feat: harden company resume, external sessions, and Office UI i18n

Improve suspend/resume identity continuity and external broker session handling, add Office UI internationalization with rebuilt assets, and expand company org configs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
小东andCursor committed 2026-07-16 09:20:40 +08:00
1 parent eb934cf2bd
commit cb6b8ed6e1
32 files changed
+2562 -446

No files matched your search

+15 -2
View File
@@ -91,6 +91,19 @@ def _ensure_aiohttp() -> None:
_pip_install(*missing)
def _run_npm(npm: str, *args: str) -> None:
"""Run npm in a way that also works when Windows resolves npm.cmd."""
cmd = [npm, *args]
if sys.platform == "win32":
npm_path = Path(npm)
npm_cmd = npm_path.with_suffix(".cmd")
if npm_path.suffix.lower() in {".cmd", ".bat"}:
cmd = [os.environ.get("COMSPEC", "cmd.exe"), "/c", npm, *args]
elif npm_cmd.exists():
cmd = [os.environ.get("COMSPEC", "cmd.exe"), "/c", str(npm_cmd), *args]
subprocess.check_call(cmd, cwd=_FRONTEND_SRC)
def _ensure_frontend() -> None:
"""Build frontend if frontend_dist is missing, empty, or stale."""
if not _frontend_needs_rebuild():
@@ -114,11 +127,11 @@ def _ensure_frontend() -> None:
node_modules = _FRONTEND_SRC / "node_modules"
if not node_modules.is_dir():
terminal_status("Installing npm dependencies")
subprocess.check_call([npm, "install"], cwd=_FRONTEND_SRC)
_run_npm(npm, "install")
# npm run build → outputs to ../frontend_dist via vite config
terminal_status("Building frontend bundle")
subprocess.check_call([npm, "run", "build"], cwd=_FRONTEND_SRC)
_run_npm(npm, "run", "build")
if _FRONTEND_DIST.is_dir() and any(_FRONTEND_DIST.iterdir()):
terminal_status("Frontend built successfully", kind="success")
@@ -1 +1 @@
.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #777;--xy-background-pattern-lines-color-default: #777;--xy-background-pattern-cross-color-default: #777;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{strokLine truncated
.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #777;--xy-background-pattern-lines-color-default: #777;--xy-background-pattern-cross-color-default: #777;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{strokLine truncated
@@ -1,167 +0,0 @@
import{g as ma,r as WM}from"./phaser-DFK5Ua9d.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();var lg={exports:{}},Mc={};var Ck;function YM(){if(Ck)return Mc;Ck=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,r,o){var a=null;if(o!==void 0&&(a=""+o),r.key!==void 0&&(a=""+r.key),"key"in r){o={};for(var c in r)c!=="key"&&(o[c]=r[c])}else o=r;return r=o.ref,{$$typeof:e,type:i,key:a,ref:r!==void 0?r:null,props:o}}return Mc.Fragment=t,Mc.jsx=n,Mc.jsxs=n,Mc}var jk;function XM(){return jk||(jk=1,lg.exports=YM()),lg.exports}var u=XM(),cg={exports:{}},St={};var Ek;function KM(){if(Ek)return St;Ek=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),g=Symbol.iterator;function x(U){return U===null||typeof U!="object"?null:(U=g&&U[g]||U["@@iterator"],typeof U=="function"?U:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,k={};function w(U,Z,F){this.props=U,this.context=Z,this.refs=k,this.updater=F||v}w.prototype.isReactComponent={},w.prototype.setState=function(U,Z){if(typeof U!="object"&&typeof U!="function"&&U!=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,U,Z,"setState")},w.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function S(){}S.prototype=w.prototype;function j(U,Z,F){this.props=U,this.context=Z,this.refs=k,this.updater=F||v}var N=j.prototype=new S;N.constructor=j,_(N,w.prototype),N.isPureReactComponent=!0;var O=Array.isArray;function R(){}var D={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function L(U,Z,F){var K=F.ref;return{$$typeof:e,type:U,key:Z,ref:K!==void 0?K:null,props:F}}function M(U,Z){return L(U.type,Z,U.props)}function A(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function B(U){var Z={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(F){return Z[F]})}var W=/\/+/g;function P(U,Z){return typeof U=="object"&&U!==null&&U.key!=null?B(""+U.key):Z.toString(36)}function G(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(R,R):(U.status="pending",U.then(function(Z){U.status==="pending"&&(U.status="fulfilled",U.value=Z)},function(Z){U.status==="pending"&&(U.status="rejected",U.reason=Z)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function $(U,Z,F,K,ee){var te=typeof U;(te==="undefined"||te==="boolean")&&(U=null);var se=!1;if(U===null)se=!0;else switch(te){case"bigint":case"string":case"number":se=!0;break;case"object":switch(U.$$typeof){case e:case t:se=!0;break;case h:return se=U._init,$(se(U._payload),Z,F,K,ee)}}if(se)return ee=ee(U),se=K===""?"."+P(U,0):K,O(ee)?(F="",se!=null&&(F=se.replace(W,"$&/")+"/"),$(ee,Z,F,"",function(ie){return ie})):ee!=null&&(A(ee)&&(ee=M(ee,F+(ee.key==null||U&&U.key===ee.key?"":(""+ee.key).replace(W,"$&/")+"/")+se)),Z.push(ee)),1;se=0;var ae=K===""?".":K+":";if(O(U))for(var ue=0;ue<U.length;ue++)K=U[ue],te=ae+P(K,ue),se+=$(K,Z,F,te,ee);else if(ue=x(U),typeof ue=="function")for(U=ue.call(U),ue=0;!(K=U.next()).done;)K=K.value,te=ae+P(K,ue++),se+=$(K,Z,F,te,ee);else if(te==="object"){if(typeof U.then=="function")return $(G(U),Z,F,K,ee);throw Z=String(U),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return se}function q(U,Z,F){if(U==null)return U;var K=[],ee=0;return $(U,K,"","",function(te){return Z.call(F,te,ee++)}),K}function Y(U){if(U._status===-1){var Z=U._result;Z=Z(),Z.then(function(F){(U._status===0||U._status===-1)&&(U._status=1,U._result=F)},function(F){(U._status===0||U._status===-1)&&(U._status=2,U._result=F)}),U._status===-1&&(U._status=0,U._result=Z)}if(U._status===1)return U._reLine truncated
at`)?" (<anonymous>)":-1<f.stack.indexOf("@")?"@unknown:0:0":""}return`
`+je+s+Te}var Ze=!1;function Xe(s,l){if(!s||Ze)return"";Ze=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var y={DetermineComponentFrameRoot:function(){try{if(l){var Ne=function(){throw Error()};if(Object.defineProperty(Ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ne,[])}catch(_e){var xe=_e}Reflect.construct(s,[],Ne)}else{try{Ne.call()}catch(_e){xe=_e}s.call(Ne.prototype)}}else{try{throw Error()}catch(_e){xe=_e}(Ne=s())&&typeof Ne.catch=="function"&&Ne.catch(function(){})}}catch(_e){if(_e&&xe&&typeof _e.stack=="string")return[_e.stack,xe.stack]}return[null,null]}};y.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(y.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(y.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var E=y.DetermineComponentFrameRoot(),H=E[0],X=E[1];if(H&&X){var re=H.split(`
`),ye=X.split(`
`);for(b=y=0;y<re.length&&!re[y].includes("DetermineComponentFrameRoot");)y++;for(;b<ye.length&&!ye[b].includes("DetermineComponentFrameRoot");)b++;if(y===re.length||b===ye.length)for(y=re.length-1,b=ye.length-1;1<=y&&0<=b&&re[y]!==ye[b];)b--;for(;1<=y&&0<=b;y--,b--)if(re[y]!==ye[b]){if(y!==1||b!==1)do if(y--,b--,0>b||re[y]!==ye[b]){var Ce=`
`+re[y].replace(" at new "," at ");return s.displayName&&Ce.includes("<anonymous>")&&(Ce=Ce.replace("<anonymous>",s.displayName)),Ce}while(1<=y&&0<=b);break}}}finally{Ze=!1,Error.prepareStackTrace=f}return(f=s?s.displayName||s.name:"")?Ge(f):""}function mt(s,l){switch(s.tag){case 26:case 27:case 5:return Ge(s.type);case 16:return Ge("Lazy");case 13:return s.child!==l&&l!==null?Ge("Suspense Fallback"):Ge("Suspense");case 19:return Ge("SuspenseList");case 0:case 15:return Xe(s.type,!1);case 11:return Xe(s.type.render,!1);case 1:return Xe(s.type,!0);case 31:return Ge("Activity");default:return""}}function Ft(s){try{var l="",f=null;do l+=mt(s,f),f=s,s=s.return;while(s);return l}catch(y){return`
Error generating stack: `+y.message+`
`+y.stack}}var Dt=Object.prototype.hasOwnProperty,jt=e.unstable_scheduleCallback,he=e.unstable_cancelCallback,ze=e.unstable_shouldYield,ot=e.unstable_requestPaint,Ve=e.unstable_now,lt=e.unstable_getCurrentPriorityLevel,me=e.unstable_ImmediatePriority,be=e.unstable_UserBlockingPriority,Ae=e.unstable_NormalPriority,Be=e.unstable_LowPriority,We=e.unstable_IdlePriority,zt=e.log,ht=e.unstable_setDisableYieldValue,ke=null,qe=null;function Qe(s){if(typeof zt=="function"&&ht(s),qe&&typeof qe.setStrictMode=="function")try{qe.setStrictMode(ke,s)}catch{}}var $e=Math.clz32?Math.clz32:ei,Fe=Math.log,Vt=Math.LN2;function ei(s){return s>>>=0,s===0?32:31-(Fe(s)/Vt|0)|0}var vt=256,bt=262144,vn=4194304;function On(s){var l=s&42;if(l!==0)return l;switch(s&-s){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 s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function wt(s,l,f){var y=s.pendingLanes;if(y===0)return 0;var b=0,E=s.suspendedLanes,H=s.pingedLanes;s=s.warmLanes;var X=y&134217727;return X!==0?(y=X&~E,y!==0?b=On(y):(H&=X,H!==0?b=On(H):f||(f=X&~s,f!==0&&(b=On(f))))):(X=y&~E,X!==0?b=On(X):H!==0?b=On(H):f||(f=y&~s,f!==0&&(b=On(f)))),b===0?0:l!==0&&l!==b&&(l&E)===0&&(E=b&-b,f=l&-l,E>=f||E===32&&(f&4194048)!==0)?l:b}function Pt(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function Hn(s,l){switch(s){case 1:case 2:case 4:case 8:case 64:return l+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 l+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 Me(){var s=vn;return vn<<=1,(vn&62914560)===0&&(vn=4194304),s}function gt(s){for(var l=[],f=0;31>f;f++)l.push(s);return l}function pt(s,l){s.pendingLanes|=l,l!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function mi(s,l,f,y,b,E){var H=s.pendingLanes;s.pendingLanes=f,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=f,s.entangledLanes&=f,s.errorRecoveryDisabledLanes&=f,s.shellSuspendCounter=0;var X=s.entanglements,re=s.expirationTimes,ye=s.hiddenUpdates;for(f=H&~f;0<f;){var Ce=31-$e(f),Ne=1<<Ce;X[Ce]=0,re[Ce]=-1;var xe=ye[Ce];if(xe!==null)for(ye[Ce]=null,Ce=0;Ce<xe.length;Ce++){var _e=xe[Ce];_e!==null&&(_e.lane&=-536870913)}f&=~Ne}y!==0&&Vn(s,y,0),E!==0&&b===0&&s.tag!==0&&(s.suspendedLanes|=E&~(H&~l))}function Vn(s,l,f){s.pendingLanes|=l,s.suspendedLanes&=~l;var y=31-$e(l);s.entangledLanes|=l,s.entanglements[y]=s.entanglements[y]|1073741824|f&261930}function pn(s,l){var f=s.entangledLanes|=l;for(s=s.entanglements;f;){var y=31-$e(f),b=1<<y;b&l|s[y]&l&&(s[y]|=l),f&=~b}}function Fn(s,l){var f=l&-l;return f=(f&42)!==0?1:tt(f),(f&(s.suspendedLanes|l))!==0?0:f}function tt(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function pi(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Si(){var s=q.p;return s!==0?s:(s=window.event,s===void 0?32:xk(s.type))}function Rn(s,l){var f=q.p;try{return q.p=s,l()}finally{q.p=f}}var wn=Math.random().toString(36).slice(2),Ht="__reactFiber$"+wn,Cn="__reactProps$"+wn,Wt="__reactContainer$"+wn,Re="__reactEvents$"+wn,kt="__reactListeners$"+wn,bn="__reactHandles$"+wn,wi="__reactResources$"+wn,In="__reactMarker$"+wn;function It(s){delete s[Ht],delete s[Cn],delete s[Re],delete s[kt],delete s[bn]}function yi(s){var l=s[Ht];if(l)return l;for(var f=s.parentNode;f;){if(l=f[Wt]||f[Ht]){if(f=l.alternate,l.child!==null||f!==null&&f.child!==null)for(s=nk(s);s!==null;){if(f=s[Ht])return f;s=nk(s)}return l}s=f,f=s.parentNode}return null}function Zn(s){if(s=s[Ht]||s[Wt]){var l=s.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return s}return null}function ti(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(i(33))}function ln(s){var l=s[wi];return l||(l=s[wi]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Yt(s){s[In]=!0}var Tt=new Set,Xt={};function Un(s,l){dn(s,l),dn(s+"Capture",l)}function dn(s,l){for(Xt[s]=l,s=0;s<l.length;s++)Tt.add(l[s])}var Je=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u2 Line truncated
`).replace(hM,"")}function q_(s,l){return l=G_(l),G_(s)===l}function kn(s,l,f,y,b,E){switch(f){case"children":typeof y=="string"?l==="body"||l==="textarea"&&y===""||nt(s,y):(typeof y=="number"||typeof y=="bigint")&&l!=="body"&&nt(s,""+y);break;case"className":Gn(s,"class",y);break;case"tabIndex":Gn(s,"tabindex",y);break;case"dir":case"role":case"viewBox":case"width":case"height":Gn(s,f,y);break;case"style":qn(s,y,E);break;case"data":if(l!=="object"){Gn(s,"data",y);break}case"src":case"href":if(y===""&&(l!=="a"||f!=="href")){s.removeAttribute(f);break}if(y==null||typeof y=="function"||typeof y=="symbol"||typeof y=="boolean"){s.removeAttribute(f);break}y=Vi(""+y),s.setAttribute(f,y);break;case"action":case"formAction":if(typeof y=="function"){s.setAttribute(f,"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 E=="function"&&(f==="formAction"?(l!=="input"&&kn(s,l,"name",b.name,b,null),kn(s,l,"formEncType",b.formEncType,b,null),kn(s,l,"formMethod",b.formMethod,b,null),kn(s,l,"formTarget",b.formTarget,b,null)):(kn(s,l,"encType",b.encType,b,null),kn(s,l,"method",b.method,b,null),kn(s,l,"target",b.target,b,null)));if(y==null||typeof y=="symbol"||typeof y=="boolean"){s.removeAttribute(f);break}y=Vi(""+y),s.setAttribute(f,y);break;case"onClick":y!=null&&(s.onclick=Ui);break;case"onScroll":y!=null&&Gt("scroll",s);break;case"onScrollEnd":y!=null&&Gt("scrollend",s);break;case"dangerouslySetInnerHTML":if(y!=null){if(typeof y!="object"||!("__html"in y))throw Error(i(61));if(f=y.__html,f!=null){if(b.children!=null)throw Error(i(60));s.innerHTML=f}}break;case"multiple":s.multiple=y&&typeof y!="function"&&typeof y!="symbol";break;case"muted":s.muted=y&&typeof y!="function"&&typeof y!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(y==null||typeof y=="function"||typeof y=="boolean"||typeof y=="symbol"){s.removeAttribute("xlink:href");break}f=Vi(""+y),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":y!=null&&typeof y!="function"&&typeof y!="symbol"?s.setAttribute(f,""+y):s.removeAttribute(f);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":y&&typeof y!="function"&&typeof y!="symbol"?s.setAttribute(f,""):s.removeAttribute(f);break;case"capture":case"download":y===!0?s.setAttribute(f,""):y!==!1&&y!=null&&typeof y!="function"&&typeof y!="symbol"?s.setAttribute(f,y):s.removeAttribute(f);break;case"cols":case"rows":case"size":case"span":y!=null&&typeof y!="function"&&typeof y!="symbol"&&!isNaN(y)&&1<=y?s.setAttribute(f,y):s.removeAttribute(f);break;case"rowSpan":case"start":y==null||typeof y=="function"||typeof y=="symbol"||isNaN(y)?s.removeAttribute(f):s.setAttribute(f,y);break;case"popover":Gt("beforetoggle",s),Gt("toggle",s),An(s,"popover",y);break;case"xlinkActuate":jn(s,"http://www.w3.org/1999/xlink","xlink:actuate",y);break;case"xlinkArcrole":jn(s,"http://www.w3.org/1999/xlink","xlink:arcrole",y);break;case"xlinkRole":jn(s,"http://www.w3.org/1999/xlink","xlink:role",y);break;case"xlinkShow":jn(s,"http://www.w3.org/1999/xlink","xlink:show",y);break;case"xlinkTitle":jn(s,"http://www.w3.org/1999/xlink","xlink:title",y);break;case"xlinkType":jn(s,"http://www.w3.org/1999/xlink","xlink:type",y);break;case"xmlBase":jn(s,"http://www.w3.org/XML/1998/namespace","xml:base",y);break;case"xmlLang":jn(s,"http://www.w3.org/XML/1998/namespace","xml:lang",y);break;case"xmlSpace":jn(s,"http://www.w3.org/XML/1998/namespace","xml:space",y);break;case"is":An(s,"is",y);break;case"innerText":case"textContent":break;default:(!(2<f.length)||f[0]!=="o"&&f[0]!=="O"||f[1]!=="n"&&f[1]!=="N")&&(f=nn.get(f)||f,An(s,f,y))}}function Uh(s,l,f,y,b,E){switch(f){case"style":qn(s,y,E);break;case"dangerouslySetInnerHTML":if(y!=null){if(typeof y!="object"||!("__html"in y))throw Error(i(61));if(f=y.__html,f!=null){if(b.children!=null)throw Error(i(60));s.innerHTML=f}}break;case"children":typeof y=="string"?nt(s,y):(typeof y=="number"||typeof y=="bigint")&&nt(s,""+y);break;case"onScroll":y!=null&&Gt("scroll",s);break;case"onScrollEnd":y!=null&&Gt("scrollend",s);break;case"onClick":y!=null&&(s.onclick=Ui);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"inne Line truncated
`),ae=p.map(([ue,ie])=>` [${ue}, ${ie}],`).join(`
`);return`const MAP_STR: string[] = [
${se}
]
const SEATS: [number, number][] = [
${ae}
]`})(),Z=()=>R(te=>Math.min(te+.25,3)),F=()=>R(te=>Math.max(te-.25,.5)),K=m.flat().filter(te=>te===1).length,ee=m.flat().filter(te=>te===0).length;return u.jsxs("div",{className:"collision-editor",children:[u.jsxs("div",{className:"ce-toolbar",children:[u.jsxs("div",{className:"ce-toolbar-group",children:[u.jsx("span",{className:"ce-title",children:"Map Editor"}),u.jsx("select",{className:"ce-office-select",value:a,onChange:te=>A(te.target.value),children:r.map(te=>u.jsx("option",{value:te.id,children:te.name},te.id))})]}),u.jsxs("div",{className:"ce-toolbar-group",children:[u.jsxs("button",{className:`ce-mode-btn ${x==="wall"?"active wall":""}`,onClick:()=>v("wall"),children:[u.jsx("span",{className:"ce-mode-dot wall"})," Wall"]}),u.jsxs("button",{className:`ce-mode-btn ${x==="floor"?"active floor":""}`,onClick:()=>v("floor"),children:[u.jsx("span",{className:"ce-mode-dot floor"})," Floor"]}),u.jsxs("button",{className:`ce-mode-btn ${x==="seat"?"active seat":""}`,onClick:()=>v("seat"),children:[u.jsx("span",{className:"ce-mode-dot seat"})," Seat"]})]}),u.jsxs("div",{className:"ce-toolbar-group",children:[u.jsx("button",{className:"ce-btn",onClick:F,children:"-"}),u.jsxs("span",{className:"ce-zoom-label",children:[Math.round(O*100),"%"]}),u.jsx("button",{className:"ce-btn",onClick:Z,children:"+"}),u.jsx("button",{className:`ce-btn${D?" active":""}`,onClick:()=>I(te=>!te),children:"Grid"})]}),u.jsxs("div",{className:"ce-toolbar-group",children:[u.jsx("button",{className:`ce-btn apply${j?" success":""}`,onClick:Y,children:j?"Applied":"Apply"}),u.jsx("button",{className:`ce-btn${w?" active":""}`,onClick:Q,children:"Export"}),u.jsx("button",{className:"ce-btn danger",onClick:V,children:"Reset"})]}),u.jsxs("div",{className:"ce-toolbar-group ce-stats",children:[u.jsxs("span",{children:["Walls: ",K]}),u.jsxs("span",{children:["Floor: ",ee]}),u.jsxs("span",{children:["Seats: ",p.length]})]})]}),u.jsxs("div",{className:"ce-body",children:[u.jsx("div",{className:"ce-canvas-wrap",style:{overflow:"auto"},children:u.jsx("canvas",{ref:t,style:{width:L*T*O,height:M*T*O,imageRendering:"pixelated",cursor:x==="seat"?"crosshair":"cell"},onMouseDown:G,onMouseMove:$,onMouseUp:q,onMouseLeave:q})}),w&&u.jsxs("div",{className:"ce-export-panel",children:[u.jsxs("div",{className:"ce-export-header",children:[u.jsx("span",{children:"Export — copy to source code"}),u.jsx("button",{className:"ce-btn",onClick:()=>navigator.clipboard.writeText(U),children:"Copy"})]}),u.jsx("textarea",{className:"ce-export-textarea",value:U,readOnly:!0,rows:20})]})]})]})}let l4=0;function gi(e,t,n={}){return{event_id:`test-${++l4}`,type:e,agent_id:t,data:n,timestamp:Date.now()/1e3}}function Pn(e){return new Promise(t=>setTimeout(t,e))}async function c4(e){const t=[],n=e.getScene();if(!n)return t.push({name:"scene-ready",pass:!1,detail:"OfficeScene not initialized"}),t;console.log("%c[EventTest] Starting full event test suite (multi-office)...","color: #6366f1; font-weight: bold");for(const A of[...n.agents.keys()])n.removeAgent(A);await Pn(100);const i=Kn();t.push({name:"offices-loaded",pass:i.length>=3,detail:`${i.length} offices loaded: ${i.map(A=>A.name).join(", ")}`});const r=["agent-A","agent-B","agent-C","agent-D","agent-E","agent-F"];for(const A of r)e.pushEvent(gi("agent_active",A));await Pn(300);const o=new Set;let a=!1;for(const A of r){const B=n.getAgent(A);B&&B.seatId&&(o.has(B.seatId)&&(a=!0),o.add(B.seatId))}t.push({name:"desk-assignment-unique",pass:!a&&o.size===r.length,detail:`Assigned ${o.size} unique seats to ${r.length} agents. IDs: [${[...o].join(", ")}]`});const c=r.every(A=>n.getAgent(A)?.officeId!=null);t.push({name:"agents-have-officeId",pass:c,detail:r.map(A=>`${A}=${n.getAgent(A)?.officeId}`).join(", ")}),e.pushEvent(gi("tool_start","agent-A",{tool_name:"shell"})),await Pn(200);const d=n.getAgent("agent-A");t.push({name:"tool_start-state",pass:d.isActive===!0&&d.currentTool==="shell",detail:`isActive=${d.isActive}, currentTool=${d.currentTool}`}),e.pushEvent(gi("tool_done","agent-A",{tool_name:"shell"})),await Pn(100),t.push({name:"tool_done-celebrate",pass:d.agentState==="celebrate",detail:`state=${d.agentState}`});for(let A=0;A<20&&d.agentState==="celebrate";A++)await Pn(500);t.push({name:"celebrate-to-idle",pass:d.agentState!=="celebrate",detail:`state=${d.agentState}`}),e.pushEvent(gi("waiting","agent-B")),await Pn(200);const m=n.getAgent("agent-B");t.push({name:"waiting-state",pass:m.isActive===!1&&(m.agentState==="walk"||m.agentState==="idle"||m.agentState==="coffee"),detail:`isActive=${m.isActive}, state=${m.agentState}`}),e.pushEvent(gi("reflect_start","agent-C")),await Pn(200);const h=n.getAgent("agent-C");t.push({name:"reflect_start-state",pass:h.currentTool==="Reflect"&&(h.agentState==="walk"||h.agentState==="reflect"),detail:`currentTool=${h.currentTool}, state=${h.agentState}`}),e.pushEvent(gi("reflect_done","agent-C")),await Pn(100),t.push({name:"reflect_done-celebrate",pass:h.agentState==="celebrate",detail:`staLine truncated
font-size: .6rem;
font-weight: bold;
color: hsl(${Math.max(0,Math.min(120-120*k,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(o&&n.skipInitialOnChange)&&n.onChange(r),o=!1,r}return a.updateDeps=c=>{i=c},a}function Jk(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const v4=(e,t)=>Math.abs(e-t)<1.01,b4=(e,t,n)=>{let i;return function(...r){e.clearTimeout(i),i=e.setTimeout(()=>t.apply(this,r),n)}},eS=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},_4=e=>e,k4=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),i=[];for(let r=t;r<=n;r++)i.push(r);return i},S4=(e,t)=>{const n=e.scrollElement;if(!n)return;const i=e.targetWindow;if(!i)return;const r=a=>{const{width:c,height:d}=a;t({width:Math.round(c),height:Math.round(d)})};if(r(eS(n)),!i.ResizeObserver)return()=>{};const o=new i.ResizeObserver(a=>{const c=()=>{const d=a[0];if(d?.borderBoxSize){const m=d.borderBoxSize[0];if(m){r({width:m.inlineSize,height:m.blockSize});return}}r(eS(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},tS={passive:!0},nS=typeof window>"u"?!0:"onscrollend"in window,w4=(e,t)=>{const n=e.scrollElement;if(!n)return;const i=e.targetWindow;if(!i)return;let r=0;const o=e.options.useScrollendEvent&&nS?()=>{}:b4(i,()=>{t(r,!1)},e.options.isScrollingResetDelay),a=h=>()=>{const{horizontal:p,isRtl:g}=e.options;r=p?n.scrollLeft*(g&&-1||1):n.scrollTop,o(),t(r,h)},c=a(!0),d=a(!1);n.addEventListener("scroll",c,tS);const m=e.options.useScrollendEvent&&nS;return m&&n.addEventListener("scrollend",d,tS),()=>{n.removeEventListener("scroll",c),m&&n.removeEventListener("scrollend",d)}},C4=(e,t,n)=>{if(t?.borderBoxSize){const i=t.borderBoxSize[0];if(i)return Math.round(i[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},j4=(e,{adjustments:t=0,behavior:n},i)=>{var r,o;const a=e+t;(o=(r=i.scrollElement)==null?void 0:r.scrollTo)==null||o.call(r,{[i.options.horizontal?"left":"top"]:a,behavior:n})};class E4{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var n,i,r;return((r=(i=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:i.now)==null?void 0:r.call(i))??Date.now()},this.observer=(()=>{let n=null;const i=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(r=>{r.forEach(o=>{const a=()=>{const c=o.target,d=this.indexFromElement(c);if(!c.isConnected){this.observer.unobserve(c);return}this.shouldMeasureDuringScroll(d)&&this.resizeItem(d,this.options.measureElement(c,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var r;(r=i())==null||r.disconnect(),n=null},observe:r=>{var o;return(o=i())==null?void 0:o.observe(r,{box:"border-box"})},unobserve:r=>{var o;return(o=i())==null?void 0:o.unobserve(r)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([i,r])=>{typeof r>"u"&&delete n[i]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:_4,rangeExtractor:k4,onChange:()=>{},measureElement:C4,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var i,r;(r=(i=this.options).onChange)==null||r.call(i,this,n)},this.maybeNotify=Za(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(r=>{this.observer.observe(r)} Line truncated
`).replace(/\r/g,`
`).split(`
`).map(i=>i.trimEnd()).join(`
`).replace(/\n{3,}/g,`
`).trim();for(;;){const i=t.match(/^\*\*([^\r\n]{8,160}?)\*\*:(?:[ \t]+|\r?\n+)([\s\S]+)$/);if(!i)break;const r=i[2].trim();if(r.length<80||r===t)break;t=r}const n=t.split(/\n{2,}/).map(i=>i.trim()).filter(Boolean);return n.length>1&&/^Verification:\s/i.test(n[n.length-1])&&(t=n.slice(0,-1).join(`
`).trim()),e5(t).slice(0,2e3)}function $x(e){const t=e.metadata??{};switch(String(t.transcript_kind??t.kind??"").trim()){case"child_task_result":return 80;case"child_task_result_retry":return 79;case"company_role_result":return 75;case"company_role_result_retry":return 74;case"child_result":return 70;case"runtime_v2_assistant":return 60;case"runtime_v2_company_assistant":return 20;case"top_level_reply":return 40}return String(t.kind??"").trim()==="worker_notification"?20:0}function aS(e){return String(e.content??"").replace(/\r\n/g,`
`).replace(/\r/g,`
`).split(`
`).map(t=>t.trimEnd()).join(`
`).trim().length}function lS(e){const t=e.metadata??{};let n=0;return String(t.source??"").trim()==="engine"&&(n+=4),String(t.source_result_message_id??"").trim()&&(n+=2),(t.authoritative_output===!0||t.canonical_result===!0)&&(n+=1),n}function n5(e,t){const n=[[$x(e),$x(t)],[lS(e),lS(t)],[aS(e),aS(t)]];for(const[o,a]of n)if(o!==a)return o>a?1:-1;const i=e.id.localeCompare(t.id);if(i!==0)return i;const r=e.content.localeCompare(t.content);return r!==0?r:e.timestamp===t.timestamp?0:e.timestamp>t.timestamp?1:-1}function dE(e){if($x(e)<=0)return"";const t=uE(e);if(t)return`result:${t}`;const n=t5(e.content);return n?`result:${n}`:""}function tf(e){if(!e)return;const t=e.replace(/,/g,"").trim();if(!t)return;const n=Number(t);return Number.isFinite(n)?Math.max(0,Math.round(n)):void 0}function cS(e){if(!(typeof e!="number"||!Number.isFinite(e)))return Math.max(0,Math.min(Math.round(e),100))}function kl(e){if(!e)return;const t=String(e.execMode??"").trim();if(!(t==="company"||t==="org"||t==="custom"||!!e.isCompanyRuntime||!!e.roleWorkItems||!!e.executorRoleWorkItems))return;const i=Object.values(e.executorRoleWorkItems??e.roleWorkItems??{});if(i.length===0)return;const r=i.map(o=>o.aggregatedStatus);if(r.some(o=>o==="active"))return"running";if(r.some(o=>o==="waiting")||r.some(o=>o==="pending"))return"pending";if(r.every(o=>o==="failed"))return"failed";if(r.every(o=>o==="done")||r.some(o=>o==="done"))return"done"}function i5(e){const t={};for(const n of e??[]){const i=`${n.summary??""} ${n.detail??""}`.trim();if(!i)continue;const r=Z4.exec(i);if(r){const c=tf(r[1]),d=tf(r[2]);typeof c=="number"&&(t.contextTokens=c),typeof d=="number"&&d>0&&(t.contextWindow=d)}const o=J4.exec(i);if(o){t.contextRemainingPct=cS(tf(o[1]));continue}const a=Q4.exec(i);if(a){const c=cS(tf(a[1]));typeof c=="number"&&(t.contextRemainingPct=100-c)}}return t}function qf(e){const t=i5(e.progressLog),n=e.contextTokens??t.contextTokens,i=e.contextWindow??t.contextWindow,r=e.contextRemainingPct??t.contextRemainingPct;return n===e.contextTokens&&i===e.contextWindow&&r===e.contextRemainingPct?e:{...e,contextTokens:n,contextWindow:i,contextRemainingPct:r}}function fE(e){const t=new Set,n=[];for(const i of e)t.has(i.taskId)||(t.add(i.taskId),n.push(i));return n}function r5(e){return!!(String(e?.workItemRoleId??"").trim()||String(e?.workItemRoleName??"").trim())}function Af(e,t){if(!e||e.mode==="child")return[];const n=new Set;e.sessionId&&n.add(e.sessionId),n.add(e.taskId);const i=String(e.originTaskId??e.taskId??"").trim(),r=new Map;for(const c of e.workItemLog??[]){const d=c.executionTurnId||c.runtimeTaskId;d&&!r.has(d)&&r.set(d,r.size)}const o=new Set;return t.filter(c=>{if(c.taskId===e.taskId||o.has(c.taskId))return!1;const d=!!c.parentSessionId&&n.has(c.parentSessionId),m=r.has(c.taskId),h=!!i&&String(c.originTaskId??"").trim()===i;return!d&&!m&&!h?!1:(o.add(c.taskId),!0)}).sort((c,d)=>{const m=r.get(c.taskId),h=r.get(d.taskId);return m!=null&&h!=null&&m!==h?m-h:m!=null&&h==null?-1:m==null&&h!=null?1:d.updatedAt-c.updatedAt})}function uS(e,t){const n=Af(e,t);return!e||e.mode==="child"||!r5(e)?n:fE([e,...n])}function Wf(e,t){if(!e||e.mode==="child")return[];const n=String(e.sessionId??"").trim();if(!n)return[];const i=new Set;return t.filter(r=>r.taskId===e.taskId||i.has(r.taskId)||String(r.sessionId??"").trim()!==n?!1:(i.add(r.taskId),!0)).sort((r,o)=>o.updatedAt-r.updatedAt)}function s5(e){const t=String(e?.execMode??"").trim();return t==="company"||t==="org"||t==="custom"}function dS(e){const t=ss(e)?1e9:0,n=String(e.draftAssistantText??"").trim()?1e10:0,i=Math.max(0,e.messageCount??0)*1e4,r=(e.progressLog?.length??0)*100;return n+t+i+r+e.updatedAt}function fS(e){const t=cE(e),n=ss(e)?1e11:0,i=String(e.draftAssistantText??"").trim()?1e10:0,r=typeof t.usedPct=="number"||typeof t.usedTokens=="number"||typeof t.windowTokens=="number"?1e10:0,o=typeof e.inputTokens=="number"||typeof e.outputTokens=="number"||typeof e.totalTokens=="number"?1e9:0,a=Math.max(0,e.messageCount??0)*1e4,c=(e.progressLog?.length??0)*100;return n+i+r+o+a+c}function Yf(e,t){if(!e)return{timelineSessions:[],displaySession:null,runtimeSession:null,projectedFromChild:!1};const n=qf(e);if(e.mode==="child"||t.length===0)return{timelineSessions:[n],displaySession:n,runtimeSession:n,projectedFromChild:!1};const i=t.map(qf),r=i.filter(p=>p.status!=="cancelled"),o=r.length>0?r:i,a=fE([n,...o]),c=s5(e),d=[...a].sort((p,g)=>dS(g)-dS(p))[0]??n,m=c?n:d,h=[...a].sort((p,g)=>fS(g)-fS(p))[0]??m;return{timelineSessions:a,displaySession:m,runtimeSession:h,projectedFromChild:!c&&m.taskId!==e.taskId}}function mS(e,t,n){if(!e)return null;const i=qf(e),r=t??i,o=kl(r)??kl(i),a=Xf(n.length>0?n:[i]);return{...i,status:o??(r.status||i.status),assigneeIds:r.assigneeIds.length>0?r.assigneeIds:i.assigneeIds,agentStatus:r.agentStatus??i.agentStatus,currentTool:r.currentTool??i.currentTool,displayTool:r.displayTool??r.currentTool??i.displayTool??i.currentTool,toolElapsedMs:r.toolElapsedMs??i.toolElapsed Line truncated
The error may be correlated with this previous error:
${te.current.stack}
`),je}Kf(()=>{te.current=void 0,F.current=void 0,U.current=ue});const ie=C.useMemo(()=>C.createElement(k,{...ue,ref:L}),[L,k,ue]);return C.useMemo(()=>v?C.createElement(A.Provider,{value:V},ie):ie,[A,ie,V])}const R=C.memo(N);if(R.WrappedComponent=k,R.displayName=N.displayName=S,d){const I=C.forwardRef(function(M,A){return C.createElement(R,{...M,reactReduxForwardedRef:A})});return I.displayName=S,I.WrappedComponent=k,Vx(I,k)}return Vx(R,k)}}var kE=hD;function gD(e){const{children:t,context:n,serverState:i,store:r}=e,o=C.useMemo(()=>{const d=vE(r);return{store:r,subscription:d,getServerState:i?()=>i:void 0}},[r,i]),a=C.useMemo(()=>r.getState(),[r]);Kf(()=>{const{subscription:d}=o;return d.onStateChange=d.notifyNestedSubs,d.trySubscribe(),a!==r.getState()&&d.notifyNestedSubs(),()=>{d.tryUnsubscribe(),d.onStateChange=void 0}},[o,a]);const c=n||_E;return C.createElement(c.Provider,{value:o},t)}var yD=gD,xD="Invariant failed";function vD(e,t){throw new Error(xD)}var $r=function(t){var n=t.top,i=t.right,r=t.bottom,o=t.left,a=i-o,c=r-n,d={top:n,right:i,bottom:r,left:o,width:a,height:c,x:o,y:n,center:{x:(i+o)/2,y:(r+n)/2}};return d},Uv=function(t,n){return{top:t.top-n.top,left:t.left-n.left,bottom:t.bottom+n.bottom,right:t.right+n.right}},IS=function(t,n){return{top:t.top+n.top,left:t.left+n.left,bottom:t.bottom-n.bottom,right:t.right-n.right}},bD=function(t,n){return{top:t.top+n.y,left:t.left+n.x,bottom:t.bottom+n.y,right:t.right+n.x}},jg={top:0,right:0,bottom:0,left:0},Gv=function(t){var n=t.borderBox,i=t.margin,r=i===void 0?jg:i,o=t.border,a=o===void 0?jg:o,c=t.padding,d=c===void 0?jg:c,m=$r(Uv(n,r)),h=$r(IS(n,a)),p=$r(IS(h,d));return{marginBox:m,borderBox:$r(n),paddingBox:h,contentBox:p,margin:r,border:a,padding:d}},jr=function(t){var n=t.slice(0,-2),i=t.slice(-2);if(i!=="px")return 0;var r=Number(n);return isNaN(r)&&vD(),r},_D=function(){return{x:window.pageXOffset,y:window.pageYOffset}},Zf=function(t,n){var i=t.borderBox,r=t.border,o=t.margin,a=t.padding,c=bD(i,n);return Gv({borderBox:c,border:r,margin:o,padding:a})},Qf=function(t,n){return n===void 0&&(n=_D()),Zf(t,n)},SE=function(t,n){var i={top:jr(n.marginTop),right:jr(n.marginRight),bottom:jr(n.marginBottom),left:jr(n.marginLeft)},r={top:jr(n.paddingTop),right:jr(n.paddingRight),bottom:jr(n.paddingBottom),left:jr(n.paddingLeft)},o={top:jr(n.borderTopWidth),right:jr(n.borderRightWidth),bottom:jr(n.borderBottomWidth),left:jr(n.borderLeftWidth)};return Gv({borderBox:t,margin:i,padding:r,border:o})},wE=function(t){var n=t.getBoundingClientRect(),i=window.getComputedStyle(t);return SE(n,i)},yu=function(t){var n=[],i=null,r=function(){for(var a=arguments.length,c=new Array(a),d=0;d<a;d++)c[d]=arguments[d];n=c,!i&&(i=requestAnimationFrame(function(){i=null,t.apply(void 0,n)}))};return r.cancel=function(){i&&(cancelAnimationFrame(i),i=null)},r};function Jf(){return Jf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Jf.apply(null,arguments)}function CE(e,t){}CE.bind(null,"warn");CE.bind(null,"error");function _o(){}function kD(e,t){return{...e,...t}}function Tr(e,t,n){const i=t.map(r=>{const o=kD(n,r.options);return e.addEventListener(r.eventName,r.fn,o),function(){e.removeEventListener(r.eventName,r.fn,o)}});return function(){i.forEach(o=>{o()})}}const SD="Invariant failed";class em extends Error{}em.prototype.toString=function(){return this.message};function Oe(e,t){throw new em(SD)}let wD=class extends Nt.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=_o,this.onWindowError=n=>{const i=this.getCallbacks();i.isDragging()&&i.tryAbort(),n.error instanceof em&&n.preventDefault()},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return this.callbacks},this.setCallbacks=n=>{this.callbacks=n}}componentDidMount(){this.unbind=Tr(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof em){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}};const CD=`
Press space bar to start a drag.
When dragging you can use the arrow keys to move the item around and escape to cancel.
Some screen readers may require you to be in focus mode or to use your pass through key
`,tm=e=>e+1,jD=e=>`
You have lifted an item in position ${tm(e.source.index)}
`,jE=(e,t)=>{const n=e.droppableId===t.droppableId,i=tm(e.index),r=tm(t.index);return n?`
You have moved the item from position ${i}
to position ${r}
`:`
You have moved the item from position ${i}
in list ${e.droppableId}
to list ${t.droppableId}
in position ${r}
`},EE=(e,t,n)=>t.droppableId===n.droppableId?`
The item ${e}
has been combined with ${n.draggableId}`:`
The item ${e}
in list ${t.droppableId}
has been combined with ${n.draggableId}
in list ${n.droppableId}
`,ED=e=>{const t=e.destination;if(t)return jE(e.source,t);const n=e.combine;return n?EE(e.draggableId,e.source,n):"You are over an area that cannot be dropped on"},TS=e=>`
The item has returned to its starting position
of ${tm(e.index)}
`,ND=e=>{if(e.reason==="CANCEL")return`
Movement cancelled.
${TS(e.source)}
`;const t=e.destination,n=e.combine;return t?`
You have dropped the item.
${jE(e.source,t)}
`:n?`
You have dropped the item.
${EE(e.draggableId,e.source,n)}
`:`
The item has been dropped while not over a drop area.
${TS(e.source)}
`},Mf={dragHandleUsageInstructions:CD,onDragStart:jD,onDragUpdate:ED,onDragEnd:ND};function ID(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function NE(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!ID(e[n],t[n]))return!1;return!0}function rn(e,t){const n=C.useState(()=>({inputs:t,result:e()}))[0],i=C.useRef(!0),r=C.useRef(n),a=i.current||!!(t&&r.current.inputs&&NE(t,r.current.inputs))?r.current:{inputs:t,result:e()};return C.useEffect(()=>{i.current=!1,r.current=a},[a]),a.result}function it(e,t){return rn(()=>e,t)}const ki={x:0,y:0},Ti=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),fr=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),ko=(e,t)=>e.x===t.x&&e.y===t.y,Fl=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),aa=(e,t,n=0)=>e==="x"?{x:t,y:n}:{x:n,y:t},xu=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),RS=(e,t)=>Math.min(...t.map(n=>xu(e,n))),IE=e=>t=>({x:e(t.x),y:e(t.y)});var TD=(e,t)=>{const n=$r({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return n.width<=0||n.height<=0?null:n};const zu=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),AS=e=>[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}],RD={top:0,right:0,bottom:0,left:0},AD=(e,t)=>t?zu(e,t.scroll.diff.displacement):e,MD=(e,t,n)=>n&&n.increasedBy?{...e,[t.end]:e[t.end]+n.increasedBy[t.line]}:e,DD=(e,t)=>t&&t.shouldClipSubject?TD(t.pageMarginBox,e):$r(e);var Sl=({page:e,withPlaceholder:t,axis:n,frame:i})=>{const r=AD(e.marginBox,i),o=MD(r,n,t),a=DD(o,i);return{page:e,withPlaceholder:t,active:a}},qv=(e,t)=>{e.frame||Oe();const n=e.frame,i=fr(t,n.scroll.initial),r=Fl(i),o={...n,scroll:{initial:n.scroll.initial,current:t,diff:{value:i,displacement:r},max:n.scroll.max}},a=Sl({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:o});return{...e,frame:o,subject:a}};function _i(e,t=NE){let n=null;function i(...r){if(n&&n.lastThis===this&&t(r,n.lastArgs))return n.lastResult;const o=e.apply(this,r);return n={lastResult:o,lastArgs:r,lastThis:this},o}return i.clear=function(){n=null},i}const TE=_i(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),RE=_i(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),Lm=_i(e=>Object.values(e)),OD=_i(e=>Object.values(e));var Vl=_i((e,t)=>OD(t).filter(i=>e===i.descriptor.droppableId).sort((i,r)=>i.descriptor.index-r.descriptor.index));function Wv(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function zm(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var Pm=_i((e,t)=>t.filter(n=>n.descriptor.id!==e.descriptor.id)),LD=({isMovingForward:e,draggable:t,destination:n,insideDestination:i,previousImpact:r})=>{if(!n.isCombineEnabled||!Wv(r))return null;function a(x){const v={type:"COMBINE",combine:{draggableId:x,droppableId:n.descriptor.id}};return{...r,at:v}}const c=r.displaced.all,d=c.length?c[0]:null;if(e)return d?a(d):null;const m=Pm(t,i);if(!d){if(!m.length)return null;const x=m[m.length-1];return a(x.descriptor.id)}const h=m.findIndex(x=>x.descriptor.id===d);h===-1&&Oe();const p=h-1;if(p<0)return null;const g=m[p];return a(g.descriptor.id)},Ul=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const AE={point:ki,value:0},vu={invisible:{},visible:{},all:[]},zD={displaced:vu,displacedBy:AE,at:null};var Rr=(e,t)=>n=>e<=n&&n<=t,ME=e=>{const t=Rr(e.top,e.bottom),n=Rr(e.left,e.right);return i=>{if(t(i.top)&&t(i.bottom)&&n(i.left)&&n(i.right))return!0;const o=t(i.top)||t(i.bottom),a=n(i.left)||n(i.right);if(o&&a)return!0;const d=i.top<e.top&&i.bottom>e.bottom,m=i.left<e.left&&i.right>e.right;return d&&m?!0:d&&a||m&&o}},PD=e=>{const t=Rr(e.top,e.bottom),n=Rr(e.left,e.right);return i=>t(i.top)&&t(i.bottom)&&n(i.left)&&n(i.right)};const Yv={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},DE={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var BD=e=>t=>{const n=Rr(t.top,t.bottom),i=Rr(t.left,t.right);return r=>e===Yv?n(r.top)&&n(r.bottom):i(r.left)&&i(r.right)};const $D=(e,t)=>{const n=t.frame?t.frame.scroll.diff.displacement:ki;return zu(e,n)},HD=(e,t,n)=>t.subject.active?n(t.subject.active)(e):!1,FD=(e,t,n)=>n(t)(e),Xv=({target:e,destination:t,viewport:n,withDroppableDisplacement:i,isVisibleThroughFrameFn:r})=>{const o=i?$D(e,t):e;return HD(o,t,r)&&FD(o,n,r)},VD=e=>Xv({...e,isVisibleThroughFrameFn:ME}),OE=e=>Xv({...e,isVisibleThroughFrameFn:PD}),UD=e=>Xv({...e,isVisibleThroughFrameFn:BD(e.destination.axis)}),GD=(e,t,n)=>{if(typeof n=="boolean")return n;if(!t)return!0;const{invisible:i,visible:r}=t;if(i[e])return!1;const o=r[e];return o?o.shouldAnimate:!0};function qD(e,t){const n=e.page.marginBox,i={top:t.point.y,right:0,bottom:0,left:t.point.x};return $r(Uv(n,i))}function bu({afterDragging:e,destination:t,displacedBy:n,viewport:i,forceShouldAnimate:r,la Line truncated
cursor: -webkit-grab;
cursor: grab;
`;return{selector:t(Cl.contextId),styles:{always:`
-webkit-touch-callout: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
touch-action: manipulation;
`,resting:c,dragging:WL,dropAnimating:c}}})(),i=(()=>{const c=`
transition: ${au.outOfTheWay};
`;return{selector:t(Yx.contextId),styles:{dragging:c,dropAnimating:c,userCancel:c}}})(),r={selector:t(GL.contextId),styles:{always:"overflow-anchor: none;"}},a=[i,n,r,{selector:"body",styles:{dragging:`
cursor: grabbing;
cursor: -webkit-grabbing;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
overflow-anchor: none;
`}}];return{always:Pc(a,"always"),resting:Pc(a,"resting"),dragging:Pc(a,"dragging"),dropAnimating:Pc(a,"dropAnimating"),userCancel:Pc(a,"userCancel")}};const pr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?C.useLayoutEffect:C.useEffect,Rg=()=>{const e=document.querySelector("head");return e||Oe(),e},qS=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function XL(e,t){const n=rn(()=>YL(e),[e]),i=C.useRef(null),r=C.useRef(null),o=it(_i(p=>{const g=r.current;g||Oe(),g.textContent=p}),[]),a=it(p=>{const g=i.current;g||Oe(),g.textContent=p},[]);pr(()=>{!i.current&&!r.current||Oe();const p=qS(t),g=qS(t);return i.current=p,r.current=g,p.setAttribute(`${wl}-always`,e),g.setAttribute(`${wl}-dynamic`,e),Rg().appendChild(p),Rg().appendChild(g),a(n.always),o(n.resting),()=>{const x=v=>{const _=v.current;_||Oe(),Rg().removeChild(_),v.current=null};x(i),x(r)}},[t,a,o,n.always,n.resting,e]);const c=it(()=>o(n.dragging),[o,n.dragging]),d=it(p=>{if(p==="DROP"){o(n.dropAnimating);return}o(n.userCancel)},[o,n.dropAnimating,n.userCancel]),m=it(()=>{r.current&&o(n.resting)},[o,n.resting]);return rn(()=>({dragging:c,dropping:d,resting:m}),[c,d,m])}function lN(e,t){return Array.from(e.querySelectorAll(t))}var cN=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function $m(e){return e instanceof cN(e).HTMLElement}function KL(e,t){const n=`[${Cl.contextId}="${e}"]`,i=lN(document,n);if(!i.length)return null;const r=i.find(o=>o.getAttribute(Cl.draggableId)===t);return!r||!$m(r)?null:r}function ZL(e){const t=C.useRef({}),n=C.useRef(null),i=C.useRef(null),r=C.useRef(!1),o=it(function(g,x){const v={id:g,focus:x};return t.current[g]=v,function(){const k=t.current;k[g]!==v&&delete k[g]}},[]),a=it(function(g){const x=KL(e,g);x&&x!==document.activeElement&&x.focus()},[e]),c=it(function(g,x){n.current===g&&(n.current=x)},[]),d=it(function(){i.current||r.current&&(i.current=requestAnimationFrame(()=>{i.current=null;const g=n.current;g&&a(g)}))},[a]),m=it(function(g){n.current=null;const x=document.activeElement;x&&x.getAttribute(Cl.draggableId)===g&&(n.current=g)},[]);return pr(()=>(r.current=!0,function(){r.current=!1;const g=i.current;g&&cancelAnimationFrame(g)}),[]),rn(()=>({register:o,tryRecordFocus:m,tryRestoreFocusRecorded:d,tryShiftRecord:c}),[o,m,d,c])}function QL(){const e={draggables:{},droppables:{}},t=[];function n(p){return t.push(p),function(){const x=t.indexOf(p);x!==-1&&t.splice(x,1)}}function i(p){t.length&&t.forEach(g=>g(p))}function r(p){return e.draggables[p]||null}function o(p){const g=r(p);return g||Oe(),g}const a={register:p=>{e.draggables[p.descriptor.id]=p,i({type:"ADDITION",value:p})},update:(p,g)=>{const x=e.draggables[g.descriptor.id];x&&x.uniqueId===p.uniqueId&&(delete e.draggables[g.descriptor.id],e.draggables[p.descriptor.id]=p)},unregister:p=>{const g=p.descriptor.id,x=r(g);x&&p.uniqueId===x.uniqueId&&(delete e.draggables[g],e.droppables[p.descriptor.droppableId]&&i({type:"REMOVAL",value:p}))},getById:o,findById:r,exists:p=>!!r(p),getAllByType:p=>Object.values(e.draggables).filter(g=>g.descriptor.type===p)};function c(p){return e.droppables[p]||null}function d(p){const g=c(p);return g||Oe(),g}const m={register:p=>{e.droppables[p.descriptor.id]=p},unregister:p=>{const g=c(p.descriptor.id);g&&p.uniqueId===g.uniqueId&&delete e.droppables[p.descriptor.id]},getById:d,findById:c,exists:p=>!!c(p),getAllByType:p=>Object.values(e.droppables).filter(g=>g.descriptor.type===p)};function h(){e.draggables={},e.droppables={},t.length=0}return{draggable:a,droppable:m,subscribe:n,clean:h}}function JL(){const e=rn(QL,[]);return C.useEffect(()=>function(){e.clean()},[e]),e}var o0=Nt.createContext(null),im=()=>{const e=document.body;return e||Oe(),e};const e6={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},t6=e=>`rfd-announcement-${e}`;function n6(e){const t=rn(()=>t6(e),[e]),n=C.useRef(null);return C.useEffect(function(){const o=document.createElement("div");return n.current=o,o.id=t,o.setAttribute("aria-live","assertive"),o.setAttribute("aria-atomic","true"),Jf(o.style,e6),im().appendChild(o),function(){setTimeout(function(){const d=im();d.contains(o)&&d.removeChild(o),o===n.current&&(n.current=null)})}},[t]),it(r=>{const o=n.current;if(o){o.textContent=r;return}},[])}const i6={separator:"::"};function a0(e,t=i6){const n=Nt.useId();return rn(()=>`${e}${t.separator}${n}`,[t.separator,e,n])}function r6({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function s6({contextId:e,text:t}){const n=a0("hidden-text",{separator:"-"}),i=rn(()=>r6({contextId:e,uniqueId:n}),[n,e]);return C.useEffect(function(){const o=document.createElement("div");return o.id=i,o.textContent=t,o.style.display="none",im().appendChild(o),function(){const c=im();c.contains(o)&&c.removeChild(o)}},[i,t]),i}var Hm=Nt.c Line truncated
`,m="/",h="*",p="",g="comment",x="declaration";function v(k,w){if(typeof k!="string")throw new TypeError("First argument must be a string");if(!k)return[];w=w||{};var S=1,j=1;function N(P){var G=P.match(t);G&&(S+=G.length);var $=P.lastIndexOf(d);j=~$?P.length-$:j+P.length}function O(){var P={line:S,column:j};return function(G){return G.position=new R(P),L(),G}}function R(P){this.start=P,this.end={line:S,column:j},this.source=w.source}R.prototype.content=k;function D(P){var G=new Error(w.source+":"+S+":"+j+": "+P);if(G.reason=P,G.filename=w.source,G.line=S,G.column=j,G.source=k,!w.silent)throw G}function I(P){var G=P.exec(k);if(G){var $=G[0];return N($),k=k.slice($.length),G}}function L(){I(n)}function M(P){var G;for(P=P||[];G=A();)G!==!1&&P.push(G);return P}function A(){var P=O();if(!(m!=k.charAt(0)||h!=k.charAt(1))){for(var G=2;p!=k.charAt(G)&&(h!=k.charAt(G)||m!=k.charAt(G+1));)++G;if(G+=2,p===k.charAt(G-1))return D("End of comment missing");var $=k.slice(2,G-2);return j+=2,N($),k=k.slice(G),j+=2,P({type:g,comment:$})}}function B(){var P=O(),G=I(i);if(G){if(A(),!I(r))return D("property missing ':'");var $=I(o),q=P({type:x,property:_(G[0].replace(e,p)),value:$?_($[0].replace(e,p)):p});return I(a),q}}function W(){var P=[];M(P);for(var G;G=B();)G!==!1&&(P.push(G),M(P));return P}return L(),W()}function _(k){return k?k.replace(c,p):p}return $g=v,$g}var uw;function C8(){if(uw)return el;uw=1;var e=el&&el.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(el,"__esModule",{value:!0}),el.default=n;const t=e(w8());function n(i,r){let o=null;if(!i||typeof i!="string")return o;const a=(0,t.default)(i),c=typeof r=="function";return a.forEach(d=>{if(d.type!=="declaration")return;const{property:m,value:h}=d;c?r(m,h,d):h&&(o=o||{},o[m]=h)}),o}return el}var Fc={},dw;function j8(){if(dw)return Fc;dw=1,Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,r=/^-(ms)-/,o=function(m){return!m||n.test(m)||e.test(m)},a=function(m,h){return h.toUpperCase()},c=function(m,h){return"".concat(h,"-")},d=function(m,h){return h===void 0&&(h={}),o(m)?m:(m=m.toLowerCase(),h.reactCompat?m=m.replace(r,c):m=m.replace(i,c),m.replace(t,a))};return Fc.camelCase=d,Fc}var Vc,fw;function E8(){if(fw)return Vc;fw=1;var e=Vc&&Vc.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},t=e(C8()),n=j8();function i(r,o){var a={};return!r||typeof r!="string"||(0,t.default)(r,function(c,d){c&&d&&(a[(0,n.camelCase)(c,o)]=d)}),a}return i.default=i,Vc=i,Vc}var N8=E8();const I8=ma(N8),ON=LN("end"),m0=LN("start");function LN(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function T8(e){const t=m0(e),n=ON(e);if(t&&n)return{start:t,end:n}}function lu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?mw(e.position):"start"in e||"end"in e?mw(e):"line"in e||"column"in e?Jx(e):""}function Jx(e){return pw(e&&e.line)+":"+pw(e&&e.column)}function mw(e){return Jx(e&&e.start)+"-"+Jx(e&&e.end)}function pw(e){return e&&typeof e=="number"?e:1}class zi extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let r="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?r=t:!o.cause&&t&&(a=!0,r=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof i=="string"){const d=i.indexOf(":");d===-1?o.ruleId=i:(o.source=i.slice(0,d),o.ruleId=i.slice(d+1))}if(!o.place&&o.ancestors&&o.ancestors){const d=o.ancestors[o.ancestors.length-1];d&&(o.place=d.position)}const c=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=c?c.line:void 0,this.name=lu(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}zi.prototype.file="";zi.prototype.name="";zi.prototype.reason="";zi.prototype.message="";zi.prototype.stack="";zi.prototype.column=void 0;zi.prototype.line=void 0;zi.prototype.ancestors=void 0;zi.prototype.cause=void 0;zi.prototype.fatal=void 0;zi.prototype.place=void 0;zi.prototype.ruleId=void 0;zi.prototype.source=void 0;const p0={}.hasOwnProperty,R8=new Map,A8=/[A-Z]/g,M8=new Set(["table","tbody","thead","tfoot","tr"]),D8=new Set(["td","th"]),zN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function O8(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.j Line truncated
`;break}case-3:{a=`\r
`;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&r)continue;a=" ";break}default:a=String.fromCharCode(o)}r=o===-2,i.push(a)}return i.join("")}function VB(e){const i={constructs:FN([BB,...(e||{}).extensions||[]]),content:r(rP),defined:[],document:r(oP),flow:r(wB),lazy:{},string:r(EB),text:r(NB)};return i;function r(o){return a;function a(c){return $B(i,o,c)}}}function UB(e){for(;!WN(e););return e}const ww=/[\0\t\n\r]/g;function GB(){let e=1,t="",n=!0,i;return r;function r(o,a,c){const d=[];let m,h,p,g,x;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(a||void 0).decode(o)),p=0,t="",n&&(o.charCodeAt(0)===65279&&p++,n=void 0);p<o.length;){if(ww.lastIndex=p,m=ww.exec(o),g=m&&m.index!==void 0?m.index:o.length,x=o.charCodeAt(g),!m){t=o.slice(p);break}if(x===10&&p===g&&i)d.push(-3),i=void 0;else switch(i&&(d.push(-5),i=void 0),p<g&&(d.push(o.slice(p,g)),e+=g-p),x){case 0:{d.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,d.push(-2);e++<h;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:i=!0,e=1}p=g+1}return c&&(i&&d.push(-5),t&&d.push(t),d.push(null)),d}}const qB=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function WB(e){return e.replace(qB,YB)}function YB(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const r=n.charCodeAt(1),o=r===120||r===88;return VN(n.slice(o?2:1),o?16:10)}return x0(n)||e}const JN={}.hasOwnProperty;function XB(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),KB(n)(UB(VB(n).document().write(GB()(e,t,!0))))}function KB(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Dt),autolinkProtocol:L,autolinkEmail:L,atxHeading:o(Ze),blockQuote:o(ie),characterEscape:L,characterReference:L,codeFenced:o(we),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(we,a),codeText:o(je,a),codeTextData:L,data:L,codeFlowValue:L,definition:o(Te),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(Ge),hardBreakEscape:o(Xe),hardBreakTrailing:o(Xe),htmlFlow:o(mt,a),htmlFlowData:L,htmlText:o(mt,a),htmlTextData:L,image:o(Ft),label:a,link:o(Dt),listItem:o(he),listItemValue:g,listOrdered:o(jt,p),listUnordered:o(jt),paragraph:o(ze),reference:F,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(Ze),strong:o(ot),thematicBreak:o(lt)},exit:{atxHeading:d(),atxHeadingSequence:O,autolink:d(),autolinkEmail:ue,autolinkProtocol:ae,blockQuote:d(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:ee,characterReferenceMarkerNumeric:ee,characterReferenceValue:te,characterReference:se,codeFenced:d(k),codeFencedFence:_,codeFencedFenceInfo:x,codeFencedFenceMeta:v,codeFlowValue:M,codeIndented:d(w),codeText:d(G),codeTextData:M,data:M,definition:d(),definitionDestinationString:N,definitionLabelString:S,definitionTitleString:j,emphasis:d(),hardBreakEscape:d(B),hardBreakTrailing:d(B),htmlFlow:d(W),htmlFlowData:M,htmlText:d(P),htmlTextData:M,image:d(q),label:Q,labelText:Y,lineEnding:A,link:d($),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:K,resourceDestinationString:V,resourceTitleString:U,resource:Z,setextHeading:d(I),setextHeadingLineSequence:D,setextHeadingText:R,strong:d(),thematicBreak:d()}};eI(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(me){let be={type:"root",children:[]};const Ae={stack:[be],tokenStack:[],config:t,enter:c,exit:m,buffer:a,resume:h,data:n},Be=[];let We=-1;for(;++We<me.length;)if(me[We][1].type==="listOrdered"||me[We][1].type==="listUnordered")if(me[We][0]==="enter")Be.push(We);else{const zt=Be.pop();We=r(me,zt,We)}for(We=-1;++We<me.length;){const zt=t[me[We][0]];JN.call(zt,me[We][1].type)&&zt[me[We][1].type].call(Object.assign({sliceSerialize:me[We][2].sliceSerialize},Ae),me[We][1])}if(Ae.tokenStack.length>0){const zt=Ae.tokenStack[Ae.tokenStack.length-1];(zt[1]||Cw).call(Ae,void 0,zt[0])}for(be.position={start:ho(me.length>0?me[0][1].start:{line:1,column:1,offset:0}),end:ho(me.length>0?me[me.length-2][1].end:{line:1,column:1,offset:0})},We=-1;++We<t.transforms.length;)be=t.transforms[We](be)||be;return be}function r(me,be,Ae){let Be=be-1,We=-1,zt=!1,ht,ke,qe,Qe;for(;++Be<=Ae;){const $e=me[Be];switch($e[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{$e[0]==="enter"?We++:We--,Qe=void 0;break}case"lineEndingBlank":{$e[0]==="enter"&&(ht&&!Qe&&!We&&!qe&&(qe=Be),Qe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Qe=void 0}if(!We&&$e[0]==="enter"&&$e[1].type==="listItemPrefix"||We===-1&&$e[0]==="exit"&&($e[1].type==="listUnordered"||$e[1].type==="listOrdered")){if(ht){let Fe=Be;for(ke=void 0;Fe--;){const Vt=me[Fe];if(Vt[1].type==="lineEnding"||Vt[1].type==="lineEndingBlank"){if(Vt[0]==="exit")continue;ke&&(me[ke][1].type="lineEndingBlank",zt=!0),Vt[1].type="lineEnding",ke=Fe}else if(!(Vt[1].type==="linePrefix"||Vt[1].type==="blockQuotePrefix"||Vt[1].type==="blockQuotePrefixWhitespace"Line truncated
`}]}function t9(e,t){const n=t.value?t.value+`
`:"",i={},r=t.lang?t.lang.split(/\s+/):[];r.length>0&&(i.className=["language-"+r[0]]);let o={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function n9(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function i9(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function r9(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),r=ql(i.toLowerCase()),o=e.footnoteOrder.indexOf(i);let a,c=e.footnoteCounts.get(i);c===void 0?(c=0,e.footnoteOrder.push(i),a=e.footnoteOrder.length):a=o+1,c+=1,e.footnoteCounts.set(i,c);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,d);const m={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,m),e.applyData(t,m)}function s9(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function o9(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function tI(e,t){const n=t.referenceType;let i="]";if(n==="collapsed"?i+="[]":n==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const r=e.all(t),o=r[0];o&&o.type==="text"?o.value="["+o.value:r.unshift({type:"text",value:"["});const a=r[r.length-1];return a&&a.type==="text"?a.value+=i:r.push({type:"text",value:i}),r}function a9(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return tI(e,t);const r={src:ql(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(r.title=i.title);const o={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,o),e.applyData(t,o)}function l9(e,t){const n={src:ql(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,i),e.applyData(t,i)}function c9(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const i={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,i),e.applyData(t,i)}function u9(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return tI(e,t);const r={href:ql(i.url||"")};i.title!==null&&i.title!==void 0&&(r.title=i.title);const o={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function d9(e,t){const n={href:ql(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function f9(e,t,n){const i=e.all(t),r=n?m9(n):nI(t),o={},a=[];if(typeof t.checked=="boolean"){const h=i[0];let p;h&&h.type==="element"&&h.tagName==="p"?p=h:(p={type:"element",tagName:"p",properties:{},children:[]},i.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let c=-1;for(;++c<i.length;){const h=i[c];(r||c!==0||h.type!=="element"||h.tagName!=="p")&&a.push({type:"text",value:`
`}),h.type==="element"&&h.tagName==="p"&&!r?a.push(...h.children):a.push(h)}const d=i[i.length-1];d&&(r||d.type!=="element"||d.tagName!=="p")&&a.push({type:"text",value:`
`});const m={type:"element",tagName:"li",properties:o,children:a};return e.patch(t,m),e.applyData(t,m)}function m9(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let i=-1;for(;!t&&++i<n.length;)t=nI(n[i])}return t}function nI(e){const t=e.spread;return t??e.children.length>1}function p9(e,t){const n={},i=e.all(t);let r=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++r<i.length;){const a=i[r];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function h9(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function g9(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function y9(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function x9(e,t){const n=e.all(t),i=n.shift(),r=[];if(i){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(t.children[0],a),r.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},c=m0(t.children[1]),d=ON(t.children[t.children.length-1]);c&&d&&(a.position={start:c,end:d}),r.push(a)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function v9(e,t,n){const i=n?n.children:void 0,o=(i?i.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,c=a?a.length:t.children.length;let d=-1;const m=[];for(;++d<c;){const p=t.children[d],g={},x=a?a[d]:void 0;x&&(g.align=x);let v={type:"element",tagName:o,properties:g,children:[]};p&&(v.children=e.all(p),e.patch(p,v),v=e.applyData(p,v)),m.push(v)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,h),e.applyData(t,h)}function b9(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const jw=9,Ew=32;function _9(e){const t=String(e),n=/\r?\n|\r/g;let i=n.exec(t),r=0;const o=[];for(;i;)o.push(Nw(t.slice(r,i.index),r>0,!0),i[0]),r=i.index+i[0].length,i=n.exec(t);return o.push(Nw(t.slice(r),r>0,!1)),o.join("")}function Nw(e,t,n){let i=0,r=e.length;if(t){let o=e.codePointAt(i);for(;o===jw||o===Ew;)i++,o=e.codePointAt(i)}if(n){let o=e.codePointAt(r-1);for(;o===jw||o===Ew;)r--,o=e.codePointAt(r-1)}return r>i?e.slice(i,r):""}function k9(e,t){const n={type:"text",value:_9(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function S9(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const w9={blockquote:JB,break:e9,code:t9,delete:n9,emphasis:i9,footnoteReference:r9,heading:s9,html:o9,imageReference:a9,image:l9,inlineCode:c9,linkReference:u9,link:d9,listItem:f9,list:p9,paragraph:h9,root:g9,strong:y9,table:x9,tableCell:b9,tableRow:v9,text:k9,thematicBreak:S9,toml:af,yaml:af,definition:af,footnoteDefinition:af};function af(){}const iI=-1,Wm=0,uu=1,cm=2,b0=3,_0=4,k0=5,S0=6,rI=7,sI=8,Iw=typeof self=="object"?self:globalThis,C9=(e,t)=>{const n=(r,o)=>(e.set(o,r),r),i=r=>{if(e.has(r))return e.get(r);const[o,a]=t[r];switch(o){case Wm:case iI:return n(a,r);case uu:{const c=n([],r);for(const d of a)c.push(i(d));return c}case cm:{const c=n({},r);for(const[d,m]of a)c[i(d)]=i(m);return c}case b0:return n(new Date(a),r);case _0:{const{source:c,flags:d}=a;return n(new RegExp(c,d),r)}case k0:{const c=n(new Map,r);for(const[d,m]of a)c.set(i(d),i(m));return c}case S0:{const c=n(new Set,r);for(const d of a)c.add(i(d));return c}case rI:{const{name:c,message:d}=a;return n(new Iw[c](d),r)}case sI:return n(BigInt(a),r);case"BigInt":return n(Object(BigInt(a)),r);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:c}=new Uint8Array(a);return n(new DataView(c),a)}}return n(new Iw[o](a),r)};return i},Tw=e=>C9(new Map,e)(0),tl="",{toString:j9}={},{keys:E9}=Object,Gc=e=>{const t=typeof e;if(t!=="object"||!e)return[Wm,t];const n=j9.call(e).slice(8,-1);switch(n){case"Array":return[uu,tl];case"Object":return[cm,tl];case"Date":return[b0,tl];case"RegExp":return[_0,tl];case"Map":return[k0,tl];case"Set":return[S0,tl];case"DataView":return[uu,n]}return n.includes("Array")?[uu,n]:n.includes("Error")?[rI,n]:[cm,n]},lf=([e,t])=>e===Wm&&(t==="function"||t==="symbol"),N9=(e,t,n,i)=>{const r=(a,c)=>{const d=i.push(a)-1;return n.set(c,d),d},o=a=>{if(n.has(a))return n.get(a);let[c,d]=Gc(a);switch(c){case Wm:{let h=a;switch(d){case"bigint":c=sI,h=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);h=null;break;case"undefined":return r([iI],a)}return r([c,h],a)}case uu:{if(d){let g=a;return d==="DataView"?g=new Uint8Array(a.buffer):d==="ArrayBuffer"&&(g=new Uint8Array( Line truncated
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:`
`}]}}const Ym=(function(e){if(e==null)return O9;if(typeof e=="function")return Xm(e);if(typeof e=="object")return Array.isArray(e)?A9(e):M9(e);if(typeof e=="string")return D9(e);throw new Error("Expected function, string, or object as test")});function A9(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ym(e[n]);return Xm(i);function i(...r){let o=-1;for(;++o<t.length;)if(t[o].apply(this,r))return!0;return!1}}function M9(e){const t=e;return Xm(n);function n(i){const r=i;let o;for(o in e)if(r[o]!==t[o])return!1;return!0}}function D9(e){return Xm(t);function t(n){return n&&n.type===e}}function Xm(e){return t;function t(n,i,r){return!!(L9(n)&&e.call(this,n,typeof i=="number"?i:void 0,r||void 0))}}function O9(){return!0}function L9(e){return e!==null&&typeof e=="object"&&"type"in e}const oI=[],z9=!0,nv=!1,P9="skip";function aI(e,t,n,i){let r;typeof t=="function"&&typeof n!="function"?(i=n,n=t):r=t;const o=Ym(r),a=i?-1:1;c(e,void 0,[])();function c(d,m,h){const p=d&&typeof d=="object"?d:{};if(typeof p.type=="string"){const x=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(d.type+(x?"<"+x+">":""))+")"})}return g;function g(){let x=oI,v,_,k;if((!t||o(d,m,h[h.length-1]||void 0))&&(x=B9(n(d,h)),x[0]===nv))return x;if("children"in d&&d.children){const w=d;if(w.children&&x[0]!==P9)for(_=(i?w.children.length:-1)+a,k=h.concat(w);_>-1&&_<w.children.length;){const S=w.children[_];if(v=c(S,_,k)(),v[0]===nv)return v;_=typeof v[1]=="number"?v[1]:_+a}}return x}}}function B9(e){return Array.isArray(e)?e:typeof e=="number"?[z9,e]:e==null?oI:[e]}function w0(e,t,n,i){let r,o,a;typeof t=="function"&&typeof n!="function"?(o=void 0,a=t,r=n):(o=t,a=n,r=i),aI(e,o,c,r);function c(d,m){const h=m[m.length-1],p=h?h.children.indexOf(d):void 0;return a(d,p,h)}}const iv={}.hasOwnProperty,$9={};function H9(e,t){const n=t||$9,i=new Map,r=new Map,o=new Map,a={...w9,...n.handlers},c={all:m,applyData:V9,definitionById:i,footnoteById:r,footnoteCounts:o,footnoteOrder:[],handlers:a,one:d,options:n,patch:F9,wrap:G9};return w0(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const p=h.type==="definition"?i:r,g=String(h.identifier).toUpperCase();p.has(g)||p.set(g,h)}}),c;function d(h,p){const g=h.type,x=c.handlers[g];if(iv.call(c.handlers,g)&&x)return x(c,h,p);if(c.options.passThrough&&c.options.passThrough.includes(g)){if("children"in h){const{children:_,...k}=h,w=um(k);return w.children=c.all(h),w}return um(h)}return(c.options.unknownHandler||U9)(c,h,p)}function m(h){const p=[];if("children"in h){const g=h.children;let x=-1;for(;++x<g.length;){const v=c.one(g[x],h);if(v){if(x&&g[x-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=Aw(v.value)),!Array.isArray(v)&&v.type==="element")){const _=v.children[0];_&&_.type==="text"&&(_.value=Aw(_.value))}Array.isArray(v)?p.push(...v):p.push(v)}}}return p}}function F9(e,t){e.position&&(t.position=T8(e))}function V9(e,t){let n=t;if(e&&e.data){const i=e.data.hName,r=e.data.hChildren,o=e.data.hProperties;if(typeof i=="string")if(n.type==="element")n.tagName=i;else{const a="children"in n?n.children:[n];n={type:"element",tagName:i,properties:{},children:a}}n.type==="element"&&o&&Object.assign(n.properties,um(o)),"children"in n&&n.children&&r!==null&&r!==void 0&&(n.children=r)}return n}function U9(e,t){const n=t.data||{},i="value"in t&&!(iv.call(n,"hProperties")||iv.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function G9(e,t){const n=[];let i=-1;for(t&&n.push({type:"text",value:`
`});++i<e.length;)i&&n.push({type:"text",value:`
`}),n.push(e[i]);return t&&e.length>0&&n.push({type:"text",value:`
`}),n}function Aw(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Mw(e,t){const n=H9(e,t),i=n.one(e,void 0),r=R9(n),o=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return r&&o.children.push({type:"text",value:`
`},r),o}function q9(e,t){return e&&"run"in e?async function(n,i){const r=Mw(n,{file:i,...t});await e.run(r,i)}:function(n,i){return Mw(n,{file:i,...e||t})}}function Dw(e){if(e)throw e}var Ug,Ow;function W9(){if(Ow)return Ug;Ow=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,r=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},o=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var h=e.call(m,"constructor"),p=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!h&&!p)return!1;var g;for(g in m);return typeof g>"u"||e.call(m,g)},a=function(m,h){n&&h.name==="__proto__"?n(m,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):m[h.name]=h.newValue},c=function(m,h){if(h==="__proto__")if(e.call(m,h)){if(i)return i(m,h).value}else return;return m[h]};return Ug=function d(){var m,h,p,g,x,v,_=arguments[0],k=1,w=arguments.length,S=!1;for(typeof _=="boolean"&&(S=_,_=arguments[1]||{},k=2),(_==null||typeof _!="object"&&typeof _!="function")&&(_={});k<w;++k)if(m=arguments[k],m!=null)for(h in m)p=c(_,h),g=c(m,h),_!==g&&(S&&g&&(o(g)||(x=r(g)))?(x?(x=!1,v=p&&r(p)?p:[]):v=p&&o(p)?p:{},a(_,{name:h,newValue:d(S,v,g)})):typeof g<"u"&&a(_,{name:h,newValue:g}));return _},Ug}var Y9=W9();const Gg=ma(Y9);function rv(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function X9(){const e=[],t={run:n,use:i};return t;function n(...r){let o=-1;const a=r.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);c(null,...r);function c(d,...m){const h=e[++o];let p=-1;if(d){a(d);return}for(;++p<r.length;)(m[p]===null||m[p]===void 0)&&(m[p]=r[p]);r=m,h?K9(h,c)(...m):a(null,...m)}}function i(r){if(typeof r!="function")throw new TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}}function K9(e,t){let n;return i;function i(...a){const c=e.length>a.length;let d;c&&a.push(r);try{d=e.apply(this,a)}catch(m){const h=m;if(c&&n)throw h;return r(h)}c||(d&&d.then&&typeof d.then=="function"?d.then(o,r):d instanceof Error?r(d):o(d))}function r(a,...c){n||(n=!0,t(a,...c))}function o(a){r(null,a)}}const Jr={basename:Z9,dirname:Q9,extname:J9,join:e$,sep:"/"};function Z9(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Hu(e);let n=0,i=-1,r=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;r--;)if(e.codePointAt(r)===47){if(o){n=r+1;break}}else i<0&&(o=!0,i=r+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let a=-1,c=t.length-1;for(;r--;)if(e.codePointAt(r)===47){if(o){n=r+1;break}}else a<0&&(o=!0,a=r+1),c>-1&&(e.codePointAt(r)===t.codePointAt(c--)?c<0&&(i=r):(c=-1,i=a));return n===i?i=a:i<0&&(i=e.length),e.slice(n,i)}function Q9(e){if(Hu(e),e.length===0)return".";let t=-1,n=e.length,i;for(;--n;)if(e.codePointAt(n)===47){if(i){t=n;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function J9(e){Hu(e);let t=e.length,n=-1,i=0,r=-1,o=0,a;for(;t--;){const c=e.codePointAt(t);if(c===47){if(a){i=t+1;break}continue}n<0&&(a=!0,n=t+1),c===46?r<0?r=t:o!==1&&(o=1):r>-1&&(o=-1)}return r<0||n<0||o===0||o===1&&r===n-1&&r===i+1?"":e.slice(r,n)}function e$(...e){let t=-1,n;for(;++t<e.length;)Hu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":t$(n)}function t$(e){Hu(e);const t=e.codePointAt(0)===47;let n=n$(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function n$(e,t){let n="",i=0,r=-1,o=0,a=-1,c,d;for(;++a<=e.length;){if(a<e.length)c=e.codePointAt(a);else{if(c===47)break;c=47}if(c===47){if(!(r===a-1||o===1))if(r!==a-1&&o===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",i=0):(n=n.slice(0,d),i=n.length-1-n.lastIndexOf("/")),r=a,o=0;continue}}else if(n.length>0){n="",i=0,r=a,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(r+1,a):n=e.slice(r+1,a),i=a-r-1;r=a,o=0}else c===46&&o>-1?o++:o=-1}return n}function Hu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const i$={cwd:r$};function r$(){return"/"}function sv(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function s$(e){if(typeof e=="string")e=new URL(e);else if(!sv(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return o$(e)}function o$(e){if(e.hostname!==""){consLine truncated
`:" ")+o.indentLines(o.containerFlow(i,c.current()),t?dI:K$))),m(),d}}function K$(e,t,n){return t===0?e:dI(e,t,n)}function dI(e,t,n){return(n?"":" ")+e}const Z$=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];fI.peek=n7;function Q$(){return{canContainEols:["delete"],enter:{strikethrough:e7},exit:{strikethrough:t7}}}function J$(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Z$}],handlers:{delete:fI}}}function e7(e){this.enter({type:"delete",children:[]},e)}function t7(e){this.exit(e)}function fI(e,t,n,i){const r=n.createTracker(i),o=n.enter("strikethrough");let a=r.move("~~");return a+=n.containerPhrasing(e,{...r.current(),before:a,after:"~"}),a+=r.move("~~"),o(),a}function n7(){return"~"}function i7(e){return e.length}function r7(e,t){const n=t||{},i=(n.align||[]).concat(),r=n.stringLength||i7,o=[],a=[],c=[],d=[];let m=0,h=-1;for(;++h<e.length;){const _=[],k=[];let w=-1;for(e[h].length>m&&(m=e[h].length);++w<e[h].length;){const S=s7(e[h][w]);if(n.alignDelimiters!==!1){const j=r(S);k[w]=j,(d[w]===void 0||j>d[w])&&(d[w]=j)}_.push(S)}a[h]=_,c[h]=k}let p=-1;if(typeof i=="object"&&"length"in i)for(;++p<m;)o[p]=Fw(i[p]);else{const _=Fw(i);for(;++p<m;)o[p]=_}p=-1;const g=[],x=[];for(;++p<m;){const _=o[p];let k="",w="";_===99?(k=":",w=":"):_===108?k=":":_===114&&(w=":");let S=n.alignDelimiters===!1?1:Math.max(1,d[p]-k.length-w.length);const j=k+"-".repeat(S)+w;n.alignDelimiters!==!1&&(S=k.length+S+w.length,S>d[p]&&(d[p]=S),x[p]=S),g[p]=j}a.splice(1,0,g),c.splice(1,0,x),h=-1;const v=[];for(;++h<a.length;){const _=a[h],k=c[h];p=-1;const w=[];for(;++p<m;){const S=_[p]||"";let j="",N="";if(n.alignDelimiters!==!1){const O=d[p]-(k[p]||0),R=o[p];R===114?j=" ".repeat(O):R===99?O%2?(j=" ".repeat(O/2+.5),N=" ".repeat(O/2-.5)):(j=" ".repeat(O/2),N=j):N=" ".repeat(O)}n.delimiterStart!==!1&&!p&&w.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&S==="")&&(n.delimiterStart!==!1||p)&&w.push(" "),n.alignDelimiters!==!1&&w.push(j),w.push(S),n.alignDelimiters!==!1&&w.push(N),n.padding!==!1&&w.push(" "),(n.delimiterEnd!==!1||p!==m-1)&&w.push("|")}v.push(n.delimiterEnd===!1?w.join("").replace(/ +$/,""):w.join(""))}return v.join(`
`)}function s7(e){return e==null?"":String(e)}function Fw(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function o7(e,t,n,i){const r=n.enter("blockquote"),o=n.createTracker(i);o.move("> "),o.shift(2);const a=n.indentLines(n.containerFlow(e,o.current()),a7);return r(),a}function a7(e,t,n){return">"+(n?"":" ")+e}function l7(e,t){return Vw(e,t.inConstruct,!0)&&!Vw(e,t.notInConstruct,!1)}function Vw(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let i=-1;for(;++i<t.length;)if(e.includes(t[i]))return!0;return!1}function Uw(e,t,n,i){let r=-1;for(;++r<n.unsafe.length;)if(n.unsafe[r].character===`
`&&l7(n.stack,n.unsafe[r]))return/[ \t]/.test(i.before)?"":" ";return`\\
`}function c7(e,t){const n=String(e);let i=n.indexOf(t),r=i,o=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===r?++o>a&&(a=o):o=1,r=i+t.length,i=n.indexOf(t,r);return a}function u7(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function d7(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function f7(e,t,n,i){const r=d7(n),o=e.value||"",a=r==="`"?"GraveAccent":"Tilde";if(u7(e,n)){const p=n.enter("codeIndented"),g=n.indentLines(o,m7);return p(),g}const c=n.createTracker(i),d=r.repeat(Math.max(c7(o,r)+1,3)),m=n.enter("codeFenced");let h=c.move(d);if(e.lang){const p=n.enter(`codeFencedLang${a}`);h+=c.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...c.current()})),p()}if(e.lang&&e.meta){const p=n.enter(`codeFencedMeta${a}`);h+=c.move(" "),h+=c.move(n.safe(e.meta,{before:h,after:`
`,encode:["`"],...c.current()})),p()}return h+=c.move(`
`),o&&(h+=c.move(o+`
`)),h+=c.move(d),m(),h}function m7(e,t,n){return(n?"":" ")+e}function j0(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function p7(e,t,n,i){const r=j0(n),o=r==='"'?"Quote":"Apostrophe",a=n.enter("definition");let c=n.enter("label");const d=n.createTracker(i);let m=d.move("[");return m+=d.move(n.safe(n.associationId(e),{before:m,after:"]",...d.current()})),m+=d.move("]: "),c(),!e.url||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(n.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(c=n.enter("destinationRaw"),m+=d.move(n.safe(e.url,{before:m,after:e.title?" ":`
`,...d.current()}))),c(),e.title&&(c=n.enter(`title${o}`),m+=d.move(" "+r),m+=d.move(n.safe(e.title,{before:m,after:r,...d.current()})),m+=d.move(r),c()),a(),m}function h7(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function ju(e){return"&#x"+e.toString(16).toUpperCase()+";"}function dm(e,t,n){const i=Il(e),r=Il(t);return i===void 0?r===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}mI.peek=g7;function mI(e,t,n,i){const r=h7(n),o=n.enter("emphasis"),a=n.createTracker(i),c=a.move(r);let d=a.move(n.containerPhrasing(e,{after:r,before:c,...a.current()}));const m=d.charCodeAt(0),h=dm(i.before.charCodeAt(i.before.length-1),m,r);h.inside&&(d=ju(m)+d.slice(1));const p=d.charCodeAt(d.length-1),g=dm(i.after.charCodeAt(0),p,r);g.inside&&(d=d.slice(0,-1)+ju(p));const x=a.move(r);return o(),n.attentionEncodeSurroundingInfo={after:g.outside,before:h.outside},c+d+x}function g7(e,t,n){return n.options.emphasis||"*"}function y7(e,t){let n=!1;return w0(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,nv}),!!((!e.depth||e.depth<3)&&y0(e)&&(t.options.setext||n))}function x7(e,t,n,i){const r=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(i);if(y7(e,n)){const h=n.enter("headingSetext"),p=n.enter("phrasing"),g=n.containerPhrasing(e,{...o.current(),before:`
`,after:`
`});return p(),h(),g+`
`+(r===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(`
`))+1))}const a="#".repeat(r),c=n.enter("headingAtx"),d=n.enter("phrasing");o.move(a+" ");let m=n.containerPhrasing(e,{before:"# ",after:`
`,...o.current()});return/^[\t ]/.test(m)&&(m=ju(m.charCodeAt(0))+m.slice(1)),m=m?a+" "+m:a,n.options.closeAtx&&(m+=" "+a),d(),c(),m}pI.peek=v7;function pI(e){return e.value||""}function v7(){return"<"}hI.peek=b7;function hI(e,t,n,i){const r=j0(n),o=r==='"'?"Quote":"Apostrophe",a=n.enter("image");let c=n.enter("label");const d=n.createTracker(i);let m=d.move("![");return m+=d.move(n.safe(e.alt,{before:m,after:"]",...d.current()})),m+=d.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(n.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(c=n.enter("destinationRaw"),m+=d.move(n.safe(e.url,{before:m,after:e.title?" ":")",...d.current()}))),c(),e.title&&(c=n.enter(`title${o}`),m+=d.move(" "+r),m+=d.move(n.safe(e.title,{before:m,after:r,...d.current()})),m+=d.move(r),c()),m+=d.move(")"),a(),m}function b7(){return"!"}gI.peek=_7;function gI(e,t,n,i){const r=e.referenceType,o=n.enter("imageReference");let a=n.enter("label");const c=n.createTracker(i);let d=c.move("![");const m=n.safe(e.alt,{before:d,after:"]",...c.current()});d+=c.move(m+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const p=n.safe(n.associationId(e),{before:d,after:"]",...c.current()});return a(),n.stack=h,o(),r==="full"||!m||m!==p?d+=c.move(p+"]"):r==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function _7(){return"!"}yI.peek=k7;function yI(e,t,n){let i=e.value||"",r="`",o=-1;for(;new RegExp("(^|[^`])"+r+"([^`]|$)").test(i);)r+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++o<n.unsafe.length;){const a=n.unsafe[o],c=n.compilePattern(a);let d;if(a.atBreak)for(;d=c.exec(i);){let m=d.index;i.charCodeAt(m)===10&&i.charCodeAt(m-1)===13&&m--,i=i.slice(0,m)+" "+i.slice(d.index+1)}}return r+i+r}function k7(){return"`"}function xI(e,t){const n=y0(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}vI.peek=S7;function vI(e,t,n,i){const r=j0(n),o=r==='"'?"Quote":"Apostrophe",a=n.createTracker(i);let c,d;if(xI(e,n)){const h=n.stack;n.stack=[],c=n.enter("autolink");let p=a.move("<");return p+=a.move(n.containerPhrasing(e,{before:p,after:">",...a.current()})),p+=a.move(">"),c(),n.stack=h,p}c=n.enter("link"),d=n.enter("label");let m=a.move("[");return m+=a.move(n.containerPhrasing(e,{before:m,after:"](",...a.current()})),m+=a.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),m+=a.move("<"),m+=a.move(n.safe(e.url,{before:m,after:">",...a.current()})),m+=a.move(">")):(d=n.enter("destinationRaw"),m+=a.move(n.safe(e.url,{before:m,after:e.title?" ":")",...a.current()}))),d(),e.title&&(d=n.enter(`title${o}`),m+=a.move(" "+r),m+=a.move(n.safe(e.title,{before:m,after:r,...a.current()})),m+=a.move(r),d()),m+=a.move(")"),c(),m}function S7(e,t,n){return xI(e,n)?"<":"["}bI.peek=w7;function bI(e,t,n,i){const r=e.referenceType,o=n.enter("linkReference");let a=n.enter("label");const c=n.createTracker(i);let d=c.move("[");const m=n.containerPhrasing(e,{before:d,after:"]",...c.current()});d+=c.move(m+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const p=n.safe(n.associationId(e),{before:d,after:"]",...c.current()});return a(),n.stack=h,o(),r==="full"||!m||m!==p?d+=c.move(p+"]"):r==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function w7(){return"["}function E0(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function C7(e){const t=E0(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function j7(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function _I(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function E7(e,t,n,i){const r=n.enter("list"),o=n.bulletCurrent;let a=e.ordered?j7(n):E0(n);const c=e.ordered?a==="."?")":".":C7(n);let d=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(d=!0),_I(n)===a&&h){let p=-1;for(;++p<e.chilLine truncated
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:a,tableCell:d,tableRow:c}};function a(x,v,_,k){return m(h(x,_,k),x.align)}function c(x,v,_,k){const w=p(x,_,k),S=m([w]);return S.slice(0,S.indexOf(`
`))}function d(x,v,_,k){const w=_.enter("tableCell"),S=_.enter("phrasing"),j=_.containerPhrasing(x,{...k,before:o,after:o});return S(),w(),j}function m(x,v){return r7(x,{align:v,alignDelimiters:i,padding:n,stringLength:r})}function h(x,v,_){const k=x.children;let w=-1;const S=[],j=v.enter("table");for(;++w<k.length;)S[w]=p(k[w],v,_);return j(),S}function p(x,v,_){const k=x.children;let w=-1;const S=[],j=v.enter("tableRow");for(;++w<k.length;)S[w]=d(k[w],x,v,_);return j(),S}function g(x,v,_){let k=SI.inlineCode(x,v,_);return _.stack.includes("tableCell")&&(k=k.replace(/\|/g,"\\$&")),k}}function G7(){return{exit:{taskListCheckValueChecked:qw,taskListCheckValueUnchecked:qw,paragraph:W7}}}function q7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Y7}}}function qw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function W7(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const i=n.children[0];if(i&&i.type==="text"){const r=t.children;let o=-1,a;for(;++o<r.length;){const c=r[o];if(c.type==="paragraph"){a=c;break}}a===n&&(i.value=i.value.slice(1),i.value.length===0?n.children.shift():n.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,n.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function Y7(e,t,n,i){const r=e.children[0],o=typeof e.checked=="boolean"&&r&&r.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",c=n.createTracker(i);o&&c.move(a);let d=SI.listItem(e,t,n,{...i,...c.current()});return o&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),d;function m(h){return h+a}}function X7(){return[E$(),Y$(),Q$(),P7(),G7()]}function K7(e){return{extensions:[N$(),X$(e),J$(),U7(e),q7()]}}const Z7={tokenize:iH,partial:!0},wI={tokenize:rH,partial:!0},CI={tokenize:sH,partial:!0},jI={tokenize:oH,partial:!0},Q7={tokenize:aH,partial:!0},EI={name:"wwwAutolink",tokenize:tH,previous:II},NI={name:"protocolAutolink",tokenize:nH,previous:TI},zs={name:"emailAutolink",tokenize:eH,previous:RI},ls={};function J7(){return{text:ls}}let Ko=48;for(;Ko<123;)ls[Ko]=zs,Ko++,Ko===58?Ko=65:Ko===91&&(Ko=97);ls[43]=zs;ls[45]=zs;ls[46]=zs;ls[95]=zs;ls[72]=[zs,NI];ls[104]=[zs,NI];ls[87]=[zs,EI];ls[119]=[zs,EI];function eH(e,t,n){const i=this;let r,o;return a;function a(p){return!ov(p)||!RI.call(i,i.previous)||N0(i.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(p))}function c(p){return ov(p)?(e.consume(p),c):p===64?(e.consume(p),d):n(p)}function d(p){return p===46?e.check(Q7,h,m)(p):p===45||p===95||Li(p)?(o=!0,e.consume(p),d):h(p)}function m(p){return e.consume(p),r=!0,d}function h(p){return o&&r&&Fi(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function tH(e,t,n){const i=this;return r;function r(a){return a!==87&&a!==119||!II.call(i,i.previous)||N0(i.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Z7,e.attempt(wI,e.attempt(CI,o),n),n)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function nH(e,t,n){const i=this;let r="",o=!1;return a;function a(p){return(p===72||p===104)&&TI.call(i,i.previous)&&!N0(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),r+=String.fromCodePoint(p),e.consume(p),c):n(p)}function c(p){if(Fi(p)&&r.length<5)return r+=String.fromCodePoint(p),e.consume(p),c;if(p===58){const g=r.toLowerCase();if(g==="http"||g==="https")return e.consume(p),d}return n(p)}function d(p){return p===47?(e.consume(p),o?m:(o=!0,d)):n(p)}function m(p){return p===null||lm(p)||Nn(p)||la(p)||Gm(p)?n(p):e.attempt(wI,e.attempt(CI,h),n)(p)}function h(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function iH(e,t,n){let i=0;return r;function r(a){return(a===87||a===119)&&i<3?(i++,e.consume(a),r):a===46&&i===3?(e.consume(a),o):n(a)}function o(a){return a===null?n(a):t(a)}}function rH(e,t,n){let i,r,o;return a;function a(m){return m===46||m===95?e.check(jI,d,c)(m):m===null||Nn(m)||la(m)||m!==45&&Gm(m)?d(m):(o=!0,e.consume(m),a)}function c(m){return m===95?i=!0:(r=i,i=void 0),e.consume(m),a}function d(m){return r||i||!o?n(m):t(m)}}function sH(e,t){let n=0,i=0;return r;function r(a){return a===40?(n++,e.consume(a),r):a===41&&i<n?o(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(jI,t,o)(a):a===null||Nn(a)||la(a)?t(a):(e.consume(a),r)}function o(a){return a===41&&i++,e.consume(a),r}}function oH(e,t,n){return i;function i(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),i):c===38?(e.consume(c),o):c===93?(e.consume(c),r):c===60||c===null||Nn(c)||la(c)?t(c):n(c)}function r(c){return c===null||c===40||c===91||Nn(c)||la(c)?t(c):i(c)}function o(c){return Fi(c)?a(c):n(c)}function a(c){re Line truncated
`),m=d.length>RH,h=m?d.length-ny*2:0,p=C.useCallback(()=>{navigator.clipboard.writeText(a),i(!0),setTimeout(()=>i(!1),1500)},[a]);return u.jsxs("div",{className:"code-block-wrap",children:[u.jsxs("div",{className:"code-block-header",children:[u.jsxs("span",{className:"code-block-lang",children:[c||"code",m?` (${d.length} lines)`:""]}),u.jsx("button",{className:"code-block-copy",onClick:p,children:n?u.jsxs(u.Fragment,{children:[u.jsx(Hl,{})," ",u.jsx("span",{children:"Copied"})]}):u.jsxs(u.Fragment,{children:[u.jsx(Rm,{})," ",u.jsx("span",{children:"Copy"})]})})]}),u.jsx("pre",{children:u.jsx("code",{className:e,children:m&&!r?u.jsxs(u.Fragment,{children:[d.slice(0,ny).join(`
`)+`
`,u.jsxs("span",{className:"code-block-omitted",onClick:()=>o(!0),children:["... +",h," lines (click to expand)"]}),`
`+d.slice(-ny).join(`
`)]}):a})}),m&&r&&u.jsxs("button",{className:"code-block-collapse-btn",onClick:()=>o(!1),children:["Collapse (",d.length," lines)"]})]})}const MH={code({className:e,children:t,...n}){return e?.startsWith("language-")?u.jsx(AH,{className:e,children:t}):u.jsx("code",{className:e,...n,children:t})}},DH=3e3,OH=60,iy=800;function Yw(e){if(e.length>DH)return!0;let t=0;for(let n=0;n<e.length;n++)if(e[n]===`
`&&++t>=OH)return!0;return!1}function LH(e){const t=e.lastIndexOf(`
`,iy);return e.slice(0,t>iy/2?t:iy)}const bi=Nt.memo(function({content:t,className:n="msg-content-agent",collapseMode:i="auto"}){const r=i!=="never"&&Yw(t),[o,a]=C.useState(r);C.useEffect(()=>{a(i!=="never"&&Yw(t))},[i,t]);const c=o?LH(t):t,d=t.split(`
`).length,m=t.length;return u.jsxs("div",{className:n,children:[u.jsx(y$,{remarkPlugins:[TH],components:MH,children:c}),r&&o&&u.jsxs("button",{className:"msg-collapse-toggle",onClick:()=>a(!1),children:["Show more (",d," lines, ",(m/1e3).toFixed(1),"k chars)"]}),r&&!o&&u.jsx("button",{className:"msg-collapse-toggle",onClick:()=>a(!0),children:"Show less"})]})}),Xw={native:"OpenOPC Native",codex:"Codex",claude_code:"Claude Code",cursor:"Cursor",opencode:"OpenCode"},Eu="codex",ry="native",zH=["codex","native","claude_code","cursor","opencode"],PH=["native","codex","claude_code","cursor","opencode"];function AI(e){if(!e)return{kind:"fallback"};if(e.kind==="employee"){const t=String(e.id??e.employee_id??"").trim();return t?{kind:"employee",id:t}:{kind:"fallback"}}if(e.kind==="template"){const t=String(e.id??e.template_id??"").trim();return t?{kind:"template",id:t}:{kind:"fallback"}}return{kind:"fallback"}}function MI(e){const t=AI(e);return t.kind==="fallback"?"fallback:":`${t.kind}:${t.id??""}`}function BH(e,t,n){const i=String(e.role_id??"").trim(),r=String(e.role_label??"").trim(),o=`${i} ${r} ${e.role_responsibility??""}`.toLowerCase(),a=new Set((e.same_role_employee_ids??[]).map(m=>String(m??"").trim()).filter(Boolean)),c=t.map(m=>{const h=String(m.employee_id??"").trim(),p=String(m.employee_name??h).trim()||h,g=String(m.role_id??"").trim(),x=String(m.category??"").trim(),v=[g,x].filter(Boolean).join(" · ")||h;return{kind:"employee",id:h,name:p,subtitle:v,category:x,searchText:`${h} ${p} ${g} ${x} ${(m.domains??[]).join(" ")} ${(m.tags??[]).join(" ")}`.toLowerCase(),rank:a.has(h)||g===i?0:2}}).filter(m=>m.id).sort((m,h)=>m.rank-h.rank||m.name.localeCompare(h.name)),d=n.map(m=>{const h=String(m.template_id??"").trim(),p=String(m.template_name??h).trim()||h,g=String(m.category??"").trim(),x=[g,h].filter(Boolean).join(" · ")||h,v=`${h} ${p} ${g} ${(m.domains??[]).join(" ")} ${(m.tags??[]).join(" ")}`.toLowerCase(),_=o.split(/[^a-z0-9]+/).filter(k=>k.length>=3).reduce((k,w)=>k+(v.includes(w)?1:0),0);return{kind:"template",id:h,name:p,subtitle:x,category:g,searchText:v,rank:_}}).filter(m=>m.id).sort((m,h)=>h.rank-m.rank||m.name.localeCompare(h.name));return[...c,...d,{kind:"fallback",id:"",name:"Fallback role-only",subtitle:"No employee override",category:"fallback",searchText:"fallback role only no employee override"}]}function $H(e,t){const n=MI(t);return e.find(i=>`${i.kind}:${i.id}`===n)??e[0]}function HH(e,t){const n=t.toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?!0:n.every(i=>e.searchText.includes(i))}function FH(e){return e.map(t=>{const n=String(t.role_id??"").trim(),i=String(t.existing_employee?.employee_id??"").trim(),r=String(t.candidate?.template_id??"").trim(),o=i?{kind:"employee",id:i}:r?{kind:"template",id:r}:{kind:"fallback"};return{role_id:n,role_label:t.role_labels?.[0]??n,role_responsibility:"",default_selection:o,same_role_employee_ids:t.existing_employee_ids??[],fallback_available:!0,default_agent:t.default_agent??Eu,selected_agent:t.selected_agent??t.default_agent??Eu,default_source:"recruitment"}}).filter(t=>t.role_id)}function VH(e,t){return t.kind==="template"&&e?.candidate?.template_id===t.id?e.candidate.proposed_name||e.candidate.template_name||t.name:t.kind==="employee"&&e?.existing_employee?.employee_id===t.id&&e.existing_employee.employee_name||t.name}function Kw(e,t){const n={},i=e.staffing_selections??{};for(const r of t){const o=String(r.role_id??"").trim();o&&(n[o]=AI(i[o]??r.default_selection))}return n}function Zw(e,t){const n=e.recruitment_role_agents??{},i={};for(const r of t){const o=String(r.role_id??"").trim();o&&(i[o]=n[o]??r.selected_agent??r.default_agent??Eu)}return i}function UH(e){return!!(String(e.checkpoint_response_message_id??"").trim()||String(e.checkpoint_responded_at??"").trim()||String(e.checkpoint_reply_kind??"").trim())}const GH=Nt.memo(function({meta:t,onReply:n,responded:i}){const r=t.proposals??[],o=C.useMemo(()=>{const L={};for(const M of r){const A=String(M.role_id??"").trim();A&&(L[A]=M)}return L},[r]),a=C.useMemo(()=>t.staffing_roles?.length?t.staffing_roles:FH(r),[t.staffing_roles,r]),c=t.staffing_pool?.employees??[],d=t.staffing_pool?.templates??[],m=t.recruitment_rationales??[],h=C.useMemo(()=>{const L={};for(const M of a){const A=String(M.role_id??"").trim();A&&(L[A]=BH(M,c,d))}return L},[c,a,d]),[p,g]=C.useState({}),[x,v]=C.useState(""),[_,k]=C.useState(()=>Kw(t,a)),[w,S]=C.useState(()=>Zw(t,a)),[j,N]=C.useState(t.recruitment_agent??ry),O=i;C.useEffect(()=>{!O||!UH(t)||(k(Kw(t,a)),S(Zw(t,a)),N(t.recruitment_agent??ry))},[O,t,a]),C.useEffect(()=>{N(t.recruitment_agent??ry)},[t.recruitment_agent]);const R=C.useCallback(L=>{const M=String(t.checkpoint_id??"").trim();if(!M)throw new Error("Recruitment checkpoint reply requires checkpoint_id metadata.");const A=String(t.checkpoint_type??"").trim();return{response_to_checkpoint_id:M,response_to_checkpoint_type:A||"company_recruitment_confirmation",checkpoint_reply_kind:L,staffin Line truncated
`).map(t=>t.trim()).find(Boolean)??e}function iF(e){switch(e){case"timeout":case"timed_out":case"expired":return"Expired";case"stale":case"invalid":return"Inactive";case"cancelled":case"canceled":return"Cancelled";case"resolved":return"Resolved";default:return"Responded"}}const nC=Nt.memo(function({meta:t,onReply:n,responded:i}){const r=i,o=String(t.checkpoint_status??"").trim().toLowerCase(),a=iF(o),c=String(t.prompt??t.summary??""),d=C.useMemo(()=>c.split(`
`).map(O=>O.trim()).filter(Boolean),[c]),m=nF(c).replace(/^\[[^\]]+\]\s*/,"")||"Action Required",h=d.slice(1).join(`
`).trim(),p=String(t.summary??"").trim(),g=(t.options??[]).filter(O=>!!O?.id),x=C.useMemo(()=>(t.active_subagents??[]).filter(O=>!!O&&typeof O=="object"),[t.active_subagents]),v=C.useMemo(()=>(t.permission_requests??[]).filter(O=>!!O&&typeof O=="object"),[t.permission_requests]),_=String(t.worktree_path??"").trim(),k=x.length>0||v.length>0||!!_,[w,S]=C.useState(""),j=!!w&&!r;C.useEffect(()=>{if(!j)return;const O=window.setTimeout(()=>S(""),tF);return()=>window.clearTimeout(O)},[j,w]);const N=C.useCallback(O=>{r||j||(S(O.id),n(O.label||O.id))},[r,j,n]);return u.jsxs("div",{className:"ckpt-panel ckpt-escalation",children:[u.jsxs("div",{className:"ckpt-header",children:[u.jsx("div",{className:"ckpt-icon ckpt-icon-escalation",children:u.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("path",{d:"M8 1.5L14.5 13H1.5L8 1.5Z"}),u.jsx("path",{d:"M8 5.5V9"}),u.jsx("circle",{cx:"8",cy:"11.5",r:"0.75",fill:"currentColor",stroke:"none"})]})}),u.jsx("div",{className:"ckpt-title",children:m}),u.jsx("span",{className:"ckpt-badge ckpt-badge-scope",children:String(t.escalation_type??"decision_needed").replace(/_/g," ")}),r&&u.jsx("span",{className:"ckpt-badge ckpt-badge-responded",children:a})]}),p&&p!==m&&u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Summary"}),u.jsx(bi,{content:p,className:"ckpt-markdown"})]}),h&&u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Request"}),u.jsx(bi,{content:h,className:"ckpt-markdown"})]}),k&&u.jsxs("details",{className:"ckpt-runtime-details",children:[u.jsx("summary",{children:"Runtime State"}),u.jsxs("div",{className:"ckpt-runtime-body",children:[_&&u.jsxs("div",{children:["Worktree: ",u.jsx("code",{children:_})]}),x.length>0&&u.jsxs("div",{children:["Active subagents: ",x.length]}),v.length>0&&u.jsxs("div",{children:["Pending permission records: ",v.length]})]})]}),!r&&g.length>0&&u.jsx("div",{className:"ckpt-actions ckpt-escalation-actions",children:g.map(O=>u.jsx("button",{className:`ckpt-btn ${O.id.includes("deny")?"ckpt-btn-deny":"ckpt-btn-approve"}${j?" ckpt-btn-submitting":""}`,onClick:()=>N(O),disabled:j,children:j&&w===O.id?"Submitting…":O.label||O.id},O.id))}),j&&u.jsx("div",{className:"ckpt-escalation-hint",children:"Decision sent — waiting for server confirmation…"}),!r&&t.default_action&&u.jsxs("div",{className:"ckpt-escalation-hint",children:["Default on timeout: ",u.jsx("code",{children:t.default_action})]})]})});function rF(e){return e.split(`
`).map(t=>t.trim()).find(Boolean)??e}function sF(e){switch(e){case"ignored":return"Ignored";case"timeout":case"timed_out":case"expired":return"Expired";case"stale":case"invalid":return"Inactive";case"superseded":return"Superseded";case"cancelled":case"canceled":return"Cancelled";case"resolved":return"Resolved";default:return"Responded"}}const oF=Nt.memo(function({meta:t,onReply:n,responded:i}){const r=i,[o,a]=C.useState(""),[c,d]=C.useState(null),m=String(t.checkpoint_status??"").trim().toLowerCase(),h=sF(m),p=String(t.prompt??t.summary??"").trim(),x=`${String(t.work_item_projection_title??rF(p)??"Human Review").trim()||"Human Review"} (for self-evolution)`,v=String(t.summary??"").trim(),_=C.useMemo(()=>(t.active_subagents??[]).filter(I=>!!I&&typeof I=="object"),[t.active_subagents]),k=C.useMemo(()=>(t.permission_requests??[]).filter(I=>!!I&&typeof I=="object"),[t.permission_requests]),w=String(t.worktree_path??"").trim(),S=_.length>0||k.length>0||!!w,j=r||c!==null,N=C.useCallback((I,L="")=>{const M=String(t.checkpoint_id??"").trim();if(!M)throw new Error("Delivery self-evolution reply requires checkpoint_id metadata.");const A={response_to_checkpoint_id:M,response_to_checkpoint_type:"company_delivery_feedback",checkpoint_reply_kind:I};return(I==="approve"||I==="feedback")&&(A.self_evolution_trigger=!0,A.human_feedback_text=L),A},[t.checkpoint_id]),O=C.useCallback(()=>{if(j)return;const I=N("approve");d("approve"),n("I fully agree with this delivery.",I)},[j,N,n]),R=C.useCallback(()=>{const I=o.trim();if(j||!I)return;const L=N("feedback",I);d("feedback"),n(I,L),a("")},[j,N,o,n]),D=C.useCallback(()=>{if(j)return;const I=N("ignore");d("ignore"),n("Ignore this self-evolution review.",I)},[j,N,n]);return u.jsxs("div",{className:"ckpt-panel ckpt-delivery-feedback",children:[u.jsxs("div",{className:"ckpt-header",children:[u.jsx("div",{className:"ckpt-icon ckpt-icon-user-input",children:u.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("path",{d:"M8 1.5L14 5v4.5c0 2.25-1.8 4.25-6 5-4.2-.75-6-2.75-6-5V5L8 1.5Z"}),u.jsx("path",{d:"M5.5 8.25L7.25 10l3.25-4"})]})}),u.jsx("div",{className:"ckpt-title",children:x}),u.jsx("span",{className:"ckpt-badge ckpt-badge-scope",children:String(t.feedback_scope??"final").replace(/_/g," ")}),r&&u.jsx("span",{className:"ckpt-badge ckpt-badge-responded",children:h})]}),v&&v!==x&&u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Summary"}),u.jsx(bi,{content:v,className:"ckpt-markdown"})]}),p&&u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Review Request"}),u.jsx(bi,{content:p,className:"ckpt-markdown"})]}),S&&u.jsxs("details",{className:"ckpt-runtime-details",children:[u.jsx("summary",{children:"Runtime State"}),u.jsxs("div",{className:"ckpt-runtime-body",children:[w&&u.jsxs("div",{children:["Worktree: ",u.jsx("code",{children:w})]}),_.length>0&&u.jsxs("div",{children:["Active subagents: ",_.length]}),k.length>0&&u.jsxs("div",{children:["Pending permission records: ",k.length]})]})]}),!r&&u.jsxs("div",{className:"ckpt-actions ckpt-actions-inline-feedback",children:[u.jsx("button",{className:"ckpt-btn ckpt-btn-approve",onClick:O,disabled:j,children:"Fully Agree"}),u.jsx("button",{className:"ckpt-btn ckpt-btn-cancel",onClick:D,disabled:j,children:"Ignore"}),u.jsx("textarea",{className:"ckpt-feedback-input ckpt-feedback-inline-input",placeholder:"Feedback for self-evolution...",value:o,onChange:I=>a(I.target.value),disabled:j,rows:2}),u.jsx("button",{className:"ckpt-btn ckpt-btn-feedback",onClick:R,disabled:j||!o.trim(),children:"Send Feedback"})]})]})}),df="__other__",aF=["A","B","C"];function es(e){return String(e??"").trim()}function lF(e,t){const n=es(e.question),i=es(e.header);if(!n&&!i)return null;const r=(e.options??[]).slice(0,3).map((o,a)=>({id:es(o.id)||String.fromCharCode(97+a),label:es(o.label),description:es(o.description)})).filter(o=>o.label);return{id:es(e.id)||`question_${t+1}`,header:i,question:n||i,options:r,allow_freeform:e.allow_freeform!==!1,required:e.required!==!1}}const cF=Nt.memo(function({meta:t,onReply:n,responded:i}){const[r,o]=C.useState(""),[a,c]=C.useState({}),d=i,m=String(t.work_item_projection_title??t.work_item_projection_id??"Input Needed").trim()||"Input Needed",h=String(t.summary??"").trim(),p=String(t.prompt??"").trim(),g=String(t.context_note??"").trim(),x=String(t.resume_hint??"").trim(),v=C.useMemo(()=>(t.questions??[]).map(q=>String(q).trim()).filter(Boolean),[t.questions]),_=C.useMemo(()=>(t.input_questions??[]).map((q,Y)=>lF(q,Y)).filter(q=>q!==null),[t.input_questions]),k=_.some(q=>(q.options??[]).length>0),w=C.useMemo(()=>(t.required_fields??[]).map(q=>String(q).trim()).filter(Boolean),[t.required_fields]),S=C.useMemo(()=>(t.active_subagents??[]).filter(q=>!!q&&typeof q=="object"),[t.active_subagents]),j=C.useMemo(( Line truncated
`),{user_input_answers:q})},[a,P,_,d,n]);return u.jsxs("div",{className:"ckpt-panel ckpt-user-input",children:[u.jsxs("div",{className:"ckpt-header",children:[u.jsx("div",{className:"ckpt-icon ckpt-icon-user-input",children:u.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("path",{d:"M3 3.5h10v6H6.5L3 13V3.5Z"}),u.jsx("path",{d:"M5.5 6h5"}),u.jsx("path",{d:"M5.5 8h3.5"})]})}),u.jsx("div",{className:"ckpt-title",children:m}),u.jsx("span",{className:"ckpt-badge ckpt-badge-scope",children:"awaiting input"}),d&&u.jsx("span",{className:"ckpt-badge ckpt-badge-responded",children:"Responded"})]}),h&&u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Summary"}),u.jsx(bi,{content:h,className:"ckpt-markdown"})]}),p&&u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Request"}),u.jsx(bi,{content:p,className:"ckpt-markdown"})]}),k?u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Questions"}),u.jsx("div",{className:"ckpt-choice-list",children:_.map(q=>{const Y=a[q.id]??{freeformText:""},Q=q.options??[],V=q.allow_freeform!==!1,U=V&&(Q.length===0||Y.selectedOptionId===df);return u.jsxs("div",{className:"ckpt-choice-question",children:[q.header&&u.jsx("div",{className:"ckpt-question-header",children:q.header}),u.jsx(bi,{content:q.question,className:"ckpt-markdown"}),Q.length>0&&u.jsxs("div",{className:"ckpt-choice-grid",children:[Q.map((Z,F)=>{const K=Y.selectedOptionId===Z.id;return u.jsxs("button",{className:`ckpt-choice-option${K?" is-selected":""}`,onClick:()=>A(q.id,Z.id),children:[u.jsx("span",{className:"ckpt-choice-letter",children:aF[F]??"?"}),u.jsxs("span",{className:"ckpt-choice-copy",children:[u.jsx("span",{className:"ckpt-choice-label",children:Z.label}),Z.description&&u.jsx("span",{className:"ckpt-choice-desc",children:Z.description})]})]},Z.id)}),V&&u.jsxs("button",{className:`ckpt-choice-option${Y.selectedOptionId===df?" is-selected":""}`,onClick:()=>A(q.id,df),children:[u.jsx("span",{className:"ckpt-choice-letter",children:"D"}),u.jsxs("span",{className:"ckpt-choice-copy",children:[u.jsx("span",{className:"ckpt-choice-label",children:"Other"}),u.jsx("span",{className:"ckpt-choice-desc",children:"Enter a custom answer"})]})]})]}),U&&u.jsx("textarea",{className:"ckpt-feedback-input ckpt-other-field",placeholder:"Type your answer...",value:Y.freeformText,onChange:Z=>B(q.id,Z.target.value),rows:3})]},q.id)})})]}):v.length>0&&u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Questions"}),u.jsx("ul",{className:"ckpt-task-list",children:v.map(q=>u.jsx("li",{children:q},q))})]}),w.length>0&&u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Required Fields"}),u.jsx("div",{className:"ckpt-task-tags",children:w.map(q=>u.jsx("span",{className:"ckpt-field-tag",children:q},q))})]}),g&&u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Context"}),u.jsx(bi,{content:g,className:"ckpt-markdown ckpt-markdown-muted"})]}),x&&u.jsx("div",{className:"ckpt-escalation-hint",children:x}),M&&u.jsxs("details",{className:"ckpt-runtime-details",children:[u.jsx("summary",{children:"Runtime State"}),u.jsxs("div",{className:"ckpt-runtime-body",children:[O&&u.jsxs("div",{children:["Requester: ",u.jsx("code",{children:O})]}),D&&u.jsxs("div",{children:["Work item: ",u.jsx("code",{children:D})]}),R&&u.jsxs("div",{children:["Task: ",u.jsx("code",{children:R})]}),I&&u.jsxs("div",{children:["Seat: ",u.jsx("code",{children:I})]}),N&&u.jsxs("div",{children:["Worktree: ",u.jsx("code",{children:N})]}),S.length>0&&u.jsxs("div",{children:["Active subagents: ",S.length]}),j.length>0&&u.jsxs("div",{children:["Pending permission records: ",j.length]})]})]}),!d&&u.jsxs("div",{className:"ckpt-feedback-area",children:[k?null:u.jsx("textarea",{className:"ckpt-feedback-input",placeholder:"Reply with the missing input to continue...",value:r,onChange:q=>o(q.target.value),rows:3}),u.jsx("div",{className:"ckpt-feedback-btns",children:u.jsx("button",{className:"ckpt-btn ckpt-btn-approve",onClick:k?$:G,disabled:k?!P:!r.trim(),children:"Send Reply"})})]})]})}),lv={todo:"To do",in_progress:"In progress",in_review:"In review",done:"Done"};function oy(e,t){if(t&&t in lv)return t;switch(e){case"active":return"in_progress";case"waiting":return"in_review";case"done":return"done";case"failed":return"done";case"pending":return"todo";default:return"todo"}}function ff(e){return lv[e]??lv.todo}const iC={active:0,waiting:1,failed:2,done:3,pending:4};function uF(e){if(e.length===0)return"pending";let t=e[0],n=iC[t]??99;for(const i of e){const r=iC[i]??99;r<n&&(t=i,n=r)}return t}const dF={native:"Native",codex:"Codex",claude_code:"Claude Code",cursor Line truncated
`)[0].slice(0,140),tone:"danger"};const o=t.match(/^\[Company:([^\]]+)\]\s*(.+)$/);if(o){const d=o[1].split("::"),m=d[0]||"company",h=o[2].trim(),p=h.toLowerCase(),g=p.includes("completed")||p.includes("done")?"success":p.includes("blocked")||p.includes("failed")?"warning":"info";return{kind:"company_event",label:`${m.toUpperCase()} · ${d[1]??""}`.replace(/ · $/,""),summary:h,tone:g}}const a=t.match(/^(Review needed|Status digest|Blocked|Completion):\s*(.+)$/i);if(a){const d=a[1].replace(/\b\w/g,h=>h.toUpperCase()),m=uy(a[2]);return{kind:"company_event",label:d,summary:m,tone:/^Blocked$/i.test(a[1])?"warning":"info"}}const c=t.match(/^NO_DELEGATION_JUSTIFICATION:\s*(.+)$/i);return c?{kind:"company_event",label:"Delegation check",summary:uy(c[1]).slice(0,180),tone:"info"}:null}function BF(e,t){const{isCompanyRuntime:n,detailMode:i}=t;if(!n||i==="full"||gu(e.metadata))return null;const r=PI(e.content);if(!r)return null;const o=e.sender==="system"||e.metadata?.type==="system",a=r.kind==="company_event"||e.content.startsWith("[Company:");return!o&&!a?null:{msg:e,classification:r}}function $F(e,t={}){const{isCompanyRuntime:n=!1,detailMode:i="summary"}=t,r=[];let o=[],a=0;const c=()=>{if(o.length===0)return;const d=o[0].msg;r.push({kind:"ops-bundle",id:`ops:${ia(d)}`,timestamp:d.timestamp,events:o,sortOrder:a}),o=[]};return e.forEach((d,m)=>{const h=m*2+1,p=BF(d,{isCompanyRuntime:n,detailMode:i});if(p){o.length===0&&(a=h),o.push(p);return}c(),r.push({kind:"message",id:ia(d),timestamp:d.timestamp,msg:d,sortOrder:h})}),c(),r}const HF=Nt.memo(function({msg:t,showDate:n,dateStr:i,classification:r}){const[o,a]=C.useState(!1),c=t.content.trim()!==`[${r.label}] ${r.summary}`.trim()&&t.content.trim().length>r.summary.length+4;return u.jsxs("div",{children:[n&&u.jsx("div",{className:"msg-date-sep",children:u.jsx("span",{children:i})}),u.jsxs("div",{className:`msg-ops-row msg-ops-tone-${r.tone}${o?" expanded":""}`,onClick:c?()=>a(d=>!d):void 0,role:c?"button":void 0,tabIndex:c?0:-1,children:[u.jsx("span",{className:"msg-ops-dot","aria-hidden":"true"}),u.jsx("span",{className:"msg-ops-label",children:r.label}),r.summary&&u.jsx("span",{className:"msg-ops-summary",title:r.summary,children:r.summary}),u.jsx("span",{className:"msg-ops-time",title:Os(t.timestamp),children:jo(t.timestamp)}),c&&u.jsx("span",{className:`msg-ops-chevron${o?" open":""}`,"aria-hidden":"true",children:u.jsx(rs,{down:o})})]}),c&&o&&u.jsx("div",{className:"msg-ops-details",children:u.jsx("pre",{className:"msg-ops-details-pre",children:t.content})})]})}),FF=Nt.memo(function({events:t,showDate:n,dateStr:i}){const[r,o]=C.useState(!1);if(t.length===0)return null;const a=t[0].msg,c=t[t.length-1].msg,d=t.reduce((p,g)=>{const x=g.classification.kind==="company_event"?"company":g.classification.kind.startsWith("external")?"runtime":"delegation";return p[x]=(p[x]??0)+1,p},{}),m=Object.entries(d).map(([p,g])=>`${g} ${p}`).join(" · "),h=`${t.length} technical event${t.length===1?"":"s"} hidden`;return u.jsxs("div",{children:[n&&u.jsx("div",{className:"msg-date-sep",children:u.jsx("span",{children:i})}),u.jsxs("button",{type:"button",className:`msg-ops-bundle${r?" expanded":""}`,onClick:()=>o(p=>!p),title:`${Os(a.timestamp)} - ${Os(c.timestamp)}`,children:[u.jsx("span",{className:"msg-ops-bundle-dot"}),u.jsx("span",{className:"msg-ops-bundle-title",children:h}),u.jsx("span",{className:"msg-ops-bundle-summary",children:m}),u.jsx("span",{className:"msg-ops-bundle-time",children:jo(a.timestamp)}),u.jsx("span",{className:"msg-ops-bundle-chevron",children:u.jsx(rs,{down:r})})]}),r&&u.jsx("div",{className:"msg-ops-bundle-details",children:t.map(({msg:p,classification:g})=>u.jsxs("div",{className:`msg-ops-bundle-event msg-ops-tone-${g.tone}`,children:[u.jsx("span",{className:"msg-ops-dot"}),u.jsx("span",{className:"msg-ops-label",children:g.label}),u.jsx("span",{className:"msg-ops-summary",children:g.summary}),u.jsx("span",{className:"msg-ops-time",title:Os(p.timestamp),children:jo(p.timestamp)})]},p.id))})]})});function VF(e){return e.kind==="review"?`Review · ${e.verdict?e.verdict.replace(/_/g," "):"review"}`:e.kind==="report"?"Report":"Update"}const UF=Nt.memo(function({msg:t,payload:n,showDate:i,dateStr:r,isCopied:o,onCopy:a}){const c=zI(t.sender==="system"?t.senderName||"OPC":t.sender),d=t.senderDeleted?"[Deleted]":t.senderName,m=VF(n),h=n.summary||n.acceptanceSummary||m;return u.jsxs("div",{children:[i&&u.jsx("div",{className:"msg-date-sep",children:u.jsx("span",{children:r})}),u.jsxs("div",{className:"msg-row agent msg-row-project-update",children:[u.jsx("div",{className:"msg-avatar agent-avatar",style:{background:c},children:d.charAt(0).toUpperCase()}),u.jsxs("div",{className:"msg-body",children:[u.jsxs("div",{className:"msg-agent-header",children:[u.jsx("span",{className:"msg-sender",style:{color:c},children:d}),u.jsx("span",{className:"msg-time",title:Os(t.timestamp),children:jo(t.timestamp)})]}),u.jsxs("div",{className:`msg-project-update-card msg-project-uLine truncated
Set up at least one role before running a task.
Go to Org tab now?`)&&n?.(),!1;if(a.length>1&&!c)return confirm(`Your organization has multiple top-level roles but no final decider selected.
Choose one final decider in the Org tab before running a task.
Go to Org tab now?`)&&n?.(),!1;const d=[],m=new Set(i.map(x=>x.role_id));o.runtimeTeams.filter(x=>x.member_role_ids.some(v=>m.has(v))||x.manager_role_id&&m.has(x.manager_role_id)).length===0&&d.push("No runtime teams defined — the system will auto-generate from your roles");const p=new Set(r.map(x=>x.role_id)),g=i.filter(x=>!p.has(x.role_id));if(g.length>0){const x=g.map(v=>v.name).join(", ");d.push(`${g.length} role(s) have no employees: ${x}`)}return d.length>0?confirm(`Before running this task:
`+d.map(x=>"• "+x).join(`
`)+`
Run anyway?`):!0}function kV(e){if(!e)return!1;const t=Um(e);return!!(t.projectRun?.run_id||t.runtimeTeams.length>0||t.runtimeSeats.length>0)}function SV(e,t){return e?e.execMode==="company"||e.execMode==="org"||e.execMode==="custom"?"summary":"full":"summary"}function yy(e,t=0){if(!e)return!1;const n=String(e.execMode??"").trim().toLowerCase();return t>0||!!e.isCompanyRuntime||!!e.roleWorkItems||!!e.executorRoleWorkItems||n==="company"||n==="org"||n==="custom"}function kC(e){return String(e?.originTaskId??e?.taskId??"").trim()||null}function wV({boardColor:e,title:t,onCommit:n}){const[i,r]=C.useState(!1),[o,a]=C.useState(t),c=C.useRef(null);C.useEffect(()=>{i||a(t)},[t,i]);const d=C.useCallback(()=>{const h=o.trim();h&&h!==t?n(h):a(t),r(!1)},[o,t,n]),m=C.useCallback(()=>{a(t),r(!0),setTimeout(()=>c.current?.select(),0)},[t]);return u.jsx("div",{className:"board-selector",children:u.jsx("div",{className:"board-tabs",children:u.jsxs("span",{className:"board-tab active board-tab-editable",style:{"--board-color":e},children:[u.jsx("span",{className:"board-tab-dot",style:{background:e}}),i?u.jsx("input",{ref:c,className:"board-tab-title-input",value:o,onChange:h=>a(h.target.value),onBlur:d,onKeyDown:h=>{h.key==="Enter"&&d(),h.key==="Escape"&&(a(t),r(!1))}}):u.jsx("span",{className:"board-tab-title",onClick:m,title:"Click to edit session title",children:t})]})})})}function CV({boardStore:e,agents:t,officeMap:n,execMode:i,companyProfile:r,taskPreferredAgent:o,chatStore:a,sessionStore:c,projectId:d,onRunTask:m,onCreateTask:h,onMoveTask:p,onCreateSession:g,onSessionSend:x,onSecretarySend:v,onDeleteSession:_,onTitleChange:k,onSessionConfigChange:w,onSessionTaskAgentChange:S,onContinueInNewChat:j,onSessionStop:N,onSessionResume:O,onSessionComplete:R,onLoadSessionDetail:D,onOpenExecutionPanel:I,onCollabSync:L,orgInfoData:M,onNavigateToOrg:A,commsState:B,commsMessage:W,onCommsRefresh:P,onCommsReadMessage:G,savedOrgsList:$,activeSavedOrg:q,onSavedOrgsList:Y,onSavedOrgLoad:Q}){const{sessions:V,activeSessionId:U,activeSession:Z}=c,{markRead:F}=a,[K,ee]=C.useState("collapsed"),{width:te,isResizing:se,handleMouseDown:ae}=vV({initialWidth:380,minWidth:300,maxWidth:600,onCollapse:()=>ee("collapsed")}),[ue,ie]=C.useState("chat"),[we,je]=C.useState(null),[Te,Ge]=C.useState({kind:"activity"}),[Ze,Xe]=C.useState([]),[mt,Ft]=C.useState(!1),[Dt,jt]=C.useState({}),he=C.useRef(D),ze=C.useRef(V),ot=C.useRef(a.getChannelMessages),Ve=C.useRef({scope:null,active:new Set,child:null}),lt=C.useRef(new Set),me=C.useRef(0);ze.current=V,ot.current=a.getChannelMessages;const be=i==="company"||i==="org"||i==="custom",Ae=`secretary:${d}`,Be=`activity:${d}`,We=C.useMemo(()=>we?V.find(de=>de.taskId===we)??null:null,[V,we]),zt=C.useMemo(()=>Te.kind!=="task-detail"?null:e.tasks.find(de=>de.id===Te.taskId)??null,[Te,e.tasks]),ht=C.useMemo(()=>{const de=Vm(zt);return de?V.find(ve=>ve.taskId===de||ve.runtimeTaskId===de||ve.executionTurnId===de)??null:null},[V,zt]),ke=C.useMemo(()=>ht?a.getChannelMessages(ht.channelId):[],[a.messages,a.getChannelMessages,ht]),qe=C.useMemo(()=>Af(Z,V),[V,Z]),Qe=C.useMemo(()=>Wf(Z,V),[V,Z]),$e=C.useMemo(()=>Yf(Z,[...Qe,...qe]),[Z,qe,Qe]);C.useEffect(()=>{he.current=D},[D]);const Fe=C.useCallback((de,ve,Pe="summary")=>{const ut=he.current;if(!ut||!de)return;const an=me.current,ce=ze.current.find(_t=>_t.taskId===de)?.channelId,Se=ve&&ce&&ve.channelId!==ce?ot.current(ce).find(_t=>$v(_t,Pe)):ve,Le=[an,de,Pe,Se?.timestamp??"latest",Se?.id??""].join("|");if(lt.current.has(Le))return;lt.current.add(Le),jt(_t=>_t[de]?_t:{..._t,[de]:!0});let Ue;try{Ue=ut(de,{limit:bV,beforeCreatedAt:Se?.timestamp,beforeMessageId:Se?.id,detailLevel:Pe})}catch{lt.current.delete(Le),me.current===an&&(jt(ct=>ct[de]?{...ct,[de]:!1}:ct),Ve.current.active.delete(`${de}:${Pe}`),Ve.current.child===de&&(Ve.current.child=null));return}return Promise.resolve(Ue).catch(()=>{me.current===an&&(Ve.current.active.delete(`${de}:${Pe}`),Ve.current.child===de&&(Ve.current.child=null))}).finally(()=>{if(lt.current.delete(Le),me.current!==an)return;const _t=`${an}|${de}|`;[...lt.current.keys()].some(nt=>nt.startsWith(_t))||jt(nt=>nt[de]?{...nt,[de]:!1}:nt)})},[]),Vt=C.useCallback(de=>!!Dt[de],[Dt]);C.useLayoutEffect(()=>{me.current+=1,lt.current.clear(),Ve.current={scope:null,active:new Set,child:null},jt({})},[d]),C.useEffect(()=>()=>{me.current+=1,lt.current.clear()},[]),C.useEffect(()=>{we&&!We&&je(null)},[we,We]),C.useEffect(()=>{Te.kind==="task-detail"&&!zt&&Ge({kind:"activity"})},[Te,zt]);const ei=C.useRef(null);C.useEffect(()=>{if(!ht){ei.current=null;return}ei.current!==ht.taskId&&(ei.current=ht.taskId,Fe(ht.taskId,void 0,"full"))},[ht,Fe]),C.useEffect(()=>{if(!we){Ve.current.child=null;return}Ve.current.child!==we&&(Ve.current.child=we,Fe(we,void 0,"full"))},[we,Fe]),C.useEffect(()=>{if(!U){Ve.current.scope=null,Ve.current.active.clear();return}Ve.current.scope!==U&&(Ve.current.scope=U,Ve.current.active.clear());const de=$e.timelineSessions.length>0?$e.timelin Line truncated
`).replace(/\r/g,`
`).split(`
`).map(t=>t.trimEnd()).join(`
`).replace(/\n{3,}/g,`
`).trim()}function wC(e){const t=dv(e),n=EV(t),i=n.split(/\n{2,}/).map(r=>r.trim()).filter(Boolean);return i.length>1&&/^Verification:\s/i.test(i[i.length-1])?i.slice(0,-1).join(`
`).trim():n}function EV(e){let t=String(e||"").trim();for(;;){const n=t.match(/^\*\*([^\r\n]{8,160}?)\*\*:(?:[ \t]+|\r?\n+)([\s\S]+)$/);if(!n)return t;const i=n[2].trim();if(i.length<80||i===t)return t;t=i}}function NV(e,t,n,i){if(!i)return n.content;const r=dv(e.content),o=dv(t.content);return!r||!o||r===o?n.content:r.endsWith(o)?e.content:o.endsWith(r)?t.content:n.content}function Tl(e){const t=Pr(e),n=new Set,i=typeof t.checkpoint_type=="string"?t.checkpoint_type.trim():"",r=typeof t.checkpoint_id=="string"?t.checkpoint_id.trim():"";for(const o of[e.id,typeof t.ui_message_id=="string"?t.ui_message_id:"",typeof t.result_delivery_id=="string"&&t.result_delivery_id.trim()?`delivery:${t.result_delivery_id.trim()}`:"",i&&r?`checkpoint:${i}:${r}`:""]){const a=String(o??"").trim();a&&n.add(a)}return n}function cl(e){return new Set([...Tl(e)].map(t=>`${e.channelId}\0${t}`))}function IV(e){return e.startsWith("checkpoint:")||e.startsWith("delivery:")}function ui(e){return typeof e.timestamp=="number"?e.timestamp:0}function fv(e){return String(e.id??"").startsWith("msg-")}function VI(e){return!fv(e)}function CC(e){const t={};for(const n of e){if(!VI(n))continue;const i=ui(n);i>(t[n.channelId]??0)&&(t[n.channelId]=i)}return t}function TV(e,t,n){return n<=(e[t]??0)?e:{...e,[t]:n}}function RV(e,t){const n={};for(const i of e){if(!VI(i)||i.sender==="user")continue;const r=t[i.channelId]??0;ui(i)<=r||(n[i.channelId]=(n[i.channelId]??0)+1)}return n}function jC(e){const t=String(e.sender??"").trim().toLowerCase(),n=Pr(e),i=typeof n.role=="string"?n.role.trim().toLowerCase():"";return t==="user"||i==="user"?"user":"assistant"}function EC(e){const t=Pr(e),n=String(e.sender??"").trim().toLowerCase();let i=0;const r=UI(e);return r&&(i+=1e3+r),t.source==="engine"&&(i+=100),n&&n!=="system"&&(i+=20),n&&!["assistant","system","user"].includes(n)&&(i+=5),e.replyToId&&(i+=2),i+=Math.min(Object.keys(t).length,10),i}function NC(e){return String(Pr(e).source??"").trim().toLowerCase()==="engine"}function UI(e){const t=Pr(e),n=String(t.transcript_kind??"").trim();if(n)return SC[n]??0;const i=String(t.kind??"").trim();return SC[i]??0}function Rl(e){return UI(e)>0}function GI(e,t){if(e.channelId!==t.channelId)return!1;const n=Tl(e),i=Tl(t);for(const r of n)if(i.has(r))return!0;return!1}function fm(e,t){if(GI(e,t))return!0;if(e.channelId!==t.channelId||jC(e)!==jC(t)||wC(e.content)!==wC(t.content))return!1;const n=Rl(e)&&Rl(t);if(!n&&String(e.replyToId??"")!==String(t.replyToId??"")||!(NC(e)||NC(t)))return!1;const i=ui(e),r=ui(t);return!(!n&&i&&r&&Math.abs(i-r)>R0)}function mm(e,t,n=!1){let i=e,r=t;const o=fv(e),a=fv(t);o!==a?(i=o?t:e,r=o?e:t):(n||EC(t)>EC(e))&&(i=t,r=e);const c=[];for(const j of[r.mentions,i.mentions])for(const N of j??[])c.includes(N)||c.push(N);const d=Tl(e),m=Tl(t);let h=!1,p="";for(const j of d)m.has(j)&&(IV(j)||(h=!0,p||(p=j)));const g=NV(e,t,i,h),x=String(Pr(e).checkpoint_id??"").trim(),v=String(Pr(t).checkpoint_id??"").trim(),_=!!x&&x===v,k=Rl(e)&&Rl(t),w=k?String(Pr(e).ui_timeline_id??Pr(t).ui_timeline_id??Bv(e)).trim():"",S={...Pr(r),...Pr(i)};return w&&(S.ui_timeline_id=w),{...r,...i,...p?{id:p}:{},content:g,metadata:S,mentions:c,timestamp:_||k?ui(e)||ui(t):ui(i)||ui(r)}}function IC(e){const t=[],n=new Map;for(const i of[...e].sort((r,o)=>ui(r)-ui(o))){const r=cl(i);let o=-1,a=!1;for(const d of r){const m=n.get(d);if(m!==void 0){o=m,a=t[m].id===i.id;break}}if(o===-1){const d=ui(i),m=Rl(i);for(let h=t.length-1;h>=0;h--){const p=ui(t[h]);if(!m&&d>0&&p>0&&d-p>R0)break;if(fm(t[h],i)){o=h;break}}}const c=o===-1?t.length:o;o===-1?t.push(i):t[o]=mm(t[o],i,a);for(const d of cl(t[c]))n.has(d)||n.set(d,c)}return t}function AV(e,t){const n=[...e],i=new Map;n.forEach((r,o)=>{for(const a of cl(r))i.set(a,o)});for(const r of[...t].sort((o,a)=>ui(o)-ui(a))){let o=-1;for(const a of cl(r)){const c=i.get(a);if(c!==void 0){o=c;break}}if(o<0){for(let a=n.length-1;a>=0;a-=1)if(fm(n[a],r)){o=a;break}}if(o<0)o=n.length,n.push(r);else{const a=n[o];n[o]=mm(a,r,a.id===r.id)}for(const a of cl(r))i.set(a,o);for(const a of cl(n[o]))i.set(a,o)}return n.sort((r,o)=>ui(r)===ui(o)?r.id.localeCompare(o.id):ui(r)-ui(o))}function MV(e,t){switch(t.type){case"SET":return t.channels;case"CLEAR":return[];case"ADD":return e.some(n=>n.id===t.channel.id)?e:[...e,t.channel];case"REMOVE":return e.filter(n=>n.id!==t.channelId);case"REMOVE_PARTICIPANT":return e.map(n=>({...n,participants:n.participants.filter(i=>i!==t.agentId)}));default:return e}}function DV(e,t){switch(t.type){case"SET":{const n=IC(t.messages);if(e.length===0)return n;const i=e.filter(r=>typeof r.id=="string"&&r.id.startsWith("msg-")&&!n.some(o=>fm(r,o)));return i.length===0?n:IC([...n,...i])}case"CLEAR":return[];case"ADD":{const n=ui(t.message);Tl(t.message);let i=!1;for(let r=e.length-1;r>=0;r--){const o=ui(e[r]);if(!i&&n>0&&o>0&&n-o>R0&&(i=!0),GI(e[r],t.message)){const a=[...e];return a[r]=mm(e[r],t.message,e[r].id===t.message.id),a}if((Rl(t.message)||!i)&&fm(e[r],t.message)){const a=[ Line truncated
${t}`:`${e}${t}`}function LV(e,t){const n=e.trim().replace(/\s+/g," ");return n?n.length>120?`${n.slice(0,120).trimEnd()}...`:n:t||"Thinking"}function zV(e){return{timestamp:Number.isFinite(e.timestamp)?e.timestamp:Date.now(),type:e.type,summary:typeof e.summary=="string"?e.summary:"",detail:typeof e.detail=="string"&&e.detail?e.detail:void 0,turnId:typeof e.turnId=="string"&&e.turnId?e.turnId:void 0,itemId:typeof e.itemId=="string"&&e.itemId?e.itemId:void 0,streamId:typeof e.streamId=="string"&&e.streamId?e.streamId:void 0,toolCallId:typeof e.toolCallId=="string"&&e.toolCallId?e.toolCallId:void 0,permissionGroupKey:typeof e.permissionGroupKey=="string"&&e.permissionGroupKey?e.permissionGroupKey:void 0,seq:typeof e.seq=="number"&&Number.isFinite(e.seq)?e.seq:void 0,executionMode:typeof e.executionMode=="string"&&e.executionMode?e.executionMode:void 0}}function pm(e){const t=e.itemId||e.streamId;return t?`${e.type}:${e.turnId??""}:${t}`:e.toolCallId&&(e.type==="tool_call"||e.type==="autonomy")?`${e.type}:${e.turnId??""}:${e.toolCallId}`:e.permissionGroupKey&&e.type==="autonomy"?`${e.type}:${e.turnId??""}:${e.permissionGroupKey}`:""}function PV(e,t){const n=pm(e),i=pm(t);return n&&i?n===i:t.timestamp-e.timestamp>Km||e.type!==t.type?!1:e.type==="thinking"||e.type==="assistant"?!0:e.type==="tool_call"?e.summary===t.summary:!1}function BV(e,t){return t.timestamp-e.timestamp<=Km&&e.type===t.type&&e.summary===t.summary&&(e.detail??"")===(t.detail??"")}function $V(e,t){if(e.type==="thinking"||e.type==="assistant"){const n=mv(e.detail??"",t.detail??"","thinking");return{timestamp:e.timestamp,type:e.type,summary:LV(n,t.summary||e.summary),detail:n||void 0,turnId:t.turnId??e.turnId,itemId:t.itemId??e.itemId,streamId:t.streamId??e.streamId,toolCallId:t.toolCallId??e.toolCallId,permissionGroupKey:t.permissionGroupKey??e.permissionGroupKey,seq:t.seq??e.seq,executionMode:t.executionMode??e.executionMode}}if(e.type==="tool_call"){const n=mv(e.detail??"",t.detail??"","tool_call");return{timestamp:e.timestamp,type:"tool_call",summary:t.summary||e.summary,detail:n||void 0,turnId:t.turnId??e.turnId,itemId:t.itemId??e.itemId,streamId:t.streamId??e.streamId,toolCallId:t.toolCallId??e.toolCallId,permissionGroupKey:t.permissionGroupKey??e.permissionGroupKey,seq:t.seq??e.seq,executionMode:t.executionMode??e.executionMode}}return t}function qI(e,t,n=100){const i=zV(t),r=pm(i),o=r?[...e].reverse().findIndex(d=>pm(d)===r):-1,a=o>=0?e.length-1-o:e.length-1,c=e[a];return c?r&&o>=0&&typeof c.seq=="number"&&typeof i.seq=="number"&&i.seq<=c.seq?e:BV(c,i)?yl([...e.slice(0,a),c,...e.slice(a+1)],n):PV(c,i)?yl([...e.slice(0,a),$V(c,i),...e.slice(a+1)],n):yl([...e,i],n):[i]}function WI(e,t=100){return(Array.isArray(e)?e:[]).reduce((n,i)=>qI(n,i,t),[])}function HV(e){return{timestamp:Number.isFinite(e.timestamp)?e.timestamp:Date.now(),type:e.type,workItemProjectionId:typeof e.workItemProjectionId=="string"&&e.workItemProjectionId?e.workItemProjectionId:void 0,workItemTurnType:typeof e.workItemTurnType=="string"&&e.workItemTurnType?e.workItemTurnType:void 0,workItemProjectionTitle:typeof e.workItemProjectionTitle=="string"&&e.workItemProjectionTitle?e.workItemProjectionTitle:void 0,runtimeTaskId:typeof e.runtimeTaskId=="string"&&e.runtimeTaskId?e.runtimeTaskId:void 0,executionTurnId:typeof e.executionTurnId=="string"&&e.executionTurnId?e.executionTurnId:void 0,roleName:typeof e.roleName=="string"&&e.roleName?e.roleName:void 0,detail:typeof e.detail=="string"&&e.detail?e.detail:void 0}}function YI(e,t){return e.type===t.type&&(e.workItemProjectionId??"")===(t.workItemProjectionId??"")&&(e.workItemTurnType??"")===(t.workItemTurnType??"")&&(e.workItemProjectionTitle??"")===(t.workItemProjectionTitle??"")&&(e.executionTurnId??e.runtimeTaskId??"")===(t.executionTurnId??t.runtimeTaskId??"")&&(e.roleName??"")===(t.roleName??"")}function FV(e,t){return t.timestamp-e.timestamp<=Km&&YI(e,t)&&(e.type==="thinking"||e.type==="tool_call")}function VV(e,t){return YI(e,t)&&(e.detail??"")===(t.detail??"")&&t.timestamp-e.timestamp<=Km}function UV(e,t){const n=t.type==="tool_call"?"tool_call":"thinking";return{...e,...t,timestamp:t.timestamp,detail:mv(e.detail??"",t.detail??"",n)||void 0}}function XI(e,t,n=100){const i=HV(t),r=e[e.length-1];return r?VV(r,i)?yl([...e.slice(0,-1),{...r,timestamp:i.timestamp}],n):FV(r,i)?yl([...e.slice(0,-1),UV(r,i)],n):yl([...e,i],n):[i]}function KI(e,t=100){return(Array.isArray(e)?e:[]).reduce((n,i)=>XI(n,i,t),[])}function pv(e){const t=String(e??"").trim().toLowerCase();return t==="company"?"company":t==="org"||t==="custom"?"org":"task"}function GV(e){return String(e??"").trim().toLowerCase()==="custom"?"custom":"corporate"}function ZI(e){const t=String(e.execMode??"").trim().toLowerCase(),n=String(e.companyProfile??"").trim().toLowerCase(),i=String(e.orgId??"").trim(),o=t.length>0?pv(t):n==="custom"||i?"org":pv(t);return o==="org"?{...e,execMode:"org",companyProfile:"custom",orgId:i||void 0}:o==="company"?{...e,execMode:"company" Line truncated
`)),[L,M]=C.useState(!1),A=C.useRef(e.role_id);C.useEffect(()=>{A.current!==e.role_id&&(A.current=e.role_id,d(e.name),h(e.responsibility),g(e.reports_to),v(e.icon??null),k(new Set(e.can_spawn)),S(new Set(e.tools)),N(e.runtime_policy?.execution_strategy??"auto"),R(e.preferred_external_agent??null),I((e.prompt_refs??[]).join(`
`)),M(!1))},[e]);const B=C.useRef({}),W=C.useRef(null),P=C.useRef(e.role_id);C.useEffect(()=>{P.current=e.role_id},[e.role_id]);const G=C.useCallback(()=>{W.current&&(clearTimeout(W.current),W.current=null);const ie=B.current;B.current={},Object.keys(ie).length!==0&&r(P.current,ie)},[r]),$=C.useCallback(ie=>{i||(B.current={...B.current,...ie},W.current&&clearTimeout(W.current),W.current=setTimeout(G,500))},[G,i]);C.useEffect(()=>()=>{W.current&&(clearTimeout(W.current),W.current=null);const ie=B.current;Object.keys(ie).length>0&&(B.current={},r(P.current,ie))},[r]);const q=ie=>{d(ie),$({name:ie})},Y=ie=>{h(ie),$({responsibility:ie})},Q=ie=>{g(ie),$({reports_to:ie})},V=ie=>{v(ie),$({icon:ie})},U=ie=>{N(ie),$({execution_strategy:ie})},Z=ie=>{R(ie),$({preferred_external_agent:ie})},F=ie=>{I(ie);const we=ie.split(`
`).map(je=>je.trim()).filter(Boolean);$({prompt_refs:we})},K=ie=>{const we=new Set(_);we.has(ie)?we.delete(ie):we.add(ie),k(we),$({can_spawn:Array.from(we)})},ee=ie=>{const we=new Set(w);we.has(ie)?we.delete(ie):we.add(ie),S(we),$({tools:Array.from(we)})},te=C.useMemo(()=>t.filter(ie=>ie.role_id!==e.role_id),[t,e.role_id]),se=C.useMemo(()=>n.filter(ie=>(ie.role_ids?.length?ie.role_ids:[ie.role_id]).includes(e.role_id)).length,[n,e.role_id]),ae=C.useMemo(()=>D.split(`
`).filter(ie=>ie.trim()).length,[D]),ue=()=>{if(!L){M(!0);return}G(),o(e.role_id)};return u.jsxs("aside",{className:"ri-panel","aria-label":`Inspector for role ${e.name}`,children:[u.jsxs("header",{className:"ri-panel-header",children:[u.jsx("img",{src:Fu(x),alt:"",className:"ri-panel-icon"}),u.jsxs("div",{className:"ri-panel-title-wrap",children:[u.jsx("h3",{className:"ri-panel-title",children:c||"(unnamed)"}),u.jsx("code",{className:"ri-panel-id",children:e.role_id})]}),u.jsx("button",{className:"btn btn-ghost btn-sm ri-panel-close",onClick:a,title:"Close (Esc)",children:"✕"})]}),u.jsxs("div",{className:"ri-panel-body",children:[u.jsxs(nl,{title:"Identity",defaultExpanded:!0,children:[u.jsx(Er,{label:"Name",children:u.jsx("input",{className:"ri-text-input",value:c,onChange:ie=>q(ie.target.value),disabled:i})}),u.jsx(Er,{label:"Responsibility",children:u.jsx("textarea",{className:"ri-textarea",rows:3,value:m,onChange:ie=>Y(ie.target.value),disabled:i})}),u.jsx(Er,{label:"Icon",children:u.jsx(yU,{value:x,onChange:V,readOnly:i})})]}),u.jsxs(nl,{title:"Hierarchy",defaultExpanded:!0,children:[u.jsx(Er,{label:"Reports to",children:u.jsxs("select",{className:"ri-select",value:p,onChange:ie=>Q(ie.target.value),disabled:i,children:[u.jsx("option",{value:"owner",children:"You (Owner)"}),te.map(ie=>u.jsx("option",{value:ie.role_id,children:ie.name},ie.role_id))]})}),u.jsx(Er,{label:"Can delegate to",children:u.jsx(xU,{allIds:te.map(ie=>ie.role_id),labelFor:ie=>te.find(we=>we.role_id===ie)?.name??ie,selected:_,onToggle:K,readOnly:i})}),u.jsx(Er,{label:"Employees assigned",children:u.jsx("span",{className:"ri-meta-value",children:se})})]}),u.jsx(nl,{title:`Tools (${w.size})`,children:u.jsx(vU,{tools:w,onToggle:ee,readOnly:i})}),u.jsx(nl,{title:`Prompts (${ae})`,children:u.jsx(Er,{label:"Prompt refs / inline",children:u.jsx("textarea",{className:"ri-textarea ri-textarea-mono",rows:5,placeholder:"One prompt ref or inline instruction per line",value:D,onChange:ie=>F(ie.target.value),disabled:i})})}),u.jsxs(nl,{title:"Runtime policy",children:[u.jsx(Er,{label:"Execution strategy",children:u.jsx("div",{className:"ri-radio-group",children:hU.map(ie=>u.jsxs("label",{className:"ri-radio",title:ie.hint,children:[u.jsx("input",{type:"radio",name:`exec-strategy-${e.role_id}`,value:ie.value,checked:j===ie.value,onChange:()=>U(ie.value),disabled:i}),ie.label]},ie.value))})}),j==="external"&&u.jsx(Er,{label:"Preferred external agent",children:u.jsxs("select",{className:"ri-select",value:O??"",onChange:ie=>Z(ie.target.value||null),disabled:i,children:[u.jsx("option",{value:"",children:"(any)"}),pU.map(ie=>u.jsx("option",{value:ie,children:ie},ie))]})})]}),u.jsxs(nl,{title:"Advanced",children:[u.jsx(Er,{label:"Role type",children:u.jsx("span",{className:"ri-meta-value",children:e.role_type??"worker"})}),u.jsx(Er,{label:"Skills",children:u.jsx("span",{className:"ri-meta-value",children:e.skill_refs&&e.skill_refs.length>0?e.skill_refs.join(", "):"(none)"})}),u.jsx(Er,{label:"Artifact contract",children:u.jsx("span",{className:"ri-meta-value",children:e.artifact_contract_ref??"(none)"})})]})]}),!i&&u.jsx("footer",{className:"ri-panel-footer",children:u.jsx("button",{className:`btn btn-sm ${L?"btn-danger":"btn-ghost"}`,onClick:ue,onBlur:()=>M(!1),children:L?"Confirm delete?":"Delete role"})})]})}function nl({title:e,defaultExpanded:t=!1,children:n}){const[i,r]=C.useState(t);return u.jsxs("section",{className:`ri-group${i?" is-expanded":""}`,children:[u.jsxs("button",{className:"ri-group-header",onClick:()=>r(o=>!o),children:[u.jsx("span",{className:"ri-group-caret",children:i?"▾":"▸"}),u.jsx("span",{className:"ri-group-title",children:e})]}),i&&u.jsx("div",{className:"ri-group-body",children:n})]})}function Er({label:e,children:t}){return u.jsxs("div",{className:"ri-field",children:[u.jsx("label",{className:"ri-field-label",children:e}),u.jsx("div",{className:"ri-field-control",children:t})]})}function yU({value:e,onChange:t,readOnly:n}){const[i,r]=C.useState(!1);return u.jsxs("div",{className:"ri-icon-picker",children:[u.jsxs("button",{className:"ri-icon-picker-trigger",onClick:()=>!n&&r(o=>!o),disabled:n,children:[u.jsx("img",{src:Fu(e),alt:"",className:"ri-icon-picker-current"}),u.jsx("span",{className:"ri-icon-picker-label",children:e??"generic"})]}),i&&u.jsxs("div",{className:"ri-icon-picker-popover",children:[u.jsx("button",{className:`ri-icon-option${e===null?" is-active":""}`,onClick:()=>{t(null),r(!1)},title:"Default icon",children:u.jsx("img",{src:du.generic,alt:""})}),fU.filter(o=>o!=="generic").map(o=>u.jsx("button",{className:`ri-icon-option${e===o?" is-active":""}`,onClick:()=>{t(o),r(!1)},title:o,children:u.jsx("img",{src:du[o],alt:o})},o))]})]})}function xU({allIds:e,labelFor:t,selected:n,onToggle:i,readOnly:r}){const[o,a]=C.useState(!1),c=e.filter(d=>!n.has(d));return u.jsxs("div",{className:"ri-multiselect",children:[u.jsxs("div",{className:"ri-chips",children:[Array.from(n).map(d=>u.jsxs("span",{className:"ri-ch Line truncated
font-size: .6rem;
font-weight: bold;
color: hsl(${Math.max(0,Math.min(120-120*g,120))}deg 100% 31%);`,n?.key)}return r}}function xt(e,t,n,i){return{debug:()=>{var r;return(r=e?.debugAll)!=null?r:e[t]},key:!1,onChange:i}}function kU(e,t,n,i){const r=()=>{var a;return(a=o.getValue())!=null?a:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(i),renderValue:r,getContext:yt(()=>[e,n,t,o],(a,c,d,m)=>({table:a,column:c,row:d,cell:m,getValue:m.getValue,renderValue:m.renderValue}),xt(e.options,"debugCells"))};return e._features.forEach(a=>{a.createCell==null||a.createCell(o,n,t,e)},{}),o}function SU(e,t,n,i){var r,o;const c={...e._getDefaultColumnDef(),...t},d=c.accessorKey;let m=(r=(o=c.id)!=null?o:d?typeof String.prototype.replaceAll=="function"?d.replaceAll(".","_"):d.replace(/\./g,"_"):void 0)!=null?r:typeof c.header=="string"?c.header:void 0,h;if(c.accessorFn?h=c.accessorFn:d&&(d.includes(".")?h=g=>{let x=g;for(const _ of d.split(".")){var v;x=(v=x)==null?void 0:v[_]}return x}:h=g=>g[c.accessorKey]),!m)throw new Error;let p={id:`${String(m)}`,accessorFn:h,parent:i,depth:n,columnDef:c,columns:[],getFlatColumns:yt(()=>[!0],()=>{var g;return[p,...(g=p.columns)==null?void 0:g.flatMap(x=>x.getFlatColumns())]},xt(e.options,"debugColumns")),getLeafColumns:yt(()=>[e._getOrderColumnsFn()],g=>{var x;if((x=p.columns)!=null&&x.length){let v=p.columns.flatMap(_=>_.getLeafColumns());return g(v)}return[p]},xt(e.options,"debugColumns"))};for(const g of e._features)g.createColumn==null||g.createColumn(p,e);return p}const Oi="debugHeaders";function DC(e,t,n){var i;let o={id:(i=n.id)!=null?i:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const a=[],c=d=>{d.subHeaders&&d.subHeaders.length&&d.subHeaders.map(c),a.push(d)};return c(o),a},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(a=>{a.createHeader==null||a.createHeader(o,e)}),o}const wU={createTable:e=>{e.getHeaderGroups=yt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,i,r)=>{var o,a;const c=(o=i?.map(p=>n.find(g=>g.id===p)).filter(Boolean))!=null?o:[],d=(a=r?.map(p=>n.find(g=>g.id===p)).filter(Boolean))!=null?a:[],m=n.filter(p=>!(i!=null&&i.includes(p.id))&&!(r!=null&&r.includes(p.id)));return gf(t,[...c,...m,...d],e)},xt(e.options,Oi)),e.getCenterHeaderGroups=yt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,i,r)=>(n=n.filter(o=>!(i!=null&&i.includes(o.id))&&!(r!=null&&r.includes(o.id))),gf(t,n,e,"center")),xt(e.options,Oi)),e.getLeftHeaderGroups=yt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,i)=>{var r;const o=(r=i?.map(a=>n.find(c=>c.id===a)).filter(Boolean))!=null?r:[];return gf(t,o,e,"left")},xt(e.options,Oi)),e.getRightHeaderGroups=yt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,i)=>{var r;const o=(r=i?.map(a=>n.find(c=>c.id===a)).filter(Boolean))!=null?r:[];return gf(t,o,e,"right")},xt(e.options,Oi)),e.getFooterGroups=yt(()=>[e.getHeaderGroups()],t=>[...t].reverse(),xt(e.options,Oi)),e.getLeftFooterGroups=yt(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),xt(e.options,Oi)),e.getCenterFooterGroups=yt(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),xt(e.options,Oi)),e.getRightFooterGroups=yt(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),xt(e.options,Oi)),e.getFlatHeaders=yt(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),xt(e.options,Oi)),e.getLeftFlatHeaders=yt(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),xt(e.options,Oi)),e.getCenterFlatHeaders=yt(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),xt(e.options,Oi)),e.getRightFlatHeaders=yt(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),xt(e.options,Oi)),e.getCenterLeafHeaders=yt(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var i;return!((i=n.subHeaders)!=null&&i.length)}),xt(e.options,Oi)),e.getLeftLeafHeaders=yt(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var i;return!((i=n.subHeaders)!=null&&i.length)}),xt(e.options,Oi)),e.getRightLeafHeaders=yt(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var i;return!((i=n.subHeaders)!=null&&i.length)}),xt(e.options,Oi)),e.getLeafHeaders=yt(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,i)=>{var r,o,a,c,d,m;return[...(r=(o=t[0])==null?void 0:o.headers)!=null?r:[],...(a=(c=n[0])==null?void 0:c.headers)!=null?a:[],...(d=(m=i[0])==null?void 0:m.headers)!=null?d:[]].map(h=>h.getLeafHeaders()).flat()},xt(e.options,Oi))}};function gf(e,t,n,i){var r,o;let a=0;const c=function(g,x){x===void 0&&(x=1),a=Math.max(a,x),g.filter(v=>v.getIsVisible()).forEach(v=>{var _;(_=v.columns)!=null&&_.length&&c(v.columns,x+1)},0)};c(e);let d=[];const m=(g,x)=>{const v={depth:x,id:[i,`${x}`].filter(Boolean).jo Line truncated
`).replace(`
`,`
+`).split(`
`)),h=m.reduce((p,g)=>p.concat(...g),[]);return[m,h]}return[[],[]]},[e]);return C.useEffect(()=>{const d=t?.target??j2,m=t?.actInsideInputWithModifier??!0;if(e!==null){const h=x=>{if(r.current=x.ctrlKey||x.metaKey||x.shiftKey||x.altKey,(!r.current||r.current&&!m)&&XT(x))return!1;const _=N2(x.code,c);if(o.current.add(x[_]),E2(a,o.current,!1)){const k=x.composedPath?.()?.[0]||x.target,w=k?.nodeName==="BUTTON"||k?.nodeName==="A";t.preventDefault!==!1&&(r.current||!w)&&x.preventDefault(),i(!0)}},p=x=>{const v=N2(x.code,c);E2(a,o.current,!0)?(i(!1),o.current.clear()):o.current.delete(x[v]),x.key==="Meta"&&o.current.clear(),r.current=!1},g=()=>{o.current.clear(),i(!1)};return d?.addEventListener("keydown",h),d?.addEventListener("keyup",p),window.addEventListener("blur",g),window.addEventListener("contextmenu",g),()=>{d?.removeEventListener("keydown",h),d?.removeEventListener("keyup",p),window.removeEventListener("blur",g),window.removeEventListener("contextmenu",g)}}},[e,i]),n}function E2(e,t,n){return e.filter(i=>n||i.length===t.size).some(i=>i.every(r=>t.has(r)))}function N2(e,t){return t.includes(e)?"code":"key"}const _K=()=>{const e=$n();return C.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:i}=e.getState();return i?i.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[i,r,o],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??i,y:t.y??r,zoom:t.zoom??o},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,i]=e.getState().transform;return{x:t,y:n,zoom:i}},setCenter:async(t,n,i)=>e.getState().setCenter(t,n,i),fitBounds:async(t,n)=>{const{width:i,height:r,minZoom:o,maxZoom:a,panZoom:c}=e.getState(),d=U0(t,i,r,o,a,n?.padding??.1);return c?(await c.setViewport(d,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:i,snapGrid:r,snapToGrid:o,domNode:a}=e.getState();if(!a)return t;const{x:c,y:d}=a.getBoundingClientRect(),m={x:t.x-c,y:t.y-d},h=n.snapGrid??r,p=n.snapToGrid??o;return Yu(m,i,p,h)},flowToScreenPosition:t=>{const{transform:n,domNode:i}=e.getState();if(!i)return t;const{x:r,y:o}=i.getBoundingClientRect(),a=wm(t,n);return{x:a.x+r,y:a.y+o}}}),[])};function yR(e,t){const n=[],i=new Map,r=[];for(const o of e)if(o.type==="add"){r.push(o);continue}else if(o.type==="remove"||o.type==="replace")i.set(o.id,[o]);else{const a=i.get(o.id);a?a.push(o):i.set(o.id,[o])}for(const o of t){const a=i.get(o.id);if(!a){n.push(o);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const c={...o};for(const d of a)kK(d,c);n.push(c)}return r.length&&r.forEach(o=>{o.index!==void 0?n.splice(o.index,0,{...o.item}):n.push({...o.item})}),n}function kK(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function xR(e,t){return yR(e,t)}function SK(e,t){return yR(e,t)}function ta(e,t){return{id:e,type:"select",selected:t}}function dl(e,t=new Set,n=!1){const i=[];for(const[r,o]of e){const a=t.has(r);!(o.selected===void 0&&!a)&&o.selected!==a&&(n&&(o.selected=a),i.push(ta(o.id,a)))}return i}function I2({items:e=[],lookup:t}){const n=[],i=new Map(e.map(r=>[r.id,r]));for(const[r,o]of e.entries()){const a=t.get(o.id),c=a?.internals?.userNode??a;c!==void 0&&c!==o&&n.push({id:o.id,item:o,type:"replace"}),c===void 0&&n.push({item:o,type:"add",index:r})}for(const[r]of t)i.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function T2(e){return{id:e.id,type:"remove"}}const R2=e=>qY(e),wK=e=>HT(e);function vR(e){return C.forwardRef(e)}function A2(e){const[t,n]=C.useState(BigInt(0)),[i]=C.useState(()=>CK(()=>n(r=>r+BigInt(1))));return Mv(()=>{const r=i.get();r.length&&(e(r),i.reset())},[t]),i}function CK(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const bR=C.createContext(null);function jK({children:e}){const t=$n(),n=C.useCallback(c=>{const{nodes:d=[],setNodes:m,hasDefaultNodes:h,onNodesChange:p,nodeLookup:g,fitViewQueued:x,onNodesChangeMiddlewareMap:v}=t.getState();let _=d;for(const w of c)_=typeof w=="function"?w(_):w;let k=I2({items:_,lookup:g});for(const w of v.values())k=w(k);h&&m(_),k.length>0?p?.(k):x&&window.requestAnimationFrame(()=>{const{fitViewQueued:w,nodes:S,setNodes:j}=t.getState();w&&j(S)})},[]),i=A2(n),r=C.useCallback(c=>{const{edges:d=[],setEdges:m,hasDefaul Line truncated
M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}qR.displayName="MiniMap";const mQ=C.memo(qR),pQ=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,hQ={[Pl.Line]:"right",[Pl.Handle]:"bottom-right"};function gQ({nodeId:e,position:t,variant:n=Pl.Handle,className:i,style:r=void 0,children:o,color:a,minWidth:c=10,minHeight:d=10,maxWidth:m=Number.MAX_VALUE,maxHeight:h=Number.MAX_VALUE,keepAspectRatio:p=!1,resizeDirection:g,autoScale:x=!0,shouldResize:v,onResizeStart:_,onResize:k,onResizeEnd:w}){const S=SR(),j=typeof e=="string"?e:S,N=$n(),O=C.useRef(null),R=n===Pl.Handle,D=on(C.useCallback(pQ(R&&x),[R,x]),Bn),I=C.useRef(null),L=t??hQ[n];C.useEffect(()=>{if(!(!O.current||!j))return I.current||(I.current=UX({domNode:O.current,nodeId:j,getStoreItems:()=>{const{nodeLookup:A,transform:B,snapGrid:W,snapToGrid:P,nodeOrigin:G,domNode:$}=N.getState();return{nodeLookup:A,transform:B,snapGrid:W,snapToGrid:P,nodeOrigin:G,paneDomNode:$}},onChange:(A,B)=>{const{triggerNodeChanges:W,nodeLookup:P,parentLookup:G,nodeOrigin:$}=N.getState(),q=[],Y={x:A.x,y:A.y},Q=P.get(j);if(Q&&Q.expandParent&&Q.parentId){const V=Q.origin??$,U=A.width??Q.measured.width??0,Z=A.height??Q.measured.height??0,F={id:Q.id,parentId:Q.parentId,rect:{width:U,height:Z,...WT({x:A.x??Q.position.x,y:A.y??Q.position.y},{width:U,height:Z},Q.parentId,P,V)}},K=K0([F],P,G,$);q.push(...K),Y.x=A.x?Math.max(V[0]*U,A.x):void 0,Y.y=A.y?Math.max(V[1]*Z,A.y):void 0}if(Y.x!==void 0&&Y.y!==void 0){const V={id:j,type:"position",position:{...Y}};q.push(V)}if(A.width!==void 0&&A.height!==void 0){const U={id:j,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:A.width,height:A.height}};q.push(U)}for(const V of B){const U={...V,type:"position"};q.push(U)}W(q)},onEnd:({width:A,height:B})=>{const W={id:j,type:"dimensions",resizing:!1,dimensions:{width:A,height:B}};N.getState().triggerNodeChanges([W])}})),I.current.update({controlPosition:L,boundaries:{minWidth:c,minHeight:d,maxWidth:m,maxHeight:h},keepAspectRatio:p,resizeDirection:g,onResizeStart:_,onResize:k,onResizeEnd:w,shouldResize:v}),()=>{I.current?.destroy()}},[L,c,d,m,h,p,_,k,w,v]);const M=L.split("-");return u.jsx("div",{className:fi(["react-flow__resize-control","nodrag",...M,n,i]),ref:O,style:{...r,scale:D,...a&&{[R?"backgroundColor":"borderColor"]:a}},children:o})}C.memo(gQ);const yQ=C.memo(function({data:t}){const n=["oc-canvas-node",t.isOwner&&"is-owner",t.isSelected&&"is-selected",t.isDropTarget&&"is-drop-target"].filter(Boolean).join(" "),i=Fu(t.icon);return u.jsxs("div",{className:n,children:[u.jsx(Bl,{type:"target",position:st.Top,className:"oc-canvas-handle"}),u.jsxs("div",{className:"oc-canvas-node-row",children:[u.jsx("div",{className:"oc-canvas-node-chip",children:u.jsx("span",{className:"oc-canvas-node-chip-icon",style:{WebkitMaskImage:`url("${i}")`,maskImage:`url("${i}")`},"aria-hidden":!0})}),u.jsxs("div",{className:"oc-canvas-node-text",children:[u.jsx("span",{className:"oc-canvas-node-name",children:t.name}),u.jsxs("div",{className:"oc-canvas-node-meta",children:[t.employeeNames.length>0?u.jsxs("span",{className:"oc-canvas-node-person",title:t.employeeNames.join(", "),children:[t.employeeNames[0],t.employeeNames.length>1?` +${t.employeeNames.length-1}`:""]}):u.jsx("span",{className:"oc-canvas-node-id",children:t.roleId}),t.employeeCount>0&&u.jsx("span",{className:"oc-canvas-node-badge",children:t.employeeCount})]})]})]}),u.jsx(Bl,{type:"source",position:st.Bottom,className:"oc-canvas-handle"})]})});var By,U2;function J0(){if(U2)return By;U2=1;var e="\0",t="\0",n="";class i{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>{};_defaultEdgeLabelFn=()=>{};_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(h){h&&(this._isDirected=Object.hasOwn(h,"directed")?h.directed:!0,this._isMultigraph=Object.hasOwn(h,"multigraph")?h.multigraph:!1,this._isCompound=Object.hasOwn(h,"compound")?h.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(h){return this._label=h,this}graph(){return this._label}setDefaultNodeLabel(h){return this._defaultNodeLabelFn=h,typeof h!="function"&&(this._defaultNodeLabelFn=()=>h),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var h=this;return this.nodes().filter(p=>Object.keys(h._in[p]).length===0)}sinks(){var h=this;return this.nodes().filter(p=>Object.keys(h._out[p]).length===0)}setNodes(h,p){var g=arguments,x=this;return h.forEach(function(v){g.length>1?x.setNode(v,p):x.setNode(v)}),this}setNode(h,p){return Object.hasOwn(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=p),this):(this._nodes[h]=arguments.length>1?p:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=t, Line truncated
${i}`}),u.jsx(iU,{projects:Se.projects,activeId:Se.activeProjectId,onSelect:J=>{const z=_t(J);t.current?.switchProject(J,z)},onCreate:J=>{t.current?.createProject(J)},onDelete:J=>t.current?.deleteProject(J)})]}),u.jsxs("div",{className:"topbar-center",children:[u.jsxs("div",{className:"page-nav",children:[u.jsxs("button",{className:`page-nav-btn${B==="workspace"?" active":""}`,onClick:()=>W("workspace"),children:["Workspace",(()=>{const J=Bt.channels.reduce((z,ne)=>z+Bt.getUnreadCount(ne.id),0);return J>0?u.jsx("span",{className:"nav-unread-badge",children:J>99?"99+":J}):null})()]}),u.jsx("button",{className:`page-nav-btn${B==="office"?" active":""}`,onClick:()=>W("office"),children:"Office"}),u.jsx("button",{className:`page-nav-btn${B==="org"?" active":""}`,onClick:()=>W("org"),children:"Org"})]}),u.jsxs("div",{className:"stat-chips",children:[u.jsxs("span",{className:"stat-chip",children:[u.jsx("b",{children:us.totalAgents})," agents"]}),u.jsxs("span",{className:"stat-chip",children:[u.jsx("b",{children:us.totalSkills})," skills"]}),u.jsxs("span",{className:"stat-chip",children:[u.jsx("b",{children:an.getOpenTaskCount()})," tasks"]})]})]}),u.jsxs("div",{className:"topbar-right",children:[u.jsxs("select",{className:"theme-select",value:Xt,title:"Outdoor lighting override",onChange:J=>{const z=J.target.value;Un(z);try{z==="auto"?(localStorage.removeItem("opc_outdoor_override"),localStorage.removeItem("opc_outdoor_day"),localStorage.removeItem("opc_outdoor_night")):(localStorage.setItem("opc_outdoor_override",z),localStorage.removeItem("opc_outdoor_day"),localStorage.removeItem("opc_outdoor_night"))}catch{}e.current.syncOutdoorLighting()},children:[u.jsx("option",{value:"auto",children:"Outdoor auto"}),u.jsx("option",{value:"day",children:"Outdoor day"}),u.jsx("option",{value:"night",children:"Outdoor night"})]}),u.jsxs("select",{className:"theme-select",value:j,onChange:J=>N(J.target.value),children:[u.jsx("option",{value:"midnight",children:"Midnight"}),u.jsx("option",{value:"neon",children:"Neon"}),u.jsx("option",{value:"paper",children:"Paper"}),u.jsx("option",{value:"retro",children:"Retro"}),u.jsx("option",{value:"terminal",children:"Terminal"}),u.jsx("option",{value:"cozy",children:"Cozy"}),u.jsx("option",{value:"openopc",children:"OpenOPC"})]}),u.jsx("button",{className:`icon-btn ${$?"active":""}`,onClick:()=>q(J=>!J),title:"Developer Tools",children:u.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[u.jsx("path",{d:"M5.5 2L2 5.5 5.5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M10.5 7L14 10.5 10.5 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),B==="workspace"&&u.jsx(CV,{boardStore:an,chatStore:Bt,sessionStore:ce,agents:P,officeMap:Xu,execMode:V,companyProfile:Z,taskPreferredAgent:K,projectId:Se.activeProjectId,orgInfoData:te,onNavigateToOrg:()=>W("org"),savedOrgsList:We,activeSavedOrg:ht,onSavedOrgsList:gn,onSavedOrgLoad:ha,commsState:ae,commsMessage:ie,onCommsRefresh:J=>{const{project_id:z,...ne}=J??{};t.current?.commsState(Je(),ne)},onCommsReadMessage:J=>t.current?.commsReadMessage(Je(),J),onRunTask:(J,z,ne,oe,pe)=>{t.current?.send({type:"run_task",project_id:Je(),task_id:J,title:z,description:ne,mode:oe,profile:pe})},onCreateTask:(J,z,ne,oe)=>{t.current?.send({type:"kanban_create_task",project_id:Je(),title:J,board_id:z,column_id:ne,task_id:oe})},onMoveTask:(J,z)=>{t.current?.send({type:"kanban_move_task",project_id:Je(),task_id:J,column_id:z})},onCreateSession:()=>{if(pn.current||wn.current)return;const J=Je();ut(J),t.current?.createSession(J,void 0,V,Dx(V),K,Qo(V,ht))},onSessionSend:(J,z,ne,oe)=>t.current?.sessionSend(Je(),J,z,ne,oe),onSecretarySend:J=>t.current?.secretarySend(Je(),J),onDeleteSession:J=>t.current?.deleteSession(Je(),J),onTitleChange:(J,z)=>t.current?.sessionUpdateTitle(Je(),J,z),onSessionConfigChange:Ao,onSessionTaskAgentChange:fp,onContinueInNewChat:Yl,onSessionStop:Mo,onSessionResume:va,onSessionComplete:J=>t.current?.sessionComplete(Je(),J),onLoadSessionDetail:(J,z)=>{const ne=t.current;if(ne)return ne.sessionDetail(Je(),J,{...z,include:z?.detailLevel==="full"?["messages","session_state","progress","work_items","runtime_context"]:["messages","session_state"],viewGeneration:tt.current}).then(oe=>{if(oe.ok===!1)throw new Error(String(oe.error??"session_detail failed"))})},onOpenExecutionPanel:J=>Tt(J),onCollabSync:()=>t.current?.collabSync(Je(),void 0,tt.current)}),B==="org"&&u.jsx("div",{className:"org-page",children:u.jsx(jJ,{data:te,sessionRecruitmentByRole:Ue,talents:je,employeeDetail:Xe,reorgProposals:Ft,isCustomMode:fs,onRequestData:()=>t.current?.orgInfo(),onRequestTalents:()=>t.current?.talentList(),onRequestEmployeeDetail:J=>t.current?.employeeDetail(J),onHireTalent:(J,z)=>{kt(J),t.current?.talentHire(J,z,void 0,te?.organization_id||ht||void 0)},hiringTemplateId:Re,onImportEmployee:J=>t.current?.importEmployeeAsAgent(J),onRe Line truncated
@@ -0,0 +1,191 @@
import{g as pa,r as QM}from"./phaser-DFK5Ua9d.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();var fg={exports:{}},Oc={};var Rk;function JM(){if(Rk)return Oc;Rk=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,r,o){var a=null;if(o!==void 0&&(a=""+o),r.key!==void 0&&(a=""+r.key),"key"in r){o={};for(var c in r)c!=="key"&&(o[c]=r[c])}else o=r;return r=o.ref,{$$typeof:e,type:i,key:a,ref:r!==void 0?r:null,props:o}}return Oc.Fragment=t,Oc.jsx=n,Oc.jsxs=n,Oc}var Ak;function e3(){return Ak||(Ak=1,fg.exports=JM()),fg.exports}var u=e3(),mg={exports:{}},kt={};var Mk;function t3(){if(Mk)return kt;Mk=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),g=Symbol.iterator;function x(V){return V===null||typeof V!="object"?null:(V=g&&V[g]||V["@@iterator"],typeof V=="function"?V:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,w={};function k(V,Q,B){this.props=V,this.context=Q,this.refs=w,this.updater=B||v}k.prototype.isReactComponent={},k.prototype.setState=function(V,Q){if(typeof V!="object"&&typeof V!="function"&&V!=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,V,Q,"setState")},k.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function S(){}S.prototype=k.prototype;function j(V,Q,B){this.props=V,this.context=Q,this.refs=w,this.updater=B||v}var N=j.prototype=new S;N.constructor=j,b(N,k.prototype),N.isPureReactComponent=!0;var L=Array.isArray;function A(){}var D={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function T(V,Q,B){var Z=B.ref;return{$$typeof:e,type:V,key:Q,ref:Z!==void 0?Z:null,props:B}}function M(V,Q){return T(V.type,Q,V.props)}function I(V){return typeof V=="object"&&V!==null&&V.$$typeof===e}function H(V){var Q={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(B){return Q[B]})}var Y=/\/+/g;function P(V,Q){return typeof V=="object"&&V!==null&&V.key!=null?H(""+V.key):Q.toString(36)}function U(V){switch(V.status){case"fulfilled":return V.value;case"rejected":throw V.reason;default:switch(typeof V.status=="string"?V.then(A,A):(V.status="pending",V.then(function(Q){V.status==="pending"&&(V.status="fulfilled",V.value=Q)},function(Q){V.status==="pending"&&(V.status="rejected",V.reason=Q)})),V.status){case"fulfilled":return V.value;case"rejected":throw V.reason}}throw V}function $(V,Q,B,Z,te){var ee=typeof V;(ee==="undefined"||ee==="boolean")&&(V=null);var se=!1;if(V===null)se=!0;else switch(ee){case"bigint":case"string":case"number":se=!0;break;case"object":switch(V.$$typeof){case e:case t:se=!0;break;case h:return se=V._init,$(se(V._payload),Q,B,Z,te)}}if(se)return te=te(V),se=Z===""?"."+P(V,0):Z,L(te)?(B="",se!=null&&(B=se.replace(Y,"$&/")+"/"),$(te,Q,B,"",function(ne){return ne})):te!=null&&(I(te)&&(te=M(te,B+(te.key==null||V&&V.key===te.key?"":(""+te.key).replace(Y,"$&/")+"/")+se)),Q.push(te)),1;se=0;var ae=Z===""?".":Z+":";if(L(V))for(var ue=0;ue<V.length;ue++)Z=V[ue],ee=ae+P(Z,ue),se+=$(Z,Q,B,ee,te);else if(ue=x(V),typeof ue=="function")for(V=ue.call(V),ue=0;!(Z=V.next()).done;)Z=Z.value,ee=ae+P(Z,ue++),se+=$(Z,Q,B,ee,te);else if(ee==="object"){if(typeof V.then=="function")return $(U(V),Q,B,Z,te);throw Q=String(V),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(V).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return se}function G(V,Q,B){if(V==null)return V;var Z=[],te=0;return $(V,Z,"","",function(ee){return Q.call(B,ee,te++)}),Z}function q(V){if(V._status===-1){var Q=V._result;Q=Q(),Q.then(function(B){(V._status===0||V._status===-1)&&(V._status=1,V._result=B)},function(B){(V._status===0||V._status===-1)&&(V._status=2,V._result=B)}),V._status===-1&&(V._status=0,V._result=Q)}if(V._status===1)return V._reLine truncated
at`)?" (<anonymous>)":-1<f.stack.indexOf("@")?"@unknown:0:0":""}return`
`+we+s+Te}var Ue=!1;function Ge(s,l){if(!s||Ue)return"";Ue=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var y={DetermineComponentFrameRoot:function(){try{if(l){var Ne=function(){throw Error()};if(Object.defineProperty(Ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ne,[])}catch(ve){var xe=ve}Reflect.construct(s,[],Ne)}else{try{Ne.call()}catch(ve){xe=ve}s.call(Ne.prototype)}}else{try{throw Error()}catch(ve){xe=ve}(Ne=s())&&typeof Ne.catch=="function"&&Ne.catch(function(){})}}catch(ve){if(ve&&xe&&typeof ve.stack=="string")return[ve.stack,xe.stack]}return[null,null]}};y.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var _=Object.getOwnPropertyDescriptor(y.DetermineComponentFrameRoot,"name");_&&_.configurable&&Object.defineProperty(y.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var E=y.DetermineComponentFrameRoot(),F=E[0],X=E[1];if(F&&X){var re=F.split(`
`),ye=X.split(`
`);for(_=y=0;y<re.length&&!re[y].includes("DetermineComponentFrameRoot");)y++;for(;_<ye.length&&!ye[_].includes("DetermineComponentFrameRoot");)_++;if(y===re.length||_===ye.length)for(y=re.length-1,_=ye.length-1;1<=y&&0<=_&&re[y]!==ye[_];)_--;for(;1<=y&&0<=_;y--,_--)if(re[y]!==ye[_]){if(y!==1||_!==1)do if(y--,_--,0>_||re[y]!==ye[_]){var Ce=`
`+re[y].replace(" at new "," at ");return s.displayName&&Ce.includes("<anonymous>")&&(Ce=Ce.replace("<anonymous>",s.displayName)),Ce}while(1<=y&&0<=_);break}}}finally{Ue=!1,Error.prepareStackTrace=f}return(f=s?s.displayName||s.name:"")?Fe(f):""}function vt(s,l){switch(s.tag){case 26:case 27:case 5:return Fe(s.type);case 16:return Fe("Lazy");case 13:return s.child!==l&&l!==null?Fe("Suspense Fallback"):Fe("Suspense");case 19:return Fe("SuspenseList");case 0:case 15:return Ge(s.type,!1);case 11:return Ge(s.type.render,!1);case 1:return Ge(s.type,!0);case 31:return Fe("Activity");default:return""}}function Lt(s){try{var l="",f=null;do l+=vt(s,f),f=s,s=s.return;while(s);return l}catch(y){return`
Error generating stack: `+y.message+`
`+y.stack}}var zt=Object.prototype.hasOwnProperty,Ut=e.unstable_scheduleCallback,he=e.unstable_cancelCallback,Be=e.unstable_shouldYield,ct=e.unstable_requestPaint,nt=e.unstable_now,Ke=e.unstable_getCurrentPriorityLevel,pe=e.unstable_ImmediatePriority,Se=e.unstable_UserBlockingPriority,De=e.unstable_NormalPriority,ze=e.unstable_LowPriority,Je=e.unstable_IdlePriority,ut=e.log,tn=e.unstable_setDisableYieldValue,be=null,We=null;function et(s){if(typeof ut=="function"&&tn(s),We&&typeof We.setStrictMode=="function")try{We.setStrictMode(be,s)}catch{}}var Ve=Math.clz32?Math.clz32:An,Ae=Math.log,St=Math.LN2;function An(s){return s>>>=0,s===0?32:31-(Ae(s)/St|0)|0}var qn=256,dt=262144,bn=4194304;function Nn(s){var l=s&42;if(l!==0)return l;switch(s&-s){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 s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Nt(s,l,f){var y=s.pendingLanes;if(y===0)return 0;var _=0,E=s.suspendedLanes,F=s.pingedLanes;s=s.warmLanes;var X=y&134217727;return X!==0?(y=X&~E,y!==0?_=Nn(y):(F&=X,F!==0?_=Nn(F):f||(f=X&~s,f!==0&&(_=Nn(f))))):(X=y&~E,X!==0?_=Nn(X):F!==0?_=Nn(F):f||(f=y&~s,f!==0&&(_=Nn(f)))),_===0?0:l!==0&&l!==_&&(l&E)===0&&(E=_&-_,f=l&-l,E>=f||E===32&&(f&4194048)!==0)?l:_}function xt(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function Vn(s,l){switch(s){case 1:case 2:case 4:case 8:case 64:return l+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 l+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 _t(){var s=bn;return bn<<=1,(bn&62914560)===0&&(bn=4194304),s}function Ye(s){for(var l=[],f=0;31>f;f++)l.push(s);return l}function Pt(s,l){s.pendingLanes|=l,l!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function zi(s,l,f,y,_,E){var F=s.pendingLanes;s.pendingLanes=f,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=f,s.entangledLanes&=f,s.errorRecoveryDisabledLanes&=f,s.shellSuspendCounter=0;var X=s.entanglements,re=s.expirationTimes,ye=s.hiddenUpdates;for(f=F&~f;0<f;){var Ce=31-Ve(f),Ne=1<<Ce;X[Ce]=0,re[Ce]=-1;var xe=ye[Ce];if(xe!==null)for(ye[Ce]=null,Ce=0;Ce<xe.length;Ce++){var ve=xe[Ce];ve!==null&&(ve.lane&=-536870913)}f&=~Ne}y!==0&&Mn(s,y,0),E!==0&&_===0&&s.tag!==0&&(s.suspendedLanes|=E&~(F&~l))}function Mn(s,l,f){s.pendingLanes|=l,s.suspendedLanes&=~l;var y=31-Ve(l);s.entangledLanes|=l,s.entanglements[y]=s.entanglements[y]|1073741824|f&261930}function nn(s,l){var f=s.entangledLanes|=l;for(s=s.entanglements;f;){var y=31-Ve(f),_=1<<y;_&l|s[y]&l&&(s[y]|=l),f&=~_}}function ht(s,l){var f=l&-l;return f=(f&42)!==0?1:Bt(f),(f&(s.suspendedLanes|l))!==0?0:f}function Bt(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function dn(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Ln(){var s=G.p;return s!==0?s:(s=window.event,s===void 0?32:wk(s.type))}function Wn(s,l){var f=G.p;try{return G.p=s,l()}finally{G.p=f}}var It=Math.random().toString(36).slice(2),Ht="__reactFiber$"+It,In="__reactProps$"+It,Yn="__reactContainer$"+It,Ie="__reactEvents$"+It,bt="__reactListeners$"+It,pn="__reactHandles$"+It,Un="__reactResources$"+It,Tn="__reactMarker$"+It;function wt(s){delete s[Ht],delete s[In],delete s[Ie],delete s[bt],delete s[pn]}function gi(s){var l=s[Ht];if(l)return l;for(var f=s.parentNode;f;){if(l=f[Yn]||f[Ht]){if(f=l.alternate,l.child!==null||f!==null&&f.child!==null)for(s=lk(s);s!==null;){if(f=s[Ht])return f;s=lk(s)}return l}s=f,f=s.parentNode}return null}function fi(s){if(s=s[Ht]||s[Yn]){var l=s.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return s}return null}function ni(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(i(33))}function hn(s){var l=s[Un];return l||(l=s[Un]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Yt(s){s[Tn]=!0}var Tt=new Set,Xt={};function zn(s,l){Pn(s,l),Pn(s+"Capture",l)}function Pn(s,l){for(Xt[s]=l,s=0;s<l.length;s++)Tt.add(l[s])}var Gn=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u2 Line truncated
`).replace(bM,"")}function Q_(s,l){return l=Z_(l),Z_(s)===l}function Sn(s,l,f,y,_,E){switch(f){case"children":typeof y=="string"?l==="body"||l==="textarea"&&y===""||st(s,y):(typeof y=="number"||typeof y=="bigint")&&l!=="body"&&st(s,""+y);break;case"className":Si(s,"class",y);break;case"tabIndex":Si(s,"tabindex",y);break;case"dir":case"role":case"viewBox":case"width":case"height":Si(s,f,y);break;case"style":Xn(s,y,E);break;case"data":if(l!=="object"){Si(s,"data",y);break}case"src":case"href":if(y===""&&(l!=="a"||f!=="href")){s.removeAttribute(f);break}if(y==null||typeof y=="function"||typeof y=="symbol"||typeof y=="boolean"){s.removeAttribute(f);break}y=Fi(""+y),s.setAttribute(f,y);break;case"action":case"formAction":if(typeof y=="function"){s.setAttribute(f,"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 E=="function"&&(f==="formAction"?(l!=="input"&&Sn(s,l,"name",_.name,_,null),Sn(s,l,"formEncType",_.formEncType,_,null),Sn(s,l,"formMethod",_.formMethod,_,null),Sn(s,l,"formTarget",_.formTarget,_,null)):(Sn(s,l,"encType",_.encType,_,null),Sn(s,l,"method",_.method,_,null),Sn(s,l,"target",_.target,_,null)));if(y==null||typeof y=="symbol"||typeof y=="boolean"){s.removeAttribute(f);break}y=Fi(""+y),s.setAttribute(f,y);break;case"onClick":y!=null&&(s.onclick=mi);break;case"onScroll":y!=null&&qt("scroll",s);break;case"onScrollEnd":y!=null&&qt("scrollend",s);break;case"dangerouslySetInnerHTML":if(y!=null){if(typeof y!="object"||!("__html"in y))throw Error(i(61));if(f=y.__html,f!=null){if(_.children!=null)throw Error(i(60));s.innerHTML=f}}break;case"multiple":s.multiple=y&&typeof y!="function"&&typeof y!="symbol";break;case"muted":s.muted=y&&typeof y!="function"&&typeof y!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(y==null||typeof y=="function"||typeof y=="boolean"||typeof y=="symbol"){s.removeAttribute("xlink:href");break}f=Fi(""+y),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":y!=null&&typeof y!="function"&&typeof y!="symbol"?s.setAttribute(f,""+y):s.removeAttribute(f);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":y&&typeof y!="function"&&typeof y!="symbol"?s.setAttribute(f,""):s.removeAttribute(f);break;case"capture":case"download":y===!0?s.setAttribute(f,""):y!==!1&&y!=null&&typeof y!="function"&&typeof y!="symbol"?s.setAttribute(f,y):s.removeAttribute(f);break;case"cols":case"rows":case"size":case"span":y!=null&&typeof y!="function"&&typeof y!="symbol"&&!isNaN(y)&&1<=y?s.setAttribute(f,y):s.removeAttribute(f);break;case"rowSpan":case"start":y==null||typeof y=="function"||typeof y=="symbol"||isNaN(y)?s.removeAttribute(f):s.setAttribute(f,y);break;case"popover":qt("beforetoggle",s),qt("toggle",s),Xe(s,"popover",y);break;case"xlinkActuate":rn(s,"http://www.w3.org/1999/xlink","xlink:actuate",y);break;case"xlinkArcrole":rn(s,"http://www.w3.org/1999/xlink","xlink:arcrole",y);break;case"xlinkRole":rn(s,"http://www.w3.org/1999/xlink","xlink:role",y);break;case"xlinkShow":rn(s,"http://www.w3.org/1999/xlink","xlink:show",y);break;case"xlinkTitle":rn(s,"http://www.w3.org/1999/xlink","xlink:title",y);break;case"xlinkType":rn(s,"http://www.w3.org/1999/xlink","xlink:type",y);break;case"xmlBase":rn(s,"http://www.w3.org/XML/1998/namespace","xml:base",y);break;case"xmlLang":rn(s,"http://www.w3.org/XML/1998/namespace","xml:lang",y);break;case"xmlSpace":rn(s,"http://www.w3.org/XML/1998/namespace","xml:space",y);break;case"is":Xe(s,"is",y);break;case"innerText":case"textContent":break;default:(!(2<f.length)||f[0]!=="o"&&f[0]!=="O"||f[1]!=="n"&&f[1]!=="N")&&(f=Ct.get(f)||f,Xe(s,f,y))}}function Yh(s,l,f,y,_,E){switch(f){case"style":Xn(s,y,E);break;case"dangerouslySetInnerHTML":if(y!=null){if(typeof y!="object"||!("__html"in y))throw Error(i(61));if(f=y.__html,f!=null){if(_.children!=null)throw Error(i(60));s.innerHTML=f}}break;case"children":typeof y=="string"?st(s,y):(typeof y=="number"||typeof y=="bigint")&&st(s,""+y);break;case"onScroll":y!=null&&qt("scroll",s);break;case"onScrollEnd":y!=null&&qt("scrollend",s);break;case"onClick":y!=null&&(s.onclick=mi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"inne Line truncated
`),ae=p.map(([ue,ne])=>` [${ue}, ${ne}],`).join(`
`);return`const MAP_STR: string[] = [
${se}
]
const SEATS: [number, number][] = [
${ae}
]`})(),Q=()=>A(ee=>Math.min(ee+.25,3)),B=()=>A(ee=>Math.max(ee-.25,.5)),Z=m.flat().filter(ee=>ee===1).length,te=m.flat().filter(ee=>ee===0).length;return u.jsxs("div",{className:"collision-editor",children:[u.jsxs("div",{className:"ce-toolbar",children:[u.jsxs("div",{className:"ce-toolbar-group",children:[u.jsx("span",{className:"ce-title",children:"Map Editor"}),u.jsx("select",{className:"ce-office-select",value:a,onChange:ee=>I(ee.target.value),children:r.map(ee=>u.jsx("option",{value:ee.id,children:ee.name},ee.id))})]}),u.jsxs("div",{className:"ce-toolbar-group",children:[u.jsxs("button",{className:`ce-mode-btn ${x==="wall"?"active wall":""}`,onClick:()=>v("wall"),children:[u.jsx("span",{className:"ce-mode-dot wall"})," Wall"]}),u.jsxs("button",{className:`ce-mode-btn ${x==="floor"?"active floor":""}`,onClick:()=>v("floor"),children:[u.jsx("span",{className:"ce-mode-dot floor"})," Floor"]}),u.jsxs("button",{className:`ce-mode-btn ${x==="seat"?"active seat":""}`,onClick:()=>v("seat"),children:[u.jsx("span",{className:"ce-mode-dot seat"})," Seat"]})]}),u.jsxs("div",{className:"ce-toolbar-group",children:[u.jsx("button",{className:"ce-btn",onClick:B,children:"-"}),u.jsxs("span",{className:"ce-zoom-label",children:[Math.round(L*100),"%"]}),u.jsx("button",{className:"ce-btn",onClick:Q,children:"+"}),u.jsx("button",{className:`ce-btn${D?" active":""}`,onClick:()=>O(ee=>!ee),children:"Grid"})]}),u.jsxs("div",{className:"ce-toolbar-group",children:[u.jsx("button",{className:`ce-btn apply${j?" success":""}`,onClick:q,children:j?"Applied":"Apply"}),u.jsx("button",{className:`ce-btn${k?" active":""}`,onClick:K,children:"Export"}),u.jsx("button",{className:"ce-btn danger",onClick:W,children:"Reset"})]}),u.jsxs("div",{className:"ce-toolbar-group ce-stats",children:[u.jsxs("span",{children:["Walls: ",Z]}),u.jsxs("span",{children:["Floor: ",te]}),u.jsxs("span",{children:["Seats: ",p.length]})]})]}),u.jsxs("div",{className:"ce-body",children:[u.jsx("div",{className:"ce-canvas-wrap",style:{overflow:"auto"},children:u.jsx("canvas",{ref:t,style:{width:T*R*L,height:M*R*L,imageRendering:"pixelated",cursor:x==="seat"?"crosshair":"cell"},onMouseDown:U,onMouseMove:$,onMouseUp:G,onMouseLeave:G})}),k&&u.jsxs("div",{className:"ce-export-panel",children:[u.jsxs("div",{className:"ce-export-header",children:[u.jsx("span",{children:"Export — copy to source code"}),u.jsx("button",{className:"ce-btn",onClick:()=>navigator.clipboard.writeText(V),children:"Copy"})]}),u.jsx("textarea",{className:"ce-export-textarea",value:V,readOnly:!0,rows:20})]})]})]})}let m4=0;function hi(e,t,n={}){return{event_id:`test-${++m4}`,type:e,agent_id:t,data:n,timestamp:Date.now()/1e3}}function $n(e){return new Promise(t=>setTimeout(t,e))}async function p4(e){const t=[],n=e.getScene();if(!n)return t.push({name:"scene-ready",pass:!1,detail:"OfficeScene not initialized"}),t;console.log("%c[EventTest] Starting full event test suite (multi-office)...","color: #6366f1; font-weight: bold");for(const I of[...n.agents.keys()])n.removeAgent(I);await $n(100);const i=Jn();t.push({name:"offices-loaded",pass:i.length>=3,detail:`${i.length} offices loaded: ${i.map(I=>I.name).join(", ")}`});const r=["agent-A","agent-B","agent-C","agent-D","agent-E","agent-F"];for(const I of r)e.pushEvent(hi("agent_active",I));await $n(300);const o=new Set;let a=!1;for(const I of r){const H=n.getAgent(I);H&&H.seatId&&(o.has(H.seatId)&&(a=!0),o.add(H.seatId))}t.push({name:"desk-assignment-unique",pass:!a&&o.size===r.length,detail:`Assigned ${o.size} unique seats to ${r.length} agents. IDs: [${[...o].join(", ")}]`});const c=r.every(I=>n.getAgent(I)?.officeId!=null);t.push({name:"agents-have-officeId",pass:c,detail:r.map(I=>`${I}=${n.getAgent(I)?.officeId}`).join(", ")}),e.pushEvent(hi("tool_start","agent-A",{tool_name:"shell"})),await $n(200);const d=n.getAgent("agent-A");t.push({name:"tool_start-state",pass:d.isActive===!0&&d.currentTool==="shell",detail:`isActive=${d.isActive}, currentTool=${d.currentTool}`}),e.pushEvent(hi("tool_done","agent-A",{tool_name:"shell"})),await $n(100),t.push({name:"tool_done-celebrate",pass:d.agentState==="celebrate",detail:`state=${d.agentState}`});for(let I=0;I<20&&d.agentState==="celebrate";I++)await $n(500);t.push({name:"celebrate-to-idle",pass:d.agentState!=="celebrate",detail:`state=${d.agentState}`}),e.pushEvent(hi("waiting","agent-B")),await $n(200);const m=n.getAgent("agent-B");t.push({name:"waiting-state",pass:m.isActive===!1&&(m.agentState==="walk"||m.agentState==="idle"||m.agentState==="coffee"),detail:`isActive=${m.isActive}, state=${m.agentState}`}),e.pushEvent(hi("reflect_start","agent-C")),await $n(200);const h=n.getAgent("agent-C");t.push({name:"reflect_start-state",pass:h.currentTool==="Reflect"&&(h.agentState==="walk"||h.agentState==="reflect"),detail:`currentTool=${h.currentTool}, state=${h.agentState}`}),e.pushEvent(hi("reflect_done","agent-C")),await $n(100),t.push({name:"reflect_done-celebrate",pass:h.agentState==="celebrate",detail:`staLine truncated
font-size: .6rem;
font-weight: bold;
color: hsl(${Math.max(0,Math.min(120-120*w,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(o&&n.skipInitialOnChange)&&n.onChange(r),o=!1,r}return a.updateDeps=c=>{i=c},a}function sS(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const w4=(e,t)=>Math.abs(e-t)<1.01,C4=(e,t,n)=>{let i;return function(...r){e.clearTimeout(i),i=e.setTimeout(()=>t.apply(this,r),n)}},oS=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},j4=e=>e,E4=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),i=[];for(let r=t;r<=n;r++)i.push(r);return i},N4=(e,t)=>{const n=e.scrollElement;if(!n)return;const i=e.targetWindow;if(!i)return;const r=a=>{const{width:c,height:d}=a;t({width:Math.round(c),height:Math.round(d)})};if(r(oS(n)),!i.ResizeObserver)return()=>{};const o=new i.ResizeObserver(a=>{const c=()=>{const d=a[0];if(d?.borderBoxSize){const m=d.borderBoxSize[0];if(m){r({width:m.inlineSize,height:m.blockSize});return}}r(oS(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},aS={passive:!0},lS=typeof window>"u"?!0:"onscrollend"in window,I4=(e,t)=>{const n=e.scrollElement;if(!n)return;const i=e.targetWindow;if(!i)return;let r=0;const o=e.options.useScrollendEvent&&lS?()=>{}:C4(i,()=>{t(r,!1)},e.options.isScrollingResetDelay),a=h=>()=>{const{horizontal:p,isRtl:g}=e.options;r=p?n.scrollLeft*(g&&-1||1):n.scrollTop,o(),t(r,h)},c=a(!0),d=a(!1);n.addEventListener("scroll",c,aS);const m=e.options.useScrollendEvent&&lS;return m&&n.addEventListener("scrollend",d,aS),()=>{n.removeEventListener("scroll",c),m&&n.removeEventListener("scrollend",d)}},T4=(e,t,n)=>{if(t?.borderBoxSize){const i=t.borderBoxSize[0];if(i)return Math.round(i[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},R4=(e,{adjustments:t=0,behavior:n},i)=>{var r,o;const a=e+t;(o=(r=i.scrollElement)==null?void 0:r.scrollTo)==null||o.call(r,{[i.options.horizontal?"left":"top"]:a,behavior:n})};class A4{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var n,i,r;return((r=(i=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:i.now)==null?void 0:r.call(i))??Date.now()},this.observer=(()=>{let n=null;const i=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(r=>{r.forEach(o=>{const a=()=>{const c=o.target,d=this.indexFromElement(c);if(!c.isConnected){this.observer.unobserve(c);return}this.shouldMeasureDuringScroll(d)&&this.resizeItem(d,this.options.measureElement(c,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var r;(r=i())==null||r.disconnect(),n=null},observe:r=>{var o;return(o=i())==null?void 0:o.observe(r,{box:"border-box"})},unobserve:r=>{var o;return(o=i())==null?void 0:o.unobserve(r)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([i,r])=>{typeof r>"u"&&delete n[i]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:j4,rangeExtractor:E4,onChange:()=>{},measureElement:T4,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var i,r;(r=(i=this.options).onChange)==null||r.call(i,this,n)},this.maybeNotify=Ka(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(r=>{this.observer.observe(r)} Line truncated
`).replace(/\r/g,`
`).split(`
`).map(i=>i.trimEnd()).join(`
`).replace(/\n{3,}/g,`
`).trim();for(;;){const i=t.match(/^\*\*([^\r\n]{8,160}?)\*\*:(?:[ \t]+|\r?\n+)([\s\S]+)$/);if(!i)break;const r=i[2].trim();if(r.length<80||r===t)break;t=r}const n=t.split(/\n{2,}/).map(i=>i.trim()).filter(Boolean);return n.length>1&&/^Verification:\s/i.test(n[n.length-1])&&(t=n.slice(0,-1).join(`
`).trim()),sD(t).slice(0,2e3)}function Gx(e){const t=e.metadata??{};switch(String(t.transcript_kind??t.kind??"").trim()){case"child_task_result":return 80;case"child_task_result_retry":return 79;case"company_role_result":return 75;case"company_role_result_retry":return 74;case"child_result":return 70;case"runtime_v2_assistant":return 60;case"runtime_v2_company_assistant":return 20;case"top_level_reply":return 40}return String(t.kind??"").trim()==="worker_notification"?20:0}function mS(e){return String(e.content??"").replace(/\r\n/g,`
`).replace(/\r/g,`
`).split(`
`).map(t=>t.trimEnd()).join(`
`).trim().length}function pS(e){const t=e.metadata??{};let n=0;return String(t.source??"").trim()==="engine"&&(n+=4),String(t.source_result_message_id??"").trim()&&(n+=2),(t.authoritative_output===!0||t.canonical_result===!0)&&(n+=1),n}function aD(e,t){const n=[[Gx(e),Gx(t)],[pS(e),pS(t)],[mS(e),mS(t)]];for(const[o,a]of n)if(o!==a)return o>a?1:-1;const i=e.id.localeCompare(t.id);if(i!==0)return i;const r=e.content.localeCompare(t.content);return r!==0?r:e.timestamp===t.timestamp?0:e.timestamp>t.timestamp?1:-1}function xE(e){if(Gx(e)<=0)return"";const t=yE(e);if(t)return`result:${t}`;const n=oD(e.content);return n?`result:${n}`:""}function rf(e){if(!e)return;const t=e.replace(/,/g,"").trim();if(!t)return;const n=Number(t);return Number.isFinite(n)?Math.max(0,Math.round(n)):void 0}function hS(e){if(!(typeof e!="number"||!Number.isFinite(e)))return Math.max(0,Math.min(Math.round(e),100))}function _l(e){if(!e)return;const t=String(e.execMode??"").trim();if(!(t==="company"||t==="org"||t==="custom"||!!e.isCompanyRuntime||!!e.roleWorkItems||!!e.executorRoleWorkItems))return;const i=Object.values(e.executorRoleWorkItems??e.roleWorkItems??{});if(i.length===0)return;const r=i.map(o=>o.aggregatedStatus);if(r.some(o=>o==="active"))return"running";if(r.some(o=>o==="waiting")||r.some(o=>o==="pending"))return"pending";if(r.every(o=>o==="failed"))return"failed";if(r.every(o=>o==="done")||r.some(o=>o==="done"))return"done"}function lD(e){const t={};for(const n of e??[]){const i=`${n.summary??""} ${n.detail??""}`.trim();if(!i)continue;const r=nD.exec(i);if(r){const c=rf(r[1]),d=rf(r[2]);typeof c=="number"&&(t.contextTokens=c),typeof d=="number"&&d>0&&(t.contextWindow=d)}const o=rD.exec(i);if(o){t.contextRemainingPct=hS(rf(o[1]));continue}const a=iD.exec(i);if(a){const c=hS(rf(a[1]));typeof c=="number"&&(t.contextRemainingPct=100-c)}}return t}function Yf(e){const t=lD(e.progressLog),n=e.contextTokens??t.contextTokens,i=e.contextWindow??t.contextWindow,r=e.contextRemainingPct??t.contextRemainingPct;return n===e.contextTokens&&i===e.contextWindow&&r===e.contextRemainingPct?e:{...e,contextTokens:n,contextWindow:i,contextRemainingPct:r}}function vE(e){const t=new Set,n=[];for(const i of e)t.has(i.taskId)||(t.add(i.taskId),n.push(i));return n}function cD(e){return!!(String(e?.workItemRoleId??"").trim()||String(e?.workItemRoleName??"").trim())}function Df(e,t){if(!e||e.mode==="child")return[];const n=new Set;e.sessionId&&n.add(e.sessionId),n.add(e.taskId);const i=String(e.originTaskId??e.taskId??"").trim(),r=new Map;for(const c of e.workItemLog??[]){const d=c.executionTurnId||c.runtimeTaskId;d&&!r.has(d)&&r.set(d,r.size)}const o=new Set;return t.filter(c=>{if(c.taskId===e.taskId||o.has(c.taskId))return!1;const d=!!c.parentSessionId&&n.has(c.parentSessionId),m=r.has(c.taskId),h=!!i&&String(c.originTaskId??"").trim()===i;return!d&&!m&&!h?!1:(o.add(c.taskId),!0)}).sort((c,d)=>{const m=r.get(c.taskId),h=r.get(d.taskId);return m!=null&&h!=null&&m!==h?m-h:m!=null&&h==null?-1:m==null&&h!=null?1:d.updatedAt-c.updatedAt})}function gS(e,t){const n=Df(e,t);return!e||e.mode==="child"||!cD(e)?n:vE([e,...n])}function Xf(e,t){if(!e||e.mode==="child")return[];const n=String(e.sessionId??"").trim();if(!n)return[];const i=new Set;return t.filter(r=>r.taskId===e.taskId||i.has(r.taskId)||String(r.sessionId??"").trim()!==n?!1:(i.add(r.taskId),!0)).sort((r,o)=>o.updatedAt-r.updatedAt)}function uD(e){const t=String(e?.execMode??"").trim();return t==="company"||t==="org"||t==="custom"}function yS(e){const t=ss(e)?1e9:0,n=String(e.draftAssistantText??"").trim()?1e10:0,i=Math.max(0,e.messageCount??0)*1e4,r=(e.progressLog?.length??0)*100;return n+t+i+r+e.updatedAt}function xS(e){const t=gE(e),n=ss(e)?1e11:0,i=String(e.draftAssistantText??"").trim()?1e10:0,r=typeof t.usedPct=="number"||typeof t.usedTokens=="number"||typeof t.windowTokens=="number"?1e10:0,o=typeof e.inputTokens=="number"||typeof e.outputTokens=="number"||typeof e.totalTokens=="number"?1e9:0,a=Math.max(0,e.messageCount??0)*1e4,c=(e.progressLog?.length??0)*100;return n+i+r+o+a+c}function Kf(e,t){if(!e)return{timelineSessions:[],displaySession:null,runtimeSession:null,projectedFromChild:!1};const n=Yf(e);if(e.mode==="child"||t.length===0)return{timelineSessions:[n],displaySession:n,runtimeSession:n,projectedFromChild:!1};const i=t.map(Yf),r=i.filter(p=>p.status!=="cancelled"),o=r.length>0?r:i,a=vE([n,...o]),c=uD(e),d=[...a].sort((p,g)=>yS(g)-yS(p))[0]??n,m=c?n:d,h=[...a].sort((p,g)=>xS(g)-xS(p))[0]??m;return{timelineSessions:a,displaySession:m,runtimeSession:h,projectedFromChild:!c&&m.taskId!==e.taskId}}function vS(e,t,n){if(!e)return null;const i=Yf(e),r=t??i,o=_l(r)??_l(i),a=Zf(n.length>0?n:[i]);return{...i,status:o??(r.status||i.status),assigneeIds:r.assigneeIds.length>0?r.assigneeIds:i.assigneeIds,agentStatus:r.agentStatus??i.agentStatus,currentTool:r.currentTool??i.currentTool,displayTool:r.displayTool??r.currentTool??i.displayTool??i.currentTool,toolElapsedMs:r.toolElapsedMs??i.toolElapsed Line truncated
Set up at least one role before running a task.
Go to Org tab now?`,"workspace.confirmNoDecider":`Your organization has multiple top-level roles but no final decider selected.
Choose one final decider in the Org tab before running a task.
Go to Org tab now?`,"workspace.warningNoTeams":"No runtime teams defined — the system will auto-generate from your roles","workspace.warningVacantRoles":"{count} role(s) have no employees: {names}","workspace.confirmWarnings":`Before running this task:
{warnings}
Run anyway?`,"kanban.addTask":"Add task","kanban.taskTitle":"Task title...","kanban.startTask":"Start task","kanban.startWorkItem":"Start Work Item","kanban.upstreamDeps":"{count} upstream dep(s)","kanban.dep":"{count} dep","kanban.crossOffice":"Cross-office","kanban.executionTurn":"Execution Turn: {id}","kanban.column.Todo":"Todo","kanban.column.In Progress":"In Progress","kanban.column.Done":"Done","kanban.column.Ready":"Ready","kanban.column.Running":"Running","kanban.column.Review":"Review","kanban.column.Approved":"Approved","kanban.status.todo":"To do","kanban.status.in_progress":"In progress","kanban.status.in_review":"In review","kanban.status.done":"Done","kanban.status.running":"Running","kanban.status.idle":"Idle","kanban.status.blocked":"Blocked","kanban.status.awaiting_peer":"Awaiting","kanban.status.awaiting_manager_review":"Mgr Review","kanban.status.awaiting_human":"Human Review","kanban.status.awaiting_review":"In Review","kanban.status.failed":"Failed","kanban.status.cancelled":"Cancelled","agent.status.idle":"Idle","agent.status.reflecting":"Thinking...","agent.status.tool_active":"Running tool","agent.summary.active":"{active}/{total} active","agent.summary.count":"{count} agent","agent.summary.countPlural":"{count} agents","org.loading":"Loading organization data...","org.company":"Company","org.customOrg":"Custom org","org.corporateCompany":"Corporate company","org.kind.saved":"Saved org","org.kind.corporate":"Corporate","org.state.editableSaved":"Editable saved architecture","org.state.editableDraft":"Editable draft architecture","org.state.readOnly":"Built-in read-only architecture","org.organization":"Organization","org.corporate":"Corporate","org.newOrganization":"New organization","org.roles":"roles","org.employees":"employees","org.runtimeTeams":"runtime teams","org.tab.team":"Team","org.tab.runtime":"Runtime","org.tab.architecture":"Architecture","org.tab.employees":"Employees","org.createdToast":"Created {name} and saved automatically","org.architectureApplied":"Architecture applied successfully"},mD={"app.page.workspace":"工作台","app.page.office":"办公室","app.page.org":"组织","app.page.mapEditor":"地图编辑","app.metric.agents":"Agent","app.metric.skills":"技能","app.metric.tasks":"任务","language.label":"语言","language.english":"EN","language.chinese":"简","outdoor.title":"户外光照","outdoor.auto":"户外自动","outdoor.day":"户外白天","outdoor.night":"户外夜晚","theme.midnight":"午夜","theme.neon":"霓虹","theme.paper":"纸张","theme.retro":"复古","theme.terminal":"终端","theme.cozy":"舒适","theme.openopc":"OpenOPC","dev.tools":"开发工具","dev.connection":"连接","dev.evolution":"进化流水线","dev.events":"事件","dev.channels":"频道","dev.phase.trace":"追踪","dev.phase.reflect":"反思","dev.phase.synthesize":"合成","dev.phase.practice":"练习","dev.phase.lifecycle":"生命周期","project.switch":"切换项目","project.new":"新建项目","project.delete":"删除项目","project.deleteButton":"删","project.placeholder":"项目名","project.confirmTitle":"删除项目“{name}”?","project.confirmBody":"此项目中的所有会话、消息、任务和 Agent 数据都会被永久删除。此操作无法撤销。","common.cancel":"取消","common.delete":"删除","common.yes":"是","common.no":"否","common.loading":"加载中...","common.ready":"就绪","common.autoSaved":"已自动保存","common.active":"活跃","common.idle":"空闲","common.general":"通用","common.state":"状态","common.tool":"工具","common.task":"任务","common.seat":"座位","common.role":"角色","common.employee":"员工","common.manager":"经理","common.origin":"来源","common.projection":"投影","common.gate":"关卡","common.runtime":"运行时","office.modeHint.org":"在“组织”页管理你的团队","office.modeHint.switch":"切换到“组织”模式以创建或管理 Agent","office.offices":"办公室","office.activeAgents":"活跃 Agent","office.rename":"重命名","office.noSeat":"未分配座位","office.moveHere":"+ 移到这里","office.characters":"角色","office.hideSub":"隐藏子项","office.showSub":"显示子项","office.hideSubagents":"隐藏子 Agent","office.showSubagents":"显示子 Agent","office.showSidePanel":"显示侧栏","office.hideSidePanel":"隐藏侧栏","office.removeAgent":"移除 {name}","office.deleteQuestion":"删除?","office.emptyAgents":"还没有 Agent,点击上方模板生成一个。","session.newChat":"新聊天","session.secretary":"秘书","session.search":"搜索...","session.activity":"动态","session.noSessions":"还没有会话","session.today":"今天","session.yesterday":"昨天","session.earlier":"更早","session.runtimeSuffix":"运行时会话","session.justNow":"刚刚","session.minutes":"{count} 分钟","session.hours":"{count} 小时","session.days":"{count} 天","session.companyRuntime":"公司运行时","session.expand":"展开","session.collapse":"折叠" Line truncated
运行任务前请至少设置一个角色。
现在前往“组织”页吗?`,"workspace.confirmNoDecider":`你的组织有多个顶层角色,但尚未选择最终决策者。
运行任务前请在“组织”页选择一个最终决策者。
现在前往“组织”页吗?`,"workspace.warningNoTeams":"尚未定义运行时团队,系统会根据角色自动生成","workspace.warningVacantRoles":"{count} 个角色没有员工:{names}","workspace.confirmWarnings":`运行此任务前:
{warnings}
仍然运行吗?`,"kanban.addTask":"添加任务","kanban.taskTitle":"任务标题...","kanban.startTask":"启动任务","kanban.startWorkItem":"启动工作项","kanban.upstreamDeps":"{count} 个上游依赖","kanban.dep":"{count} 依赖","kanban.crossOffice":"跨办公室","kanban.executionTurn":"执行轮次:{id}","kanban.column.Todo":"待办","kanban.column.In Progress":"进行中","kanban.column.Done":"完成","kanban.column.Ready":"就绪","kanban.column.Running":"运行中","kanban.column.Review":"评审","kanban.column.Approved":"已批准","kanban.status.todo":"待办","kanban.status.in_progress":"进行中","kanban.status.in_review":"评审中","kanban.status.done":"完成","kanban.status.running":"运行中","kanban.status.idle":"空闲","kanban.status.blocked":"阻塞","kanban.status.awaiting_peer":"等待同伴","kanban.status.awaiting_manager_review":"经理评审","kanban.status.awaiting_human":"人工评审","kanban.status.awaiting_review":"评审中","kanban.status.failed":"失败","kanban.status.cancelled":"已取消","agent.status.idle":"空闲","agent.status.reflecting":"思考中...","agent.status.tool_active":"运行工具","agent.summary.active":"{active}/{total} 活跃","agent.summary.count":"{count} 个 Agent","agent.summary.countPlural":"{count} 个 Agent","org.loading":"正在加载组织数据...","org.company":"公司","org.customOrg":"自定义组织","org.corporateCompany":"企业公司","org.kind.saved":"已保存组织","org.kind.corporate":"企业","org.state.editableSaved":"可编辑的已保存架构","org.state.editableDraft":"可编辑草稿架构","org.state.readOnly":"内置只读架构","org.organization":"组织","org.corporate":"企业","org.newOrganization":"新建组织","org.roles":"角色","org.employees":"员工","org.runtimeTeams":"运行时团队","org.tab.team":"团队","org.tab.runtime":"运行时","org.tab.architecture":"架构","org.tab.employees":"员工","org.createdToast":"已创建 {name} 并自动保存","org.architectureApplied":"架构已成功应用"},Eg={en:fD,"zh-CN":mD},_E=C.createContext(null);function pD(){try{const e=localStorage.getItem(bE);if(e==="en"||e==="zh-CN")return e}catch{}try{return navigator.language.toLowerCase().startsWith("zh")?"zh-CN":"en"}catch{return"en"}}function hD(e,t){return t?e.replace(/\{(\w+)\}/g,(n,i)=>Object.prototype.hasOwnProperty.call(t,i)?String(t[i]):`{${i}}`):e}function gD({children:e}){const[t,n]=C.useState(()=>pD());C.useEffect(()=>{document.documentElement.lang=t==="zh-CN"?"zh-CN":"en"},[t]);const i=C.useCallback(c=>{n(c);try{localStorage.setItem(bE,c),document.documentElement.lang=c==="zh-CN"?"zh-CN":"en"}catch{}},[]),r=C.useCallback((c,d)=>{const m=Eg[t][c]??Eg.en[c]??c;return hD(m,d)},[t]),o=C.useCallback((c,d)=>{const m=String(d??"").trim();if(!m)return"";const h=`${c}.${m}`;return Eg[t][h]??m},[t]),a=C.useMemo(()=>({locale:t,setLocale:i,t:r,translateMaybe:o}),[t,i,r,o]);return u.jsx(_E.Provider,{value:a,children:e})}function Vr(){const e=C.useContext(_E);if(!e)throw new Error("useI18n must be used within I18nProvider");return e}const yD={idle:"status-idle",done:"status-done",pending:"status-pending",failed:"status-failed",cancelled:"status-cancelled",blocked:"status-blocked"};function xD(e){const t=_l(e)??e.status,n=Om({...e,status:t});return n==="tool_active"?"status-tool-active":n==="reflecting"?"status-reflecting":t==="running"?"status-running-idle":yD[t]??"status-pending"}function vD(e,t){const n=Date.now()-e;return n<6e4?t("session.justNow"):n<36e5?t("session.minutes",{count:Math.floor(n/6e4)}):n<864e5?t("session.hours",{count:Math.floor(n/36e5)}):t("session.days",{count:Math.floor(n/864e5)})}function bD(e){const t=new Date,n=new Date(e),i=new Date(t.getFullYear(),t.getMonth(),t.getDate()),r=new Date(i.getTime()-864e5);return n>=i?"Today":n>=r?"Yesterday":"Earlier"}function kS(e,t,n){const i=n(e==="Today"?"session.today":e==="Yesterday"?"session.yesterday":"session.earlier");return t?`${i} ${n("session.runtimeSuffix")}`:i}function _D(e){const t=new Map,n=[];for(const i of e)if(i.mode==="child"&&i.parentSessionId){const r=t.get(i.parentSessionId)??[];r.push(i),t.set(i.parentSessionId,r)}else n.push(i);return n.map(i=>({session:i,children:Array.from(new Map([...i.sessionId?t.get(i.sessionId)??[]:[],...t.get(i.taskId)??[]].map(r=>[r.taskId,r])).values())}))}function sf({session:e,isActive:t,isChild:n,isLast:i,unreadCount:r,onSelect:o,onDelete:a}){const{t:c,translateMaybe:d}=Vr(),[m,h]=C.useState(!1),[p,g]=C.useState(!1),x=e.assigneeIds.length>0?e.assigneeIds[0].replace(/^agent-/,""):null,v=_l(e)??e.status;return C.useEffect(()=>{if(!p)return;const b=setTimeout(()=>g(!1),3e3);return()=>clearTimeout(b)},[p]),u.jsxs("button",{className:`session-item${t?" active":""}${n?" session-item-child":""}`,onClick:o,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:[n&&u.jsx("span",{className:`session-tree-line${i?" last":""}`}),u.jsx("span",{className:`session-dot ${xD(e)}`}),u.jsxs("div",{className:"s Line truncated
The error may be correlated with this previous error:
${ee.current.stack}
`),we}Qf(()=>{ee.current=void 0,B.current=void 0,V.current=ue});const ne=C.useMemo(()=>C.createElement(w,{...ue,ref:T}),[T,w,ue]);return C.useMemo(()=>v?C.createElement(I.Provider,{value:W},ne):ne,[I,ne,W])}const A=C.memo(N);if(A.WrappedComponent=w,A.displayName=N.displayName=S,d){const O=C.forwardRef(function(M,I){return C.createElement(A,{...M,reactReduxForwardedRef:I})});return O.displayName=S,O.WrappedComponent=w,Yx(O,w)}return Yx(A,w)}}var RE=C5;function j5(e){const{children:t,context:n,serverState:i,store:r}=e,o=C.useMemo(()=>{const d=NE(r);return{store:r,subscription:d,getServerState:i?()=>i:void 0}},[r,i]),a=C.useMemo(()=>r.getState(),[r]);Qf(()=>{const{subscription:d}=o;return d.onStateChange=d.notifyNestedSubs,d.trySubscribe(),a!==r.getState()&&d.notifyNestedSubs(),()=>{d.tryUnsubscribe(),d.onStateChange=void 0}},[o,a]);const c=n||TE;return C.createElement(c.Provider,{value:o},t)}var E5=j5,N5="Invariant failed";function I5(e,t){throw new Error(N5)}var zr=function(t){var n=t.top,i=t.right,r=t.bottom,o=t.left,a=i-o,c=r-n,d={top:n,right:i,bottom:r,left:o,width:a,height:c,x:o,y:n,center:{x:(i+o)/2,y:(r+n)/2}};return d},Xv=function(t,n){return{top:t.top-n.top,left:t.left-n.left,bottom:t.bottom+n.bottom,right:t.right+n.right}},LS=function(t,n){return{top:t.top+n.top,left:t.left+n.left,bottom:t.bottom-n.bottom,right:t.right-n.right}},T5=function(t,n){return{top:t.top+n.y,left:t.left+n.x,bottom:t.bottom+n.y,right:t.right+n.x}},Rg={top:0,right:0,bottom:0,left:0},Kv=function(t){var n=t.borderBox,i=t.margin,r=i===void 0?Rg:i,o=t.border,a=o===void 0?Rg:o,c=t.padding,d=c===void 0?Rg:c,m=zr(Xv(n,r)),h=zr(LS(n,a)),p=zr(LS(h,d));return{marginBox:m,borderBox:zr(n),paddingBox:h,contentBox:p,margin:r,border:a,padding:d}},Cr=function(t){var n=t.slice(0,-2),i=t.slice(-2);if(i!=="px")return 0;var r=Number(n);return isNaN(r)&&I5(),r},R5=function(){return{x:window.pageXOffset,y:window.pageYOffset}},Jf=function(t,n){var i=t.borderBox,r=t.border,o=t.margin,a=t.padding,c=T5(i,n);return Kv({borderBox:c,border:r,margin:o,padding:a})},em=function(t,n){return n===void 0&&(n=R5()),Jf(t,n)},AE=function(t,n){var i={top:Cr(n.marginTop),right:Cr(n.marginRight),bottom:Cr(n.marginBottom),left:Cr(n.marginLeft)},r={top:Cr(n.paddingTop),right:Cr(n.paddingRight),bottom:Cr(n.paddingBottom),left:Cr(n.paddingLeft)},o={top:Cr(n.borderTopWidth),right:Cr(n.borderRightWidth),bottom:Cr(n.borderBottomWidth),left:Cr(n.borderLeftWidth)};return Kv({borderBox:t,margin:i,padding:r,border:o})},ME=function(t){var n=t.getBoundingClientRect(),i=window.getComputedStyle(t);return AE(n,i)},vu=function(t){var n=[],i=null,r=function(){for(var a=arguments.length,c=new Array(a),d=0;d<a;d++)c[d]=arguments[d];n=c,!i&&(i=requestAnimationFrame(function(){i=null,t.apply(void 0,n)}))};return r.cancel=function(){i&&(cancelAnimationFrame(i),i=null)},r};function tm(){return tm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},tm.apply(null,arguments)}function DE(e,t){}DE.bind(null,"warn");DE.bind(null,"error");function vo(){}function A5(e,t){return{...e,...t}}function Ir(e,t,n){const i=t.map(r=>{const o=A5(n,r.options);return e.addEventListener(r.eventName,r.fn,o),function(){e.removeEventListener(r.eventName,r.fn,o)}});return function(){i.forEach(o=>{o()})}}const M5="Invariant failed";class nm extends Error{}nm.prototype.toString=function(){return this.message};function Pe(e,t){throw new nm(M5)}let D5=class extends Et.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=vo,this.onWindowError=n=>{const i=this.getCallbacks();i.isDragging()&&i.tryAbort(),n.error instanceof nm&&n.preventDefault()},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return this.callbacks},this.setCallbacks=n=>{this.callbacks=n}}componentDidMount(){this.unbind=Ir(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof nm){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}};const O5=`
Press space bar to start a drag.
When dragging you can use the arrow keys to move the item around and escape to cancel.
Some screen readers may require you to be in focus mode or to use your pass through key
`,im=e=>e+1,L5=e=>`
You have lifted an item in position ${im(e.source.index)}
`,OE=(e,t)=>{const n=e.droppableId===t.droppableId,i=im(e.index),r=im(t.index);return n?`
You have moved the item from position ${i}
to position ${r}
`:`
You have moved the item from position ${i}
in list ${e.droppableId}
to list ${t.droppableId}
in position ${r}
`},LE=(e,t,n)=>t.droppableId===n.droppableId?`
The item ${e}
has been combined with ${n.draggableId}`:`
The item ${e}
in list ${t.droppableId}
has been combined with ${n.draggableId}
in list ${n.droppableId}
`,z5=e=>{const t=e.destination;if(t)return OE(e.source,t);const n=e.combine;return n?LE(e.draggableId,e.source,n):"You are over an area that cannot be dropped on"},zS=e=>`
The item has returned to its starting position
of ${im(e.index)}
`,P5=e=>{if(e.reason==="CANCEL")return`
Movement cancelled.
${zS(e.source)}
`;const t=e.destination,n=e.combine;return t?`
You have dropped the item.
${OE(e.source,t)}
`:n?`
You have dropped the item.
${LE(e.draggableId,e.source,n)}
`:`
The item has been dropped while not over a drop area.
${zS(e.source)}
`},Of={dragHandleUsageInstructions:O5,onDragStart:L5,onDragUpdate:z5,onDragEnd:P5};function B5(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function zE(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!B5(e[n],t[n]))return!1;return!0}function sn(e,t){const n=C.useState(()=>({inputs:t,result:e()}))[0],i=C.useRef(!0),r=C.useRef(n),a=i.current||!!(t&&r.current.inputs&&zE(t,r.current.inputs))?r.current:{inputs:t,result:e()};return C.useEffect(()=>{i.current=!1,r.current=a},[a]),a.result}function it(e,t){return sn(()=>e,t)}const ki={x:0,y:0},Ii=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),dr=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),bo=(e,t)=>e.x===t.x&&e.y===t.y,Hl=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),la=(e,t,n=0)=>e==="x"?{x:t,y:n}:{x:n,y:t},bu=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),PS=(e,t)=>Math.min(...t.map(n=>bu(e,n))),PE=e=>t=>({x:e(t.x),y:e(t.y)});var $5=(e,t)=>{const n=zr({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return n.width<=0||n.height<=0?null:n};const Bu=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),BS=e=>[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}],H5={top:0,right:0,bottom:0,left:0},F5=(e,t)=>t?Bu(e,t.scroll.diff.displacement):e,V5=(e,t,n)=>n&&n.increasedBy?{...e,[t.end]:e[t.end]+n.increasedBy[t.line]}:e,U5=(e,t)=>t&&t.shouldClipSubject?$5(t.pageMarginBox,e):zr(e);var kl=({page:e,withPlaceholder:t,axis:n,frame:i})=>{const r=F5(e.marginBox,i),o=V5(r,n,t),a=U5(o,i);return{page:e,withPlaceholder:t,active:a}},Zv=(e,t)=>{e.frame||Pe();const n=e.frame,i=dr(t,n.scroll.initial),r=Hl(i),o={...n,scroll:{initial:n.scroll.initial,current:t,diff:{value:i,displacement:r},max:n.scroll.max}},a=kl({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:o});return{...e,frame:o,subject:a}};function _i(e,t=zE){let n=null;function i(...r){if(n&&n.lastThis===this&&t(r,n.lastArgs))return n.lastResult;const o=e.apply(this,r);return n={lastResult:o,lastArgs:r,lastThis:this},o}return i.clear=function(){n=null},i}const BE=_i(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),$E=_i(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),zm=_i(e=>Object.values(e)),G5=_i(e=>Object.values(e));var Fl=_i((e,t)=>G5(t).filter(i=>e===i.descriptor.droppableId).sort((i,r)=>i.descriptor.index-r.descriptor.index));function Qv(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function Pm(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var Bm=_i((e,t)=>t.filter(n=>n.descriptor.id!==e.descriptor.id)),q5=({isMovingForward:e,draggable:t,destination:n,insideDestination:i,previousImpact:r})=>{if(!n.isCombineEnabled||!Qv(r))return null;function a(x){const v={type:"COMBINE",combine:{draggableId:x,droppableId:n.descriptor.id}};return{...r,at:v}}const c=r.displaced.all,d=c.length?c[0]:null;if(e)return d?a(d):null;const m=Bm(t,i);if(!d){if(!m.length)return null;const x=m[m.length-1];return a(x.descriptor.id)}const h=m.findIndex(x=>x.descriptor.id===d);h===-1&&Pe();const p=h-1;if(p<0)return null;const g=m[p];return a(g.descriptor.id)},Vl=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const HE={point:ki,value:0},_u={invisible:{},visible:{},all:[]},W5={displaced:_u,displacedBy:HE,at:null};var Tr=(e,t)=>n=>e<=n&&n<=t,FE=e=>{const t=Tr(e.top,e.bottom),n=Tr(e.left,e.right);return i=>{if(t(i.top)&&t(i.bottom)&&n(i.left)&&n(i.right))return!0;const o=t(i.top)||t(i.bottom),a=n(i.left)||n(i.right);if(o&&a)return!0;const d=i.top<e.top&&i.bottom>e.bottom,m=i.left<e.left&&i.right>e.right;return d&&m?!0:d&&a||m&&o}},Y5=e=>{const t=Tr(e.top,e.bottom),n=Tr(e.left,e.right);return i=>t(i.top)&&t(i.bottom)&&n(i.left)&&n(i.right)};const Jv={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},VE={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var X5=e=>t=>{const n=Tr(t.top,t.bottom),i=Tr(t.left,t.right);return r=>e===Jv?n(r.top)&&n(r.bottom):i(r.left)&&i(r.right)};const K5=(e,t)=>{const n=t.frame?t.frame.scroll.diff.displacement:ki;return Bu(e,n)},Z5=(e,t,n)=>t.subject.active?n(t.subject.active)(e):!1,Q5=(e,t,n)=>n(t)(e),e0=({target:e,destination:t,viewport:n,withDroppableDisplacement:i,isVisibleThroughFrameFn:r})=>{const o=i?K5(e,t):e;return Z5(o,t,r)&&Q5(o,n,r)},J5=e=>e0({...e,isVisibleThroughFrameFn:FE}),UE=e=>e0({...e,isVisibleThroughFrameFn:Y5}),eO=e=>e0({...e,isVisibleThroughFrameFn:X5(e.destination.axis)}),tO=(e,t,n)=>{if(typeof n=="boolean")return n;if(!t)return!0;const{invisible:i,visible:r}=t;if(i[e])return!1;const o=r[e];return o?o.shouldAnimate:!0};function nO(e,t){const n=e.page.marginBox,i={top:t.point.y,right:0,bottom:0,left:t.point.x};return zr(Xv(n,i))}function ku({afterDragging:e,destination:t,displacedBy:n,viewport:i,forceShouldAnimate:r,la Line truncated
cursor: -webkit-grab;
cursor: grab;
`;return{selector:t(wl.contextId),styles:{always:`
-webkit-touch-callout: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
touch-action: manipulation;
`,resting:c,dragging:i6,dropAnimating:c}}})(),i=(()=>{const c=`
transition: ${cu.outOfTheWay};
`;return{selector:t(Jx.contextId),styles:{dragging:c,dropAnimating:c,userCancel:c}}})(),r={selector:t(t6.contextId),styles:{always:"overflow-anchor: none;"}},a=[i,n,r,{selector:"body",styles:{dragging:`
cursor: grabbing;
cursor: -webkit-grabbing;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
overflow-anchor: none;
`}}];return{always:$c(a,"always"),resting:$c(a,"resting"),dragging:$c(a,"dragging"),dropAnimating:$c(a,"dropAnimating"),userCancel:$c(a,"userCancel")}};const mr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?C.useLayoutEffect:C.useEffect,Lg=()=>{const e=document.querySelector("head");return e||Pe(),e},JS=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function s6(e,t){const n=sn(()=>r6(e),[e]),i=C.useRef(null),r=C.useRef(null),o=it(_i(p=>{const g=r.current;g||Pe(),g.textContent=p}),[]),a=it(p=>{const g=i.current;g||Pe(),g.textContent=p},[]);mr(()=>{!i.current&&!r.current||Pe();const p=JS(t),g=JS(t);return i.current=p,r.current=g,p.setAttribute(`${Sl}-always`,e),g.setAttribute(`${Sl}-dynamic`,e),Lg().appendChild(p),Lg().appendChild(g),a(n.always),o(n.resting),()=>{const x=v=>{const b=v.current;b||Pe(),Lg().removeChild(b),v.current=null};x(i),x(r)}},[t,a,o,n.always,n.resting,e]);const c=it(()=>o(n.dragging),[o,n.dragging]),d=it(p=>{if(p==="DROP"){o(n.dropAnimating);return}o(n.userCancel)},[o,n.dropAnimating,n.userCancel]),m=it(()=>{r.current&&o(n.resting)},[o,n.resting]);return sn(()=>({dragging:c,dropping:d,resting:m}),[c,d,m])}function yN(e,t){return Array.from(e.querySelectorAll(t))}var xN=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function Hm(e){return e instanceof xN(e).HTMLElement}function o6(e,t){const n=`[${wl.contextId}="${e}"]`,i=yN(document,n);if(!i.length)return null;const r=i.find(o=>o.getAttribute(wl.draggableId)===t);return!r||!Hm(r)?null:r}function a6(e){const t=C.useRef({}),n=C.useRef(null),i=C.useRef(null),r=C.useRef(!1),o=it(function(g,x){const v={id:g,focus:x};return t.current[g]=v,function(){const w=t.current;w[g]!==v&&delete w[g]}},[]),a=it(function(g){const x=o6(e,g);x&&x!==document.activeElement&&x.focus()},[e]),c=it(function(g,x){n.current===g&&(n.current=x)},[]),d=it(function(){i.current||r.current&&(i.current=requestAnimationFrame(()=>{i.current=null;const g=n.current;g&&a(g)}))},[a]),m=it(function(g){n.current=null;const x=document.activeElement;x&&x.getAttribute(wl.draggableId)===g&&(n.current=g)},[]);return mr(()=>(r.current=!0,function(){r.current=!1;const g=i.current;g&&cancelAnimationFrame(g)}),[]),sn(()=>({register:o,tryRecordFocus:m,tryRestoreFocusRecorded:d,tryShiftRecord:c}),[o,m,d,c])}function l6(){const e={draggables:{},droppables:{}},t=[];function n(p){return t.push(p),function(){const x=t.indexOf(p);x!==-1&&t.splice(x,1)}}function i(p){t.length&&t.forEach(g=>g(p))}function r(p){return e.draggables[p]||null}function o(p){const g=r(p);return g||Pe(),g}const a={register:p=>{e.draggables[p.descriptor.id]=p,i({type:"ADDITION",value:p})},update:(p,g)=>{const x=e.draggables[g.descriptor.id];x&&x.uniqueId===p.uniqueId&&(delete e.draggables[g.descriptor.id],e.draggables[p.descriptor.id]=p)},unregister:p=>{const g=p.descriptor.id,x=r(g);x&&p.uniqueId===x.uniqueId&&(delete e.draggables[g],e.droppables[p.descriptor.droppableId]&&i({type:"REMOVAL",value:p}))},getById:o,findById:r,exists:p=>!!r(p),getAllByType:p=>Object.values(e.draggables).filter(g=>g.descriptor.type===p)};function c(p){return e.droppables[p]||null}function d(p){const g=c(p);return g||Pe(),g}const m={register:p=>{e.droppables[p.descriptor.id]=p},unregister:p=>{const g=c(p.descriptor.id);g&&p.uniqueId===g.uniqueId&&delete e.droppables[p.descriptor.id]},getById:d,findById:c,exists:p=>!!c(p),getAllByType:p=>Object.values(e.droppables).filter(g=>g.descriptor.type===p)};function h(){e.draggables={},e.droppables={},t.length=0}return{draggable:a,droppable:m,subscribe:n,clean:h}}function c6(){const e=sn(l6,[]);return C.useEffect(()=>function(){e.clean()},[e]),e}var d0=Et.createContext(null),sm=()=>{const e=document.body;return e||Pe(),e};const u6={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},d6=e=>`rfd-announcement-${e}`;function f6(e){const t=sn(()=>d6(e),[e]),n=C.useRef(null);return C.useEffect(function(){const o=document.createElement("div");return n.current=o,o.id=t,o.setAttribute("aria-live","assertive"),o.setAttribute("aria-atomic","true"),tm(o.style,u6),sm().appendChild(o),function(){setTimeout(function(){const d=sm();d.contains(o)&&d.removeChild(o),o===n.current&&(n.current=null)})}},[t]),it(r=>{const o=n.current;if(o){o.textContent=r;return}},[])}const m6={separator:"::"};function f0(e,t=m6){const n=Et.useId();return sn(()=>`${e}${t.separator}${n}`,[t.separator,e,n])}function p6({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function h6({contextId:e,text:t}){const n=f0("hidden-text",{separator:"-"}),i=sn(()=>p6({contextId:e,uniqueId:n}),[n,e]);return C.useEffect(function(){const o=document.createElement("div");return o.id=i,o.textContent=t,o.style.display="none",sm().appendChild(o),function(){const c=sm();c.contains(o)&&c.removeChild(o)}},[i,t]),i}var Fm=Et.c Line truncated
`,m="/",h="*",p="",g="comment",x="declaration";function v(w,k){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];k=k||{};var S=1,j=1;function N(P){var U=P.match(t);U&&(S+=U.length);var $=P.lastIndexOf(d);j=~$?P.length-$:j+P.length}function L(){var P={line:S,column:j};return function(U){return U.position=new A(P),T(),U}}function A(P){this.start=P,this.end={line:S,column:j},this.source=k.source}A.prototype.content=w;function D(P){var U=new Error(k.source+":"+S+":"+j+": "+P);if(U.reason=P,U.filename=k.source,U.line=S,U.column=j,U.source=w,!k.silent)throw U}function O(P){var U=P.exec(w);if(U){var $=U[0];return N($),w=w.slice($.length),U}}function T(){O(n)}function M(P){var U;for(P=P||[];U=I();)U!==!1&&P.push(U);return P}function I(){var P=L();if(!(m!=w.charAt(0)||h!=w.charAt(1))){for(var U=2;p!=w.charAt(U)&&(h!=w.charAt(U)||m!=w.charAt(U+1));)++U;if(U+=2,p===w.charAt(U-1))return D("End of comment missing");var $=w.slice(2,U-2);return j+=2,N($),w=w.slice(U),j+=2,P({type:g,comment:$})}}function H(){var P=L(),U=O(i);if(U){if(I(),!O(r))return D("property missing ':'");var $=O(o),G=P({type:x,property:b(U[0].replace(e,p)),value:$?b($[0].replace(e,p)):p});return O(a),G}}function Y(){var P=[];M(P);for(var U;U=H();)U!==!1&&(P.push(U),M(P));return P}return T(),Y()}function b(w){return w?w.replace(c,p):p}return Gg=v,Gg}var yw;function O8(){if(yw)return Ja;yw=1;var e=Ja&&Ja.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.default=n;const t=e(D8());function n(i,r){let o=null;if(!i||typeof i!="string")return o;const a=(0,t.default)(i),c=typeof r=="function";return a.forEach(d=>{if(d.type!=="declaration")return;const{property:m,value:h}=d;c?r(m,h,d):h&&(o=o||{},o[m]=h)}),o}return Ja}var Uc={},xw;function L8(){if(xw)return Uc;xw=1,Object.defineProperty(Uc,"__esModule",{value:!0}),Uc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,r=/^-(ms)-/,o=function(m){return!m||n.test(m)||e.test(m)},a=function(m,h){return h.toUpperCase()},c=function(m,h){return"".concat(h,"-")},d=function(m,h){return h===void 0&&(h={}),o(m)?m:(m=m.toLowerCase(),h.reactCompat?m=m.replace(r,c):m=m.replace(i,c),m.replace(t,a))};return Uc.camelCase=d,Uc}var Gc,vw;function z8(){if(vw)return Gc;vw=1;var e=Gc&&Gc.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},t=e(O8()),n=L8();function i(r,o){var a={};return!r||typeof r!="string"||(0,t.default)(r,function(c,d){c&&d&&(a[(0,n.camelCase)(c,o)]=d)}),a}return i.default=i,Gc=i,Gc}var P8=z8();const B8=pa(P8),UN=GN("end"),v0=GN("start");function GN(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function $8(e){const t=v0(e),n=UN(e);if(t&&n)return{start:t,end:n}}function uu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?bw(e.position):"start"in e||"end"in e?bw(e):"line"in e||"column"in e?rv(e):""}function rv(e){return _w(e&&e.line)+":"+_w(e&&e.column)}function bw(e){return rv(e&&e.start)+"-"+rv(e&&e.end)}function _w(e){return e&&typeof e=="number"?e:1}class Li extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let r="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?r=t:!o.cause&&t&&(a=!0,r=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof i=="string"){const d=i.indexOf(":");d===-1?o.ruleId=i:(o.source=i.slice(0,d),o.ruleId=i.slice(d+1))}if(!o.place&&o.ancestors&&o.ancestors){const d=o.ancestors[o.ancestors.length-1];d&&(o.place=d.position)}const c=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=c?c.line:void 0,this.name=uu(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Li.prototype.file="";Li.prototype.name="";Li.prototype.reason="";Li.prototype.message="";Li.prototype.stack="";Li.prototype.column=void 0;Li.prototype.line=void 0;Li.prototype.ancestors=void 0;Li.prototype.cause=void 0;Li.prototype.fatal=void 0;Li.prototype.place=void 0;Li.prototype.ruleId=void 0;Li.prototype.source=void 0;const b0={}.hasOwnProperty,H8=new Map,F8=/[A-Z]/g,V8=new Set(["table","tbody","thead","tfoot","tr"]),U8=new Set(["td","th"]),qN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function G8(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.j Line truncated
`;break}case-3:{a=`\r
`;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&r)continue;a=" ";break}default:a=String.fromCharCode(o)}r=o===-2,i.push(a)}return i.join("")}function JB(e){const i={constructs:ZN([XB,...(e||{}).extensions||[]]),content:r(pP),defined:[],document:r(gP),flow:r(DB),lazy:{},string:r(zB),text:r(PB)};return i;function r(o){return a;function a(c){return KB(i,o,c)}}}function e9(e){for(;!nI(e););return e}const Rw=/[\0\t\n\r]/g;function t9(){let e=1,t="",n=!0,i;return r;function r(o,a,c){const d=[];let m,h,p,g,x;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(a||void 0).decode(o)),p=0,t="",n&&(o.charCodeAt(0)===65279&&p++,n=void 0);p<o.length;){if(Rw.lastIndex=p,m=Rw.exec(o),g=m&&m.index!==void 0?m.index:o.length,x=o.charCodeAt(g),!m){t=o.slice(p);break}if(x===10&&p===g&&i)d.push(-3),i=void 0;else switch(i&&(d.push(-5),i=void 0),p<g&&(d.push(o.slice(p,g)),e+=g-p),x){case 0:{d.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,d.push(-2);e++<h;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:i=!0,e=1}p=g+1}return c&&(i&&d.push(-5),t&&d.push(t),d.push(null)),d}}const n9=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function i9(e){return e.replace(n9,r9)}function r9(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const r=n.charCodeAt(1),o=r===120||r===88;return QN(n.slice(o?2:1),o?16:10)}return w0(n)||e}const lI={}.hasOwnProperty;function s9(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),o9(n)(e9(JB(n).document().write(t9()(e,t,!0))))}function o9(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(zt),autolinkProtocol:T,autolinkEmail:T,atxHeading:o(Ue),blockQuote:o(ne),characterEscape:T,characterReference:T,codeFenced:o(je),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(je,a),codeText:o(we,a),codeTextData:T,data:T,codeFlowValue:T,definition:o(Te),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(Fe),hardBreakEscape:o(Ge),hardBreakTrailing:o(Ge),htmlFlow:o(vt,a),htmlFlowData:T,htmlText:o(vt,a),htmlTextData:T,image:o(Lt),label:a,link:o(zt),listItem:o(he),listItemValue:g,listOrdered:o(Ut,p),listUnordered:o(Ut),paragraph:o(Be),reference:B,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(Ue),strong:o(ct),thematicBreak:o(Ke)},exit:{atxHeading:d(),atxHeadingSequence:L,autolink:d(),autolinkEmail:ue,autolinkProtocol:ae,blockQuote:d(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:te,characterReferenceMarkerNumeric:te,characterReferenceValue:ee,characterReference:se,codeFenced:d(w),codeFencedFence:b,codeFencedFenceInfo:x,codeFencedFenceMeta:v,codeFlowValue:M,codeIndented:d(k),codeText:d(U),codeTextData:M,data:M,definition:d(),definitionDestinationString:N,definitionLabelString:S,definitionTitleString:j,emphasis:d(),hardBreakEscape:d(H),hardBreakTrailing:d(H),htmlFlow:d(Y),htmlFlowData:M,htmlText:d(P),htmlTextData:M,image:d(G),label:K,labelText:q,lineEnding:I,link:d($),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:Z,resourceDestinationString:W,resourceTitleString:V,resource:Q,setextHeading:d(O),setextHeadingLineSequence:D,setextHeadingText:A,strong:d(),thematicBreak:d()}};cI(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(pe){let Se={type:"root",children:[]};const De={stack:[Se],tokenStack:[],config:t,enter:c,exit:m,buffer:a,resume:h,data:n},ze=[];let Je=-1;for(;++Je<pe.length;)if(pe[Je][1].type==="listOrdered"||pe[Je][1].type==="listUnordered")if(pe[Je][0]==="enter")ze.push(Je);else{const ut=ze.pop();Je=r(pe,ut,Je)}for(Je=-1;++Je<pe.length;){const ut=t[pe[Je][0]];lI.call(ut,pe[Je][1].type)&&ut[pe[Je][1].type].call(Object.assign({sliceSerialize:pe[Je][2].sliceSerialize},De),pe[Je][1])}if(De.tokenStack.length>0){const ut=De.tokenStack[De.tokenStack.length-1];(ut[1]||Aw).call(De,void 0,ut[0])}for(Se.position={start:mo(pe.length>0?pe[0][1].start:{line:1,column:1,offset:0}),end:mo(pe.length>0?pe[pe.length-2][1].end:{line:1,column:1,offset:0})},Je=-1;++Je<t.transforms.length;)Se=t.transforms[Je](Se)||Se;return Se}function r(pe,Se,De){let ze=Se-1,Je=-1,ut=!1,tn,be,We,et;for(;++ze<=De;){const Ve=pe[ze];switch(Ve[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ve[0]==="enter"?Je++:Je--,et=void 0;break}case"lineEndingBlank":{Ve[0]==="enter"&&(tn&&!et&&!Je&&!We&&(We=ze),et=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:et=void 0}if(!Je&&Ve[0]==="enter"&&Ve[1].type==="listItemPrefix"||Je===-1&&Ve[0]==="exit"&&(Ve[1].type==="listUnordered"||Ve[1].type==="listOrdered")){if(tn){let Ae=ze;for(be=void 0;Ae--;){const St=pe[Ae];if(St[1].type==="lineEnding"||St[1].type==="lineEndingBlank"){if(St[0]==="exit")continue;be&&(pe[be][1].type="lineEndingBlank",ut=!0),St[1].type="lineEnding",be=Ae}else if(!(St[1].type==="linePrefix"||St[1].type==="blockQuotePrefix"||St[1].type==="blockQuotePrefixWhitespace"Line truncated
`}]}function d9(e,t){const n=t.value?t.value+`
`:"",i={},r=t.lang?t.lang.split(/\s+/):[];r.length>0&&(i.className=["language-"+r[0]]);let o={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function f9(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function m9(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function p9(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),r=Gl(i.toLowerCase()),o=e.footnoteOrder.indexOf(i);let a,c=e.footnoteCounts.get(i);c===void 0?(c=0,e.footnoteOrder.push(i),a=e.footnoteOrder.length):a=o+1,c+=1,e.footnoteCounts.set(i,c);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,d);const m={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,m),e.applyData(t,m)}function h9(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function g9(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function uI(e,t){const n=t.referenceType;let i="]";if(n==="collapsed"?i+="[]":n==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const r=e.all(t),o=r[0];o&&o.type==="text"?o.value="["+o.value:r.unshift({type:"text",value:"["});const a=r[r.length-1];return a&&a.type==="text"?a.value+=i:r.push({type:"text",value:i}),r}function y9(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return uI(e,t);const r={src:Gl(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(r.title=i.title);const o={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,o),e.applyData(t,o)}function x9(e,t){const n={src:Gl(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,i),e.applyData(t,i)}function v9(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const i={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,i),e.applyData(t,i)}function b9(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return uI(e,t);const r={href:Gl(i.url||"")};i.title!==null&&i.title!==void 0&&(r.title=i.title);const o={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function _9(e,t){const n={href:Gl(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function k9(e,t,n){const i=e.all(t),r=n?S9(n):dI(t),o={},a=[];if(typeof t.checked=="boolean"){const h=i[0];let p;h&&h.type==="element"&&h.tagName==="p"?p=h:(p={type:"element",tagName:"p",properties:{},children:[]},i.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let c=-1;for(;++c<i.length;){const h=i[c];(r||c!==0||h.type!=="element"||h.tagName!=="p")&&a.push({type:"text",value:`
`}),h.type==="element"&&h.tagName==="p"&&!r?a.push(...h.children):a.push(h)}const d=i[i.length-1];d&&(r||d.type!=="element"||d.tagName!=="p")&&a.push({type:"text",value:`
`});const m={type:"element",tagName:"li",properties:o,children:a};return e.patch(t,m),e.applyData(t,m)}function S9(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let i=-1;for(;!t&&++i<n.length;)t=dI(n[i])}return t}function dI(e){const t=e.spread;return t??e.children.length>1}function w9(e,t){const n={},i=e.all(t);let r=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++r<i.length;){const a=i[r];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function C9(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function j9(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function E9(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function N9(e,t){const n=e.all(t),i=n.shift(),r=[];if(i){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(t.children[0],a),r.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},c=v0(t.children[1]),d=UN(t.children[t.children.length-1]);c&&d&&(a.position={start:c,end:d}),r.push(a)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function I9(e,t,n){const i=n?n.children:void 0,o=(i?i.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,c=a?a.length:t.children.length;let d=-1;const m=[];for(;++d<c;){const p=t.children[d],g={},x=a?a[d]:void 0;x&&(g.align=x);let v={type:"element",tagName:o,properties:g,children:[]};p&&(v.children=e.all(p),e.patch(p,v),v=e.applyData(p,v)),m.push(v)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,h),e.applyData(t,h)}function T9(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Mw=9,Dw=32;function R9(e){const t=String(e),n=/\r?\n|\r/g;let i=n.exec(t),r=0;const o=[];for(;i;)o.push(Ow(t.slice(r,i.index),r>0,!0),i[0]),r=i.index+i[0].length,i=n.exec(t);return o.push(Ow(t.slice(r),r>0,!1)),o.join("")}function Ow(e,t,n){let i=0,r=e.length;if(t){let o=e.codePointAt(i);for(;o===Mw||o===Dw;)i++,o=e.codePointAt(i)}if(n){let o=e.codePointAt(r-1);for(;o===Mw||o===Dw;)r--,o=e.codePointAt(r-1)}return r>i?e.slice(i,r):""}function A9(e,t){const n={type:"text",value:R9(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function M9(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const D9={blockquote:c9,break:u9,code:d9,delete:f9,emphasis:m9,footnoteReference:p9,heading:h9,html:g9,imageReference:y9,image:x9,inlineCode:v9,linkReference:b9,link:_9,listItem:k9,list:w9,paragraph:C9,root:j9,strong:E9,table:N9,tableCell:T9,tableRow:I9,text:A9,thematicBreak:M9,toml:cf,yaml:cf,definition:cf,footnoteDefinition:cf};function cf(){}const fI=-1,Ym=0,fu=1,um=2,j0=3,E0=4,N0=5,I0=6,mI=7,pI=8,Lw=typeof self=="object"?self:globalThis,O9=(e,t)=>{const n=(r,o)=>(e.set(o,r),r),i=r=>{if(e.has(r))return e.get(r);const[o,a]=t[r];switch(o){case Ym:case fI:return n(a,r);case fu:{const c=n([],r);for(const d of a)c.push(i(d));return c}case um:{const c=n({},r);for(const[d,m]of a)c[i(d)]=i(m);return c}case j0:return n(new Date(a),r);case E0:{const{source:c,flags:d}=a;return n(new RegExp(c,d),r)}case N0:{const c=n(new Map,r);for(const[d,m]of a)c.set(i(d),i(m));return c}case I0:{const c=n(new Set,r);for(const d of a)c.add(i(d));return c}case mI:{const{name:c,message:d}=a;return n(new Lw[c](d),r)}case pI:return n(BigInt(a),r);case"BigInt":return n(Object(BigInt(a)),r);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:c}=new Uint8Array(a);return n(new DataView(c),a)}}return n(new Lw[o](a),r)};return i},zw=e=>O9(new Map,e)(0),el="",{toString:L9}={},{keys:z9}=Object,Wc=e=>{const t=typeof e;if(t!=="object"||!e)return[Ym,t];const n=L9.call(e).slice(8,-1);switch(n){case"Array":return[fu,el];case"Object":return[um,el];case"Date":return[j0,el];case"RegExp":return[E0,el];case"Map":return[N0,el];case"Set":return[I0,el];case"DataView":return[fu,n]}return n.includes("Array")?[fu,n]:n.includes("Error")?[mI,n]:[um,n]},uf=([e,t])=>e===Ym&&(t==="function"||t==="symbol"),P9=(e,t,n,i)=>{const r=(a,c)=>{const d=i.push(a)-1;return n.set(c,d),d},o=a=>{if(n.has(a))return n.get(a);let[c,d]=Wc(a);switch(c){case Ym:{let h=a;switch(d){case"bigint":c=pI,h=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);h=null;break;case"undefined":return r([fI],a)}return r([c,h],a)}case fu:{if(d){let g=a;return d==="DataView"?g=new Uint8Array(a.buffer):d==="ArrayBuffer"&&(g=new Uint8Array( Line truncated
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:`
`}]}}const Xm=(function(e){if(e==null)return G9;if(typeof e=="function")return Km(e);if(typeof e=="object")return Array.isArray(e)?F9(e):V9(e);if(typeof e=="string")return U9(e);throw new Error("Expected function, string, or object as test")});function F9(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Xm(e[n]);return Km(i);function i(...r){let o=-1;for(;++o<t.length;)if(t[o].apply(this,r))return!0;return!1}}function V9(e){const t=e;return Km(n);function n(i){const r=i;let o;for(o in e)if(r[o]!==t[o])return!1;return!0}}function U9(e){return Km(t);function t(n){return n&&n.type===e}}function Km(e){return t;function t(n,i,r){return!!(q9(n)&&e.call(this,n,typeof i=="number"?i:void 0,r||void 0))}}function G9(){return!0}function q9(e){return e!==null&&typeof e=="object"&&"type"in e}const hI=[],W9=!0,av=!1,Y9="skip";function gI(e,t,n,i){let r;typeof t=="function"&&typeof n!="function"?(i=n,n=t):r=t;const o=Xm(r),a=i?-1:1;c(e,void 0,[])();function c(d,m,h){const p=d&&typeof d=="object"?d:{};if(typeof p.type=="string"){const x=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(d.type+(x?"<"+x+">":""))+")"})}return g;function g(){let x=hI,v,b,w;if((!t||o(d,m,h[h.length-1]||void 0))&&(x=X9(n(d,h)),x[0]===av))return x;if("children"in d&&d.children){const k=d;if(k.children&&x[0]!==Y9)for(b=(i?k.children.length:-1)+a,w=h.concat(k);b>-1&&b<k.children.length;){const S=k.children[b];if(v=c(S,b,w)(),v[0]===av)return v;b=typeof v[1]=="number"?v[1]:b+a}}return x}}}function X9(e){return Array.isArray(e)?e:typeof e=="number"?[W9,e]:e==null?hI:[e]}function T0(e,t,n,i){let r,o,a;typeof t=="function"&&typeof n!="function"?(o=void 0,a=t,r=n):(o=t,a=n,r=i),gI(e,o,c,r);function c(d,m){const h=m[m.length-1],p=h?h.children.indexOf(d):void 0;return a(d,p,h)}}const lv={}.hasOwnProperty,K9={};function Z9(e,t){const n=t||K9,i=new Map,r=new Map,o=new Map,a={...D9,...n.handlers},c={all:m,applyData:J9,definitionById:i,footnoteById:r,footnoteCounts:o,footnoteOrder:[],handlers:a,one:d,options:n,patch:Q9,wrap:t$};return T0(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const p=h.type==="definition"?i:r,g=String(h.identifier).toUpperCase();p.has(g)||p.set(g,h)}}),c;function d(h,p){const g=h.type,x=c.handlers[g];if(lv.call(c.handlers,g)&&x)return x(c,h,p);if(c.options.passThrough&&c.options.passThrough.includes(g)){if("children"in h){const{children:b,...w}=h,k=dm(w);return k.children=c.all(h),k}return dm(h)}return(c.options.unknownHandler||e$)(c,h,p)}function m(h){const p=[];if("children"in h){const g=h.children;let x=-1;for(;++x<g.length;){const v=c.one(g[x],h);if(v){if(x&&g[x-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=Bw(v.value)),!Array.isArray(v)&&v.type==="element")){const b=v.children[0];b&&b.type==="text"&&(b.value=Bw(b.value))}Array.isArray(v)?p.push(...v):p.push(v)}}}return p}}function Q9(e,t){e.position&&(t.position=$8(e))}function J9(e,t){let n=t;if(e&&e.data){const i=e.data.hName,r=e.data.hChildren,o=e.data.hProperties;if(typeof i=="string")if(n.type==="element")n.tagName=i;else{const a="children"in n?n.children:[n];n={type:"element",tagName:i,properties:{},children:a}}n.type==="element"&&o&&Object.assign(n.properties,dm(o)),"children"in n&&n.children&&r!==null&&r!==void 0&&(n.children=r)}return n}function e$(e,t){const n=t.data||{},i="value"in t&&!(lv.call(n,"hProperties")||lv.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function t$(e,t){const n=[];let i=-1;for(t&&n.push({type:"text",value:`
`});++i<e.length;)i&&n.push({type:"text",value:`
`}),n.push(e[i]);return t&&e.length>0&&n.push({type:"text",value:`
`}),n}function Bw(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function $w(e,t){const n=Z9(e,t),i=n.one(e,void 0),r=H9(n),o=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return r&&o.children.push({type:"text",value:`
`},r),o}function n$(e,t){return e&&"run"in e?async function(n,i){const r=$w(n,{file:i,...t});await e.run(r,i)}:function(n,i){return $w(n,{file:i,...e||t})}}function Hw(e){if(e)throw e}var Xg,Fw;function i$(){if(Fw)return Xg;Fw=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,r=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},o=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var h=e.call(m,"constructor"),p=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!h&&!p)return!1;var g;for(g in m);return typeof g>"u"||e.call(m,g)},a=function(m,h){n&&h.name==="__proto__"?n(m,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):m[h.name]=h.newValue},c=function(m,h){if(h==="__proto__")if(e.call(m,h)){if(i)return i(m,h).value}else return;return m[h]};return Xg=function d(){var m,h,p,g,x,v,b=arguments[0],w=1,k=arguments.length,S=!1;for(typeof b=="boolean"&&(S=b,b=arguments[1]||{},w=2),(b==null||typeof b!="object"&&typeof b!="function")&&(b={});w<k;++w)if(m=arguments[w],m!=null)for(h in m)p=c(b,h),g=c(m,h),b!==g&&(S&&g&&(o(g)||(x=r(g)))?(x?(x=!1,v=p&&r(p)?p:[]):v=p&&o(p)?p:{},a(b,{name:h,newValue:d(S,v,g)})):typeof g<"u"&&a(b,{name:h,newValue:g}));return b},Xg}var r$=i$();const Kg=pa(r$);function cv(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function s$(){const e=[],t={run:n,use:i};return t;function n(...r){let o=-1;const a=r.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);c(null,...r);function c(d,...m){const h=e[++o];let p=-1;if(d){a(d);return}for(;++p<r.length;)(m[p]===null||m[p]===void 0)&&(m[p]=r[p]);r=m,h?o$(h,c)(...m):a(null,...m)}}function i(r){if(typeof r!="function")throw new TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}}function o$(e,t){let n;return i;function i(...a){const c=e.length>a.length;let d;c&&a.push(r);try{d=e.apply(this,a)}catch(m){const h=m;if(c&&n)throw h;return r(h)}c||(d&&d.then&&typeof d.then=="function"?d.then(o,r):d instanceof Error?r(d):o(d))}function r(a,...c){n||(n=!0,t(a,...c))}function o(a){r(null,a)}}const Jr={basename:a$,dirname:l$,extname:c$,join:u$,sep:"/"};function a$(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Vu(e);let n=0,i=-1,r=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;r--;)if(e.codePointAt(r)===47){if(o){n=r+1;break}}else i<0&&(o=!0,i=r+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let a=-1,c=t.length-1;for(;r--;)if(e.codePointAt(r)===47){if(o){n=r+1;break}}else a<0&&(o=!0,a=r+1),c>-1&&(e.codePointAt(r)===t.codePointAt(c--)?c<0&&(i=r):(c=-1,i=a));return n===i?i=a:i<0&&(i=e.length),e.slice(n,i)}function l$(e){if(Vu(e),e.length===0)return".";let t=-1,n=e.length,i;for(;--n;)if(e.codePointAt(n)===47){if(i){t=n;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function c$(e){Vu(e);let t=e.length,n=-1,i=0,r=-1,o=0,a;for(;t--;){const c=e.codePointAt(t);if(c===47){if(a){i=t+1;break}continue}n<0&&(a=!0,n=t+1),c===46?r<0?r=t:o!==1&&(o=1):r>-1&&(o=-1)}return r<0||n<0||o===0||o===1&&r===n-1&&r===i+1?"":e.slice(r,n)}function u$(...e){let t=-1,n;for(;++t<e.length;)Vu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":d$(n)}function d$(e){Vu(e);const t=e.codePointAt(0)===47;let n=f$(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function f$(e,t){let n="",i=0,r=-1,o=0,a=-1,c,d;for(;++a<=e.length;){if(a<e.length)c=e.codePointAt(a);else{if(c===47)break;c=47}if(c===47){if(!(r===a-1||o===1))if(r!==a-1&&o===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",i=0):(n=n.slice(0,d),i=n.length-1-n.lastIndexOf("/")),r=a,o=0;continue}}else if(n.length>0){n="",i=0,r=a,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(r+1,a):n=e.slice(r+1,a),i=a-r-1;r=a,o=0}else c===46&&o>-1?o++:o=-1}return n}function Vu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const m$={cwd:p$};function p$(){return"/"}function uv(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function h$(e){if(typeof e=="string")e=new URL(e);else if(!uv(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return g$(e)}function g$(e){if(e.hostname!==""){consLine truncated
`:" ")+o.indentLines(o.containerFlow(i,c.current()),t?bI:o7))),m(),d}}function o7(e,t,n){return t===0?e:bI(e,t,n)}function bI(e,t,n){return(n?"":" ")+e}const a7=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];_I.peek=f7;function l7(){return{canContainEols:["delete"],enter:{strikethrough:u7},exit:{strikethrough:d7}}}function c7(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:a7}],handlers:{delete:_I}}}function u7(e){this.enter({type:"delete",children:[]},e)}function d7(e){this.exit(e)}function _I(e,t,n,i){const r=n.createTracker(i),o=n.enter("strikethrough");let a=r.move("~~");return a+=n.containerPhrasing(e,{...r.current(),before:a,after:"~"}),a+=r.move("~~"),o(),a}function f7(){return"~"}function m7(e){return e.length}function p7(e,t){const n=t||{},i=(n.align||[]).concat(),r=n.stringLength||m7,o=[],a=[],c=[],d=[];let m=0,h=-1;for(;++h<e.length;){const b=[],w=[];let k=-1;for(e[h].length>m&&(m=e[h].length);++k<e[h].length;){const S=h7(e[h][k]);if(n.alignDelimiters!==!1){const j=r(S);w[k]=j,(d[k]===void 0||j>d[k])&&(d[k]=j)}b.push(S)}a[h]=b,c[h]=w}let p=-1;if(typeof i=="object"&&"length"in i)for(;++p<m;)o[p]=Xw(i[p]);else{const b=Xw(i);for(;++p<m;)o[p]=b}p=-1;const g=[],x=[];for(;++p<m;){const b=o[p];let w="",k="";b===99?(w=":",k=":"):b===108?w=":":b===114&&(k=":");let S=n.alignDelimiters===!1?1:Math.max(1,d[p]-w.length-k.length);const j=w+"-".repeat(S)+k;n.alignDelimiters!==!1&&(S=w.length+S+k.length,S>d[p]&&(d[p]=S),x[p]=S),g[p]=j}a.splice(1,0,g),c.splice(1,0,x),h=-1;const v=[];for(;++h<a.length;){const b=a[h],w=c[h];p=-1;const k=[];for(;++p<m;){const S=b[p]||"";let j="",N="";if(n.alignDelimiters!==!1){const L=d[p]-(w[p]||0),A=o[p];A===114?j=" ".repeat(L):A===99?L%2?(j=" ".repeat(L/2+.5),N=" ".repeat(L/2-.5)):(j=" ".repeat(L/2),N=j):N=" ".repeat(L)}n.delimiterStart!==!1&&!p&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&S==="")&&(n.delimiterStart!==!1||p)&&k.push(" "),n.alignDelimiters!==!1&&k.push(j),k.push(S),n.alignDelimiters!==!1&&k.push(N),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||p!==m-1)&&k.push("|")}v.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return v.join(`
`)}function h7(e){return e==null?"":String(e)}function Xw(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function g7(e,t,n,i){const r=n.enter("blockquote"),o=n.createTracker(i);o.move("> "),o.shift(2);const a=n.indentLines(n.containerFlow(e,o.current()),y7);return r(),a}function y7(e,t,n){return">"+(n?"":" ")+e}function x7(e,t){return Kw(e,t.inConstruct,!0)&&!Kw(e,t.notInConstruct,!1)}function Kw(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let i=-1;for(;++i<t.length;)if(e.includes(t[i]))return!0;return!1}function Zw(e,t,n,i){let r=-1;for(;++r<n.unsafe.length;)if(n.unsafe[r].character===`
`&&x7(n.stack,n.unsafe[r]))return/[ \t]/.test(i.before)?"":" ";return`\\
`}function v7(e,t){const n=String(e);let i=n.indexOf(t),r=i,o=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===r?++o>a&&(a=o):o=1,r=i+t.length,i=n.indexOf(t,r);return a}function b7(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function _7(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function k7(e,t,n,i){const r=_7(n),o=e.value||"",a=r==="`"?"GraveAccent":"Tilde";if(b7(e,n)){const p=n.enter("codeIndented"),g=n.indentLines(o,S7);return p(),g}const c=n.createTracker(i),d=r.repeat(Math.max(v7(o,r)+1,3)),m=n.enter("codeFenced");let h=c.move(d);if(e.lang){const p=n.enter(`codeFencedLang${a}`);h+=c.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...c.current()})),p()}if(e.lang&&e.meta){const p=n.enter(`codeFencedMeta${a}`);h+=c.move(" "),h+=c.move(n.safe(e.meta,{before:h,after:`
`,encode:["`"],...c.current()})),p()}return h+=c.move(`
`),o&&(h+=c.move(o+`
`)),h+=c.move(d),m(),h}function S7(e,t,n){return(n?"":" ")+e}function A0(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function w7(e,t,n,i){const r=A0(n),o=r==='"'?"Quote":"Apostrophe",a=n.enter("definition");let c=n.enter("label");const d=n.createTracker(i);let m=d.move("[");return m+=d.move(n.safe(n.associationId(e),{before:m,after:"]",...d.current()})),m+=d.move("]: "),c(),!e.url||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(n.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(c=n.enter("destinationRaw"),m+=d.move(n.safe(e.url,{before:m,after:e.title?" ":`
`,...d.current()}))),c(),e.title&&(c=n.enter(`title${o}`),m+=d.move(" "+r),m+=d.move(n.safe(e.title,{before:m,after:r,...d.current()})),m+=d.move(r),c()),a(),m}function C7(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Nu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function fm(e,t,n){const i=Nl(e),r=Nl(t);return i===void 0?r===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}kI.peek=j7;function kI(e,t,n,i){const r=C7(n),o=n.enter("emphasis"),a=n.createTracker(i),c=a.move(r);let d=a.move(n.containerPhrasing(e,{after:r,before:c,...a.current()}));const m=d.charCodeAt(0),h=fm(i.before.charCodeAt(i.before.length-1),m,r);h.inside&&(d=Nu(m)+d.slice(1));const p=d.charCodeAt(d.length-1),g=fm(i.after.charCodeAt(0),p,r);g.inside&&(d=d.slice(0,-1)+Nu(p));const x=a.move(r);return o(),n.attentionEncodeSurroundingInfo={after:g.outside,before:h.outside},c+d+x}function j7(e,t,n){return n.options.emphasis||"*"}function E7(e,t){let n=!1;return T0(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,av}),!!((!e.depth||e.depth<3)&&S0(e)&&(t.options.setext||n))}function N7(e,t,n,i){const r=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(i);if(E7(e,n)){const h=n.enter("headingSetext"),p=n.enter("phrasing"),g=n.containerPhrasing(e,{...o.current(),before:`
`,after:`
`});return p(),h(),g+`
`+(r===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(`
`))+1))}const a="#".repeat(r),c=n.enter("headingAtx"),d=n.enter("phrasing");o.move(a+" ");let m=n.containerPhrasing(e,{before:"# ",after:`
`,...o.current()});return/^[\t ]/.test(m)&&(m=Nu(m.charCodeAt(0))+m.slice(1)),m=m?a+" "+m:a,n.options.closeAtx&&(m+=" "+a),d(),c(),m}SI.peek=I7;function SI(e){return e.value||""}function I7(){return"<"}wI.peek=T7;function wI(e,t,n,i){const r=A0(n),o=r==='"'?"Quote":"Apostrophe",a=n.enter("image");let c=n.enter("label");const d=n.createTracker(i);let m=d.move("![");return m+=d.move(n.safe(e.alt,{before:m,after:"]",...d.current()})),m+=d.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(n.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(c=n.enter("destinationRaw"),m+=d.move(n.safe(e.url,{before:m,after:e.title?" ":")",...d.current()}))),c(),e.title&&(c=n.enter(`title${o}`),m+=d.move(" "+r),m+=d.move(n.safe(e.title,{before:m,after:r,...d.current()})),m+=d.move(r),c()),m+=d.move(")"),a(),m}function T7(){return"!"}CI.peek=R7;function CI(e,t,n,i){const r=e.referenceType,o=n.enter("imageReference");let a=n.enter("label");const c=n.createTracker(i);let d=c.move("![");const m=n.safe(e.alt,{before:d,after:"]",...c.current()});d+=c.move(m+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const p=n.safe(n.associationId(e),{before:d,after:"]",...c.current()});return a(),n.stack=h,o(),r==="full"||!m||m!==p?d+=c.move(p+"]"):r==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function R7(){return"!"}jI.peek=A7;function jI(e,t,n){let i=e.value||"",r="`",o=-1;for(;new RegExp("(^|[^`])"+r+"([^`]|$)").test(i);)r+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++o<n.unsafe.length;){const a=n.unsafe[o],c=n.compilePattern(a);let d;if(a.atBreak)for(;d=c.exec(i);){let m=d.index;i.charCodeAt(m)===10&&i.charCodeAt(m-1)===13&&m--,i=i.slice(0,m)+" "+i.slice(d.index+1)}}return r+i+r}function A7(){return"`"}function EI(e,t){const n=S0(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}NI.peek=M7;function NI(e,t,n,i){const r=A0(n),o=r==='"'?"Quote":"Apostrophe",a=n.createTracker(i);let c,d;if(EI(e,n)){const h=n.stack;n.stack=[],c=n.enter("autolink");let p=a.move("<");return p+=a.move(n.containerPhrasing(e,{before:p,after:">",...a.current()})),p+=a.move(">"),c(),n.stack=h,p}c=n.enter("link"),d=n.enter("label");let m=a.move("[");return m+=a.move(n.containerPhrasing(e,{before:m,after:"](",...a.current()})),m+=a.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),m+=a.move("<"),m+=a.move(n.safe(e.url,{before:m,after:">",...a.current()})),m+=a.move(">")):(d=n.enter("destinationRaw"),m+=a.move(n.safe(e.url,{before:m,after:e.title?" ":")",...a.current()}))),d(),e.title&&(d=n.enter(`title${o}`),m+=a.move(" "+r),m+=a.move(n.safe(e.title,{before:m,after:r,...a.current()})),m+=a.move(r),d()),m+=a.move(")"),c(),m}function M7(e,t,n){return EI(e,n)?"<":"["}II.peek=D7;function II(e,t,n,i){const r=e.referenceType,o=n.enter("linkReference");let a=n.enter("label");const c=n.createTracker(i);let d=c.move("[");const m=n.containerPhrasing(e,{before:d,after:"]",...c.current()});d+=c.move(m+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const p=n.safe(n.associationId(e),{before:d,after:"]",...c.current()});return a(),n.stack=h,o(),r==="full"||!m||m!==p?d+=c.move(p+"]"):r==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function D7(){return"["}function M0(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function O7(e){const t=M0(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function L7(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function TI(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function z7(e,t,n,i){const r=n.enter("list"),o=n.bulletCurrent;let a=e.ordered?L7(n):M0(n);const c=e.ordered?a==="."?")":".":O7(n);let d=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(d=!0),TI(n)===a&&h){let p=-1;for(;++p<e.chilLine truncated
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:a,tableCell:d,tableRow:c}};function a(x,v,b,w){return m(h(x,b,w),x.align)}function c(x,v,b,w){const k=p(x,b,w),S=m([k]);return S.slice(0,S.indexOf(`
`))}function d(x,v,b,w){const k=b.enter("tableCell"),S=b.enter("phrasing"),j=b.containerPhrasing(x,{...w,before:o,after:o});return S(),k(),j}function m(x,v){return p7(x,{align:v,alignDelimiters:i,padding:n,stringLength:r})}function h(x,v,b){const w=x.children;let k=-1;const S=[],j=v.enter("table");for(;++k<w.length;)S[k]=p(w[k],v,b);return j(),S}function p(x,v,b){const w=x.children;let k=-1;const S=[],j=v.enter("tableRow");for(;++k<w.length;)S[k]=d(w[k],x,v,b);return j(),S}function g(x,v,b){let w=AI.inlineCode(x,v,b);return b.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function tH(){return{exit:{taskListCheckValueChecked:Jw,taskListCheckValueUnchecked:Jw,paragraph:iH}}}function nH(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:rH}}}function Jw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function iH(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const i=n.children[0];if(i&&i.type==="text"){const r=t.children;let o=-1,a;for(;++o<r.length;){const c=r[o];if(c.type==="paragraph"){a=c;break}}a===n&&(i.value=i.value.slice(1),i.value.length===0?n.children.shift():n.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,n.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function rH(e,t,n,i){const r=e.children[0],o=typeof e.checked=="boolean"&&r&&r.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",c=n.createTracker(i);o&&c.move(a);let d=AI.listItem(e,t,n,{...i,...c.current()});return o&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),d;function m(h){return h+a}}function sH(){return[z$(),r7(),l7(),Y7(),tH()]}function oH(e){return{extensions:[P$(),s7(e),c7(),eH(e),nH()]}}const aH={tokenize:mH,partial:!0},MI={tokenize:pH,partial:!0},DI={tokenize:hH,partial:!0},OI={tokenize:gH,partial:!0},lH={tokenize:yH,partial:!0},LI={name:"wwwAutolink",tokenize:dH,previous:PI},zI={name:"protocolAutolink",tokenize:fH,previous:BI},Os={name:"emailAutolink",tokenize:uH,previous:$I},ls={};function cH(){return{text:ls}}let Zo=48;for(;Zo<123;)ls[Zo]=Os,Zo++,Zo===58?Zo=65:Zo===91&&(Zo=97);ls[43]=Os;ls[45]=Os;ls[46]=Os;ls[95]=Os;ls[72]=[Os,zI];ls[104]=[Os,zI];ls[87]=[Os,LI];ls[119]=[Os,LI];function uH(e,t,n){const i=this;let r,o;return a;function a(p){return!dv(p)||!$I.call(i,i.previous)||D0(i.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(p))}function c(p){return dv(p)?(e.consume(p),c):p===64?(e.consume(p),d):n(p)}function d(p){return p===46?e.check(lH,h,m)(p):p===45||p===95||Oi(p)?(o=!0,e.consume(p),d):h(p)}function m(p){return e.consume(p),r=!0,d}function h(p){return o&&r&&Hi(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function dH(e,t,n){const i=this;return r;function r(a){return a!==87&&a!==119||!PI.call(i,i.previous)||D0(i.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(aH,e.attempt(MI,e.attempt(DI,o),n),n)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function fH(e,t,n){const i=this;let r="",o=!1;return a;function a(p){return(p===72||p===104)&&BI.call(i,i.previous)&&!D0(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),r+=String.fromCodePoint(p),e.consume(p),c):n(p)}function c(p){if(Hi(p)&&r.length<5)return r+=String.fromCodePoint(p),e.consume(p),c;if(p===58){const g=r.toLowerCase();if(g==="http"||g==="https")return e.consume(p),d}return n(p)}function d(p){return p===47?(e.consume(p),o?m:(o=!0,d)):n(p)}function m(p){return p===null||cm(p)||En(p)||ca(p)||qm(p)?n(p):e.attempt(MI,e.attempt(DI,h),n)(p)}function h(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function mH(e,t,n){let i=0;return r;function r(a){return(a===87||a===119)&&i<3?(i++,e.consume(a),r):a===46&&i===3?(e.consume(a),o):n(a)}function o(a){return a===null?n(a):t(a)}}function pH(e,t,n){let i,r,o;return a;function a(m){return m===46||m===95?e.check(OI,d,c)(m):m===null||En(m)||ca(m)||m!==45&&qm(m)?d(m):(o=!0,e.consume(m),a)}function c(m){return m===95?i=!0:(r=i,i=void 0),e.consume(m),a}function d(m){return r||i||!o?n(m):t(m)}}function hH(e,t){let n=0,i=0;return r;function r(a){return a===40?(n++,e.consume(a),r):a===41&&i<n?o(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(OI,t,o)(a):a===null||En(a)||ca(a)?t(a):(e.consume(a),r)}function o(a){return a===41&&i++,e.consume(a),r}}function gH(e,t,n){return i;function i(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),i):c===38?(e.consume(c),o):c===93?(e.consume(c),r):c===60||c===null||En(c)||ca(c)?t(c):n(c)}function r(c){return c===null||c===40||c===91||En(c)||ca(c)?t(c):i(c)}function o(c){return Hi(c)?a(c):n(c)}function a(c){re Line truncated
`),m=d.length>HH,h=m?d.length-ay*2:0,p=C.useCallback(()=>{navigator.clipboard.writeText(a),i(!0),setTimeout(()=>i(!1),1500)},[a]);return u.jsxs("div",{className:"code-block-wrap",children:[u.jsxs("div",{className:"code-block-header",children:[u.jsxs("span",{className:"code-block-lang",children:[c||"code",m?` (${d.length} lines)`:""]}),u.jsx("button",{className:"code-block-copy",onClick:p,children:n?u.jsxs(u.Fragment,{children:[u.jsx($l,{})," ",u.jsx("span",{children:"Copied"})]}):u.jsxs(u.Fragment,{children:[u.jsx(Am,{})," ",u.jsx("span",{children:"Copy"})]})})]}),u.jsx("pre",{children:u.jsx("code",{className:e,children:m&&!r?u.jsxs(u.Fragment,{children:[d.slice(0,ay).join(`
`)+`
`,u.jsxs("span",{className:"code-block-omitted",onClick:()=>o(!0),children:["... +",h," lines (click to expand)"]}),`
`+d.slice(-ay).join(`
`)]}):a})}),m&&r&&u.jsxs("button",{className:"code-block-collapse-btn",onClick:()=>o(!1),children:["Collapse (",d.length," lines)"]})]})}const VH={code({className:e,children:t,...n}){return e?.startsWith("language-")?u.jsx(FH,{className:e,children:t}):u.jsx("code",{className:e,...n,children:t})}},UH=3e3,GH=60,ly=800;function tC(e){if(e.length>UH)return!0;let t=0;for(let n=0;n<e.length;n++)if(e[n]===`
`&&++t>=GH)return!0;return!1}function qH(e){const t=e.lastIndexOf(`
`,ly);return e.slice(0,t>ly/2?t:ly)}const bi=Et.memo(function({content:t,className:n="msg-content-agent",collapseMode:i="auto"}){const r=i!=="never"&&tC(t),[o,a]=C.useState(r);C.useEffect(()=>{a(i!=="never"&&tC(t))},[i,t]);const c=o?qH(t):t,d=t.split(`
`).length,m=t.length;return u.jsxs("div",{className:n,children:[u.jsx(E$,{remarkPlugins:[$H],components:VH,children:c}),r&&o&&u.jsxs("button",{className:"msg-collapse-toggle",onClick:()=>a(!1),children:["Show more (",d," lines, ",(m/1e3).toFixed(1),"k chars)"]}),r&&!o&&u.jsx("button",{className:"msg-collapse-toggle",onClick:()=>a(!0),children:"Show less"})]})}),nC={native:"OpenOPC Native",codex:"Codex",claude_code:"Claude Code",cursor:"Cursor",opencode:"OpenCode"},Iu="codex",cy="native",WH=["codex","native","claude_code","cursor","opencode"],YH=["native","codex","claude_code","cursor","opencode"];function HI(e){if(!e)return{kind:"fallback"};if(e.kind==="employee"){const t=String(e.id??e.employee_id??"").trim();return t?{kind:"employee",id:t}:{kind:"fallback"}}if(e.kind==="template"){const t=String(e.id??e.template_id??"").trim();return t?{kind:"template",id:t}:{kind:"fallback"}}return{kind:"fallback"}}function FI(e){const t=HI(e);return t.kind==="fallback"?"fallback:":`${t.kind}:${t.id??""}`}function XH(e,t,n){const i=String(e.role_id??"").trim(),r=String(e.role_label??"").trim(),o=`${i} ${r} ${e.role_responsibility??""}`.toLowerCase(),a=new Set((e.same_role_employee_ids??[]).map(m=>String(m??"").trim()).filter(Boolean)),c=t.map(m=>{const h=String(m.employee_id??"").trim(),p=String(m.employee_name??h).trim()||h,g=String(m.role_id??"").trim(),x=String(m.category??"").trim(),v=[g,x].filter(Boolean).join(" · ")||h;return{kind:"employee",id:h,name:p,subtitle:v,category:x,searchText:`${h} ${p} ${g} ${x} ${(m.domains??[]).join(" ")} ${(m.tags??[]).join(" ")}`.toLowerCase(),rank:a.has(h)||g===i?0:2}}).filter(m=>m.id).sort((m,h)=>m.rank-h.rank||m.name.localeCompare(h.name)),d=n.map(m=>{const h=String(m.template_id??"").trim(),p=String(m.template_name??h).trim()||h,g=String(m.category??"").trim(),x=[g,h].filter(Boolean).join(" · ")||h,v=`${h} ${p} ${g} ${(m.domains??[]).join(" ")} ${(m.tags??[]).join(" ")}`.toLowerCase(),b=o.split(/[^a-z0-9]+/).filter(w=>w.length>=3).reduce((w,k)=>w+(v.includes(k)?1:0),0);return{kind:"template",id:h,name:p,subtitle:x,category:g,searchText:v,rank:b}}).filter(m=>m.id).sort((m,h)=>h.rank-m.rank||m.name.localeCompare(h.name));return[...c,...d,{kind:"fallback",id:"",name:"Fallback role-only",subtitle:"No employee override",category:"fallback",searchText:"fallback role only no employee override"}]}function KH(e,t){const n=FI(t);return e.find(i=>`${i.kind}:${i.id}`===n)??e[0]}function ZH(e,t){const n=t.toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?!0:n.every(i=>e.searchText.includes(i))}function QH(e){return e.map(t=>{const n=String(t.role_id??"").trim(),i=String(t.existing_employee?.employee_id??"").trim(),r=String(t.candidate?.template_id??"").trim(),o=i?{kind:"employee",id:i}:r?{kind:"template",id:r}:{kind:"fallback"};return{role_id:n,role_label:t.role_labels?.[0]??n,role_responsibility:"",default_selection:o,same_role_employee_ids:t.existing_employee_ids??[],fallback_available:!0,default_agent:t.default_agent??Iu,selected_agent:t.selected_agent??t.default_agent??Iu,default_source:"recruitment"}}).filter(t=>t.role_id)}function JH(e,t){return t.kind==="template"&&e?.candidate?.template_id===t.id?e.candidate.proposed_name||e.candidate.template_name||t.name:t.kind==="employee"&&e?.existing_employee?.employee_id===t.id&&e.existing_employee.employee_name||t.name}function iC(e,t){const n={},i=e.staffing_selections??{};for(const r of t){const o=String(r.role_id??"").trim();o&&(n[o]=HI(i[o]??r.default_selection))}return n}function rC(e,t){const n=e.recruitment_role_agents??{},i={};for(const r of t){const o=String(r.role_id??"").trim();o&&(i[o]=n[o]??r.selected_agent??r.default_agent??Iu)}return i}function eF(e){return!!(String(e.checkpoint_response_message_id??"").trim()||String(e.checkpoint_responded_at??"").trim()||String(e.checkpoint_reply_kind??"").trim())}const tF=Et.memo(function({meta:t,onReply:n,responded:i}){const r=t.proposals??[],o=C.useMemo(()=>{const T={};for(const M of r){const I=String(M.role_id??"").trim();I&&(T[I]=M)}return T},[r]),a=C.useMemo(()=>t.staffing_roles?.length?t.staffing_roles:QH(r),[t.staffing_roles,r]),c=t.staffing_pool?.employees??[],d=t.staffing_pool?.templates??[],m=t.recruitment_rationales??[],h=C.useMemo(()=>{const T={};for(const M of a){const I=String(M.role_id??"").trim();I&&(T[I]=XH(M,c,d))}return T},[c,a,d]),[p,g]=C.useState({}),[x,v]=C.useState(""),[b,w]=C.useState(()=>iC(t,a)),[k,S]=C.useState(()=>rC(t,a)),[j,N]=C.useState(t.recruitment_agent??cy),L=i;C.useEffect(()=>{!L||!eF(t)||(w(iC(t,a)),S(rC(t,a)),N(t.recruitment_agent??cy))},[L,t,a]),C.useEffect(()=>{N(t.recruitment_agent??cy)},[t.recruitment_agent]);const A=C.useCallback(T=>{const M=String(t.checkpoint_id??"").trim();if(!M)throw new Error("Recruitment checkpoint reply requires checkpoint_id metadata.");const I=String(t.checkpoint_type??"").trim();return{response_to_checkpoint_id:M,response_to_checkpoint_type:I||"company_recruitment_confirmation",checkpoint_reply_kind:T,staffin Line truncated
`).map(t=>t.trim()).find(Boolean)??e}function mF(e){switch(e){case"timeout":case"timed_out":case"expired":return"Expired";case"stale":case"invalid":return"Inactive";case"cancelled":case"canceled":return"Cancelled";case"resolved":return"Resolved";default:return"Responded"}}const cC=Et.memo(function({meta:t,onReply:n,responded:i}){const r=i,o=String(t.checkpoint_status??"").trim().toLowerCase(),a=mF(o),c=String(t.prompt??t.summary??""),d=C.useMemo(()=>c.split(`
`).map(L=>L.trim()).filter(Boolean),[c]),m=fF(c).replace(/^\[[^\]]+\]\s*/,"")||"Action Required",h=d.slice(1).join(`
`).trim(),p=String(t.summary??"").trim(),g=(t.options??[]).filter(L=>!!L?.id),x=C.useMemo(()=>(t.active_subagents??[]).filter(L=>!!L&&typeof L=="object"),[t.active_subagents]),v=C.useMemo(()=>(t.permission_requests??[]).filter(L=>!!L&&typeof L=="object"),[t.permission_requests]),b=String(t.worktree_path??"").trim(),w=x.length>0||v.length>0||!!b,[k,S]=C.useState(""),j=!!k&&!r;C.useEffect(()=>{if(!j)return;const L=window.setTimeout(()=>S(""),dF);return()=>window.clearTimeout(L)},[j,k]);const N=C.useCallback(L=>{r||j||(S(L.id),n(L.label||L.id))},[r,j,n]);return u.jsxs("div",{className:"ckpt-panel ckpt-escalation",children:[u.jsxs("div",{className:"ckpt-header",children:[u.jsx("div",{className:"ckpt-icon ckpt-icon-escalation",children:u.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("path",{d:"M8 1.5L14.5 13H1.5L8 1.5Z"}),u.jsx("path",{d:"M8 5.5V9"}),u.jsx("circle",{cx:"8",cy:"11.5",r:"0.75",fill:"currentColor",stroke:"none"})]})}),u.jsx("div",{className:"ckpt-title",children:m}),u.jsx("span",{className:"ckpt-badge ckpt-badge-scope",children:String(t.escalation_type??"decision_needed").replace(/_/g," ")}),r&&u.jsx("span",{className:"ckpt-badge ckpt-badge-responded",children:a})]}),p&&p!==m&&u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Summary"}),u.jsx(bi,{content:p,className:"ckpt-markdown"})]}),h&&u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Request"}),u.jsx(bi,{content:h,className:"ckpt-markdown"})]}),w&&u.jsxs("details",{className:"ckpt-runtime-details",children:[u.jsx("summary",{children:"Runtime State"}),u.jsxs("div",{className:"ckpt-runtime-body",children:[b&&u.jsxs("div",{children:["Worktree: ",u.jsx("code",{children:b})]}),x.length>0&&u.jsxs("div",{children:["Active subagents: ",x.length]}),v.length>0&&u.jsxs("div",{children:["Pending permission records: ",v.length]})]})]}),!r&&g.length>0&&u.jsx("div",{className:"ckpt-actions ckpt-escalation-actions",children:g.map(L=>u.jsx("button",{className:`ckpt-btn ${L.id.includes("deny")?"ckpt-btn-deny":"ckpt-btn-approve"}${j?" ckpt-btn-submitting":""}`,onClick:()=>N(L),disabled:j,children:j&&k===L.id?"Submitting…":L.label||L.id},L.id))}),j&&u.jsx("div",{className:"ckpt-escalation-hint",children:"Decision sent — waiting for server confirmation…"}),!r&&t.default_action&&u.jsxs("div",{className:"ckpt-escalation-hint",children:["Default on timeout: ",u.jsx("code",{children:t.default_action})]})]})});function pF(e){return e.split(`
`).map(t=>t.trim()).find(Boolean)??e}function hF(e){switch(e){case"ignored":return"Ignored";case"timeout":case"timed_out":case"expired":return"Expired";case"stale":case"invalid":return"Inactive";case"superseded":return"Superseded";case"cancelled":case"canceled":return"Cancelled";case"resolved":return"Resolved";default:return"Responded"}}const gF=Et.memo(function({meta:t,onReply:n,responded:i}){const r=i,[o,a]=C.useState(""),[c,d]=C.useState(null),m=String(t.checkpoint_status??"").trim().toLowerCase(),h=hF(m),p=String(t.prompt??t.summary??"").trim(),x=`${String(t.work_item_projection_title??pF(p)??"Human Review").trim()||"Human Review"} (for self-evolution)`,v=String(t.summary??"").trim(),b=C.useMemo(()=>(t.active_subagents??[]).filter(O=>!!O&&typeof O=="object"),[t.active_subagents]),w=C.useMemo(()=>(t.permission_requests??[]).filter(O=>!!O&&typeof O=="object"),[t.permission_requests]),k=String(t.worktree_path??"").trim(),S=b.length>0||w.length>0||!!k,j=r||c!==null,N=C.useCallback((O,T="")=>{const M=String(t.checkpoint_id??"").trim();if(!M)throw new Error("Delivery self-evolution reply requires checkpoint_id metadata.");const I={response_to_checkpoint_id:M,response_to_checkpoint_type:"company_delivery_feedback",checkpoint_reply_kind:O};return(O==="approve"||O==="feedback")&&(I.self_evolution_trigger=!0,I.human_feedback_text=T),I},[t.checkpoint_id]),L=C.useCallback(()=>{if(j)return;const O=N("approve");d("approve"),n("I fully agree with this delivery.",O)},[j,N,n]),A=C.useCallback(()=>{const O=o.trim();if(j||!O)return;const T=N("feedback",O);d("feedback"),n(O,T),a("")},[j,N,o,n]),D=C.useCallback(()=>{if(j)return;const O=N("ignore");d("ignore"),n("Ignore this self-evolution review.",O)},[j,N,n]);return u.jsxs("div",{className:"ckpt-panel ckpt-delivery-feedback",children:[u.jsxs("div",{className:"ckpt-header",children:[u.jsx("div",{className:"ckpt-icon ckpt-icon-user-input",children:u.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("path",{d:"M8 1.5L14 5v4.5c0 2.25-1.8 4.25-6 5-4.2-.75-6-2.75-6-5V5L8 1.5Z"}),u.jsx("path",{d:"M5.5 8.25L7.25 10l3.25-4"})]})}),u.jsx("div",{className:"ckpt-title",children:x}),u.jsx("span",{className:"ckpt-badge ckpt-badge-scope",children:String(t.feedback_scope??"final").replace(/_/g," ")}),r&&u.jsx("span",{className:"ckpt-badge ckpt-badge-responded",children:h})]}),v&&v!==x&&u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Summary"}),u.jsx(bi,{content:v,className:"ckpt-markdown"})]}),p&&u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Review Request"}),u.jsx(bi,{content:p,className:"ckpt-markdown"})]}),S&&u.jsxs("details",{className:"ckpt-runtime-details",children:[u.jsx("summary",{children:"Runtime State"}),u.jsxs("div",{className:"ckpt-runtime-body",children:[k&&u.jsxs("div",{children:["Worktree: ",u.jsx("code",{children:k})]}),b.length>0&&u.jsxs("div",{children:["Active subagents: ",b.length]}),w.length>0&&u.jsxs("div",{children:["Pending permission records: ",w.length]})]})]}),!r&&u.jsxs("div",{className:"ckpt-actions ckpt-actions-inline-feedback",children:[u.jsx("button",{className:"ckpt-btn ckpt-btn-approve",onClick:L,disabled:j,children:"Fully Agree"}),u.jsx("button",{className:"ckpt-btn ckpt-btn-cancel",onClick:D,disabled:j,children:"Ignore"}),u.jsx("textarea",{className:"ckpt-feedback-input ckpt-feedback-inline-input",placeholder:"Feedback for self-evolution...",value:o,onChange:O=>a(O.target.value),disabled:j,rows:2}),u.jsx("button",{className:"ckpt-btn ckpt-btn-feedback",onClick:A,disabled:j||!o.trim(),children:"Send Feedback"})]})]})}),mf="__other__",yF=["A","B","C"];function es(e){return String(e??"").trim()}function xF(e,t){const n=es(e.question),i=es(e.header);if(!n&&!i)return null;const r=(e.options??[]).slice(0,3).map((o,a)=>({id:es(o.id)||String.fromCharCode(97+a),label:es(o.label),description:es(o.description)})).filter(o=>o.label);return{id:es(e.id)||`question_${t+1}`,header:i,question:n||i,options:r,allow_freeform:e.allow_freeform!==!1,required:e.required!==!1}}const vF=Et.memo(function({meta:t,onReply:n,responded:i}){const[r,o]=C.useState(""),[a,c]=C.useState({}),d=i,m=String(t.work_item_projection_title??t.work_item_projection_id??"Input Needed").trim()||"Input Needed",h=String(t.summary??"").trim(),p=String(t.prompt??"").trim(),g=String(t.context_note??"").trim(),x=String(t.resume_hint??"").trim(),v=C.useMemo(()=>(t.questions??[]).map(G=>String(G).trim()).filter(Boolean),[t.questions]),b=C.useMemo(()=>(t.input_questions??[]).map((G,q)=>xF(G,q)).filter(G=>G!==null),[t.input_questions]),w=b.some(G=>(G.options??[]).length>0),k=C.useMemo(()=>(t.required_fields??[]).map(G=>String(G).trim()).filter(Boolean),[t.required_fields]),S=C.useMemo(()=>(t.active_subagents??[]).filter(G=>!!G&&typeof G=="object"),[t.active_subagents]),j=C.useMemo(( Line truncated
`),{user_input_answers:G})},[a,P,b,d,n]);return u.jsxs("div",{className:"ckpt-panel ckpt-user-input",children:[u.jsxs("div",{className:"ckpt-header",children:[u.jsx("div",{className:"ckpt-icon ckpt-icon-user-input",children:u.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u.jsx("path",{d:"M3 3.5h10v6H6.5L3 13V3.5Z"}),u.jsx("path",{d:"M5.5 6h5"}),u.jsx("path",{d:"M5.5 8h3.5"})]})}),u.jsx("div",{className:"ckpt-title",children:m}),u.jsx("span",{className:"ckpt-badge ckpt-badge-scope",children:"awaiting input"}),d&&u.jsx("span",{className:"ckpt-badge ckpt-badge-responded",children:"Responded"})]}),h&&u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Summary"}),u.jsx(bi,{content:h,className:"ckpt-markdown"})]}),p&&u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Request"}),u.jsx(bi,{content:p,className:"ckpt-markdown"})]}),w?u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Questions"}),u.jsx("div",{className:"ckpt-choice-list",children:b.map(G=>{const q=a[G.id]??{freeformText:""},K=G.options??[],W=G.allow_freeform!==!1,V=W&&(K.length===0||q.selectedOptionId===mf);return u.jsxs("div",{className:"ckpt-choice-question",children:[G.header&&u.jsx("div",{className:"ckpt-question-header",children:G.header}),u.jsx(bi,{content:G.question,className:"ckpt-markdown"}),K.length>0&&u.jsxs("div",{className:"ckpt-choice-grid",children:[K.map((Q,B)=>{const Z=q.selectedOptionId===Q.id;return u.jsxs("button",{className:`ckpt-choice-option${Z?" is-selected":""}`,onClick:()=>I(G.id,Q.id),children:[u.jsx("span",{className:"ckpt-choice-letter",children:yF[B]??"?"}),u.jsxs("span",{className:"ckpt-choice-copy",children:[u.jsx("span",{className:"ckpt-choice-label",children:Q.label}),Q.description&&u.jsx("span",{className:"ckpt-choice-desc",children:Q.description})]})]},Q.id)}),W&&u.jsxs("button",{className:`ckpt-choice-option${q.selectedOptionId===mf?" is-selected":""}`,onClick:()=>I(G.id,mf),children:[u.jsx("span",{className:"ckpt-choice-letter",children:"D"}),u.jsxs("span",{className:"ckpt-choice-copy",children:[u.jsx("span",{className:"ckpt-choice-label",children:"Other"}),u.jsx("span",{className:"ckpt-choice-desc",children:"Enter a custom answer"})]})]})]}),V&&u.jsx("textarea",{className:"ckpt-feedback-input ckpt-other-field",placeholder:"Type your answer...",value:q.freeformText,onChange:Q=>H(G.id,Q.target.value),rows:3})]},G.id)})})]}):v.length>0&&u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Questions"}),u.jsx("ul",{className:"ckpt-task-list",children:v.map(G=>u.jsx("li",{children:G},G))})]}),k.length>0&&u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Required Fields"}),u.jsx("div",{className:"ckpt-task-tags",children:k.map(G=>u.jsx("span",{className:"ckpt-field-tag",children:G},G))})]}),g&&u.jsxs("div",{className:"ckpt-section",children:[u.jsx("div",{className:"ckpt-section-title",children:"Context"}),u.jsx(bi,{content:g,className:"ckpt-markdown ckpt-markdown-muted"})]}),x&&u.jsx("div",{className:"ckpt-escalation-hint",children:x}),M&&u.jsxs("details",{className:"ckpt-runtime-details",children:[u.jsx("summary",{children:"Runtime State"}),u.jsxs("div",{className:"ckpt-runtime-body",children:[L&&u.jsxs("div",{children:["Requester: ",u.jsx("code",{children:L})]}),D&&u.jsxs("div",{children:["Work item: ",u.jsx("code",{children:D})]}),A&&u.jsxs("div",{children:["Task: ",u.jsx("code",{children:A})]}),O&&u.jsxs("div",{children:["Seat: ",u.jsx("code",{children:O})]}),N&&u.jsxs("div",{children:["Worktree: ",u.jsx("code",{children:N})]}),S.length>0&&u.jsxs("div",{children:["Active subagents: ",S.length]}),j.length>0&&u.jsxs("div",{children:["Pending permission records: ",j.length]})]})]}),!d&&u.jsxs("div",{className:"ckpt-feedback-area",children:[w?null:u.jsx("textarea",{className:"ckpt-feedback-input",placeholder:"Reply with the missing input to continue...",value:r,onChange:G=>o(G.target.value),rows:3}),u.jsx("div",{className:"ckpt-feedback-btns",children:u.jsx("button",{className:"ckpt-btn ckpt-btn-approve",onClick:w?$:U,disabled:w?!P:!r.trim(),children:"Send Reply"})})]})]})}),mv={todo:"To do",in_progress:"In progress",in_review:"In review",done:"Done"};function dy(e,t){if(t&&t in mv)return t;switch(e){case"active":return"in_progress";case"waiting":return"in_review";case"done":return"done";case"failed":return"done";case"pending":return"todo";default:return"todo"}}function pf(e){return mv[e]??mv.todo}const uC={active:0,waiting:1,failed:2,done:3,pending:4};function bF(e){if(e.length===0)return"pending";let t=e[0],n=uC[t]??99;for(const i of e){const r=uC[i]??99;r<n&&(t=i,n=r)}return t}const _F={native:"Native",codex:"Codex",claude_code:"Claude Code",cursor Line truncated
`)[0].slice(0,140),tone:"danger"};const o=t.match(/^\[Company:([^\]]+)\]\s*(.+)$/);if(o){const d=o[1].split("::"),m=d[0]||"company",h=o[2].trim(),p=h.toLowerCase(),g=p.includes("completed")||p.includes("done")?"success":p.includes("blocked")||p.includes("failed")?"warning":"info";return{kind:"company_event",label:`${m.toUpperCase()} · ${d[1]??""}`.replace(/ · $/,""),summary:h,tone:g}}const a=t.match(/^(Review needed|Status digest|Blocked|Completion):\s*(.+)$/i);if(a){const d=a[1].replace(/\b\w/g,h=>h.toUpperCase()),m=hy(a[2]);return{kind:"company_event",label:d,summary:m,tone:/^Blocked$/i.test(a[1])?"warning":"info"}}const c=t.match(/^NO_DELEGATION_JUSTIFICATION:\s*(.+)$/i);return c?{kind:"company_event",label:"Delegation check",summary:hy(c[1]).slice(0,180),tone:"info"}:null}function XF(e,t){const{isCompanyRuntime:n,detailMode:i}=t;if(!n||i==="full"||xu(e.metadata))return null;const r=WI(e.content);if(!r)return null;const o=e.sender==="system"||e.metadata?.type==="system",a=r.kind==="company_event"||e.content.startsWith("[Company:");return!o&&!a?null:{msg:e,classification:r}}function KF(e,t={}){const{isCompanyRuntime:n=!1,detailMode:i="summary"}=t,r=[];let o=[],a=0;const c=()=>{if(o.length===0)return;const d=o[0].msg;r.push({kind:"ops-bundle",id:`ops:${ra(d)}`,timestamp:d.timestamp,events:o,sortOrder:a}),o=[]};return e.forEach((d,m)=>{const h=m*2+1,p=XF(d,{isCompanyRuntime:n,detailMode:i});if(p){o.length===0&&(a=h),o.push(p);return}c(),r.push({kind:"message",id:ra(d),timestamp:d.timestamp,msg:d,sortOrder:h})}),c(),r}const ZF=Et.memo(function({msg:t,showDate:n,dateStr:i,classification:r}){const[o,a]=C.useState(!1),c=t.content.trim()!==`[${r.label}] ${r.summary}`.trim()&&t.content.trim().length>r.summary.length+4;return u.jsxs("div",{children:[n&&u.jsx("div",{className:"msg-date-sep",children:u.jsx("span",{children:i})}),u.jsxs("div",{className:`msg-ops-row msg-ops-tone-${r.tone}${o?" expanded":""}`,onClick:c?()=>a(d=>!d):void 0,role:c?"button":void 0,tabIndex:c?0:-1,children:[u.jsx("span",{className:"msg-ops-dot","aria-hidden":"true"}),u.jsx("span",{className:"msg-ops-label",children:r.label}),r.summary&&u.jsx("span",{className:"msg-ops-summary",title:r.summary,children:r.summary}),u.jsx("span",{className:"msg-ops-time",title:Ms(t.timestamp),children:wo(t.timestamp)}),c&&u.jsx("span",{className:`msg-ops-chevron${o?" open":""}`,"aria-hidden":"true",children:u.jsx(rs,{down:o})})]}),c&&o&&u.jsx("div",{className:"msg-ops-details",children:u.jsx("pre",{className:"msg-ops-details-pre",children:t.content})})]})}),QF=Et.memo(function({events:t,showDate:n,dateStr:i}){const[r,o]=C.useState(!1);if(t.length===0)return null;const a=t[0].msg,c=t[t.length-1].msg,d=t.reduce((p,g)=>{const x=g.classification.kind==="company_event"?"company":g.classification.kind.startsWith("external")?"runtime":"delegation";return p[x]=(p[x]??0)+1,p},{}),m=Object.entries(d).map(([p,g])=>`${g} ${p}`).join(" · "),h=`${t.length} technical event${t.length===1?"":"s"} hidden`;return u.jsxs("div",{children:[n&&u.jsx("div",{className:"msg-date-sep",children:u.jsx("span",{children:i})}),u.jsxs("button",{type:"button",className:`msg-ops-bundle${r?" expanded":""}`,onClick:()=>o(p=>!p),title:`${Ms(a.timestamp)} - ${Ms(c.timestamp)}`,children:[u.jsx("span",{className:"msg-ops-bundle-dot"}),u.jsx("span",{className:"msg-ops-bundle-title",children:h}),u.jsx("span",{className:"msg-ops-bundle-summary",children:m}),u.jsx("span",{className:"msg-ops-bundle-time",children:wo(a.timestamp)}),u.jsx("span",{className:"msg-ops-bundle-chevron",children:u.jsx(rs,{down:r})})]}),r&&u.jsx("div",{className:"msg-ops-bundle-details",children:t.map(({msg:p,classification:g})=>u.jsxs("div",{className:`msg-ops-bundle-event msg-ops-tone-${g.tone}`,children:[u.jsx("span",{className:"msg-ops-dot"}),u.jsx("span",{className:"msg-ops-label",children:g.label}),u.jsx("span",{className:"msg-ops-summary",children:g.summary}),u.jsx("span",{className:"msg-ops-time",title:Ms(p.timestamp),children:wo(p.timestamp)})]},p.id))})]})});function JF(e){return e.kind==="review"?`Review · ${e.verdict?e.verdict.replace(/_/g," "):"review"}`:e.kind==="report"?"Report":"Update"}const eV=Et.memo(function({msg:t,payload:n,showDate:i,dateStr:r,isCopied:o,onCopy:a}){const c=qI(t.sender==="system"?t.senderName||"OPC":t.sender),d=t.senderDeleted?"[Deleted]":t.senderName,m=JF(n),h=n.summary||n.acceptanceSummary||m;return u.jsxs("div",{children:[i&&u.jsx("div",{className:"msg-date-sep",children:u.jsx("span",{children:r})}),u.jsxs("div",{className:"msg-row agent msg-row-project-update",children:[u.jsx("div",{className:"msg-avatar agent-avatar",style:{background:c},children:d.charAt(0).toUpperCase()}),u.jsxs("div",{className:"msg-body",children:[u.jsxs("div",{className:"msg-agent-header",children:[u.jsx("span",{className:"msg-sender",style:{color:c},children:d}),u.jsx("span",{className:"msg-time",title:Ms(t.timestamp),children:wo(t.timestamp)})]}),u.jsxs("div",{className:`msg-project-update-card msg-project-uLine truncated
Set up at least one role before running a task.
Go to Org tab now?`,"workspace.confirmNoDecider":`Your organization has multiple top-level roles but no final decider selected.
Choose one final decider in the Org tab before running a task.
Go to Org tab now?`,"workspace.warningNoTeams":"No runtime teams defined — the system will auto-generate from your roles","workspace.warningVacantRoles":"{count} role(s) have no employees: {names}","workspace.confirmWarnings":`Before running this task:
{warnings}
Run anyway?`}[b]??b).replace(/\{(\w+)\}/g,(j,N)=>String(w?.[N]??`{${N}}`)));if(e!=="org"&&e!=="custom"||!t)return!0;const{roles:o,employees:a}=t,c=Gm(t),d=t.top_level_role_ids??[],m=t.final_decider_role_id??"";if(o.length===0)return confirm(r("workspace.confirmNoRoles"))&&n?.(),!1;if(d.length>1&&!m)return confirm(r("workspace.confirmNoDecider"))&&n?.(),!1;const h=[],p=new Set(o.map(b=>b.role_id));c.runtimeTeams.filter(b=>b.member_role_ids.some(w=>p.has(w))||b.manager_role_id&&p.has(b.manager_role_id)).length===0&&h.push(r("workspace.warningNoTeams"));const x=new Set(a.map(b=>b.role_id)),v=o.filter(b=>!x.has(b.role_id));if(v.length>0){const b=v.map(w=>w.name).join(", ");h.push(r("workspace.warningVacantRoles",{count:v.length,names:b}))}return h.length>0?confirm(r("workspace.confirmWarnings",{warnings:h.map(b=>"• "+b).join(`
`)})):!0}function AV(e){if(!e)return!1;const t=Gm(e);return!!(t.projectRun?.run_id||t.runtimeTeams.length>0||t.runtimeSeats.length>0)}function MV(e,t){return e?e.execMode==="company"||e.execMode==="org"||e.execMode==="custom"?"summary":"full":"summary"}function ky(e,t=0){if(!e)return!1;const n=String(e.execMode??"").trim().toLowerCase();return t>0||!!e.isCompanyRuntime||!!e.roleWorkItems||!!e.executorRoleWorkItems||n==="company"||n==="org"||n==="custom"}function IC(e){return String(e?.originTaskId??e?.taskId??"").trim()||null}function DV({boardColor:e,title:t,onCommit:n}){const{t:i}=Vr(),[r,o]=C.useState(!1),[a,c]=C.useState(t),d=C.useRef(null);C.useEffect(()=>{r||c(t)},[t,r]);const m=C.useCallback(()=>{const p=a.trim();p&&p!==t?n(p):c(t),o(!1)},[a,t,n]),h=C.useCallback(()=>{c(t),o(!0),setTimeout(()=>d.current?.select(),0)},[t]);return u.jsx("div",{className:"board-selector",children:u.jsx("div",{className:"board-tabs",children:u.jsxs("span",{className:"board-tab active board-tab-editable",style:{"--board-color":e},children:[u.jsx("span",{className:"board-tab-dot",style:{background:e}}),r?u.jsx("input",{ref:d,className:"board-tab-title-input",value:a,onChange:p=>c(p.target.value),onBlur:m,onKeyDown:p=>{p.key==="Enter"&&m(),p.key==="Escape"&&(c(t),o(!1))}}):u.jsx("span",{className:"board-tab-title",onClick:h,title:i("workspace.clickEditTitle"),children:t})]})})})}function OV({boardStore:e,agents:t,officeMap:n,execMode:i,companyProfile:r,taskPreferredAgent:o,chatStore:a,sessionStore:c,projectId:d,onRunTask:m,onCreateTask:h,onMoveTask:p,onCreateSession:g,onSessionSend:x,onSecretarySend:v,onDeleteSession:b,onTitleChange:w,onSessionConfigChange:k,onSessionTaskAgentChange:S,onContinueInNewChat:j,onSessionStop:N,onSessionResume:L,onSessionComplete:A,onLoadSessionDetail:D,onOpenExecutionPanel:O,onCollabSync:T,orgInfoData:M,onNavigateToOrg:I,commsState:H,commsMessage:Y,onCommsRefresh:P,onCommsReadMessage:U,savedOrgsList:$,activeSavedOrg:G,onSavedOrgsList:q,onSavedOrgLoad:K}){const{t:W}=Vr(),{sessions:V,activeSessionId:Q,activeSession:B}=c,{markRead:Z}=a,[te,ee]=C.useState("collapsed"),{width:se,isResizing:ae,handleMouseDown:ue}=IV({initialWidth:380,minWidth:300,maxWidth:600,onCollapse:()=>ee("collapsed")}),[ne,je]=C.useState("chat"),[we,Te]=C.useState(null),[Fe,Ue]=C.useState({kind:"activity"}),[Ge,vt]=C.useState([]),[Lt,zt]=C.useState(!1),[Ut,he]=C.useState({}),Be=C.useRef(D),ct=C.useRef(V),nt=C.useRef(a.getChannelMessages),Ke=C.useRef({scope:null,active:new Set,child:null}),pe=C.useRef(new Set),Se=C.useRef(0);ct.current=V,nt.current=a.getChannelMessages;const De=i==="company"||i==="org"||i==="custom",ze=`secretary:${d}`,Je=`activity:${d}`,ut=C.useMemo(()=>we?V.find(de=>de.taskId===we)??null:null,[V,we]),tn=C.useMemo(()=>Fe.kind!=="task-detail"?null:e.tasks.find(de=>de.id===Fe.taskId)??null,[Fe,e.tasks]),be=C.useMemo(()=>{const de=Um(tn);return de?V.find(_e=>_e.taskId===de||_e.runtimeTaskId===de||_e.executionTurnId===de)??null:null},[V,tn]),We=C.useMemo(()=>be?a.getChannelMessages(be.channelId):[],[a.messages,a.getChannelMessages,be]),et=C.useMemo(()=>Df(B,V),[V,B]),Ve=C.useMemo(()=>Xf(B,V),[V,B]),Ae=C.useMemo(()=>Kf(B,[...Ve,...et]),[B,et,Ve]);C.useEffect(()=>{Be.current=D},[D]);const St=C.useCallback((de,_e,$e="summary")=>{const ft=Be.current;if(!ft||!de)return;const Rt=Se.current,ke=ct.current.find(Qe=>Qe.taskId===de)?.channelId,Me=_e&&ke&&_e.channelId!==ke?nt.current(ke).find(Qe=>Gv(Qe,$e)):_e,Le=[Rt,de,$e,Me?.timestamp??"latest",Me?.id??""].join("|");if(pe.current.has(Le))return;pe.current.add(Le),he(Qe=>Qe[de]?Qe:{...Qe,[de]:!0});let rt;try{rt=ft(de,{limit:TV,beforeCreatedAt:Me?.timestamp,beforeMessageId:Me?.id,detailLevel:$e})}catch{pe.current.delete(Le),Se.current===Rt&&(he(st=>st[de]?{...st,[de]:!1}:st),Ke.current.active.delete(`${de}:${$e}`),Ke.current.child===de&&(Ke.current.child=null));return}return Promise.resolve(rt).catch(()=>{Se.current===Rt&&(Ke.current.active.delete(`${de}:${$e}`),Ke.current.child===de&&(Ke.current.child=null))}).finally(()=>{if(pe.current.delete(Le),Se.current!==Rt)return;const Qe=`${Rt}|${de}|`;[...pe.current.keys()].some(Cn=>Cn.startsWith(Qe))||he(Cn=>Cn[de]?{...Cn,[de]:!1}:Cn)})},[]),An=C.useCallback(de=>!!Ut[de],[Ut]);C.useLayoutEffect(()=>{Se.current+=1,pe.current.clear(),Ke.current={scope:null,active:new Set,child:null},he({})},[d]),C.useEffect(()=>()=>{Se.current+=1,pe.current.clear()},[]),C.useEffect(()=>{we&&!ut&&Te(null)},[we,ut]),C.useEffect(()=>{Fe.kind==="task-detail"&&!tn&&Ue({kind:"activity"})},[Fe,tn]);const qn=C.useRef(null);C.useEffect(()=>{if(!be){qn.current=null;return}qn.current!==be.taskId&&(qn.current=be.taskId,St(be.taskId,void 0,"full"))},[be,St]),C.useEffect(()=>{if(!we){Ke.current.child=null;return}Ke.current.child!==we&&(Ke.current.child=we,St(we,void 0,"full"))},[we,St]),C.useEffect(()=>{if(!Q){Ke.current.scope=null,Ke.current.active.clear();return}Ke.current.scope!==Q&&(Ke.current.scope=Q,Ke.current.active.clear());const de=Ae.timelineSessions.leng Line truncated
`).replace(/\r/g,`
`).split(`
`).map(t=>t.trimEnd()).join(`
`).replace(/\n{3,}/g,`
`).trim()}function RC(e){const t=gv(e),n=zV(t),i=n.split(/\n{2,}/).map(r=>r.trim()).filter(Boolean);return i.length>1&&/^Verification:\s/i.test(i[i.length-1])?i.slice(0,-1).join(`
`).trim():n}function zV(e){let t=String(e||"").trim();for(;;){const n=t.match(/^\*\*([^\r\n]{8,160}?)\*\*:(?:[ \t]+|\r?\n+)([\s\S]+)$/);if(!n)return t;const i=n[2].trim();if(i.length<80||i===t)return t;t=i}}function PV(e,t,n,i){if(!i)return n.content;const r=gv(e.content),o=gv(t.content);return!r||!o||r===o?n.content:r.endsWith(o)?e.content:o.endsWith(r)?t.content:n.content}function Il(e){const t=Or(e),n=new Set,i=typeof t.checkpoint_type=="string"?t.checkpoint_type.trim():"",r=typeof t.checkpoint_id=="string"?t.checkpoint_id.trim():"";for(const o of[e.id,typeof t.ui_message_id=="string"?t.ui_message_id:"",typeof t.result_delivery_id=="string"&&t.result_delivery_id.trim()?`delivery:${t.result_delivery_id.trim()}`:"",i&&r?`checkpoint:${i}:${r}`:""]){const a=String(o??"").trim();a&&n.add(a)}return n}function ll(e){return new Set([...Il(e)].map(t=>`${e.channelId}\0${t}`))}function BV(e){return e.startsWith("checkpoint:")||e.startsWith("delivery:")}function ci(e){return typeof e.timestamp=="number"?e.timestamp:0}function yv(e){return String(e.id??"").startsWith("msg-")}function QI(e){return!yv(e)}function AC(e){const t={};for(const n of e){if(!QI(n))continue;const i=ci(n);i>(t[n.channelId]??0)&&(t[n.channelId]=i)}return t}function $V(e,t,n){return n<=(e[t]??0)?e:{...e,[t]:n}}function HV(e,t){const n={};for(const i of e){if(!QI(i)||i.sender==="user")continue;const r=t[i.channelId]??0;ci(i)<=r||(n[i.channelId]=(n[i.channelId]??0)+1)}return n}function MC(e){const t=String(e.sender??"").trim().toLowerCase(),n=Or(e),i=typeof n.role=="string"?n.role.trim().toLowerCase():"";return t==="user"||i==="user"?"user":"assistant"}function DC(e){const t=Or(e),n=String(e.sender??"").trim().toLowerCase();let i=0;const r=JI(e);return r&&(i+=1e3+r),t.source==="engine"&&(i+=100),n&&n!=="system"&&(i+=20),n&&!["assistant","system","user"].includes(n)&&(i+=5),e.replyToId&&(i+=2),i+=Math.min(Object.keys(t).length,10),i}function OC(e){return String(Or(e).source??"").trim().toLowerCase()==="engine"}function JI(e){const t=Or(e),n=String(t.transcript_kind??"").trim();if(n)return TC[n]??0;const i=String(t.kind??"").trim();return TC[i]??0}function Tl(e){return JI(e)>0}function eT(e,t){if(e.channelId!==t.channelId)return!1;const n=Il(e),i=Il(t);for(const r of n)if(i.has(r))return!0;return!1}function mm(e,t){if(eT(e,t))return!0;if(e.channelId!==t.channelId||MC(e)!==MC(t)||RC(e.content)!==RC(t.content))return!1;const n=Tl(e)&&Tl(t);if(!n&&String(e.replyToId??"")!==String(t.replyToId??"")||!(OC(e)||OC(t)))return!1;const i=ci(e),r=ci(t);return!(!n&&i&&r&&Math.abs(i-r)>z0)}function pm(e,t,n=!1){let i=e,r=t;const o=yv(e),a=yv(t);o!==a?(i=o?t:e,r=o?e:t):(n||DC(t)>DC(e))&&(i=t,r=e);const c=[];for(const j of[r.mentions,i.mentions])for(const N of j??[])c.includes(N)||c.push(N);const d=Il(e),m=Il(t);let h=!1,p="";for(const j of d)m.has(j)&&(BV(j)||(h=!0,p||(p=j)));const g=PV(e,t,i,h),x=String(Or(e).checkpoint_id??"").trim(),v=String(Or(t).checkpoint_id??"").trim(),b=!!x&&x===v,w=Tl(e)&&Tl(t),k=w?String(Or(e).ui_timeline_id??Or(t).ui_timeline_id??Uv(e)).trim():"",S={...Or(r),...Or(i)};return k&&(S.ui_timeline_id=k),{...r,...i,...p?{id:p}:{},content:g,metadata:S,mentions:c,timestamp:b||w?ci(e)||ci(t):ci(i)||ci(r)}}function LC(e){const t=[],n=new Map;for(const i of[...e].sort((r,o)=>ci(r)-ci(o))){const r=ll(i);let o=-1,a=!1;for(const d of r){const m=n.get(d);if(m!==void 0){o=m,a=t[m].id===i.id;break}}if(o===-1){const d=ci(i),m=Tl(i);for(let h=t.length-1;h>=0;h--){const p=ci(t[h]);if(!m&&d>0&&p>0&&d-p>z0)break;if(mm(t[h],i)){o=h;break}}}const c=o===-1?t.length:o;o===-1?t.push(i):t[o]=pm(t[o],i,a);for(const d of ll(t[c]))n.has(d)||n.set(d,c)}return t}function FV(e,t){const n=[...e],i=new Map;n.forEach((r,o)=>{for(const a of ll(r))i.set(a,o)});for(const r of[...t].sort((o,a)=>ci(o)-ci(a))){let o=-1;for(const a of ll(r)){const c=i.get(a);if(c!==void 0){o=c;break}}if(o<0){for(let a=n.length-1;a>=0;a-=1)if(mm(n[a],r)){o=a;break}}if(o<0)o=n.length,n.push(r);else{const a=n[o];n[o]=pm(a,r,a.id===r.id)}for(const a of ll(r))i.set(a,o);for(const a of ll(n[o]))i.set(a,o)}return n.sort((r,o)=>ci(r)===ci(o)?r.id.localeCompare(o.id):ci(r)-ci(o))}function VV(e,t){switch(t.type){case"SET":return t.channels;case"CLEAR":return[];case"ADD":return e.some(n=>n.id===t.channel.id)?e:[...e,t.channel];case"REMOVE":return e.filter(n=>n.id!==t.channelId);case"REMOVE_PARTICIPANT":return e.map(n=>({...n,participants:n.participants.filter(i=>i!==t.agentId)}));default:return e}}function UV(e,t){switch(t.type){case"SET":{const n=LC(t.messages);if(e.length===0)return n;const i=e.filter(r=>typeof r.id=="string"&&r.id.startsWith("msg-")&&!n.some(o=>mm(r,o)));return i.length===0?n:LC([...n,...i])}case"CLEAR":return[];case"ADD":{const n=ci(t.message);Il(t.message);let i=!1;for(let r=e.length-1;r>=0;r--){const o=ci(e[r]);if(!i&&n>0&&o>0&&n-o>z0&&(i=!0),eT(e[r],t.message)){const a=[...e];return a[r]=pm(e[r],t.message,e[r].id===t.message.id),a}if((Tl(t.message)||!i)&&mm(e[r],t.message)){const a=[ Line truncated
${t}`:`${e}${t}`}function qV(e,t){const n=e.trim().replace(/\s+/g," ");return n?n.length>120?`${n.slice(0,120).trimEnd()}...`:n:t||"Thinking"}function WV(e){return{timestamp:Number.isFinite(e.timestamp)?e.timestamp:Date.now(),type:e.type,summary:typeof e.summary=="string"?e.summary:"",detail:typeof e.detail=="string"&&e.detail?e.detail:void 0,turnId:typeof e.turnId=="string"&&e.turnId?e.turnId:void 0,itemId:typeof e.itemId=="string"&&e.itemId?e.itemId:void 0,streamId:typeof e.streamId=="string"&&e.streamId?e.streamId:void 0,toolCallId:typeof e.toolCallId=="string"&&e.toolCallId?e.toolCallId:void 0,permissionGroupKey:typeof e.permissionGroupKey=="string"&&e.permissionGroupKey?e.permissionGroupKey:void 0,seq:typeof e.seq=="number"&&Number.isFinite(e.seq)?e.seq:void 0,executionMode:typeof e.executionMode=="string"&&e.executionMode?e.executionMode:void 0}}function hm(e){const t=e.itemId||e.streamId;return t?`${e.type}:${e.turnId??""}:${t}`:e.toolCallId&&(e.type==="tool_call"||e.type==="autonomy")?`${e.type}:${e.turnId??""}:${e.toolCallId}`:e.permissionGroupKey&&e.type==="autonomy"?`${e.type}:${e.turnId??""}:${e.permissionGroupKey}`:""}function YV(e,t){const n=hm(e),i=hm(t);return n&&i?n===i:t.timestamp-e.timestamp>Zm||e.type!==t.type?!1:e.type==="thinking"||e.type==="assistant"?!0:e.type==="tool_call"?e.summary===t.summary:!1}function XV(e,t){return t.timestamp-e.timestamp<=Zm&&e.type===t.type&&e.summary===t.summary&&(e.detail??"")===(t.detail??"")}function KV(e,t){if(e.type==="thinking"||e.type==="assistant"){const n=xv(e.detail??"",t.detail??"","thinking");return{timestamp:e.timestamp,type:e.type,summary:qV(n,t.summary||e.summary),detail:n||void 0,turnId:t.turnId??e.turnId,itemId:t.itemId??e.itemId,streamId:t.streamId??e.streamId,toolCallId:t.toolCallId??e.toolCallId,permissionGroupKey:t.permissionGroupKey??e.permissionGroupKey,seq:t.seq??e.seq,executionMode:t.executionMode??e.executionMode}}if(e.type==="tool_call"){const n=xv(e.detail??"",t.detail??"","tool_call");return{timestamp:e.timestamp,type:"tool_call",summary:t.summary||e.summary,detail:n||void 0,turnId:t.turnId??e.turnId,itemId:t.itemId??e.itemId,streamId:t.streamId??e.streamId,toolCallId:t.toolCallId??e.toolCallId,permissionGroupKey:t.permissionGroupKey??e.permissionGroupKey,seq:t.seq??e.seq,executionMode:t.executionMode??e.executionMode}}return t}function tT(e,t,n=100){const i=WV(t),r=hm(i),o=r?[...e].reverse().findIndex(d=>hm(d)===r):-1,a=o>=0?e.length-1-o:e.length-1,c=e[a];return c?r&&o>=0&&typeof c.seq=="number"&&typeof i.seq=="number"&&i.seq<=c.seq?e:XV(c,i)?gl([...e.slice(0,a),c,...e.slice(a+1)],n):YV(c,i)?gl([...e.slice(0,a),KV(c,i),...e.slice(a+1)],n):gl([...e,i],n):[i]}function nT(e,t=100){return(Array.isArray(e)?e:[]).reduce((n,i)=>tT(n,i,t),[])}function ZV(e){return{timestamp:Number.isFinite(e.timestamp)?e.timestamp:Date.now(),type:e.type,workItemProjectionId:typeof e.workItemProjectionId=="string"&&e.workItemProjectionId?e.workItemProjectionId:void 0,workItemTurnType:typeof e.workItemTurnType=="string"&&e.workItemTurnType?e.workItemTurnType:void 0,workItemProjectionTitle:typeof e.workItemProjectionTitle=="string"&&e.workItemProjectionTitle?e.workItemProjectionTitle:void 0,runtimeTaskId:typeof e.runtimeTaskId=="string"&&e.runtimeTaskId?e.runtimeTaskId:void 0,executionTurnId:typeof e.executionTurnId=="string"&&e.executionTurnId?e.executionTurnId:void 0,roleName:typeof e.roleName=="string"&&e.roleName?e.roleName:void 0,detail:typeof e.detail=="string"&&e.detail?e.detail:void 0}}function iT(e,t){return e.type===t.type&&(e.workItemProjectionId??"")===(t.workItemProjectionId??"")&&(e.workItemTurnType??"")===(t.workItemTurnType??"")&&(e.workItemProjectionTitle??"")===(t.workItemProjectionTitle??"")&&(e.executionTurnId??e.runtimeTaskId??"")===(t.executionTurnId??t.runtimeTaskId??"")&&(e.roleName??"")===(t.roleName??"")}function QV(e,t){return t.timestamp-e.timestamp<=Zm&&iT(e,t)&&(e.type==="thinking"||e.type==="tool_call")}function JV(e,t){return iT(e,t)&&(e.detail??"")===(t.detail??"")&&t.timestamp-e.timestamp<=Zm}function eU(e,t){const n=t.type==="tool_call"?"tool_call":"thinking";return{...e,...t,timestamp:t.timestamp,detail:xv(e.detail??"",t.detail??"",n)||void 0}}function rT(e,t,n=100){const i=ZV(t),r=e[e.length-1];return r?JV(r,i)?gl([...e.slice(0,-1),{...r,timestamp:i.timestamp}],n):QV(r,i)?gl([...e.slice(0,-1),eU(r,i)],n):gl([...e,i],n):[i]}function sT(e,t=100){return(Array.isArray(e)?e:[]).reduce((n,i)=>rT(n,i,t),[])}function vv(e){const t=String(e??"").trim().toLowerCase();return t==="company"?"company":t==="org"||t==="custom"?"org":"task"}function tU(e){return String(e??"").trim().toLowerCase()==="custom"?"custom":"corporate"}function oT(e){const t=String(e.execMode??"").trim().toLowerCase(),n=String(e.companyProfile??"").trim().toLowerCase(),i=String(e.orgId??"").trim(),o=t.length>0?vv(t):n==="custom"||i?"org":vv(t);return o==="org"?{...e,execMode:"org",companyProfile:"custom",orgId:i||void 0}:o==="company"?{...e,execMode:"company" Line truncated
`)),[T,M]=C.useState(!1),I=C.useRef(e.role_id);C.useEffect(()=>{I.current!==e.role_id&&(I.current=e.role_id,d(e.name),h(e.responsibility),g(e.reports_to),v(e.icon??null),w(new Set(e.can_spawn)),S(new Set(e.tools)),N(e.runtime_policy?.execution_strategy??"auto"),A(e.preferred_external_agent??null),O((e.prompt_refs??[]).join(`
`)),M(!1))},[e]);const H=C.useRef({}),Y=C.useRef(null),P=C.useRef(e.role_id);C.useEffect(()=>{P.current=e.role_id},[e.role_id]);const U=C.useCallback(()=>{Y.current&&(clearTimeout(Y.current),Y.current=null);const ne=H.current;H.current={},Object.keys(ne).length!==0&&r(P.current,ne)},[r]),$=C.useCallback(ne=>{i||(H.current={...H.current,...ne},Y.current&&clearTimeout(Y.current),Y.current=setTimeout(U,500))},[U,i]);C.useEffect(()=>()=>{Y.current&&(clearTimeout(Y.current),Y.current=null);const ne=H.current;Object.keys(ne).length>0&&(H.current={},r(P.current,ne))},[r]);const G=ne=>{d(ne),$({name:ne})},q=ne=>{h(ne),$({responsibility:ne})},K=ne=>{g(ne),$({reports_to:ne})},W=ne=>{v(ne),$({icon:ne})},V=ne=>{N(ne),$({execution_strategy:ne})},Q=ne=>{A(ne),$({preferred_external_agent:ne})},B=ne=>{O(ne);const je=ne.split(`
`).map(we=>we.trim()).filter(Boolean);$({prompt_refs:je})},Z=ne=>{const je=new Set(b);je.has(ne)?je.delete(ne):je.add(ne),w(je),$({can_spawn:Array.from(je)})},te=ne=>{const je=new Set(k);je.has(ne)?je.delete(ne):je.add(ne),S(je),$({tools:Array.from(je)})},ee=C.useMemo(()=>t.filter(ne=>ne.role_id!==e.role_id),[t,e.role_id]),se=C.useMemo(()=>n.filter(ne=>(ne.role_ids?.length?ne.role_ids:[ne.role_id]).includes(e.role_id)).length,[n,e.role_id]),ae=C.useMemo(()=>D.split(`
`).filter(ne=>ne.trim()).length,[D]),ue=()=>{if(!T){M(!0);return}U(),o(e.role_id)};return u.jsxs("aside",{className:"ri-panel","aria-label":`Inspector for role ${e.name}`,children:[u.jsxs("header",{className:"ri-panel-header",children:[u.jsx("img",{src:Uu(x),alt:"",className:"ri-panel-icon"}),u.jsxs("div",{className:"ri-panel-title-wrap",children:[u.jsx("h3",{className:"ri-panel-title",children:c||"(unnamed)"}),u.jsx("code",{className:"ri-panel-id",children:e.role_id})]}),u.jsx("button",{className:"btn btn-ghost btn-sm ri-panel-close",onClick:a,title:"Close (Esc)",children:"✕"})]}),u.jsxs("div",{className:"ri-panel-body",children:[u.jsxs(tl,{title:"Identity",defaultExpanded:!0,children:[u.jsx(jr,{label:"Name",children:u.jsx("input",{className:"ri-text-input",value:c,onChange:ne=>G(ne.target.value),disabled:i})}),u.jsx(jr,{label:"Responsibility",children:u.jsx("textarea",{className:"ri-textarea",rows:3,value:m,onChange:ne=>q(ne.target.value),disabled:i})}),u.jsx(jr,{label:"Icon",children:u.jsx(EU,{value:x,onChange:W,readOnly:i})})]}),u.jsxs(tl,{title:"Hierarchy",defaultExpanded:!0,children:[u.jsx(jr,{label:"Reports to",children:u.jsxs("select",{className:"ri-select",value:p,onChange:ne=>K(ne.target.value),disabled:i,children:[u.jsx("option",{value:"owner",children:"You (Owner)"}),ee.map(ne=>u.jsx("option",{value:ne.role_id,children:ne.name},ne.role_id))]})}),u.jsx(jr,{label:"Can delegate to",children:u.jsx(NU,{allIds:ee.map(ne=>ne.role_id),labelFor:ne=>ee.find(je=>je.role_id===ne)?.name??ne,selected:b,onToggle:Z,readOnly:i})}),u.jsx(jr,{label:"Employees assigned",children:u.jsx("span",{className:"ri-meta-value",children:se})})]}),u.jsx(tl,{title:`Tools (${k.size})`,children:u.jsx(IU,{tools:k,onToggle:te,readOnly:i})}),u.jsx(tl,{title:`Prompts (${ae})`,children:u.jsx(jr,{label:"Prompt refs / inline",children:u.jsx("textarea",{className:"ri-textarea ri-textarea-mono",rows:5,placeholder:"One prompt ref or inline instruction per line",value:D,onChange:ne=>B(ne.target.value),disabled:i})})}),u.jsxs(tl,{title:"Runtime policy",children:[u.jsx(jr,{label:"Execution strategy",children:u.jsx("div",{className:"ri-radio-group",children:CU.map(ne=>u.jsxs("label",{className:"ri-radio",title:ne.hint,children:[u.jsx("input",{type:"radio",name:`exec-strategy-${e.role_id}`,value:ne.value,checked:j===ne.value,onChange:()=>V(ne.value),disabled:i}),ne.label]},ne.value))})}),j==="external"&&u.jsx(jr,{label:"Preferred external agent",children:u.jsxs("select",{className:"ri-select",value:L??"",onChange:ne=>Q(ne.target.value||null),disabled:i,children:[u.jsx("option",{value:"",children:"(any)"}),wU.map(ne=>u.jsx("option",{value:ne,children:ne},ne))]})})]}),u.jsxs(tl,{title:"Advanced",children:[u.jsx(jr,{label:"Role type",children:u.jsx("span",{className:"ri-meta-value",children:e.role_type??"worker"})}),u.jsx(jr,{label:"Skills",children:u.jsx("span",{className:"ri-meta-value",children:e.skill_refs&&e.skill_refs.length>0?e.skill_refs.join(", "):"(none)"})}),u.jsx(jr,{label:"Artifact contract",children:u.jsx("span",{className:"ri-meta-value",children:e.artifact_contract_ref??"(none)"})})]})]}),!i&&u.jsx("footer",{className:"ri-panel-footer",children:u.jsx("button",{className:`btn btn-sm ${T?"btn-danger":"btn-ghost"}`,onClick:ue,onBlur:()=>M(!1),children:T?"Confirm delete?":"Delete role"})})]})}function tl({title:e,defaultExpanded:t=!1,children:n}){const[i,r]=C.useState(t);return u.jsxs("section",{className:`ri-group${i?" is-expanded":""}`,children:[u.jsxs("button",{className:"ri-group-header",onClick:()=>r(o=>!o),children:[u.jsx("span",{className:"ri-group-caret",children:i?"▾":"▸"}),u.jsx("span",{className:"ri-group-title",children:e})]}),i&&u.jsx("div",{className:"ri-group-body",children:n})]})}function jr({label:e,children:t}){return u.jsxs("div",{className:"ri-field",children:[u.jsx("label",{className:"ri-field-label",children:e}),u.jsx("div",{className:"ri-field-control",children:t})]})}function EU({value:e,onChange:t,readOnly:n}){const[i,r]=C.useState(!1);return u.jsxs("div",{className:"ri-icon-picker",children:[u.jsxs("button",{className:"ri-icon-picker-trigger",onClick:()=>!n&&r(o=>!o),disabled:n,children:[u.jsx("img",{src:Uu(e),alt:"",className:"ri-icon-picker-current"}),u.jsx("span",{className:"ri-icon-picker-label",children:e??"generic"})]}),i&&u.jsxs("div",{className:"ri-icon-picker-popover",children:[u.jsx("button",{className:`ri-icon-option${e===null?" is-active":""}`,onClick:()=>{t(null),r(!1)},title:"Default icon",children:u.jsx("img",{src:mu.generic,alt:""})}),kU.filter(o=>o!=="generic").map(o=>u.jsx("button",{className:`ri-icon-option${e===o?" is-active":""}`,onClick:()=>{t(o),r(!1)},title:o,children:u.jsx("img",{src:mu[o],alt:o})},o))]})]})}function NU({allIds:e,labelFor:t,selected:n,onToggle:i,readOnly:r}){const[o,a]=C.useState(!1),c=e.filter(d=>!n.has(d));return u.jsxs("div",{className:"ri-multiselect",children:[u.jsxs("div",{className:"ri-chips",children:[Array.from(n).map(d=>u.jsxs("span",{className:"ri-ch Line truncated
font-size: .6rem;
font-weight: bold;
color: hsl(${Math.max(0,Math.min(120-120*g,120))}deg 100% 31%);`,n?.key)}return r}}function yt(e,t,n,i){return{debug:()=>{var r;return(r=e?.debugAll)!=null?r:e[t]},key:!1,onChange:i}}function AU(e,t,n,i){const r=()=>{var a;return(a=o.getValue())!=null?a:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(i),renderValue:r,getContext:gt(()=>[e,n,t,o],(a,c,d,m)=>({table:a,column:c,row:d,cell:m,getValue:m.getValue,renderValue:m.renderValue}),yt(e.options,"debugCells"))};return e._features.forEach(a=>{a.createCell==null||a.createCell(o,n,t,e)},{}),o}function MU(e,t,n,i){var r,o;const c={...e._getDefaultColumnDef(),...t},d=c.accessorKey;let m=(r=(o=c.id)!=null?o:d?typeof String.prototype.replaceAll=="function"?d.replaceAll(".","_"):d.replace(/\./g,"_"):void 0)!=null?r:typeof c.header=="string"?c.header:void 0,h;if(c.accessorFn?h=c.accessorFn:d&&(d.includes(".")?h=g=>{let x=g;for(const b of d.split(".")){var v;x=(v=x)==null?void 0:v[b]}return x}:h=g=>g[c.accessorKey]),!m)throw new Error;let p={id:`${String(m)}`,accessorFn:h,parent:i,depth:n,columnDef:c,columns:[],getFlatColumns:gt(()=>[!0],()=>{var g;return[p,...(g=p.columns)==null?void 0:g.flatMap(x=>x.getFlatColumns())]},yt(e.options,"debugColumns")),getLeafColumns:gt(()=>[e._getOrderColumnsFn()],g=>{var x;if((x=p.columns)!=null&&x.length){let v=p.columns.flatMap(b=>b.getLeafColumns());return g(v)}return[p]},yt(e.options,"debugColumns"))};for(const g of e._features)g.createColumn==null||g.createColumn(p,e);return p}const Di="debugHeaders";function HC(e,t,n){var i;let o={id:(i=n.id)!=null?i:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const a=[],c=d=>{d.subHeaders&&d.subHeaders.length&&d.subHeaders.map(c),a.push(d)};return c(o),a},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(a=>{a.createHeader==null||a.createHeader(o,e)}),o}const DU={createTable:e=>{e.getHeaderGroups=gt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,i,r)=>{var o,a;const c=(o=i?.map(p=>n.find(g=>g.id===p)).filter(Boolean))!=null?o:[],d=(a=r?.map(p=>n.find(g=>g.id===p)).filter(Boolean))!=null?a:[],m=n.filter(p=>!(i!=null&&i.includes(p.id))&&!(r!=null&&r.includes(p.id)));return xf(t,[...c,...m,...d],e)},yt(e.options,Di)),e.getCenterHeaderGroups=gt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,i,r)=>(n=n.filter(o=>!(i!=null&&i.includes(o.id))&&!(r!=null&&r.includes(o.id))),xf(t,n,e,"center")),yt(e.options,Di)),e.getLeftHeaderGroups=gt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,i)=>{var r;const o=(r=i?.map(a=>n.find(c=>c.id===a)).filter(Boolean))!=null?r:[];return xf(t,o,e,"left")},yt(e.options,Di)),e.getRightHeaderGroups=gt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,i)=>{var r;const o=(r=i?.map(a=>n.find(c=>c.id===a)).filter(Boolean))!=null?r:[];return xf(t,o,e,"right")},yt(e.options,Di)),e.getFooterGroups=gt(()=>[e.getHeaderGroups()],t=>[...t].reverse(),yt(e.options,Di)),e.getLeftFooterGroups=gt(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),yt(e.options,Di)),e.getCenterFooterGroups=gt(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),yt(e.options,Di)),e.getRightFooterGroups=gt(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),yt(e.options,Di)),e.getFlatHeaders=gt(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),yt(e.options,Di)),e.getLeftFlatHeaders=gt(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),yt(e.options,Di)),e.getCenterFlatHeaders=gt(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),yt(e.options,Di)),e.getRightFlatHeaders=gt(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),yt(e.options,Di)),e.getCenterLeafHeaders=gt(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var i;return!((i=n.subHeaders)!=null&&i.length)}),yt(e.options,Di)),e.getLeftLeafHeaders=gt(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var i;return!((i=n.subHeaders)!=null&&i.length)}),yt(e.options,Di)),e.getRightLeafHeaders=gt(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var i;return!((i=n.subHeaders)!=null&&i.length)}),yt(e.options,Di)),e.getLeafHeaders=gt(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,i)=>{var r,o,a,c,d,m;return[...(r=(o=t[0])==null?void 0:o.headers)!=null?r:[],...(a=(c=n[0])==null?void 0:c.headers)!=null?a:[],...(d=(m=i[0])==null?void 0:m.headers)!=null?d:[]].map(h=>h.getLeafHeaders()).flat()},yt(e.options,Di))}};function xf(e,t,n,i){var r,o;let a=0;const c=function(g,x){x===void 0&&(x=1),a=Math.max(a,x),g.filter(v=>v.getIsVisible()).forEach(v=>{var b;(b=v.columns)!=null&&b.length&&c(v.columns,x+1)},0)};c(e);let d=[];const m=(g,x)=>{const v={depth:x,id:[i,`${x}`].filter(Boolean).jo Line truncated
`).replace(`
`,`
+`).split(`
`)),h=m.reduce((p,g)=>p.concat(...g),[]);return[m,h]}return[[],[]]},[e]);return C.useEffect(()=>{const d=t?.target??M2,m=t?.actInsideInputWithModifier??!0;if(e!==null){const h=x=>{if(r.current=x.ctrlKey||x.metaKey||x.shiftKey||x.altKey,(!r.current||r.current&&!m)&&rR(x))return!1;const b=O2(x.code,c);if(o.current.add(x[b]),D2(a,o.current,!1)){const w=x.composedPath?.()?.[0]||x.target,k=w?.nodeName==="BUTTON"||w?.nodeName==="A";t.preventDefault!==!1&&(r.current||!k)&&x.preventDefault(),i(!0)}},p=x=>{const v=O2(x.code,c);D2(a,o.current,!0)?(i(!1),o.current.clear()):o.current.delete(x[v]),x.key==="Meta"&&o.current.clear(),r.current=!1},g=()=>{o.current.clear(),i(!1)};return d?.addEventListener("keydown",h),d?.addEventListener("keyup",p),window.addEventListener("blur",g),window.addEventListener("contextmenu",g),()=>{d?.removeEventListener("keydown",h),d?.removeEventListener("keyup",p),window.removeEventListener("blur",g),window.removeEventListener("contextmenu",g)}}},[e,i]),n}function D2(e,t,n){return e.filter(i=>n||i.length===t.size).some(i=>i.every(r=>t.has(r)))}function O2(e,t){return t.includes(e)?"code":"key"}const RK=()=>{const e=Fn();return C.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:i}=e.getState();return i?i.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[i,r,o],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??i,y:t.y??r,zoom:t.zoom??o},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,i]=e.getState().transform;return{x:t,y:n,zoom:i}},setCenter:async(t,n,i)=>e.getState().setCenter(t,n,i),fitBounds:async(t,n)=>{const{width:i,height:r,minZoom:o,maxZoom:a,panZoom:c}=e.getState(),d=K0(t,i,r,o,a,n?.padding??.1);return c?(await c.setViewport(d,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:i,snapGrid:r,snapToGrid:o,domNode:a}=e.getState();if(!a)return t;const{x:c,y:d}=a.getBoundingClientRect(),m={x:t.x-c,y:t.y-d},h=n.snapGrid??r,p=n.snapToGrid??o;return Ku(m,i,p,h)},flowToScreenPosition:t=>{const{transform:n,domNode:i}=e.getState();if(!i)return t;const{x:r,y:o}=i.getBoundingClientRect(),a=Cm(t,n);return{x:a.x+r,y:a.y+o}}}),[])};function jR(e,t){const n=[],i=new Map,r=[];for(const o of e)if(o.type==="add"){r.push(o);continue}else if(o.type==="remove"||o.type==="replace")i.set(o.id,[o]);else{const a=i.get(o.id);a?a.push(o):i.set(o.id,[o])}for(const o of t){const a=i.get(o.id);if(!a){n.push(o);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const c={...o};for(const d of a)AK(d,c);n.push(c)}return r.length&&r.forEach(o=>{o.index!==void 0?n.splice(o.index,0,{...o.item}):n.push({...o.item})}),n}function AK(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function ER(e,t){return jR(e,t)}function MK(e,t){return jR(e,t)}function na(e,t){return{id:e,type:"select",selected:t}}function ul(e,t=new Set,n=!1){const i=[];for(const[r,o]of e){const a=t.has(r);!(o.selected===void 0&&!a)&&o.selected!==a&&(n&&(o.selected=a),i.push(na(o.id,a)))}return i}function L2({items:e=[],lookup:t}){const n=[],i=new Map(e.map(r=>[r.id,r]));for(const[r,o]of e.entries()){const a=t.get(o.id),c=a?.internals?.userNode??a;c!==void 0&&c!==o&&n.push({id:o.id,item:o,type:"replace"}),c===void 0&&n.push({item:o,type:"add",index:r})}for(const[r]of t)i.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function z2(e){return{id:e.id,type:"remove"}}const P2=e=>nX(e),DK=e=>KT(e);function NR(e){return C.forwardRef(e)}function B2(e){const[t,n]=C.useState(BigInt(0)),[i]=C.useState(()=>OK(()=>n(r=>r+BigInt(1))));return Pv(()=>{const r=i.get();r.length&&(e(r),i.reset())},[t]),i}function OK(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const IR=C.createContext(null);function LK({children:e}){const t=Fn(),n=C.useCallback(c=>{const{nodes:d=[],setNodes:m,hasDefaultNodes:h,onNodesChange:p,nodeLookup:g,fitViewQueued:x,onNodesChangeMiddlewareMap:v}=t.getState();let b=d;for(const k of c)b=typeof k=="function"?k(b):k;let w=L2({items:b,lookup:g});for(const k of v.values())w=k(w);h&&m(b),w.length>0?p?.(w):x&&window.requestAnimationFrame(()=>{const{fitViewQueued:k,nodes:S,setNodes:j}=t.getState();k&&j(S)})},[]),i=B2(n),r=C.useCallback(c=>{const{edges:d=[],setEdges:m,hasDefaul Line truncated
M${O.x},${O.y}h${O.width}v${O.height}h${-O.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}tA.displayName="MiniMap";const SQ=C.memo(tA),wQ=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,CQ={[zl.Line]:"right",[zl.Handle]:"bottom-right"};function jQ({nodeId:e,position:t,variant:n=zl.Handle,className:i,style:r=void 0,children:o,color:a,minWidth:c=10,minHeight:d=10,maxWidth:m=Number.MAX_VALUE,maxHeight:h=Number.MAX_VALUE,keepAspectRatio:p=!1,resizeDirection:g,autoScale:x=!0,shouldResize:v,onResizeStart:b,onResize:w,onResizeEnd:k}){const S=AR(),j=typeof e=="string"?e:S,N=Fn(),L=C.useRef(null),A=n===zl.Handle,D=an(C.useCallback(wQ(A&&x),[A,x]),Hn),O=C.useRef(null),T=t??CQ[n];C.useEffect(()=>{if(!(!L.current||!j))return O.current||(O.current=eK({domNode:L.current,nodeId:j,getStoreItems:()=>{const{nodeLookup:I,transform:H,snapGrid:Y,snapToGrid:P,nodeOrigin:U,domNode:$}=N.getState();return{nodeLookup:I,transform:H,snapGrid:Y,snapToGrid:P,nodeOrigin:U,paneDomNode:$}},onChange:(I,H)=>{const{triggerNodeChanges:Y,nodeLookup:P,parentLookup:U,nodeOrigin:$}=N.getState(),G=[],q={x:I.x,y:I.y},K=P.get(j);if(K&&K.expandParent&&K.parentId){const W=K.origin??$,V=I.width??K.measured.width??0,Q=I.height??K.measured.height??0,B={id:K.id,parentId:K.parentId,rect:{width:V,height:Q,...nR({x:I.x??K.position.x,y:I.y??K.position.y},{width:V,height:Q},K.parentId,P,W)}},Z=nb([B],P,U,$);G.push(...Z),q.x=I.x?Math.max(W[0]*V,I.x):void 0,q.y=I.y?Math.max(W[1]*Q,I.y):void 0}if(q.x!==void 0&&q.y!==void 0){const W={id:j,type:"position",position:{...q}};G.push(W)}if(I.width!==void 0&&I.height!==void 0){const V={id:j,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:I.width,height:I.height}};G.push(V)}for(const W of H){const V={...W,type:"position"};G.push(V)}Y(G)},onEnd:({width:I,height:H})=>{const Y={id:j,type:"dimensions",resizing:!1,dimensions:{width:I,height:H}};N.getState().triggerNodeChanges([Y])}})),O.current.update({controlPosition:T,boundaries:{minWidth:c,minHeight:d,maxWidth:m,maxHeight:h},keepAspectRatio:p,resizeDirection:g,onResizeStart:b,onResize:w,onResizeEnd:k,shouldResize:v}),()=>{O.current?.destroy()}},[T,c,d,m,h,p,b,w,k,v]);const M=T.split("-");return u.jsx("div",{className:di(["react-flow__resize-control","nodrag",...M,n,i]),ref:L,style:{...r,scale:D,...a&&{[A?"backgroundColor":"borderColor"]:a}},children:o})}C.memo(jQ);const EQ=C.memo(function({data:t}){const n=["oc-canvas-node",t.isOwner&&"is-owner",t.isSelected&&"is-selected",t.isDropTarget&&"is-drop-target"].filter(Boolean).join(" "),i=Uu(t.icon);return u.jsxs("div",{className:n,children:[u.jsx(Pl,{type:"target",position:at.Top,className:"oc-canvas-handle"}),u.jsxs("div",{className:"oc-canvas-node-row",children:[u.jsx("div",{className:"oc-canvas-node-chip",children:u.jsx("span",{className:"oc-canvas-node-chip-icon",style:{WebkitMaskImage:`url("${i}")`,maskImage:`url("${i}")`},"aria-hidden":!0})}),u.jsxs("div",{className:"oc-canvas-node-text",children:[u.jsx("span",{className:"oc-canvas-node-name",children:t.name}),u.jsxs("div",{className:"oc-canvas-node-meta",children:[t.employeeNames.length>0?u.jsxs("span",{className:"oc-canvas-node-person",title:t.employeeNames.join(", "),children:[t.employeeNames[0],t.employeeNames.length>1?` +${t.employeeNames.length-1}`:""]}):u.jsx("span",{className:"oc-canvas-node-id",children:t.roleId}),t.employeeCount>0&&u.jsx("span",{className:"oc-canvas-node-badge",children:t.employeeCount})]})]})]}),u.jsx(Pl,{type:"source",position:at.Bottom,className:"oc-canvas-handle"})]})});var Uy,Z2;function sb(){if(Z2)return Uy;Z2=1;var e="\0",t="\0",n="";class i{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>{};_defaultEdgeLabelFn=()=>{};_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(h){h&&(this._isDirected=Object.hasOwn(h,"directed")?h.directed:!0,this._isMultigraph=Object.hasOwn(h,"multigraph")?h.multigraph:!1,this._isCompound=Object.hasOwn(h,"compound")?h.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(h){return this._label=h,this}graph(){return this._label}setDefaultNodeLabel(h){return this._defaultNodeLabelFn=h,typeof h!="function"&&(this._defaultNodeLabelFn=()=>h),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var h=this;return this.nodes().filter(p=>Object.keys(h._in[p]).length===0)}sinks(){var h=this;return this.nodes().filter(p=>Object.keys(h._out[p]).length===0)}setNodes(h,p){var g=arguments,x=this;return h.forEach(function(v){g.length>1?x.setNode(v,p):x.setNode(v)}),this}setNode(h,p){return Object.hasOwn(this._nodes,h)?(arguments.length>1&&(this._nodes[h]=p),this):(this._nodes[h]=arguments.length>1?p:this._defaultNodeLabelFn(h),this._isCompound&&(this._parent[h]=t, Line truncated
${c}`}),u.jsx(mU,{projects:Qe.projects,activeId:Qe.activeProjectId,onSelect:J=>{const z=wi(J);o.current?.switchProject(J,z)},onCreate:J=>{o.current?.createProject(J)},onDelete:J=>o.current?.deleteProject(J)})]}),u.jsxs("div",{className:"topbar-center",children:[u.jsxs("div",{className:"page-nav",children:[u.jsxs("button",{className:`page-nav-btn${$==="workspace"?" active":""}`,onClick:()=>G("workspace"),children:[n("app.page.workspace"),(()=>{const J=Le.channels.reduce((z,ie)=>z+Le.getUnreadCount(ie.id),0);return J>0?u.jsx("span",{className:"nav-unread-badge",children:J>99?"99+":J}):null})()]}),u.jsx("button",{className:`page-nav-btn${$==="office"?" active":""}`,onClick:()=>G("office"),children:n("app.page.office")}),u.jsx("button",{className:`page-nav-btn${$==="org"?" active":""}`,onClick:()=>G("org"),children:n("app.page.org")})]}),u.jsxs("div",{className:"stat-chips",children:[u.jsxs("span",{className:"stat-chip",children:[u.jsx("b",{children:Bs.totalAgents})," ",n("app.metric.agents")]}),u.jsxs("span",{className:"stat-chip",children:[u.jsx("b",{children:Bs.totalSkills})," ",n("app.metric.skills")]}),u.jsxs("span",{className:"stat-chip",children:[u.jsx("b",{children:Me.getOpenTaskCount()})," ",n("app.metric.tasks")]})]})]}),u.jsxs("div",{className:"topbar-right",children:[u.jsxs("div",{className:"language-toggle",role:"group","aria-label":n("language.label"),title:n("language.label"),children:[u.jsx("button",{type:"button","data-locale":"en","aria-pressed":e==="en",className:`language-toggle-btn${e==="en"?" active":""}`,onClick:()=>t("en"),children:n("language.english")}),u.jsx("button",{type:"button","data-locale":"zh-CN","aria-pressed":e==="zh-CN",className:`language-toggle-btn${e==="zh-CN"?" active":""}`,onClick:()=>t("zh-CN"),children:n("language.chinese")})]}),u.jsxs("select",{className:"theme-select",value:yi,title:n("outdoor.title"),"aria-label":n("outdoor.title"),onChange:J=>{const z=J.target.value;_n(z);try{z==="auto"?(localStorage.removeItem("opc_outdoor_override"),localStorage.removeItem("opc_outdoor_day"),localStorage.removeItem("opc_outdoor_night")):(localStorage.setItem("opc_outdoor_override",z),localStorage.removeItem("opc_outdoor_day"),localStorage.removeItem("opc_outdoor_night"))}catch{}r.current.syncOutdoorLighting()},children:[u.jsx("option",{value:"auto",children:n("outdoor.auto")}),u.jsx("option",{value:"day",children:n("outdoor.day")}),u.jsx("option",{value:"night",children:n("outdoor.night")})]}),u.jsxs("select",{className:"theme-select",value:D,onChange:J=>O(J.target.value),children:[u.jsx("option",{value:"midnight",children:n("theme.midnight")}),u.jsx("option",{value:"neon",children:n("theme.neon")}),u.jsx("option",{value:"paper",children:n("theme.paper")}),u.jsx("option",{value:"retro",children:n("theme.retro")}),u.jsx("option",{value:"terminal",children:n("theme.terminal")}),u.jsx("option",{value:"cozy",children:n("theme.cozy")}),u.jsx("option",{value:"openopc",children:n("theme.openopc")})]}),u.jsx("button",{className:`icon-btn ${W?"active":""}`,onClick:()=>V(J=>!J),title:n("dev.tools"),"aria-label":n("dev.tools"),children:u.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[u.jsx("path",{d:"M5.5 2L2 5.5 5.5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M10.5 7L14 10.5 10.5 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),$==="workspace"&&u.jsx(OV,{boardStore:Me,chatStore:Le,sessionStore:rt,agents:q,officeMap:Eo,execMode:Z,companyProfile:ee,taskPreferredAgent:ae,projectId:Qe.activeProjectId,orgInfoData:ne,onNavigateToOrg:()=>G("org"),savedOrgsList:We,activeSavedOrg:Ve,onSavedOrgsList:ga,onSavedOrgLoad:Wl,commsState:we,commsMessage:Fe,onCommsRefresh:J=>{const{project_id:z,...ie}=J??{};o.current?.commsState(Xe(),ie)},onCommsReadMessage:J=>o.current?.commsReadMessage(Xe(),J),onRunTask:(J,z,ie,oe,me)=>{o.current?.send({type:"run_task",project_id:Xe(),task_id:J,title:z,description:ie,mode:oe,profile:me})},onCreateTask:(J,z,ie,oe)=>{o.current?.send({type:"kanban_create_task",project_id:Xe(),title:J,board_id:z,column_id:ie,task_id:oe})},onMoveTask:(J,z)=>{o.current?.send({type:"kanban_move_task",project_id:Xe(),task_id:J,column_id:z})},onCreateSession:()=>{if(Ln.current||Ie.current)return;const J=Xe();ke(J),o.current?.createSession(J,void 0,Z,Bx(Z),ae,Jo(Z,Ve))},onSessionSend:(J,z,ie,oe)=>o.current?.sessionSend(Xe(),J,z,ie,oe),onSecretarySend:J=>o.current?.secretarySend(Xe(),J),onDeleteSession:J=>o.current?.deleteSession(Xe(),J),onTitleChange:(J,z)=>o.current?.sessionUpdateTitle(Xe(),J,z),onSessionConfigChange:Do,onSessionTaskAgentChange:ya,onContinueInNewChat:Ju,onSessionStop:pp,onSessionResume:hp,onSessionComplete:J=>o.current?.sessionComplete(Xe(),J),onLoadSessionDetail:(J,z)=>{const ie=o.current;if(ie)return ie.sessionDetail(Xe(),J,{...z,include:z?.detailLevel==="full"?["messages","session_state","progress","work_items","runtime_context"]:[" Line truncated
@@ -5,12 +5,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="data:," />
<title>OpenOPC Pixel Office</title>
<script type="module" crossorigin src="./assets/index-CTK-c7_K.js"></script>
<script type="module" crossorigin src="./assets/index-E3Xtv5nT.js"></script>
<link rel="modulepreload" crossorigin href="./assets/phaser-DFK5Ua9d.js">
<link rel="stylesheet" crossorigin href="./assets/index-DEvLDWDw.css">
<link rel="stylesheet" crossorigin href="./assets/index-B6-ikSHW.css">
</head>
<body>
<div id="root"></div>
</body>
</html>
+73 -49
View File
@@ -27,6 +27,7 @@ import { extractSessionRecruitmentByRole, sessionChannelId } from './lib/session
import { resolveCanonicalTurnId, terminalAssistantTurnId } from './lib/turnIdentity'
import { unassignAgent } from './game/map/OfficeStore'
import type { AgentAnimStatus, EmployeeAssignment, KanbanPhase, KanbanTask, RoleAggregatedStatus, RoleWorkItemSummary, Session, TaskPreferredAgent } from './types/kanban'
import { useI18n } from './i18n'
function readOutdoorOverrideUi(): 'auto' | 'day' | 'night' {
try {
@@ -444,6 +445,7 @@ function MaybeExecutionPanel({ taskId, sessions, agents, onClose }: {
}
export default function App() {
const { locale, setLocale, t, translateMaybe } = useI18n()
const bridgeRef = useRef(new GameBridge())
useMemo(() => registerTestRunner(bridgeRef.current), [])
const clientRef = useRef<VisualSocketClient | null>(null)
@@ -2347,26 +2349,47 @@ export default function App() {
<div className="topbar-center">
<div className="page-nav">
<button className={`page-nav-btn${activePage === 'workspace' ? ' active' : ''}`} onClick={() => setActivePage('workspace')}>
Workspace
{t('app.page.workspace')}
{(() => {
const total = chatStore.channels.reduce((sum, ch) => sum + chatStore.getUnreadCount(ch.id), 0)
return total > 0 ? <span className="nav-unread-badge">{total > 99 ? '99+' : total}</span> : null
})()}
</button>
<button className={`page-nav-btn${activePage === 'office' ? ' active' : ''}`} onClick={() => setActivePage('office')}>Office</button>
<button className={`page-nav-btn${activePage === 'org' ? ' active' : ''}`} onClick={() => setActivePage('org')}>Org</button>
<button className={`page-nav-btn${activePage === 'office' ? ' active' : ''}`} onClick={() => setActivePage('office')}>{t('app.page.office')}</button>
<button className={`page-nav-btn${activePage === 'org' ? ' active' : ''}`} onClick={() => setActivePage('org')}>{t('app.page.org')}</button>
</div>
<div className="stat-chips">
<span className="stat-chip"><b>{metrics.totalAgents}</b> agents</span>
<span className="stat-chip"><b>{metrics.totalSkills}</b> skills</span>
<span className="stat-chip"><b>{boardStore.getOpenTaskCount()}</b> tasks</span>
<span className="stat-chip"><b>{metrics.totalAgents}</b> {t('app.metric.agents')}</span>
<span className="stat-chip"><b>{metrics.totalSkills}</b> {t('app.metric.skills')}</span>
<span className="stat-chip"><b>{boardStore.getOpenTaskCount()}</b> {t('app.metric.tasks')}</span>
</div>
</div>
<div className="topbar-right">
<div className="language-toggle" role="group" aria-label={t('language.label')} title={t('language.label')}>
<button
type="button"
data-locale="en"
aria-pressed={locale === 'en'}
className={`language-toggle-btn${locale === 'en' ? ' active' : ''}`}
onClick={() => setLocale('en')}
>
{t('language.english')}
</button>
<button
type="button"
data-locale="zh-CN"
aria-pressed={locale === 'zh-CN'}
className={`language-toggle-btn${locale === 'zh-CN' ? ' active' : ''}`}
onClick={() => setLocale('zh-CN')}
>
{t('language.chinese')}
</button>
</div>
<select
className="theme-select"
value={outdoorOverride}
title="Outdoor lighting override"
title={t('outdoor.title')}
aria-label={t('outdoor.title')}
onChange={(e) => {
const v = e.target.value as 'auto' | 'day' | 'night'
setOutdoorOverride(v)
@@ -2384,20 +2407,20 @@ export default function App() {
bridgeRef.current.syncOutdoorLighting()
}}
>
<option value="auto">Outdoor auto</option>
<option value="day">Outdoor day</option>
<option value="night">Outdoor night</option>
<option value="auto">{t('outdoor.auto')}</option>
<option value="day">{t('outdoor.day')}</option>
<option value="night">{t('outdoor.night')}</option>
</select>
<select className="theme-select" value={theme} onChange={(e) => setTheme(e.target.value as ThemeName)}>
<option value="midnight">Midnight</option>
<option value="neon">Neon</option>
<option value="paper">Paper</option>
<option value="retro">Retro</option>
<option value="terminal">Terminal</option>
<option value="cozy">Cozy</option>
<option value="openopc">OpenOPC</option>
<option value="midnight">{t('theme.midnight')}</option>
<option value="neon">{t('theme.neon')}</option>
<option value="paper">{t('theme.paper')}</option>
<option value="retro">{t('theme.retro')}</option>
<option value="terminal">{t('theme.terminal')}</option>
<option value="cozy">{t('theme.cozy')}</option>
<option value="openopc">{t('theme.openopc')}</option>
</select>
<button className={`icon-btn ${showDevTools ? 'active' : ''}`} onClick={() => setShowDevTools((v) => !v)} title="Developer Tools">
<button className={`icon-btn ${showDevTools ? 'active' : ''}`} onClick={() => setShowDevTools((v) => !v)} title={t('dev.tools')} aria-label={t('dev.tools')}>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M5.5 2L2 5.5 5.5 9" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/><path d="M10.5 7L14 10.5 10.5 14" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/></svg>
</button>
</div>
@@ -2552,14 +2575,14 @@ export default function App() {
{/* Phaser Game Canvas */}
<section className="canvas-wrap">
<PhaserGame bridge={bridgeRef.current} active={activePage === 'office'} />
<button className="canvas-float-btn" onClick={() => setShowSubagents((v) => !v)} title={showSubagents ? 'Hide sub-agents' : 'Show sub-agents'}>
<button className="canvas-float-btn" onClick={() => setShowSubagents((v) => !v)} title={showSubagents ? t('office.hideSubagents') : t('office.showSubagents')}>
{showSubagents ? '👥' : '👤'}
</button>
<button
className="sidebar-collapse-btn"
onClick={toggleSidebar}
title={sidebarCollapsed ? 'Show side panel' : 'Hide side panel'}
aria-label={sidebarCollapsed ? 'Show side panel' : 'Hide side panel'}
title={sidebarCollapsed ? t('office.showSidePanel') : t('office.hideSidePanel')}
aria-label={sidebarCollapsed ? t('office.showSidePanel') : t('office.hideSidePanel')}
>
<span className="collapse-glyph">{sidebarCollapsed ? '❮' : '❯'}</span>
</button>
@@ -2574,13 +2597,13 @@ export default function App() {
<div className="mode-info-bar">
<span className="mode-badge">{globalExecMode === 'company' ? `${globalExecMode}/${globalCompanyProfile}` : globalModeLabel}</span>
{isOrgMode ? (
<span className="mode-hint">Manage your team in the <b>Org</b> tab</span>
<span className="mode-hint">{t('office.modeHint.org')}</span>
) : (
<span className="mode-hint">Switch to <b>Org</b> mode to create or manage agents</span>
<span className="mode-hint">{t('office.modeHint.switch')}</span>
)}
</div>
<div className="section-label">Offices <span className="count-badge">{offices.length}</span></div>
<div className="section-label">{t('office.offices')} <span className="count-badge">{offices.length}</span></div>
<div className="office-cards">
{offices.map((office) => {
const deskCount = getOfficeDeskSeats(office.id).length
@@ -2602,14 +2625,14 @@ export default function App() {
) : (
<>
<span className="office-name">{office.name}</span>
<button className="office-edit-btn" title="Rename" onClick={(e) => { e.stopPropagation(); setEditingOfficeName(office.id); setOfficeNameDraft(office.name) }}>✎</button>
<button className="office-edit-btn" title={t('office.rename')} onClick={(e) => { e.stopPropagation(); setEditingOfficeName(office.id); setOfficeNameDraft(office.name) }}>✎</button>
</>
)}
<span className="office-capacity">{assignedCards.length}/{deskCount}</span>
</div>
<div className="office-agents">
{assignedCards.map(c => (
<span key={c.id} className="office-agent-chip" title={`${c.displayName} — ${c.seatId ?? 'no seat'}`} onClick={(e) => { e.stopPropagation(); selectAgent(c.id) }}>
<span key={c.id} className="office-agent-chip" title={`${c.displayName} — ${c.seatId ?? t('office.noSeat')}`} onClick={(e) => { e.stopPropagation(); selectAgent(c.id) }}>
{c.displayName.slice(0, 8)}
</span>
))}
@@ -2620,7 +2643,7 @@ export default function App() {
onClick={e => e.stopPropagation()}
onChange={e => { if (e.target.value) handleAssignAgent(office.id, e.target.value) }}
>
<option value="">+ Move here</option>
<option value="">{t('office.moveHere')}</option>
{otherAgents.map(a => (
<option key={a.id} value={a.id}>{a.displayName} ({offices.find(o => o.id === (cards.find(cc => cc.id === a.id)?.officeId))?.name ?? '?'})</option>
))}
@@ -2632,7 +2655,7 @@ export default function App() {
})}
</div>
<div className="section-label">Active Agents <span className="count-badge">{swarmAgents.length}</span></div>
<div className="section-label">{t('office.activeAgents')} <span className="count-badge">{swarmAgents.length}</span></div>
<div className="agent-list">
{swarmAgents.map((agent) => (
<div key={agent.agent_id} className={`agent-row ${selectedAgentId === agent.agent_id ? 'selected' : ''}`}>
@@ -2640,7 +2663,7 @@ export default function App() {
<span className={`dot ${agent.status}`} />
<div className="agent-info">
<span className="agent-name">{agent.name}</span>
<span className="agent-spec">{agent.specialties.slice(0, 2).join(' · ') || 'general'}</span>
<span className="agent-spec">{agent.specialties.slice(0, 2).join(' · ') || t('common.general')}</span>
</div>
</button>
{isOrgMode && (
@@ -2648,27 +2671,27 @@ export default function App() {
? <span className="agent-del" style={{ pointerEvents: 'none' }}><span className="spinner-inline" /></span>
: confirmDeleteId === agent.agent_id
? <span className="del-confirm">
<span className="del-confirm-label">Delete?</span>
<button className="del-confirm-yes" onClick={() => { setDeletingAgentId(agent.agent_id); setConfirmDeleteId(null); clientRef.current?.deleteAgent(agent.agent_id) }}>Yes</button>
<button className="del-confirm-no" onClick={() => setConfirmDeleteId(null)}>No</button>
<span className="del-confirm-label">{t('office.deleteQuestion')}</span>
<button className="del-confirm-yes" onClick={() => { setDeletingAgentId(agent.agent_id); setConfirmDeleteId(null); clientRef.current?.deleteAgent(agent.agent_id) }}>{t('common.yes')}</button>
<button className="del-confirm-no" onClick={() => setConfirmDeleteId(null)}>{t('common.no')}</button>
</span>
: <button className="agent-del" title={`Remove ${agent.name}`} onClick={() => setConfirmDeleteId(agent.agent_id)}>×</button>
: <button className="agent-del" title={t('office.removeAgent', { name: agent.name })} onClick={() => setConfirmDeleteId(agent.agent_id)}>×</button>
)}
</div>
))}
{swarmAgents.length === 0 && (
<div className="empty-state">No agents yet — click a template above to spawn one.</div>
<div className="empty-state">{t('office.emptyAgents')}</div>
)}
</div>
{selectedCard && (
<div className="agent-detail">
<div className="agent-detail-name">{selectedCard.displayName}</div>
<div className="agent-detail-row"><span className="detail-label">State</span><span className="detail-value">{selectedCard.state}</span></div>
<div className="agent-detail-row"><span className="detail-label">Tool</span><span className="detail-value">{selectedCard.currentTool ?? '—'}</span></div>
<div className="agent-detail-row"><span className="detail-label">Task</span><span className="detail-value">{selectedCard.taskSummary ?? '—'}</span></div>
<div className="agent-detail">
<div className="agent-detail-name">{selectedCard.displayName}</div>
<div className="agent-detail-row"><span className="detail-label">{t('common.state')}</span><span className="detail-value">{translateMaybe('agent.status', selectedCard.state) || selectedCard.state}</span></div>
<div className="agent-detail-row"><span className="detail-label">{t('common.tool')}</span><span className="detail-value">{selectedCard.currentTool ?? '—'}</span></div>
<div className="agent-detail-row"><span className="detail-label">{t('common.task')}</span><span className="detail-value">{selectedCard.taskSummary ?? '—'}</span></div>
<div className="agent-detail-row">
<span className="detail-label">Office</span>
<span className="detail-label">{t('app.page.office')}</span>
<select
className="detail-select"
value={selectedCard.officeId}
@@ -2679,7 +2702,7 @@ export default function App() {
</select>
</div>
<div className="agent-detail-row">
<span className="detail-label">Seat</span>
<span className="detail-label">{t('common.seat')}</span>
<select
className="detail-select"
value={selectedCard.seatId ?? ''}
@@ -2704,8 +2727,8 @@ export default function App() {
{cards.length > swarmAgents.length && (
<>
<div className="section-label">
Characters
<button className="inline-btn" onClick={() => setShowSubagents((v) => !v)}>{showSubagents ? 'hide sub' : 'show sub'}</button>
{t('office.characters')}
<button className="inline-btn" onClick={() => setShowSubagents((v) => !v)}>{showSubagents ? t('office.hideSub') : t('office.showSub')}</button>
</div>
<div className="agent-list">
{cards.filter((c) => !swarmAgents.some((a) => a.agent_id === c.id)).map((card) => (
@@ -2727,28 +2750,29 @@ export default function App() {
{showDevTools && (
<div className="dev-overlay">
<div className="dev-header">
<span className="dev-title">Developer Tools</span>
<span className="dev-title">{t('dev.tools')}</span>
<button className="icon-btn" onClick={() => setShowDevTools(false)}>✕</button>
</div>
<div className="dev-group">
<div className="dev-label">Connection</div>
<div className="dev-label">{t('dev.connection')}</div>
<div className="input-row">
<input value={wsUrlInput} onChange={(e) => setWsUrlInput(e.target.value)} placeholder="ws://..." />
<button className="send-btn" onClick={applyWsUrl}>↩</button>
</div>
</div>
<div className="dev-group">
<div className="dev-label">Evolution Pipeline</div>
<div className="dev-label">{t('dev.evolution')}</div>
<div className="evo-pipeline">
{(['Trace', 'Reflect', 'Synthesize', 'Practice', 'Lifecycle'] as const).map((phase, i) => {
const key = phase.toLowerCase() as keyof typeof evolutionPhases
const active = key in evolutionPhases ? evolutionPhases[key as 'trace' | 'reflect' | 'synthesize'] : false
const phaseLabelKey = `dev.phase.${key}` as Parameters<typeof t>[0]
return (
<div key={phase} className="evo-phase-group">
{i > 0 && <div className="evo-connector" />}
<div className={`evo-node ${active ? 'active' : ''}`}>
<div className="evo-dot" />
<span className="evo-label">{phase}</span>
<span className="evo-label">{t(phaseLabelKey)}</span>
</div>
</div>
)
@@ -2765,7 +2789,7 @@ export default function App() {
</div>
<div className="dev-group">
<div className="dev-label">
Events
{t('dev.events')}
<select className="inline-select" value={eventTypeFilter} onChange={(e) => setEventTypeFilter(e.target.value)}>
{eventTypes.map((type) => <option key={type} value={type}>{type}</option>)}
</select>
@@ -2783,7 +2807,7 @@ export default function App() {
</div>
{Object.keys(snapshot?.channels ?? {}).length > 0 && (
<div className="dev-group">
<div className="dev-label">Channels</div>
<div className="dev-label">{t('dev.channels')}</div>
{Object.entries(snapshot?.channels ?? {}).map(([name, info]) => (
<div className="list-row" key={name}>
<span>{name}</span>
@@ -4,6 +4,7 @@ import type { Session } from '../types/kanban'
import { IconPlus, IconSearch, IconActivity, IconShield, IconTrash, IconWorkItem } from './SvgIcons'
import { getSessionRuntimeStatus } from '../lib/sessionRuntime'
import { deriveCompanyRuntimeDisplayStatus } from '../lib/workItemSessions'
import { useI18n } from '../i18n'
interface SessionSidebarProps {
sessions: Session[]
@@ -35,12 +36,14 @@ function sessionDotClass(session: Session): string {
return STATUS_DOT[displayStatus] ?? 'status-pending'
}
function relativeTime(ts: number): string {
type TFunction = ReturnType<typeof useI18n>['t']
function relativeTime(ts: number, t: TFunction): string {
const diff = Date.now() - ts
if (diff < 60_000) return 'just now'
if (diff < 3_600_000) return `${Math.floor(diff / 60_000)}m`
if (diff < 86_400_000) return `${Math.floor(diff / 3_600_000)}h`
return `${Math.floor(diff / 86_400_000)}d`
if (diff < 60_000) return t('session.justNow')
if (diff < 3_600_000) return t('session.minutes', { count: Math.floor(diff / 60_000) })
if (diff < 86_400_000) return t('session.hours', { count: Math.floor(diff / 3_600_000) })
return t('session.days', { count: Math.floor(diff / 86_400_000) })
}
function dateGroup(ts: number): string {
@@ -53,6 +56,15 @@ function dateGroup(ts: number): string {
return 'Earlier'
}
function groupLabel(group: 'Today' | 'Yesterday' | 'Earlier', hasRuntimeSessions: boolean, t: TFunction): string {
const label = group === 'Today'
? t('session.today')
: group === 'Yesterday'
? t('session.yesterday')
: t('session.earlier')
return hasRuntimeSessions ? `${label} ${t('session.runtimeSuffix')}` : label
}
interface SessionTree {
session: Session
children: Session[]
@@ -104,6 +116,7 @@ function SessionItem({
onSelect: () => void
onDelete: () => void
}) {
const { t, translateMaybe } = useI18n()
const [showDelete, setShowDelete] = useState(false)
const [confirming, setConfirming] = useState(false)
const agentLabel = session.assigneeIds.length > 0
@@ -134,12 +147,12 @@ function SessionItem({
<span className="session-agent-tag">{agentLabel}</span>
)}
{!isChild && session.isCompanyRuntime && (
<span className="session-runtime-badge" title="Company runtime"><IconWorkItem /></span>
<span className="session-runtime-badge" title={t('session.companyRuntime')}><IconWorkItem /></span>
)}
{session.title}
</span>
<span className="session-item-meta">
{displayStatus} · {relativeTime(session.updatedAt)}
{translateMaybe('kanban.status', displayStatus) || displayStatus} · {relativeTime(session.updatedAt, t)}
</span>
</div>
{!!unreadCount && unreadCount > 0 && (
@@ -149,15 +162,15 @@ function SessionItem({
<button
className="session-delete-btn"
onClick={e => { e.stopPropagation(); setConfirming(true) }}
title="Delete"
title={t('common.delete')}
>
<IconTrash />
</button>
)}
{confirming && (
<span className="session-confirm-delete" onClick={e => e.stopPropagation()}>
<button className="session-confirm-yes" onClick={() => { setConfirming(false); onDelete() }}>Delete</button>
<button className="session-confirm-no" onClick={() => setConfirming(false)}>Cancel</button>
<button className="session-confirm-yes" onClick={() => { setConfirming(false); onDelete() }}>{t('common.delete')}</button>
<button className="session-confirm-no" onClick={() => setConfirming(false)}>{t('common.cancel')}</button>
</span>
)}
</button>
@@ -165,6 +178,7 @@ function SessionItem({
}
export function SessionSidebar({ sessions, activeSessionId, activeChannel, secretaryChannelId, unreadCounts, onSelect, onCreateSession, onDeleteSession, onSelectSecretary }: SessionSidebarProps) {
const { t } = useI18n()
const [search, setSearch] = useState('')
const [collapsed, setCollapsed] = useState<Set<string>>(new Set())
const hasRuntimeSessions = sessions.some(session =>
@@ -256,7 +270,7 @@ export function SessionSidebar({ sessions, activeSessionId, activeChannel, secre
e.stopPropagation()
toggleCollapse(node.session.taskId)
}}
aria-label={isCollapsed ? 'Expand' : 'Collapse'}
aria-label={isCollapsed ? t('session.expand') : t('session.collapse')}
/>
)}
<SessionItem
@@ -269,13 +283,13 @@ export function SessionSidebar({ sessions, activeSessionId, activeChannel, secre
</div>
</div>
)
}, [activeSessionId, collapsed, onDeleteSession, onSelect, toggleCollapse, unreadCounts])
}, [activeSessionId, collapsed, onDeleteSession, onSelect, toggleCollapse, unreadCounts, t])
const renderVirtualRow = useCallback((row: SidebarRow) => {
if (row.kind === 'group') {
return (
<div className="session-group-label">
{hasRuntimeSessions ? `${row.group} Runtime Sessions` : row.group}
{groupLabel(row.group, hasRuntimeSessions, t)}
</div>
)
}
@@ -288,7 +302,7 @@ export function SessionSidebar({ sessions, activeSessionId, activeChannel, secre
className="session-child-count"
onClick={() => toggleCollapse(row.node.session.taskId)}
>
{row.node.children.length} sub-task{row.node.children.length > 1 ? 's' : ''}
{t(row.node.children.length > 1 ? 'session.subTasks' : 'session.subTask', { count: row.node.children.length })}
</button>
)
}
@@ -305,13 +319,13 @@ export function SessionSidebar({ sessions, activeSessionId, activeChannel, secre
/>
</div>
)
}, [activeSessionId, hasRuntimeSessions, onDeleteSession, onSelect, renderPrimaryRow, toggleCollapse, unreadCounts])
}, [activeSessionId, hasRuntimeSessions, onDeleteSession, onSelect, renderPrimaryRow, toggleCollapse, unreadCounts, t])
return (
<div className="session-sidebar">
<button className="session-new-btn" onClick={onCreateSession}>
<IconPlus />
<span>New Chat</span>
<span>{t('session.newChat')}</span>
</button>
{onSelectSecretary && (
@@ -320,7 +334,7 @@ export function SessionSidebar({ sessions, activeSessionId, activeChannel, secre
onClick={onSelectSecretary}
>
<IconShield />
<span>Secretary</span>
<span>{t('session.secretary')}</span>
{!!(secretaryChannelId && unreadCounts?.[secretaryChannelId]) && unreadCounts![secretaryChannelId!] > 0 && (
<span className="session-unread-badge">{unreadCounts![secretaryChannelId!] > 99 ? '99+' : unreadCounts![secretaryChannelId!]}</span>
)}
@@ -331,7 +345,7 @@ export function SessionSidebar({ sessions, activeSessionId, activeChannel, secre
<IconSearch />
<input
className="session-search"
placeholder="Search..."
placeholder={t('session.search')}
value={search}
onChange={e => setSearch(e.target.value)}
/>
@@ -368,7 +382,7 @@ export function SessionSidebar({ sessions, activeSessionId, activeChannel, secre
if (!items || items.length === 0) return null
return (
<div key={group} className="session-group">
<div className="session-group-label">{hasRuntimeSessions ? `${group} Runtime Sessions` : group}</div>
<div className="session-group-label">{groupLabel(group, hasRuntimeSessions, t)}</div>
{items.map(node => {
const hasChildren = node.children.length > 0
const isCollapsed = collapsed.has(node.session.taskId)
@@ -382,7 +396,7 @@ export function SessionSidebar({ sessions, activeSessionId, activeChannel, secre
e.stopPropagation()
toggleCollapse(node.session.taskId)
}}
aria-label={isCollapsed ? 'Expand' : 'Collapse'}
aria-label={isCollapsed ? t('session.expand') : t('session.collapse')}
/>
)}
<SessionItem
@@ -416,7 +430,7 @@ export function SessionSidebar({ sessions, activeSessionId, activeChannel, secre
className="session-child-count"
onClick={() => toggleCollapse(node.session.taskId)}
>
{node.children.length} sub-task{node.children.length > 1 ? 's' : ''}
{t(node.children.length > 1 ? 'session.subTasks' : 'session.subTask', { count: node.children.length })}
</button>
)}
</div>
@@ -427,7 +441,7 @@ export function SessionSidebar({ sessions, activeSessionId, activeChannel, secre
})}
{filtered.length === 0 && (
<div className="session-empty">No sessions yet</div>
<div className="session-empty">{t('session.noSessions')}</div>
)}
</div>
@@ -436,7 +450,7 @@ export function SessionSidebar({ sessions, activeSessionId, activeChannel, secre
onClick={() => onSelect(null)}
>
<IconActivity />
<span>Activity</span>
<span>{t('session.activity')}</span>
</button>
</div>
)
@@ -1,5 +1,6 @@
import { useState, useCallback } from 'react'
import type { Project } from '../types/kanban'
import { useI18n } from '../i18n'
interface ProjectSelectorProps {
projects: Project[]
@@ -10,6 +11,7 @@ interface ProjectSelectorProps {
}
export function ProjectSelector({ projects, activeId, onSelect, onCreate, onDelete }: ProjectSelectorProps) {
const { t } = useI18n()
const [creating, setCreating] = useState(false)
const [newName, setNewName] = useState('')
const [confirmDelete, setConfirmDelete] = useState<string | null>(null)
@@ -34,7 +36,8 @@ export function ProjectSelector({ projects, activeId, onSelect, onCreate, onDele
className="theme-select"
value={activeId}
onChange={e => onSelect(e.target.value)}
title="Switch project"
title={t('project.switch')}
aria-label={t('project.switch')}
>
{projects.map(p => (
<option key={p.id} value={p.id}>{p.name}</option>
@@ -49,7 +52,7 @@ export function ProjectSelector({ projects, activeId, onSelect, onCreate, onDele
autoFocus
className="theme-select"
value={newName}
placeholder="project-name"
placeholder={t('project.placeholder')}
onChange={e => setNewName(e.target.value)}
onKeyDown={e => { if (e.key === 'Escape') setCreating(false) }}
style={{ width: 120 }}
@@ -60,7 +63,7 @@ export function ProjectSelector({ projects, activeId, onSelect, onCreate, onDele
<button
className="pill-btn"
onClick={() => setCreating(true)}
title="New project"
title={t('project.new')}
style={{ fontSize: 11, padding: '2px 8px' }}
>
+
@@ -70,10 +73,10 @@ export function ProjectSelector({ projects, activeId, onSelect, onCreate, onDele
<button
className="pill-btn"
onClick={() => setConfirmDelete(activeId)}
title="Delete project"
title={t('project.delete')}
style={{ fontSize: 11, padding: '2px 8px', color: '#ef4444' }}
>
Del
{t('project.deleteButton')}
</button>
)}
@@ -88,10 +91,10 @@ export function ProjectSelector({ projects, activeId, onSelect, onCreate, onDele
maxWidth: 400, boxShadow: '0 8px 32px rgba(0,0,0,0.4)', textAlign: 'center',
}}>
<p style={{ margin: '0 0 8px', fontWeight: 600, fontSize: 15 }}>
Delete project "{confirmDelete}"?
{t('project.confirmTitle', { name: confirmDelete })}
</p>
<p style={{ margin: '0 0 20px', fontSize: 13, opacity: 0.7 }}>
All sessions, messages, tasks, and agent data in this project will be permanently deleted. This action cannot be undone.
{t('project.confirmBody')}
</p>
<div style={{ display: 'flex', gap: 8, justifyContent: 'center' }}>
<button
@@ -99,14 +102,14 @@ export function ProjectSelector({ projects, activeId, onSelect, onCreate, onDele
onClick={() => setConfirmDelete(null)}
style={{ padding: '6px 18px', fontSize: 13 }}
>
Cancel
{t('common.cancel')}
</button>
<button
className="pill-btn"
onClick={handleDelete}
style={{ padding: '6px 18px', fontSize: 13, background: '#ef4444', color: '#fff' }}
>
Delete
{t('common.delete')}
</button>
</div>
</div>
@@ -0,0 +1,403 @@
import { createContext, useCallback, useContext, useEffect, useMemo, useState, type ReactNode } from 'react'
export type Locale = 'en' | 'zh-CN'
const STORAGE_KEY = 'openopc_locale'
const en = {
'app.page.workspace': 'Workspace',
'app.page.office': 'Office',
'app.page.org': 'Org',
'app.page.mapEditor': 'Map editor',
'app.metric.agents': 'agents',
'app.metric.skills': 'skills',
'app.metric.tasks': 'tasks',
'language.label': 'Language',
'language.english': 'EN',
'language.chinese': '简',
'outdoor.title': 'Outdoor lighting override',
'outdoor.auto': 'Outdoor auto',
'outdoor.day': 'Outdoor day',
'outdoor.night': 'Outdoor night',
'theme.midnight': 'Midnight',
'theme.neon': 'Neon',
'theme.paper': 'Paper',
'theme.retro': 'Retro',
'theme.terminal': 'Terminal',
'theme.cozy': 'Cozy',
'theme.openopc': 'OpenOPC',
'dev.tools': 'Developer Tools',
'dev.connection': 'Connection',
'dev.evolution': 'Evolution Pipeline',
'dev.events': 'Events',
'dev.channels': 'Channels',
'dev.phase.trace': 'Trace',
'dev.phase.reflect': 'Reflect',
'dev.phase.synthesize': 'Synthesize',
'dev.phase.practice': 'Practice',
'dev.phase.lifecycle': 'Lifecycle',
'project.switch': 'Switch project',
'project.new': 'New project',
'project.delete': 'Delete project',
'project.deleteButton': 'Del',
'project.placeholder': 'project-name',
'project.confirmTitle': 'Delete project "{name}"?',
'project.confirmBody': 'All sessions, messages, tasks, and agent data in this project will be permanently deleted. This action cannot be undone.',
'common.cancel': 'Cancel',
'common.delete': 'Delete',
'common.yes': 'Yes',
'common.no': 'No',
'common.loading': 'Loading...',
'common.ready': 'ready',
'common.autoSaved': 'Auto-saved',
'common.active': 'active',
'common.idle': 'idle',
'common.general': 'general',
'common.state': 'State',
'common.tool': 'Tool',
'common.task': 'Task',
'common.seat': 'Seat',
'common.role': 'Role',
'common.employee': 'Employee',
'common.manager': 'Manager',
'common.origin': 'Origin',
'common.projection': 'Projection',
'common.gate': 'Gate',
'common.runtime': 'Runtime',
'office.modeHint.org': 'Manage your team in the Org tab',
'office.modeHint.switch': 'Switch to Org mode to create or manage agents',
'office.offices': 'Offices',
'office.activeAgents': 'Active Agents',
'office.rename': 'Rename',
'office.noSeat': 'no seat',
'office.moveHere': '+ Move here',
'office.characters': 'Characters',
'office.hideSub': 'hide sub',
'office.showSub': 'show sub',
'office.hideSubagents': 'Hide sub-agents',
'office.showSubagents': 'Show sub-agents',
'office.showSidePanel': 'Show side panel',
'office.hideSidePanel': 'Hide side panel',
'office.removeAgent': 'Remove {name}',
'office.deleteQuestion': 'Delete?',
'office.emptyAgents': 'No agents yet — click a template above to spawn one.',
'session.newChat': 'New Chat',
'session.secretary': 'Secretary',
'session.search': 'Search...',
'session.activity': 'Activity',
'session.noSessions': 'No sessions yet',
'session.today': 'Today',
'session.yesterday': 'Yesterday',
'session.earlier': 'Earlier',
'session.runtimeSuffix': 'Runtime Sessions',
'session.justNow': 'just now',
'session.minutes': '{count}m',
'session.hours': '{count}h',
'session.days': '{count}d',
'session.companyRuntime': 'Company runtime',
'session.expand': 'Expand',
'session.collapse': 'Collapse',
'session.subTask': '{count} sub-task',
'session.subTasks': '{count} sub-tasks',
'workspace.selectRuntimeSession': 'Select a Runtime Session on the left to view its Work Item board.',
'workspace.noWorkItems': 'No work items yet — start delegation to populate this board.',
'workspace.clickEditTitle': 'Click to edit session title',
'workspace.channel.secretary': 'Secretary',
'workspace.channel.activity': 'Activity',
'workspace.confirmNoRoles': 'Your org has no roles defined.\n\nSet up at least one role before running a task.\n\nGo to Org tab now?',
'workspace.confirmNoDecider': 'Your organization has multiple top-level roles but no final decider selected.\n\nChoose one final decider in the Org tab before running a task.\n\nGo to Org tab now?',
'workspace.warningNoTeams': 'No runtime teams defined — the system will auto-generate from your roles',
'workspace.warningVacantRoles': '{count} role(s) have no employees: {names}',
'workspace.confirmWarnings': 'Before running this task:\n\n{warnings}\n\nRun anyway?',
'kanban.addTask': 'Add task',
'kanban.taskTitle': 'Task title...',
'kanban.startTask': 'Start task',
'kanban.startWorkItem': 'Start Work Item',
'kanban.upstreamDeps': '{count} upstream dep(s)',
'kanban.dep': '{count} dep',
'kanban.crossOffice': 'Cross-office',
'kanban.executionTurn': 'Execution Turn: {id}',
'kanban.column.Todo': 'Todo',
'kanban.column.In Progress': 'In Progress',
'kanban.column.Done': 'Done',
'kanban.column.Ready': 'Ready',
'kanban.column.Running': 'Running',
'kanban.column.Review': 'Review',
'kanban.column.Approved': 'Approved',
'kanban.status.todo': 'To do',
'kanban.status.in_progress': 'In progress',
'kanban.status.in_review': 'In review',
'kanban.status.done': 'Done',
'kanban.status.running': 'Running',
'kanban.status.idle': 'Idle',
'kanban.status.blocked': 'Blocked',
'kanban.status.awaiting_peer': 'Awaiting',
'kanban.status.awaiting_manager_review': 'Mgr Review',
'kanban.status.awaiting_human': 'Human Review',
'kanban.status.awaiting_review': 'In Review',
'kanban.status.failed': 'Failed',
'kanban.status.cancelled': 'Cancelled',
'agent.status.idle': 'Idle',
'agent.status.reflecting': 'Thinking...',
'agent.status.tool_active': 'Running tool',
'agent.summary.active': '{active}/{total} active',
'agent.summary.count': '{count} agent',
'agent.summary.countPlural': '{count} agents',
'org.loading': 'Loading organization data...',
'org.company': 'Company',
'org.customOrg': 'Custom org',
'org.corporateCompany': 'Corporate company',
'org.kind.saved': 'Saved org',
'org.kind.corporate': 'Corporate',
'org.state.editableSaved': 'Editable saved architecture',
'org.state.editableDraft': 'Editable draft architecture',
'org.state.readOnly': 'Built-in read-only architecture',
'org.organization': 'Organization',
'org.corporate': 'Corporate',
'org.newOrganization': 'New organization',
'org.roles': 'roles',
'org.employees': 'employees',
'org.runtimeTeams': 'runtime teams',
'org.tab.team': 'Team',
'org.tab.runtime': 'Runtime',
'org.tab.architecture': 'Architecture',
'org.tab.employees': 'Employees',
'org.createdToast': 'Created {name} and saved automatically',
'org.architectureApplied': 'Architecture applied successfully',
}
type MessageKey = keyof typeof en
const zh: Record<MessageKey, string> = {
'app.page.workspace': '工作台',
'app.page.office': '办公室',
'app.page.org': '组织',
'app.page.mapEditor': '地图编辑',
'app.metric.agents': 'Agent',
'app.metric.skills': '技能',
'app.metric.tasks': '任务',
'language.label': '语言',
'language.english': 'EN',
'language.chinese': '简',
'outdoor.title': '户外光照',
'outdoor.auto': '户外自动',
'outdoor.day': '户外白天',
'outdoor.night': '户外夜晚',
'theme.midnight': '午夜',
'theme.neon': '霓虹',
'theme.paper': '纸张',
'theme.retro': '复古',
'theme.terminal': '终端',
'theme.cozy': '舒适',
'theme.openopc': 'OpenOPC',
'dev.tools': '开发工具',
'dev.connection': '连接',
'dev.evolution': '进化流水线',
'dev.events': '事件',
'dev.channels': '频道',
'dev.phase.trace': '追踪',
'dev.phase.reflect': '反思',
'dev.phase.synthesize': '合成',
'dev.phase.practice': '练习',
'dev.phase.lifecycle': '生命周期',
'project.switch': '切换项目',
'project.new': '新建项目',
'project.delete': '删除项目',
'project.deleteButton': '删',
'project.placeholder': '项目名',
'project.confirmTitle': '删除项目“{name}”?',
'project.confirmBody': '此项目中的所有会话、消息、任务和 Agent 数据都会被永久删除。此操作无法撤销。',
'common.cancel': '取消',
'common.delete': '删除',
'common.yes': '是',
'common.no': '否',
'common.loading': '加载中...',
'common.ready': '就绪',
'common.autoSaved': '已自动保存',
'common.active': '活跃',
'common.idle': '空闲',
'common.general': '通用',
'common.state': '状态',
'common.tool': '工具',
'common.task': '任务',
'common.seat': '座位',
'common.role': '角色',
'common.employee': '员工',
'common.manager': '经理',
'common.origin': '来源',
'common.projection': '投影',
'common.gate': '关卡',
'common.runtime': '运行时',
'office.modeHint.org': '在“组织”页管理你的团队',
'office.modeHint.switch': '切换到“组织”模式以创建或管理 Agent',
'office.offices': '办公室',
'office.activeAgents': '活跃 Agent',
'office.rename': '重命名',
'office.noSeat': '未分配座位',
'office.moveHere': '+ 移到这里',
'office.characters': '角色',
'office.hideSub': '隐藏子项',
'office.showSub': '显示子项',
'office.hideSubagents': '隐藏子 Agent',
'office.showSubagents': '显示子 Agent',
'office.showSidePanel': '显示侧栏',
'office.hideSidePanel': '隐藏侧栏',
'office.removeAgent': '移除 {name}',
'office.deleteQuestion': '删除?',
'office.emptyAgents': '还没有 Agent,点击上方模板生成一个。',
'session.newChat': '新聊天',
'session.secretary': '秘书',
'session.search': '搜索...',
'session.activity': '动态',
'session.noSessions': '还没有会话',
'session.today': '今天',
'session.yesterday': '昨天',
'session.earlier': '更早',
'session.runtimeSuffix': '运行时会话',
'session.justNow': '刚刚',
'session.minutes': '{count} 分钟',
'session.hours': '{count} 小时',
'session.days': '{count} 天',
'session.companyRuntime': '公司运行时',
'session.expand': '展开',
'session.collapse': '折叠',
'session.subTask': '{count} 个子任务',
'session.subTasks': '{count} 个子任务',
'workspace.selectRuntimeSession': '在左侧选择一个运行时会话来查看它的工作项看板。',
'workspace.noWorkItems': '还没有工作项,开始委派后会填充此看板。',
'workspace.clickEditTitle': '点击编辑会话标题',
'workspace.channel.secretary': '秘书',
'workspace.channel.activity': '动态',
'workspace.confirmNoRoles': '你的组织还没有定义角色。\n\n运行任务前请至少设置一个角色。\n\n现在前往“组织”页吗?',
'workspace.confirmNoDecider': '你的组织有多个顶层角色,但尚未选择最终决策者。\n\n运行任务前请在“组织”页选择一个最终决策者。\n\n现在前往“组织”页吗?',
'workspace.warningNoTeams': '尚未定义运行时团队,系统会根据角色自动生成',
'workspace.warningVacantRoles': '{count} 个角色没有员工:{names}',
'workspace.confirmWarnings': '运行此任务前:\n\n{warnings}\n\n仍然运行吗?',
'kanban.addTask': '添加任务',
'kanban.taskTitle': '任务标题...',
'kanban.startTask': '启动任务',
'kanban.startWorkItem': '启动工作项',
'kanban.upstreamDeps': '{count} 个上游依赖',
'kanban.dep': '{count} 依赖',
'kanban.crossOffice': '跨办公室',
'kanban.executionTurn': '执行轮次:{id}',
'kanban.column.Todo': '待办',
'kanban.column.In Progress': '进行中',
'kanban.column.Done': '完成',
'kanban.column.Ready': '就绪',
'kanban.column.Running': '运行中',
'kanban.column.Review': '评审',
'kanban.column.Approved': '已批准',
'kanban.status.todo': '待办',
'kanban.status.in_progress': '进行中',
'kanban.status.in_review': '评审中',
'kanban.status.done': '完成',
'kanban.status.running': '运行中',
'kanban.status.idle': '空闲',
'kanban.status.blocked': '阻塞',
'kanban.status.awaiting_peer': '等待同伴',
'kanban.status.awaiting_manager_review': '经理评审',
'kanban.status.awaiting_human': '人工评审',
'kanban.status.awaiting_review': '评审中',
'kanban.status.failed': '失败',
'kanban.status.cancelled': '已取消',
'agent.status.idle': '空闲',
'agent.status.reflecting': '思考中...',
'agent.status.tool_active': '运行工具',
'agent.summary.active': '{active}/{total} 活跃',
'agent.summary.count': '{count} 个 Agent',
'agent.summary.countPlural': '{count} 个 Agent',
'org.loading': '正在加载组织数据...',
'org.company': '公司',
'org.customOrg': '自定义组织',
'org.corporateCompany': '企业公司',
'org.kind.saved': '已保存组织',
'org.kind.corporate': '企业',
'org.state.editableSaved': '可编辑的已保存架构',
'org.state.editableDraft': '可编辑草稿架构',
'org.state.readOnly': '内置只读架构',
'org.organization': '组织',
'org.corporate': '企业',
'org.newOrganization': '新建组织',
'org.roles': '角色',
'org.employees': '员工',
'org.runtimeTeams': '运行时团队',
'org.tab.team': '团队',
'org.tab.runtime': '运行时',
'org.tab.architecture': '架构',
'org.tab.employees': '员工',
'org.createdToast': '已创建 {name} 并自动保存',
'org.architectureApplied': '架构已成功应用',
}
const dictionaries = { en, 'zh-CN': zh } satisfies Record<Locale, Record<MessageKey, string>>
interface I18nContextValue {
locale: Locale
setLocale: (locale: Locale) => void
t: (key: MessageKey, params?: Record<string, string | number>) => string
translateMaybe: (namespace: string, value: string | undefined | null) => string
}
const I18nContext = createContext<I18nContextValue | null>(null)
function readInitialLocale(): Locale {
try {
const stored = localStorage.getItem(STORAGE_KEY)
if (stored === 'en' || stored === 'zh-CN') return stored
} catch {
// private mode
}
try {
return navigator.language.toLowerCase().startsWith('zh') ? 'zh-CN' : 'en'
} catch {
return 'en'
}
}
function interpolate(template: string, params?: Record<string, string | number>): string {
if (!params) return template
return template.replace(/\{(\w+)\}/g, (_, key: string) => (
Object.prototype.hasOwnProperty.call(params, key) ? String(params[key]) : `{${key}}`
))
}
export function I18nProvider({ children }: { children: ReactNode }) {
const [locale, setLocaleState] = useState<Locale>(() => readInitialLocale())
useEffect(() => {
document.documentElement.lang = locale === 'zh-CN' ? 'zh-CN' : 'en'
}, [locale])
const setLocale = useCallback((next: Locale) => {
setLocaleState(next)
try {
localStorage.setItem(STORAGE_KEY, next)
document.documentElement.lang = next === 'zh-CN' ? 'zh-CN' : 'en'
} catch {
// private mode
}
}, [])
const t = useCallback<I18nContextValue['t']>((key, params) => {
const template = dictionaries[locale][key] ?? dictionaries.en[key] ?? key
return interpolate(template, params)
}, [locale])
const translateMaybe = useCallback<I18nContextValue['translateMaybe']>((namespace, value) => {
const normalized = String(value ?? '').trim()
if (!normalized) return ''
const key = `${namespace}.${normalized}` as MessageKey
return dictionaries[locale][key] ?? normalized
}, [locale])
const value = useMemo<I18nContextValue>(() => ({ locale, setLocale, t, translateMaybe }), [locale, setLocale, t, translateMaybe])
return <I18nContext.Provider value={value}>{children}</I18nContext.Provider>
}
export function useI18n(): I18nContextValue {
const ctx = useContext(I18nContext)
if (!ctx) throw new Error('useI18n must be used within I18nProvider')
return ctx
}
@@ -426,6 +426,41 @@ html, body, #root {
gap: 6px;
}
.language-toggle {
display: inline-flex;
align-items: center;
flex: 0 0 auto;
height: 30px;
padding: 2px;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
background: var(--surface);
}
.language-toggle-btn {
flex: 0 0 auto;
min-width: 34px;
height: 24px;
padding: 0 8px;
border: 0;
border-radius: calc(var(--radius-sm) - 2px);
background: transparent;
color: var(--text-secondary);
font-size: 11px;
line-height: 1;
cursor: pointer;
}
.language-toggle-btn:hover {
color: var(--text);
background: var(--surface-hover);
}
.language-toggle-btn.active {
color: var(--accent);
background: var(--accent-soft);
}
.theme-select {
font-size: 11px;
padding: 4px 8px;
@@ -1,7 +1,8 @@
import { useMemo } from 'react'
import type { AgentInfo } from '../types/visual'
import type { AgentAnimStatus, KanbanTask } from '../types/kanban'
import { AGENT_STATUS_LABEL } from '../types/kanban'
import type { AgentInfo } from '../types/visual'
import type { AgentAnimStatus, KanbanTask } from '../types/kanban'
import { AGENT_STATUS_LABEL } from '../types/kanban'
import { useI18n } from '../i18n'
interface AgentStatusBarProps {
agents: AgentInfo[]
@@ -15,8 +16,9 @@ interface AgentState {
taskDisplayId?: string
}
export function AgentStatusBar({ agents, tasks }: AgentStatusBarProps) {
const agentStates = useMemo<AgentState[]>(() => {
export function AgentStatusBar({ agents, tasks }: AgentStatusBarProps) {
const { t, translateMaybe } = useI18n()
const agentStates = useMemo<AgentState[]>(() => {
const tasksById = new Map(tasks.map((task) => [task.id, task]))
return agents.map(agent => {
// Find the first active (non-idle) task for this agent
@@ -38,36 +40,41 @@ export function AgentStatusBar({ agents, tasks }: AgentStatusBarProps) {
const activeCount = agentStates.filter(s => s.status !== 'idle').length
return (
<div className="agent-status-bar">
<span className="agent-status-summary">
{activeCount > 0
? `${activeCount}/${agents.length} active`
: `${agents.length} agent${agents.length !== 1 ? 's' : ''}`}
</span>
<div className="agent-status-chips">
{agentStates.map(({ agent, status, currentTool, taskDisplayId }) => (
<div
key={agent.agent_id}
className={`agent-status-chip status-${status}`}
title={`${agent.name}: ${status === 'tool_active' && currentTool ? currentTool : AGENT_STATUS_LABEL[status]}${taskDisplayId ? ` (${taskDisplayId})` : ''}`}
>
<span className="agent-status-avatar">{agent.name.charAt(0).toUpperCase()}</span>
<span className="agent-status-name">{agent.name}</span>
{status !== 'idle' && (
<>
<span className="kanban-runtime-dot" />
<span className="agent-status-detail">
{status === 'tool_active' && currentTool ? currentTool : AGENT_STATUS_LABEL[status]}
</span>
</>
)}
{taskDisplayId && (
<span className="agent-status-task">{taskDisplayId}</span>
)}
</div>
))}
</div>
</div>
)
}
return (
<div className="agent-status-bar">
<span className="agent-status-summary">
{activeCount > 0
? t('agent.summary.active', { active: activeCount, total: agents.length })
: t(agents.length !== 1 ? 'agent.summary.countPlural' : 'agent.summary.count', { count: agents.length })}
</span>
<div className="agent-status-chips">
{agentStates.map(({ agent, status, currentTool, taskDisplayId }) => {
const statusLabel = status === 'tool_active' && currentTool
? currentTool
: translateMaybe('agent.status', status) || AGENT_STATUS_LABEL[status]
return (
<div
key={agent.agent_id}
className={`agent-status-chip status-${status}`}
title={`${agent.name}: ${statusLabel}${taskDisplayId ? ` (${taskDisplayId})` : ''}`}
>
<span className="agent-status-avatar">{agent.name.charAt(0).toUpperCase()}</span>
<span className="agent-status-name">{agent.name}</span>
{status !== 'idle' && (
<>
<span className="kanban-runtime-dot" />
<span className="agent-status-detail">
{statusLabel}
</span>
</>
)}
{taskDisplayId && (
<span className="agent-status-task">{taskDisplayId}</span>
)}
</div>
)
})}
</div>
</div>
)
}
@@ -1,4 +1,5 @@
import type { KanbanBoard } from '../types/kanban'
import { useI18n } from '../i18n'
interface BoardSelectorProps {
boards: KanbanBoard[]
@@ -7,6 +8,7 @@ interface BoardSelectorProps {
}
export function BoardSelector({ boards, activeBoardId, onSelect }: BoardSelectorProps) {
const { translateMaybe } = useI18n()
return (
<div className="board-selector">
<div className="board-tabs">
@@ -18,7 +20,7 @@ export function BoardSelector({ boards, activeBoardId, onSelect }: BoardSelector
onClick={() => onSelect(b.id)}
>
<span className="board-tab-dot" style={{ background: b.color }} />
{b.name}
{translateMaybe('kanban.column', b.name) || b.name}
</button>
))}
</div>
@@ -3,6 +3,7 @@ import type { AgentInfo } from '../types/visual'
import { PRIORITY_META, AGENT_STATUS_LABEL, type KanbanTask } from '../types/kanban'
import { getWorkItemRoleLabel, humanizeWorkItemRoleId } from '../lib/workItemIdentity'
import { getLinkedRuntimeTaskId } from '../lib/workItemRuntimeIds'
import { useI18n } from '../i18n'
const STATUS_BADGE: Record<string, { label: string; color: string }> = {
todo: { label: 'To do', color: '#9ca3af' },
@@ -32,7 +33,8 @@ interface KanbanCardProps {
}
export function KanbanCard({ task, index, agents, officeMap, companyMode, isSelected, onClick, onStart }: KanbanCardProps) {
const assignees = task.assigneeIds
const { t, translateMaybe } = useI18n()
const assignees = task.assigneeIds
.map(id => agents.find(a => a.agent_id === id))
.filter(Boolean) as AgentInfo[]
const priority = task.priority ? PRIORITY_META[task.priority] : null
@@ -54,6 +56,9 @@ export function KanbanCard({ task, index, agents, officeMap, companyMode, isSele
const blockerLabel = (task.blockedReason ?? '').trim()
const reworkLabel = (task.reworkFeedback ?? '').trim()
const linkedRuntimeTaskId = getLinkedRuntimeTaskId(task)
const runtimeStatusLabel = task.agentStatus
? (translateMaybe('agent.status', task.agentStatus) || AGENT_STATUS_LABEL[task.agentStatus] || task.agentStatus)
: ''
return (
<Draggable draggableId={task.id} index={index} isDragDisabled={!!companyMode}>
@@ -66,22 +71,22 @@ export function KanbanCard({ task, index, agents, officeMap, companyMode, isSele
data-task-id={task.id}
onMouseUp={e => { if (e.button === 0 && !snapshot.isDragging) onClick(task) }}
>
<div className="kanban-card-top">
<span className="kanban-card-id">{task.displayId}</span>
{statusBadge && (
<span className="kanban-status-badge" style={{ color: statusBadge.color }}>
<span style={{ display: 'inline-block', width: 6, height: 6, borderRadius: '50%', background: statusBadge.color, marginRight: 3 }} />
{statusBadge.label}
</span>
)}
{depCount > 0 && (
<span className="kanban-dep-badge" title={`${depCount} upstream dep(s)`}>{depCount} dep</span>
)}
{crossOffice && <span className="kanban-cross-badge" title="Cross-office">&#x21C4;</span>}
<div className="kanban-card-top">
<span className="kanban-card-id">{task.displayId}</span>
{statusBadge && (
<span className="kanban-status-badge" style={{ color: statusBadge.color }}>
<span style={{ display: 'inline-block', width: 6, height: 6, borderRadius: '50%', background: statusBadge.color, marginRight: 3 }} />
{translateMaybe('kanban.status', phaseBadge) || statusBadge.label}
</span>
)}
{depCount > 0 && (
<span className="kanban-dep-badge" title={t('kanban.upstreamDeps', { count: depCount })}>{t('kanban.dep', { count: depCount })}</span>
)}
{crossOffice && <span className="kanban-cross-badge" title={t('kanban.crossOffice')}>&#x21C4;</span>}
{onStart && (
<button
className="kanban-start-btn"
title={companyMode ? 'Start Work Item' : 'Start task'}
title={companyMode ? t('kanban.startWorkItem') : t('kanban.startTask')}
onClick={e => { e.stopPropagation(); onStart(task.id) }}
>
&#x25B6;
@@ -94,34 +99,34 @@ export function KanbanCard({ task, index, agents, officeMap, companyMode, isSele
{(roleLabel || employee?.name || gate?.type || task.originChannel || task.workItemProjectionId) && (
<div className="kanban-card-meta-row">
{roleLabel && (
<span className="kanban-meta-badge kanban-role-badge" title={`Role: ${roleLabel}`}>
<span className="kanban-meta-badge kanban-role-badge" title={`${t('common.role')}: ${roleLabel}`}>
{roleLabel}
</span>
)}
{employee?.name && (
<span className="kanban-meta-badge kanban-employee-badge" title={`Employee: ${employee.name}${employee.category ? ` (${employee.category})` : ''}`}>
<span className="kanban-meta-badge kanban-employee-badge" title={`${t('common.employee')}: ${employee.name}${employee.category ? ` (${employee.category})` : ''}`}>
<span className="kanban-meta-icon">&#x1F464;</span>
{employee.name}
</span>
)}
{employee.name}
</span>
)}
{task.workItemProjectionId && (
<span className="kanban-meta-badge kanban-projection-badge" title={`Projection: ${task.workItemProjectionId}`}>
<span className="kanban-meta-badge kanban-projection-badge" title={`${t('common.projection')}: ${task.workItemProjectionId}`}>
{task.workItemProjectionId}
</span>
)}
{gate?.type && (
<span className={`kanban-meta-badge kanban-gate-badge kanban-gate-${gate.type}`} title={`Gate: ${gate.type}${gate.reviewerRole ? ` by ${gate.reviewerRole}` : ''}`}>
{gate.type === 'review' ? '\u2709' : gate.type === 'approval' ? '\u2713' : '\u270B'}
{gate.type}
</span>
)}
{gate?.type && (
<span className={`kanban-meta-badge kanban-gate-badge kanban-gate-${gate.type}`} title={`${t('common.gate')}: ${gate.type}${gate.reviewerRole ? ` by ${gate.reviewerRole}` : ''}`}>
{gate.type === 'review' ? '\u2709' : gate.type === 'approval' ? '\u2713' : '\u270B'}
{gate.type}
</span>
)}
{task.originChannel && (
<span className="kanban-meta-badge kanban-origin-badge" title={`Origin: ${task.originChannel}`}>
<span className="kanban-meta-badge kanban-origin-badge" title={`${t('common.origin')}: ${task.originChannel}`}>
#{task.originChannel}
</span>
)}
{managerLabel && (
<span className="kanban-meta-badge" title={`Manager: ${managerLabel}`}>
<span className="kanban-meta-badge" title={`${t('common.manager')}: ${managerLabel}`}>
{managerLabel}
</span>
)}
@@ -133,8 +138,8 @@ export function KanbanCard({ task, index, agents, officeMap, companyMode, isSele
{blockerLabel && <span className="kanban-tag">{blockerLabel}</span>}
{reworkLabel && <span className="kanban-tag">{reworkLabel}</span>}
{linkedRuntimeTaskId && (
<span className="kanban-tag" title={`Execution Turn: ${linkedRuntimeTaskId}`}>
Runtime
<span className="kanban-tag" title={t('kanban.executionTurn', { id: linkedRuntimeTaskId })}>
{t('common.runtime')}
</span>
)}
</div>
@@ -144,10 +149,10 @@ export function KanbanCard({ task, index, agents, officeMap, companyMode, isSele
<div className={`kanban-card-runtime status-${task.agentStatus}`}>
<span className="kanban-runtime-dot" />
<span className="kanban-runtime-label">
{task.agentStatus === 'tool_active' && task.currentTool
? task.currentTool
: AGENT_STATUS_LABEL[task.agentStatus!] ?? task.agentStatus}
</span>
{task.agentStatus === 'tool_active' && task.currentTool
? task.currentTool
: runtimeStatusLabel}
</span>
</div>
)}
@@ -1,8 +1,9 @@
import { useCallback, useRef, useState } from 'react'
import { Droppable } from '@hello-pangea/dnd'
import type { AgentInfo } from '../types/visual'
import type { KanbanColumn as KanbanColumnType, KanbanTask } from '../types/kanban'
import { KanbanCard } from './KanbanCard'
import type { AgentInfo } from '../types/visual'
import type { KanbanColumn as KanbanColumnType, KanbanTask } from '../types/kanban'
import { KanbanCard } from './KanbanCard'
import { useI18n } from '../i18n'
interface KanbanColumnProps {
column: KanbanColumnType
@@ -17,7 +18,8 @@ interface KanbanColumnProps {
}
export function KanbanColumn({ column, tasks, agents, officeMap, companyMode, selectedTaskId, onCardClick, onStartTask, onQuickCreate }: KanbanColumnProps) {
const [adding, setAdding] = useState(false)
const { t, translateMaybe } = useI18n()
const [adding, setAdding] = useState(false)
const [draft, setDraft] = useState('')
const committedRef = useRef(false)
@@ -35,12 +37,12 @@ export function KanbanColumn({ column, tasks, agents, officeMap, companyMode, se
return (
<div className="kanban-column">
<div className="kanban-column-header">
<span className="kanban-col-dot" style={{ background: column.color }} />
<span className="kanban-col-label">{column.name}</span>
<span className="kanban-col-count">{tasks.length}</span>
{onQuickCreate && (
<button className="kanban-col-add" title="Add task" onClick={() => { committedRef.current = false; setAdding(true) }}>+</button>
)}
<span className="kanban-col-dot" style={{ background: column.color }} />
<span className="kanban-col-label">{translateMaybe('kanban.column', column.name) || column.name}</span>
<span className="kanban-col-count">{tasks.length}</span>
{onQuickCreate && (
<button className="kanban-col-add" title={t('kanban.addTask')} onClick={() => { committedRef.current = false; setAdding(true) }}>+</button>
)}
</div>
{adding && (
@@ -54,7 +56,7 @@ export function KanbanColumn({ column, tasks, agents, officeMap, companyMode, se
if (e.key === 'Escape') { committedRef.current = true; setDraft(''); setAdding(false) }
}}
onBlur={commitAdd}
placeholder="Task title..."
placeholder={t('kanban.taskTitle')}
autoFocus
/>
</div>
+4 -1
View File
@@ -1,6 +1,7 @@
import React from 'react'
import { createRoot } from 'react-dom/client'
import App from './App'
import { I18nProvider } from './i18n'
import './index.css'
class ErrorBoundary extends React.Component<
@@ -66,7 +67,9 @@ if (!root) {
try {
createRoot(root).render(
<ErrorBoundary>
<App />
<I18nProvider>
<App />
</I18nProvider>
</ErrorBoundary>
)
} catch (err) {
@@ -18,6 +18,7 @@ import { EmployeesMarketplace } from './EmployeesMarketplace'
import { ConfigImportExportPanel } from './ConfigImportExportPanel'
import { OrgCreateModal } from './OrgCreateModal'
import { getRuntimeOrgView } from '../lib/runtimeOrg'
import { useI18n } from '../i18n'
import './org.css'
import './team.css'
import './marketplace.css'
@@ -122,6 +123,7 @@ export function OrgTab({
onSavedOrgsList, onSavedOrgSaveAs, onSavedOrgCreate, onSavedOrgLoad, onSavedOrgDelete, savedOrgsList,
activeSavedOrg, activeSavedOrgVersionAtLoad, orgCreatePending, orgCreateResult, onSelectCorporate,
}: OrgTabProps) {
const { t } = useI18n()
const [activeTab, setActiveTab] = useState<SubTab>('team')
const [createOpen, setCreateOpen] = useState(false)
@@ -166,8 +168,8 @@ export function OrgTab({
if (!orgCreateResult || !orgCreateResult.ok) return
setCreateOpen(false)
setActiveTab('team')
showToast(`Created ${orgCreateResult.organization_name || orgCreateResult.name} and saved automatically`)
}, [orgCreateResult, showToast])
showToast(t('org.createdToast', { name: orgCreateResult.organization_name || orgCreateResult.name }))
}, [orgCreateResult, showToast, t])
// In org mode: show only user-owned roles. In company mode: show all roles read-only.
const allRoles = data?.roles ?? []
@@ -176,13 +178,13 @@ export function OrgTab({
const runtimeView = useMemo(() => getRuntimeOrgView(data), [data])
const activeAgents = useMemo(() => displayEmployees.filter(e => e.linked_agent_id), [displayEmployees])
const configuredOrgName = data?.organization_name?.trim()
const activeOrgLabel = configuredOrgName || humanizeOrgName(activeSavedOrg) || (isCustomMode ? 'Custom org' : 'Corporate company')
const activeOrgLabel = configuredOrgName || humanizeOrgName(activeSavedOrg) || (isCustomMode ? t('org.customOrg') : t('org.corporateCompany'))
const activeOrgId = (isCustomMode ? (data?.organization_id || activeSavedOrg) : 'corporate') || ''
const architectureKindLabel = isCustomMode ? 'Saved org' : 'Corporate'
const architectureKindLabel = isCustomMode ? t('org.kind.saved') : t('org.kind.corporate')
const architectureStateLabel = isCustomMode
? activeSavedOrg ? 'Editable saved architecture' : 'Editable draft architecture'
: 'Built-in read-only architecture'
const runtimeStateLabel = runtimeView.frontier.status || runtimeView.projectRun?.status || runtimeView.projectRun?.lifecycle_status || 'ready'
? activeSavedOrg ? t('org.state.editableSaved') : t('org.state.editableDraft')
: t('org.state.readOnly')
const runtimeStateLabel = runtimeView.frontier.status || runtimeView.projectRun?.status || runtimeView.projectRun?.lifecycle_status || t('common.ready')
// Roles that already have at least one non-placeholder employee.
const filledRoleIds = useMemo(
@@ -210,9 +212,9 @@ export function OrgTab({
setApplyingPresetId(null)
versionAtApply.current = -1
setActiveTab('team')
showToast('Architecture applied successfully')
showToast(t('org.architectureApplied'))
}
}, [orgVersion, applyingPresetId, showToast])
}, [orgVersion, applyingPresetId, showToast, t])
const handleApplyPreset = (presetId: string, strategy: string) => {
versionAtApply.current = orgVersion // snapshot current version
@@ -232,7 +234,7 @@ export function OrgTab({
}
if (!data) {
return <div className="org-tab"><div className="org-loading">Loading organization data...</div></div>
return <div className="org-tab"><div className="org-loading">{t('org.loading')}</div></div>
}
const installedPackages = data.installed_packages ?? []
@@ -244,7 +246,7 @@ export function OrgTab({
<div className={`org-header${isCustomMode ? ' org-header--custom' : ' org-header--corporate'}`}>
<div className="org-header-main">
<div className="org-eyebrow">
<span>Company</span>
<span>{t('org.company')}</span>
<span className="org-eyebrow-separator">/</span>
<span>{architectureKindLabel}</span>
</div>
@@ -259,13 +261,13 @@ export function OrgTab({
<span className="org-meta-pill">{data.company_profile || (isCustomMode ? 'custom' : 'corporate')}</span>
{activeOrgId && <code className="org-meta-code">{activeOrgId}</code>}
<span className="org-meta-pill org-meta-pill--runtime">{runtimeStateLabel}</span>
<span className="org-meta-pill org-meta-pill--saved">Auto-saved</span>
<span className="org-meta-pill org-meta-pill--saved">{t('common.autoSaved')}</span>
</div>
</div>
<div className="org-control-panel">
<label className="org-switcher">
<span className="org-switcher-label">Organization</span>
<span className="org-switcher-label">{t('org.organization')}</span>
<span className="org-switcher-select-wrap">
<select
className="org-switcher-select"
@@ -273,9 +275,9 @@ export function OrgTab({
onChange={e => handleOrgSelection(e.target.value)}
onFocus={() => onSavedOrgsList?.()}
onPointerDown={() => onSavedOrgsList?.()}
aria-label="Organization"
aria-label={t('org.organization')}
>
<option value="corporate">Corporate</option>
<option value="corporate">{t('org.corporate')}</option>
{savedOrgOptions.map(org => (
<option key={org.name} value={`org:${org.name}`}>
{(org.organization_name || org.name).trim() || org.name}
@@ -286,36 +288,36 @@ export function OrgTab({
</label>
<button type="button" className="org-create-trigger" onClick={() => setCreateOpen(true)}>
<span className="org-create-trigger-icon" aria-hidden>+</span>
New organization
{t('org.newOrganization')}
</button>
</div>
<div className="org-stats-strip">
<span className="org-stat">
<img src={STAT_ICON.agents} alt="" className="org-stat-icon" />
<b>{displayRoles.length}</b> roles
<b>{displayRoles.length}</b> {t('org.roles')}
</span>
<span className="org-stat">
<img src={TAB_ICON.employees} alt="" className="org-stat-icon" />
<b>{displayEmployees.length}</b> employees
<b>{displayEmployees.length}</b> {t('org.employees')}
</span>
<span className="org-stat">
<img src={TAB_ICON.runtime} alt="" className="org-stat-icon" />
<b>{runtimeView.runtimeTeams.length}</b> runtime teams
<b>{runtimeView.runtimeTeams.length}</b> {t('org.runtimeTeams')}
</span>
<span className="org-stat">
<img src={STAT_ICON.active} alt="" className="org-stat-icon" />
<b>{activeAgents.length}</b> active
<b>{activeAgents.length}</b> {t('common.active')}
</span>
</div>
</div>
<div className="org-subtabs">
{([
{ id: 'team' as SubTab, icon: TAB_ICON.team, label: 'Team', count: displayRoles.length },
{ id: 'runtime' as SubTab, icon: TAB_ICON.runtime, label: 'Runtime', count: runtimeView.runtimeTeams.length },
{ id: 'architecture' as SubTab, icon: TAB_ICON.architecture, label: 'Architecture', count: marketPresets?.length ?? 0 },
{ id: 'employees' as SubTab, icon: TAB_ICON.employees, label: 'Employees', count: talents.length },
{ id: 'team' as SubTab, icon: TAB_ICON.team, label: t('org.tab.team'), count: displayRoles.length },
{ id: 'runtime' as SubTab, icon: TAB_ICON.runtime, label: t('org.tab.runtime'), count: runtimeView.runtimeTeams.length },
{ id: 'architecture' as SubTab, icon: TAB_ICON.architecture, label: t('org.tab.architecture'), count: marketPresets?.length ?? 0 },
{ id: 'employees' as SubTab, icon: TAB_ICON.employees, label: t('org.tab.employees'), count: talents.length },
]).map(tab => (
<button key={tab.id}
className={`org-subtab${activeTab === tab.id ? ' org-subtab--active' : ''}`}
@@ -22,6 +22,7 @@ import { getRuntimeOrgView } from '../lib/runtimeOrg'
import { getLinkedRuntimeTaskId } from '../lib/workItemRuntimeIds'
import { ContextPanel } from './ContextPanel'
import { useResizePanel } from './useResizePanel'
import { useI18n } from '../i18n'
type ActiveView =
| { kind: 'session'; taskId: string }
@@ -42,11 +43,25 @@ function makeOptimisticUserMessageId(): string {
/* ── Org mode pre-run readiness check ─────────────────────────────────── */
type TFunction = ReturnType<typeof useI18n>['t']
function checkOrgModeReadiness(
mode: string,
orgInfoData: OrgInfoPayload | null | undefined,
onNavigateToOrg?: () => void,
t?: TFunction,
): boolean {
const tr = t ?? ((key: string, params?: Record<string, string | number>) => {
const fallbacks: Record<string, string> = {
'workspace.confirmNoRoles': 'Your org has no roles defined.\n\nSet up at least one role before running a task.\n\nGo to Org tab now?',
'workspace.confirmNoDecider': 'Your organization has multiple top-level roles but no final decider selected.\n\nChoose one final decider in the Org tab before running a task.\n\nGo to Org tab now?',
'workspace.warningNoTeams': 'No runtime teams defined — the system will auto-generate from your roles',
'workspace.warningVacantRoles': '{count} role(s) have no employees: {names}',
'workspace.confirmWarnings': 'Before running this task:\n\n{warnings}\n\nRun anyway?',
}
const template = fallbacks[key] ?? key
return template.replace(/\{(\w+)\}/g, (_, name) => String(params?.[name] ?? `{${name}}`))
}) as TFunction
if (mode !== 'org' && mode !== 'custom') return true
if (!orgInfoData) return true
@@ -57,21 +72,13 @@ function checkOrgModeReadiness(
// Block: no roles defined
if (roles.length === 0) {
const goToOrg = confirm(
'Your org has no roles defined.\n\n' +
'Set up at least one role before running a task.\n\n' +
'Go to Org tab now?'
)
const goToOrg = confirm(tr('workspace.confirmNoRoles'))
if (goToOrg) onNavigateToOrg?.()
return false
}
if (topLevelRoleIds.length > 1 && !finalDeciderRoleId) {
const goToOrg = confirm(
'Your organization has multiple top-level roles but no final decider selected.\n\n' +
'Choose one final decider in the Org tab before running a task.\n\n' +
'Go to Org tab now?'
)
const goToOrg = confirm(tr('workspace.confirmNoDecider'))
if (goToOrg) onNavigateToOrg?.()
return false
}
@@ -84,7 +91,7 @@ function checkOrgModeReadiness(
|| (team.manager_role_id && roleIds.has(team.manager_role_id))
))
if (relevantTeams.length === 0) {
warnings.push('No runtime teams defined \u2014 the system will auto-generate from your roles')
warnings.push(tr('workspace.warningNoTeams'))
}
// Warn: roles without employees
@@ -92,15 +99,11 @@ function checkOrgModeReadiness(
const vacantRoles = roles.filter(r => !employeeRoleIds.has(r.role_id))
if (vacantRoles.length > 0) {
const names = vacantRoles.map(r => r.name).join(', ')
warnings.push(`${vacantRoles.length} role(s) have no employees: ${names}`)
warnings.push(tr('workspace.warningVacantRoles', { count: vacantRoles.length, names }))
}
if (warnings.length > 0) {
return confirm(
'Before running this task:\n\n' +
warnings.map(w => '\u2022 ' + w).join('\n') +
'\n\nRun anyway?'
)
return confirm(tr('workspace.confirmWarnings', { warnings: warnings.map(w => '\u2022 ' + w).join('\n') }))
}
return true
@@ -158,6 +161,7 @@ function BoardTitleEditor({
title: string
onCommit: (next: string) => void
}) {
const { t } = useI18n()
const [editing, setEditing] = useState(false)
const [draft, setDraft] = useState(title)
const inputRef = useRef<HTMLInputElement>(null)
@@ -206,7 +210,7 @@ function BoardTitleEditor({
<span
className="board-tab-title"
onClick={startEditing}
title="Click to edit session title"
title={t('workspace.clickEditTitle')}
>
{title}
</span>
@@ -310,6 +314,7 @@ export function WorkspacePage({
onSavedOrgsList,
onSavedOrgLoad,
}: WorkspacePageProps) {
const { t } = useI18n()
const { sessions, activeSessionId, activeSession } = sessionStore
const { markRead } = chatStore
@@ -933,7 +938,7 @@ export function WorkspacePage({
: undefined
// Pre-run readiness check for org mode
if (!checkOrgModeReadiness(sessionExecMode, orgInfoData, onNavigateToOrg)) {
if (!checkOrgModeReadiness(sessionExecMode, orgInfoData, onNavigateToOrg, t)) {
return
}
@@ -948,7 +953,7 @@ export function WorkspacePage({
if (inProgressCol) {
boardStore.moveTask(taskId, inProgressCol.id, 0)
}
}, [boardStore, onRunTask, sessions, execMode, companyProfile, orgInfoData, onNavigateToOrg])
}, [boardStore, onRunTask, sessions, execMode, companyProfile, orgInfoData, onNavigateToOrg, t])
const handleSessionConfigChange = useCallback((taskId: string, sessionMode: string, sessionCompanyProfile?: string, orgId?: string) => {
onSessionConfigChange?.(taskId, sessionMode, sessionCompanyProfile, orgId)
@@ -1094,7 +1099,7 @@ export function WorkspacePage({
}, [handleOpenWorkItemSession, onOpenExecutionPanel])
const isSecretary = effectiveView.kind === 'secretary'
const channelName = isSecretary ? 'Secretary' : activeSession ? activeSession.title : 'Activity'
const channelName = isSecretary ? t('workspace.channel.secretary') : activeSession ? activeSession.title : t('workspace.channel.activity')
return (
<div className={`workspace-page${panelState === 'maximized' ? ' panel-maximized' : ''}`}>
@@ -1137,7 +1142,7 @@ export function WorkspacePage({
)}
{isCompanyMode && !boardStore.activeBoard ? (
<div className="kanban-empty-state">
<p>Select a Runtime Session on the left to view its Work Item board.</p>
<p>{t('workspace.selectRuntimeSession')}</p>
</div>
) : (
<>
@@ -1156,7 +1161,7 @@ export function WorkspacePage({
/>
{isCompanyMode && boardStore.activeBoard && boardStore.tasks.filter(t => t.boardId === boardStore.activeBoardId).length === 0 && (
<div className="kanban-empty-state kanban-empty-state-inline">
<p>No work items yet — start delegation to populate this board.</p>
<p>{t('workspace.noWorkItems')}</p>
</div>
)}
</>