fix(ui): reconcile runtime status so stale chips converge without a refresh (#11)

Live status deltas are one-shot best-effort broadcasts: a delta lost to a
disconnect window, a project-scope drop, or a not-ready store left the UI
stuck on a stale status ("thinking" vs stopped) until a hard refresh, which
rebuilds from the always-correct snapshot. Close the class, not the sites:

- Add a low-frequency runtime_status_sync reconciliation broadcast: every
  12s (lazily started, cancelled on shutdown) re-broadcast the persisted
  status + in-memory tracker state of every task with a live runtime, plus
  one final tick for tasks that just ended. Candidates come purely from
  in-memory registries (no table scans); idle system pays nothing.
- Frontend consumes it diff-before-dispatch: a tick where nothing drifted
  triggers zero store updates and zero re-renders; clearing mirrors the
  mergeLiveRuntimeField semantics already used by collab_sync.
- Fix the EventAdapter tracker state machine: tool_completed returns to
  REFLECTING (the turn is still running), and turn_completed/turn_failed
  now transition to IDLE and emit an authoritative idle runtime update.
- Guarantee the terminal board_task_status_changed in _run_session_task's
  finally: a cancelled run previously skipped it, leaving the board on
  "running". The fallback mirrors persisted state read-only.

Verified: 7 new tests in test_runtime_status_sync.py; 236 backend tests
pass with zero new failures; tsc clean; frontend structural tests pass;
dist rebuilt.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
LZH-YS1998andClaude Fable 5 committed 2026-07-21 12:54:46 +08:00
1 parent b73a5a14c3
commit 0c6925402c
8 files changed
+440 -60

No files matched your search

+7
View File
@@ -207,6 +207,8 @@ class EventAdapter:
results.append(_ve(agent_id, runtime_type, dict(p)))
if runtime_type in {
"turn_started",
"turn_completed",
"turn_failed",
"tool_started",
"tool_progress",
"tool_completed",
@@ -233,6 +235,11 @@ class EventAdapter:
elif runtime_type in {"turn_started", "permission_requested", "permission_resolved", "subagent_started", "subagent_updated", "verification_started"}:
tracker.state = AgentAnimState.REFLECTING
elif runtime_type in {"tool_completed", "subagent_completed", "verification_completed"}:
# The turn is still running between tools — the agent is
# back to reasoning, not idle. IDLE is owned by turn end.
tracker.current_tool = None
tracker.state = AgentAnimState.REFLECTING
elif runtime_type in {"turn_completed", "turn_failed"}:
tracker.current_tool = None
tracker.state = AgentAnimState.IDLE
extras: dict[str, Any] = {}
@@ -1,23 +1,23 @@
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
import{g as ma,r as YM}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 XM(){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 KM(){return jk||(jk=1,lg.exports=XM()),lg.exports}var u=KM(),cg={exports:{}},Ct={};var Ek;function ZM(){if(Ek)return Ct;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 oe=!1;if(U===null)oe=!0;else switch(te){case"bigint":case"string":case"number":oe=!0;break;case"object":switch(U.$$typeof){case e:case t:oe=!0;break;case h:return oe=U._init,$(oe(U._payload),Z,F,K,ee)}}if(oe)return ee=ee(U),oe=K===""?"."+P(U,0):K,O(ee)?(F="",oe!=null&&(F=oe.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,"$&/")+"/")+oe)),Z.push(ee)),1;oe=0;var ae=K===""?".":K+":";if(O(U))for(var ue=0;ue<U.length;ue++)K=U[ue],te=ae+P(K,ue),oe+=$(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++),oe+=$(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 oe}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(`
`+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 Ie=function(){throw Error()};if(Object.defineProperty(Ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ie,[])}catch(_e){var xe=_e}Reflect.construct(s,[],Ie)}else{try{Ie.call()}catch(_e){xe=_e}s.call(Ie.prototype)}}else{try{throw Error()}catch(_e){xe=_e}(Ie=s())&&typeof Ie.catch=="function"&&Ie.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`
`+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:"")?qe(f):""}function pt(s,l){switch(s.tag){case 26:case 27:case 5:return qe(s.type);case 16:return qe("Lazy");case 13:return s.child!==l&&l!==null?qe("Suspense Fallback"):qe("Suspense");case 19:return qe("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 qe("Activity");default:return""}}function Ut(s){try{var l="",f=null;do l+=pt(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
`+y.stack}}var Pt=Object.prototype.hasOwnProperty,It=e.unstable_scheduleCallback,he=e.unstable_cancelCallback,Be=e.unstable_shouldYield,at=e.unstable_requestPaint,Ue=e.unstable_now,ct=e.unstable_getCurrentPriorityLevel,pe=e.unstable_ImmediatePriority,be=e.unstable_UserBlockingPriority,Ae=e.unstable_NormalPriority,He=e.unstable_LowPriority,Ye=e.unstable_IdlePriority,$t=e.log,yt=e.unstable_setDisableYieldValue,ke=null,We=null;function Qe(s){if(typeof $t=="function"&&yt(s),We&&typeof We.setStrictMode=="function")try{We.setStrictMode(ke,s)}catch{}}var Fe=Math.clz32?Math.clz32:ei,Ve=Math.log,Gt=Math.LN2;function ei(s){return s>>>=0,s===0?32:31-(Ve(s)/Gt|0)|0}var _t=256,kt=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 jt(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 Ht(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 ht(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-Fe(f),Ie=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&=~Ie}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-Fe(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-Fe(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),Vt="__reactFiber$"+wn,Cn="__reactProps$"+wn,Xt="__reactContainer$"+wn,Re="__reactEvents$"+wn,wt="__reactListeners$"+wn,bn="__reactHandles$"+wn,wi="__reactResources$"+wn,In="__reactMarker$"+wn;function At(s){delete s[Vt],delete s[Cn],delete s[Re],delete s[wt],delete s[bn]}function yi(s){var l=s[Vt];if(l)return l;for(var f=s.parentNode;f;){if(l=f[Xt]||f[Vt]){if(f=l.alternate,l.child!==null||f!==null&&f.child!==null)for(s=nk(s);s!==null;){if(f=s[Vt])return f;s=nk(s)}return l}s=f,f=s.parentNode}return null}function Zn(s){if(s=s[Vt]||s[Xt]){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 Kt(s){s[In]=!0}var Mt=new Set,Zt={};function Un(s,l){dn(s,l),dn(s+"Capture",l)}function dn(s,l){for(Zt[s]=l,s=0;s<l.length;s++)Mt.add(l[s])}var Je=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u2 Line truncated
`).replace(gM,"")}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&&Wt("scroll",s);break;case"onScrollEnd":y!=null&&Wt("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":Wt("beforetoggle",s),Wt("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&&Wt("scroll",s);break;case"onScrollEnd":y!=null&&Wt("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}
${oe}
]
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
]`})(),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 c4=0;function gi(e,t,n={}){return{event_id:`test-${++c4}`,type:e,agent_id:t,data:n,timestamp:Date.now()/1e3}}function Pn(e){return new Promise(t=>setTimeout(t,e))}async function u4(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
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 b4=(e,t)=>Math.abs(e-t)<1.01,_4=(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}},k4=e=>e,S4=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},w4=(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,C4=(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?()=>{}:_4(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)}},j4=(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"]},E4=(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 N4{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:k4,rangeExtractor:S4,onChange:()=>{},measureElement:j4,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(`
@@ -25,21 +25,21 @@ ${ae}
`).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,`
`).trim()),t5(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
`).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 i5(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 fE(e){if($x(e)<=0)return"";const t=dE(e);if(t)return`result:${t}`;const n=n5(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 r5(e){const t={};for(const n of e??[]){const i=`${n.summary??""} ${n.detail??""}`.trim();if(!i)continue;const r=Q4.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=e5.exec(i);if(o){t.contextRemainingPct=cS(tf(o[1]));continue}const a=J4.exec(i);if(a){const c=cS(tf(a[1]));typeof c=="number"&&(t.contextRemainingPct=100-c)}}return t}function qf(e){const t=r5(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 mE(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 s5(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"||!s5(e)?n:mE([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 o5(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=uE(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=mE([n,...o]),c=o5(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=`
`),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 SE=gD;function yD(e){const{children:t,context:n,serverState:i,store:r}=e,o=C.useMemo(()=>{const d=bE(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||kE;return C.createElement(c.Provider,{value:o},t)}var xD=yD,vD="Invariant failed";function bD(e,t){throw new Error(vD)}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}},_D=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)&&bD(),r},kD=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=_D(i,n);return Gv({borderBox:c,border:r,margin:o,padding:a})},Qf=function(t,n){return n===void 0&&(n=kD()),Zf(t,n)},wE=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})},CE=function(t){var n=t.getBoundingClientRect(),i=window.getComputedStyle(t);return wE(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 jE(e,t){}jE.bind(null,"warn");jE.bind(null,"error");function _o(){}function SD(e,t){return{...e,...t}}function Tr(e,t,n){const i=t.map(r=>{const o=SD(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 wD="Invariant failed";class em extends Error{}em.prototype.toString=function(){return this.message};function Le(e,t){throw new em(wD)}let CD=class extends Rt.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 jD=`
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=>`
`,tm=e=>e+1,ED=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?`
`,EE=(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}
`:`
@@ -47,38 +47,38 @@ ${te.current.stack}
in list ${e.droppableId}
to list ${t.droppableId}
in position ${r}
`},EE=(e,t,n)=>t.droppableId===n.droppableId?`
`},NE=(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=>`
`,ND=e=>{const t=e.destination;if(t)return EE(e.source,t);const n=e.combine;return n?NE(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`
`,ID=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)}
${EE(e.source,t)}
`:n?`
You have dropped the item.
${EE(e.draggableId,e.source,n)}
${NE(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
`},Mf={dragHandleUsageInstructions:jD,onDragStart:ED,onDragUpdate:ND,onDragEnd:ID};function TD(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function IE(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!TD(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&&IE(t,r.current.inputs))?r.current:{inputs:t,result:e()};return C.useEffect(()=>{i.current=!1,r.current=a},[a]),a.result}function rt(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))),TE=e=>t=>({x:e(t.x),y:e(t.y)});var RD=(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}],AD={top:0,right:0,bottom:0,left:0},MD=(e,t)=>t?zu(e,t.scroll.diff.displacement):e,DD=(e,t,n)=>n&&n.increasedBy?{...e,[t.end]:e[t.end]+n.increasedBy[t.line]}:e,OD=(e,t)=>t&&t.shouldClipSubject?RD(t.pageMarginBox,e):$r(e);var Sl=({page:e,withPlaceholder:t,axis:n,frame:i})=>{const r=MD(e.marginBox,i),o=DD(r,n,t),a=OD(o,i);return{page:e,withPlaceholder:t,active:a}},qv=(e,t)=>{e.frame||Le();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=IE){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 RE=_i(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),AE=_i(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),Lm=_i(e=>Object.values(e)),LD=_i(e=>Object.values(e));var Vl=_i((e,t)=>LD(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)),zD=({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&&Le();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 ME={point:ki,value:0},vu={invisible:{},visible:{},all:[]},PD={displaced:vu,displacedBy:ME,at:null};var Rr=(e,t)=>n=>e<=n&&n<=t,DE=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}},BD=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"},OE={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var $D=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 HD=(e,t)=>{const n=t.frame?t.frame.scroll.diff.displacement:ki;return zu(e,n)},FD=(e,t,n)=>t.subject.active?n(t.subject.active)(e):!1,VD=(e,t,n)=>n(t)(e),Xv=({target:e,destination:t,viewport:n,withDroppableDisplacement:i,isVisibleThroughFrameFn:r})=>{const o=i?HD(e,t):e;return FD(o,t,r)&&VD(o,n,r)},UD=e=>Xv({...e,isVisibleThroughFrameFn:DE}),LE=e=>Xv({...e,isVisibleThroughFrameFn:BD}),GD=e=>Xv({...e,isVisibleThroughFrameFn:$D(e.destination.axis)}),qD=(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 WD(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=`
`,resting:c,dragging:YL,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:`
`;return{selector:t(Yx.contextId),styles:{dragging:c,dropAnimating:c,userCancel:c}}})(),r={selector:t(qL.contextId),styles:{always:"overflow-anchor: none;"}},a=[i,n,r,{selector:"body",styles:{dragging:`
cursor: grabbing;
cursor: -webkit-grabbing;
user-select: none;
@@ -86,49 +86,49 @@ ${te.current.stack}
-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
`}}];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||Le(),e},qS=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function KL(e,t){const n=rn(()=>XL(e),[e]),i=C.useRef(null),r=C.useRef(null),o=rt(_i(p=>{const g=r.current;g||Le(),g.textContent=p}),[]),a=rt(p=>{const g=i.current;g||Le(),g.textContent=p},[]);pr(()=>{!i.current&&!r.current||Le();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;_||Le(),Rg().removeChild(_),v.current=null};x(i),x(r)}},[t,a,o,n.always,n.resting,e]);const c=rt(()=>o(n.dragging),[o,n.dragging]),d=rt(p=>{if(p==="DROP"){o(n.dropAnimating);return}o(n.userCancel)},[o,n.dropAnimating,n.userCancel]),m=rt(()=>{r.current&&o(n.resting)},[o,n.resting]);return rn(()=>({dragging:c,dropping:d,resting:m}),[c,d,m])}function cN(e,t){return Array.from(e.querySelectorAll(t))}var uN=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function $m(e){return e instanceof uN(e).HTMLElement}function ZL(e,t){const n=`[${Cl.contextId}="${e}"]`,i=cN(document,n);if(!i.length)return null;const r=i.find(o=>o.getAttribute(Cl.draggableId)===t);return!r||!$m(r)?null:r}function QL(e){const t=C.useRef({}),n=C.useRef(null),i=C.useRef(null),r=C.useRef(!1),o=rt(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=rt(function(g){const x=ZL(e,g);x&&x!==document.activeElement&&x.focus()},[e]),c=rt(function(g,x){n.current===g&&(n.current=x)},[]),d=rt(function(){i.current||r.current&&(i.current=requestAnimationFrame(()=>{i.current=null;const g=n.current;g&&a(g)}))},[a]),m=rt(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 JL(){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||Le(),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||Le(),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 e6(){const e=rn(JL,[]);return C.useEffect(()=>function(){e.clean()},[e]),e}var o0=Rt.createContext(null),im=()=>{const e=document.body;return e||Le(),e};const t6={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},n6=e=>`rfd-announcement-${e}`;function i6(e){const t=rn(()=>n6(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,t6),im().appendChild(o),function(){setTimeout(function(){const d=im();d.contains(o)&&d.removeChild(o),o===n.current&&(n.current=null)})}},[t]),rt(r=>{const o=n.current;if(o){o.textContent=r;return}},[])}const r6={separator:"::"};function a0(e,t=r6){const n=Rt.useId();return rn(()=>`${e}${t.separator}${n}`,[t.separator,e,n])}function s6({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function o6({contextId:e,text:t}){const n=a0("hidden-text",{separator:"-"}),i=rn(()=>s6({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=Rt.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 j8(){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(C8());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 E8(){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 N8(){if(fw)return Vc;fw=1;var e=Vc&&Vc.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},t=e(j8()),n=E8();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 I8=N8();const T8=ma(I8),LN=zN("end"),m0=zN("start");function zN(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 R8(e){const t=m0(e),n=LN(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,A8=new Map,M8=/[A-Z]/g,D8=new Set(["table","tbody","thead","tfoot","tr"]),O8=new Set(["td","th"]),PN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function L8(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:`
`;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 UB(e){const i={constructs:VN([$B,...(e||{}).extensions||[]]),content:r(sP),defined:[],document:r(aP),flow:r(CB),lazy:{},string:r(NB),text:r(IB)};return i;function r(o){return a;function a(c){return HB(i,o,c)}}}function GB(e){for(;!YN(e););return e}const ww=/[\0\t\n\r]/g;function qB(){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 WB=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function YB(e){return e.replace(WB,XB)}function XB(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const r=n.charCodeAt(1),o=r===120||r===88;return UN(n.slice(o?2:1),o?16:10)}return x0(n)||e}const eI={}.hasOwnProperty;function KB(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),ZB(n)(GB(UB(n).document().write(qB()(e,t,!0))))}function ZB(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Pt),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(qe),hardBreakEscape:o(Xe),hardBreakTrailing:o(Xe),htmlFlow:o(pt,a),htmlFlowData:L,htmlText:o(pt,a),htmlTextData:L,image:o(Ut),label:a,link:o(Pt),listItem:o(he),listItemValue:g,listOrdered:o(It,p),listUnordered:o(It),paragraph:o(Be),reference:F,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(Ze),strong:o(at),thematicBreak:o(ct)},exit:{atxHeading:d(),atxHeadingSequence:O,autolink:d(),autolinkEmail:ue,autolinkProtocol:ae,blockQuote:d(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:ee,characterReferenceMarkerNumeric:ee,characterReferenceValue:te,characterReference:oe,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()}};tI(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(pe){let be={type:"root",children:[]};const Ae={stack:[be],tokenStack:[],config:t,enter:c,exit:m,buffer:a,resume:h,data:n},He=[];let Ye=-1;for(;++Ye<pe.length;)if(pe[Ye][1].type==="listOrdered"||pe[Ye][1].type==="listUnordered")if(pe[Ye][0]==="enter")He.push(Ye);else{const $t=He.pop();Ye=r(pe,$t,Ye)}for(Ye=-1;++Ye<pe.length;){const $t=t[pe[Ye][0]];eI.call($t,pe[Ye][1].type)&&$t[pe[Ye][1].type].call(Object.assign({sliceSerialize:pe[Ye][2].sliceSerialize},Ae),pe[Ye][1])}if(Ae.tokenStack.length>0){const $t=Ae.tokenStack[Ae.tokenStack.length-1];($t[1]||Cw).call(Ae,void 0,$t[0])}for(be.position={start:ho(pe.length>0?pe[0][1].start:{line:1,column:1,offset:0}),end:ho(pe.length>0?pe[pe.length-2][1].end:{line:1,column:1,offset:0})},Ye=-1;++Ye<t.transforms.length;)be=t.transforms[Ye](be)||be;return be}function r(pe,be,Ae){let He=be-1,Ye=-1,$t=!1,yt,ke,We,Qe;for(;++He<=Ae;){const Fe=pe[He];switch(Fe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Fe[0]==="enter"?Ye++:Ye--,Qe=void 0;break}case"lineEndingBlank":{Fe[0]==="enter"&&(yt&&!Qe&&!Ye&&!We&&(We=He),Qe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Qe=void 0}if(!Ye&&Fe[0]==="enter"&&Fe[1].type==="listItemPrefix"||Ye===-1&&Fe[0]==="exit"&&(Fe[1].type==="listUnordered"||Fe[1].type==="listOrdered")){if(yt){let Ve=He;for(ke=void 0;Ve--;){const Gt=pe[Ve];if(Gt[1].type==="lineEnding"||Gt[1].type==="lineEndingBlank"){if(Gt[0]==="exit")continue;ke&&(pe[ke][1].type="lineEndingBlank",$t=!0),Gt[1].type="lineEnding",ke=Ve}else if(!(Gt[1].type==="linePrefix"||Gt[1].type==="blockQuotePrefix"||Gt[1].type==="blockQuotePrefixWhitespace"Line truncated
`}]}function n9(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 i9(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function r9(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function s9(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 o9(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 a9(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function nI(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 l9(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return nI(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 c9(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 u9(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 d9(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return nI(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 f9(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 m9(e,t,n){const i=e.all(t),r=n?p9(n):iI(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
`});const m={type:"element",tagName:"li",properties:o,children:a};return e.patch(t,m),e.applyData(t,m)}function p9(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=iI(n[i])}return t}function iI(e){const t=e.spread;return t??e.children.length>1}function h9(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 g9(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function y9(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function x9(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function v9(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=LN(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 b9(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 _9(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 k9(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 S9(e,t){const n={type:"text",value:k9(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function w9(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const C9={blockquote:e9,break:t9,code:n9,delete:i9,emphasis:r9,footnoteReference:s9,heading:o9,html:a9,imageReference:l9,image:c9,inlineCode:u9,linkReference:d9,link:f9,listItem:m9,list:h9,paragraph:g9,root:y9,strong:x9,table:v9,tableCell:_9,tableRow:b9,text:S9,thematicBreak:w9,toml:af,yaml:af,definition:af,footnoteDefinition:af};function af(){}const rI=-1,Wm=0,uu=1,cm=2,b0=3,_0=4,k0=5,S0=6,sI=7,oI=8,Iw=typeof self=="object"?self:globalThis,j9=(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 rI: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 sI:{const{name:c,message:d}=a;return n(new Iw[c](d),r)}case oI: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=>j9(new Map,e)(0),tl="",{toString:E9}={},{keys:N9}=Object,Gc=e=>{const t=typeof e;if(t!=="object"||!e)return[Wm,t];const n=E9.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")?[sI,n]:[cm,n]},lf=([e,t])=>e===Wm&&(t==="function"||t==="symbol"),I9=(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=oI,h=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);h=null;break;case"undefined":return r([rI],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:`
`}]}}const Ym=(function(e){if(e==null)return L9;if(typeof e=="function")return Xm(e);if(typeof e=="object")return Array.isArray(e)?M9(e):D9(e);if(typeof e=="string")return O9(e);throw new Error("Expected function, string, or object as test")});function M9(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 D9(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 O9(e){return Xm(t);function t(n){return n&&n.type===e}}function Xm(e){return t;function t(n,i,r){return!!(z9(n)&&e.call(this,n,typeof i=="number"?i:void 0,r||void 0))}}function L9(){return!0}function z9(e){return e!==null&&typeof e=="object"&&"type"in e}const aI=[],P9=!0,nv=!1,B9="skip";function lI(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=aI,v,_,k;if((!t||o(d,m,h[h.length-1]||void 0))&&(x=$9(n(d,h)),x[0]===nv))return x;if("children"in d&&d.children){const w=d;if(w.children&&x[0]!==B9)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 $9(e){return Array.isArray(e)?e:typeof e=="number"?[P9,e]:e==null?aI:[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),lI(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,H9={};function F9(e,t){const n=t||H9,i=new Map,r=new Map,o=new Map,a={...C9,...n.handlers},c={all:m,applyData:U9,definitionById:i,footnoteById:r,footnoteCounts:o,footnoteOrder:[],handlers:a,one:d,options:n,patch:V9,wrap:q9};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||G9)(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 V9(e,t){e.position&&(t.position=R8(e))}function U9(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 G9(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 q9(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:`
`}),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=F9(e,t),i=n.one(e,void 0),r=A9(n),o=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return r&&o.children.push({type:"text",value:`
`},r),o}function W9(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 Y9(){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 X9=Y9();const Gg=ma(X9);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 K9(){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?Z9(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 Z9(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:Q9,dirname:J9,extname:e$,join:t$,sep:"/"};function Q9(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 J9(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 e$(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 t$(...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?".":n$(n)}function n$(e){Hu(e);const t=e.codePointAt(0)===47;let n=i$(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function i$(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 r$={cwd:s$};function s$(){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 o$(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 a$(e)}function a$(e){if(e.hostname!==""){consLine truncated
`:" ")+o.indentLines(o.containerFlow(i,c.current()),t?fI:Z$))),m(),d}}function Z$(e,t,n){return t===0?e:fI(e,t,n)}function fI(e,t,n){return(n?"":" ")+e}const Q$=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];mI.peek=i7;function J$(){return{canContainEols:["delete"],enter:{strikethrough:t7},exit:{strikethrough:n7}}}function e7(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Q$}],handlers:{delete:mI}}}function t7(e){this.enter({type:"delete",children:[]},e)}function n7(e){this.exit(e)}function mI(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 i7(){return"~"}function r7(e){return e.length}function s7(e,t){const n=t||{},i=(n.align||[]).concat(),r=n.stringLength||r7,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=o7(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 o7(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 a7(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()),l7);return r(),a}function l7(e,t,n){return">"+(n?"":" ")+e}function c7(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===`
`&&c7(n.stack,n.unsafe[r]))return/[ \t]/.test(i.before)?"":" ";return`\\
`}function u7(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 d7(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 f7(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 m7(e,t,n,i){const r=f7(n),o=e.value||"",a=r==="`"?"GraveAccent":"Tilde";if(d7(e,n)){const p=n.enter("codeIndented"),g=n.indentLines(o,p7);return p(),g}const c=n.createTracker(i),d=r.repeat(Math.max(u7(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:`
`)),h+=c.move(d),m(),h}function p7(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 h7(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 g7(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}}pI.peek=y7;function pI(e,t,n,i){const r=g7(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 y7(e,t,n){return n.options.emphasis||"*"}function x7(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 v7(e,t,n,i){const r=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(i);if(x7(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
`,...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}hI.peek=b7;function hI(e){return e.value||""}function b7(){return"<"}gI.peek=_7;function gI(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 _7(){return"!"}yI.peek=k7;function yI(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 k7(){return"!"}xI.peek=S7;function xI(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 S7(){return"`"}function vI(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))}bI.peek=w7;function bI(e,t,n,i){const r=j0(n),o=r==='"'?"Quote":"Apostrophe",a=n.createTracker(i);let c,d;if(vI(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 w7(e,t,n){return vI(e,n)?"<":"["}_I.peek=C7;function _I(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 C7(){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 j7(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 E7(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 kI(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 N7(e,t,n,i){const r=n.enter("list"),o=n.bulletCurrent;let a=e.ordered?E7(n):E0(n);const c=e.ordered?a==="."?")":".":j7(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),kI(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(`
`))}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 s7(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=wI.inlineCode(x,v,_);return _.stack.includes("tableCell")&&(k=k.replace(/\|/g,"\\$&")),k}}function q7(){return{exit:{taskListCheckValueChecked:qw,taskListCheckValueUnchecked:qw,paragraph:Y7}}}function W7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:X7}}}function qw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Y7(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 X7(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=wI.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 K7(){return[N$(),X$(),J$(),B7(),q7()]}function Z7(e){return{extensions:[I$(),K$(e),e7(),G7(e),W7()]}}const Q7={tokenize:rH,partial:!0},CI={tokenize:sH,partial:!0},jI={tokenize:oH,partial:!0},EI={tokenize:aH,partial:!0},J7={tokenize:lH,partial:!0},NI={name:"wwwAutolink",tokenize:nH,previous:TI},II={name:"protocolAutolink",tokenize:iH,previous:RI},zs={name:"emailAutolink",tokenize:tH,previous:AI},ls={};function eH(){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,II];ls[104]=[zs,II];ls[87]=[zs,NI];ls[119]=[zs,NI];function tH(e,t,n){const i=this;let r,o;return a;function a(p){return!ov(p)||!AI.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(J7,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 nH(e,t,n){const i=this;return r;function r(a){return a!==87&&a!==119||!TI.call(i,i.previous)||N0(i.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Q7,e.attempt(CI,e.attempt(jI,o),n),n)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function iH(e,t,n){const i=this;let r="",o=!1;return a;function a(p){return(p===72||p===104)&&RI.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(CI,e.attempt(jI,h),n)(p)}function h(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function rH(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 sH(e,t,n){let i,r,o;return a;function a(m){return m===46||m===95?e.check(EI,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 oH(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(EI,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 aH(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>AH,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
`)]}):a})}),m&&r&&u.jsxs("button",{className:"code-block-collapse-btn",onClick:()=>o(!1),children:["Collapse (",d.length," lines)"]})]})}const DH={code({className:e,children:t,...n}){return e?.startsWith("language-")?u.jsx(MH,{className:e,children:t}):u.jsx("code",{className:e,...n,children:t})}},OH=3e3,LH=60,iy=800;function Yw(e){if(e.length>OH)return!0;let t=0;for(let n=0;n<e.length;n++)if(e[n]===`
`&&++t>=LH)return!0;return!1}function zH(e){const t=e.lastIndexOf(`
`,iy);return e.slice(0,t>iy/2?t:iy)}const bi=Rt.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?zH(t):t,d=t.split(`
`).length,m=t.length;return u.jsxs("div",{className:n,children:[u.jsx(x$,{remarkPlugins:[RH],components:DH,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",PH=["codex","native","claude_code","cursor","opencode"],BH=["native","codex","claude_code","cursor","opencode"];function MI(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 DI(e){const t=MI(e);return t.kind==="fallback"?"fallback:":`${t.kind}:${t.id??""}`}function $H(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 HH(e,t){const n=DI(t);return e.find(i=>`${i.kind}:${i.id}`===n)??e[0]}function FH(e,t){const n=t.toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?!0:n.every(i=>e.searchText.includes(i))}function VH(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 UH(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]=MI(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 GH(e){return!!(String(e.checkpoint_response_message_id??"").trim()||String(e.checkpoint_responded_at??"").trim()||String(e.checkpoint_reply_kind??"").trim())}const qH=Rt.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:VH(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]=$H(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||!GH(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 rF(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=Rt.memo(function({meta:t,onReply:n,responded:i}){const r=i,o=String(t.checkpoint_status??"").trim().toLowerCase(),a=rF(o),c=String(t.prompt??t.summary??""),d=C.useMemo(()=>c.split(`
`).map(O=>O.trim()).filter(Boolean),[c]),m=iF(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(""),nF);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 sF(e){return e.split(`
`).map(t=>t.trim()).find(Boolean)??e}function oF(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 aF=Rt.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=oF(m),p=String(t.prompt??t.summary??"").trim(),x=`${String(t.work_item_projection_title??sF(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__",lF=["A","B","C"];function es(e){return String(e??"").trim()}function cF(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 uF=Rt.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)=>cF(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:lF[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 dF(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 fF={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 $F(e,t){const{isCompanyRuntime:n,detailMode:i}=t;if(!n||i==="full"||gu(e.metadata))return null;const r=BI(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 HF(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=$F(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 FF=Rt.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})})]})}),VF=Rt.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 UF(e){return e.kind==="review"?`Review · ${e.verdict?e.verdict.replace(/_/g," "):"review"}`:e.kind==="report"?"Report":"Update"}const GF=Rt.memo(function({msg:t,payload:n,showDate:i,dateStr:r,isCopied:o,onCopy:a}){const c=PI(t.sender==="system"?t.senderName||"OPC":t.sender),d=t.senderDeleted?"[Deleted]":t.senderName,m=UF(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.
@@ -141,27 +141,27 @@ Go to Org tab now?`)&&n?.(),!1;const d=[],m=new Set(i.map(x=>x.role_id));o.runti
`+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
Run anyway?`):!0}function SV(e){if(!e)return!1;const t=Um(e);return!!(t.projectRun?.run_id||t.runtimeTeams.length>0||t.runtimeSeats.length>0)}function wV(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 CV({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 jV({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:oe,handleMouseDown:ae}=bV({initialWidth:380,minWidth:300,maxWidth:600,onCollapse:()=>ee("collapsed")}),[ue,ie]=C.useState("chat"),[we,je]=C.useState(null),[Te,qe]=C.useState({kind:"activity"}),[Ze,Xe]=C.useState([]),[pt,Ut]=C.useState(!1),[Pt,It]=C.useState({}),he=C.useRef(D),Be=C.useRef(V),at=C.useRef(a.getChannelMessages),Ue=C.useRef({scope:null,active:new Set,child:null}),ct=C.useRef(new Set),pe=C.useRef(0);Be.current=V,at.current=a.getChannelMessages;const be=i==="company"||i==="org"||i==="custom",Ae=`secretary:${d}`,He=`activity:${d}`,Ye=C.useMemo(()=>we?V.find(de=>de.taskId===we)??null:null,[V,we]),$t=C.useMemo(()=>Te.kind!=="task-detail"?null:e.tasks.find(de=>de.id===Te.taskId)??null,[Te,e.tasks]),yt=C.useMemo(()=>{const de=Vm($t);return de?V.find(ve=>ve.taskId===de||ve.runtimeTaskId===de||ve.executionTurnId===de)??null:null},[V,$t]),ke=C.useMemo(()=>yt?a.getChannelMessages(yt.channelId):[],[a.messages,a.getChannelMessages,yt]),We=C.useMemo(()=>Af(Z,V),[V,Z]),Qe=C.useMemo(()=>Wf(Z,V),[V,Z]),Fe=C.useMemo(()=>Yf(Z,[...Qe,...We]),[Z,We,Qe]);C.useEffect(()=>{he.current=D},[D]);const Ve=C.useCallback((de,ve,$e="summary")=>{const dt=he.current;if(!dt||!de)return;const an=pe.current,ce=Be.current.find(St=>St.taskId===de)?.channelId,Se=ve&&ce&&ve.channelId!==ce?at.current(ce).find(St=>$v(St,$e)):ve,ze=[an,de,$e,Se?.timestamp??"latest",Se?.id??""].join("|");if(ct.current.has(ze))return;ct.current.add(ze),It(St=>St[de]?St:{...St,[de]:!0});let Ge;try{Ge=dt(de,{limit:_V,beforeCreatedAt:Se?.timestamp,beforeMessageId:Se?.id,detailLevel:$e})}catch{ct.current.delete(ze),pe.current===an&&(It(ut=>ut[de]?{...ut,[de]:!1}:ut),Ue.current.active.delete(`${de}:${$e}`),Ue.current.child===de&&(Ue.current.child=null));return}return Promise.resolve(Ge).catch(()=>{pe.current===an&&(Ue.current.active.delete(`${de}:${$e}`),Ue.current.child===de&&(Ue.current.child=null))}).finally(()=>{if(ct.current.delete(ze),pe.current!==an)return;const St=`${an}|${de}|`;[...ct.current.keys()].some(nt=>nt.startsWith(St))||It(nt=>nt[de]?{...nt,[de]:!1}:nt)})},[]),Gt=C.useCallback(de=>!!Pt[de],[Pt]);C.useLayoutEffect(()=>{pe.current+=1,ct.current.clear(),Ue.current={scope:null,active:new Set,child:null},It({})},[d]),C.useEffect(()=>()=>{pe.current+=1,ct.current.clear()},[]),C.useEffect(()=>{we&&!Ye&&je(null)},[we,Ye]),C.useEffect(()=>{Te.kind==="task-detail"&&!$t&&qe({kind:"activity"})},[Te,$t]);const ei=C.useRef(null);C.useEffect(()=>{if(!yt){ei.current=null;return}ei.current!==yt.taskId&&(ei.current=yt.taskId,Ve(yt.taskId,void 0,"full"))},[yt,Ve]),C.useEffect(()=>{if(!we){Ue.current.child=null;return}Ue.current.child!==we&&(Ue.current.child=we,Ve(we,void 0,"full"))},[we,Ve]),C.useEffect(()=>{if(!U){Ue.current.scope=null,Ue.current.active.clear();return}Ue.current.scope!==U&&(Ue.current.scope=U,Ue.current.active.clear());const de=Fe.timelineSessions.length>0?Fe.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()}function wC(e){const t=dv(e),n=NV(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
`).trim():n}function NV(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 IV(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 TV(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 UI(e){return!fv(e)}function CC(e){const t={};for(const n of e){if(!UI(n))continue;const i=ui(n);i>(t[n.channelId]??0)&&(t[n.channelId]=i)}return t}function RV(e,t,n){return n<=(e[t]??0)?e:{...e,[t]:n}}function AV(e,t){const n={};for(const i of e){if(!UI(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=GI(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 GI(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 GI(e)>0}function qI(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(qI(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)&&(TV(j)||(h=!0,p||(p=j)));const g=IV(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 MV(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 DV(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 OV(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),qI(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 zV(e,t){const n=e.trim().replace(/\s+/g," ");return n?n.length>120?`${n.slice(0,120).trimEnd()}...`:n:t||"Thinking"}function PV(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 BV(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 $V(e,t){return t.timestamp-e.timestamp<=Km&&e.type===t.type&&e.summary===t.summary&&(e.detail??"")===(t.detail??"")}function HV(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:zV(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 WI(e,t,n=100){const i=PV(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:$V(c,i)?yl([...e.slice(0,a),c,...e.slice(a+1)],n):BV(c,i)?yl([...e.slice(0,a),HV(c,i),...e.slice(a+1)],n):yl([...e,i],n):[i]}function YI(e,t=100){return(Array.isArray(e)?e:[]).reduce((n,i)=>WI(n,i,t),[])}function FV(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 XI(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 VV(e,t){return t.timestamp-e.timestamp<=Km&&XI(e,t)&&(e.type==="thinking"||e.type==="tool_call")}function UV(e,t){return XI(e,t)&&(e.detail??"")===(t.detail??"")&&t.timestamp-e.timestamp<=Km}function GV(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 KI(e,t,n=100){const i=FV(t),r=e[e.length-1];return r?UV(r,i)?yl([...e.slice(0,-1),{...r,timestamp:i.timestamp}],n):VV(r,i)?yl([...e.slice(0,-1),GV(r,i)],n):yl([...e,i],n):[i]}function ZI(e,t=100){return(Array.isArray(e)?e:[]).reduce((n,i)=>KI(n,i,t),[])}function pv(e){const t=String(e??"").trim().toLowerCase();return t==="company"?"company":t==="org"||t==="custom"?"org":"task"}function qV(e){return String(e??"").trim().toLowerCase()==="custom"?"custom":"corporate"}function QI(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
`).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]),oe=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(xU,{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(vU,{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:oe})})]}),u.jsx(nl,{title:`Tools (${w.size})`,children:u.jsx(bU,{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:gU.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)"}),hU.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 xU({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:""})}),mU.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 vU({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
color: hsl(${Math.max(0,Math.min(120-120*g,120))}deg 100% 31%);`,n?.key)}return r}}function bt(e,t,n,i){return{debug:()=>{var r;return(r=e?.debugAll)!=null?r:e[t]},key:!1,onChange:i}}function SU(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:vt(()=>[e,n,t,o],(a,c,d,m)=>({table:a,column:c,row:d,cell:m,getValue:m.getValue,renderValue:m.renderValue}),bt(e.options,"debugCells"))};return e._features.forEach(a=>{a.createCell==null||a.createCell(o,n,t,e)},{}),o}function wU(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:vt(()=>[!0],()=>{var g;return[p,...(g=p.columns)==null?void 0:g.flatMap(x=>x.getFlatColumns())]},bt(e.options,"debugColumns")),getLeafColumns:vt(()=>[e._getOrderColumnsFn()],g=>{var x;if((x=p.columns)!=null&&x.length){let v=p.columns.flatMap(_=>_.getLeafColumns());return g(v)}return[p]},bt(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 CU={createTable:e=>{e.getHeaderGroups=vt(()=>[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)},bt(e.options,Oi)),e.getCenterHeaderGroups=vt(()=>[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")),bt(e.options,Oi)),e.getLeftHeaderGroups=vt(()=>[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")},bt(e.options,Oi)),e.getRightHeaderGroups=vt(()=>[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")},bt(e.options,Oi)),e.getFooterGroups=vt(()=>[e.getHeaderGroups()],t=>[...t].reverse(),bt(e.options,Oi)),e.getLeftFooterGroups=vt(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),bt(e.options,Oi)),e.getCenterFooterGroups=vt(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),bt(e.options,Oi)),e.getRightFooterGroups=vt(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),bt(e.options,Oi)),e.getFlatHeaders=vt(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),bt(e.options,Oi)),e.getLeftFlatHeaders=vt(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),bt(e.options,Oi)),e.getCenterFlatHeaders=vt(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),bt(e.options,Oi)),e.getRightFlatHeaders=vt(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),bt(e.options,Oi)),e.getCenterLeafHeaders=vt(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var i;return!((i=n.subHeaders)!=null&&i.length)}),bt(e.options,Oi)),e.getLeftLeafHeaders=vt(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var i;return!((i=n.subHeaders)!=null&&i.length)}),bt(e.options,Oi)),e.getRightLeafHeaders=vt(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var i;return!((i=n.subHeaders)!=null&&i.length)}),bt(e.options,Oi)),e.getLeafHeaders=vt(()=>[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()},bt(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
`)),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)&&KT(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 kK=()=>{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 xR(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)SK(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 SK(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 vR(e,t){return xR(e,t)}function wK(e,t){return xR(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=>WY(e),CK=e=>FT(e);function bR(e){return C.forwardRef(e)}function A2(e){const[t,n]=C.useState(BigInt(0)),[i]=C.useState(()=>jK(()=>n(r=>r+BigInt(1))));return Mv(()=>{const r=i.get();r.length&&(e(r),i.reset())},[t]),i}function jK(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const _R=C.createContext(null);function EK({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"})]})})}WR.displayName="MiniMap";const pQ=C.memo(WR),hQ=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,gQ={[Pl.Line]:"right",[Pl.Handle]:"bottom-right"};function yQ({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=wR(),j=typeof e=="string"?e:S,N=$n(),O=C.useRef(null),R=n===Pl.Handle,D=on(C.useCallback(hQ(R&&x),[R,x]),Bn),I=C.useRef(null),L=t??gQ[n];C.useEffect(()=>{if(!(!O.current||!j))return I.current||(I.current=GX({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,...YT({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(yQ);const xQ=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:ot.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:ot.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(rU,{projects:Se.projects,activeId:Se.activeProjectId,onSelect:J=>{const z=St(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=Ft.channels.reduce((z,ne)=>z+Ft.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:Zt,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(jV,{boardStore:an,chatStore:Ft,sessionStore:ce,agents:P,officeMap:Xu,execMode:V,companyProfile:Z,taskPreferredAgent:K,projectId:Se.activeProjectId,orgInfoData:te,onNavigateToOrg:()=>W("org"),savedOrgsList:Ye,activeSavedOrg:yt,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,se,me)=>{t.current?.send({type:"run_task",project_id:Je(),task_id:J,title:z,description:ne,mode:se,profile:me})},onCreateTask:(J,z,ne,se)=>{t.current?.send({type:"kanban_create_task",project_id:Je(),title:J,board_id:z,column_id:ne,task_id:se})},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();dt(J),t.current?.createSession(J,void 0,V,Dx(V),K,Qo(V,yt))},onSessionSend:(J,z,ne,se)=>t.current?.sessionSend(Je(),J,z,ne,se),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(se=>{if(se.ok===!1)throw new Error(String(se.error??"session_detail failed"))})},onOpenExecutionPanel:J=>Mt(J),onCollabSync:()=>t.current?.collabSync(Je(),void 0,tt.current)}),B==="org"&&u.jsx("div",{className:"org-page",children:u.jsx(EJ,{data:te,sessionRecruitmentByRole:Ge,talents:je,employeeDetail:Xe,reorgProposals:Ut,isCustomMode:fs,onRequestData:()=>t.current?.orgInfo(),onRequestTalents:()=>t.current?.talentList(),onRequestEmployeeDetail:J=>t.current?.employeeDetail(J),onHireTalent:(J,z)=>{wt(J),t.current?.talentHire(J,z,void 0,te?.organization_id||yt||void 0)},hiringTemplateId:Re,onImportEmployee:J=>t.current?.importEmployeeAsAgent(J),onRe Line truncated
@@ -5,7 +5,7 @@
<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-BgyI65M_.js"></script>
<link rel="modulepreload" crossorigin href="./assets/phaser-DFK5Ua9d.js">
<link rel="stylesheet" crossorigin href="./assets/index-DEvLDWDw.css">
</head>
@@ -1449,6 +1449,56 @@ export default function App() {
scheduleSessionDetailRefresh(payload.task_id)
}
},
onRuntimeStatusSync: (payload) => {
if (!payloadMatchesActiveProject(payload as unknown as Record<string, unknown>, false)) return
const ss = sessionStoreRef.current
const bs = boardStoreRef.current
if (!ss) return
// Periodic reconciliation against the backend's authoritative status.
// Diff before dispatching: a tick where nothing drifted must not
// trigger a single store update (and therefore no re-render).
for (const entry of payload.sessions ?? []) {
const taskId = String(entry.task_id ?? '').trim()
if (!taskId) continue
const session = ss.sessions.find((s) => s.taskId === taskId)
if (!session) continue
const status = String(entry.status ?? '').trim()
const patch: Partial<import('./types/kanban').Session> = {}
if (status && status !== session.status) patch.status = status
const rawAgentStatus = typeof entry.agent_status === 'string' ? entry.agent_status.trim() : ''
if (rawAgentStatus === 'idle' || rawAgentStatus === 'reflecting' || rawAgentStatus === 'tool_active') {
if (rawAgentStatus !== session.agentStatus) patch.agentStatus = rawAgentStatus
const tool = typeof entry.current_tool === 'string' && entry.current_tool.trim()
? entry.current_tool
: undefined
if (tool !== session.currentTool) patch.currentTool = tool
if (runtimeStatusClearsDisplayTool(rawAgentStatus) && session.displayTool !== undefined) {
patch.displayTool = undefined
}
} else {
// No live tracker for this task: only clear stale indicators when
// the backend says the task is no longer running (mirrors the
// mergeLiveRuntimeField semantics used by collab_sync).
const controlActive = session.runtimeControlState === 'running'
|| session.runtimeControlState === 'suspending'
|| session.runtimeControlState === 'resuming'
if (status && status !== 'running' && !controlActive) {
if (session.agentStatus !== undefined) patch.agentStatus = undefined
if (session.currentTool !== undefined) patch.currentTool = undefined
if (session.displayTool !== undefined) patch.displayTool = undefined
}
}
if (Object.keys(patch).length === 0) continue
ss.updateSession(taskId, patch)
if (bs && ('agentStatus' in patch || 'currentTool' in patch || 'displayTool' in patch)) {
const boardPatch: Partial<KanbanTask> = {}
if ('agentStatus' in patch) boardPatch.agentStatus = patch.agentStatus as KanbanTask['agentStatus']
if ('currentTool' in patch) boardPatch.currentTool = patch.currentTool
if ('displayTool' in patch) boardPatch.displayTool = patch.displayTool
bs.updateTask(taskId, boardPatch)
}
}
},
onWorkerNotification: (payload) => {
if (!payloadMatchesActiveProject(payload as unknown as Record<string, unknown>, false)) return
const data = payload as Record<string, unknown>
@@ -29,6 +29,7 @@ interface SocketHandlers {
onCrossOfficeCollab?: (payload: { agent_ids: string[]; task_id: string; action: string }) => void
onCollabMessage?: (type: string, payload: Record<string, unknown>) => void
onAgentRuntimeUpdate?: (payload: AgentRuntimePayload) => void
onRuntimeStatusSync?: (payload: RuntimeStatusSyncPayload) => void
onWorkerNotification?: (payload: WorkerNotificationPayload) => void
onKanbanViewData?: (payload: KanbanViewDataPayload) => void
onSessionCreated?: (payload: { project_id: string; task_id: string; channel_id: string; session_id?: string; parent_session_id?: string; origin_task_id?: string; title: string; status: string; created_at: number; assignee_ids?: string[]; exec_mode?: string; company_profile?: string; org_id?: string; organization_id?: string; preferred_agent?: TaskPreferredAgent; selected_execution_agent?: TaskPreferredAgent }) => void
@@ -60,6 +61,16 @@ interface SocketHandlers {
onCommsMessage?: (payload: CommsMessagePayload) => void
}
export interface RuntimeStatusSyncPayload {
project_id: string
sessions: Array<{
task_id: string
status: string
agent_status?: string
current_tool?: string | null
}>
}
export interface CommsMessageItem {
message_id: string
from: string
@@ -752,6 +763,9 @@ export class VisualSocketClient {
case 'agent_runtime_update':
this.handlers.onAgentRuntimeUpdate?.(parsed.payload)
break
case 'runtime_status_sync':
this.handlers.onRuntimeStatusSync?.(parsed.payload)
break
case 'worker_notification':
this.handlers.onWorkerNotification?.(parsed.payload as WorkerNotificationPayload)
break
@@ -119,6 +119,7 @@ export type SocketEnvelope =
| { type: 'comms_state'; payload: Record<string, unknown> }
| { type: 'comms_message'; payload: Record<string, unknown> }
| { type: 'comms_state_dirty'; payload: { project_id: string; [key: string]: unknown } }
| { type: 'runtime_status_sync'; payload: { project_id: string; sessions: Array<{ task_id: string; status: string; agent_status?: string; current_tool?: string | null }> } }
export type SocketStatus = 'connecting' | 'connected' | 'disconnected' | 'error'
@@ -0,0 +1,168 @@
"""Tests for the runtime-status reconciliation broadcast (issue #11).
The sync tick re-broadcasts the authoritative status of every task with a
live runtime so any dropped live delta converges within one interval.
"""
from __future__ import annotations
import unittest
from dataclasses import dataclass, field
from types import SimpleNamespace
from typing import Any
from unittest.mock import AsyncMock
from opc.plugins.office_ui.event_adapter import AgentAnimState, EventAdapter
from opc.plugins.office_ui.ws_handler import WSHandler
@dataclass
class FakeEvent:
event_type: str
payload: dict[str, Any]
timestamp: float = 0.0
event_id: str = "test"
@dataclass
class _FakeTask:
status: str
@dataclass
class _FakeStore:
tasks: dict[str, _FakeTask] = field(default_factory=dict)
async def get_task(self, task_id: str) -> _FakeTask | None:
return self.tasks.get(task_id)
class _FakeBgTask:
"""Hashable stand-in for an asyncio.Task in the bg-context registry."""
def __init__(self, done: bool = False) -> None:
self._done = done
def done(self) -> bool:
return self._done
def _fake_bg_task(done: bool = False) -> _FakeBgTask:
return _FakeBgTask(done)
def _make_handler(tasks: dict[str, _FakeTask]) -> WSHandler:
engine = SimpleNamespace(project_id="p1", store=_FakeStore(tasks))
handler = WSHandler(engine, SimpleNamespace(), SimpleNamespace(), EventAdapter())
handler._engine_for_project = AsyncMock(return_value=engine) # type: ignore[method-assign]
handler.broadcast = AsyncMock() # type: ignore[method-assign]
handler._clients = {object()} # type: ignore[assignment]
return handler
class RuntimeStatusSyncTickTests(unittest.IsolatedAsyncioTestCase):
async def test_tick_broadcasts_authoritative_status_with_tracker_state(self) -> None:
handler = _make_handler({"task-1": _FakeTask(status="running")})
handler._task_bg_context[_fake_bg_task()] = {"task_id": "task-1", "project_id": "p1"}
tracker = handler.event_adapter._get_tracker("agent-1")
tracker.task_id = "task-1"
tracker.state = AgentAnimState.REFLECTING
tracker.current_tool = None
await handler._runtime_status_sync_tick()
handler.broadcast.assert_awaited_once()
envelope = handler.broadcast.await_args.args[0]
self.assertEqual(envelope["type"], "runtime_status_sync")
self.assertEqual(envelope["payload"]["project_id"], "p1")
self.assertEqual(envelope["payload"]["sessions"], [{
"task_id": "task-1",
"status": "running",
"agent_status": "reflecting",
"current_tool": None,
}])
async def test_tick_without_clients_or_candidates_is_silent(self) -> None:
handler = _make_handler({"task-1": _FakeTask(status="running")})
# No candidates at all → nothing to broadcast.
await handler._runtime_status_sync_tick()
handler.broadcast.assert_not_awaited()
# Candidates but no clients → still silent (snapshot covers reconnect).
handler._task_bg_context[_fake_bg_task()] = {"task_id": "task-1", "project_id": "p1"}
handler._clients = set() # type: ignore[assignment]
await handler._runtime_status_sync_tick()
handler.broadcast.assert_not_awaited()
async def test_departed_task_gets_one_final_tick(self) -> None:
handler = _make_handler({"task-1": _FakeTask(status="done")})
bg = _fake_bg_task()
handler._task_bg_context[bg] = {"task_id": "task-1", "project_id": "p1"}
await handler._runtime_status_sync_tick()
self.assertEqual(handler.broadcast.await_count, 1)
# Runtime finished: the task leaves the registry, one final sync fires.
del handler._task_bg_context[bg]
await handler._runtime_status_sync_tick()
self.assertEqual(handler.broadcast.await_count, 2)
envelope = handler.broadcast.await_args.args[0]
self.assertEqual(envelope["payload"]["sessions"][0]["status"], "done")
# After the final tick the task is forgotten entirely.
await handler._runtime_status_sync_tick()
self.assertEqual(handler.broadcast.await_count, 2)
async def test_company_child_inherits_root_project(self) -> None:
handler = _make_handler({
"root-1": _FakeTask(status="running"),
"child-1": _FakeTask(status="running"),
})
handler._task_bg_context[_fake_bg_task()] = {"task_id": "root-1", "project_id": "p1"}
handler._active_runtime_children["root-1"] = "root-1"
handler._active_runtime_children["child-1"] = "root-1"
await handler._runtime_status_sync_tick()
envelope = handler.broadcast.await_args.args[0]
task_ids = [s["task_id"] for s in envelope["payload"]["sessions"]]
self.assertEqual(task_ids, ["child-1", "root-1"])
self.assertEqual(envelope["payload"]["project_id"], "p1")
async def test_done_bg_tasks_are_not_candidates(self) -> None:
handler = _make_handler({"task-1": _FakeTask(status="running")})
handler._task_bg_context[_fake_bg_task(done=True)] = {"task_id": "task-1", "project_id": "p1"}
await handler._runtime_status_sync_tick()
handler.broadcast.assert_not_awaited()
class TrackerTurnLifecycleTests(unittest.TestCase):
"""The tracker must treat tool boundaries as reasoning, and turn ends as idle."""
def _runtime_event(self, runtime_type: str, **extra: Any) -> FakeEvent:
return FakeEvent("runtime_event", {"type": runtime_type, "task_id": "task-1", **extra})
def test_tool_completed_returns_to_reflecting(self) -> None:
adapter = EventAdapter()
adapter.translate(self._runtime_event("tool_started", tool_name="file_read", agent_id="a1"))
adapter.translate(self._runtime_event("tool_completed", agent_id="a1"))
tracker = adapter._get_tracker("a1")
self.assertEqual(tracker.state, AgentAnimState.REFLECTING)
self.assertIsNone(tracker.current_tool)
def test_turn_end_goes_idle_and_emits_runtime_update(self) -> None:
adapter = EventAdapter()
adapter.translate(self._runtime_event("turn_started", agent_id="a1"))
for terminal in ("turn_completed", "turn_failed"):
adapter.translate(self._runtime_event("turn_started", agent_id="a1"))
events = adapter.translate(self._runtime_event(terminal, agent_id="a1"))
tracker = adapter._get_tracker("a1")
self.assertEqual(tracker.state, AgentAnimState.IDLE)
updates = [e for e in events if e["type"] == "agent_runtime_update"]
self.assertEqual(len(updates), 1)
self.assertEqual(updates[0]["data"]["status"], "idle")
if __name__ == "__main__":
unittest.main()
+140
View File
@@ -382,6 +382,7 @@ _PROJECT_SCOPED_ENVELOPE_TYPES = frozenset({
"comms_state",
"comms_message",
"comms_state_dirty",
"runtime_status_sync",
})
@@ -463,6 +464,8 @@ class WSHandler:
self._pending_escalation_order: list[str] = []
self._progress_buffer: dict[str, list[dict[str, Any]]] = {}
self._progress_project_ids: dict[str, str] = {}
self._runtime_status_sync_task: asyncio.Task[Any] | None = None
self._runtime_status_sync_prev: dict[str, str] = {}
self._assistant_delta_buffers: dict[tuple[str, str, str], dict[str, Any]] = {}
self._assistant_delta_flush_tasks: dict[tuple[str, str, str], asyncio.Task[None]] = {}
self._assistant_delta_seq: int = 0
@@ -482,6 +485,7 @@ class WSHandler:
# in RAM before they're persisted and visible on page refresh.
self._PROGRESS_FLUSH_THRESHOLD = 2
self._PROGRESS_FLUSH_INTERVAL_SEC = 3.0
self._RUNTIME_STATUS_SYNC_INTERVAL_SEC = 12.0
self._progress_flush_task: asyncio.Task[None] | None = None
self._shutting_down: bool = False
self._active_message_tasks: set[asyncio.Task[Any]] = set()
@@ -1081,6 +1085,7 @@ class WSHandler:
return ws
self._clients.add(ws)
self._ensure_progress_flush_loop()
self._ensure_runtime_status_sync_loop()
logger.info(f"WS client connected ({len(self._clients)} total)")
try:
@@ -2328,6 +2333,109 @@ class WSHandler:
"Periodic progress flush error for task %s", tid,
)
def _ensure_runtime_status_sync_loop(self) -> None:
"""Start the runtime-status reconciliation coroutine if not running.
Live status deltas are one-shot, best-effort broadcasts: a delta lost
to a disconnect window, a project-scope drop, or a not-ready store
leaves the UI stuck on a stale status until a full refresh. This loop
periodically re-broadcasts the authoritative status of every task with
a live runtime (plus one final tick for tasks that just ended) so any
missed delta converges within one interval.
"""
if self._runtime_status_sync_task and not self._runtime_status_sync_task.done():
return
self._runtime_status_sync_task = asyncio.create_task(self._runtime_status_sync_loop())
async def _runtime_status_sync_loop(self) -> None:
while not self._shutting_down:
try:
await asyncio.sleep(self._RUNTIME_STATUS_SYNC_INTERVAL_SEC)
except asyncio.CancelledError:
break
if self._shutting_down:
break
try:
await self._runtime_status_sync_tick()
except Exception:
logger.opt(exception=True).debug("runtime status sync tick failed")
def _collect_runtime_status_candidates(self) -> dict[str, str]:
"""Map task_id → project_id for every task with a live runtime.
Sources are purely in-memory (no store scans): the background-task
context registry covers every session run across modes; the company
runtime-children map adds work-item child tasks of a live tree.
"""
candidates: dict[str, str] = {}
for bg, ctx in list(self._task_bg_context.items()):
if bg.done():
continue
t_id = str(ctx.get("task_id") or "").strip()
if t_id:
candidates[t_id] = self._normalize_project_id(str(ctx.get("project_id") or ""))
for child_id, root_id in list(self._active_runtime_children.items()):
if child_id in candidates:
continue
pid = (
candidates.get(root_id)
or self._progress_project_ids.get(child_id)
or self._progress_project_ids.get(root_id)
)
if pid:
candidates[child_id] = self._normalize_project_id(pid)
return candidates
async def _runtime_status_sync_tick(self) -> None:
current = self._collect_runtime_status_candidates()
if not self._clients:
# Nobody to correct; a connecting client gets a full snapshot.
self._runtime_status_sync_prev = current
return
departed = {
tid: pid for tid, pid in self._runtime_status_sync_prev.items()
if tid not in current
}
self._runtime_status_sync_prev = current
to_sync = {**departed, **current}
if not to_sync:
return
tracker_by_task: dict[str, tuple[str, str | None]] = {}
for tracker in getattr(self.event_adapter, "_trackers", {}).values():
t_id = str(getattr(tracker, "task_id", "") or "").strip()
if t_id:
tracker_by_task[t_id] = (tracker.state.value, tracker.current_tool)
by_project: dict[str, list[str]] = {}
for tid, pid in to_sync.items():
by_project.setdefault(pid, []).append(tid)
for pid, task_ids in by_project.items():
try:
engine = await self._engine_for_project(pid)
except Exception:
continue
store = getattr(engine, "store", None)
if store is None or not self._store_is_ready(store):
continue
sessions: list[dict[str, Any]] = []
for task_id in sorted(task_ids):
try:
t = await store.get_task(task_id)
except Exception:
continue
if t is None:
continue
status_val = t.status.value if hasattr(t.status, "value") else str(t.status)
entry: dict[str, Any] = {"task_id": task_id, "status": status_val}
tracked = tracker_by_task.get(task_id)
if tracked is not None:
entry["agent_status"], entry["current_tool"] = tracked
sessions.append(entry)
if sessions:
await self.broadcast({
"type": "runtime_status_sync",
"payload": {"project_id": pid, "sessions": sessions},
})
@staticmethod
def _parse_progress_entry(text: str) -> dict[str, Any] | None:
"""Parse on_progress text into a ProgressEntry dict, or None to skip."""
@@ -4586,6 +4694,16 @@ class WSHandler:
pass
self._progress_flush_task = None
if self._runtime_status_sync_task:
# Cancel rather than await: the sync interval is long enough that
# waiting for a natural wake-up would stall shutdown.
self._runtime_status_sync_task.cancel()
try:
await self._runtime_status_sync_task
except (asyncio.CancelledError, Exception):
pass
self._runtime_status_sync_task = None
clients = list(self._clients)
for ws in clients:
try:
@@ -8474,6 +8592,7 @@ class WSHandler:
await self.broadcast({"type": "board_task_status_changed", "payload": {
"project_id": pid, "task_id": task_id, "column_id": "in-progress", "status": "running",
}})
terminal_board_broadcast_sent = False
# Register company runtime origin so child-task progress can dual-route
company_runtime_target: dict[str, Any] | None = None
if session_exec_mode in ("company", "org", "custom"):
@@ -8563,6 +8682,7 @@ class WSHandler:
await self.broadcast({"type": "board_task_status_changed", "payload": {
"project_id": pid, "task_id": task_id, "column_id": final_column_id, "status": final_status,
}})
terminal_board_broadcast_sent = True
if session_exec_mode in ("company", "org", "custom"):
try:
idle_target = await self._resolve_company_runtime_target(task_id, engine=engine)
@@ -8593,6 +8713,7 @@ class WSHandler:
await self.broadcast({"type": "board_task_status_changed", "payload": {
"project_id": pid, "task_id": task_id, "column_id": "in-progress", "status": "failed",
}})
terminal_board_broadcast_sent = True
if session_exec_mode in ("company", "org", "custom"):
try:
failed_target = await self._resolve_company_runtime_target(task_id, engine=engine)
@@ -8615,6 +8736,25 @@ class WSHandler:
self._stop_requested_task_ids.discard(task_id)
if session_id:
self._session_to_task.pop(session_id, None)
if not terminal_board_broadcast_sent:
# A cancelled run (or a failure inside the failure handler)
# never reaches the terminal broadcasts above, leaving the
# board stuck on "running" until a full refresh. Mirror the
# persisted status best-effort; never write engine state here.
try:
store = engine.store
if self._store_is_ready(store):
t = await store.get_task(task_id)
if t is not None:
status_val = t.status.value if hasattr(t.status, "value") else str(t.status)
await self.broadcast({"type": "board_task_status_changed", "payload": {
"project_id": pid,
"task_id": task_id,
"column_id": "done" if status_val in ("done", "cancelled") else "in-progress",
"status": status_val,
}})
except Exception:
logger.opt(exception=True).debug("failed to mirror terminal board status")
# Clear agent runtime indicator — include agent_id so the
# frontend can also clear the swarm agent's reflecting/tool_active state.
idle_payload: dict[str, Any] = {