fix(office-ui): stop progress-row flicker and surface native role replies end to end

Two user-visible defects in company mode, root-caused via project 6666/8888
DB forensics:

Progress-row flicker (thinking preview appearing/disappearing): progress
entries were broadcast to clients before reaching the persistence buffer,
so a tool_call-triggered session_detail snapshot rebuilt from the DB erased
freshly streamed entries from the live log. Buffer now fills before the
broadcast and session_detail flushes it before reading.

Native role transcripts incomplete (thinking only at start, no narration,
no final summary — external agents unaffected):
- thinking deltas shared one stream id per conversation turn while seq
  reset per iteration, collapsing all iterations into one entry and
  silently dropping live thinking from iteration 2 on; now keyed per
  iteration like assistant deltas
- assistant_delta events were mapped to None; company mode now surfaces
  them as streaming 'assistant' progress entries (rendered as Reply cards,
  merged like thinking, excluded from inline chat rows)
- thinking was persisted one row per token, flooding the 1000-entry cap
  and evicting interleaved tool history; append_progress now folds
  streaming deltas per (type, turn, stream) with seq dedup
- the terminal company turn was hidden at summary detail and, worse, its
  id-keyed backfill merge kept the first-inserted intermediate content, so
  the final reply never reached any channel; terminal turns are now
  flagged company_final_turn, visible at summary detail, and carry their
  own ui_message_id so they insert as fresh rows
- appendProgressEntry applied its seq guard against unrelated entries when
  the stream key was absent from the log, killing the first delta of any
  fresh stream; the guard now only applies within the same stream

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
LZH-YS1998andClaude Fable 5 committed 2026-07-09 20:46:14 +08:00
1 parent 35fa717cf6
commit a0402522da
13 files changed
+365 -178

No files matched your search

+20 -2
View File
@@ -435,8 +435,13 @@ class NativeRuntimeV2:
"canonical_turn_id": conversation_turn_id, "canonical_turn_id": conversation_turn_id,
"conversation_turn_id": conversation_turn_id, "conversation_turn_id": conversation_turn_id,
"execution_turn_id": execution_turn_id, "execution_turn_id": execution_turn_id,
"item_id": f"{turn_id}:thinking", # Keyed per iteration (like assistant_delta):
"stream_id": f"{turn_id}:thinking", # thinking_delta_seq resets every iteration, so a
# turn-scoped stream id makes downstream seq guards
# drop iteration>=2 deltas and collapses all
# iterations into one entry (no tool interleaving).
"item_id": f"{execution_turn_id}:thinking",
"stream_id": f"{execution_turn_id}:thinking",
"seq": thinking_delta_seq, "seq": thinking_delta_seq,
"text": thinking_text, "text": thinking_text,
}, },
@@ -2797,6 +2802,11 @@ class NativeRuntimeV2:
if is_company_mode: if is_company_mode:
metadata["execution_mode"] = "company_mode" metadata["execution_mode"] = "company_mode"
metadata["company_runtime_raw_turn"] = True metadata["company_runtime_raw_turn"] = True
if not tool_calls:
# Terminal iteration of the company turn — this is the role's
# final reply. Marked so the UI can show it at summary detail
# even though the kind is otherwise full-detail-only.
metadata["company_final_turn"] = True
if task.assigned_to: if task.assigned_to:
metadata["role_id"] = str(task.assigned_to) metadata["role_id"] = str(task.assigned_to)
else: else:
@@ -2808,6 +2818,14 @@ class NativeRuntimeV2:
if message_turn_id and message_turn_id != canonical_turn_id: if message_turn_id and message_turn_id != canonical_turn_id:
metadata["execution_turn_id"] = message_turn_id metadata["execution_turn_id"] = message_turn_id
if is_company_mode: if is_company_mode:
# Tool-calling iterations of a company conversation turn share
# one UI row; the terminal reply gets its own id. The id-keyed
# backfill merge keeps the first-inserted content for same-kind
# candidates, so reusing the shared id freezes the row at
# iteration 1 and swallows the final reply entirely.
if metadata.get("company_final_turn"):
metadata["ui_message_id"] = f"runtime-v2-company-assistant-final:{canonical_turn_id}"
else:
metadata["ui_message_id"] = f"runtime-v2-company-assistant:{canonical_turn_id}" metadata["ui_message_id"] = f"runtime-v2-company-assistant:{canonical_turn_id}"
elif is_intermediate_tool_turn: elif is_intermediate_tool_turn:
metadata["ui_message_id"] = f"runtime-v2-intermediate-assistant:{message_turn_id or canonical_turn_id}" metadata["ui_message_id"] = f"runtime-v2-intermediate-assistant:{message_turn_id or canonical_turn_id}"
+53 -1
View File
@@ -1599,6 +1599,58 @@ class ChatStore:
# concern, swap this in-row JSON blob for a proper rolling table. # concern, swap this in-row JSON blob for a proper rolling table.
_PROGRESS_MAX_ENTRIES = 1000 _PROGRESS_MAX_ENTRIES = 1000
# Streaming text types arrive as one entry per token-sized delta. Without
# folding, thinking floods the entry cap (forensics: 929/1000 entries were
# single-token thinking rows) and evicts the interleaved tool history.
_PROGRESS_STREAM_MERGE_TYPES = frozenset({"thinking", "assistant"})
@staticmethod
def _progress_stream_key(entry: dict[str, Any]) -> tuple[str, str, str] | None:
entry_type = str(entry.get("type", "") or "")
if entry_type not in ChatStore._PROGRESS_STREAM_MERGE_TYPES:
return None
item_id = str(entry.get("item_id") or entry.get("stream_id") or "").strip()
if not item_id:
return None
return (entry_type, str(entry.get("turn_id", "") or ""), item_id)
@classmethod
def _fold_progress_entries(
cls,
existing: list[dict[str, Any]],
new_entries: list[dict[str, Any]],
) -> list[dict[str, Any]]:
"""Fold streaming deltas into their stream's entry (mirrors the
frontend ``appendProgressEntry`` merge so persisted state equals what
the live client built)."""
merged = list(existing)
index_by_key: dict[tuple[str, str, str], int] = {}
for i, entry in enumerate(merged):
key = cls._progress_stream_key(entry)
if key is not None:
index_by_key[key] = i
for entry in new_entries:
key = cls._progress_stream_key(entry)
if key is None or key not in index_by_key:
if key is not None:
index_by_key[key] = len(merged)
merged.append(entry)
continue
target = merged[index_by_key[key]]
last_seq = target.get("seq")
new_seq = entry.get("seq")
if isinstance(last_seq, (int, float)) and isinstance(new_seq, (int, float)) and new_seq <= last_seq:
continue
# Deltas are disjoint token fragments — concatenate raw, no strip.
detail = f"{target.get('detail') or ''}{entry.get('detail') or ''}"
preview = " ".join(detail.split())
folded = dict(target)
folded.update(entry)
folded["detail"] = detail
folded["summary"] = preview[:120].rstrip() + ("..." if len(preview) > 120 else "")
merged[index_by_key[key]] = folded
return merged
async def append_progress( async def append_progress(
self, self,
task_id: str, task_id: str,
@@ -1611,7 +1663,7 @@ class ChatStore:
the first call creates the row and subsequent calls update it. the first call creates the row and subsequent calls update it.
""" """
existing = await self.get_progress(task_id, project_id=project_id) existing = await self.get_progress(task_id, project_id=project_id)
merged = (existing + new_entries)[-self._PROGRESS_MAX_ENTRIES:] merged = self._fold_progress_entries(existing, new_entries)[-self._PROGRESS_MAX_ENTRIES:]
async def _write() -> None: async def _write() -> None:
await self._db.execute( await self._db.execute(
@@ -0,0 +1,155 @@
import{g as ta,r as A3}from"./phaser-DFK5Ua9d.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var rg={exports:{}},Cc={};var pk;function M3(){if(pk)return Cc;pk=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,i,o){var a=null;if(o!==void 0&&(a=""+o),i.key!==void 0&&(a=""+i.key),"key"in i){o={};for(var u in i)u!=="key"&&(o[u]=i[u])}else o=i;return i=o.ref,{$$typeof:e,type:r,key:a,ref:i!==void 0?i:null,props:o}}return Cc.Fragment=t,Cc.jsx=n,Cc.jsxs=n,Cc}var gk;function D3(){return gk||(gk=1,rg.exports=M3()),rg.exports}var c=D3(),ig={exports:{}},_t={};var xk;function O3(){if(xk)return _t;xk=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),g=Symbol.iterator;function y(G){return G===null||typeof G!="object"?null:(G=g&&G[g]||G["@@iterator"],typeof G=="function"?G:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,S={};function _(G,J,P){this.props=G,this.context=J,this.refs=S,this.updater=P||v}_.prototype.isReactComponent={},_.prototype.setState=function(G,J){if(typeof G!="object"&&typeof G!="function"&&G!=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,G,J,"setState")},_.prototype.forceUpdate=function(G){this.updater.enqueueForceUpdate(this,G,"forceUpdate")};function w(){}w.prototype=_.prototype;function C(G,J,P){this.props=G,this.context=J,this.refs=S,this.updater=P||v}var N=C.prototype=new w;N.constructor=C,k(N,_.prototype),N.isPureReactComponent=!0;var O=Array.isArray;function I(){}var D={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function L(G,J,P){var X=P.ref;return{$$typeof:e,type:G,key:J,ref:X!==void 0?X:null,props:P}}function A(G,J){return L(G.type,J,G.props)}function M(G){return typeof G=="object"&&G!==null&&G.$$typeof===e}function $(G){var J={"=":"=0",":":"=2"};return"$"+G.replace(/[=:]/g,function(P){return J[P]})}var W=/\/+/g;function B(G,J){return typeof G=="object"&&G!==null&&G.key!=null?$(""+G.key):J.toString(36)}function U(G){switch(G.status){case"fulfilled":return G.value;case"rejected":throw G.reason;default:switch(typeof G.status=="string"?G.then(I,I):(G.status="pending",G.then(function(J){G.status==="pending"&&(G.status="fulfilled",G.value=J)},function(J){G.status==="pending"&&(G.status="rejected",G.reason=J)})),G.status){case"fulfilled":return G.value;case"rejected":throw G.reason}}throw G}function H(G,J,P,X,ee){var te=typeof G;(te==="undefined"||te==="boolean")&&(G=null);var re=!1;if(G===null)re=!0;else switch(te){case"bigint":case"string":case"number":re=!0;break;case"object":switch(G.$$typeof){case e:case t:re=!0;break;case p:return re=G._init,H(re(G._payload),J,P,X,ee)}}if(re)return ee=ee(G),re=X===""?"."+B(G,0):X,O(ee)?(P="",re!=null&&(P=re.replace(W,"$&/")+"/"),H(ee,J,P,"",function(se){return se})):ee!=null&&(M(ee)&&(ee=A(ee,P+(ee.key==null||G&&G.key===ee.key?"":(""+ee.key).replace(W,"$&/")+"/")+re)),J.push(ee)),1;re=0;var oe=X===""?".":X+":";if(O(G))for(var de=0;de<G.length;de++)X=G[de],te=oe+B(X,de),re+=H(X,J,P,te,ee);else if(de=y(G),typeof de=="function")for(G=de.call(G),de=0;!(X=G.next()).done;)X=X.value,te=oe+B(X,de++),re+=H(X,J,P,te,ee);else if(te==="object"){if(typeof G.then=="function")return H(U(G),J,P,X,ee);throw J=String(G),Error("Objects are not valid as a React child (found: "+(J==="[object Object]"?"object with keys {"+Object.keys(G).join(", ")+"}":J)+"). If you meant to render a collection of children, use an array instead.")}return re}function V(G,J,P){if(G==null)return G;var X=[],ee=0;return H(G,X,"","",function(te){return J.call(P,te,ee++)}),X}function Y(G){if(G._status===-1){var J=G._result;J=J(),J.then(function(P){(G._status===0||G._status===-1)&&(G._status=1,G._result=P)},function(P){(G._status===0||G._status===-1)&&(G._status=2,G._result=P)}),G._status===-1&&(G._status=0,G._result=J)}if(G._status===1)return G._reLine truncated
at`)?" (<anonymous>)":-1<f.stack.indexOf("@")?"@unknown:0:0":""}return`
`+we+s+Ce}var Ge=!1;function Ye(s,l){if(!s||Ge)return"";Ge=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var x={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(ye){var xe=ye}Reflect.construct(s,[],Ie)}else{try{Ie.call()}catch(ye){xe=ye}s.call(Ie.prototype)}}else{try{throw Error()}catch(ye){xe=ye}(Ie=s())&&typeof Ie.catch=="function"&&Ie.catch(function(){})}}catch(ye){if(ye&&xe&&typeof ye.stack=="string")return[ye.stack,xe.stack]}return[null,null]}};x.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(x.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(x.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var E=x.DetermineComponentFrameRoot(),F=E[0],K=E[1];if(F&&K){var ie=F.split(`
`),ge=K.split(`
`);for(b=x=0;x<ie.length&&!ie[x].includes("DetermineComponentFrameRoot");)x++;for(;b<ge.length&&!ge[b].includes("DetermineComponentFrameRoot");)b++;if(x===ie.length||b===ge.length)for(x=ie.length-1,b=ge.length-1;1<=x&&0<=b&&ie[x]!==ge[b];)b--;for(;1<=x&&0<=b;x--,b--)if(ie[x]!==ge[b]){if(x!==1||b!==1)do if(x--,b--,0>b||ie[x]!==ge[b]){var _e=`
`+ie[x].replace(" at new "," at ");return s.displayName&&_e.includes("<anonymous>")&&(_e=_e.replace("<anonymous>",s.displayName)),_e}while(1<=x&&0<=b);break}}}finally{Ge=!1,Error.prepareStackTrace=f}return(f=s?s.displayName||s.name:"")?Be(f):""}function yt(s,l){switch(s.tag){case 26:case 27:case 5:return Be(s.type);case 16:return Be("Lazy");case 13:return s.child!==l&&l!==null?Be("Suspense Fallback"):Be("Suspense");case 19:return Be("SuspenseList");case 0:case 15:return Ye(s.type,!1);case 11:return Ye(s.type.render,!1);case 1:return Ye(s.type,!0);case 31:return Be("Activity");default:return""}}function qt(s){try{var l="",f=null;do l+=yt(s,f),f=s,s=s.return;while(s);return l}catch(x){return`
Error generating stack: `+x.message+`
`+x.stack}}var bt=Object.prototype.hasOwnProperty,vt=e.unstable_scheduleCallback,me=e.unstable_cancelCallback,Oe=e.unstable_shouldYield,rt=e.unstable_requestPaint,Qe=e.unstable_now,Je=e.unstable_getCurrentPriorityLevel,fe=e.unstable_ImmediatePriority,be=e.unstable_UserBlockingPriority,Me=e.unstable_NormalPriority,Fe=e.unstable_LowPriority,$e=e.unstable_IdlePriority,Wt=e.log,nn=e.unstable_setDisableYieldValue,ke=null,Te=null;function Pe(s){if(typeof Wt=="function"&&nn(s),Te&&typeof Te.setStrictMode=="function")try{Te.setStrictMode(ke,s)}catch{}}var Ve=Math.clz32?Math.clz32:Mn,qe=Math.log,et=Math.LN2;function Mn(s){return s>>>=0,s===0?32:31-(qe(s)/et|0)|0}var Tn=256,Dn=262144,yn=4194304;function Yt(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 x=s.pendingLanes;if(x===0)return 0;var b=0,E=s.suspendedLanes,F=s.pingedLanes;s=s.warmLanes;var K=x&134217727;return K!==0?(x=K&~E,x!==0?b=Yt(x):(F&=K,F!==0?b=Yt(F):f||(f=K&~s,f!==0&&(b=Yt(f))))):(K=x&~E,K!==0?b=Yt(K):F!==0?b=Yt(F):f||(f=x&~s,f!==0&&(b=Yt(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 Et(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function wt(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 tt(){var s=yn;return yn<<=1,(yn&62914560)===0&&(yn=4194304),s}function it(s){for(var l=[],f=0;31>f;f++)l.push(s);return l}function rn(s,l){s.pendingLanes|=l,l!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Xt(s,l,f,x,b,E){var F=s.pendingLanes;s.pendingLanes=f,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=f,s.entangledLanes&=f,s.errorRecoveryDisabledLanes&=f,s.shellSuspendCounter=0;var K=s.entanglements,ie=s.expirationTimes,ge=s.hiddenUpdates;for(f=F&~f;0<f;){var _e=31-Ve(f),Ie=1<<_e;K[_e]=0,ie[_e]=-1;var xe=ge[_e];if(xe!==null)for(ge[_e]=null,_e=0;_e<xe.length;_e++){var ye=xe[_e];ye!==null&&(ye.lane&=-536870913)}f&=~Ie}x!==0&&mt(s,x,0),E!==0&&b===0&&s.tag!==0&&(s.suspendedLanes|=E&~(F&~l))}function mt(s,l,f){s.pendingLanes|=l,s.suspendedLanes&=~l;var x=31-Ve(l);s.entangledLanes|=l,s.entanglements[x]=s.entanglements[x]|1073741824|f&261930}function Ht(s,l){var f=s.entangledLanes|=l;for(s=s.entanglements;f;){var x=31-Ve(f),b=1<<x;b&l|s[x]&l&&(s[x]|=l),f&=~b}}function On(s,l){var f=l&-l;return f=(f&42)!==0?1:vn(f),(f&(s.suspendedLanes|l))!==0?0:f}function vn(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 Rn(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function ve(){var s=V.p;return s!==0?s:(s=window.event,s===void 0?32:lk(s.type))}function Re(s,l){var f=V.p;try{return V.p=s,l()}finally{V.p=f}}var Xe=Math.random().toString(36).slice(2),He="__reactFiber$"+Xe,Tt="__reactProps$"+Xe,ht="__reactContainer$"+Xe,$n="__reactEvents$"+Xe,Ae="__reactListeners$"+Xe,Dt="__reactHandles$"+Xe,kn="__reactResources$"+Xe,nr="__reactMarker$"+Xe;function Sn(s){delete s[He],delete s[Tt],delete s[$n],delete s[Ae],delete s[Dt]}function We(s){var l=s[He];if(l)return l;for(var f=s.parentNode;f;){if(l=f[ht]||f[He]){if(f=l.alternate,l.child!==null||f!==null&&f.child!==null)for(s=q_(s);s!==null;){if(f=s[He])return f;s=q_(s)}return l}s=f,f=s.parentNode}return null}function lr(s){if(s=s[He]||s[ht]){var l=s.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return s}return null}function cr(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(r(33))}function mn(s){var l=s[kn];return l||(l=s[kn]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Pt(s){s[nr]=!0}var Zn=new Set,wn={};function pt(s,l){Ar(s,l),Ar(s+"Capture",l)}function Ar(s,l){for(wn[s]=l,s=0;s<l.length;s++)Zn.add(l[s])}var jr=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u2 Line truncated
`).replace(e3,"")}function L_(s,l){return l=O_(l),O_(s)===l}function dn(s,l,f,x,b,E){switch(f){case"children":typeof x=="string"?l==="body"||l==="textarea"&&x===""||Rs(s,x):(typeof x=="number"||typeof x=="bigint")&&l!=="body"&&Rs(s,""+x);break;case"className":Nt(s,"class",x);break;case"tabIndex":Nt(s,"tabindex",x);break;case"dir":case"role":case"viewBox":case"width":case"height":Nt(s,f,x);break;case"style":si(s,x,E);break;case"data":if(l!=="object"){Nt(s,"data",x);break}case"src":case"href":if(x===""&&(l!=="a"||f!=="href")){s.removeAttribute(f);break}if(x==null||typeof x=="function"||typeof x=="symbol"||typeof x=="boolean"){s.removeAttribute(f);break}x=sa(""+x),s.setAttribute(f,x);break;case"action":case"formAction":if(typeof x=="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"&&dn(s,l,"name",b.name,b,null),dn(s,l,"formEncType",b.formEncType,b,null),dn(s,l,"formMethod",b.formMethod,b,null),dn(s,l,"formTarget",b.formTarget,b,null)):(dn(s,l,"encType",b.encType,b,null),dn(s,l,"method",b.method,b,null),dn(s,l,"target",b.target,b,null)));if(x==null||typeof x=="symbol"||typeof x=="boolean"){s.removeAttribute(f);break}x=sa(""+x),s.setAttribute(f,x);break;case"onClick":x!=null&&(s.onclick=oi);break;case"onScroll":x!=null&&At("scroll",s);break;case"onScrollEnd":x!=null&&At("scrollend",s);break;case"dangerouslySetInnerHTML":if(x!=null){if(typeof x!="object"||!("__html"in x))throw Error(r(61));if(f=x.__html,f!=null){if(b.children!=null)throw Error(r(60));s.innerHTML=f}}break;case"multiple":s.multiple=x&&typeof x!="function"&&typeof x!="symbol";break;case"muted":s.muted=x&&typeof x!="function"&&typeof x!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(x==null||typeof x=="function"||typeof x=="boolean"||typeof x=="symbol"){s.removeAttribute("xlink:href");break}f=sa(""+x),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":x!=null&&typeof x!="function"&&typeof x!="symbol"?s.setAttribute(f,""+x):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":x&&typeof x!="function"&&typeof x!="symbol"?s.setAttribute(f,""):s.removeAttribute(f);break;case"capture":case"download":x===!0?s.setAttribute(f,""):x!==!1&&x!=null&&typeof x!="function"&&typeof x!="symbol"?s.setAttribute(f,x):s.removeAttribute(f);break;case"cols":case"rows":case"size":case"span":x!=null&&typeof x!="function"&&typeof x!="symbol"&&!isNaN(x)&&1<=x?s.setAttribute(f,x):s.removeAttribute(f);break;case"rowSpan":case"start":x==null||typeof x=="function"||typeof x=="symbol"||isNaN(x)?s.removeAttribute(f):s.setAttribute(f,x);break;case"popover":At("beforetoggle",s),At("toggle",s),sn(s,"popover",x);break;case"xlinkActuate":vr(s,"http://www.w3.org/1999/xlink","xlink:actuate",x);break;case"xlinkArcrole":vr(s,"http://www.w3.org/1999/xlink","xlink:arcrole",x);break;case"xlinkRole":vr(s,"http://www.w3.org/1999/xlink","xlink:role",x);break;case"xlinkShow":vr(s,"http://www.w3.org/1999/xlink","xlink:show",x);break;case"xlinkTitle":vr(s,"http://www.w3.org/1999/xlink","xlink:title",x);break;case"xlinkType":vr(s,"http://www.w3.org/1999/xlink","xlink:type",x);break;case"xmlBase":vr(s,"http://www.w3.org/XML/1998/namespace","xml:base",x);break;case"xmlLang":vr(s,"http://www.w3.org/XML/1998/namespace","xml:lang",x);break;case"xmlSpace":vr(s,"http://www.w3.org/XML/1998/namespace","xml:space",x);break;case"is":sn(s,"is",x);break;case"innerText":case"textContent":break;default:(!(2<f.length)||f[0]!=="o"&&f[0]!=="O"||f[1]!=="n"&&f[1]!=="N")&&(f=oh.get(f)||f,sn(s,f,x))}}function Bp(s,l,f,x,b,E){switch(f){case"style":si(s,x,E);break;case"dangerouslySetInnerHTML":if(x!=null){if(typeof x!="object"||!("__html"in x))throw Error(r(61));if(f=x.__html,f!=null){if(b.children!=null)throw Error(r(60));s.innerHTML=f}}break;case"children":typeof x=="string"?Rs(s,x):(typeof x=="number"||typeof x=="bigint")&&Rs(s,""+x);break;case"onScroll":x!=null&&At("scroll",s);break;case"onScrollEnd":x!=null&&At("scrollend",s);break;case"onClick":x!=null&&(s.onclick=oi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"inne Line truncated
`),oe=h.map(([de,se])=>` [${de}, ${se}],`).join(`
`);return`const MAP_STR: string[] = [
${re}
]
const SEATS: [number, number][] = [
${oe}
]`})(),J=()=>I(te=>Math.min(te+.25,3)),P=()=>I(te=>Math.max(te-.25,.5)),X=m.flat().filter(te=>te===1).length,ee=m.flat().filter(te=>te===0).length;return c.jsxs("div",{className:"collision-editor",children:[c.jsxs("div",{className:"ce-toolbar",children:[c.jsxs("div",{className:"ce-toolbar-group",children:[c.jsx("span",{className:"ce-title",children:"Map Editor"}),c.jsx("select",{className:"ce-office-select",value:a,onChange:te=>M(te.target.value),children:i.map(te=>c.jsx("option",{value:te.id,children:te.name},te.id))})]}),c.jsxs("div",{className:"ce-toolbar-group",children:[c.jsxs("button",{className:`ce-mode-btn ${y==="wall"?"active wall":""}`,onClick:()=>v("wall"),children:[c.jsx("span",{className:"ce-mode-dot wall"})," Wall"]}),c.jsxs("button",{className:`ce-mode-btn ${y==="floor"?"active floor":""}`,onClick:()=>v("floor"),children:[c.jsx("span",{className:"ce-mode-dot floor"})," Floor"]}),c.jsxs("button",{className:`ce-mode-btn ${y==="seat"?"active seat":""}`,onClick:()=>v("seat"),children:[c.jsx("span",{className:"ce-mode-dot seat"})," Seat"]})]}),c.jsxs("div",{className:"ce-toolbar-group",children:[c.jsx("button",{className:"ce-btn",onClick:P,children:"-"}),c.jsxs("span",{className:"ce-zoom-label",children:[Math.round(O*100),"%"]}),c.jsx("button",{className:"ce-btn",onClick:J,children:"+"}),c.jsx("button",{className:`ce-btn${D?" active":""}`,onClick:()=>T(te=>!te),children:"Grid"})]}),c.jsxs("div",{className:"ce-toolbar-group",children:[c.jsx("button",{className:`ce-btn apply${C?" success":""}`,onClick:Y,children:C?"Applied":"Apply"}),c.jsx("button",{className:`ce-btn${_?" active":""}`,onClick:Q,children:"Export"}),c.jsx("button",{className:"ce-btn danger",onClick:q,children:"Reset"})]}),c.jsxs("div",{className:"ce-toolbar-group ce-stats",children:[c.jsxs("span",{children:["Walls: ",X]}),c.jsxs("span",{children:["Floor: ",ee]}),c.jsxs("span",{children:["Seats: ",h.length]})]})]}),c.jsxs("div",{className:"ce-body",children:[c.jsx("div",{className:"ce-canvas-wrap",style:{overflow:"auto"},children:c.jsx("canvas",{ref:t,style:{width:L*R*O,height:A*R*O,imageRendering:"pixelated",cursor:y==="seat"?"crosshair":"cell"},onMouseDown:U,onMouseMove:H,onMouseUp:V,onMouseLeave:V})}),_&&c.jsxs("div",{className:"ce-export-panel",children:[c.jsxs("div",{className:"ce-export-header",children:[c.jsx("span",{children:"Export — copy to source code"}),c.jsx("button",{className:"ce-btn",onClick:()=>navigator.clipboard.writeText(G),children:"Copy"})]}),c.jsx("textarea",{className:"ce-export-textarea",value:G,readOnly:!0,rows:20})]})]})]})}let qM=0;function tr(e,t,n={}){return{event_id:`test-${++qM}`,type:e,agent_id:t,data:n,timestamp:Date.now()/1e3}}function En(e){return new Promise(t=>setTimeout(t,e))}async function WM(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 M of[...n.agents.keys()])n.removeAgent(M);await En(100);const r=Bn();t.push({name:"offices-loaded",pass:r.length>=3,detail:`${r.length} offices loaded: ${r.map(M=>M.name).join(", ")}`});const i=["agent-A","agent-B","agent-C","agent-D","agent-E","agent-F"];for(const M of i)e.pushEvent(tr("agent_active",M));await En(300);const o=new Set;let a=!1;for(const M of i){const $=n.getAgent(M);$&&$.seatId&&(o.has($.seatId)&&(a=!0),o.add($.seatId))}t.push({name:"desk-assignment-unique",pass:!a&&o.size===i.length,detail:`Assigned ${o.size} unique seats to ${i.length} agents. IDs: [${[...o].join(", ")}]`});const u=i.every(M=>n.getAgent(M)?.officeId!=null);t.push({name:"agents-have-officeId",pass:u,detail:i.map(M=>`${M}=${n.getAgent(M)?.officeId}`).join(", ")}),e.pushEvent(tr("tool_start","agent-A",{tool_name:"shell"})),await En(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(tr("tool_done","agent-A",{tool_name:"shell"})),await En(100),t.push({name:"tool_done-celebrate",pass:d.agentState==="celebrate",detail:`state=${d.agentState}`});for(let M=0;M<20&&d.agentState==="celebrate";M++)await En(500);t.push({name:"celebrate-to-idle",pass:d.agentState!=="celebrate",detail:`state=${d.agentState}`}),e.pushEvent(tr("waiting","agent-B")),await En(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(tr("reflect_start","agent-C")),await En(200);const p=n.getAgent("agent-C");t.push({name:"reflect_start-state",pass:p.currentTool==="Reflect"&&(p.agentState==="walk"||p.agentState==="reflect"),detail:`currentTool=${p.currentTool}, state=${p.agentState}`}),e.pushEvent(tr("reflect_done","agent-C")),await En(100),t.push({name:"reflect_done-celebrate",pass:p.agentState==="celebrate",detail:`staLine truncated
font-size: .6rem;
font-weight: bold;
color: hsl(${Math.max(0,Math.min(120-120*S,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(o&&n.skipInitialOnChange)&&n.onChange(i),o=!1,i}return a.updateDeps=u=>{r=u},a}function Gk(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const i4=(e,t)=>Math.abs(e-t)<1.01,s4=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},qk=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},o4=e=>e,a4=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let i=t;i<=n;i++)r.push(i);return r},l4=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const i=a=>{const{width:u,height:d}=a;t({width:Math.round(u),height:Math.round(d)})};if(i(qk(n)),!r.ResizeObserver)return()=>{};const o=new r.ResizeObserver(a=>{const u=()=>{const d=a[0];if(d?.borderBoxSize){const m=d.borderBoxSize[0];if(m){i({width:m.inlineSize,height:m.blockSize});return}}i(qk(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(u):u()});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},Wk={passive:!0},Yk=typeof window>"u"?!0:"onscrollend"in window,c4=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let i=0;const o=e.options.useScrollendEvent&&Yk?()=>{}:s4(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),a=p=>()=>{const{horizontal:h,isRtl:g}=e.options;i=h?n.scrollLeft*(g&&-1||1):n.scrollTop,o(),t(i,p)},u=a(!0),d=a(!1);n.addEventListener("scroll",u,Wk);const m=e.options.useScrollendEvent&&Yk;return m&&n.addEventListener("scrollend",d,Wk),()=>{n.removeEventListener("scroll",u),m&&n.removeEventListener("scrollend",d)}},u4=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},d4=(e,{adjustments:t=0,behavior:n},r)=>{var i,o;const a=e+t;(o=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||o.call(i,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class f4{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,r,i;return((i=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:i.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(o=>{const a=()=>{const u=o.target,d=this.indexFromElement(u);if(!u.isConnected){this.observer.unobserve(u);return}this.shouldMeasureDuringScroll(d)&&this.resizeItem(d,this.options.measureElement(u,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),n=null},observe:i=>{var o;return(o=r())==null?void 0:o.observe(i,{box:"border-box"})},unobserve:i=>{var o;return(o=r())==null?void 0:o.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,i])=>{typeof i>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:o4,rangeExtractor:a4,onChange:()=>{},measureElement:u4,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 r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=Va(()=>(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 r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,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(i=>{this.observer.observe(i)} Line truncated
The error may be correlated with this previous error:
${te.current.stack}
`),we}Vf(()=>{te.current=void 0,P.current=void 0,G.current=de});const se=j.useMemo(()=>j.createElement(S,{...de,ref:L}),[L,S,de]);return j.useMemo(()=>v?j.createElement(M.Provider,{value:q},se):se,[M,se,q])}const I=j.memo(N);if(I.WrappedComponent=S,I.displayName=N.displayName=w,d){const T=j.forwardRef(function(A,M){return j.createElement(I,{...A,reactReduxForwardedRef:M})});return T.displayName=w,T.WrappedComponent=S,Ay(T,S)}return Ay(I,S)}}var oE=K5;function Z5(e){const{children:t,context:n,serverState:r,store:i}=e,o=j.useMemo(()=>{const d=rE(i);return{store:i,subscription:d,getServerState:r?()=>r:void 0}},[i,r]),a=j.useMemo(()=>i.getState(),[i]);Vf(()=>{const{subscription:d}=o;return d.onStateChange=d.notifyNestedSubs,d.trySubscribe(),a!==i.getState()&&d.notifyNestedSubs(),()=>{d.tryUnsubscribe(),d.onStateChange=void 0}},[o,a]);const u=n||sE;return j.createElement(u.Provider,{value:o},t)}var Q5=Z5,J5="Invariant failed";function eD(e,t){throw new Error(J5)}var Ti=function(t){var n=t.top,r=t.right,i=t.bottom,o=t.left,a=r-o,u=i-n,d={top:n,right:r,bottom:i,left:o,width:a,height:u,x:o,y:n,center:{x:(r+o)/2,y:(i+n)/2}};return d},M0=function(t,n){return{top:t.top-n.top,left:t.left-n.left,bottom:t.bottom+n.bottom,right:t.right+n.right}},vS=function(t,n){return{top:t.top+n.top,left:t.left+n.left,bottom:t.bottom-n.bottom,right:t.right-n.right}},tD=function(t,n){return{top:t.top+n.y,left:t.left+n.x,bottom:t.bottom+n.y,right:t.right+n.x}},bg={top:0,right:0,bottom:0,left:0},D0=function(t){var n=t.borderBox,r=t.margin,i=r===void 0?bg:r,o=t.border,a=o===void 0?bg:o,u=t.padding,d=u===void 0?bg:u,m=Ti(M0(n,i)),p=Ti(vS(n,a)),h=Ti(vS(p,d));return{marginBox:m,borderBox:Ti(n),paddingBox:p,contentBox:h,margin:i,border:a,padding:d}},gi=function(t){var n=t.slice(0,-2),r=t.slice(-2);if(r!=="px")return 0;var i=Number(n);return isNaN(i)&&eD(),i},nD=function(){return{x:window.pageXOffset,y:window.pageYOffset}},Uf=function(t,n){var r=t.borderBox,i=t.border,o=t.margin,a=t.padding,u=tD(r,n);return D0({borderBox:u,border:i,margin:o,padding:a})},Gf=function(t,n){return n===void 0&&(n=nD()),Uf(t,n)},aE=function(t,n){var r={top:gi(n.marginTop),right:gi(n.marginRight),bottom:gi(n.marginBottom),left:gi(n.marginLeft)},i={top:gi(n.paddingTop),right:gi(n.paddingRight),bottom:gi(n.paddingBottom),left:gi(n.paddingLeft)},o={top:gi(n.borderTopWidth),right:gi(n.borderRightWidth),bottom:gi(n.borderBottomWidth),left:gi(n.borderLeftWidth)};return D0({borderBox:t,margin:r,padding:i,border:o})},lE=function(t){var n=t.getBoundingClientRect(),r=window.getComputedStyle(t);return aE(n,r)},cu=function(t){var n=[],r=null,i=function(){for(var a=arguments.length,u=new Array(a),d=0;d<a;d++)u[d]=arguments[d];n=u,!r&&(r=requestAnimationFrame(function(){r=null,t.apply(void 0,n)}))};return i.cancel=function(){r&&(cancelAnimationFrame(r),r=null)},i};function qf(){return qf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qf.apply(null,arguments)}function cE(e,t){}cE.bind(null,"warn");cE.bind(null,"error");function fo(){}function rD(e,t){return{...e,...t}}function bi(e,t,n){const r=t.map(i=>{const o=rD(n,i.options);return e.addEventListener(i.eventName,i.fn,o),function(){e.removeEventListener(i.eventName,i.fn,o)}});return function(){r.forEach(o=>{o()})}}const iD="Invariant failed";class Wf extends Error{}Wf.prototype.toString=function(){return this.message};function Le(e,t){throw new Wf(iD)}let sD=class extends St.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=fo,this.onWindowError=n=>{const r=this.getCallbacks();r.isDragging()&&r.tryAbort(),n.error instanceof Wf&&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=bi(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof Wf){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}};const oD=`
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
`,Yf=e=>e+1,aD=e=>`
You have lifted an item in position ${Yf(e.source.index)}
`,uE=(e,t)=>{const n=e.droppableId===t.droppableId,r=Yf(e.index),i=Yf(t.index);return n?`
You have moved the item from position ${r}
to position ${i}
`:`
You have moved the item from position ${r}
in list ${e.droppableId}
to list ${t.droppableId}
in position ${i}
`},dE=(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}
`,lD=e=>{const t=e.destination;if(t)return uE(e.source,t);const n=e.combine;return n?dE(e.draggableId,e.source,n):"You are over an area that cannot be dropped on"},bS=e=>`
The item has returned to its starting position
of ${Yf(e.index)}
`,cD=e=>{if(e.reason==="CANCEL")return`
Movement cancelled.
${bS(e.source)}
`;const t=e.destination,n=e.combine;return t?`
You have dropped the item.
${uE(e.source,t)}
`:n?`
You have dropped the item.
${dE(e.draggableId,e.source,n)}
`:`
The item has been dropped while not over a drop area.
${bS(e.source)}
`},Ef={dragHandleUsageInstructions:oD,onDragStart:aD,onDragUpdate:lD,onDragEnd:cD};function uD(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function fE(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!uD(e[n],t[n]))return!1;return!0}function Vt(e,t){const n=j.useState(()=>({inputs:t,result:e()}))[0],r=j.useRef(!0),i=j.useRef(n),a=r.current||!!(t&&i.current.inputs&&fE(t,i.current.inputs))?i.current:{inputs:t,result:e()};return j.useEffect(()=>{r.current=!1,i.current=a},[a]),a.result}function st(e,t){return Vt(()=>e,t)}const ar={x:0,y:0},xr=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),Jr=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),mo=(e,t)=>e.x===t.x&&e.y===t.y,Il=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),qo=(e,t,n=0)=>e==="x"?{x:t,y:n}:{x:n,y:t},uu=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),_S=(e,t)=>Math.min(...t.map(n=>uu(e,n))),mE=e=>t=>({x:e(t.x),y:e(t.y)});var dD=(e,t)=>{const n=Ti({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 Iu=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),kS=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}],fD={top:0,right:0,bottom:0,left:0},mD=(e,t)=>t?Iu(e,t.scroll.diff.displacement):e,hD=(e,t,n)=>n&&n.increasedBy?{...e,[t.end]:e[t.end]+n.increasedBy[t.line]}:e,pD=(e,t)=>t&&t.shouldClipSubject?dD(t.pageMarginBox,e):Ti(e);var ml=({page:e,withPlaceholder:t,axis:n,frame:r})=>{const i=mD(e.marginBox,r),o=hD(i,n,t),a=pD(o,r);return{page:e,withPlaceholder:t,active:a}},O0=(e,t)=>{e.frame||Le();const n=e.frame,r=Jr(t,n.scroll.initial),i=Il(r),o={...n,scroll:{initial:n.scroll.initial,current:t,diff:{value:r,displacement:i},max:n.scroll.max}},a=ml({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:o});return{...e,frame:o,subject:a}};function or(e,t=fE){let n=null;function r(...i){if(n&&n.lastThis===this&&t(i,n.lastArgs))return n.lastResult;const o=e.apply(this,i);return n={lastResult:o,lastArgs:i,lastThis:this},o}return r.clear=function(){n=null},r}const hE=or(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),pE=or(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),Im=or(e=>Object.values(e)),gD=or(e=>Object.values(e));var Tl=or((e,t)=>gD(t).filter(r=>e===r.descriptor.droppableId).sort((r,i)=>r.descriptor.index-i.descriptor.index));function L0(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function Tm(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var Rm=or((e,t)=>t.filter(n=>n.descriptor.id!==e.descriptor.id)),xD=({isMovingForward:e,draggable:t,destination:n,insideDestination:r,previousImpact:i})=>{if(!n.isCombineEnabled||!L0(i))return null;function a(y){const v={type:"COMBINE",combine:{draggableId:y,droppableId:n.descriptor.id}};return{...i,at:v}}const u=i.displaced.all,d=u.length?u[0]:null;if(e)return d?a(d):null;const m=Rm(t,r);if(!d){if(!m.length)return null;const y=m[m.length-1];return a(y.descriptor.id)}const p=m.findIndex(y=>y.descriptor.id===d);p===-1&&Le();const h=p-1;if(h<0)return null;const g=m[h];return a(g.descriptor.id)},Rl=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const gE={point:ar,value:0},du={invisible:{},visible:{},all:[]},yD={displaced:du,displacedBy:gE,at:null};var _i=(e,t)=>n=>e<=n&&n<=t,xE=e=>{const t=_i(e.top,e.bottom),n=_i(e.left,e.right);return r=>{if(t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right))return!0;const o=t(r.top)||t(r.bottom),a=n(r.left)||n(r.right);if(o&&a)return!0;const d=r.top<e.top&&r.bottom>e.bottom,m=r.left<e.left&&r.right>e.right;return d&&m?!0:d&&a||m&&o}},vD=e=>{const t=_i(e.top,e.bottom),n=_i(e.left,e.right);return r=>t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right)};const z0={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},yE={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var bD=e=>t=>{const n=_i(t.top,t.bottom),r=_i(t.left,t.right);return i=>e===z0?n(i.top)&&n(i.bottom):r(i.left)&&r(i.right)};const _D=(e,t)=>{const n=t.frame?t.frame.scroll.diff.displacement:ar;return Iu(e,n)},kD=(e,t,n)=>t.subject.active?n(t.subject.active)(e):!1,SD=(e,t,n)=>n(t)(e),P0=({target:e,destination:t,viewport:n,withDroppableDisplacement:r,isVisibleThroughFrameFn:i})=>{const o=r?_D(e,t):e;return kD(o,t,i)&&SD(o,n,i)},wD=e=>P0({...e,isVisibleThroughFrameFn:xE}),vE=e=>P0({...e,isVisibleThroughFrameFn:vD}),CD=e=>P0({...e,isVisibleThroughFrameFn:bD(e.destination.axis)}),jD=(e,t,n)=>{if(typeof n=="boolean")return n;if(!t)return!0;const{invisible:r,visible:i}=t;if(r[e])return!1;const o=i[e];return o?o.shouldAnimate:!0};function ED(e,t){const n=e.page.marginBox,r={top:t.point.y,right:0,bottom:0,left:t.point.x};return Ti(M0(n,r))}function fu({afterDragging:e,destination:t,displacedBy:n,viewport:r,forceShouldAnimate:i,la Line truncated
cursor: -webkit-grab;
cursor: grab;
`;return{selector:t(pl.contextId),styles:{always:`
-webkit-touch-callout: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
touch-action: manipulation;
`,resting:u,dragging:NL,dropAnimating:u}}})(),r=(()=>{const u=`
transition: ${Qc.outOfTheWay};
`;return{selector:t(zy.contextId),styles:{dragging:u,dropAnimating:u,userCancel:u}}})(),i={selector:t(jL.contextId),styles:{always:"overflow-anchor: none;"}},a=[r,n,i,{selector:"body",styles:{dragging:`
cursor: grabbing;
cursor: -webkit-grabbing;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
overflow-anchor: none;
`}}];return{always:Tc(a,"always"),resting:Tc(a,"resting"),dragging:Tc(a,"dragging"),dropAnimating:Tc(a,"dropAnimating"),userCancel:Tc(a,"userCancel")}};const ti=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?j.useLayoutEffect:j.useEffect,Cg=()=>{const e=document.querySelector("head");return e||Le(),e},LS=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function TL(e,t){const n=Vt(()=>IL(e),[e]),r=j.useRef(null),i=j.useRef(null),o=st(or(h=>{const g=i.current;g||Le(),g.textContent=h}),[]),a=st(h=>{const g=r.current;g||Le(),g.textContent=h},[]);ti(()=>{!r.current&&!i.current||Le();const h=LS(t),g=LS(t);return r.current=h,i.current=g,h.setAttribute(`${hl}-always`,e),g.setAttribute(`${hl}-dynamic`,e),Cg().appendChild(h),Cg().appendChild(g),a(n.always),o(n.resting),()=>{const y=v=>{const k=v.current;k||Le(),Cg().removeChild(k),v.current=null};y(r),y(i)}},[t,a,o,n.always,n.resting,e]);const u=st(()=>o(n.dragging),[o,n.dragging]),d=st(h=>{if(h==="DROP"){o(n.dropAnimating);return}o(n.userCancel)},[o,n.dropAnimating,n.userCancel]),m=st(()=>{i.current&&o(n.resting)},[o,n.resting]);return Vt(()=>({dragging:u,dropping:d,resting:m}),[u,d,m])}function qE(e,t){return Array.from(e.querySelectorAll(t))}var WE=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function Mm(e){return e instanceof WE(e).HTMLElement}function RL(e,t){const n=`[${pl.contextId}="${e}"]`,r=qE(document,n);if(!r.length)return null;const i=r.find(o=>o.getAttribute(pl.draggableId)===t);return!i||!Mm(i)?null:i}function AL(e){const t=j.useRef({}),n=j.useRef(null),r=j.useRef(null),i=j.useRef(!1),o=st(function(g,y){const v={id:g,focus:y};return t.current[g]=v,function(){const S=t.current;S[g]!==v&&delete S[g]}},[]),a=st(function(g){const y=RL(e,g);y&&y!==document.activeElement&&y.focus()},[e]),u=st(function(g,y){n.current===g&&(n.current=y)},[]),d=st(function(){r.current||i.current&&(r.current=requestAnimationFrame(()=>{r.current=null;const g=n.current;g&&a(g)}))},[a]),m=st(function(g){n.current=null;const y=document.activeElement;y&&y.getAttribute(pl.draggableId)===g&&(n.current=g)},[]);return ti(()=>(i.current=!0,function(){i.current=!1;const g=r.current;g&&cancelAnimationFrame(g)}),[]),Vt(()=>({register:o,tryRecordFocus:m,tryRestoreFocusRecorded:d,tryShiftRecord:u}),[o,m,d,u])}function ML(){const e={draggables:{},droppables:{}},t=[];function n(h){return t.push(h),function(){const y=t.indexOf(h);y!==-1&&t.splice(y,1)}}function r(h){t.length&&t.forEach(g=>g(h))}function i(h){return e.draggables[h]||null}function o(h){const g=i(h);return g||Le(),g}const a={register:h=>{e.draggables[h.descriptor.id]=h,r({type:"ADDITION",value:h})},update:(h,g)=>{const y=e.draggables[g.descriptor.id];y&&y.uniqueId===h.uniqueId&&(delete e.draggables[g.descriptor.id],e.draggables[h.descriptor.id]=h)},unregister:h=>{const g=h.descriptor.id,y=i(g);y&&h.uniqueId===y.uniqueId&&(delete e.draggables[g],e.droppables[h.descriptor.droppableId]&&r({type:"REMOVAL",value:h}))},getById:o,findById:i,exists:h=>!!i(h),getAllByType:h=>Object.values(e.draggables).filter(g=>g.descriptor.type===h)};function u(h){return e.droppables[h]||null}function d(h){const g=u(h);return g||Le(),g}const m={register:h=>{e.droppables[h.descriptor.id]=h},unregister:h=>{const g=u(h.descriptor.id);g&&h.uniqueId===g.uniqueId&&delete e.droppables[h.descriptor.id]},getById:d,findById:u,exists:h=>!!u(h),getAllByType:h=>Object.values(e.droppables).filter(g=>g.descriptor.type===h)};function p(){e.draggables={},e.droppables={},t.length=0}return{draggable:a,droppable:m,subscribe:n,clean:p}}function DL(){const e=Vt(ML,[]);return j.useEffect(()=>function(){e.clean()},[e]),e}var X0=St.createContext(null),Kf=()=>{const e=document.body;return e||Le(),e};const OL={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},LL=e=>`rfd-announcement-${e}`;function zL(e){const t=Vt(()=>LL(e),[e]),n=j.useRef(null);return j.useEffect(function(){const o=document.createElement("div");return n.current=o,o.id=t,o.setAttribute("aria-live","assertive"),o.setAttribute("aria-atomic","true"),qf(o.style,OL),Kf().appendChild(o),function(){setTimeout(function(){const d=Kf();d.contains(o)&&d.removeChild(o),o===n.current&&(n.current=null)})}},[t]),st(i=>{const o=n.current;if(o){o.textContent=i;return}},[])}const PL={separator:"::"};function K0(e,t=PL){const n=St.useId();return Vt(()=>`${e}${t.separator}${n}`,[t.separator,e,n])}function BL({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function $L({contextId:e,text:t}){const n=K0("hidden-text",{separator:"-"}),r=Vt(()=>BL({contextId:e,uniqueId:n}),[n,e]);return j.useEffect(function(){const o=document.createElement("div");return o.id=r,o.textContent=t,o.style.display="none",Kf().appendChild(o),function(){const u=Kf();u.contains(o)&&u.removeChild(o)}},[r,t]),r}var Dm=St.c Line truncated
`,m="/",p="*",h="",g="comment",y="declaration";function v(S,_){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];_=_||{};var w=1,C=1;function N(B){var U=B.match(t);U&&(w+=U.length);var H=B.lastIndexOf(d);C=~H?B.length-H:C+B.length}function O(){var B={line:w,column:C};return function(U){return U.position=new I(B),L(),U}}function I(B){this.start=B,this.end={line:w,column:C},this.source=_.source}I.prototype.content=S;function D(B){var U=new Error(_.source+":"+w+":"+C+": "+B);if(U.reason=B,U.filename=_.source,U.line=w,U.column=C,U.source=S,!_.silent)throw U}function T(B){var U=B.exec(S);if(U){var H=U[0];return N(H),S=S.slice(H.length),U}}function L(){T(n)}function A(B){var U;for(B=B||[];U=M();)U!==!1&&B.push(U);return B}function M(){var B=O();if(!(m!=S.charAt(0)||p!=S.charAt(1))){for(var U=2;h!=S.charAt(U)&&(p!=S.charAt(U)||m!=S.charAt(U+1));)++U;if(U+=2,h===S.charAt(U-1))return D("End of comment missing");var H=S.slice(2,U-2);return C+=2,N(H),S=S.slice(U),C+=2,B({type:g,comment:H})}}function $(){var B=O(),U=T(r);if(U){if(M(),!T(i))return D("property missing ':'");var H=T(o),V=B({type:y,property:k(U[0].replace(e,h)),value:H?k(H[0].replace(e,h)):h});return T(a),V}}function W(){var B=[];A(B);for(var U;U=$();)U!==!1&&(B.push(U),A(B));return B}return L(),W()}function k(S){return S?S.replace(u,h):h}return Dg=v,Dg}var ew;function oz(){if(ew)return qa;ew=1;var e=qa&&qa.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(qa,"__esModule",{value:!0}),qa.default=n;const t=e(sz());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const a=(0,t.default)(r),u=typeof i=="function";return a.forEach(d=>{if(d.type!=="declaration")return;const{property:m,value:p}=d;u?i(m,p,d):p&&(o=o||{},o[m]=p)}),o}return qa}var Dc={},tw;function az(){if(tw)return Dc;tw=1,Object.defineProperty(Dc,"__esModule",{value:!0}),Dc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(m){return!m||n.test(m)||e.test(m)},a=function(m,p){return p.toUpperCase()},u=function(m,p){return"".concat(p,"-")},d=function(m,p){return p===void 0&&(p={}),o(m)?m:(m=m.toLowerCase(),p.reactCompat?m=m.replace(i,u):m=m.replace(r,u),m.replace(t,a))};return Dc.camelCase=d,Dc}var Oc,nw;function lz(){if(nw)return Oc;nw=1;var e=Oc&&Oc.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(oz()),n=az();function r(i,o){var a={};return!i||typeof i!="string"||(0,t.default)(i,function(u,d){u&&d&&(a[(0,n.camelCase)(u,o)]=d)}),a}return r.default=r,Oc=r,Oc}var cz=lz();const uz=ta(cz),vN=bN("end"),nv=bN("start");function bN(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function dz(e){const t=nv(e),n=vN(e);if(t&&n)return{start:t,end:n}}function Jc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?rw(e.position):"start"in e||"end"in e?rw(e):"line"in e||"column"in e?Fy(e):""}function Fy(e){return iw(e&&e.line)+":"+iw(e&&e.column)}function rw(e){return Fy(e&&e.start)+"-"+Fy(e&&e.end)}function iw(e){return e&&typeof e=="number"?e:1}class Cr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",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"?i=t:!o.cause&&t&&(a=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?o.ruleId=r:(o.source=r.slice(0,d),o.ruleId=r.slice(d+1))}if(!o.place&&o.ancestors&&o.ancestors){const d=o.ancestors[o.ancestors.length-1];d&&(o.place=d.position)}const u=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=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=u?u.line:void 0,this.name=Jc(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}}Cr.prototype.file="";Cr.prototype.name="";Cr.prototype.reason="";Cr.prototype.message="";Cr.prototype.stack="";Cr.prototype.column=void 0;Cr.prototype.line=void 0;Cr.prototype.ancestors=void 0;Cr.prototype.cause=void 0;Cr.prototype.fatal=void 0;Cr.prototype.place=void 0;Cr.prototype.ruleId=void 0;Cr.prototype.source=void 0;const rv={}.hasOwnProperty,fz=new Map,mz=/[A-Z]/g,hz=new Set(["table","tbody","thead","tfoot","tr"]),pz=new Set(["td","th"]),_N="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function gz(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.j Line truncated
`;break}case-3:{a=`\r
`;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&i)continue;a=" ";break}default:a=String.fromCharCode(o)}i=o===-2,r.push(a)}return r.join("")}function wB(e){const r={constructs:jN([bB,...(e||{}).extensions||[]]),content:i(Bz),defined:[],document:i(Hz),flow:i(sB),lazy:{},string:i(lB),text:i(cB)};return r;function i(o){return a;function a(u){return _B(r,o,u)}}}function CB(e){for(;!RN(e););return e}const hw=/[\0\t\n\r]/g;function jB(){let e=1,t="",n=!0,r;return i;function i(o,a,u){const d=[];let m,p,h,g,y;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(a||void 0).decode(o)),h=0,t="",n&&(o.charCodeAt(0)===65279&&h++,n=void 0);h<o.length;){if(hw.lastIndex=h,m=hw.exec(o),g=m&&m.index!==void 0?m.index:o.length,y=o.charCodeAt(g),!m){t=o.slice(h);break}if(y===10&&h===g&&r)d.push(-3),r=void 0;else switch(r&&(d.push(-5),r=void 0),h<g&&(d.push(o.slice(h,g)),e+=g-h),y){case 0:{d.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,d.push(-2);e++<p;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:r=!0,e=1}h=g+1}return u&&(r&&d.push(-5),t&&d.push(t),d.push(null)),d}}const EB=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function NB(e){return e.replace(EB,IB)}function IB(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return EN(n.slice(o?2:1),o?16:10)}return av(n)||e}const zN={}.hasOwnProperty;function TB(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),RB(n)(CB(wB(n).document().write(jB()(e,t,!0))))}function RB(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(bt),autolinkProtocol:L,autolinkEmail:L,atxHeading:o(Ge),blockQuote:o(se),characterEscape:L,characterReference:L,codeFenced:o(Ee),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(Ee,a),codeText:o(we,a),codeTextData:L,data:L,codeFlowValue:L,definition:o(Ce),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(Be),hardBreakEscape:o(Ye),hardBreakTrailing:o(Ye),htmlFlow:o(yt,a),htmlFlowData:L,htmlText:o(yt,a),htmlTextData:L,image:o(qt),label:a,link:o(bt),listItem:o(me),listItemValue:g,listOrdered:o(vt,h),listUnordered:o(vt),paragraph:o(Oe),reference:P,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(Ge),strong:o(rt),thematicBreak:o(Je)},exit:{atxHeading:d(),atxHeadingSequence:O,autolink:d(),autolinkEmail:de,autolinkProtocol:oe,blockQuote:d(),characterEscapeValue:A,characterReferenceMarkerHexadecimal:ee,characterReferenceMarkerNumeric:ee,characterReferenceValue:te,characterReference:re,codeFenced:d(S),codeFencedFence:k,codeFencedFenceInfo:y,codeFencedFenceMeta:v,codeFlowValue:A,codeIndented:d(_),codeText:d(U),codeTextData:A,data:A,definition:d(),definitionDestinationString:N,definitionLabelString:w,definitionTitleString:C,emphasis:d(),hardBreakEscape:d($),hardBreakTrailing:d($),htmlFlow:d(W),htmlFlowData:A,htmlText:d(B),htmlTextData:A,image:d(V),label:Q,labelText:Y,lineEnding:M,link:d(H),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:X,resourceDestinationString:q,resourceTitleString:G,resource:J,setextHeading:d(T),setextHeadingLineSequence:D,setextHeadingText:I,strong:d(),thematicBreak:d()}};PN(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(fe){let be={type:"root",children:[]};const Me={stack:[be],tokenStack:[],config:t,enter:u,exit:m,buffer:a,resume:p,data:n},Fe=[];let $e=-1;for(;++$e<fe.length;)if(fe[$e][1].type==="listOrdered"||fe[$e][1].type==="listUnordered")if(fe[$e][0]==="enter")Fe.push($e);else{const Wt=Fe.pop();$e=i(fe,Wt,$e)}for($e=-1;++$e<fe.length;){const Wt=t[fe[$e][0]];zN.call(Wt,fe[$e][1].type)&&Wt[fe[$e][1].type].call(Object.assign({sliceSerialize:fe[$e][2].sliceSerialize},Me),fe[$e][1])}if(Me.tokenStack.length>0){const Wt=Me.tokenStack[Me.tokenStack.length-1];(Wt[1]||pw).call(Me,void 0,Wt[0])}for(be.position={start:io(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:io(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},$e=-1;++$e<t.transforms.length;)be=t.transforms[$e](be)||be;return be}function i(fe,be,Me){let Fe=be-1,$e=-1,Wt=!1,nn,ke,Te,Pe;for(;++Fe<=Me;){const Ve=fe[Fe];switch(Ve[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ve[0]==="enter"?$e++:$e--,Pe=void 0;break}case"lineEndingBlank":{Ve[0]==="enter"&&(nn&&!Pe&&!$e&&!Te&&(Te=Fe),Pe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Pe=void 0}if(!$e&&Ve[0]==="enter"&&Ve[1].type==="listItemPrefix"||$e===-1&&Ve[0]==="exit"&&(Ve[1].type==="listUnordered"||Ve[1].type==="listOrdered")){if(nn){let qe=Fe;for(ke=void 0;qe--;){const et=fe[qe];if(et[1].type==="lineEnding"||et[1].type==="lineEndingBlank"){if(et[0]==="exit")continue;ke&&(fe[ke][1].type="lineEndingBlank",Wt=!0),et[1].type="lineEnding",ke=qe}else if(!(et[1].type==="linePrefix"||et[1].type==="blockQuotePrefix"||et[1].type==="blockQuotePrefixWhitespace"Line truncated
`}]}function LB(e,t){const n=t.value?t.value+`
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,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 zB(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PB(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function BB(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Ml(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let a,u=e.footnoteCounts.get(r);u===void 0?(u=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=o+1,u+=1,e.footnoteCounts.set(r,u);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(u>1?"-"+u:""),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 $B(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 HB(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function BN(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function FB(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return BN(e,t);const i={src:Ml(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function VB(e,t){const n={src:Ml(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 r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function UB(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function GB(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return BN(e,t);const i={href:Ml(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function qB(e,t){const n={href:Ml(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function WB(e,t,n){const r=e.all(t),i=n?YB(n):$N(t),o={},a=[];if(typeof t.checked=="boolean"){const p=r[0];let h;p&&p.type==="element"&&p.tagName==="p"?h=p:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let u=-1;for(;++u<r.length;){const p=r[u];(i||u!==0||p.type!=="element"||p.tagName!=="p")&&a.push({type:"text",value:`
`}),p.type==="element"&&p.tagName==="p"&&!i?a.push(...p.children):a.push(p)}const d=r[r.length-1];d&&(i||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 YB(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=$N(n[r])}return t}function $N(e){const t=e.spread;return t??e.children.length>1}function XB(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const a=r[i];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(r,!0)};return e.patch(t,o),e.applyData(t,o)}function KB(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ZB(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function QB(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function JB(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},u=nv(t.children[1]),d=vN(t.children[t.children.length-1]);u&&d&&(a.position={start:u,end:d}),i.push(a)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function e9(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,u=a?a.length:t.children.length;let d=-1;const m=[];for(;++d<u;){const h=t.children[d],g={},y=a?a[d]:void 0;y&&(g.align=y);let v={type:"element",tagName:o,properties:g,children:[]};h&&(v.children=e.all(h),e.patch(h,v),v=e.applyData(h,v)),m.push(v)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,p),e.applyData(t,p)}function t9(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const gw=9,xw=32;function n9(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push(yw(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(yw(t.slice(i),i>0,!1)),o.join("")}function yw(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===gw||o===xw;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===gw||o===xw;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function r9(e,t){const n={type:"text",value:n9(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function i9(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const s9={blockquote:DB,break:OB,code:LB,delete:zB,emphasis:PB,footnoteReference:BB,heading:$B,html:HB,imageReference:FB,image:VB,inlineCode:UB,linkReference:GB,link:qB,listItem:WB,list:XB,paragraph:KB,root:ZB,strong:QB,table:JB,tableCell:t9,tableRow:e9,text:r9,thematicBreak:i9,toml:ef,yaml:ef,definition:ef,footnoteDefinition:ef};function ef(){}const HN=-1,$m=0,tu=1,nm=2,cv=3,uv=4,dv=5,fv=6,FN=7,VN=8,vw=typeof self=="object"?self:globalThis,o9=(e,t)=>{const n=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,a]=t[i];switch(o){case $m:case HN:return n(a,i);case tu:{const u=n([],i);for(const d of a)u.push(r(d));return u}case nm:{const u=n({},i);for(const[d,m]of a)u[r(d)]=r(m);return u}case cv:return n(new Date(a),i);case uv:{const{source:u,flags:d}=a;return n(new RegExp(u,d),i)}case dv:{const u=n(new Map,i);for(const[d,m]of a)u.set(r(d),r(m));return u}case fv:{const u=n(new Set,i);for(const d of a)u.add(r(d));return u}case FN:{const{name:u,message:d}=a;return n(new vw[u](d),i)}case VN:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:u}=new Uint8Array(a);return n(new DataView(u),a)}}return n(new vw[o](a),i)};return r},bw=e=>o9(new Map,e)(0),Wa="",{toString:a9}={},{keys:l9}=Object,zc=e=>{const t=typeof e;if(t!=="object"||!e)return[$m,t];const n=a9.call(e).slice(8,-1);switch(n){case"Array":return[tu,Wa];case"Object":return[nm,Wa];case"Date":return[cv,Wa];case"RegExp":return[uv,Wa];case"Map":return[dv,Wa];case"Set":return[fv,Wa];case"DataView":return[tu,n]}return n.includes("Array")?[tu,n]:n.includes("Error")?[FN,n]:[nm,n]},tf=([e,t])=>e===$m&&(t==="function"||t==="symbol"),c9=(e,t,n,r)=>{const i=(a,u)=>{const d=r.push(a)-1;return n.set(u,d),d},o=a=>{if(n.has(a))return n.get(a);let[u,d]=zc(a);switch(u){case $m:{let p=a;switch(d){case"bigint":u=VN,p=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);p=null;break;case"undefined":return i([HN],a)}return i([u,p],a)}case tu:{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(u,!0)},{type:"text",value:`
`}]}}const Hm=(function(e){if(e==null)return g9;if(typeof e=="function")return Fm(e);if(typeof e=="object")return Array.isArray(e)?m9(e):h9(e);if(typeof e=="string")return p9(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]=Hm(e[n]);return Fm(r);function r(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function h9(e){const t=e;return Fm(n);function n(r){const i=r;let o;for(o in e)if(i[o]!==t[o])return!1;return!0}}function p9(e){return Fm(t);function t(n){return n&&n.type===e}}function Fm(e){return t;function t(n,r,i){return!!(x9(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function g9(){return!0}function x9(e){return e!==null&&typeof e=="object"&&"type"in e}const UN=[],y9=!0,Gy=!1,v9="skip";function GN(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const o=Hm(i),a=r?-1:1;u(e,void 0,[])();function u(d,m,p){const h=d&&typeof d=="object"?d:{};if(typeof h.type=="string"){const y=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(d.type+(y?"<"+y+">":""))+")"})}return g;function g(){let y=UN,v,k,S;if((!t||o(d,m,p[p.length-1]||void 0))&&(y=b9(n(d,p)),y[0]===Gy))return y;if("children"in d&&d.children){const _=d;if(_.children&&y[0]!==v9)for(k=(r?_.children.length:-1)+a,S=p.concat(_);k>-1&&k<_.children.length;){const w=_.children[k];if(v=u(w,k,S)(),v[0]===Gy)return v;k=typeof v[1]=="number"?v[1]:k+a}}return y}}}function b9(e){return Array.isArray(e)?e:typeof e=="number"?[y9,e]:e==null?UN:[e]}function mv(e,t,n,r){let i,o,a;typeof t=="function"&&typeof n!="function"?(o=void 0,a=t,i=n):(o=t,a=n,i=r),GN(e,o,u,i);function u(d,m){const p=m[m.length-1],h=p?p.children.indexOf(d):void 0;return a(d,h,p)}}const qy={}.hasOwnProperty,_9={};function k9(e,t){const n=t||_9,r=new Map,i=new Map,o=new Map,a={...s9,...n.handlers},u={all:m,applyData:w9,definitionById:r,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:a,one:d,options:n,patch:S9,wrap:j9};return mv(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const h=p.type==="definition"?r:i,g=String(p.identifier).toUpperCase();h.has(g)||h.set(g,p)}}),u;function d(p,h){const g=p.type,y=u.handlers[g];if(qy.call(u.handlers,g)&&y)return y(u,p,h);if(u.options.passThrough&&u.options.passThrough.includes(g)){if("children"in p){const{children:k,...S}=p,_=rm(S);return _.children=u.all(p),_}return rm(p)}return(u.options.unknownHandler||C9)(u,p,h)}function m(p){const h=[];if("children"in p){const g=p.children;let y=-1;for(;++y<g.length;){const v=u.one(g[y],p);if(v){if(y&&g[y-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=kw(v.value)),!Array.isArray(v)&&v.type==="element")){const k=v.children[0];k&&k.type==="text"&&(k.value=kw(k.value))}Array.isArray(v)?h.push(...v):h.push(v)}}}return h}}function S9(e,t){e.position&&(t.position=dz(e))}function w9(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&o&&Object.assign(n.properties,rm(o)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function C9(e,t){const n=t.data||{},r="value"in t&&!(qy.call(n,"hProperties")||qy.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function j9(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
`});++r<e.length;)r&&n.push({type:"text",value:`
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
`}),n}function kw(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Sw(e,t){const n=k9(e,t),r=n.one(e,void 0),i=f9(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
`},i),o}function E9(e,t){return e&&"run"in e?async function(n,r){const i=Sw(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Sw(n,{file:r,...e||t})}}function ww(e){if(e)throw e}var Pg,Cw;function N9(){if(Cw)return Pg;Cw=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=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 p=e.call(m,"constructor"),h=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!p&&!h)return!1;var g;for(g in m);return typeof g>"u"||e.call(m,g)},a=function(m,p){n&&p.name==="__proto__"?n(m,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):m[p.name]=p.newValue},u=function(m,p){if(p==="__proto__")if(e.call(m,p)){if(r)return r(m,p).value}else return;return m[p]};return Pg=function d(){var m,p,h,g,y,v,k=arguments[0],S=1,_=arguments.length,w=!1;for(typeof k=="boolean"&&(w=k,k=arguments[1]||{},S=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});S<_;++S)if(m=arguments[S],m!=null)for(p in m)h=u(k,p),g=u(m,p),k!==g&&(w&&g&&(o(g)||(y=i(g)))?(y?(y=!1,v=h&&i(h)?h:[]):v=h&&o(h)?h:{},a(k,{name:p,newValue:d(w,v,g)})):typeof g<"u"&&a(k,{name:p,newValue:g}));return k},Pg}var I9=N9();const Bg=ta(I9);function Wy(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 T9(){const e=[],t={run:n,use:r};return t;function n(...i){let o=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);u(null,...i);function u(d,...m){const p=e[++o];let h=-1;if(d){a(d);return}for(;++h<i.length;)(m[h]===null||m[h]===void 0)&&(m[h]=i[h]);i=m,p?R9(p,u)(...m):a(null,...m)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function R9(e,t){let n;return r;function r(...a){const u=e.length>a.length;let d;u&&a.push(i);try{d=e.apply(this,a)}catch(m){const p=m;if(u&&n)throw p;return i(p)}u||(d&&d.then&&typeof d.then=="function"?d.then(o,i):d instanceof Error?i(d):o(d))}function i(a,...u){n||(n=!0,t(a,...u))}function o(a){i(null,a)}}const Vi={basename:A9,dirname:M9,extname:D9,join:O9,sep:"/"};function A9(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Mu(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,u=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else a<0&&(o=!0,a=i+1),u>-1&&(e.codePointAt(i)===t.codePointAt(u--)?u<0&&(r=i):(u=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function M9(e){if(Mu(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function D9(e){Mu(e);let t=e.length,n=-1,r=0,i=-1,o=0,a;for(;t--;){const u=e.codePointAt(t);if(u===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),u===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function O9(...e){let t=-1,n;for(;++t<e.length;)Mu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":L9(n)}function L9(e){Mu(e);const t=e.codePointAt(0)===47;let n=z9(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function z9(e,t){let n="",r=0,i=-1,o=0,a=-1,u,d;for(;++a<=e.length;){if(a<e.length)u=e.codePointAt(a);else{if(u===47)break;u=47}if(u===47){if(!(i===a-1||o===1))if(i!==a-1&&o===2){if(n.length<2||r!==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="",r=0):(n=n.slice(0,d),r=n.length-1-n.lastIndexOf("/")),i=a,o=0;continue}}else if(n.length>0){n="",r=0,i=a,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),r=a-i-1;i=a,o=0}else u===46&&o>-1?o++:o=-1}return n}function Mu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const P9={cwd:B9};function B9(){return"/"}function Yy(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function $9(e){if(typeof e=="string")e=new URL(e);else if(!Yy(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 H9(e)}function H9(e){if(e.hostname!==""){consLine truncated
`:" ")+o.indentLines(o.containerFlow(r,u.current()),t?XN:R$))),m(),d}}function R$(e,t,n){return t===0?e:XN(e,t,n)}function XN(e,t,n){return(n?"":" ")+e}const A$=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];KN.peek=z$;function M$(){return{canContainEols:["delete"],enter:{strikethrough:O$},exit:{strikethrough:L$}}}function D$(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:A$}],handlers:{delete:KN}}}function O$(e){this.enter({type:"delete",children:[]},e)}function L$(e){this.exit(e)}function KN(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),o(),a}function z$(){return"~"}function P$(e){return e.length}function B$(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||P$,o=[],a=[],u=[],d=[];let m=0,p=-1;for(;++p<e.length;){const k=[],S=[];let _=-1;for(e[p].length>m&&(m=e[p].length);++_<e[p].length;){const w=$$(e[p][_]);if(n.alignDelimiters!==!1){const C=i(w);S[_]=C,(d[_]===void 0||C>d[_])&&(d[_]=C)}k.push(w)}a[p]=k,u[p]=S}let h=-1;if(typeof r=="object"&&"length"in r)for(;++h<m;)o[h]=Aw(r[h]);else{const k=Aw(r);for(;++h<m;)o[h]=k}h=-1;const g=[],y=[];for(;++h<m;){const k=o[h];let S="",_="";k===99?(S=":",_=":"):k===108?S=":":k===114&&(_=":");let w=n.alignDelimiters===!1?1:Math.max(1,d[h]-S.length-_.length);const C=S+"-".repeat(w)+_;n.alignDelimiters!==!1&&(w=S.length+w+_.length,w>d[h]&&(d[h]=w),y[h]=w),g[h]=C}a.splice(1,0,g),u.splice(1,0,y),p=-1;const v=[];for(;++p<a.length;){const k=a[p],S=u[p];h=-1;const _=[];for(;++h<m;){const w=k[h]||"";let C="",N="";if(n.alignDelimiters!==!1){const O=d[h]-(S[h]||0),I=o[h];I===114?C=" ".repeat(O):I===99?O%2?(C=" ".repeat(O/2+.5),N=" ".repeat(O/2-.5)):(C=" ".repeat(O/2),N=C):N=" ".repeat(O)}n.delimiterStart!==!1&&!h&&_.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&w==="")&&(n.delimiterStart!==!1||h)&&_.push(" "),n.alignDelimiters!==!1&&_.push(C),_.push(w),n.alignDelimiters!==!1&&_.push(N),n.padding!==!1&&_.push(" "),(n.delimiterEnd!==!1||h!==m-1)&&_.push("|")}v.push(n.delimiterEnd===!1?_.join("").replace(/ +$/,""):_.join(""))}return v.join(`
`)}function $$(e){return e==null?"":String(e)}function Aw(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 H$(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const a=n.indentLines(n.containerFlow(e,o.current()),F$);return i(),a}function F$(e,t,n){return">"+(n?"":" ")+e}function V$(e,t){return Mw(e,t.inConstruct,!0)&&!Mw(e,t.notInConstruct,!1)}function Mw(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Dw(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
`&&V$(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
`}function U$(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++o>a&&(a=o):o=1,i=r+t.length,r=n.indexOf(t,i);return a}function G$(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 q$(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 W$(e,t,n,r){const i=q$(n),o=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(G$(e,n)){const h=n.enter("codeIndented"),g=n.indentLines(o,Y$);return h(),g}const u=n.createTracker(r),d=i.repeat(Math.max(U$(o,i)+1,3)),m=n.enter("codeFenced");let p=u.move(d);if(e.lang){const h=n.enter(`codeFencedLang${a}`);p+=u.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...u.current()})),h()}if(e.lang&&e.meta){const h=n.enter(`codeFencedMeta${a}`);p+=u.move(" "),p+=u.move(n.safe(e.meta,{before:p,after:`
`,encode:["`"],...u.current()})),h()}return p+=u.move(`
`),o&&(p+=u.move(o+`
`)),p+=u.move(d),m(),p}function Y$(e,t,n){return(n?"":" ")+e}function pv(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 X$(e,t,n,r){const i=pv(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let u=n.enter("label");const d=n.createTracker(r);let m=d.move("[");return m+=d.move(n.safe(n.associationId(e),{before:m,after:"]",...d.current()})),m+=d.move("]: "),u(),!e.url||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(n.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(u=n.enter("destinationRaw"),m+=d.move(n.safe(e.url,{before:m,after:e.title?" ":`
`,...d.current()}))),u(),e.title&&(u=n.enter(`title${o}`),m+=d.move(" "+i),m+=d.move(n.safe(e.title,{before:m,after:i,...d.current()})),m+=d.move(i),u()),a(),m}function K$(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 yu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function im(e,t,n){const r=yl(e),i=yl(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}ZN.peek=Z$;function ZN(e,t,n,r){const i=K$(n),o=n.enter("emphasis"),a=n.createTracker(r),u=a.move(i);let d=a.move(n.containerPhrasing(e,{after:i,before:u,...a.current()}));const m=d.charCodeAt(0),p=im(r.before.charCodeAt(r.before.length-1),m,i);p.inside&&(d=yu(m)+d.slice(1));const h=d.charCodeAt(d.length-1),g=im(r.after.charCodeAt(0),h,i);g.inside&&(d=d.slice(0,-1)+yu(h));const y=a.move(i);return o(),n.attentionEncodeSurroundingInfo={after:g.outside,before:p.outside},u+d+y}function Z$(e,t,n){return n.options.emphasis||"*"}function Q$(e,t){let n=!1;return mv(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Gy}),!!((!e.depth||e.depth<3)&&ov(e)&&(t.options.setext||n))}function J$(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(Q$(e,n)){const p=n.enter("headingSetext"),h=n.enter("phrasing"),g=n.containerPhrasing(e,{...o.current(),before:`
`,after:`
`});return h(),p(),g+`
`+(i===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(`
`))+1))}const a="#".repeat(i),u=n.enter("headingAtx"),d=n.enter("phrasing");o.move(a+" ");let m=n.containerPhrasing(e,{before:"# ",after:`
`,...o.current()});return/^[\t ]/.test(m)&&(m=yu(m.charCodeAt(0))+m.slice(1)),m=m?a+" "+m:a,n.options.closeAtx&&(m+=" "+a),d(),u(),m}QN.peek=e7;function QN(e){return e.value||""}function e7(){return"<"}JN.peek=t7;function JN(e,t,n,r){const i=pv(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let u=n.enter("label");const d=n.createTracker(r);let m=d.move("![");return m+=d.move(n.safe(e.alt,{before:m,after:"]",...d.current()})),m+=d.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(n.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(u=n.enter("destinationRaw"),m+=d.move(n.safe(e.url,{before:m,after:e.title?" ":")",...d.current()}))),u(),e.title&&(u=n.enter(`title${o}`),m+=d.move(" "+i),m+=d.move(n.safe(e.title,{before:m,after:i,...d.current()})),m+=d.move(i),u()),m+=d.move(")"),a(),m}function t7(){return"!"}eI.peek=n7;function eI(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let a=n.enter("label");const u=n.createTracker(r);let d=u.move("![");const m=n.safe(e.alt,{before:d,after:"]",...u.current()});d+=u.move(m+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(e),{before:d,after:"]",...u.current()});return a(),n.stack=p,o(),i==="full"||!m||m!==h?d+=u.move(h+"]"):i==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function n7(){return"!"}tI.peek=r7;function tI(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const a=n.unsafe[o],u=n.compilePattern(a);let d;if(a.atBreak)for(;d=u.exec(r);){let m=d.index;r.charCodeAt(m)===10&&r.charCodeAt(m-1)===13&&m--,r=r.slice(0,m)+" "+r.slice(d.index+1)}}return i+r+i}function r7(){return"`"}function nI(e,t){const n=ov(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))}rI.peek=i7;function rI(e,t,n,r){const i=pv(n),o=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let u,d;if(nI(e,n)){const p=n.stack;n.stack=[],u=n.enter("autolink");let h=a.move("<");return h+=a.move(n.containerPhrasing(e,{before:h,after:">",...a.current()})),h+=a.move(">"),u(),n.stack=p,h}u=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(" "+i),m+=a.move(n.safe(e.title,{before:m,after:i,...a.current()})),m+=a.move(i),d()),m+=a.move(")"),u(),m}function i7(e,t,n){return nI(e,n)?"<":"["}iI.peek=s7;function iI(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let a=n.enter("label");const u=n.createTracker(r);let d=u.move("[");const m=n.containerPhrasing(e,{before:d,after:"]",...u.current()});d+=u.move(m+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(e),{before:d,after:"]",...u.current()});return a(),n.stack=p,o(),i==="full"||!m||m!==h?d+=u.move(h+"]"):i==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function s7(){return"["}function gv(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function o7(e){const t=gv(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 a7(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 sI(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 l7(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let a=e.ordered?a7(n):gv(n);const u=e.ordered?a==="."?")":".":o7(n);let d=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&p&&(!p.children||!p.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),sI(n)===a&&p){let h=-1;for(;++h<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:u}};function a(y,v,k,S){return m(p(y,k,S),y.align)}function u(y,v,k,S){const _=h(y,k,S),w=m([_]);return w.slice(0,w.indexOf(`
`))}function d(y,v,k,S){const _=k.enter("tableCell"),w=k.enter("phrasing"),C=k.containerPhrasing(y,{...S,before:o,after:o});return w(),_(),C}function m(y,v){return B$(y,{align:v,alignDelimiters:r,padding:n,stringLength:i})}function p(y,v,k){const S=y.children;let _=-1;const w=[],C=v.enter("table");for(;++_<S.length;)w[_]=h(S[_],v,k);return C(),w}function h(y,v,k){const S=y.children;let _=-1;const w=[],C=v.enter("tableRow");for(;++_<S.length;)w[_]=d(S[_],y,v,k);return C(),w}function g(y,v,k){let S=aI.inlineCode(y,v,k);return k.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function j7(){return{exit:{taskListCheckValueChecked:Lw,taskListCheckValueUnchecked:Lw,paragraph:N7}}}function E7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:I7}}}function Lw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function N7(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 r=n.children[0];if(r&&r.type==="text"){const i=t.children;let o=-1,a;for(;++o<i.length;){const u=i[o];if(u.type==="paragraph"){a=u;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function I7(e,t,n,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);o&&u.move(a);let d=aI.listItem(e,t,n,{...r,...u.current()});return o&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),d;function m(p){return p+a}}function T7(){return[l$(),I$(),M$(),v7(),j7()]}function R7(e){return{extensions:[c$(),T$(e),D$(),C7(e),E7()]}}const A7={tokenize:P7,partial:!0},lI={tokenize:B7,partial:!0},cI={tokenize:$7,partial:!0},uI={tokenize:H7,partial:!0},M7={tokenize:F7,partial:!0},dI={name:"wwwAutolink",tokenize:L7,previous:mI},fI={name:"protocolAutolink",tokenize:z7,previous:hI},Is={name:"emailAutolink",tokenize:O7,previous:pI},es={};function D7(){return{text:es}}let Po=48;for(;Po<123;)es[Po]=Is,Po++,Po===58?Po=65:Po===91&&(Po=97);es[43]=Is;es[45]=Is;es[46]=Is;es[95]=Is;es[72]=[Is,fI];es[104]=[Is,fI];es[87]=[Is,dI];es[119]=[Is,dI];function O7(e,t,n){const r=this;let i,o;return a;function a(h){return!Xy(h)||!pI.call(r,r.previous)||xv(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(h))}function u(h){return Xy(h)?(e.consume(h),u):h===64?(e.consume(h),d):n(h)}function d(h){return h===46?e.check(M7,p,m)(h):h===45||h===95||wr(h)?(o=!0,e.consume(h),d):p(h)}function m(h){return e.consume(h),i=!0,d}function p(h){return o&&i&&Rr(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function L7(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!mI.call(r,r.previous)||xv(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(A7,e.attempt(lI,e.attempt(cI,o),n),n)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function z7(e,t,n){const r=this;let i="",o=!1;return a;function a(h){return(h===72||h===104)&&hI.call(r,r.previous)&&!xv(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),e.consume(h),u):n(h)}function u(h){if(Rr(h)&&i.length<5)return i+=String.fromCodePoint(h),e.consume(h),u;if(h===58){const g=i.toLowerCase();if(g==="http"||g==="https")return e.consume(h),d}return n(h)}function d(h){return h===47?(e.consume(h),o?m:(o=!0,d)):n(h)}function m(h){return h===null||tm(h)||gn(h)||Yo(h)||Pm(h)?n(h):e.attempt(lI,e.attempt(cI,p),n)(h)}function p(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function P7(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),o):n(a)}function o(a){return a===null?n(a):t(a)}}function B7(e,t,n){let r,i,o;return a;function a(m){return m===46||m===95?e.check(uI,d,u)(m):m===null||gn(m)||Yo(m)||m!==45&&Pm(m)?d(m):(o=!0,e.consume(m),a)}function u(m){return m===95?r=!0:(i=r,r=void 0),e.consume(m),a}function d(m){return i||r||!o?n(m):t(m)}}function $7(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<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(uI,t,o)(a):a===null||gn(a)||Yo(a)?t(a):(e.consume(a),i)}function o(a){return a===41&&r++,e.consume(a),i}}function H7(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),o):u===93?(e.consume(u),i):u===60||u===null||gn(u)||Yo(u)?t(u):n(u)}function i(u){return u===null||u===40||u===91||gn(u)||Yo(u)?t(u):r(u)}function o(u){return Rr(u)?a(u):n(u)}function a(u){re Line truncated
`),m=d.length>fH,p=m?d.length-Kg*2:0,h=j.useCallback(()=>{navigator.clipboard.writeText(a),r(!0),setTimeout(()=>r(!1),1500)},[a]);return c.jsxs("div",{className:"code-block-wrap",children:[c.jsxs("div",{className:"code-block-header",children:[c.jsxs("span",{className:"code-block-lang",children:[u||"code",m?` (${d.length} lines)`:""]}),c.jsx("button",{className:"code-block-copy",onClick:h,children:n?c.jsxs(c.Fragment,{children:[c.jsx(Nl,{})," ",c.jsx("span",{children:"Copied"})]}):c.jsxs(c.Fragment,{children:[c.jsx(Cm,{})," ",c.jsx("span",{children:"Copy"})]})})]}),c.jsx("pre",{children:c.jsx("code",{className:e,children:m&&!i?c.jsxs(c.Fragment,{children:[d.slice(0,Kg).join(`
`)+`
`,c.jsxs("span",{className:"code-block-omitted",onClick:()=>o(!0),children:["... +",p," lines (click to expand)"]}),`
`+d.slice(-Kg).join(`
`)]}):a})}),m&&i&&c.jsxs("button",{className:"code-block-collapse-btn",onClick:()=>o(!1),children:["Collapse (",d.length," lines)"]})]})}const hH={code({className:e,children:t,...n}){return e?.startsWith("language-")?c.jsx(mH,{className:e,children:t}):c.jsx("code",{className:e,...n,children:t})}},pH=3e3,gH=60,Zg=800;function Pw(e){if(e.length>pH)return!0;let t=0;for(let n=0;n<e.length;n++)if(e[n]===`
`&&++t>=gH)return!0;return!1}function xH(e){const t=e.lastIndexOf(`
`,Zg);return e.slice(0,t>Zg/2?t:Zg)}const sr=St.memo(function({content:t,className:n="msg-content-agent",collapseMode:r="auto"}){const i=r!=="never"&&Pw(t),[o,a]=j.useState(i);j.useEffect(()=>{a(r!=="never"&&Pw(t))},[r,t]);const u=o?xH(t):t,d=t.split(`
`).length,m=t.length;return c.jsxs("div",{className:n,children:[c.jsx(Q9,{remarkPlugins:[dH],components:hH,children:u}),i&&o&&c.jsxs("button",{className:"msg-collapse-toggle",onClick:()=>a(!1),children:["Show more (",d," lines, ",(m/1e3).toFixed(1),"k chars)"]}),i&&!o&&c.jsx("button",{className:"msg-collapse-toggle",onClick:()=>a(!0),children:"Show less"})]})}),Bw={native:"OpenOPC Native",codex:"Codex",claude_code:"Claude Code",cursor:"Cursor",opencode:"OpenCode"},vu="codex",Qg="native",yH=["codex","native","claude_code","cursor","opencode"],vH=["native","codex","claude_code","cursor","opencode"];function gI(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 xI(e){const t=gI(e);return t.kind==="fallback"?"fallback:":`${t.kind}:${t.id??""}`}function bH(e,t,n){const r=String(e.role_id??"").trim(),i=String(e.role_label??"").trim(),o=`${r} ${i} ${e.role_responsibility??""}`.toLowerCase(),a=new Set((e.same_role_employee_ids??[]).map(m=>String(m??"").trim()).filter(Boolean)),u=t.map(m=>{const p=String(m.employee_id??"").trim(),h=String(m.employee_name??p).trim()||p,g=String(m.role_id??"").trim(),y=String(m.category??"").trim(),v=[g,y].filter(Boolean).join(" · ")||p;return{kind:"employee",id:p,name:h,subtitle:v,category:y,searchText:`${p} ${h} ${g} ${y} ${(m.domains??[]).join(" ")} ${(m.tags??[]).join(" ")}`.toLowerCase(),rank:a.has(p)||g===r?0:2}}).filter(m=>m.id).sort((m,p)=>m.rank-p.rank||m.name.localeCompare(p.name)),d=n.map(m=>{const p=String(m.template_id??"").trim(),h=String(m.template_name??p).trim()||p,g=String(m.category??"").trim(),y=[g,p].filter(Boolean).join(" · ")||p,v=`${p} ${h} ${g} ${(m.domains??[]).join(" ")} ${(m.tags??[]).join(" ")}`.toLowerCase(),k=o.split(/[^a-z0-9]+/).filter(S=>S.length>=3).reduce((S,_)=>S+(v.includes(_)?1:0),0);return{kind:"template",id:p,name:h,subtitle:y,category:g,searchText:v,rank:k}}).filter(m=>m.id).sort((m,p)=>p.rank-m.rank||m.name.localeCompare(p.name));return[...u,...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=xI(t);return e.find(r=>`${r.kind}:${r.id}`===n)??e[0]}function kH(e,t){const n=t.toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?!0:n.every(r=>e.searchText.includes(r))}function SH(e){return e.map(t=>{const n=String(t.role_id??"").trim(),r=String(t.existing_employee?.employee_id??"").trim(),i=String(t.candidate?.template_id??"").trim(),o=r?{kind:"employee",id:r}:i?{kind:"template",id:i}:{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??vu,selected_agent:t.selected_agent??t.default_agent??vu,default_source:"recruitment"}}).filter(t=>t.role_id)}function wH(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 $w(e,t){const n={},r=e.staffing_selections??{};for(const i of t){const o=String(i.role_id??"").trim();o&&(n[o]=gI(r[o]??i.default_selection))}return n}function Hw(e,t){const n=e.recruitment_role_agents??{},r={};for(const i of t){const o=String(i.role_id??"").trim();o&&(r[o]=n[o]??i.selected_agent??i.default_agent??vu)}return r}function CH(e){return!!(String(e.checkpoint_response_message_id??"").trim()||String(e.checkpoint_responded_at??"").trim()||String(e.checkpoint_reply_kind??"").trim())}const yI=St.memo(function({meta:t,onReply:n,responded:r}){const i=t.proposals??[],o=j.useMemo(()=>{const L={};for(const A of i){const M=String(A.role_id??"").trim();M&&(L[M]=A)}return L},[i]),a=j.useMemo(()=>t.staffing_roles?.length?t.staffing_roles:SH(i),[t.staffing_roles,i]),u=t.staffing_pool?.employees??[],d=t.staffing_pool?.templates??[],m=t.recruitment_rationales??[],p=j.useMemo(()=>{const L={};for(const A of a){const M=String(A.role_id??"").trim();M&&(L[M]=bH(A,u,d))}return L},[u,a,d]),[h,g]=j.useState({}),[y,v]=j.useState(""),[k,S]=j.useState(()=>$w(t,a)),[_,w]=j.useState(()=>Hw(t,a)),[C,N]=j.useState(t.recruitment_agent??Qg),O=r;j.useEffect(()=>{!O||!CH(t)||(S($w(t,a)),w(Hw(t,a)),N(t.recruitment_agent??Qg))},[O,t,a]),j.useEffect(()=>{N(t.recruitment_agent??Qg)},[t.recruitment_agent]);const I=j.useCallback(L=>{const A=String(t.checkpoint_id??"").trim();if(!A)throw new Error("Recruitment checkpoint reply requires checkpoint_id metadata.");const M=String(t.checkpoint_type??"").trim();return{response_to_checkpoint_id:A,response_to_checkpoint_type:M||"company_recruitment_confirmation",checkpoint_reply_kind:L,staffin Line truncated
`).map(t=>t.trim()).find(Boolean)??e}function OH(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 sm=St.memo(function({meta:t,onReply:n,responded:r}){const i=r,o=String(t.checkpoint_status??"").trim().toLowerCase(),a=OH(o),u=String(t.prompt??t.summary??""),d=j.useMemo(()=>u.split(`
`).map(O=>O.trim()).filter(Boolean),[u]),m=DH(u).replace(/^\[[^\]]+\]\s*/,"")||"Action Required",p=d.slice(1).join(`
`).trim(),h=String(t.summary??"").trim(),g=(t.options??[]).filter(O=>!!O?.id),y=j.useMemo(()=>(t.active_subagents??[]).filter(O=>!!O&&typeof O=="object"),[t.active_subagents]),v=j.useMemo(()=>(t.permission_requests??[]).filter(O=>!!O&&typeof O=="object"),[t.permission_requests]),k=String(t.worktree_path??"").trim(),S=y.length>0||v.length>0||!!k,[_,w]=j.useState(""),C=!!_&&!i;j.useEffect(()=>{if(!C)return;const O=window.setTimeout(()=>w(""),MH);return()=>window.clearTimeout(O)},[C,_]);const N=j.useCallback(O=>{i||C||(w(O.id),n(O.label||O.id))},[i,C,n]);return c.jsxs("div",{className:"ckpt-panel ckpt-escalation",children:[c.jsxs("div",{className:"ckpt-header",children:[c.jsx("div",{className:"ckpt-icon ckpt-icon-escalation",children:c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("path",{d:"M8 1.5L14.5 13H1.5L8 1.5Z"}),c.jsx("path",{d:"M8 5.5V9"}),c.jsx("circle",{cx:"8",cy:"11.5",r:"0.75",fill:"currentColor",stroke:"none"})]})}),c.jsx("div",{className:"ckpt-title",children:m}),c.jsx("span",{className:"ckpt-badge ckpt-badge-scope",children:String(t.escalation_type??"decision_needed").replace(/_/g," ")}),i&&c.jsx("span",{className:"ckpt-badge ckpt-badge-responded",children:a})]}),h&&h!==m&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Summary"}),c.jsx(sr,{content:h,className:"ckpt-markdown"})]}),p&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Request"}),c.jsx(sr,{content:p,className:"ckpt-markdown"})]}),S&&c.jsxs("details",{className:"ckpt-runtime-details",children:[c.jsx("summary",{children:"Runtime State"}),c.jsxs("div",{className:"ckpt-runtime-body",children:[k&&c.jsxs("div",{children:["Worktree: ",c.jsx("code",{children:k})]}),y.length>0&&c.jsxs("div",{children:["Active subagents: ",y.length]}),v.length>0&&c.jsxs("div",{children:["Pending permission records: ",v.length]})]})]}),!i&&g.length>0&&c.jsx("div",{className:"ckpt-actions ckpt-escalation-actions",children:g.map(O=>c.jsx("button",{className:`ckpt-btn ${O.id.includes("deny")?"ckpt-btn-deny":"ckpt-btn-approve"}${C?" ckpt-btn-submitting":""}`,onClick:()=>N(O),disabled:C,children:C&&_===O.id?"Submitting…":O.label||O.id},O.id))}),C&&c.jsx("div",{className:"ckpt-escalation-hint",children:"Decision sent — waiting for server confirmation…"}),!i&&t.default_action&&c.jsxs("div",{className:"ckpt-escalation-hint",children:["Default on timeout: ",c.jsx("code",{children:t.default_action})]})]})});function LH(e){return e.split(`
`).map(t=>t.trim()).find(Boolean)??e}function zH(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 SI=St.memo(function({meta:t,onReply:n,responded:r}){const i=r,[o,a]=j.useState(""),[u,d]=j.useState(null),m=String(t.checkpoint_status??"").trim().toLowerCase(),p=zH(m),h=String(t.prompt??t.summary??"").trim(),y=`${String(t.work_item_projection_title??LH(h)??"Human Review").trim()||"Human Review"} (for self-evolution)`,v=String(t.summary??"").trim(),k=j.useMemo(()=>(t.active_subagents??[]).filter(T=>!!T&&typeof T=="object"),[t.active_subagents]),S=j.useMemo(()=>(t.permission_requests??[]).filter(T=>!!T&&typeof T=="object"),[t.permission_requests]),_=String(t.worktree_path??"").trim(),w=k.length>0||S.length>0||!!_,C=i||u!==null,N=j.useCallback((T,L="")=>{const A=String(t.checkpoint_id??"").trim();if(!A)throw new Error("Delivery self-evolution reply requires checkpoint_id metadata.");const M={response_to_checkpoint_id:A,response_to_checkpoint_type:"company_delivery_feedback",checkpoint_reply_kind:T};return(T==="approve"||T==="feedback")&&(M.self_evolution_trigger=!0,M.human_feedback_text=L),M},[t.checkpoint_id]),O=j.useCallback(()=>{if(C)return;const T=N("approve");d("approve"),n("I fully agree with this delivery.",T)},[C,N,n]),I=j.useCallback(()=>{const T=o.trim();if(C||!T)return;const L=N("feedback",T);d("feedback"),n(T,L),a("")},[C,N,o,n]),D=j.useCallback(()=>{if(C)return;const T=N("ignore");d("ignore"),n("Ignore this self-evolution review.",T)},[C,N,n]);return c.jsxs("div",{className:"ckpt-panel ckpt-delivery-feedback",children:[c.jsxs("div",{className:"ckpt-header",children:[c.jsx("div",{className:"ckpt-icon ckpt-icon-user-input",children:c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.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"}),c.jsx("path",{d:"M5.5 8.25L7.25 10l3.25-4"})]})}),c.jsx("div",{className:"ckpt-title",children:y}),c.jsx("span",{className:"ckpt-badge ckpt-badge-scope",children:String(t.feedback_scope??"final").replace(/_/g," ")}),i&&c.jsx("span",{className:"ckpt-badge ckpt-badge-responded",children:p})]}),v&&v!==y&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Summary"}),c.jsx(sr,{content:v,className:"ckpt-markdown"})]}),h&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Review Request"}),c.jsx(sr,{content:h,className:"ckpt-markdown"})]}),w&&c.jsxs("details",{className:"ckpt-runtime-details",children:[c.jsx("summary",{children:"Runtime State"}),c.jsxs("div",{className:"ckpt-runtime-body",children:[_&&c.jsxs("div",{children:["Worktree: ",c.jsx("code",{children:_})]}),k.length>0&&c.jsxs("div",{children:["Active subagents: ",k.length]}),S.length>0&&c.jsxs("div",{children:["Pending permission records: ",S.length]})]})]}),!i&&c.jsxs("div",{className:"ckpt-actions ckpt-actions-inline-feedback",children:[c.jsx("button",{className:"ckpt-btn ckpt-btn-approve",onClick:O,disabled:C,children:"Fully Agree"}),c.jsx("button",{className:"ckpt-btn ckpt-btn-cancel",onClick:D,disabled:C,children:"Ignore"}),c.jsx("textarea",{className:"ckpt-feedback-input ckpt-feedback-inline-input",placeholder:"Feedback for self-evolution...",value:o,onChange:T=>a(T.target.value),disabled:C,rows:2}),c.jsx("button",{className:"ckpt-btn ckpt-btn-feedback",onClick:I,disabled:C||!o.trim(),children:"Send Feedback"})]})]})}),sf="__other__",PH=["A","B","C"];function Ui(e){return String(e??"").trim()}function BH(e,t){const n=Ui(e.question),r=Ui(e.header);if(!n&&!r)return null;const i=(e.options??[]).slice(0,3).map((o,a)=>({id:Ui(o.id)||String.fromCharCode(97+a),label:Ui(o.label),description:Ui(o.description)})).filter(o=>o.label);return{id:Ui(e.id)||`question_${t+1}`,header:r,question:n||r,options:i,allow_freeform:e.allow_freeform!==!1,required:e.required!==!1}}const wI=St.memo(function({meta:t,onReply:n,responded:r}){const[i,o]=j.useState(""),[a,u]=j.useState({}),d=r,m=String(t.work_item_projection_title??t.work_item_projection_id??"Input Needed").trim()||"Input Needed",p=String(t.summary??"").trim(),h=String(t.prompt??"").trim(),g=String(t.context_note??"").trim(),y=String(t.resume_hint??"").trim(),v=j.useMemo(()=>(t.questions??[]).map(V=>String(V).trim()).filter(Boolean),[t.questions]),k=j.useMemo(()=>(t.input_questions??[]).map((V,Y)=>BH(V,Y)).filter(V=>V!==null),[t.input_questions]),S=k.some(V=>(V.options??[]).length>0),_=j.useMemo(()=>(t.required_fields??[]).map(V=>String(V).trim()).filter(Boolean),[t.required_fields]),w=j.useMemo(()=>(t.active_subagents??[]).filter(V=>!!V&&typeof V=="object"),[t.active_subagents]),C=j.useMemo(( Line truncated
`),{user_input_answers:V})},[a,B,k,d,n]);return c.jsxs("div",{className:"ckpt-panel ckpt-user-input",children:[c.jsxs("div",{className:"ckpt-header",children:[c.jsx("div",{className:"ckpt-icon ckpt-icon-user-input",children:c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("path",{d:"M3 3.5h10v6H6.5L3 13V3.5Z"}),c.jsx("path",{d:"M5.5 6h5"}),c.jsx("path",{d:"M5.5 8h3.5"})]})}),c.jsx("div",{className:"ckpt-title",children:m}),c.jsx("span",{className:"ckpt-badge ckpt-badge-scope",children:"awaiting input"}),d&&c.jsx("span",{className:"ckpt-badge ckpt-badge-responded",children:"Responded"})]}),p&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Summary"}),c.jsx(sr,{content:p,className:"ckpt-markdown"})]}),h&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Request"}),c.jsx(sr,{content:h,className:"ckpt-markdown"})]}),S?c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Questions"}),c.jsx("div",{className:"ckpt-choice-list",children:k.map(V=>{const Y=a[V.id]??{freeformText:""},Q=V.options??[],q=V.allow_freeform!==!1,G=q&&(Q.length===0||Y.selectedOptionId===sf);return c.jsxs("div",{className:"ckpt-choice-question",children:[V.header&&c.jsx("div",{className:"ckpt-question-header",children:V.header}),c.jsx(sr,{content:V.question,className:"ckpt-markdown"}),Q.length>0&&c.jsxs("div",{className:"ckpt-choice-grid",children:[Q.map((J,P)=>{const X=Y.selectedOptionId===J.id;return c.jsxs("button",{className:`ckpt-choice-option${X?" is-selected":""}`,onClick:()=>M(V.id,J.id),children:[c.jsx("span",{className:"ckpt-choice-letter",children:PH[P]??"?"}),c.jsxs("span",{className:"ckpt-choice-copy",children:[c.jsx("span",{className:"ckpt-choice-label",children:J.label}),J.description&&c.jsx("span",{className:"ckpt-choice-desc",children:J.description})]})]},J.id)}),q&&c.jsxs("button",{className:`ckpt-choice-option${Y.selectedOptionId===sf?" is-selected":""}`,onClick:()=>M(V.id,sf),children:[c.jsx("span",{className:"ckpt-choice-letter",children:"D"}),c.jsxs("span",{className:"ckpt-choice-copy",children:[c.jsx("span",{className:"ckpt-choice-label",children:"Other"}),c.jsx("span",{className:"ckpt-choice-desc",children:"Enter a custom answer"})]})]})]}),G&&c.jsx("textarea",{className:"ckpt-feedback-input ckpt-other-field",placeholder:"Type your answer...",value:Y.freeformText,onChange:J=>$(V.id,J.target.value),rows:3})]},V.id)})})]}):v.length>0&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Questions"}),c.jsx("ul",{className:"ckpt-task-list",children:v.map(V=>c.jsx("li",{children:V},V))})]}),_.length>0&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Required Fields"}),c.jsx("div",{className:"ckpt-task-tags",children:_.map(V=>c.jsx("span",{className:"ckpt-field-tag",children:V},V))})]}),g&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Context"}),c.jsx(sr,{content:g,className:"ckpt-markdown ckpt-markdown-muted"})]}),y&&c.jsx("div",{className:"ckpt-escalation-hint",children:y}),A&&c.jsxs("details",{className:"ckpt-runtime-details",children:[c.jsx("summary",{children:"Runtime State"}),c.jsxs("div",{className:"ckpt-runtime-body",children:[O&&c.jsxs("div",{children:["Requester: ",c.jsx("code",{children:O})]}),D&&c.jsxs("div",{children:["Work item: ",c.jsx("code",{children:D})]}),I&&c.jsxs("div",{children:["Task: ",c.jsx("code",{children:I})]}),T&&c.jsxs("div",{children:["Seat: ",c.jsx("code",{children:T})]}),N&&c.jsxs("div",{children:["Worktree: ",c.jsx("code",{children:N})]}),w.length>0&&c.jsxs("div",{children:["Active subagents: ",w.length]}),C.length>0&&c.jsxs("div",{children:["Pending permission records: ",C.length]})]})]}),!d&&c.jsxs("div",{className:"ckpt-feedback-area",children:[S?null:c.jsx("textarea",{className:"ckpt-feedback-input",placeholder:"Reply with the missing input to continue...",value:i,onChange:V=>o(V.target.value),rows:3}),c.jsx("div",{className:"ckpt-feedback-btns",children:c.jsx("button",{className:"ckpt-btn ckpt-btn-approve",onClick:S?H:U,disabled:S?!B:!i.trim(),children:"Send Reply"})})]})]})}),Zy={todo:"To do",in_progress:"In progress",in_review:"In review",done:"Done"};function ex(e,t){if(t&&t in Zy)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 of(e){return Zy[e]??Zy.todo}const qw={active:0,waiting:1,failed:2,done:3,pending:4};function $H(e){if(e.length===0)return"pending";let t=e[0],n=qw[t]??99;for(const r of e){const i=qw[r]??99;i<n&&(t=r,n=i)}return t}const HH={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",p=o[2].trim(),h=p.toLowerCase(),g=h.includes("completed")||h.includes("done")?"success":h.includes("blocked")||h.includes("failed")?"warning":"info";return{kind:"company_event",label:`${m.toUpperCase()} · ${d[1]??""}`.replace(/ · $/,""),summary:p,tone:g}}const a=t.match(/^(Review needed|Status digest|Blocked|Completion):\s*(.+)$/i);if(a){const d=a[1].replace(/\b\w/g,p=>p.toUpperCase()),m=nu(a[2]);return{kind:"company_event",label:d,summary:m,tone:/^Blocked$/i.test(a[1])?"warning":"info"}}const u=t.match(/^NO_DELEGATION_JUSTIFICATION:\s*(.+)$/i);return u?{kind:"company_event",label:"Delegation check",summary:nu(u[1]).slice(0,180),tone:"info"}:null}function xF(e,t){const{isCompanyRuntime:n,detailMode:r}=t;if(!n||r==="full"||lu(e.metadata))return null;const i=jI(e.content);if(!i)return null;const o=e.sender==="system"||e.metadata?.type==="system",a=i.kind==="company_event"||e.content.startsWith("[Company:");return!o&&!a?null:{msg:e,classification:i}}function yF(e,t={}){const{isCompanyRuntime:n=!1,detailMode:r="summary"}=t,i=[];let o=[],a=0;const u=new Set,d=new Set,m=()=>{if(o.length===0)return;const p=o[0].msg,h=o[o.length-1].msg;i.push({kind:"ops-bundle",id:`ops:${p.id}:${o.length}:${h.id}`,timestamp:p.timestamp,events:o,sortOrder:a}),o=[]};return e.forEach((p,h)=>{const g=h*2+1,y=xF(p,{isCompanyRuntime:n,detailMode:r});if(y){o.length===0&&(a=g),o.push(y);return}const v=r==="summary"?CI(p.content):null;if(v){const k=[p.sender,Math.round(p.timestamp/1e3),v.kind,nu(v.summary||v.acceptanceSummary||"").slice(0,500),v.verdict??"",v.deliverables.map(S=>`${S.name}:${S.path}`).join("|").slice(0,800)].join("");if(u.has(k))return;u.add(k)}if(r==="summary"){const k=nu(oF(p.content)).slice(0,1200);if(k){const S=aF(p)?["result",k].join(""):[p.sender,Math.round(p.timestamp/1e3),k].join("");if(d.has(S))return;d.add(S)}}m(),i.push({kind:"message",id:p.id,timestamp:p.timestamp,msg:p,sortOrder:g})}),m(),i}const vF=St.memo(function({msg:t,showDate:n,dateStr:r,classification:i}){const[o,a]=j.useState(!1),u=t.content.trim()!==`[${i.label}] ${i.summary}`.trim()&&t.content.trim().length>i.summary.length+4;return c.jsxs("div",{children:[n&&c.jsx("div",{className:"msg-date-sep",children:c.jsx("span",{children:r})}),c.jsxs("div",{className:`msg-ops-row msg-ops-tone-${i.tone}${o?" expanded":""}`,onClick:u?()=>a(d=>!d):void 0,role:u?"button":void 0,tabIndex:u?0:-1,children:[c.jsx("span",{className:"msg-ops-dot","aria-hidden":"true"}),c.jsx("span",{className:"msg-ops-label",children:i.label}),i.summary&&c.jsx("span",{className:"msg-ops-summary",title:i.summary,children:i.summary}),c.jsx("span",{className:"msg-ops-time",title:Zi(t.timestamp),children:Es(t.timestamp)}),u&&c.jsx("span",{className:`msg-ops-chevron${o?" open":""}`,"aria-hidden":"true",children:c.jsx(Yi,{down:o})})]}),u&&o&&c.jsx("div",{className:"msg-ops-details",children:c.jsx("pre",{className:"msg-ops-details-pre",children:t.content})})]})}),bF=St.memo(function({events:t,showDate:n,dateStr:r}){const[i,o]=j.useState(!1);if(t.length===0)return null;const a=t[0].msg,u=t[t.length-1].msg,d=t.reduce((h,g)=>{const y=g.classification.kind==="company_event"?"company":g.classification.kind.startsWith("external")?"runtime":"delegation";return h[y]=(h[y]??0)+1,h},{}),m=Object.entries(d).map(([h,g])=>`${g} ${h}`).join(" · "),p=`${t.length} technical event${t.length===1?"":"s"} hidden`;return c.jsxs("div",{children:[n&&c.jsx("div",{className:"msg-date-sep",children:c.jsx("span",{children:r})}),c.jsxs("button",{type:"button",className:`msg-ops-bundle${i?" expanded":""}`,onClick:()=>o(h=>!h),title:`${Zi(a.timestamp)} - ${Zi(u.timestamp)}`,children:[c.jsx("span",{className:"msg-ops-bundle-dot"}),c.jsx("span",{className:"msg-ops-bundle-title",children:p}),c.jsx("span",{className:"msg-ops-bundle-summary",children:m}),c.jsx("span",{className:"msg-ops-bundle-time",children:Es(a.timestamp)}),c.jsx("span",{className:"msg-ops-bundle-chevron",children:c.jsx(Yi,{down:i})})]}),i&&c.jsx("div",{className:"msg-ops-bundle-details",children:t.map(({msg:h,classification:g})=>c.jsxs("div",{className:`msg-ops-bundle-event msg-ops-tone-${g.tone}`,children:[c.jsx("span",{className:"msg-ops-dot"}),c.jsx("span",{className:"msg-ops-label",children:g.label}),c.jsx("span",{className:"msg-ops-summary",children:g.summary}),c.jsx("span",{className:"msg-ops-time",title:Zi(h.timestamp),children:Es(h.timestamp)})]},h.id))})]})});function _F(e){return e.kind==="review"?`Review · ${e.verdict?e.verdict.replace(/_/g," "):"review"}`:e.kind==="report"?"Report":"Update"}const kF=St.memo(function({msg:t,payload:n,showDate:r,dateStr:i,isCopied:o,onCopy:a}){const u=yv(t.sender==="system"?t.senderName||"OPC":t.sender),d=t.senderDeleted?"[Deleted]":t.senderName,m=_F(n),p=n.summary||n.acceptanceSummary||m;return c.jsxs("div",{children:[r&&c.jsx("div",{className:"msg-date-sep",children:c.jsx("spa Line truncated
Set up at least one role before running a task.
Go to Org tab now?`)&&n?.(),!1;if(a.length>1&&!u)return confirm(`Your organization has multiple top-level roles but no final decider selected.
Choose one final decider in the Org tab before running a task.
Go to Org tab now?`)&&n?.(),!1;const d=[],m=new Set(r.map(y=>y.role_id));o.runtimeTeams.filter(y=>y.member_role_ids.some(v=>m.has(v))||y.manager_role_id&&m.has(y.manager_role_id)).length===0&&d.push("No runtime teams defined — the system will auto-generate from your roles");const h=new Set(i.map(y=>y.role_id)),g=r.filter(y=>!h.has(y.role_id));if(g.length>0){const y=g.map(v=>v.name).join(", ");d.push(`${g.length} role(s) have no employees: ${y}`)}return d.length>0?confirm(`Before running this task:
`+d.map(y=>"• "+y).join(`
`)+`
Run anyway?`):!0}function tV(e){if(!e)return!1;const t=zm(e);return!!(t.projectRun?.run_id||t.runtimeTeams.length>0||t.runtimeSeats.length>0)}function uC(e,t){const n=!!t?.childDetail;return e?n?"full":e.execMode==="company"||e.execMode==="org"||e.execMode==="custom"?"summary":"full":"summary"}function dC(e){return String(e?.originTaskId??e?.taskId??"").trim()||null}function nV({boardColor:e,title:t,onCommit:n}){const[r,i]=j.useState(!1),[o,a]=j.useState(t),u=j.useRef(null);j.useEffect(()=>{r||a(t)},[t,r]);const d=j.useCallback(()=>{const p=o.trim();p&&p!==t?n(p):a(t),i(!1)},[o,t,n]),m=j.useCallback(()=>{a(t),i(!0),setTimeout(()=>u.current?.select(),0)},[t]);return c.jsx("div",{className:"board-selector",children:c.jsx("div",{className:"board-tabs",children:c.jsxs("span",{className:"board-tab active board-tab-editable",style:{"--board-color":e},children:[c.jsx("span",{className:"board-tab-dot",style:{background:e}}),r?c.jsx("input",{ref:u,className:"board-tab-title-input",value:o,onChange:p=>a(p.target.value),onBlur:d,onKeyDown:p=>{p.key==="Enter"&&d(),p.key==="Escape"&&(a(t),i(!1))}}):c.jsx("span",{className:"board-tab-title",onClick:m,title:"Click to edit session title",children:t})]})})})}function rV({boardStore:e,agents:t,officeMap:n,execMode:r,companyProfile:i,taskPreferredAgent:o,chatStore:a,sessionStore:u,projectId:d,onRunTask:m,onCreateTask:p,onMoveTask:h,onCreateSession:g,onSessionSend:y,onSecretarySend:v,onDeleteSession:k,onTitleChange:S,onSessionConfigChange:_,onSessionTaskAgentChange:w,onContinueInNewChat:C,onSessionStop:N,onSessionResume:O,onSessionComplete:I,onLoadSessionDetail:D,onOpenExecutionPanel:T,onCollabSync:L,orgInfoData:A,onNavigateToOrg:M,recoveryStatus:$,onRecoveryResume:W,onRecoveryCancel:B,commsState:U,commsMessage:H,onCommsRefresh:V,onCommsReadMessage:Y,savedOrgsList:Q,activeSavedOrg:q,onSavedOrgsList:G,onSavedOrgLoad:J}){const{sessions:P,activeSessionId:X,activeSession:ee}=u,[te,re]=j.useState("collapsed"),{width:oe,isResizing:de,handleMouseDown:se}=QF({initialWidth:380,minWidth:300,maxWidth:600,onCollapse:()=>re("collapsed")}),[Ee,we]=j.useState("chat"),[Ce,Be]=j.useState(null),[Ge,Ye]=j.useState({kind:"activity"}),[yt,qt]=j.useState([]),[bt,vt]=j.useState(!1),[me,Oe]=j.useState({}),rt=j.useRef(D),Qe=j.useRef({active:null,child:null}),Je=r==="company"||r==="org"||r==="custom",fe=`secretary:${d}`,be=`activity:${d}`,Me=j.useMemo(()=>Ce?P.find(ue=>ue.taskId===Ce)??null:null,[P,Ce]),Fe=j.useMemo(()=>Ge.kind!=="task-detail"?null:e.tasks.find(ue=>ue.id===Ge.taskId)??null,[Ge,e.tasks]),$e=j.useMemo(()=>{const ue=Lm(Fe);return ue?P.find(Se=>Se.taskId===ue||Se.runtimeTaskId===ue||Se.executionTurnId===ue)??null:null},[P,Fe]),Wt=j.useMemo(()=>$e?a.getChannelMessages($e.channelId):[],[a.messages,a.getChannelMessages,$e]),nn=j.useMemo(()=>jf(ee,P),[P,ee]),ke=j.useMemo(()=>$f(ee,P),[P,ee]),Te=j.useMemo(()=>Hf(ee,[...ke,...nn]),[ee,nn,ke]);j.useEffect(()=>{rt.current=D},[D]);const Pe=j.useCallback((ue,Se,Ue="summary")=>{const ft=rt.current;!ft||!ue||(Oe(Kt=>Kt[ue]?Kt:{...Kt,[ue]:!0}),ft(ue,{limit:JF,beforeCreatedAt:Se?.timestamp,beforeMessageId:Se?.id,detailLevel:Ue}),window.setTimeout(()=>{Oe(Kt=>Kt[ue]?{...Kt,[ue]:!1}:Kt)},800))},[]),Ve=j.useCallback(ue=>!!me[ue],[me]);j.useEffect(()=>{Qe.current={active:null,child:null}},[d]),j.useEffect(()=>{Ce&&!Me&&Be(null)},[Ce,Me]),j.useEffect(()=>{Ge.kind==="task-detail"&&!Fe&&Ye({kind:"activity"})},[Ge,Fe]);const qe=j.useRef(null);j.useEffect(()=>{if(!$e){qe.current=null;return}qe.current!==$e.taskId&&(qe.current=$e.taskId,Pe($e.taskId,void 0,"full"))},[$e,Pe]),j.useEffect(()=>{if(!Ce){Qe.current.child=null;return}Qe.current.child!==Ce&&(Qe.current.child=Ce,Pe(Ce,void 0,"full"))},[Ce,Pe]),j.useEffect(()=>{if(!X){Qe.current.active=null;return}const ue=Te.timelineSessions.length>0?Te.timelineSessions:P.find(Ue=>Ue.taskId===X)?[P.find(Ue=>Ue.taskId===X)]:[];if(ue.length===0){Qe.current.active=null;return}const Se=ue.map(Ue=>`${Ue.taskId}:${uC(Ue,{childDetail:Ue.mode==="child"})}`).join("|");if(Qe.current.active!==Se){Qe.current.active=Se;for(const Ue of ue)Pe(Ue.taskId,void 0,uC(Ue,{childDetail:Ue.mode==="child"}))}},[Te.timelineSessions,X,Pe,P]);const et=j.useMemo(()=>Ce?{kind:"child-detail"}:Ge.kind==="task-detail"||Ge.kind==="secretary"?Ge:X?{kind:"session",taskId:X}:{kind:"activity"},[Ge,X,Ce]),Mn=j.useMemo(()=>et.kind==="secretary"?fe:et.kind==="child-detail"&&Me?Me.channelId:et.kind==="session"&&Te.displaySession?Te.displaySession.channelId:et.kind==="session"&&ee?ee.channelId:be,[et,Te.displaySession,ee,Me,fe,be]),Tn=j.useMemo(()=>{if(et.kind==="activity")return[be];if(et.kind==="secretary")return[fe];if(et.kind==="child-detail"&&Me)return[Me.channelId];if(et.kind==="session"){const ue=Te.timelineSessions.map(Se=>Se.channelId).filter((Se,Ue,ft)=>!!Se&&ft.indexOf(Se)===Ue);if(ue.length>0)return ue}return Mn?[Mn]:[]},[et.kind,Te.timelineSessions,Me,be,fe,Mn]),Dn=j.useMemo(()=>{const ue=new Set;for(const Se of P)Se.status!=="cancelled"&&ue.add(Se. Line truncated
`).replace(/\r/g,`
`).split(`
`).map(i=>i.trimEnd()).join(`
`).replace(/\n{3,}/g,`
`).trim(),n=sV(t),r=n.split(/\n{2,}/).map(i=>i.trim()).filter(Boolean);return r.length>1&&/^Verification:\s/i.test(r[r.length-1])?r.slice(0,-1).join(`
`).trim():n}function sV(e){const t=String(e||"").trim(),n=t.match(/^\*\*(.{8,160}?)\*\*:\s+([\s\S]+)$/);if(n){const a=n[2].trim();if(a.length>=80)return a}const r=t.indexOf(": ");if(r<8||r>160)return t;const i=t.slice(0,r).replace(/\*/g,"").trim(),o=t.slice(r+2).trim();return o.length<80||!/[A-Za-z\u4e00-\u9fff]/.test(i)||/^(https?|file)$/i.test(i)?t:o}function Ko(e){const t=Xo(e),n=new Set,r=typeof t.checkpoint_type=="string"?t.checkpoint_type.trim():"",i=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:"",r&&i?`checkpoint:${r}:${i}`:""]){const a=String(o??"").trim();a&&n.add(a)}return n}function oV(e){return e.startsWith("checkpoint:")}function Xi(e){return typeof e.timestamp=="number"?e.timestamp:0}function mC(e){const t=String(e.sender??"").trim().toLowerCase(),n=Xo(e),r=typeof n.role=="string"?n.role.trim().toLowerCase():"";return t==="user"||r==="user"?"user":"assistant"}function hC(e){const t=Xo(e),n=String(e.sender??"").trim().toLowerCase();let r=0;const i=TI(e);return i&&(r+=1e3+i),t.source==="engine"&&(r+=100),n&&n!=="system"&&(r+=20),n&&!["assistant","system","user"].includes(n)&&(r+=5),e.replyToId&&(r+=2),r+=Math.min(Object.keys(t).length,10),r}function pC(e){return String(Xo(e).source??"").trim().toLowerCase()==="engine"}function TI(e){const t=Xo(e),n=String(t.transcript_kind??"").trim();if(n)return fC[n]??0;const r=String(t.kind??"").trim();return fC[r]??0}function am(e){return TI(e)>0}function RI(e,t){if(e.channelId!==t.channelId)return!1;const n=Ko(e),r=Ko(t);for(const i of n)if(r.has(i))return!0;return!1}function t0(e,t){if(RI(e,t))return!0;if(e.channelId!==t.channelId||mC(e)!==mC(t)||om(e.content)!==om(t.content))return!1;const n=am(e)&&am(t);if(!n&&String(e.replyToId??"")!==String(t.replyToId??"")||!(pC(e)||pC(t)))return!1;const r=Xi(e),i=Xi(t);return!(!n&&r&&i&&Math.abs(r-i)>_v)}function n0(e,t,n=!1){let r=e,i=t;(n||hC(t)>hC(e))&&(r=t,i=e);const o=[];for(const h of[i.mentions,r.mentions])for(const g of h??[])o.includes(g)||o.push(g);const a=Ko(e),u=Ko(t);let d="";for(const h of a)if(u.has(h)&&!oV(h)){d=h;break}const m=om(r.content),p=m&&m===om(i.content)?m:r.content;return{...i,...r,...d?{id:d}:{},content:p,metadata:{...Xo(i),...Xo(r)},mentions:o,timestamp:Xi(r)||Xi(i)}}function lx(e){const t=[],n=new Map;for(const r of[...e].sort((i,o)=>Xi(i)-Xi(o))){const i=Ko(r);let o=-1,a=!1;for(const d of i){const m=n.get(d);if(m!==void 0){o=m,a=t[m].id===r.id;break}}if(o===-1){const d=Xi(r),m=am(r);for(let p=t.length-1;p>=0;p--){const h=Xi(t[p]);if(!m&&d>0&&h>0&&d-h>_v)break;if(t0(t[p],r)){o=p;break}}}const u=o===-1?t.length:o;o===-1?t.push(r):t[o]=n0(t[o],r,a);for(const d of Ko(t[u]))n.has(d)||n.set(d,u)}return t}function aV(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(r=>r!==t.agentId)}));default:return e}}function lV(e,t){switch(t.type){case"SET":{const n=lx(t.messages);if(e.length===0)return n;const r=e.filter(i=>typeof i.id=="string"&&i.id.startsWith("msg-")&&!n.some(o=>t0(i,o)));return r.length===0?n:lx([...n,...r])}case"CLEAR":return[];case"ADD":{const n=Xi(t.message);Ko(t.message);let r=!1;for(let i=e.length-1;i>=0;i--){const o=Xi(e[i]);if(!r&&n>0&&o>0&&n-o>_v&&(r=!0),RI(e[i],t.message)){const a=[...e];return a[i]=n0(e[i],t.message,e[i].id===t.message.id),a}if((am(t.message)||!r)&&t0(e[i],t.message)){const a=[...e];return a[i]=n0(e[i],t.message),a}}return[...e,t.message]}case"MERGE":return t.messages.length===0?e:lx([...e,...t.messages]);case"MARK_SENDER_DELETED":return e.map(n=>n.sender===t.senderId?{...n,senderDeleted:!0,senderName:"[已删除的 Agent]"}:n);case"REMOVE_BY_CHANNEL":return e.filter(n=>n.channelId!==t.channelId);case"REMOVE_BY_TASK_ID":return e.filter(n=>n.channelId!==`session:${t.taskId}`&&n.metadata?.task_id!==t.taskId);default:return e}}function cV(){const[e,t]=j.useReducer(aV,[]),[n,r]=j.useReducer(lV,[]),[i,o]=j.useState({}),[a,u]=j.useState("default"),d=j.useMemo(()=>{const I={};for(const D of n)I[D.channelId]||(I[D.channelId]=[]),I[D.channelId].push(D);return I},[n]),m=j.useMemo(()=>{const I={};for(const D of n){if(D.sender==="user")continue;const T=i[D.channelId]??0;D.timestamp<=T||(I[D.channelId]=(I[D.channelId]??0)+1)}return I},[n,i]),p=j.useCallback(I=>{const D={id:`msg-${iV()}`,channelId:I.channelId,sender:I.sender,senderName:I.senderName,content:I.content,timestamp:Date.now(),replyToId:I.replyToId,mentions:[],metadata:I.metadata};return r({type:"ADD",message:D}),D},[]),h=j.useCallback(I=>d[I]??[],[d]),g=j.useCallback(I=>m[I]??0,[m]),y=j.useCallback(I=>{o(D=>({...D,[I]:Date.now()}))},[]),v=j.useCallback(I=>{r({type:"MARK_SENDER_DELETED",senderId:I})},[]),k=j.useCallback(I=>{t({type:"REMOVE_PARTICIPANT",agentId:I})},[]),S=j.useCallback(I=>{t({type:"REMOVE",channe Line truncated
${t}`:`${e}${t}`}function uV(e,t){const n=e.trim().replace(/\s+/g," ");return n?n.length>120?`${n.slice(0,120).trimEnd()}...`:n:t||"Thinking"}function dV(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 lm(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 fV(e,t){const n=lm(e),r=lm(t);return n&&r?n===r:t.timestamp-e.timestamp>Vm||e.type!==t.type?!1:e.type==="thinking"||e.type==="assistant"?!0:e.type==="tool_call"?e.summary===t.summary:!1}function mV(e,t){return t.timestamp-e.timestamp<=Vm&&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=r0(e.detail??"",t.detail??"","thinking");return{timestamp:t.timestamp,type:e.type,summary:uV(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=r0(e.detail??"",t.detail??"","tool_call");return{timestamp:t.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 AI(e,t,n=100){const r=dV(t),i=lm(r),o=i?[...e].reverse().findIndex(d=>lm(d)===i):-1,a=o>=0?e.length-1-o:e.length-1,u=e[a];return u?i&&o>=0&&typeof u.seq=="number"&&typeof r.seq=="number"&&r.seq<=u.seq?e:mV(u,r)?ll([...e.slice(0,a),{...u,timestamp:r.timestamp},...e.slice(a+1)],n):fV(u,r)?ll([...e.slice(0,a),hV(u,r),...e.slice(a+1)],n):ll([...e,r],n):[r]}function MI(e,t=100){return(Array.isArray(e)?e:[]).reduce((n,r)=>AI(n,r,t),[])}function pV(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 DI(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 gV(e,t){return t.timestamp-e.timestamp<=Vm&&DI(e,t)&&(e.type==="thinking"||e.type==="tool_call")}function xV(e,t){return DI(e,t)&&(e.detail??"")===(t.detail??"")&&t.timestamp-e.timestamp<=Vm}function yV(e,t){const n=t.type==="tool_call"?"tool_call":"thinking";return{...e,...t,timestamp:t.timestamp,detail:r0(e.detail??"",t.detail??"",n)||void 0}}function OI(e,t,n=100){const r=pV(t),i=e[e.length-1];return i?xV(i,r)?ll([...e.slice(0,-1),{...i,timestamp:r.timestamp}],n):gV(i,r)?ll([...e.slice(0,-1),yV(i,r)],n):ll([...e,r],n):[r]}function LI(e,t=100){return(Array.isArray(e)?e:[]).reduce((n,r)=>OI(n,r,t),[])}function i0(e){const t=String(e??"").trim().toLowerCase();return t==="company"?"company":t==="org"||t==="custom"?"org":"task"}function vV(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(),r=String(e.orgId??"").trim(),o=t.length>0?i0(t):n==="custom"||r?"org":i0(t);return o==="org"?{...e,execMode:"org",companyProfile:"custom",orgId:r||void 0}:o==="compan Line truncated
`)),[L,A]=j.useState(!1),M=j.useRef(e.role_id);j.useEffect(()=>{M.current!==e.role_id&&(M.current=e.role_id,d(e.name),p(e.responsibility),g(e.reports_to),v(e.icon??null),S(new Set(e.can_spawn)),w(new Set(e.tools)),N(e.runtime_policy?.execution_strategy??"auto"),I(e.preferred_external_agent??null),T((e.prompt_refs??[]).join(`
`)),A(!1))},[e]);const $=j.useRef({}),W=j.useRef(null),B=j.useRef(e.role_id);j.useEffect(()=>{B.current=e.role_id},[e.role_id]);const U=j.useCallback(()=>{W.current&&(clearTimeout(W.current),W.current=null);const se=$.current;$.current={},Object.keys(se).length!==0&&i(B.current,se)},[i]),H=j.useCallback(se=>{r||($.current={...$.current,...se},W.current&&clearTimeout(W.current),W.current=setTimeout(U,500))},[U,r]);j.useEffect(()=>()=>{W.current&&(clearTimeout(W.current),W.current=null);const se=$.current;Object.keys(se).length>0&&($.current={},i(B.current,se))},[i]);const V=se=>{d(se),H({name:se})},Y=se=>{p(se),H({responsibility:se})},Q=se=>{g(se),H({reports_to:se})},q=se=>{v(se),H({icon:se})},G=se=>{N(se),H({execution_strategy:se})},J=se=>{I(se),H({preferred_external_agent:se})},P=se=>{T(se);const Ee=se.split(`
`).map(we=>we.trim()).filter(Boolean);H({prompt_refs:Ee})},X=se=>{const Ee=new Set(k);Ee.has(se)?Ee.delete(se):Ee.add(se),S(Ee),H({can_spawn:Array.from(Ee)})},ee=se=>{const Ee=new Set(_);Ee.has(se)?Ee.delete(se):Ee.add(se),w(Ee),H({tools:Array.from(Ee)})},te=j.useMemo(()=>t.filter(se=>se.role_id!==e.role_id),[t,e.role_id]),re=j.useMemo(()=>n.filter(se=>(se.role_ids?.length?se.role_ids:[se.role_id]).includes(e.role_id)).length,[n,e.role_id]),oe=j.useMemo(()=>D.split(`
`).filter(se=>se.trim()).length,[D]),de=()=>{if(!L){A(!0);return}U(),o(e.role_id)};return c.jsxs("aside",{className:"ri-panel","aria-label":`Inspector for role ${e.name}`,children:[c.jsxs("header",{className:"ri-panel-header",children:[c.jsx("img",{src:Du(y),alt:"",className:"ri-panel-icon"}),c.jsxs("div",{className:"ri-panel-title-wrap",children:[c.jsx("h3",{className:"ri-panel-title",children:u||"(unnamed)"}),c.jsx("code",{className:"ri-panel-id",children:e.role_id})]}),c.jsx("button",{className:"btn btn-ghost btn-sm ri-panel-close",onClick:a,title:"Close (Esc)",children:"✕"})]}),c.jsxs("div",{className:"ri-panel-body",children:[c.jsxs(Ya,{title:"Identity",defaultExpanded:!0,children:[c.jsx(xi,{label:"Name",children:c.jsx("input",{className:"ri-text-input",value:u,onChange:se=>V(se.target.value),disabled:r})}),c.jsx(xi,{label:"Responsibility",children:c.jsx("textarea",{className:"ri-textarea",rows:3,value:m,onChange:se=>Y(se.target.value),disabled:r})}),c.jsx(xi,{label:"Icon",children:c.jsx(GV,{value:y,onChange:q,readOnly:r})})]}),c.jsxs(Ya,{title:"Hierarchy",defaultExpanded:!0,children:[c.jsx(xi,{label:"Reports to",children:c.jsxs("select",{className:"ri-select",value:h,onChange:se=>Q(se.target.value),disabled:r,children:[c.jsx("option",{value:"owner",children:"You (Owner)"}),te.map(se=>c.jsx("option",{value:se.role_id,children:se.name},se.role_id))]})}),c.jsx(xi,{label:"Can delegate to",children:c.jsx(qV,{allIds:te.map(se=>se.role_id),labelFor:se=>te.find(Ee=>Ee.role_id===se)?.name??se,selected:k,onToggle:X,readOnly:r})}),c.jsx(xi,{label:"Employees assigned",children:c.jsx("span",{className:"ri-meta-value",children:re})})]}),c.jsx(Ya,{title:`Tools (${_.size})`,children:c.jsx(WV,{tools:_,onToggle:ee,readOnly:r})}),c.jsx(Ya,{title:`Prompts (${oe})`,children:c.jsx(xi,{label:"Prompt refs / inline",children:c.jsx("textarea",{className:"ri-textarea ri-textarea-mono",rows:5,placeholder:"One prompt ref or inline instruction per line",value:D,onChange:se=>P(se.target.value),disabled:r})})}),c.jsxs(Ya,{title:"Runtime policy",children:[c.jsx(xi,{label:"Execution strategy",children:c.jsx("div",{className:"ri-radio-group",children:VV.map(se=>c.jsxs("label",{className:"ri-radio",title:se.hint,children:[c.jsx("input",{type:"radio",name:`exec-strategy-${e.role_id}`,value:se.value,checked:C===se.value,onChange:()=>G(se.value),disabled:r}),se.label]},se.value))})}),C==="external"&&c.jsx(xi,{label:"Preferred external agent",children:c.jsxs("select",{className:"ri-select",value:O??"",onChange:se=>J(se.target.value||null),disabled:r,children:[c.jsx("option",{value:"",children:"(any)"}),FV.map(se=>c.jsx("option",{value:se,children:se},se))]})})]}),c.jsxs(Ya,{title:"Advanced",children:[c.jsx(xi,{label:"Role type",children:c.jsx("span",{className:"ri-meta-value",children:e.role_type??"worker"})}),c.jsx(xi,{label:"Skills",children:c.jsx("span",{className:"ri-meta-value",children:e.skill_refs&&e.skill_refs.length>0?e.skill_refs.join(", "):"(none)"})}),c.jsx(xi,{label:"Artifact contract",children:c.jsx("span",{className:"ri-meta-value",children:e.artifact_contract_ref??"(none)"})})]})]}),!r&&c.jsx("footer",{className:"ri-panel-footer",children:c.jsx("button",{className:`btn btn-sm ${L?"btn-danger":"btn-ghost"}`,onClick:de,onBlur:()=>A(!1),children:L?"Confirm delete?":"Delete role"})})]})}function Ya({title:e,defaultExpanded:t=!1,children:n}){const[r,i]=j.useState(t);return c.jsxs("section",{className:`ri-group${r?" is-expanded":""}`,children:[c.jsxs("button",{className:"ri-group-header",onClick:()=>i(o=>!o),children:[c.jsx("span",{className:"ri-group-caret",children:r?"▾":"▸"}),c.jsx("span",{className:"ri-group-title",children:e})]}),r&&c.jsx("div",{className:"ri-group-body",children:n})]})}function xi({label:e,children:t}){return c.jsxs("div",{className:"ri-field",children:[c.jsx("label",{className:"ri-field-label",children:e}),c.jsx("div",{className:"ri-field-control",children:t})]})}function GV({value:e,onChange:t,readOnly:n}){const[r,i]=j.useState(!1);return c.jsxs("div",{className:"ri-icon-picker",children:[c.jsxs("button",{className:"ri-icon-picker-trigger",onClick:()=>!n&&i(o=>!o),disabled:n,children:[c.jsx("img",{src:Du(e),alt:"",className:"ri-icon-picker-current"}),c.jsx("span",{className:"ri-icon-picker-label",children:e??"generic"})]}),r&&c.jsxs("div",{className:"ri-icon-picker-popover",children:[c.jsx("button",{className:`ri-icon-option${e===null?" is-active":""}`,onClick:()=>{t(null),i(!1)},title:"Default icon",children:c.jsx("img",{src:ru.generic,alt:""})}),$V.filter(o=>o!=="generic").map(o=>c.jsx("button",{className:`ri-icon-option${e===o?" is-active":""}`,onClick:()=>{t(o),i(!1)},title:o,children:c.jsx("img",{src:ru[o],alt:o})},o))]})]})}function qV({allIds:e,labelFor:t,selected:n,onToggle:r,readOnly:i}){const[o,a]=j.useState(!1),u=e.filter(d=>!n.has(d));return c.jsxs("div",{className:"ri-multiselect",children:[c.jsxs("div",{className:"ri-chips",children:[Array.from(n).map(d=>c.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 i}}function xt(e,t,n,r){return{debug:()=>{var i;return(i=e?.debugAll)!=null?i:e[t]},key:!1,onChange:r}}function KV(e,t,n,r){const i=()=>{var a;return(a=o.getValue())!=null?a:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:i,getContext:gt(()=>[e,n,t,o],(a,u,d,m)=>({table:a,column:u,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 ZV(e,t,n,r){var i,o;const u={...e._getDefaultColumnDef(),...t},d=u.accessorKey;let m=(i=(o=u.id)!=null?o:d?typeof String.prototype.replaceAll=="function"?d.replaceAll(".","_"):d.replace(/\./g,"_"):void 0)!=null?i:typeof u.header=="string"?u.header:void 0,p;if(u.accessorFn?p=u.accessorFn:d&&(d.includes(".")?p=g=>{let y=g;for(const k of d.split(".")){var v;y=(v=y)==null?void 0:v[k]}return y}:p=g=>g[u.accessorKey]),!m)throw new Error;let h={id:`${String(m)}`,accessorFn:p,parent:r,depth:n,columnDef:u,columns:[],getFlatColumns:gt(()=>[!0],()=>{var g;return[h,...(g=h.columns)==null?void 0:g.flatMap(y=>y.getFlatColumns())]},xt(e.options,"debugColumns")),getLeafColumns:gt(()=>[e._getOrderColumnsFn()],g=>{var y;if((y=h.columns)!=null&&y.length){let v=h.columns.flatMap(k=>k.getLeafColumns());return g(v)}return[h]},xt(e.options,"debugColumns"))};for(const g of e._features)g.createColumn==null||g.createColumn(h,e);return h}const Sr="debugHeaders";function bC(e,t,n){var r;let o={id:(r=n.id)!=null?r: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=[],u=d=>{d.subHeaders&&d.subHeaders.length&&d.subHeaders.map(u),a.push(d)};return u(o),a},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(a=>{a.createHeader==null||a.createHeader(o,e)}),o}const QV={createTable:e=>{e.getHeaderGroups=gt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{var o,a;const u=(o=r?.map(h=>n.find(g=>g.id===h)).filter(Boolean))!=null?o:[],d=(a=i?.map(h=>n.find(g=>g.id===h)).filter(Boolean))!=null?a:[],m=n.filter(h=>!(r!=null&&r.includes(h.id))&&!(i!=null&&i.includes(h.id)));return uf(t,[...u,...m,...d],e)},xt(e.options,Sr)),e.getCenterHeaderGroups=gt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(o=>!(r!=null&&r.includes(o.id))&&!(i!=null&&i.includes(o.id))),uf(t,n,e,"center")),xt(e.options,Sr)),e.getLeftHeaderGroups=gt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var i;const o=(i=r?.map(a=>n.find(u=>u.id===a)).filter(Boolean))!=null?i:[];return uf(t,o,e,"left")},xt(e.options,Sr)),e.getRightHeaderGroups=gt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var i;const o=(i=r?.map(a=>n.find(u=>u.id===a)).filter(Boolean))!=null?i:[];return uf(t,o,e,"right")},xt(e.options,Sr)),e.getFooterGroups=gt(()=>[e.getHeaderGroups()],t=>[...t].reverse(),xt(e.options,Sr)),e.getLeftFooterGroups=gt(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),xt(e.options,Sr)),e.getCenterFooterGroups=gt(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),xt(e.options,Sr)),e.getRightFooterGroups=gt(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),xt(e.options,Sr)),e.getFlatHeaders=gt(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),xt(e.options,Sr)),e.getLeftFlatHeaders=gt(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),xt(e.options,Sr)),e.getCenterFlatHeaders=gt(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),xt(e.options,Sr)),e.getRightFlatHeaders=gt(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),xt(e.options,Sr)),e.getCenterLeafHeaders=gt(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),xt(e.options,Sr)),e.getLeftLeafHeaders=gt(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),xt(e.options,Sr)),e.getRightLeafHeaders=gt(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),xt(e.options,Sr)),e.getLeafHeaders=gt(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var i,o,a,u,d,m;return[...(i=(o=t[0])==null?void 0:o.headers)!=null?i:[],...(a=(u=n[0])==null?void 0:u.headers)!=null?a:[],...(d=(m=r[0])==null?void 0:m.headers)!=null?d:[]].map(p=>p.getLeafHeaders()).flat()},xt(e.options,Sr))}};function uf(e,t,n,r){var i,o;let a=0;const u=function(g,y){y===void 0&&(y=1),a=Math.max(a,y),g.filter(v=>v.getIsVisible()).forEach(v=>{var k;(k=v.columns)!=null&&k.length&&u(v.columns,y+1)},0)};u(e);let d=[];const m=(g,y)=>{const v={depth:y,id:[r,`${y}`].filter(Boolean).jo Line truncated
`).replace(`
`,`
+`).split(`
`)),p=m.reduce((h,g)=>h.concat(...g),[]);return[m,p]}return[[],[]]},[e]);return j.useEffect(()=>{const d=t?.target??f2,m=t?.actInsideInputWithModifier??!0;if(e!==null){const p=y=>{if(i.current=y.ctrlKey||y.metaKey||y.shiftKey||y.altKey,(!i.current||i.current&&!m)&&OT(y))return!1;const k=h2(y.code,u);if(o.current.add(y[k]),m2(a,o.current,!1)){const S=y.composedPath?.()?.[0]||y.target,_=S?.nodeName==="BUTTON"||S?.nodeName==="A";t.preventDefault!==!1&&(i.current||!_)&&y.preventDefault(),r(!0)}},h=y=>{const v=h2(y.code,u);m2(a,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(y[v]),y.key==="Meta"&&o.current.clear(),i.current=!1},g=()=>{o.current.clear(),r(!1)};return d?.addEventListener("keydown",p),d?.addEventListener("keyup",h),window.addEventListener("blur",g),window.addEventListener("contextmenu",g),()=>{d?.removeEventListener("keydown",p),d?.removeEventListener("keyup",h),window.removeEventListener("blur",g),window.removeEventListener("contextmenu",g)}}},[e,r]),n}function m2(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function h2(e,t){return t.includes(e)?"code":"key"}const XX=()=>{const e=In();return j.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:r}=e.getState();return r?r.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,i,o],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??o},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:i,minZoom:o,maxZoom:a,panZoom:u}=e.getState(),d=Dv(t,r,i,o,a,n?.padding??.1);return u?(await u.setViewport(d,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:i,snapToGrid:o,domNode:a}=e.getState();if(!a)return t;const{x:u,y:d}=a.getBoundingClientRect(),m={x:t.x-u,y:t.y-d},p=n.snapGrid??i,h=n.snapToGrid??o;return $u(m,r,h,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:i,y:o}=r.getBoundingClientRect(),a=ym(t,n);return{x:a.x+i,y:a.y+o}}}),[])};function rR(e,t){const n=[],r=new Map,i=[];for(const o of e)if(o.type==="add"){i.push(o);continue}else if(o.type==="remove"||o.type==="replace")r.set(o.id,[o]);else{const a=r.get(o.id);a?a.push(o):r.set(o.id,[o])}for(const o of t){const a=r.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 u={...o};for(const d of a)KX(d,u);n.push(u)}return i.length&&i.forEach(o=>{o.index!==void 0?n.splice(o.index,0,{...o.item}):n.push({...o.item})}),n}function KX(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 iR(e,t){return rR(e,t)}function ZX(e,t){return rR(e,t)}function Fo(e,t){return{id:e,type:"select",selected:t}}function nl(e,t=new Set,n=!1){const r=[];for(const[i,o]of e){const a=t.has(i);!(o.selected===void 0&&!a)&&o.selected!==a&&(n&&(o.selected=a),r.push(Fo(o.id,a)))}return r}function p2({items:e=[],lookup:t}){const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,o]of e.entries()){const a=t.get(o.id),u=a?.internals?.userNode??a;u!==void 0&&u!==o&&n.push({id:o.id,item:o,type:"replace"}),u===void 0&&n.push({item:o,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function g2(e){return{id:e.id,type:"remove"}}const x2=e=>bY(e),QX=e=>ET(e);function sR(e){return j.forwardRef(e)}function y2(e){const[t,n]=j.useState(BigInt(0)),[r]=j.useState(()=>JX(()=>n(i=>i+BigInt(1))));return S0(()=>{const i=r.get();i.length&&(e(i),r.reset())},[t]),r}function JX(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const oR=j.createContext(null);function eK({children:e}){const t=In(),n=j.useCallback(u=>{const{nodes:d=[],setNodes:m,hasDefaultNodes:p,onNodesChange:h,nodeLookup:g,fitViewQueued:y,onNodesChangeMiddlewareMap:v}=t.getState();let k=d;for(const _ of u)k=typeof _=="function"?_(k):_;let S=p2({items:k,lookup:g});for(const _ of v.values())S=_(S);p&&m(k),S.length>0?h?.(S):y&&window.requestAnimationFrame(()=>{const{fitViewQueued:_,nodes:w,setNodes:C}=t.getState();_&&C(w)})},[]),r=y2(n),i=j.useCallback(u=>{const{edges:d=[],setEdges:m,hasDefaul Line truncated
M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}AR.displayName="MiniMap";const HZ=j.memo(AR),FZ=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,VZ={[Cl.Line]:"right",[Cl.Handle]:"bottom-right"};function UZ({nodeId:e,position:t,variant:n=Cl.Handle,className:r,style:i=void 0,children:o,color:a,minWidth:u=10,minHeight:d=10,maxWidth:m=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:h=!1,resizeDirection:g,autoScale:y=!0,shouldResize:v,onResizeStart:k,onResize:S,onResizeEnd:_}){const w=cR(),C=typeof e=="string"?e:w,N=In(),O=j.useRef(null),I=n===Cl.Handle,D=Gt(j.useCallback(FZ(I&&y),[I,y]),Nn),T=j.useRef(null),L=t??VZ[n];j.useEffect(()=>{if(!(!O.current||!C))return T.current||(T.current=yX({domNode:O.current,nodeId:C,getStoreItems:()=>{const{nodeLookup:M,transform:$,snapGrid:W,snapToGrid:B,nodeOrigin:U,domNode:H}=N.getState();return{nodeLookup:M,transform:$,snapGrid:W,snapToGrid:B,nodeOrigin:U,paneDomNode:H}},onChange:(M,$)=>{const{triggerNodeChanges:W,nodeLookup:B,parentLookup:U,nodeOrigin:H}=N.getState(),V=[],Y={x:M.x,y:M.y},Q=B.get(C);if(Q&&Q.expandParent&&Q.parentId){const q=Q.origin??H,G=M.width??Q.measured.width??0,J=M.height??Q.measured.height??0,P={id:Q.id,parentId:Q.parentId,rect:{width:G,height:J,...MT({x:M.x??Q.position.x,y:M.y??Q.position.y},{width:G,height:J},Q.parentId,B,q)}},X=$v([P],B,U,H);V.push(...X),Y.x=M.x?Math.max(q[0]*G,M.x):void 0,Y.y=M.y?Math.max(q[1]*J,M.y):void 0}if(Y.x!==void 0&&Y.y!==void 0){const q={id:C,type:"position",position:{...Y}};V.push(q)}if(M.width!==void 0&&M.height!==void 0){const G={id:C,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:M.width,height:M.height}};V.push(G)}for(const q of $){const G={...q,type:"position"};V.push(G)}W(V)},onEnd:({width:M,height:$})=>{const W={id:C,type:"dimensions",resizing:!1,dimensions:{width:M,height:$}};N.getState().triggerNodeChanges([W])}})),T.current.update({controlPosition:L,boundaries:{minWidth:u,minHeight:d,maxWidth:m,maxHeight:p},keepAspectRatio:h,resizeDirection:g,onResizeStart:k,onResize:S,onResizeEnd:_,shouldResize:v}),()=>{T.current?.destroy()}},[L,u,d,m,p,h,k,S,_,v]);const A=L.split("-");return c.jsx("div",{className:Kn(["react-flow__resize-control","nodrag",...A,n,r]),ref:O,style:{...i,scale:D,...a&&{[I?"backgroundColor":"borderColor"]:a}},children:o})}j.memo(UZ);const GZ=j.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(" "),r=Du(t.icon);return c.jsxs("div",{className:n,children:[c.jsx(jl,{type:"target",position:at.Top,className:"oc-canvas-handle"}),c.jsxs("div",{className:"oc-canvas-node-row",children:[c.jsx("div",{className:"oc-canvas-node-chip",children:c.jsx("span",{className:"oc-canvas-node-chip-icon",style:{WebkitMaskImage:`url("${r}")`,maskImage:`url("${r}")`},"aria-hidden":!0})}),c.jsxs("div",{className:"oc-canvas-node-text",children:[c.jsx("span",{className:"oc-canvas-node-name",children:t.name}),c.jsxs("div",{className:"oc-canvas-node-meta",children:[t.employeeNames.length>0?c.jsxs("span",{className:"oc-canvas-node-person",title:t.employeeNames.join(", "),children:[t.employeeNames[0],t.employeeNames.length>1?` +${t.employeeNames.length-1}`:""]}):c.jsx("span",{className:"oc-canvas-node-id",children:t.roleId}),t.employeeCount>0&&c.jsx("span",{className:"oc-canvas-node-badge",children:t.employeeCount})]})]})]}),c.jsx(jl,{type:"source",position:at.Bottom,className:"oc-canvas-handle"})]})});var Tx,T2;function Vv(){if(T2)return Tx;T2=1;var e="\0",t="\0",n="";class r{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>{};_defaultEdgeLabelFn=()=>{};_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(p){p&&(this._isDirected=Object.hasOwn(p,"directed")?p.directed:!0,this._isMultigraph=Object.hasOwn(p,"multigraph")?p.multigraph:!1,this._isCompound=Object.hasOwn(p,"compound")?p.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(p){return this._label=p,this}graph(){return this._label}setDefaultNodeLabel(p){return this._defaultNodeLabelFn=p,typeof p!="function"&&(this._defaultNodeLabelFn=()=>p),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var p=this;return this.nodes().filter(h=>Object.keys(p._in[h]).length===0)}sinks(){var p=this;return this.nodes().filter(h=>Object.keys(p._out[h]).length===0)}setNodes(p,h){var g=arguments,y=this;return p.forEach(function(v){g.length>1?y.setNode(v,h):y.setNode(v)}),this}setNode(p,h){return Object.hasOwn(this._nodes,p)?(arguments.length>1&&(this._nodes[p]=h),this):(this._nodes[p]=arguments.length>1?h:this._defaultNodeLabelFn(p),this._isCompound&&(this._parent[p]=t, Line truncated
${r}`}),c.jsx(RV,{projects:Mr.projects,activeId:Mr.activeProjectId,onSelect:Z=>{const z=Rs(Z);t.current?.switchProject(Z,z)},onCreate:Z=>{t.current?.createProject(Z)},onDelete:Z=>t.current?.deleteProject(Z)})]}),c.jsxs("div",{className:"topbar-center",children:[c.jsxs("div",{className:"page-nav",children:[c.jsxs("button",{className:`page-nav-btn${$==="workspace"?" active":""}`,onClick:()=>W("workspace"),children:["Workspace",(()=>{const Z=Er.channels.reduce((z,ne)=>z+Er.getUnreadCount(ne.id),0);return Z>0?c.jsx("span",{className:"nav-unread-badge",children:Z>99?"99+":Z}):null})()]}),c.jsx("button",{className:`page-nav-btn${$==="office"?" active":""}`,onClick:()=>W("office"),children:"Office"}),c.jsx("button",{className:`page-nav-btn${$==="org"?" active":""}`,onClick:()=>W("org"),children:"Org"})]}),c.jsxs("div",{className:"stat-chips",children:[c.jsxs("span",{className:"stat-chip",children:[c.jsx("b",{children:oa.totalAgents})," agents"]}),c.jsxs("span",{className:"stat-chip",children:[c.jsx("b",{children:oa.totalSkills})," skills"]}),c.jsxs("span",{className:"stat-chip",children:[c.jsx("b",{children:Hn.getOpenTaskCount()})," tasks"]})]})]}),c.jsxs("div",{className:"topbar-right",children:[c.jsxs("select",{className:"theme-select",value:Ar,title:"Outdoor lighting override",onChange:Z=>{const z=Z.target.value;jr(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:[c.jsx("option",{value:"auto",children:"Outdoor auto"}),c.jsx("option",{value:"day",children:"Outdoor day"}),c.jsx("option",{value:"night",children:"Outdoor night"})]}),c.jsxs("select",{className:"theme-select",value:C,onChange:Z=>N(Z.target.value),children:[c.jsx("option",{value:"midnight",children:"Midnight"}),c.jsx("option",{value:"neon",children:"Neon"}),c.jsx("option",{value:"paper",children:"Paper"}),c.jsx("option",{value:"retro",children:"Retro"}),c.jsx("option",{value:"terminal",children:"Terminal"}),c.jsx("option",{value:"cozy",children:"Cozy"}),c.jsx("option",{value:"openopc",children:"OpenOPC"})]}),c.jsx("button",{className:`icon-btn ${H?"active":""}`,onClick:()=>V(Z=>!Z),title:"Developer Tools",children:c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[c.jsx("path",{d:"M5.5 2L2 5.5 5.5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M10.5 7L14 10.5 10.5 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),$==="workspace"&&c.jsx(rV,{boardStore:Hn,chatStore:Er,sessionStore:hn,agents:B,officeMap:Si,execMode:q,companyProfile:J,taskPreferredAgent:X,projectId:Mr.activeProjectId,orgInfoData:te,onNavigateToOrg:()=>W("org"),savedOrgsList:nn,activeSavedOrg:Te,onSavedOrgsList:oi,onSavedOrgLoad:ns,recoveryStatus:oe,onRecoveryResume:Z=>t.current?.recoveryAction(ct(),"resume",Z),onRecoveryCancel:Z=>t.current?.recoveryAction(ct(),"cancel",Z),commsState:se,commsMessage:we,onCommsRefresh:Z=>{const{project_id:z,...ne}=Z??{};t.current?.commsState(ct(),ne)},onCommsReadMessage:Z=>t.current?.commsReadMessage(ct(),Z),onRunTask:(Z,z,ne,ae,he)=>{t.current?.send({type:"run_task",project_id:ct(),task_id:Z,title:z,description:ne,mode:ae,profile:he})},onCreateTask:(Z,z,ne,ae)=>{t.current?.send({type:"kanban_create_task",project_id:ct(),title:Z,board_id:z,column_id:ne,task_id:ae})},onMoveTask:(Z,z)=>{t.current?.send({type:"kanban_move_task",project_id:ct(),task_id:Z,column_id:z})},onCreateSession:()=>{if(vn.current||Tt.current)return;const Z=ct();Cn(Z),t.current?.createSession(Z,void 0,q,Cy(q),X,Bo(q,Te))},onSessionSend:(Z,z,ne,ae)=>t.current?.sessionSend(ct(),Z,z,ne,ae),onSecretarySend:Z=>t.current?.secretarySend(ct(),Z),onDeleteSession:Z=>t.current?.deleteSession(ct(),Z),onTitleChange:(Z,z)=>t.current?.sessionUpdateTitle(ct(),Z,z),onSessionConfigChange:Bl,onSessionTaskAgentChange:$l,onContinueInNewChat:_o,onSessionStop:Uu,onSessionResume:ah,onSessionComplete:Z=>t.current?.sessionComplete(ct(),Z),onLoadSessionDetail:(Z,z)=>t.current?.sessionDetail(ct(),Z,{...z,include:z?.detailLevel==="full"?["messages","session_state","progress","work_items","runtime_context"]:["messages","session_state"],viewGeneration:ve.current}),onOpenExecutionPanel:Z=>pt(Z),onCollabSync:()=>t.current?.collabSync(ct(),void 0,ve.current)}),$==="org"&&c.jsx("div",{className:"org-page",children:c.jsx(eJ,{data:te,sessionRecruitmentByRole:Hu,talents:Be,employeeDetail:qt,reorgProposals:vt,isCustomMode:Os,onRequestData:()=>t.current?.orgInfo(),onRequestTalents:()=>t.current?.talentList(),onRequestEmployeeDetail:Z=>t.current?.employeeDetail(Z),onHireTalent:(Z,z)=>{kn(Z),t.current?.talentHire(Z,z,void 0,te?.organization_id||Te||void 0)},hiringTemplateId:Dt,onImportEmployee:Z=>t.curre Line truncated
@@ -1,155 +0,0 @@
import{g as ta,r as A3}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 ig={exports:{}},Cc={};var hk;function M3(){if(hk)return Cc;hk=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 u in r)u!=="key"&&(o[u]=r[u])}else o=r;return r=o.ref,{$$typeof:e,type:i,key:a,ref:r!==void 0?r:null,props:o}}return Cc.Fragment=t,Cc.jsx=n,Cc.jsxs=n,Cc}var gk;function D3(){return gk||(gk=1,ig.exports=M3()),ig.exports}var c=D3(),rg={exports:{}},xt={};var xk;function O3(){if(xk)return xt;xk=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"),u=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 y(G){return G===null||typeof G!="object"?null:(G=g&&G[g]||G["@@iterator"],typeof G=="function"?G:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,S={};function _(G,J,P){this.props=G,this.context=J,this.refs=S,this.updater=P||v}_.prototype.isReactComponent={},_.prototype.setState=function(G,J){if(typeof G!="object"&&typeof G!="function"&&G!=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,G,J,"setState")},_.prototype.forceUpdate=function(G){this.updater.enqueueForceUpdate(this,G,"forceUpdate")};function w(){}w.prototype=_.prototype;function C(G,J,P){this.props=G,this.context=J,this.refs=S,this.updater=P||v}var N=C.prototype=new w;N.constructor=C,k(N,_.prototype),N.isPureReactComponent=!0;var O=Array.isArray;function I(){}var D={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function L(G,J,P){var K=P.ref;return{$$typeof:e,type:G,key:J,ref:K!==void 0?K:null,props:P}}function A(G,J){return L(G.type,J,G.props)}function M(G){return typeof G=="object"&&G!==null&&G.$$typeof===e}function $(G){var J={"=":"=0",":":"=2"};return"$"+G.replace(/[=:]/g,function(P){return J[P]})}var W=/\/+/g;function B(G,J){return typeof G=="object"&&G!==null&&G.key!=null?$(""+G.key):J.toString(36)}function U(G){switch(G.status){case"fulfilled":return G.value;case"rejected":throw G.reason;default:switch(typeof G.status=="string"?G.then(I,I):(G.status="pending",G.then(function(J){G.status==="pending"&&(G.status="fulfilled",G.value=J)},function(J){G.status==="pending"&&(G.status="rejected",G.reason=J)})),G.status){case"fulfilled":return G.value;case"rejected":throw G.reason}}throw G}function F(G,J,P,K,ee){var te=typeof G;(te==="undefined"||te==="boolean")&&(G=null);var ie=!1;if(G===null)ie=!0;else switch(te){case"bigint":case"string":case"number":ie=!0;break;case"object":switch(G.$$typeof){case e:case t:ie=!0;break;case h:return ie=G._init,F(ie(G._payload),J,P,K,ee)}}if(ie)return ee=ee(G),ie=K===""?"."+B(G,0):K,O(ee)?(P="",ie!=null&&(P=ie.replace(W,"$&/")+"/"),F(ee,J,P,"",function(se){return se})):ee!=null&&(M(ee)&&(ee=A(ee,P+(ee.key==null||G&&G.key===ee.key?"":(""+ee.key).replace(W,"$&/")+"/")+ie)),J.push(ee)),1;ie=0;var oe=K===""?".":K+":";if(O(G))for(var fe=0;fe<G.length;fe++)K=G[fe],te=oe+B(K,fe),ie+=F(K,J,P,te,ee);else if(fe=y(G),typeof fe=="function")for(G=fe.call(G),fe=0;!(K=G.next()).done;)K=K.value,te=oe+B(K,fe++),ie+=F(K,J,P,te,ee);else if(te==="object"){if(typeof G.then=="function")return F(U(G),J,P,K,ee);throw J=String(G),Error("Objects are not valid as a React child (found: "+(J==="[object Object]"?"object with keys {"+Object.keys(G).join(", ")+"}":J)+"). If you meant to render a collection of children, use an array instead.")}return ie}function V(G,J,P){if(G==null)return G;var K=[],ee=0;return F(G,K,"","",function(te){return J.call(P,te,ee++)}),K}function Y(G){if(G._status===-1){var J=G._result;J=J(),J.then(function(P){(G._status===0||G._status===-1)&&(G._status=1,G._result=P)},function(P){(G._status===0||G._status===-1)&&(G._status=2,G._result=P)}),G._status===-1&&(G._status=0,G._result=J)}if(G._status===1)return G._reLine truncated
at`)?" (<anonymous>)":-1<f.stack.indexOf("@")?"@unknown:0:0":""}return`
`+we+s+Ce}var Ve=!1;function Ye(s,l){if(!s||Ve)return"";Ve=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var x={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(ye){var xe=ye}Reflect.construct(s,[],Ne)}else{try{Ne.call()}catch(ye){xe=ye}s.call(Ne.prototype)}}else{try{throw Error()}catch(ye){xe=ye}(Ne=s())&&typeof Ne.catch=="function"&&Ne.catch(function(){})}}catch(ye){if(ye&&xe&&typeof ye.stack=="string")return[ye.stack,xe.stack]}return[null,null]}};x.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(x.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(x.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var j=x.DetermineComponentFrameRoot(),H=j[0],X=j[1];if(H&&X){var re=H.split(`
`),ge=X.split(`
`);for(b=x=0;x<re.length&&!re[x].includes("DetermineComponentFrameRoot");)x++;for(;b<ge.length&&!ge[b].includes("DetermineComponentFrameRoot");)b++;if(x===re.length||b===ge.length)for(x=re.length-1,b=ge.length-1;1<=x&&0<=b&&re[x]!==ge[b];)b--;for(;1<=x&&0<=b;x--,b--)if(re[x]!==ge[b]){if(x!==1||b!==1)do if(x--,b--,0>b||re[x]!==ge[b]){var ke=`
`+re[x].replace(" at new "," at ");return s.displayName&&ke.includes("<anonymous>")&&(ke=ke.replace("<anonymous>",s.displayName)),ke}while(1<=x&&0<=b);break}}}finally{Ve=!1,Error.prepareStackTrace=f}return(f=s?s.displayName||s.name:"")?Be(f):""}function ht(s,l){switch(s.tag){case 26:case 27:case 5:return Be(s.type);case 16:return Be("Lazy");case 13:return s.child!==l&&l!==null?Be("Suspense Fallback"):Be("Suspense");case 19:return Be("SuspenseList");case 0:case 15:return Ye(s.type,!1);case 11:return Ye(s.type.render,!1);case 1:return Ye(s.type,!0);case 31:return Be("Activity");default:return""}}function zt(s){try{var l="",f=null;do l+=ht(s,f),f=s,s=s.return;while(s);return l}catch(x){return`
Error generating stack: `+x.message+`
`+x.stack}}var bt=Object.prototype.hasOwnProperty,Nt=e.unstable_scheduleCallback,me=e.unstable_cancelCallback,ze=e.unstable_shouldYield,lt=e.unstable_requestPaint,tt=e.unstable_now,qe=e.unstable_getCurrentPriorityLevel,ce=e.unstable_ImmediatePriority,ve=e.unstable_UserBlockingPriority,Ae=e.unstable_NormalPriority,$e=e.unstable_LowPriority,He=e.unstable_IdlePriority,Kt=e.log,Yt=e.unstable_setDisableYieldValue,be=null,Re=null;function Ue(s){if(typeof Kt=="function"&&Yt(s),Re&&typeof Re.setStrictMode=="function")try{Re.setStrictMode(be,s)}catch{}}var Xe=Math.clz32?Math.clz32:qn,Ge=Math.log,Je=Math.LN2;function qn(s){return s>>>=0,s===0?32:31-(Ge(s)/Je|0)|0}var In=256,Dn=262144,Ie=4194304;function Te(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 Ke(s,l,f){var x=s.pendingLanes;if(x===0)return 0;var b=0,j=s.suspendedLanes,H=s.pingedLanes;s=s.warmLanes;var X=x&134217727;return X!==0?(x=X&~j,x!==0?b=Te(x):(H&=X,H!==0?b=Te(H):f||(f=X&~s,f!==0&&(b=Te(f))))):(X=x&~j,X!==0?b=Te(X):H!==0?b=Te(H):f||(f=x&~s,f!==0&&(b=Te(f)))),b===0?0:l!==0&&l!==b&&(l&j)===0&&(j=b&-b,f=l&-l,j>=f||j===32&&(f&4194048)!==0)?l:b}function We(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function gt(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 Oe(){var s=Ie;return Ie<<=1,(Ie&62914560)===0&&(Ie=4194304),s}function nt(s){for(var l=[],f=0;31>f;f++)l.push(s);return l}function on(s,l){s.pendingLanes|=l,l!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Zt(s,l,f,x,b,j){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,ge=s.hiddenUpdates;for(f=H&~f;0<f;){var ke=31-Xe(f),Ne=1<<ke;X[ke]=0,re[ke]=-1;var xe=ge[ke];if(xe!==null)for(ge[ke]=null,ke=0;ke<xe.length;ke++){var ye=xe[ke];ye!==null&&(ye.lane&=-536870913)}f&=~Ne}x!==0&&_t(s,x,0),j!==0&&b===0&&s.tag!==0&&(s.suspendedLanes|=j&~(H&~l))}function _t(s,l,f){s.pendingLanes|=l,s.suspendedLanes&=~l;var x=31-Xe(l);s.entangledLanes|=l,s.entanglements[x]=s.entanglements[x]|1073741824|f&261930}function Qt(s,l){var f=s.entangledLanes|=l;for(s=s.entanglements;f;){var x=31-Xe(f),b=1<<x;b&l|s[x]&l&&(s[x]|=l),f&=~b}}function Cn(s,l){var f=l&-l;return f=(f&42)!==0?1:dt(f),(f&(s.suspendedLanes|l))!==0?0:f}function dt(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 jn(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Jt(){var s=V.p;return s!==0?s:(s=window.event,s===void 0?32:lk(s.type))}function En(s,l){var f=V.p;try{return V.p=s,l()}finally{V.p=f}}var hn=Math.random().toString(36).slice(2),jt="__reactFiber$"+hn,yt="__reactProps$"+hn,gn="__reactContainer$"+hn,ri="__reactEvents$"+hn,Me="__reactListeners$"+hn,$t="__reactHandles$"+hn,Wn="__reactResources$"+hn,_i="__reactMarker$"+hn;function On(s){delete s[jt],delete s[yt],delete s[ri],delete s[Me],delete s[$t]}function vt(s){var l=s[jt];if(l)return l;for(var f=s.parentNode;f;){if(l=f[gn]||f[jt]){if(f=l.alternate,l.child!==null||f!==null&&f.child!==null)for(s=q_(s);s!==null;){if(f=s[jt])return f;s=q_(s)}return l}s=f,f=s.parentNode}return null}function Ni(s){if(s=s[jt]||s[gn]){var l=s.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return s}return null}function Ii(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(i(33))}function Yn(s){var l=s[Wn];return l||(l=s[Wn]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function dn(s){s[_i]=!0}var Hi=new Set,Or={};function Et(s,l){Ti(s,l),Ti(s+"Capture",l)}function Ti(s,l){for(Or[s]=l,s=0;s<l.length;s++)Hi.add(l[s])}var ki=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u2 Line truncated
`).replace(e3,"")}function L_(s,l){return l=O_(l),O_(s)===l}function cn(s,l,f,x,b,j){switch(f){case"children":typeof x=="string"?l==="body"||l==="textarea"&&x===""||Rs(s,x):(typeof x=="number"||typeof x=="bigint")&&l!=="body"&&Rs(s,""+x);break;case"className":It(s,"class",x);break;case"tabIndex":It(s,"tabindex",x);break;case"dir":case"role":case"viewBox":case"width":case"height":It(s,f,x);break;case"style":rr(s,x,j);break;case"data":if(l!=="object"){It(s,"data",x);break}case"src":case"href":if(x===""&&(l!=="a"||f!=="href")){s.removeAttribute(f);break}if(x==null||typeof x=="function"||typeof x=="symbol"||typeof x=="boolean"){s.removeAttribute(f);break}x=sa(""+x),s.setAttribute(f,x);break;case"action":case"formAction":if(typeof x=="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 j=="function"&&(f==="formAction"?(l!=="input"&&cn(s,l,"name",b.name,b,null),cn(s,l,"formEncType",b.formEncType,b,null),cn(s,l,"formMethod",b.formMethod,b,null),cn(s,l,"formTarget",b.formTarget,b,null)):(cn(s,l,"encType",b.encType,b,null),cn(s,l,"method",b.method,b,null),cn(s,l,"target",b.target,b,null)));if(x==null||typeof x=="symbol"||typeof x=="boolean"){s.removeAttribute(f);break}x=sa(""+x),s.setAttribute(f,x);break;case"onClick":x!=null&&(s.onclick=sr);break;case"onScroll":x!=null&&At("scroll",s);break;case"onScrollEnd":x!=null&&At("scrollend",s);break;case"dangerouslySetInnerHTML":if(x!=null){if(typeof x!="object"||!("__html"in x))throw Error(i(61));if(f=x.__html,f!=null){if(b.children!=null)throw Error(i(60));s.innerHTML=f}}break;case"multiple":s.multiple=x&&typeof x!="function"&&typeof x!="symbol";break;case"muted":s.muted=x&&typeof x!="function"&&typeof x!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(x==null||typeof x=="function"||typeof x=="boolean"||typeof x=="symbol"){s.removeAttribute("xlink:href");break}f=sa(""+x),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":x!=null&&typeof x!="function"&&typeof x!="symbol"?s.setAttribute(f,""+x):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":x&&typeof x!="function"&&typeof x!="symbol"?s.setAttribute(f,""):s.removeAttribute(f);break;case"capture":case"download":x===!0?s.setAttribute(f,""):x!==!1&&x!=null&&typeof x!="function"&&typeof x!="symbol"?s.setAttribute(f,x):s.removeAttribute(f);break;case"cols":case"rows":case"size":case"span":x!=null&&typeof x!="function"&&typeof x!="symbol"&&!isNaN(x)&&1<=x?s.setAttribute(f,x):s.removeAttribute(f);break;case"rowSpan":case"start":x==null||typeof x=="function"||typeof x=="symbol"||isNaN(x)?s.removeAttribute(f):s.setAttribute(f,x);break;case"popover":At("beforetoggle",s),At("toggle",s),tn(s,"popover",x);break;case"xlinkActuate":pi(s,"http://www.w3.org/1999/xlink","xlink:actuate",x);break;case"xlinkArcrole":pi(s,"http://www.w3.org/1999/xlink","xlink:arcrole",x);break;case"xlinkRole":pi(s,"http://www.w3.org/1999/xlink","xlink:role",x);break;case"xlinkShow":pi(s,"http://www.w3.org/1999/xlink","xlink:show",x);break;case"xlinkTitle":pi(s,"http://www.w3.org/1999/xlink","xlink:title",x);break;case"xlinkType":pi(s,"http://www.w3.org/1999/xlink","xlink:type",x);break;case"xmlBase":pi(s,"http://www.w3.org/XML/1998/namespace","xml:base",x);break;case"xmlLang":pi(s,"http://www.w3.org/XML/1998/namespace","xml:lang",x);break;case"xmlSpace":pi(s,"http://www.w3.org/XML/1998/namespace","xml:space",x);break;case"is":tn(s,"is",x);break;case"innerText":case"textContent":break;default:(!(2<f.length)||f[0]!=="o"&&f[0]!=="O"||f[1]!=="n"&&f[1]!=="N")&&(f=op.get(f)||f,tn(s,f,x))}}function Bh(s,l,f,x,b,j){switch(f){case"style":rr(s,x,j);break;case"dangerouslySetInnerHTML":if(x!=null){if(typeof x!="object"||!("__html"in x))throw Error(i(61));if(f=x.__html,f!=null){if(b.children!=null)throw Error(i(60));s.innerHTML=f}}break;case"children":typeof x=="string"?Rs(s,x):(typeof x=="number"||typeof x=="bigint")&&Rs(s,""+x);break;case"onScroll":x!=null&&At("scroll",s);break;case"onScrollEnd":x!=null&&At("scrollend",s);break;case"onClick":x!=null&&(s.onclick=sr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"inne Line truncated
`),oe=p.map(([fe,se])=>` [${fe}, ${se}],`).join(`
`);return`const MAP_STR: string[] = [
${ie}
]
const SEATS: [number, number][] = [
${oe}
]`})(),J=()=>I(te=>Math.min(te+.25,3)),P=()=>I(te=>Math.max(te-.25,.5)),K=m.flat().filter(te=>te===1).length,ee=m.flat().filter(te=>te===0).length;return c.jsxs("div",{className:"collision-editor",children:[c.jsxs("div",{className:"ce-toolbar",children:[c.jsxs("div",{className:"ce-toolbar-group",children:[c.jsx("span",{className:"ce-title",children:"Map Editor"}),c.jsx("select",{className:"ce-office-select",value:a,onChange:te=>M(te.target.value),children:r.map(te=>c.jsx("option",{value:te.id,children:te.name},te.id))})]}),c.jsxs("div",{className:"ce-toolbar-group",children:[c.jsxs("button",{className:`ce-mode-btn ${y==="wall"?"active wall":""}`,onClick:()=>v("wall"),children:[c.jsx("span",{className:"ce-mode-dot wall"})," Wall"]}),c.jsxs("button",{className:`ce-mode-btn ${y==="floor"?"active floor":""}`,onClick:()=>v("floor"),children:[c.jsx("span",{className:"ce-mode-dot floor"})," Floor"]}),c.jsxs("button",{className:`ce-mode-btn ${y==="seat"?"active seat":""}`,onClick:()=>v("seat"),children:[c.jsx("span",{className:"ce-mode-dot seat"})," Seat"]})]}),c.jsxs("div",{className:"ce-toolbar-group",children:[c.jsx("button",{className:"ce-btn",onClick:P,children:"-"}),c.jsxs("span",{className:"ce-zoom-label",children:[Math.round(O*100),"%"]}),c.jsx("button",{className:"ce-btn",onClick:J,children:"+"}),c.jsx("button",{className:`ce-btn${D?" active":""}`,onClick:()=>T(te=>!te),children:"Grid"})]}),c.jsxs("div",{className:"ce-toolbar-group",children:[c.jsx("button",{className:`ce-btn apply${C?" success":""}`,onClick:Y,children:C?"Applied":"Apply"}),c.jsx("button",{className:`ce-btn${_?" active":""}`,onClick:Q,children:"Export"}),c.jsx("button",{className:"ce-btn danger",onClick:q,children:"Reset"})]}),c.jsxs("div",{className:"ce-toolbar-group ce-stats",children:[c.jsxs("span",{children:["Walls: ",K]}),c.jsxs("span",{children:["Floor: ",ee]}),c.jsxs("span",{children:["Seats: ",p.length]})]})]}),c.jsxs("div",{className:"ce-body",children:[c.jsx("div",{className:"ce-canvas-wrap",style:{overflow:"auto"},children:c.jsx("canvas",{ref:t,style:{width:L*R*O,height:A*R*O,imageRendering:"pixelated",cursor:y==="seat"?"crosshair":"cell"},onMouseDown:U,onMouseMove:F,onMouseUp:V,onMouseLeave:V})}),_&&c.jsxs("div",{className:"ce-export-panel",children:[c.jsxs("div",{className:"ce-export-header",children:[c.jsx("span",{children:"Export — copy to source code"}),c.jsx("button",{className:"ce-btn",onClick:()=>navigator.clipboard.writeText(G),children:"Copy"})]}),c.jsx("textarea",{className:"ce-export-textarea",value:G,readOnly:!0,rows:20})]})]})]})}let qM=0;function Qn(e,t,n={}){return{event_id:`test-${++qM}`,type:e,agent_id:t,data:n,timestamp:Date.now()/1e3}}function kn(e){return new Promise(t=>setTimeout(t,e))}async function WM(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 M of[...n.agents.keys()])n.removeAgent(M);await kn(100);const i=Mn();t.push({name:"offices-loaded",pass:i.length>=3,detail:`${i.length} offices loaded: ${i.map(M=>M.name).join(", ")}`});const r=["agent-A","agent-B","agent-C","agent-D","agent-E","agent-F"];for(const M of r)e.pushEvent(Qn("agent_active",M));await kn(300);const o=new Set;let a=!1;for(const M of r){const $=n.getAgent(M);$&&$.seatId&&(o.has($.seatId)&&(a=!0),o.add($.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 u=r.every(M=>n.getAgent(M)?.officeId!=null);t.push({name:"agents-have-officeId",pass:u,detail:r.map(M=>`${M}=${n.getAgent(M)?.officeId}`).join(", ")}),e.pushEvent(Qn("tool_start","agent-A",{tool_name:"shell"})),await kn(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(Qn("tool_done","agent-A",{tool_name:"shell"})),await kn(100),t.push({name:"tool_done-celebrate",pass:d.agentState==="celebrate",detail:`state=${d.agentState}`});for(let M=0;M<20&&d.agentState==="celebrate";M++)await kn(500);t.push({name:"celebrate-to-idle",pass:d.agentState!=="celebrate",detail:`state=${d.agentState}`}),e.pushEvent(Qn("waiting","agent-B")),await kn(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(Qn("reflect_start","agent-C")),await kn(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(Qn("reflect_done","agent-C")),await kn(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*S,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(o&&n.skipInitialOnChange)&&n.onChange(r),o=!1,r}return a.updateDeps=u=>{i=u},a}function Gk(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const r4=(e,t)=>Math.abs(e-t)<1.01,s4=(e,t,n)=>{let i;return function(...r){e.clearTimeout(i),i=e.setTimeout(()=>t.apply(this,r),n)}},qk=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},o4=e=>e,a4=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},l4=(e,t)=>{const n=e.scrollElement;if(!n)return;const i=e.targetWindow;if(!i)return;const r=a=>{const{width:u,height:d}=a;t({width:Math.round(u),height:Math.round(d)})};if(r(qk(n)),!i.ResizeObserver)return()=>{};const o=new i.ResizeObserver(a=>{const u=()=>{const d=a[0];if(d?.borderBoxSize){const m=d.borderBoxSize[0];if(m){r({width:m.inlineSize,height:m.blockSize});return}}r(qk(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(u):u()});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},Wk={passive:!0},Yk=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&&Yk?()=>{}:s4(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)},u=a(!0),d=a(!1);n.addEventListener("scroll",u,Wk);const m=e.options.useScrollendEvent&&Yk;return m&&n.addEventListener("scrollend",d,Wk),()=>{n.removeEventListener("scroll",u),m&&n.removeEventListener("scrollend",d)}},u4=(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"]},d4=(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 f4{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 u=o.target,d=this.indexFromElement(u);if(!u.isConnected){this.observer.unobserve(u);return}this.shouldMeasureDuringScroll(d)&&this.resizeItem(d,this.options.measureElement(u,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:o4,rangeExtractor:a4,onChange:()=>{},measureElement:u4,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=Va(()=>(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
The error may be correlated with this previous error:
${te.current.stack}
`),we}Vf(()=>{te.current=void 0,P.current=void 0,G.current=fe});const se=E.useMemo(()=>E.createElement(S,{...fe,ref:L}),[L,S,fe]);return E.useMemo(()=>v?E.createElement(M.Provider,{value:q},se):se,[M,se,q])}const I=E.memo(N);if(I.WrappedComponent=S,I.displayName=N.displayName=w,d){const T=E.forwardRef(function(A,M){return E.createElement(I,{...A,reactReduxForwardedRef:M})});return T.displayName=w,T.WrappedComponent=S,Ay(T,S)}return Ay(I,S)}}var sE=K5;function Z5(e){const{children:t,context:n,serverState:i,store:r}=e,o=E.useMemo(()=>{const d=nE(r);return{store:r,subscription:d,getServerState:i?()=>i:void 0}},[r,i]),a=E.useMemo(()=>r.getState(),[r]);Vf(()=>{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 u=n||rE;return E.createElement(u.Provider,{value:o},t)}var Q5=Z5,J5="Invariant failed";function eD(e,t){throw new Error(J5)}var Nr=function(t){var n=t.top,i=t.right,r=t.bottom,o=t.left,a=i-o,u=r-n,d={top:n,right:i,bottom:r,left:o,width:a,height:u,x:o,y:n,center:{x:(i+o)/2,y:(r+n)/2}};return d},M0=function(t,n){return{top:t.top-n.top,left:t.left-n.left,bottom:t.bottom+n.bottom,right:t.right+n.right}},vS=function(t,n){return{top:t.top+n.top,left:t.left+n.left,bottom:t.bottom-n.bottom,right:t.right-n.right}},tD=function(t,n){return{top:t.top+n.y,left:t.left+n.x,bottom:t.bottom+n.y,right:t.right+n.x}},bg={top:0,right:0,bottom:0,left:0},D0=function(t){var n=t.borderBox,i=t.margin,r=i===void 0?bg:i,o=t.border,a=o===void 0?bg:o,u=t.padding,d=u===void 0?bg:u,m=Nr(M0(n,r)),h=Nr(vS(n,a)),p=Nr(vS(h,d));return{marginBox:m,borderBox:Nr(n),paddingBox:h,contentBox:p,margin:r,border:a,padding:d}},hr=function(t){var n=t.slice(0,-2),i=t.slice(-2);if(i!=="px")return 0;var r=Number(n);return isNaN(r)&&eD(),r},nD=function(){return{x:window.pageXOffset,y:window.pageYOffset}},Uf=function(t,n){var i=t.borderBox,r=t.border,o=t.margin,a=t.padding,u=tD(i,n);return D0({borderBox:u,border:r,margin:o,padding:a})},Gf=function(t,n){return n===void 0&&(n=nD()),Uf(t,n)},oE=function(t,n){var i={top:hr(n.marginTop),right:hr(n.marginRight),bottom:hr(n.marginBottom),left:hr(n.marginLeft)},r={top:hr(n.paddingTop),right:hr(n.paddingRight),bottom:hr(n.paddingBottom),left:hr(n.paddingLeft)},o={top:hr(n.borderTopWidth),right:hr(n.borderRightWidth),bottom:hr(n.borderBottomWidth),left:hr(n.borderLeftWidth)};return D0({borderBox:t,margin:i,padding:r,border:o})},aE=function(t){var n=t.getBoundingClientRect(),i=window.getComputedStyle(t);return oE(n,i)},cu=function(t){var n=[],i=null,r=function(){for(var a=arguments.length,u=new Array(a),d=0;d<a;d++)u[d]=arguments[d];n=u,!i&&(i=requestAnimationFrame(function(){i=null,t.apply(void 0,n)}))};return r.cancel=function(){i&&(cancelAnimationFrame(i),i=null)},r};function qf(){return qf=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},qf.apply(null,arguments)}function lE(e,t){}lE.bind(null,"warn");lE.bind(null,"error");function uo(){}function iD(e,t){return{...e,...t}}function vr(e,t,n){const i=t.map(r=>{const o=iD(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 rD="Invariant failed";class Wf extends Error{}Wf.prototype.toString=function(){return this.message};function Le(e,t){throw new Wf(rD)}let sD=class extends St.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=uo,this.onWindowError=n=>{const i=this.getCallbacks();i.isDragging()&&i.tryAbort(),n.error instanceof Wf&&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=vr(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof Wf){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}};const oD=`
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
`,Yf=e=>e+1,aD=e=>`
You have lifted an item in position ${Yf(e.source.index)}
`,cE=(e,t)=>{const n=e.droppableId===t.droppableId,i=Yf(e.index),r=Yf(t.index);return n?`
You have moved the item from position ${i}
to position ${r}
`:`
You have moved the item from position ${i}
in list ${e.droppableId}
to list ${t.droppableId}
in position ${r}
`},uE=(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}
`,lD=e=>{const t=e.destination;if(t)return cE(e.source,t);const n=e.combine;return n?uE(e.draggableId,e.source,n):"You are over an area that cannot be dropped on"},bS=e=>`
The item has returned to its starting position
of ${Yf(e.index)}
`,cD=e=>{if(e.reason==="CANCEL")return`
Movement cancelled.
${bS(e.source)}
`;const t=e.destination,n=e.combine;return t?`
You have dropped the item.
${cE(e.source,t)}
`:n?`
You have dropped the item.
${uE(e.draggableId,e.source,n)}
`:`
The item has been dropped while not over a drop area.
${bS(e.source)}
`},Ef={dragHandleUsageInstructions:oD,onDragStart:aD,onDragUpdate:lD,onDragEnd:cD};function uD(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function dE(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!uD(e[n],t[n]))return!1;return!0}function Ft(e,t){const n=E.useState(()=>({inputs:t,result:e()}))[0],i=E.useRef(!0),r=E.useRef(n),a=i.current||!!(t&&r.current.inputs&&dE(t,r.current.inputs))?r.current:{inputs:t,result:e()};return E.useEffect(()=>{i.current=!1,r.current=a},[a]),a.result}function it(e,t){return Ft(()=>e,t)}const ii={x:0,y:0},fi=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),Qi=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),fo=(e,t)=>e.x===t.x&&e.y===t.y,Il=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),qo=(e,t,n=0)=>e==="x"?{x:t,y:n}:{x:n,y:t},uu=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),_S=(e,t)=>Math.min(...t.map(n=>uu(e,n))),fE=e=>t=>({x:e(t.x),y:e(t.y)});var dD=(e,t)=>{const n=Nr({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 Iu=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),kS=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}],fD={top:0,right:0,bottom:0,left:0},mD=(e,t)=>t?Iu(e,t.scroll.diff.displacement):e,pD=(e,t,n)=>n&&n.increasedBy?{...e,[t.end]:e[t.end]+n.increasedBy[t.line]}:e,hD=(e,t)=>t&&t.shouldClipSubject?dD(t.pageMarginBox,e):Nr(e);var ml=({page:e,withPlaceholder:t,axis:n,frame:i})=>{const r=mD(e.marginBox,i),o=pD(r,n,t),a=hD(o,i);return{page:e,withPlaceholder:t,active:a}},O0=(e,t)=>{e.frame||Le();const n=e.frame,i=Qi(t,n.scroll.initial),r=Il(i),o={...n,scroll:{initial:n.scroll.initial,current:t,diff:{value:i,displacement:r},max:n.scroll.max}},a=ml({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:o});return{...e,frame:o,subject:a}};function ni(e,t=dE){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 mE=ni(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),pE=ni(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),Im=ni(e=>Object.values(e)),gD=ni(e=>Object.values(e));var Tl=ni((e,t)=>gD(t).filter(i=>e===i.descriptor.droppableId).sort((i,r)=>i.descriptor.index-r.descriptor.index));function L0(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function Tm(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var Rm=ni((e,t)=>t.filter(n=>n.descriptor.id!==e.descriptor.id)),xD=({isMovingForward:e,draggable:t,destination:n,insideDestination:i,previousImpact:r})=>{if(!n.isCombineEnabled||!L0(r))return null;function a(y){const v={type:"COMBINE",combine:{draggableId:y,droppableId:n.descriptor.id}};return{...r,at:v}}const u=r.displaced.all,d=u.length?u[0]:null;if(e)return d?a(d):null;const m=Rm(t,i);if(!d){if(!m.length)return null;const y=m[m.length-1];return a(y.descriptor.id)}const h=m.findIndex(y=>y.descriptor.id===d);h===-1&&Le();const p=h-1;if(p<0)return null;const g=m[p];return a(g.descriptor.id)},Rl=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const hE={point:ii,value:0},du={invisible:{},visible:{},all:[]},yD={displaced:du,displacedBy:hE,at:null};var br=(e,t)=>n=>e<=n&&n<=t,gE=e=>{const t=br(e.top,e.bottom),n=br(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}},vD=e=>{const t=br(e.top,e.bottom),n=br(e.left,e.right);return i=>t(i.top)&&t(i.bottom)&&n(i.left)&&n(i.right)};const z0={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},xE={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var bD=e=>t=>{const n=br(t.top,t.bottom),i=br(t.left,t.right);return r=>e===z0?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:ii;return Iu(e,n)},kD=(e,t,n)=>t.subject.active?n(t.subject.active)(e):!1,SD=(e,t,n)=>n(t)(e),P0=({target:e,destination:t,viewport:n,withDroppableDisplacement:i,isVisibleThroughFrameFn:r})=>{const o=i?_D(e,t):e;return kD(o,t,r)&&SD(o,n,r)},wD=e=>P0({...e,isVisibleThroughFrameFn:gE}),yE=e=>P0({...e,isVisibleThroughFrameFn:vD}),CD=e=>P0({...e,isVisibleThroughFrameFn:bD(e.destination.axis)}),jD=(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 ED(e,t){const n=e.page.marginBox,i={top:t.point.y,right:0,bottom:0,left:t.point.x};return Nr(M0(n,i))}function fu({afterDragging:e,destination:t,displacedBy:n,viewport:i,forceShouldAnimate:r,la Line truncated
cursor: -webkit-grab;
cursor: grab;
`;return{selector:t(hl.contextId),styles:{always:`
-webkit-touch-callout: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
touch-action: manipulation;
`,resting:u,dragging:NL,dropAnimating:u}}})(),i=(()=>{const u=`
transition: ${Qc.outOfTheWay};
`;return{selector:t(zy.contextId),styles:{dragging:u,dropAnimating:u,userCancel:u}}})(),r={selector:t(jL.contextId),styles:{always:"overflow-anchor: none;"}},a=[i,n,r,{selector:"body",styles:{dragging:`
cursor: grabbing;
cursor: -webkit-grabbing;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
overflow-anchor: none;
`}}];return{always:Tc(a,"always"),resting:Tc(a,"resting"),dragging:Tc(a,"dragging"),dropAnimating:Tc(a,"dropAnimating"),userCancel:Tc(a,"userCancel")}};const er=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?E.useLayoutEffect:E.useEffect,Cg=()=>{const e=document.querySelector("head");return e||Le(),e},LS=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function TL(e,t){const n=Ft(()=>IL(e),[e]),i=E.useRef(null),r=E.useRef(null),o=it(ni(p=>{const g=r.current;g||Le(),g.textContent=p}),[]),a=it(p=>{const g=i.current;g||Le(),g.textContent=p},[]);er(()=>{!i.current&&!r.current||Le();const p=LS(t),g=LS(t);return i.current=p,r.current=g,p.setAttribute(`${pl}-always`,e),g.setAttribute(`${pl}-dynamic`,e),Cg().appendChild(p),Cg().appendChild(g),a(n.always),o(n.resting),()=>{const y=v=>{const k=v.current;k||Le(),Cg().removeChild(k),v.current=null};y(i),y(r)}},[t,a,o,n.always,n.resting,e]);const u=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 Ft(()=>({dragging:u,dropping:d,resting:m}),[u,d,m])}function GE(e,t){return Array.from(e.querySelectorAll(t))}var qE=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function Mm(e){return e instanceof qE(e).HTMLElement}function RL(e,t){const n=`[${hl.contextId}="${e}"]`,i=GE(document,n);if(!i.length)return null;const r=i.find(o=>o.getAttribute(hl.draggableId)===t);return!r||!Mm(r)?null:r}function AL(e){const t=E.useRef({}),n=E.useRef(null),i=E.useRef(null),r=E.useRef(!1),o=it(function(g,y){const v={id:g,focus:y};return t.current[g]=v,function(){const S=t.current;S[g]!==v&&delete S[g]}},[]),a=it(function(g){const y=RL(e,g);y&&y!==document.activeElement&&y.focus()},[e]),u=it(function(g,y){n.current===g&&(n.current=y)},[]),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 y=document.activeElement;y&&y.getAttribute(hl.draggableId)===g&&(n.current=g)},[]);return er(()=>(r.current=!0,function(){r.current=!1;const g=i.current;g&&cancelAnimationFrame(g)}),[]),Ft(()=>({register:o,tryRecordFocus:m,tryRestoreFocusRecorded:d,tryShiftRecord:u}),[o,m,d,u])}function ML(){const e={draggables:{},droppables:{}},t=[];function n(p){return t.push(p),function(){const y=t.indexOf(p);y!==-1&&t.splice(y,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 y=e.draggables[g.descriptor.id];y&&y.uniqueId===p.uniqueId&&(delete e.draggables[g.descriptor.id],e.draggables[p.descriptor.id]=p)},unregister:p=>{const g=p.descriptor.id,y=r(g);y&&p.uniqueId===y.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 u(p){return e.droppables[p]||null}function d(p){const g=u(p);return g||Le(),g}const m={register:p=>{e.droppables[p.descriptor.id]=p},unregister:p=>{const g=u(p.descriptor.id);g&&p.uniqueId===g.uniqueId&&delete e.droppables[p.descriptor.id]},getById:d,findById:u,exists:p=>!!u(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 DL(){const e=Ft(ML,[]);return E.useEffect(()=>function(){e.clean()},[e]),e}var X0=St.createContext(null),Kf=()=>{const e=document.body;return e||Le(),e};const OL={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},LL=e=>`rfd-announcement-${e}`;function zL(e){const t=Ft(()=>LL(e),[e]),n=E.useRef(null);return E.useEffect(function(){const o=document.createElement("div");return n.current=o,o.id=t,o.setAttribute("aria-live","assertive"),o.setAttribute("aria-atomic","true"),qf(o.style,OL),Kf().appendChild(o),function(){setTimeout(function(){const d=Kf();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 PL={separator:"::"};function K0(e,t=PL){const n=St.useId();return Ft(()=>`${e}${t.separator}${n}`,[t.separator,e,n])}function BL({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function $L({contextId:e,text:t}){const n=K0("hidden-text",{separator:"-"}),i=Ft(()=>BL({contextId:e,uniqueId:n}),[n,e]);return E.useEffect(function(){const o=document.createElement("div");return o.id=i,o.textContent=t,o.style.display="none",Kf().appendChild(o),function(){const u=Kf();u.contains(o)&&u.removeChild(o)}},[i,t]),i}var Dm=St.c Line truncated
`,m="/",h="*",p="",g="comment",y="declaration";function v(S,_){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];_=_||{};var w=1,C=1;function N(B){var U=B.match(t);U&&(w+=U.length);var F=B.lastIndexOf(d);C=~F?B.length-F:C+B.length}function O(){var B={line:w,column:C};return function(U){return U.position=new I(B),L(),U}}function I(B){this.start=B,this.end={line:w,column:C},this.source=_.source}I.prototype.content=S;function D(B){var U=new Error(_.source+":"+w+":"+C+": "+B);if(U.reason=B,U.filename=_.source,U.line=w,U.column=C,U.source=S,!_.silent)throw U}function T(B){var U=B.exec(S);if(U){var F=U[0];return N(F),S=S.slice(F.length),U}}function L(){T(n)}function A(B){var U;for(B=B||[];U=M();)U!==!1&&B.push(U);return B}function M(){var B=O();if(!(m!=S.charAt(0)||h!=S.charAt(1))){for(var U=2;p!=S.charAt(U)&&(h!=S.charAt(U)||m!=S.charAt(U+1));)++U;if(U+=2,p===S.charAt(U-1))return D("End of comment missing");var F=S.slice(2,U-2);return C+=2,N(F),S=S.slice(U),C+=2,B({type:g,comment:F})}}function $(){var B=O(),U=T(i);if(U){if(M(),!T(r))return D("property missing ':'");var F=T(o),V=B({type:y,property:k(U[0].replace(e,p)),value:F?k(F[0].replace(e,p)):p});return T(a),V}}function W(){var B=[];A(B);for(var U;U=$();)U!==!1&&(B.push(U),A(B));return B}return L(),W()}function k(S){return S?S.replace(u,p):p}return Dg=v,Dg}var ew;function oz(){if(ew)return qa;ew=1;var e=qa&&qa.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(qa,"__esModule",{value:!0}),qa.default=n;const t=e(sz());function n(i,r){let o=null;if(!i||typeof i!="string")return o;const a=(0,t.default)(i),u=typeof r=="function";return a.forEach(d=>{if(d.type!=="declaration")return;const{property:m,value:h}=d;u?r(m,h,d):h&&(o=o||{},o[m]=h)}),o}return qa}var Dc={},tw;function az(){if(tw)return Dc;tw=1,Object.defineProperty(Dc,"__esModule",{value:!0}),Dc.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()},u=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,u):m=m.replace(i,u),m.replace(t,a))};return Dc.camelCase=d,Dc}var Oc,nw;function lz(){if(nw)return Oc;nw=1;var e=Oc&&Oc.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},t=e(oz()),n=az();function i(r,o){var a={};return!r||typeof r!="string"||(0,t.default)(r,function(u,d){u&&d&&(a[(0,n.camelCase)(u,o)]=d)}),a}return i.default=i,Oc=i,Oc}var cz=lz();const uz=ta(cz),yN=vN("end"),nv=vN("start");function vN(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 dz(e){const t=nv(e),n=yN(e);if(t&&n)return{start:t,end:n}}function Jc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?iw(e.position):"start"in e||"end"in e?iw(e):"line"in e||"column"in e?Fy(e):""}function Fy(e){return rw(e&&e.line)+":"+rw(e&&e.column)}function iw(e){return Fy(e&&e.start)+"-"+Fy(e&&e.end)}function rw(e){return e&&typeof e=="number"?e:1}class bi 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 u=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=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=u?u.line:void 0,this.name=Jc(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}}bi.prototype.file="";bi.prototype.name="";bi.prototype.reason="";bi.prototype.message="";bi.prototype.stack="";bi.prototype.column=void 0;bi.prototype.line=void 0;bi.prototype.ancestors=void 0;bi.prototype.cause=void 0;bi.prototype.fatal=void 0;bi.prototype.place=void 0;bi.prototype.ruleId=void 0;bi.prototype.source=void 0;const iv={}.hasOwnProperty,fz=new Map,mz=/[A-Z]/g,pz=new Set(["table","tbody","thead","tfoot","tr"]),hz=new Set(["td","th"]),bN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function gz(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 wB(e){const i={constructs:CN([bB,...(e||{}).extensions||[]]),content:r(Bz),defined:[],document:r(Hz),flow:r(sB),lazy:{},string:r(lB),text:r(cB)};return i;function r(o){return a;function a(u){return _B(i,o,u)}}}function CB(e){for(;!TN(e););return e}const pw=/[\0\t\n\r]/g;function jB(){let e=1,t="",n=!0,i;return r;function r(o,a,u){const d=[];let m,h,p,g,y;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(pw.lastIndex=p,m=pw.exec(o),g=m&&m.index!==void 0?m.index:o.length,y=o.charCodeAt(g),!m){t=o.slice(p);break}if(y===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),y){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 u&&(i&&d.push(-5),t&&d.push(t),d.push(null)),d}}const EB=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function NB(e){return e.replace(EB,IB)}function IB(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const r=n.charCodeAt(1),o=r===120||r===88;return jN(n.slice(o?2:1),o?16:10)}return av(n)||e}const LN={}.hasOwnProperty;function TB(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),RB(n)(CB(wB(n).document().write(jB()(e,t,!0))))}function RB(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(bt),autolinkProtocol:L,autolinkEmail:L,atxHeading:o(Ve),blockQuote:o(se),characterEscape:L,characterReference:L,codeFenced:o(_e),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(_e,a),codeText:o(we,a),codeTextData:L,data:L,codeFlowValue:L,definition:o(Ce),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(Be),hardBreakEscape:o(Ye),hardBreakTrailing:o(Ye),htmlFlow:o(ht,a),htmlFlowData:L,htmlText:o(ht,a),htmlTextData:L,image:o(zt),label:a,link:o(bt),listItem:o(me),listItemValue:g,listOrdered:o(Nt,p),listUnordered:o(Nt),paragraph:o(ze),reference:P,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(Ve),strong:o(lt),thematicBreak:o(qe)},exit:{atxHeading:d(),atxHeadingSequence:O,autolink:d(),autolinkEmail:fe,autolinkProtocol:oe,blockQuote:d(),characterEscapeValue:A,characterReferenceMarkerHexadecimal:ee,characterReferenceMarkerNumeric:ee,characterReferenceValue:te,characterReference:ie,codeFenced:d(S),codeFencedFence:k,codeFencedFenceInfo:y,codeFencedFenceMeta:v,codeFlowValue:A,codeIndented:d(_),codeText:d(U),codeTextData:A,data:A,definition:d(),definitionDestinationString:N,definitionLabelString:w,definitionTitleString:C,emphasis:d(),hardBreakEscape:d($),hardBreakTrailing:d($),htmlFlow:d(W),htmlFlowData:A,htmlText:d(B),htmlTextData:A,image:d(V),label:Q,labelText:Y,lineEnding:M,link:d(F),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:K,resourceDestinationString:q,resourceTitleString:G,resource:J,setextHeading:d(T),setextHeadingLineSequence:D,setextHeadingText:I,strong:d(),thematicBreak:d()}};zN(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(ce){let ve={type:"root",children:[]};const Ae={stack:[ve],tokenStack:[],config:t,enter:u,exit:m,buffer:a,resume:h,data:n},$e=[];let He=-1;for(;++He<ce.length;)if(ce[He][1].type==="listOrdered"||ce[He][1].type==="listUnordered")if(ce[He][0]==="enter")$e.push(He);else{const Kt=$e.pop();He=r(ce,Kt,He)}for(He=-1;++He<ce.length;){const Kt=t[ce[He][0]];LN.call(Kt,ce[He][1].type)&&Kt[ce[He][1].type].call(Object.assign({sliceSerialize:ce[He][2].sliceSerialize},Ae),ce[He][1])}if(Ae.tokenStack.length>0){const Kt=Ae.tokenStack[Ae.tokenStack.length-1];(Kt[1]||hw).call(Ae,void 0,Kt[0])}for(ve.position={start:ro(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:ro(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},He=-1;++He<t.transforms.length;)ve=t.transforms[He](ve)||ve;return ve}function r(ce,ve,Ae){let $e=ve-1,He=-1,Kt=!1,Yt,be,Re,Ue;for(;++$e<=Ae;){const Xe=ce[$e];switch(Xe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Xe[0]==="enter"?He++:He--,Ue=void 0;break}case"lineEndingBlank":{Xe[0]==="enter"&&(Yt&&!Ue&&!He&&!Re&&(Re=$e),Ue=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ue=void 0}if(!He&&Xe[0]==="enter"&&Xe[1].type==="listItemPrefix"||He===-1&&Xe[0]==="exit"&&(Xe[1].type==="listUnordered"||Xe[1].type==="listOrdered")){if(Yt){let Ge=$e;for(be=void 0;Ge--;){const Je=ce[Ge];if(Je[1].type==="lineEnding"||Je[1].type==="lineEndingBlank"){if(Je[0]==="exit")continue;be&&(ce[be][1].type="lineEndingBlank",Kt=!0),Je[1].type="lineEnding",be=Ge}else if(!(Je[1].type==="linePrefix"||Je[1].type==="blockQuotePrefix"||Je[1].type==="blockQuotePrefixWhitespace"Line truncated
`}]}function LB(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 zB(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PB(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function BB(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),r=Ml(i.toLowerCase()),o=e.footnoteOrder.indexOf(i);let a,u=e.footnoteCounts.get(i);u===void 0?(u=0,e.footnoteOrder.push(i),a=e.footnoteOrder.length):a=o+1,u+=1,e.footnoteCounts.set(i,u);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(u>1?"-"+u:""),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 $B(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 HB(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function PN(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 FB(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return PN(e,t);const r={src:Ml(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 VB(e,t){const n={src:Ml(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 UB(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 GB(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return PN(e,t);const r={href:Ml(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 qB(e,t){const n={href:Ml(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 WB(e,t,n){const i=e.all(t),r=n?YB(n):BN(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 u=-1;for(;++u<i.length;){const h=i[u];(r||u!==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 YB(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=BN(n[i])}return t}function BN(e){const t=e.spread;return t??e.children.length>1}function XB(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 KB(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ZB(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function QB(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function JB(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)},u=nv(t.children[1]),d=yN(t.children[t.children.length-1]);u&&d&&(a.position={start:u,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 e9(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,u=a?a.length:t.children.length;let d=-1;const m=[];for(;++d<u;){const p=t.children[d],g={},y=a?a[d]:void 0;y&&(g.align=y);let v={type:"element",tagName:o,properties:g,children:[]};p&&(v.children=e.all(p),e.patch(p,v),v=e.applyData(p,v)),m.push(v)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,h),e.applyData(t,h)}function t9(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const gw=9,xw=32;function n9(e){const t=String(e),n=/\r?\n|\r/g;let i=n.exec(t),r=0;const o=[];for(;i;)o.push(yw(t.slice(r,i.index),r>0,!0),i[0]),r=i.index+i[0].length,i=n.exec(t);return o.push(yw(t.slice(r),r>0,!1)),o.join("")}function yw(e,t,n){let i=0,r=e.length;if(t){let o=e.codePointAt(i);for(;o===gw||o===xw;)i++,o=e.codePointAt(i)}if(n){let o=e.codePointAt(r-1);for(;o===gw||o===xw;)r--,o=e.codePointAt(r-1)}return r>i?e.slice(i,r):""}function i9(e,t){const n={type:"text",value:n9(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function r9(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const s9={blockquote:DB,break:OB,code:LB,delete:zB,emphasis:PB,footnoteReference:BB,heading:$B,html:HB,imageReference:FB,image:VB,inlineCode:UB,linkReference:GB,link:qB,listItem:WB,list:XB,paragraph:KB,root:ZB,strong:QB,table:JB,tableCell:t9,tableRow:e9,text:i9,thematicBreak:r9,toml:ef,yaml:ef,definition:ef,footnoteDefinition:ef};function ef(){}const $N=-1,$m=0,tu=1,nm=2,cv=3,uv=4,dv=5,fv=6,HN=7,FN=8,vw=typeof self=="object"?self:globalThis,o9=(e,t)=>{const n=(r,o)=>(e.set(o,r),r),i=r=>{if(e.has(r))return e.get(r);const[o,a]=t[r];switch(o){case $m:case $N:return n(a,r);case tu:{const u=n([],r);for(const d of a)u.push(i(d));return u}case nm:{const u=n({},r);for(const[d,m]of a)u[i(d)]=i(m);return u}case cv:return n(new Date(a),r);case uv:{const{source:u,flags:d}=a;return n(new RegExp(u,d),r)}case dv:{const u=n(new Map,r);for(const[d,m]of a)u.set(i(d),i(m));return u}case fv:{const u=n(new Set,r);for(const d of a)u.add(i(d));return u}case HN:{const{name:u,message:d}=a;return n(new vw[u](d),r)}case FN: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:u}=new Uint8Array(a);return n(new DataView(u),a)}}return n(new vw[o](a),r)};return i},bw=e=>o9(new Map,e)(0),Wa="",{toString:a9}={},{keys:l9}=Object,zc=e=>{const t=typeof e;if(t!=="object"||!e)return[$m,t];const n=a9.call(e).slice(8,-1);switch(n){case"Array":return[tu,Wa];case"Object":return[nm,Wa];case"Date":return[cv,Wa];case"RegExp":return[uv,Wa];case"Map":return[dv,Wa];case"Set":return[fv,Wa];case"DataView":return[tu,n]}return n.includes("Array")?[tu,n]:n.includes("Error")?[HN,n]:[nm,n]},tf=([e,t])=>e===$m&&(t==="function"||t==="symbol"),c9=(e,t,n,i)=>{const r=(a,u)=>{const d=i.push(a)-1;return n.set(u,d),d},o=a=>{if(n.has(a))return n.get(a);let[u,d]=zc(a);switch(u){case $m:{let h=a;switch(d){case"bigint":u=FN,h=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);h=null;break;case"undefined":return r([$N],a)}return r([u,h],a)}case tu:{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(u,!0)},{type:"text",value:`
`}]}}const Hm=(function(e){if(e==null)return g9;if(typeof e=="function")return Fm(e);if(typeof e=="object")return Array.isArray(e)?m9(e):p9(e);if(typeof e=="string")return h9(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]=Hm(e[n]);return Fm(i);function i(...r){let o=-1;for(;++o<t.length;)if(t[o].apply(this,r))return!0;return!1}}function p9(e){const t=e;return Fm(n);function n(i){const r=i;let o;for(o in e)if(r[o]!==t[o])return!1;return!0}}function h9(e){return Fm(t);function t(n){return n&&n.type===e}}function Fm(e){return t;function t(n,i,r){return!!(x9(n)&&e.call(this,n,typeof i=="number"?i:void 0,r||void 0))}}function g9(){return!0}function x9(e){return e!==null&&typeof e=="object"&&"type"in e}const VN=[],y9=!0,Gy=!1,v9="skip";function UN(e,t,n,i){let r;typeof t=="function"&&typeof n!="function"?(i=n,n=t):r=t;const o=Hm(r),a=i?-1:1;u(e,void 0,[])();function u(d,m,h){const p=d&&typeof d=="object"?d:{};if(typeof p.type=="string"){const y=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(d.type+(y?"<"+y+">":""))+")"})}return g;function g(){let y=VN,v,k,S;if((!t||o(d,m,h[h.length-1]||void 0))&&(y=b9(n(d,h)),y[0]===Gy))return y;if("children"in d&&d.children){const _=d;if(_.children&&y[0]!==v9)for(k=(i?_.children.length:-1)+a,S=h.concat(_);k>-1&&k<_.children.length;){const w=_.children[k];if(v=u(w,k,S)(),v[0]===Gy)return v;k=typeof v[1]=="number"?v[1]:k+a}}return y}}}function b9(e){return Array.isArray(e)?e:typeof e=="number"?[y9,e]:e==null?VN:[e]}function mv(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),UN(e,o,u,r);function u(d,m){const h=m[m.length-1],p=h?h.children.indexOf(d):void 0;return a(d,p,h)}}const qy={}.hasOwnProperty,_9={};function k9(e,t){const n=t||_9,i=new Map,r=new Map,o=new Map,a={...s9,...n.handlers},u={all:m,applyData:w9,definitionById:i,footnoteById:r,footnoteCounts:o,footnoteOrder:[],handlers:a,one:d,options:n,patch:S9,wrap:j9};return mv(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)}}),u;function d(h,p){const g=h.type,y=u.handlers[g];if(qy.call(u.handlers,g)&&y)return y(u,h,p);if(u.options.passThrough&&u.options.passThrough.includes(g)){if("children"in h){const{children:k,...S}=h,_=im(S);return _.children=u.all(h),_}return im(h)}return(u.options.unknownHandler||C9)(u,h,p)}function m(h){const p=[];if("children"in h){const g=h.children;let y=-1;for(;++y<g.length;){const v=u.one(g[y],h);if(v){if(y&&g[y-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=kw(v.value)),!Array.isArray(v)&&v.type==="element")){const k=v.children[0];k&&k.type==="text"&&(k.value=kw(k.value))}Array.isArray(v)?p.push(...v):p.push(v)}}}return p}}function S9(e,t){e.position&&(t.position=dz(e))}function w9(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,im(o)),"children"in n&&n.children&&r!==null&&r!==void 0&&(n.children=r)}return n}function C9(e,t){const n=t.data||{},i="value"in t&&!(qy.call(n,"hProperties")||qy.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 j9(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 kw(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Sw(e,t){const n=k9(e,t),i=n.one(e,void 0),r=f9(n),o=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return r&&o.children.push({type:"text",value:`
`},r),o}function E9(e,t){return e&&"run"in e?async function(n,i){const r=Sw(n,{file:i,...t});await e.run(r,i)}:function(n,i){return Sw(n,{file:i,...e||t})}}function ww(e){if(e)throw e}var Pg,Cw;function N9(){if(Cw)return Pg;Cw=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},u=function(m,h){if(h==="__proto__")if(e.call(m,h)){if(i)return i(m,h).value}else return;return m[h]};return Pg=function d(){var m,h,p,g,y,v,k=arguments[0],S=1,_=arguments.length,w=!1;for(typeof k=="boolean"&&(w=k,k=arguments[1]||{},S=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});S<_;++S)if(m=arguments[S],m!=null)for(h in m)p=u(k,h),g=u(m,h),k!==g&&(w&&g&&(o(g)||(y=r(g)))?(y?(y=!1,v=p&&r(p)?p:[]):v=p&&o(p)?p:{},a(k,{name:h,newValue:d(w,v,g)})):typeof g<"u"&&a(k,{name:h,newValue:g}));return k},Pg}var I9=N9();const Bg=ta(I9);function Wy(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 T9(){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);u(null,...r);function u(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?R9(h,u)(...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 R9(e,t){let n;return i;function i(...a){const u=e.length>a.length;let d;u&&a.push(r);try{d=e.apply(this,a)}catch(m){const h=m;if(u&&n)throw h;return r(h)}u||(d&&d.then&&typeof d.then=="function"?d.then(o,r):d instanceof Error?r(d):o(d))}function r(a,...u){n||(n=!0,t(a,...u))}function o(a){r(null,a)}}const Vr={basename:A9,dirname:M9,extname:D9,join:O9,sep:"/"};function A9(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Mu(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,u=t.length-1;for(;r--;)if(e.codePointAt(r)===47){if(o){n=r+1;break}}else a<0&&(o=!0,a=r+1),u>-1&&(e.codePointAt(r)===t.codePointAt(u--)?u<0&&(i=r):(u=-1,i=a));return n===i?i=a:i<0&&(i=e.length),e.slice(n,i)}function M9(e){if(Mu(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 D9(e){Mu(e);let t=e.length,n=-1,i=0,r=-1,o=0,a;for(;t--;){const u=e.codePointAt(t);if(u===47){if(a){i=t+1;break}continue}n<0&&(a=!0,n=t+1),u===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 O9(...e){let t=-1,n;for(;++t<e.length;)Mu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":L9(n)}function L9(e){Mu(e);const t=e.codePointAt(0)===47;let n=z9(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function z9(e,t){let n="",i=0,r=-1,o=0,a=-1,u,d;for(;++a<=e.length;){if(a<e.length)u=e.codePointAt(a);else{if(u===47)break;u=47}if(u===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 u===46&&o>-1?o++:o=-1}return n}function Mu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const P9={cwd:B9};function B9(){return"/"}function Yy(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function $9(e){if(typeof e=="string")e=new URL(e);else if(!Yy(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 H9(e)}function H9(e){if(e.hostname!==""){consLine truncated
`:" ")+o.indentLines(o.containerFlow(i,u.current()),t?YN:R$))),m(),d}}function R$(e,t,n){return t===0?e:YN(e,t,n)}function YN(e,t,n){return(n?"":" ")+e}const A$=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];XN.peek=z$;function M$(){return{canContainEols:["delete"],enter:{strikethrough:O$},exit:{strikethrough:L$}}}function D$(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:A$}],handlers:{delete:XN}}}function O$(e){this.enter({type:"delete",children:[]},e)}function L$(e){this.exit(e)}function XN(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 z$(){return"~"}function P$(e){return e.length}function B$(e,t){const n=t||{},i=(n.align||[]).concat(),r=n.stringLength||P$,o=[],a=[],u=[],d=[];let m=0,h=-1;for(;++h<e.length;){const k=[],S=[];let _=-1;for(e[h].length>m&&(m=e[h].length);++_<e[h].length;){const w=$$(e[h][_]);if(n.alignDelimiters!==!1){const C=r(w);S[_]=C,(d[_]===void 0||C>d[_])&&(d[_]=C)}k.push(w)}a[h]=k,u[h]=S}let p=-1;if(typeof i=="object"&&"length"in i)for(;++p<m;)o[p]=Aw(i[p]);else{const k=Aw(i);for(;++p<m;)o[p]=k}p=-1;const g=[],y=[];for(;++p<m;){const k=o[p];let S="",_="";k===99?(S=":",_=":"):k===108?S=":":k===114&&(_=":");let w=n.alignDelimiters===!1?1:Math.max(1,d[p]-S.length-_.length);const C=S+"-".repeat(w)+_;n.alignDelimiters!==!1&&(w=S.length+w+_.length,w>d[p]&&(d[p]=w),y[p]=w),g[p]=C}a.splice(1,0,g),u.splice(1,0,y),h=-1;const v=[];for(;++h<a.length;){const k=a[h],S=u[h];p=-1;const _=[];for(;++p<m;){const w=k[p]||"";let C="",N="";if(n.alignDelimiters!==!1){const O=d[p]-(S[p]||0),I=o[p];I===114?C=" ".repeat(O):I===99?O%2?(C=" ".repeat(O/2+.5),N=" ".repeat(O/2-.5)):(C=" ".repeat(O/2),N=C):N=" ".repeat(O)}n.delimiterStart!==!1&&!p&&_.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&w==="")&&(n.delimiterStart!==!1||p)&&_.push(" "),n.alignDelimiters!==!1&&_.push(C),_.push(w),n.alignDelimiters!==!1&&_.push(N),n.padding!==!1&&_.push(" "),(n.delimiterEnd!==!1||p!==m-1)&&_.push("|")}v.push(n.delimiterEnd===!1?_.join("").replace(/ +$/,""):_.join(""))}return v.join(`
`)}function $$(e){return e==null?"":String(e)}function Aw(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 H$(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()),F$);return r(),a}function F$(e,t,n){return">"+(n?"":" ")+e}function V$(e,t){return Mw(e,t.inConstruct,!0)&&!Mw(e,t.notInConstruct,!1)}function Mw(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 Dw(e,t,n,i){let r=-1;for(;++r<n.unsafe.length;)if(n.unsafe[r].character===`
`&&V$(n.stack,n.unsafe[r]))return/[ \t]/.test(i.before)?"":" ";return`\\
`}function U$(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 G$(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 q$(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 W$(e,t,n,i){const r=q$(n),o=e.value||"",a=r==="`"?"GraveAccent":"Tilde";if(G$(e,n)){const p=n.enter("codeIndented"),g=n.indentLines(o,Y$);return p(),g}const u=n.createTracker(i),d=r.repeat(Math.max(U$(o,r)+1,3)),m=n.enter("codeFenced");let h=u.move(d);if(e.lang){const p=n.enter(`codeFencedLang${a}`);h+=u.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...u.current()})),p()}if(e.lang&&e.meta){const p=n.enter(`codeFencedMeta${a}`);h+=u.move(" "),h+=u.move(n.safe(e.meta,{before:h,after:`
`,encode:["`"],...u.current()})),p()}return h+=u.move(`
`),o&&(h+=u.move(o+`
`)),h+=u.move(d),m(),h}function Y$(e,t,n){return(n?"":" ")+e}function hv(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 X$(e,t,n,i){const r=hv(n),o=r==='"'?"Quote":"Apostrophe",a=n.enter("definition");let u=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("]: "),u(),!e.url||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(n.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(u=n.enter("destinationRaw"),m+=d.move(n.safe(e.url,{before:m,after:e.title?" ":`
`,...d.current()}))),u(),e.title&&(u=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),u()),a(),m}function K$(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 yu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function rm(e,t,n){const i=yl(e),r=yl(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}}KN.peek=Z$;function KN(e,t,n,i){const r=K$(n),o=n.enter("emphasis"),a=n.createTracker(i),u=a.move(r);let d=a.move(n.containerPhrasing(e,{after:r,before:u,...a.current()}));const m=d.charCodeAt(0),h=rm(i.before.charCodeAt(i.before.length-1),m,r);h.inside&&(d=yu(m)+d.slice(1));const p=d.charCodeAt(d.length-1),g=rm(i.after.charCodeAt(0),p,r);g.inside&&(d=d.slice(0,-1)+yu(p));const y=a.move(r);return o(),n.attentionEncodeSurroundingInfo={after:g.outside,before:h.outside},u+d+y}function Z$(e,t,n){return n.options.emphasis||"*"}function Q$(e,t){let n=!1;return mv(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,Gy}),!!((!e.depth||e.depth<3)&&ov(e)&&(t.options.setext||n))}function J$(e,t,n,i){const r=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(i);if(Q$(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),u=n.enter("headingAtx"),d=n.enter("phrasing");o.move(a+" ");let m=n.containerPhrasing(e,{before:"# ",after:`
`,...o.current()});return/^[\t ]/.test(m)&&(m=yu(m.charCodeAt(0))+m.slice(1)),m=m?a+" "+m:a,n.options.closeAtx&&(m+=" "+a),d(),u(),m}ZN.peek=e7;function ZN(e){return e.value||""}function e7(){return"<"}QN.peek=t7;function QN(e,t,n,i){const r=hv(n),o=r==='"'?"Quote":"Apostrophe",a=n.enter("image");let u=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("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(n.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(u=n.enter("destinationRaw"),m+=d.move(n.safe(e.url,{before:m,after:e.title?" ":")",...d.current()}))),u(),e.title&&(u=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),u()),m+=d.move(")"),a(),m}function t7(){return"!"}JN.peek=n7;function JN(e,t,n,i){const r=e.referenceType,o=n.enter("imageReference");let a=n.enter("label");const u=n.createTracker(i);let d=u.move("![");const m=n.safe(e.alt,{before:d,after:"]",...u.current()});d+=u.move(m+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const p=n.safe(n.associationId(e),{before:d,after:"]",...u.current()});return a(),n.stack=h,o(),r==="full"||!m||m!==p?d+=u.move(p+"]"):r==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function n7(){return"!"}eI.peek=i7;function eI(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],u=n.compilePattern(a);let d;if(a.atBreak)for(;d=u.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 i7(){return"`"}function tI(e,t){const n=ov(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}nI.peek=r7;function nI(e,t,n,i){const r=hv(n),o=r==='"'?"Quote":"Apostrophe",a=n.createTracker(i);let u,d;if(tI(e,n)){const h=n.stack;n.stack=[],u=n.enter("autolink");let p=a.move("<");return p+=a.move(n.containerPhrasing(e,{before:p,after:">",...a.current()})),p+=a.move(">"),u(),n.stack=h,p}u=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(")"),u(),m}function r7(e,t,n){return tI(e,n)?"<":"["}iI.peek=s7;function iI(e,t,n,i){const r=e.referenceType,o=n.enter("linkReference");let a=n.enter("label");const u=n.createTracker(i);let d=u.move("[");const m=n.containerPhrasing(e,{before:d,after:"]",...u.current()});d+=u.move(m+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const p=n.safe(n.associationId(e),{before:d,after:"]",...u.current()});return a(),n.stack=h,o(),r==="full"||!m||m!==p?d+=u.move(p+"]"):r==="shortcut"?d=d.slice(0,-1):d+=u.move("]"),d}function s7(){return"["}function gv(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function o7(e){const t=gv(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 a7(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 rI(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 l7(e,t,n,i){const r=n.enter("list"),o=n.bulletCurrent;let a=e.ordered?a7(n):gv(n);const u=e.ordered?a==="."?")":".":o7(n);let d=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(d=!0),rI(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:u}};function a(y,v,k,S){return m(h(y,k,S),y.align)}function u(y,v,k,S){const _=p(y,k,S),w=m([_]);return w.slice(0,w.indexOf(`
`))}function d(y,v,k,S){const _=k.enter("tableCell"),w=k.enter("phrasing"),C=k.containerPhrasing(y,{...S,before:o,after:o});return w(),_(),C}function m(y,v){return B$(y,{align:v,alignDelimiters:i,padding:n,stringLength:r})}function h(y,v,k){const S=y.children;let _=-1;const w=[],C=v.enter("table");for(;++_<S.length;)w[_]=p(S[_],v,k);return C(),w}function p(y,v,k){const S=y.children;let _=-1;const w=[],C=v.enter("tableRow");for(;++_<S.length;)w[_]=d(S[_],y,v,k);return C(),w}function g(y,v,k){let S=oI.inlineCode(y,v,k);return k.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function j7(){return{exit:{taskListCheckValueChecked:Lw,taskListCheckValueUnchecked:Lw,paragraph:N7}}}function E7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:I7}}}function Lw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function N7(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 u=r[o];if(u.type==="paragraph"){a=u;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 I7(e,t,n,i){const r=e.children[0],o=typeof e.checked=="boolean"&&r&&r.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",u=n.createTracker(i);o&&u.move(a);let d=oI.listItem(e,t,n,{...i,...u.current()});return o&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),d;function m(h){return h+a}}function T7(){return[l$(),I$(),M$(),v7(),j7()]}function R7(e){return{extensions:[c$(),T$(e),D$(),C7(e),E7()]}}const A7={tokenize:P7,partial:!0},aI={tokenize:B7,partial:!0},lI={tokenize:$7,partial:!0},cI={tokenize:H7,partial:!0},M7={tokenize:F7,partial:!0},uI={name:"wwwAutolink",tokenize:L7,previous:fI},dI={name:"protocolAutolink",tokenize:z7,previous:mI},Is={name:"emailAutolink",tokenize:O7,previous:pI},es={};function D7(){return{text:es}}let zo=48;for(;zo<123;)es[zo]=Is,zo++,zo===58?zo=65:zo===91&&(zo=97);es[43]=Is;es[45]=Is;es[46]=Is;es[95]=Is;es[72]=[Is,dI];es[104]=[Is,dI];es[87]=[Is,uI];es[119]=[Is,uI];function O7(e,t,n){const i=this;let r,o;return a;function a(p){return!Xy(p)||!pI.call(i,i.previous)||xv(i.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(p))}function u(p){return Xy(p)?(e.consume(p),u):p===64?(e.consume(p),d):n(p)}function d(p){return p===46?e.check(M7,h,m)(p):p===45||p===95||vi(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&&Ei(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function L7(e,t,n){const i=this;return r;function r(a){return a!==87&&a!==119||!fI.call(i,i.previous)||xv(i.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(A7,e.attempt(aI,e.attempt(lI,o),n),n)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function z7(e,t,n){const i=this;let r="",o=!1;return a;function a(p){return(p===72||p===104)&&mI.call(i,i.previous)&&!xv(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),r+=String.fromCodePoint(p),e.consume(p),u):n(p)}function u(p){if(Ei(p)&&r.length<5)return r+=String.fromCodePoint(p),e.consume(p),u;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||tm(p)||pn(p)||Yo(p)||Pm(p)?n(p):e.attempt(aI,e.attempt(lI,h),n)(p)}function h(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function P7(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 B7(e,t,n){let i,r,o;return a;function a(m){return m===46||m===95?e.check(cI,d,u)(m):m===null||pn(m)||Yo(m)||m!==45&&Pm(m)?d(m):(o=!0,e.consume(m),a)}function u(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 $7(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(cI,t,o)(a):a===null||pn(a)||Yo(a)?t(a):(e.consume(a),r)}function o(a){return a===41&&i++,e.consume(a),r}}function H7(e,t,n){return i;function i(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),i):u===38?(e.consume(u),o):u===93?(e.consume(u),r):u===60||u===null||pn(u)||Yo(u)?t(u):n(u)}function r(u){return u===null||u===40||u===91||pn(u)||Yo(u)?t(u):i(u)}function o(u){return Ei(u)?a(u):n(u)}function a(u){re Line truncated
`),m=d.length>fH,h=m?d.length-Kg*2:0,p=E.useCallback(()=>{navigator.clipboard.writeText(a),i(!0),setTimeout(()=>i(!1),1500)},[a]);return c.jsxs("div",{className:"code-block-wrap",children:[c.jsxs("div",{className:"code-block-header",children:[c.jsxs("span",{className:"code-block-lang",children:[u||"code",m?` (${d.length} lines)`:""]}),c.jsx("button",{className:"code-block-copy",onClick:p,children:n?c.jsxs(c.Fragment,{children:[c.jsx(Nl,{})," ",c.jsx("span",{children:"Copied"})]}):c.jsxs(c.Fragment,{children:[c.jsx(Cm,{})," ",c.jsx("span",{children:"Copy"})]})})]}),c.jsx("pre",{children:c.jsx("code",{className:e,children:m&&!r?c.jsxs(c.Fragment,{children:[d.slice(0,Kg).join(`
`)+`
`,c.jsxs("span",{className:"code-block-omitted",onClick:()=>o(!0),children:["... +",h," lines (click to expand)"]}),`
`+d.slice(-Kg).join(`
`)]}):a})}),m&&r&&c.jsxs("button",{className:"code-block-collapse-btn",onClick:()=>o(!1),children:["Collapse (",d.length," lines)"]})]})}const pH={code({className:e,children:t,...n}){return e?.startsWith("language-")?c.jsx(mH,{className:e,children:t}):c.jsx("code",{className:e,...n,children:t})}},hH=3e3,gH=60,Zg=800;function Pw(e){if(e.length>hH)return!0;let t=0;for(let n=0;n<e.length;n++)if(e[n]===`
`&&++t>=gH)return!0;return!1}function xH(e){const t=e.lastIndexOf(`
`,Zg);return e.slice(0,t>Zg/2?t:Zg)}const ti=St.memo(function({content:t,className:n="msg-content-agent",collapseMode:i="auto"}){const r=i!=="never"&&Pw(t),[o,a]=E.useState(r);E.useEffect(()=>{a(i!=="never"&&Pw(t))},[i,t]);const u=o?xH(t):t,d=t.split(`
`).length,m=t.length;return c.jsxs("div",{className:n,children:[c.jsx(Q9,{remarkPlugins:[dH],components:pH,children:u}),r&&o&&c.jsxs("button",{className:"msg-collapse-toggle",onClick:()=>a(!1),children:["Show more (",d," lines, ",(m/1e3).toFixed(1),"k chars)"]}),r&&!o&&c.jsx("button",{className:"msg-collapse-toggle",onClick:()=>a(!0),children:"Show less"})]})}),Bw={native:"OpenOPC Native",codex:"Codex",claude_code:"Claude Code",cursor:"Cursor",opencode:"OpenCode"},vu="codex",Qg="native",yH=["codex","native","claude_code","cursor","opencode"],vH=["native","codex","claude_code","cursor","opencode"];function hI(e){if(!e)return{kind:"fallback"};if(e.kind==="employee"){const t=String(e.id??e.employee_id??"").trim();return t?{kind:"employee",id:t}:{kind:"fallback"}}if(e.kind==="template"){const t=String(e.id??e.template_id??"").trim();return t?{kind:"template",id:t}:{kind:"fallback"}}return{kind:"fallback"}}function gI(e){const t=hI(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)),u=t.map(m=>{const h=String(m.employee_id??"").trim(),p=String(m.employee_name??h).trim()||h,g=String(m.role_id??"").trim(),y=String(m.category??"").trim(),v=[g,y].filter(Boolean).join(" · ")||h;return{kind:"employee",id:h,name:p,subtitle:v,category:y,searchText:`${h} ${p} ${g} ${y} ${(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(),y=[g,h].filter(Boolean).join(" · ")||h,v=`${h} ${p} ${g} ${(m.domains??[]).join(" ")} ${(m.tags??[]).join(" ")}`.toLowerCase(),k=o.split(/[^a-z0-9]+/).filter(S=>S.length>=3).reduce((S,_)=>S+(v.includes(_)?1:0),0);return{kind:"template",id:h,name:p,subtitle:y,category:g,searchText:v,rank:k}}).filter(m=>m.id).sort((m,h)=>h.rank-m.rank||m.name.localeCompare(h.name));return[...u,...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=gI(t);return e.find(i=>`${i.kind}:${i.id}`===n)??e[0]}function kH(e,t){const n=t.toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?!0:n.every(i=>e.searchText.includes(i))}function SH(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??vu,selected_agent:t.selected_agent??t.default_agent??vu,default_source:"recruitment"}}).filter(t=>t.role_id)}function wH(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 $w(e,t){const n={},i=e.staffing_selections??{};for(const r of t){const o=String(r.role_id??"").trim();o&&(n[o]=hI(i[o]??r.default_selection))}return n}function Hw(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??vu)}return i}function CH(e){return!!(String(e.checkpoint_response_message_id??"").trim()||String(e.checkpoint_responded_at??"").trim()||String(e.checkpoint_reply_kind??"").trim())}const xI=St.memo(function({meta:t,onReply:n,responded:i}){const r=t.proposals??[],o=E.useMemo(()=>{const L={};for(const A of r){const M=String(A.role_id??"").trim();M&&(L[M]=A)}return L},[r]),a=E.useMemo(()=>t.staffing_roles?.length?t.staffing_roles:SH(r),[t.staffing_roles,r]),u=t.staffing_pool?.employees??[],d=t.staffing_pool?.templates??[],m=t.recruitment_rationales??[],h=E.useMemo(()=>{const L={};for(const A of a){const M=String(A.role_id??"").trim();M&&(L[M]=bH(A,u,d))}return L},[u,a,d]),[p,g]=E.useState({}),[y,v]=E.useState(""),[k,S]=E.useState(()=>$w(t,a)),[_,w]=E.useState(()=>Hw(t,a)),[C,N]=E.useState(t.recruitment_agent??Qg),O=i;E.useEffect(()=>{!O||!CH(t)||(S($w(t,a)),w(Hw(t,a)),N(t.recruitment_agent??Qg))},[O,t,a]),E.useEffect(()=>{N(t.recruitment_agent??Qg)},[t.recruitment_agent]);const I=E.useCallback(L=>{const A=String(t.checkpoint_id??"").trim();if(!A)throw new Error("Recruitment checkpoint reply requires checkpoint_id metadata.");const M=String(t.checkpoint_type??"").trim();return{response_to_checkpoint_id:A,response_to_checkpoint_type:M||"company_recruitment_confirmation",checkpoint_reply_kind:L,staffin Line truncated
`).map(t=>t.trim()).find(Boolean)??e}function OH(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 sm=St.memo(function({meta:t,onReply:n,responded:i}){const r=i,o=String(t.checkpoint_status??"").trim().toLowerCase(),a=OH(o),u=String(t.prompt??t.summary??""),d=E.useMemo(()=>u.split(`
`).map(O=>O.trim()).filter(Boolean),[u]),m=DH(u).replace(/^\[[^\]]+\]\s*/,"")||"Action Required",h=d.slice(1).join(`
`).trim(),p=String(t.summary??"").trim(),g=(t.options??[]).filter(O=>!!O?.id),y=E.useMemo(()=>(t.active_subagents??[]).filter(O=>!!O&&typeof O=="object"),[t.active_subagents]),v=E.useMemo(()=>(t.permission_requests??[]).filter(O=>!!O&&typeof O=="object"),[t.permission_requests]),k=String(t.worktree_path??"").trim(),S=y.length>0||v.length>0||!!k,[_,w]=E.useState(""),C=!!_&&!r;E.useEffect(()=>{if(!C)return;const O=window.setTimeout(()=>w(""),MH);return()=>window.clearTimeout(O)},[C,_]);const N=E.useCallback(O=>{r||C||(w(O.id),n(O.label||O.id))},[r,C,n]);return c.jsxs("div",{className:"ckpt-panel ckpt-escalation",children:[c.jsxs("div",{className:"ckpt-header",children:[c.jsx("div",{className:"ckpt-icon ckpt-icon-escalation",children:c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("path",{d:"M8 1.5L14.5 13H1.5L8 1.5Z"}),c.jsx("path",{d:"M8 5.5V9"}),c.jsx("circle",{cx:"8",cy:"11.5",r:"0.75",fill:"currentColor",stroke:"none"})]})}),c.jsx("div",{className:"ckpt-title",children:m}),c.jsx("span",{className:"ckpt-badge ckpt-badge-scope",children:String(t.escalation_type??"decision_needed").replace(/_/g," ")}),r&&c.jsx("span",{className:"ckpt-badge ckpt-badge-responded",children:a})]}),p&&p!==m&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Summary"}),c.jsx(ti,{content:p,className:"ckpt-markdown"})]}),h&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Request"}),c.jsx(ti,{content:h,className:"ckpt-markdown"})]}),S&&c.jsxs("details",{className:"ckpt-runtime-details",children:[c.jsx("summary",{children:"Runtime State"}),c.jsxs("div",{className:"ckpt-runtime-body",children:[k&&c.jsxs("div",{children:["Worktree: ",c.jsx("code",{children:k})]}),y.length>0&&c.jsxs("div",{children:["Active subagents: ",y.length]}),v.length>0&&c.jsxs("div",{children:["Pending permission records: ",v.length]})]})]}),!r&&g.length>0&&c.jsx("div",{className:"ckpt-actions ckpt-escalation-actions",children:g.map(O=>c.jsx("button",{className:`ckpt-btn ${O.id.includes("deny")?"ckpt-btn-deny":"ckpt-btn-approve"}${C?" ckpt-btn-submitting":""}`,onClick:()=>N(O),disabled:C,children:C&&_===O.id?"Submitting…":O.label||O.id},O.id))}),C&&c.jsx("div",{className:"ckpt-escalation-hint",children:"Decision sent — waiting for server confirmation…"}),!r&&t.default_action&&c.jsxs("div",{className:"ckpt-escalation-hint",children:["Default on timeout: ",c.jsx("code",{children:t.default_action})]})]})});function LH(e){return e.split(`
`).map(t=>t.trim()).find(Boolean)??e}function zH(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 kI=St.memo(function({meta:t,onReply:n,responded:i}){const r=i,[o,a]=E.useState(""),[u,d]=E.useState(null),m=String(t.checkpoint_status??"").trim().toLowerCase(),h=zH(m),p=String(t.prompt??t.summary??"").trim(),y=`${String(t.work_item_projection_title??LH(p)??"Human Review").trim()||"Human Review"} (for self-evolution)`,v=String(t.summary??"").trim(),k=E.useMemo(()=>(t.active_subagents??[]).filter(T=>!!T&&typeof T=="object"),[t.active_subagents]),S=E.useMemo(()=>(t.permission_requests??[]).filter(T=>!!T&&typeof T=="object"),[t.permission_requests]),_=String(t.worktree_path??"").trim(),w=k.length>0||S.length>0||!!_,C=r||u!==null,N=E.useCallback((T,L="")=>{const A=String(t.checkpoint_id??"").trim();if(!A)throw new Error("Delivery self-evolution reply requires checkpoint_id metadata.");const M={response_to_checkpoint_id:A,response_to_checkpoint_type:"company_delivery_feedback",checkpoint_reply_kind:T};return(T==="approve"||T==="feedback")&&(M.self_evolution_trigger=!0,M.human_feedback_text=L),M},[t.checkpoint_id]),O=E.useCallback(()=>{if(C)return;const T=N("approve");d("approve"),n("I fully agree with this delivery.",T)},[C,N,n]),I=E.useCallback(()=>{const T=o.trim();if(C||!T)return;const L=N("feedback",T);d("feedback"),n(T,L),a("")},[C,N,o,n]),D=E.useCallback(()=>{if(C)return;const T=N("ignore");d("ignore"),n("Ignore this self-evolution review.",T)},[C,N,n]);return c.jsxs("div",{className:"ckpt-panel ckpt-delivery-feedback",children:[c.jsxs("div",{className:"ckpt-header",children:[c.jsx("div",{className:"ckpt-icon ckpt-icon-user-input",children:c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.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"}),c.jsx("path",{d:"M5.5 8.25L7.25 10l3.25-4"})]})}),c.jsx("div",{className:"ckpt-title",children:y}),c.jsx("span",{className:"ckpt-badge ckpt-badge-scope",children:String(t.feedback_scope??"final").replace(/_/g," ")}),r&&c.jsx("span",{className:"ckpt-badge ckpt-badge-responded",children:h})]}),v&&v!==y&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Summary"}),c.jsx(ti,{content:v,className:"ckpt-markdown"})]}),p&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Review Request"}),c.jsx(ti,{content:p,className:"ckpt-markdown"})]}),w&&c.jsxs("details",{className:"ckpt-runtime-details",children:[c.jsx("summary",{children:"Runtime State"}),c.jsxs("div",{className:"ckpt-runtime-body",children:[_&&c.jsxs("div",{children:["Worktree: ",c.jsx("code",{children:_})]}),k.length>0&&c.jsxs("div",{children:["Active subagents: ",k.length]}),S.length>0&&c.jsxs("div",{children:["Pending permission records: ",S.length]})]})]}),!r&&c.jsxs("div",{className:"ckpt-actions ckpt-actions-inline-feedback",children:[c.jsx("button",{className:"ckpt-btn ckpt-btn-approve",onClick:O,disabled:C,children:"Fully Agree"}),c.jsx("button",{className:"ckpt-btn ckpt-btn-cancel",onClick:D,disabled:C,children:"Ignore"}),c.jsx("textarea",{className:"ckpt-feedback-input ckpt-feedback-inline-input",placeholder:"Feedback for self-evolution...",value:o,onChange:T=>a(T.target.value),disabled:C,rows:2}),c.jsx("button",{className:"ckpt-btn ckpt-btn-feedback",onClick:I,disabled:C||!o.trim(),children:"Send Feedback"})]})]})}),sf="__other__",PH=["A","B","C"];function Ur(e){return String(e??"").trim()}function BH(e,t){const n=Ur(e.question),i=Ur(e.header);if(!n&&!i)return null;const r=(e.options??[]).slice(0,3).map((o,a)=>({id:Ur(o.id)||String.fromCharCode(97+a),label:Ur(o.label),description:Ur(o.description)})).filter(o=>o.label);return{id:Ur(e.id)||`question_${t+1}`,header:i,question:n||i,options:r,allow_freeform:e.allow_freeform!==!1,required:e.required!==!1}}const SI=St.memo(function({meta:t,onReply:n,responded:i}){const[r,o]=E.useState(""),[a,u]=E.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(),y=String(t.resume_hint??"").trim(),v=E.useMemo(()=>(t.questions??[]).map(V=>String(V).trim()).filter(Boolean),[t.questions]),k=E.useMemo(()=>(t.input_questions??[]).map((V,Y)=>BH(V,Y)).filter(V=>V!==null),[t.input_questions]),S=k.some(V=>(V.options??[]).length>0),_=E.useMemo(()=>(t.required_fields??[]).map(V=>String(V).trim()).filter(Boolean),[t.required_fields]),w=E.useMemo(()=>(t.active_subagents??[]).filter(V=>!!V&&typeof V=="object"),[t.active_subagents]),C=E.useMemo(( Line truncated
`),{user_input_answers:V})},[a,B,k,d,n]);return c.jsxs("div",{className:"ckpt-panel ckpt-user-input",children:[c.jsxs("div",{className:"ckpt-header",children:[c.jsx("div",{className:"ckpt-icon ckpt-icon-user-input",children:c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("path",{d:"M3 3.5h10v6H6.5L3 13V3.5Z"}),c.jsx("path",{d:"M5.5 6h5"}),c.jsx("path",{d:"M5.5 8h3.5"})]})}),c.jsx("div",{className:"ckpt-title",children:m}),c.jsx("span",{className:"ckpt-badge ckpt-badge-scope",children:"awaiting input"}),d&&c.jsx("span",{className:"ckpt-badge ckpt-badge-responded",children:"Responded"})]}),h&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Summary"}),c.jsx(ti,{content:h,className:"ckpt-markdown"})]}),p&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Request"}),c.jsx(ti,{content:p,className:"ckpt-markdown"})]}),S?c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Questions"}),c.jsx("div",{className:"ckpt-choice-list",children:k.map(V=>{const Y=a[V.id]??{freeformText:""},Q=V.options??[],q=V.allow_freeform!==!1,G=q&&(Q.length===0||Y.selectedOptionId===sf);return c.jsxs("div",{className:"ckpt-choice-question",children:[V.header&&c.jsx("div",{className:"ckpt-question-header",children:V.header}),c.jsx(ti,{content:V.question,className:"ckpt-markdown"}),Q.length>0&&c.jsxs("div",{className:"ckpt-choice-grid",children:[Q.map((J,P)=>{const K=Y.selectedOptionId===J.id;return c.jsxs("button",{className:`ckpt-choice-option${K?" is-selected":""}`,onClick:()=>M(V.id,J.id),children:[c.jsx("span",{className:"ckpt-choice-letter",children:PH[P]??"?"}),c.jsxs("span",{className:"ckpt-choice-copy",children:[c.jsx("span",{className:"ckpt-choice-label",children:J.label}),J.description&&c.jsx("span",{className:"ckpt-choice-desc",children:J.description})]})]},J.id)}),q&&c.jsxs("button",{className:`ckpt-choice-option${Y.selectedOptionId===sf?" is-selected":""}`,onClick:()=>M(V.id,sf),children:[c.jsx("span",{className:"ckpt-choice-letter",children:"D"}),c.jsxs("span",{className:"ckpt-choice-copy",children:[c.jsx("span",{className:"ckpt-choice-label",children:"Other"}),c.jsx("span",{className:"ckpt-choice-desc",children:"Enter a custom answer"})]})]})]}),G&&c.jsx("textarea",{className:"ckpt-feedback-input ckpt-other-field",placeholder:"Type your answer...",value:Y.freeformText,onChange:J=>$(V.id,J.target.value),rows:3})]},V.id)})})]}):v.length>0&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Questions"}),c.jsx("ul",{className:"ckpt-task-list",children:v.map(V=>c.jsx("li",{children:V},V))})]}),_.length>0&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Required Fields"}),c.jsx("div",{className:"ckpt-task-tags",children:_.map(V=>c.jsx("span",{className:"ckpt-field-tag",children:V},V))})]}),g&&c.jsxs("div",{className:"ckpt-section",children:[c.jsx("div",{className:"ckpt-section-title",children:"Context"}),c.jsx(ti,{content:g,className:"ckpt-markdown ckpt-markdown-muted"})]}),y&&c.jsx("div",{className:"ckpt-escalation-hint",children:y}),A&&c.jsxs("details",{className:"ckpt-runtime-details",children:[c.jsx("summary",{children:"Runtime State"}),c.jsxs("div",{className:"ckpt-runtime-body",children:[O&&c.jsxs("div",{children:["Requester: ",c.jsx("code",{children:O})]}),D&&c.jsxs("div",{children:["Work item: ",c.jsx("code",{children:D})]}),I&&c.jsxs("div",{children:["Task: ",c.jsx("code",{children:I})]}),T&&c.jsxs("div",{children:["Seat: ",c.jsx("code",{children:T})]}),N&&c.jsxs("div",{children:["Worktree: ",c.jsx("code",{children:N})]}),w.length>0&&c.jsxs("div",{children:["Active subagents: ",w.length]}),C.length>0&&c.jsxs("div",{children:["Pending permission records: ",C.length]})]})]}),!d&&c.jsxs("div",{className:"ckpt-feedback-area",children:[S?null:c.jsx("textarea",{className:"ckpt-feedback-input",placeholder:"Reply with the missing input to continue...",value:r,onChange:V=>o(V.target.value),rows:3}),c.jsx("div",{className:"ckpt-feedback-btns",children:c.jsx("button",{className:"ckpt-btn ckpt-btn-approve",onClick:S?F:U,disabled:S?!B:!r.trim(),children:"Send Reply"})})]})]})}),Zy={todo:"To do",in_progress:"In progress",in_review:"In review",done:"Done"};function ex(e,t){if(t&&t in Zy)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 of(e){return Zy[e]??Zy.todo}const qw={active:0,waiting:1,failed:2,done:3,pending:4};function $H(e){if(e.length===0)return"pending";let t=e[0],n=qw[t]??99;for(const i of e){const r=qw[i]??99;r<n&&(t=i,n=r)}return t}const HH={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=nu(a[2]);return{kind:"company_event",label:d,summary:m,tone:/^Blocked$/i.test(a[1])?"warning":"info"}}const u=t.match(/^NO_DELEGATION_JUSTIFICATION:\s*(.+)$/i);return u?{kind:"company_event",label:"Delegation check",summary:nu(u[1]).slice(0,180),tone:"info"}:null}function xF(e,t){const{isCompanyRuntime:n,detailMode:i}=t;if(!n||i==="full"||lu(e.metadata))return null;const r=CI(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 yF(e,t={}){const{isCompanyRuntime:n=!1,detailMode:i="summary"}=t,r=[];let o=[],a=0;const u=new Set,d=new Set,m=()=>{if(o.length===0)return;const h=o[0].msg,p=o[o.length-1].msg;r.push({kind:"ops-bundle",id:`ops:${h.id}:${o.length}:${p.id}`,timestamp:h.timestamp,events:o,sortOrder:a}),o=[]};return e.forEach((h,p)=>{const g=p*2+1,y=xF(h,{isCompanyRuntime:n,detailMode:i});if(y){o.length===0&&(a=g),o.push(y);return}const v=i==="summary"?wI(h.content):null;if(v){const k=[h.sender,Math.round(h.timestamp/1e3),v.kind,nu(v.summary||v.acceptanceSummary||"").slice(0,500),v.verdict??"",v.deliverables.map(S=>`${S.name}:${S.path}`).join("|").slice(0,800)].join("");if(u.has(k))return;u.add(k)}if(i==="summary"){const k=nu(oF(h.content)).slice(0,1200);if(k){const S=aF(h)?["result",k].join(""):[h.sender,Math.round(h.timestamp/1e3),k].join("");if(d.has(S))return;d.add(S)}}m(),r.push({kind:"message",id:h.id,timestamp:h.timestamp,msg:h,sortOrder:g})}),m(),r}const vF=St.memo(function({msg:t,showDate:n,dateStr:i,classification:r}){const[o,a]=E.useState(!1),u=t.content.trim()!==`[${r.label}] ${r.summary}`.trim()&&t.content.trim().length>r.summary.length+4;return c.jsxs("div",{children:[n&&c.jsx("div",{className:"msg-date-sep",children:c.jsx("span",{children:i})}),c.jsxs("div",{className:`msg-ops-row msg-ops-tone-${r.tone}${o?" expanded":""}`,onClick:u?()=>a(d=>!d):void 0,role:u?"button":void 0,tabIndex:u?0:-1,children:[c.jsx("span",{className:"msg-ops-dot","aria-hidden":"true"}),c.jsx("span",{className:"msg-ops-label",children:r.label}),r.summary&&c.jsx("span",{className:"msg-ops-summary",title:r.summary,children:r.summary}),c.jsx("span",{className:"msg-ops-time",title:Zr(t.timestamp),children:Es(t.timestamp)}),u&&c.jsx("span",{className:`msg-ops-chevron${o?" open":""}`,"aria-hidden":"true",children:c.jsx(Yr,{down:o})})]}),u&&o&&c.jsx("div",{className:"msg-ops-details",children:c.jsx("pre",{className:"msg-ops-details-pre",children:t.content})})]})}),bF=St.memo(function({events:t,showDate:n,dateStr:i}){const[r,o]=E.useState(!1);if(t.length===0)return null;const a=t[0].msg,u=t[t.length-1].msg,d=t.reduce((p,g)=>{const y=g.classification.kind==="company_event"?"company":g.classification.kind.startsWith("external")?"runtime":"delegation";return p[y]=(p[y]??0)+1,p},{}),m=Object.entries(d).map(([p,g])=>`${g} ${p}`).join(" · "),h=`${t.length} technical event${t.length===1?"":"s"} hidden`;return c.jsxs("div",{children:[n&&c.jsx("div",{className:"msg-date-sep",children:c.jsx("span",{children:i})}),c.jsxs("button",{type:"button",className:`msg-ops-bundle${r?" expanded":""}`,onClick:()=>o(p=>!p),title:`${Zr(a.timestamp)} - ${Zr(u.timestamp)}`,children:[c.jsx("span",{className:"msg-ops-bundle-dot"}),c.jsx("span",{className:"msg-ops-bundle-title",children:h}),c.jsx("span",{className:"msg-ops-bundle-summary",children:m}),c.jsx("span",{className:"msg-ops-bundle-time",children:Es(a.timestamp)}),c.jsx("span",{className:"msg-ops-bundle-chevron",children:c.jsx(Yr,{down:r})})]}),r&&c.jsx("div",{className:"msg-ops-bundle-details",children:t.map(({msg:p,classification:g})=>c.jsxs("div",{className:`msg-ops-bundle-event msg-ops-tone-${g.tone}`,children:[c.jsx("span",{className:"msg-ops-dot"}),c.jsx("span",{className:"msg-ops-label",children:g.label}),c.jsx("span",{className:"msg-ops-summary",children:g.summary}),c.jsx("span",{className:"msg-ops-time",title:Zr(p.timestamp),children:Es(p.timestamp)})]},p.id))})]})});function _F(e){return e.kind==="review"?`Review · ${e.verdict?e.verdict.replace(/_/g," "):"review"}`:e.kind==="report"?"Report":"Update"}const kF=St.memo(function({msg:t,payload:n,showDate:i,dateStr:r,isCopied:o,onCopy:a}){const u=yv(t.sender==="system"?t.senderName||"OPC":t.sender),d=t.senderDeleted?"[Deleted]":t.senderName,m=_F(n),h=n.summary||n.acceptanceSummary||m;return c.jsxs("div",{children:[i&&c.jsx("div",{className:"msg-date-sep",children:c.jsx("spa Line truncated
Set up at least one role before running a task.
Go to Org tab now?`)&&n?.(),!1;if(a.length>1&&!u)return confirm(`Your organization has multiple top-level roles but no final decider selected.
Choose one final decider in the Org tab before running a task.
Go to Org tab now?`)&&n?.(),!1;const d=[],m=new Set(i.map(y=>y.role_id));o.runtimeTeams.filter(y=>y.member_role_ids.some(v=>m.has(v))||y.manager_role_id&&m.has(y.manager_role_id)).length===0&&d.push("No runtime teams defined — the system will auto-generate from your roles");const p=new Set(r.map(y=>y.role_id)),g=i.filter(y=>!p.has(y.role_id));if(g.length>0){const y=g.map(v=>v.name).join(", ");d.push(`${g.length} role(s) have no employees: ${y}`)}return d.length>0?confirm(`Before running this task:
`+d.map(y=>"• "+y).join(`
`)+`
Run anyway?`):!0}function tV(e){if(!e)return!1;const t=zm(e);return!!(t.projectRun?.run_id||t.runtimeTeams.length>0||t.runtimeSeats.length>0)}function cC(e,t){const n=!!t?.childDetail;return e?n?"full":e.execMode==="company"||e.execMode==="org"||e.execMode==="custom"?"summary":"full":"summary"}function uC(e){return String(e?.originTaskId??e?.taskId??"").trim()||null}function nV({boardColor:e,title:t,onCommit:n}){const[i,r]=E.useState(!1),[o,a]=E.useState(t),u=E.useRef(null);E.useEffect(()=>{i||a(t)},[t,i]);const d=E.useCallback(()=>{const h=o.trim();h&&h!==t?n(h):a(t),r(!1)},[o,t,n]),m=E.useCallback(()=>{a(t),r(!0),setTimeout(()=>u.current?.select(),0)},[t]);return c.jsx("div",{className:"board-selector",children:c.jsx("div",{className:"board-tabs",children:c.jsxs("span",{className:"board-tab active board-tab-editable",style:{"--board-color":e},children:[c.jsx("span",{className:"board-tab-dot",style:{background:e}}),i?c.jsx("input",{ref:u,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))}}):c.jsx("span",{className:"board-tab-title",onClick:m,title:"Click to edit session title",children:t})]})})})}function iV({boardStore:e,agents:t,officeMap:n,execMode:i,companyProfile:r,taskPreferredAgent:o,chatStore:a,sessionStore:u,projectId:d,onRunTask:m,onCreateTask:h,onMoveTask:p,onCreateSession:g,onSessionSend:y,onSecretarySend:v,onDeleteSession:k,onTitleChange:S,onSessionConfigChange:_,onSessionTaskAgentChange:w,onContinueInNewChat:C,onSessionStop:N,onSessionResume:O,onSessionComplete:I,onLoadSessionDetail:D,onOpenExecutionPanel:T,onCollabSync:L,orgInfoData:A,onNavigateToOrg:M,recoveryStatus:$,onRecoveryResume:W,onRecoveryCancel:B,commsState:U,commsMessage:F,onCommsRefresh:V,onCommsReadMessage:Y,savedOrgsList:Q,activeSavedOrg:q,onSavedOrgsList:G,onSavedOrgLoad:J}){const{sessions:P,activeSessionId:K,activeSession:ee}=u,[te,ie]=E.useState("collapsed"),{width:oe,isResizing:fe,handleMouseDown:se}=QF({initialWidth:380,minWidth:300,maxWidth:600,onCollapse:()=>ie("collapsed")}),[_e,we]=E.useState("chat"),[Ce,Be]=E.useState(null),[Ve,Ye]=E.useState({kind:"activity"}),[ht,zt]=E.useState([]),[bt,Nt]=E.useState(!1),[me,ze]=E.useState({}),lt=E.useRef(D),tt=E.useRef({active:null,child:null}),qe=i==="company"||i==="org"||i==="custom",ce=`secretary:${d}`,ve=`activity:${d}`,Ae=E.useMemo(()=>Ce?P.find(de=>de.taskId===Ce)??null:null,[P,Ce]),$e=E.useMemo(()=>Ve.kind!=="task-detail"?null:e.tasks.find(de=>de.id===Ve.taskId)??null,[Ve,e.tasks]),He=E.useMemo(()=>{const de=Lm($e);return de?P.find(Se=>Se.taskId===de||Se.runtimeTaskId===de||Se.executionTurnId===de)??null:null},[P,$e]),Kt=E.useMemo(()=>He?a.getChannelMessages(He.channelId):[],[a.messages,a.getChannelMessages,He]),Yt=E.useMemo(()=>jf(ee,P),[P,ee]),be=E.useMemo(()=>$f(ee,P),[P,ee]),Re=E.useMemo(()=>Hf(ee,[...be,...Yt]),[ee,Yt,be]);E.useEffect(()=>{lt.current=D},[D]);const Ue=E.useCallback((de,Se,Fe="summary")=>{const ft=lt.current;!ft||!de||(ze(Gt=>Gt[de]?Gt:{...Gt,[de]:!0}),ft(de,{limit:JF,beforeCreatedAt:Se?.timestamp,beforeMessageId:Se?.id,detailLevel:Fe}),window.setTimeout(()=>{ze(Gt=>Gt[de]?{...Gt,[de]:!1}:Gt)},800))},[]),Xe=E.useCallback(de=>!!me[de],[me]);E.useEffect(()=>{tt.current={active:null,child:null}},[d]),E.useEffect(()=>{Ce&&!Ae&&Be(null)},[Ce,Ae]),E.useEffect(()=>{Ve.kind==="task-detail"&&!$e&&Ye({kind:"activity"})},[Ve,$e]);const Ge=E.useRef(null);E.useEffect(()=>{if(!He){Ge.current=null;return}Ge.current!==He.taskId&&(Ge.current=He.taskId,Ue(He.taskId,void 0,"full"))},[He,Ue]),E.useEffect(()=>{if(!Ce){tt.current.child=null;return}tt.current.child!==Ce&&(tt.current.child=Ce,Ue(Ce,void 0,"full"))},[Ce,Ue]),E.useEffect(()=>{if(!K){tt.current.active=null;return}const de=Re.timelineSessions.length>0?Re.timelineSessions:P.find(Fe=>Fe.taskId===K)?[P.find(Fe=>Fe.taskId===K)]:[];if(de.length===0){tt.current.active=null;return}const Se=de.map(Fe=>`${Fe.taskId}:${cC(Fe,{childDetail:Fe.mode==="child"})}`).join("|");if(tt.current.active!==Se){tt.current.active=Se;for(const Fe of de)Ue(Fe.taskId,void 0,cC(Fe,{childDetail:Fe.mode==="child"}))}},[Re.timelineSessions,K,Ue,P]);const Je=E.useMemo(()=>Ce?{kind:"child-detail"}:Ve.kind==="task-detail"||Ve.kind==="secretary"?Ve:K?{kind:"session",taskId:K}:{kind:"activity"},[Ve,K,Ce]),qn=E.useMemo(()=>Je.kind==="secretary"?ce:Je.kind==="child-detail"&&Ae?Ae.channelId:Je.kind==="session"&&Re.displaySession?Re.displaySession.channelId:Je.kind==="session"&&ee?ee.channelId:ve,[Je,Re.displaySession,ee,Ae,ce,ve]),In=E.useMemo(()=>{if(Je.kind==="activity")return[ve];if(Je.kind==="secretary")return[ce];if(Je.kind==="child-detail"&&Ae)return[Ae.channelId];if(Je.kind==="session"){const de=Re.timelineSessions.map(Se=>Se.channelId).filter((Se,Fe,ft)=>!!Se&&ft.indexOf(Se)===Fe);if(de.length>0)return de}return qn?[qn]:[]},[Je.kind,Re.timelineSessions,Ae,ve,ce,qn]),Dn=E.useMemo(()=>{const de=new Set;for(const Se of P)Se.status!=="cancelled"&&de.add(Se. Line truncated
`).replace(/\r/g,`
`).split(`
`).map(r=>r.trimEnd()).join(`
`).replace(/\n{3,}/g,`
`).trim(),n=sV(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 sV(e){const t=String(e||"").trim(),n=t.match(/^\*\*(.{8,160}?)\*\*:\s+([\s\S]+)$/);if(n){const a=n[2].trim();if(a.length>=80)return a}const i=t.indexOf(": ");if(i<8||i>160)return t;const r=t.slice(0,i).replace(/\*/g,"").trim(),o=t.slice(i+2).trim();return o.length<80||!/[A-Za-z\u4e00-\u9fff]/.test(r)||/^(https?|file)$/i.test(r)?t:o}function Ko(e){const t=Xo(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:"",i&&r?`checkpoint:${i}:${r}`:""]){const a=String(o??"").trim();a&&n.add(a)}return n}function oV(e){return e.startsWith("checkpoint:")}function Xr(e){return typeof e.timestamp=="number"?e.timestamp:0}function fC(e){const t=String(e.sender??"").trim().toLowerCase(),n=Xo(e),i=typeof n.role=="string"?n.role.trim().toLowerCase():"";return t==="user"||i==="user"?"user":"assistant"}function mC(e){const t=Xo(e),n=String(e.sender??"").trim().toLowerCase();let i=0;const r=II(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 pC(e){return String(Xo(e).source??"").trim().toLowerCase()==="engine"}function II(e){const t=Xo(e),n=String(t.transcript_kind??"").trim();if(n)return dC[n]??0;const i=String(t.kind??"").trim();return dC[i]??0}function am(e){return II(e)>0}function TI(e,t){if(e.channelId!==t.channelId)return!1;const n=Ko(e),i=Ko(t);for(const r of n)if(i.has(r))return!0;return!1}function t0(e,t){if(TI(e,t))return!0;if(e.channelId!==t.channelId||fC(e)!==fC(t)||om(e.content)!==om(t.content))return!1;const n=am(e)&&am(t);if(!n&&String(e.replyToId??"")!==String(t.replyToId??"")||!(pC(e)||pC(t)))return!1;const i=Xr(e),r=Xr(t);return!(!n&&i&&r&&Math.abs(i-r)>_v)}function n0(e,t,n=!1){let i=e,r=t;(n||mC(t)>mC(e))&&(i=t,r=e);const o=[];for(const p of[r.mentions,i.mentions])for(const g of p??[])o.includes(g)||o.push(g);const a=Ko(e),u=Ko(t);let d="";for(const p of a)if(u.has(p)&&!oV(p)){d=p;break}const m=om(i.content),h=m&&m===om(r.content)?m:i.content;return{...r,...i,...d?{id:d}:{},content:h,metadata:{...Xo(r),...Xo(i)},mentions:o,timestamp:Xr(i)||Xr(r)}}function lx(e){const t=[],n=new Map;for(const i of[...e].sort((r,o)=>Xr(r)-Xr(o))){const r=Ko(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=Xr(i),m=am(i);for(let h=t.length-1;h>=0;h--){const p=Xr(t[h]);if(!m&&d>0&&p>0&&d-p>_v)break;if(t0(t[h],i)){o=h;break}}}const u=o===-1?t.length:o;o===-1?t.push(i):t[o]=n0(t[o],i,a);for(const d of Ko(t[u]))n.has(d)||n.set(d,u)}return t}function aV(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 lV(e,t){switch(t.type){case"SET":{const n=lx(t.messages);if(e.length===0)return n;const i=e.filter(r=>typeof r.id=="string"&&r.id.startsWith("msg-")&&!n.some(o=>t0(r,o)));return i.length===0?n:lx([...n,...i])}case"CLEAR":return[];case"ADD":{const n=Xr(t.message);Ko(t.message);let i=!1;for(let r=e.length-1;r>=0;r--){const o=Xr(e[r]);if(!i&&n>0&&o>0&&n-o>_v&&(i=!0),TI(e[r],t.message)){const a=[...e];return a[r]=n0(e[r],t.message,e[r].id===t.message.id),a}if((am(t.message)||!i)&&t0(e[r],t.message)){const a=[...e];return a[r]=n0(e[r],t.message),a}}return[...e,t.message]}case"MERGE":return t.messages.length===0?e:lx([...e,...t.messages]);case"MARK_SENDER_DELETED":return e.map(n=>n.sender===t.senderId?{...n,senderDeleted:!0,senderName:"[已删除的 Agent]"}:n);case"REMOVE_BY_CHANNEL":return e.filter(n=>n.channelId!==t.channelId);case"REMOVE_BY_TASK_ID":return e.filter(n=>n.channelId!==`session:${t.taskId}`&&n.metadata?.task_id!==t.taskId);default:return e}}function cV(){const[e,t]=E.useReducer(aV,[]),[n,i]=E.useReducer(lV,[]),[r,o]=E.useState({}),[a,u]=E.useState("default"),d=E.useMemo(()=>{const I={};for(const D of n)I[D.channelId]||(I[D.channelId]=[]),I[D.channelId].push(D);return I},[n]),m=E.useMemo(()=>{const I={};for(const D of n){if(D.sender==="user")continue;const T=r[D.channelId]??0;D.timestamp<=T||(I[D.channelId]=(I[D.channelId]??0)+1)}return I},[n,r]),h=E.useCallback(I=>{const D={id:`msg-${rV()}`,channelId:I.channelId,sender:I.sender,senderName:I.senderName,content:I.content,timestamp:Date.now(),replyToId:I.replyToId,mentions:[],metadata:I.metadata};return i({type:"ADD",message:D}),D},[]),p=E.useCallback(I=>d[I]??[],[d]),g=E.useCallback(I=>m[I]??0,[m]),y=E.useCallback(I=>{o(D=>({...D,[I]:Date.now()}))},[]),v=E.useCallback(I=>{i({type:"MARK_SENDER_DELETED",senderId:I})},[]),k=E.useCallback(I=>{t({type:"REMOVE_PARTICIPANT",agentId:I})},[]),S=E.useCallback(I=>{t({type:"REMOVE",channe Line truncated
${t}`:`${e}${t}`}function uV(e,t){const n=e.trim().replace(/\s+/g," ");return n?n.length>120?`${n.slice(0,120).trimEnd()}...`:n:t||"Thinking"}function RI(e){return typeof e.lastTimestamp=="number"&&Number.isFinite(e.lastTimestamp)?e.lastTimestamp:e.timestamp}function dV(e){const t=Number.isFinite(e.timestamp)?e.timestamp:Date.now();return{timestamp:t,lastTimestamp:typeof e.lastTimestamp=="number"&&Number.isFinite(e.lastTimestamp)?e.lastTimestamp:t,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 lm(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 fV(e,t){const n=lm(e),i=lm(t);return n&&i?n===i:t.timestamp-RI(e)>Vm||e.type!==t.type?!1:e.type==="thinking"?!0:e.type==="tool_call"?e.summary===t.summary:!1}function mV(e,t){return t.timestamp-RI(e)<=Vm&&e.type===t.type&&e.summary===t.summary&&(e.detail??"")===(t.detail??"")}function pV(e,t){if(e.type==="thinking"){const n=i0(e.detail??"",t.detail??"","thinking");return{timestamp:e.timestamp,lastTimestamp:t.timestamp,type:"thinking",summary:uV(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=i0(e.detail??"",t.detail??"","tool_call");return{timestamp:e.timestamp,lastTimestamp:t.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,timestamp:e.timestamp,lastTimestamp:t.timestamp}}function AI(e,t,n=100){const i=dV(t),r=lm(i),o=r?[...e].reverse().findIndex(d=>lm(d)===r):-1,a=o>=0?e.length-1-o:e.length-1,u=e[a];return u?r&&typeof u.seq=="number"&&typeof i.seq=="number"&&i.seq<=u.seq?e:mV(u,i)?ll([...e.slice(0,a),{...u,lastTimestamp:i.timestamp},...e.slice(a+1)],n):fV(u,i)?ll([...e.slice(0,a),pV(u,i),...e.slice(a+1)],n):ll([...e,i],n):[i]}function MI(e,t=100){return(Array.isArray(e)?e:[]).reduce((n,i)=>AI(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 DI(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 gV(e,t){return t.timestamp-e.timestamp<=Vm&&DI(e,t)&&(e.type==="thinking"||e.type==="tool_call")}function xV(e,t){return DI(e,t)&&(e.detail??"")===(t.detail??"")&&t.timestamp-e.timestamp<=Vm}function yV(e,t){const n=t.type==="tool_call"?"tool_call":"thinking";return{...e,...t,timestamp:t.timestamp,detail:i0(e.detail??"",t.detail??"",n)||void 0}}function OI(e,t,n=100){const i=hV(t),r=e[e.length-1];return r?xV(r,i)?ll([...e.slice(0,-1),{...r,timestamp:i.timestamp}],n):gV(r,i)?ll([...e.slice(0,-1),yV(r,i)],n):ll([...e,i],n):[i]}function LI(e,t=100){return(Array.isArray(e)?e:[]).reduce((n,i)=>OI(n,i,t),[])}function r0(e){const t=String(e??"").trim().toLowerCase();return t==="company"?"company":t==="org"||t==="custom"?"org":"task"}function vV(e){return String(e??"").trim().toLowerCase()==="custom"?"custom":"corporate"}function Line truncated
`)),[L,A]=E.useState(!1),M=E.useRef(e.role_id);E.useEffect(()=>{M.current!==e.role_id&&(M.current=e.role_id,d(e.name),h(e.responsibility),g(e.reports_to),v(e.icon??null),S(new Set(e.can_spawn)),w(new Set(e.tools)),N(e.runtime_policy?.execution_strategy??"auto"),I(e.preferred_external_agent??null),T((e.prompt_refs??[]).join(`
`)),A(!1))},[e]);const $=E.useRef({}),W=E.useRef(null),B=E.useRef(e.role_id);E.useEffect(()=>{B.current=e.role_id},[e.role_id]);const U=E.useCallback(()=>{W.current&&(clearTimeout(W.current),W.current=null);const se=$.current;$.current={},Object.keys(se).length!==0&&r(B.current,se)},[r]),F=E.useCallback(se=>{i||($.current={...$.current,...se},W.current&&clearTimeout(W.current),W.current=setTimeout(U,500))},[U,i]);E.useEffect(()=>()=>{W.current&&(clearTimeout(W.current),W.current=null);const se=$.current;Object.keys(se).length>0&&($.current={},r(B.current,se))},[r]);const V=se=>{d(se),F({name:se})},Y=se=>{h(se),F({responsibility:se})},Q=se=>{g(se),F({reports_to:se})},q=se=>{v(se),F({icon:se})},G=se=>{N(se),F({execution_strategy:se})},J=se=>{I(se),F({preferred_external_agent:se})},P=se=>{T(se);const _e=se.split(`
`).map(we=>we.trim()).filter(Boolean);F({prompt_refs:_e})},K=se=>{const _e=new Set(k);_e.has(se)?_e.delete(se):_e.add(se),S(_e),F({can_spawn:Array.from(_e)})},ee=se=>{const _e=new Set(_);_e.has(se)?_e.delete(se):_e.add(se),w(_e),F({tools:Array.from(_e)})},te=E.useMemo(()=>t.filter(se=>se.role_id!==e.role_id),[t,e.role_id]),ie=E.useMemo(()=>n.filter(se=>(se.role_ids?.length?se.role_ids:[se.role_id]).includes(e.role_id)).length,[n,e.role_id]),oe=E.useMemo(()=>D.split(`
`).filter(se=>se.trim()).length,[D]),fe=()=>{if(!L){A(!0);return}U(),o(e.role_id)};return c.jsxs("aside",{className:"ri-panel","aria-label":`Inspector for role ${e.name}`,children:[c.jsxs("header",{className:"ri-panel-header",children:[c.jsx("img",{src:Du(y),alt:"",className:"ri-panel-icon"}),c.jsxs("div",{className:"ri-panel-title-wrap",children:[c.jsx("h3",{className:"ri-panel-title",children:u||"(unnamed)"}),c.jsx("code",{className:"ri-panel-id",children:e.role_id})]}),c.jsx("button",{className:"btn btn-ghost btn-sm ri-panel-close",onClick:a,title:"Close (Esc)",children:"✕"})]}),c.jsxs("div",{className:"ri-panel-body",children:[c.jsxs(Ya,{title:"Identity",defaultExpanded:!0,children:[c.jsx(gr,{label:"Name",children:c.jsx("input",{className:"ri-text-input",value:u,onChange:se=>V(se.target.value),disabled:i})}),c.jsx(gr,{label:"Responsibility",children:c.jsx("textarea",{className:"ri-textarea",rows:3,value:m,onChange:se=>Y(se.target.value),disabled:i})}),c.jsx(gr,{label:"Icon",children:c.jsx(GV,{value:y,onChange:q,readOnly:i})})]}),c.jsxs(Ya,{title:"Hierarchy",defaultExpanded:!0,children:[c.jsx(gr,{label:"Reports to",children:c.jsxs("select",{className:"ri-select",value:p,onChange:se=>Q(se.target.value),disabled:i,children:[c.jsx("option",{value:"owner",children:"You (Owner)"}),te.map(se=>c.jsx("option",{value:se.role_id,children:se.name},se.role_id))]})}),c.jsx(gr,{label:"Can delegate to",children:c.jsx(qV,{allIds:te.map(se=>se.role_id),labelFor:se=>te.find(_e=>_e.role_id===se)?.name??se,selected:k,onToggle:K,readOnly:i})}),c.jsx(gr,{label:"Employees assigned",children:c.jsx("span",{className:"ri-meta-value",children:ie})})]}),c.jsx(Ya,{title:`Tools (${_.size})`,children:c.jsx(WV,{tools:_,onToggle:ee,readOnly:i})}),c.jsx(Ya,{title:`Prompts (${oe})`,children:c.jsx(gr,{label:"Prompt refs / inline",children:c.jsx("textarea",{className:"ri-textarea ri-textarea-mono",rows:5,placeholder:"One prompt ref or inline instruction per line",value:D,onChange:se=>P(se.target.value),disabled:i})})}),c.jsxs(Ya,{title:"Runtime policy",children:[c.jsx(gr,{label:"Execution strategy",children:c.jsx("div",{className:"ri-radio-group",children:VV.map(se=>c.jsxs("label",{className:"ri-radio",title:se.hint,children:[c.jsx("input",{type:"radio",name:`exec-strategy-${e.role_id}`,value:se.value,checked:C===se.value,onChange:()=>G(se.value),disabled:i}),se.label]},se.value))})}),C==="external"&&c.jsx(gr,{label:"Preferred external agent",children:c.jsxs("select",{className:"ri-select",value:O??"",onChange:se=>J(se.target.value||null),disabled:i,children:[c.jsx("option",{value:"",children:"(any)"}),FV.map(se=>c.jsx("option",{value:se,children:se},se))]})})]}),c.jsxs(Ya,{title:"Advanced",children:[c.jsx(gr,{label:"Role type",children:c.jsx("span",{className:"ri-meta-value",children:e.role_type??"worker"})}),c.jsx(gr,{label:"Skills",children:c.jsx("span",{className:"ri-meta-value",children:e.skill_refs&&e.skill_refs.length>0?e.skill_refs.join(", "):"(none)"})}),c.jsx(gr,{label:"Artifact contract",children:c.jsx("span",{className:"ri-meta-value",children:e.artifact_contract_ref??"(none)"})})]})]}),!i&&c.jsx("footer",{className:"ri-panel-footer",children:c.jsx("button",{className:`btn btn-sm ${L?"btn-danger":"btn-ghost"}`,onClick:fe,onBlur:()=>A(!1),children:L?"Confirm delete?":"Delete role"})})]})}function Ya({title:e,defaultExpanded:t=!1,children:n}){const[i,r]=E.useState(t);return c.jsxs("section",{className:`ri-group${i?" is-expanded":""}`,children:[c.jsxs("button",{className:"ri-group-header",onClick:()=>r(o=>!o),children:[c.jsx("span",{className:"ri-group-caret",children:i?"▾":"▸"}),c.jsx("span",{className:"ri-group-title",children:e})]}),i&&c.jsx("div",{className:"ri-group-body",children:n})]})}function gr({label:e,children:t}){return c.jsxs("div",{className:"ri-field",children:[c.jsx("label",{className:"ri-field-label",children:e}),c.jsx("div",{className:"ri-field-control",children:t})]})}function GV({value:e,onChange:t,readOnly:n}){const[i,r]=E.useState(!1);return c.jsxs("div",{className:"ri-icon-picker",children:[c.jsxs("button",{className:"ri-icon-picker-trigger",onClick:()=>!n&&r(o=>!o),disabled:n,children:[c.jsx("img",{src:Du(e),alt:"",className:"ri-icon-picker-current"}),c.jsx("span",{className:"ri-icon-picker-label",children:e??"generic"})]}),i&&c.jsxs("div",{className:"ri-icon-picker-popover",children:[c.jsx("button",{className:`ri-icon-option${e===null?" is-active":""}`,onClick:()=>{t(null),r(!1)},title:"Default icon",children:c.jsx("img",{src:iu.generic,alt:""})}),$V.filter(o=>o!=="generic").map(o=>c.jsx("button",{className:`ri-icon-option${e===o?" is-active":""}`,onClick:()=>{t(o),r(!1)},title:o,children:c.jsx("img",{src:iu[o],alt:o})},o))]})]})}function qV({allIds:e,labelFor:t,selected:n,onToggle:i,readOnly:r}){const[o,a]=E.useState(!1),u=e.filter(d=>!n.has(d));return c.jsxs("div",{className:"ri-multiselect",children:[c.jsxs("div",{className:"ri-chips",children:[Array.from(n).map(d=>c.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 pt(e,t,n,i){return{debug:()=>{var r;return(r=e?.debugAll)!=null?r:e[t]},key:!1,onChange:i}}function KV(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:mt(()=>[e,n,t,o],(a,u,d,m)=>({table:a,column:u,row:d,cell:m,getValue:m.getValue,renderValue:m.renderValue}),pt(e.options,"debugCells"))};return e._features.forEach(a=>{a.createCell==null||a.createCell(o,n,t,e)},{}),o}function ZV(e,t,n,i){var r,o;const u={...e._getDefaultColumnDef(),...t},d=u.accessorKey;let m=(r=(o=u.id)!=null?o:d?typeof String.prototype.replaceAll=="function"?d.replaceAll(".","_"):d.replace(/\./g,"_"):void 0)!=null?r:typeof u.header=="string"?u.header:void 0,h;if(u.accessorFn?h=u.accessorFn:d&&(d.includes(".")?h=g=>{let y=g;for(const k of d.split(".")){var v;y=(v=y)==null?void 0:v[k]}return y}:h=g=>g[u.accessorKey]),!m)throw new Error;let p={id:`${String(m)}`,accessorFn:h,parent:i,depth:n,columnDef:u,columns:[],getFlatColumns:mt(()=>[!0],()=>{var g;return[p,...(g=p.columns)==null?void 0:g.flatMap(y=>y.getFlatColumns())]},pt(e.options,"debugColumns")),getLeafColumns:mt(()=>[e._getOrderColumnsFn()],g=>{var y;if((y=p.columns)!=null&&y.length){let v=p.columns.flatMap(k=>k.getLeafColumns());return g(v)}return[p]},pt(e.options,"debugColumns"))};for(const g of e._features)g.createColumn==null||g.createColumn(p,e);return p}const yi="debugHeaders";function vC(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=[],u=d=>{d.subHeaders&&d.subHeaders.length&&d.subHeaders.map(u),a.push(d)};return u(o),a},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(a=>{a.createHeader==null||a.createHeader(o,e)}),o}const QV={createTable:e=>{e.getHeaderGroups=mt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,i,r)=>{var o,a;const u=(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 uf(t,[...u,...m,...d],e)},pt(e.options,yi)),e.getCenterHeaderGroups=mt(()=>[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))),uf(t,n,e,"center")),pt(e.options,yi)),e.getLeftHeaderGroups=mt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,i)=>{var r;const o=(r=i?.map(a=>n.find(u=>u.id===a)).filter(Boolean))!=null?r:[];return uf(t,o,e,"left")},pt(e.options,yi)),e.getRightHeaderGroups=mt(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,i)=>{var r;const o=(r=i?.map(a=>n.find(u=>u.id===a)).filter(Boolean))!=null?r:[];return uf(t,o,e,"right")},pt(e.options,yi)),e.getFooterGroups=mt(()=>[e.getHeaderGroups()],t=>[...t].reverse(),pt(e.options,yi)),e.getLeftFooterGroups=mt(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),pt(e.options,yi)),e.getCenterFooterGroups=mt(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),pt(e.options,yi)),e.getRightFooterGroups=mt(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),pt(e.options,yi)),e.getFlatHeaders=mt(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),pt(e.options,yi)),e.getLeftFlatHeaders=mt(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),pt(e.options,yi)),e.getCenterFlatHeaders=mt(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),pt(e.options,yi)),e.getRightFlatHeaders=mt(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),pt(e.options,yi)),e.getCenterLeafHeaders=mt(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var i;return!((i=n.subHeaders)!=null&&i.length)}),pt(e.options,yi)),e.getLeftLeafHeaders=mt(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var i;return!((i=n.subHeaders)!=null&&i.length)}),pt(e.options,yi)),e.getRightLeafHeaders=mt(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var i;return!((i=n.subHeaders)!=null&&i.length)}),pt(e.options,yi)),e.getLeafHeaders=mt(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,i)=>{var r,o,a,u,d,m;return[...(r=(o=t[0])==null?void 0:o.headers)!=null?r:[],...(a=(u=n[0])==null?void 0:u.headers)!=null?a:[],...(d=(m=i[0])==null?void 0:m.headers)!=null?d:[]].map(h=>h.getLeafHeaders()).flat()},pt(e.options,yi))}};function uf(e,t,n,i){var r,o;let a=0;const u=function(g,y){y===void 0&&(y=1),a=Math.max(a,y),g.filter(v=>v.getIsVisible()).forEach(v=>{var k;(k=v.columns)!=null&&k.length&&u(v.columns,y+1)},0)};u(e);let d=[];const m=(g,y)=>{const v={depth:y,id:[i,`${y}`].filter(Boolean).jo Line truncated
`).replace(`
`,`
+`).split(`
`)),h=m.reduce((p,g)=>p.concat(...g),[]);return[m,h]}return[[],[]]},[e]);return E.useEffect(()=>{const d=t?.target??d2,m=t?.actInsideInputWithModifier??!0;if(e!==null){const h=y=>{if(r.current=y.ctrlKey||y.metaKey||y.shiftKey||y.altKey,(!r.current||r.current&&!m)&&OT(y))return!1;const k=m2(y.code,u);if(o.current.add(y[k]),f2(a,o.current,!1)){const S=y.composedPath?.()?.[0]||y.target,_=S?.nodeName==="BUTTON"||S?.nodeName==="A";t.preventDefault!==!1&&(r.current||!_)&&y.preventDefault(),i(!0)}},p=y=>{const v=m2(y.code,u);f2(a,o.current,!0)?(i(!1),o.current.clear()):o.current.delete(y[v]),y.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 f2(e,t,n){return e.filter(i=>n||i.length===t.size).some(i=>i.every(r=>t.has(r)))}function m2(e,t){return t.includes(e)?"code":"key"}const XX=()=>{const e=wn();return E.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:u}=e.getState(),d=Dv(t,i,r,o,a,n?.padding??.1);return u?(await u.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:u,y:d}=a.getBoundingClientRect(),m={x:t.x-u,y:t.y-d},h=n.snapGrid??r,p=n.snapToGrid??o;return $u(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=ym(t,n);return{x:a.x+r,y:a.y+o}}}),[])};function iR(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 u={...o};for(const d of a)KX(d,u);n.push(u)}return r.length&&r.forEach(o=>{o.index!==void 0?n.splice(o.index,0,{...o.item}):n.push({...o.item})}),n}function KX(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 rR(e,t){return iR(e,t)}function ZX(e,t){return iR(e,t)}function Ho(e,t){return{id:e,type:"select",selected:t}}function nl(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(Ho(o.id,a)))}return i}function p2({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),u=a?.internals?.userNode??a;u!==void 0&&u!==o&&n.push({id:o.id,item:o,type:"replace"}),u===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 h2(e){return{id:e.id,type:"remove"}}const g2=e=>bY(e),QX=e=>ET(e);function sR(e){return E.forwardRef(e)}function x2(e){const[t,n]=E.useState(BigInt(0)),[i]=E.useState(()=>JX(()=>n(r=>r+BigInt(1))));return S0(()=>{const r=i.get();r.length&&(e(r),i.reset())},[t]),i}function JX(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const oR=E.createContext(null);function eK({children:e}){const t=wn(),n=E.useCallback(u=>{const{nodes:d=[],setNodes:m,hasDefaultNodes:h,onNodesChange:p,nodeLookup:g,fitViewQueued:y,onNodesChangeMiddlewareMap:v}=t.getState();let k=d;for(const _ of u)k=typeof _=="function"?_(k):_;let S=p2({items:k,lookup:g});for(const _ of v.values())S=_(S);h&&m(k),S.length>0?p?.(S):y&&window.requestAnimationFrame(()=>{const{fitViewQueued:_,nodes:w,setNodes:C}=t.getState();_&&C(w)})},[]),i=x2(n),r=E.useCallback(u=>{const{edges:d=[],setEdges:m,hasDefaul Line truncated
M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}AR.displayName="MiniMap";const HZ=E.memo(AR),FZ=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,VZ={[Cl.Line]:"right",[Cl.Handle]:"bottom-right"};function UZ({nodeId:e,position:t,variant:n=Cl.Handle,className:i,style:r=void 0,children:o,color:a,minWidth:u=10,minHeight:d=10,maxWidth:m=Number.MAX_VALUE,maxHeight:h=Number.MAX_VALUE,keepAspectRatio:p=!1,resizeDirection:g,autoScale:y=!0,shouldResize:v,onResizeStart:k,onResize:S,onResizeEnd:_}){const w=cR(),C=typeof e=="string"?e:w,N=wn(),O=E.useRef(null),I=n===Cl.Handle,D=Ut(E.useCallback(FZ(I&&y),[I,y]),Sn),T=E.useRef(null),L=t??VZ[n];E.useEffect(()=>{if(!(!O.current||!C))return T.current||(T.current=yX({domNode:O.current,nodeId:C,getStoreItems:()=>{const{nodeLookup:M,transform:$,snapGrid:W,snapToGrid:B,nodeOrigin:U,domNode:F}=N.getState();return{nodeLookup:M,transform:$,snapGrid:W,snapToGrid:B,nodeOrigin:U,paneDomNode:F}},onChange:(M,$)=>{const{triggerNodeChanges:W,nodeLookup:B,parentLookup:U,nodeOrigin:F}=N.getState(),V=[],Y={x:M.x,y:M.y},Q=B.get(C);if(Q&&Q.expandParent&&Q.parentId){const q=Q.origin??F,G=M.width??Q.measured.width??0,J=M.height??Q.measured.height??0,P={id:Q.id,parentId:Q.parentId,rect:{width:G,height:J,...MT({x:M.x??Q.position.x,y:M.y??Q.position.y},{width:G,height:J},Q.parentId,B,q)}},K=$v([P],B,U,F);V.push(...K),Y.x=M.x?Math.max(q[0]*G,M.x):void 0,Y.y=M.y?Math.max(q[1]*J,M.y):void 0}if(Y.x!==void 0&&Y.y!==void 0){const q={id:C,type:"position",position:{...Y}};V.push(q)}if(M.width!==void 0&&M.height!==void 0){const G={id:C,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:M.width,height:M.height}};V.push(G)}for(const q of $){const G={...q,type:"position"};V.push(G)}W(V)},onEnd:({width:M,height:$})=>{const W={id:C,type:"dimensions",resizing:!1,dimensions:{width:M,height:$}};N.getState().triggerNodeChanges([W])}})),T.current.update({controlPosition:L,boundaries:{minWidth:u,minHeight:d,maxWidth:m,maxHeight:h},keepAspectRatio:p,resizeDirection:g,onResizeStart:k,onResize:S,onResizeEnd:_,shouldResize:v}),()=>{T.current?.destroy()}},[L,u,d,m,h,p,k,S,_,v]);const A=L.split("-");return c.jsx("div",{className:Gn(["react-flow__resize-control","nodrag",...A,n,i]),ref:O,style:{...r,scale:D,...a&&{[I?"backgroundColor":"borderColor"]:a}},children:o})}E.memo(UZ);const GZ=E.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=Du(t.icon);return c.jsxs("div",{className:n,children:[c.jsx(jl,{type:"target",position:st.Top,className:"oc-canvas-handle"}),c.jsxs("div",{className:"oc-canvas-node-row",children:[c.jsx("div",{className:"oc-canvas-node-chip",children:c.jsx("span",{className:"oc-canvas-node-chip-icon",style:{WebkitMaskImage:`url("${i}")`,maskImage:`url("${i}")`},"aria-hidden":!0})}),c.jsxs("div",{className:"oc-canvas-node-text",children:[c.jsx("span",{className:"oc-canvas-node-name",children:t.name}),c.jsxs("div",{className:"oc-canvas-node-meta",children:[t.employeeNames.length>0?c.jsxs("span",{className:"oc-canvas-node-person",title:t.employeeNames.join(", "),children:[t.employeeNames[0],t.employeeNames.length>1?` +${t.employeeNames.length-1}`:""]}):c.jsx("span",{className:"oc-canvas-node-id",children:t.roleId}),t.employeeCount>0&&c.jsx("span",{className:"oc-canvas-node-badge",children:t.employeeCount})]})]})]}),c.jsx(jl,{type:"source",position:st.Bottom,className:"oc-canvas-handle"})]})});var Tx,I2;function Vv(){if(I2)return Tx;I2=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,y=this;return h.forEach(function(v){g.length>1?y.setNode(v,p):y.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}`}),c.jsx(RV,{projects:Ri.projects,activeId:Ri.activeProjectId,onSelect:Z=>{const z=Rs(Z);t.current?.switchProject(Z,z)},onCreate:Z=>{t.current?.createProject(Z)},onDelete:Z=>t.current?.deleteProject(Z)})]}),c.jsxs("div",{className:"topbar-center",children:[c.jsxs("div",{className:"page-nav",children:[c.jsxs("button",{className:`page-nav-btn${$==="workspace"?" active":""}`,onClick:()=>W("workspace"),children:["Workspace",(()=>{const Z=Si.channels.reduce((z,ne)=>z+Si.getUnreadCount(ne.id),0);return Z>0?c.jsx("span",{className:"nav-unread-badge",children:Z>99?"99+":Z}):null})()]}),c.jsx("button",{className:`page-nav-btn${$==="office"?" active":""}`,onClick:()=>W("office"),children:"Office"}),c.jsx("button",{className:`page-nav-btn${$==="org"?" active":""}`,onClick:()=>W("org"),children:"Org"})]}),c.jsxs("div",{className:"stat-chips",children:[c.jsxs("span",{className:"stat-chip",children:[c.jsx("b",{children:oa.totalAgents})," agents"]}),c.jsxs("span",{className:"stat-chip",children:[c.jsx("b",{children:oa.totalSkills})," skills"]}),c.jsxs("span",{className:"stat-chip",children:[c.jsx("b",{children:Ln.getOpenTaskCount()})," tasks"]})]})]}),c.jsxs("div",{className:"topbar-right",children:[c.jsxs("select",{className:"theme-select",value:Ti,title:"Outdoor lighting override",onChange:Z=>{const z=Z.target.value;ki(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:[c.jsx("option",{value:"auto",children:"Outdoor auto"}),c.jsx("option",{value:"day",children:"Outdoor day"}),c.jsx("option",{value:"night",children:"Outdoor night"})]}),c.jsxs("select",{className:"theme-select",value:C,onChange:Z=>N(Z.target.value),children:[c.jsx("option",{value:"midnight",children:"Midnight"}),c.jsx("option",{value:"neon",children:"Neon"}),c.jsx("option",{value:"paper",children:"Paper"}),c.jsx("option",{value:"retro",children:"Retro"}),c.jsx("option",{value:"terminal",children:"Terminal"}),c.jsx("option",{value:"cozy",children:"Cozy"}),c.jsx("option",{value:"openopc",children:"OpenOPC"})]}),c.jsx("button",{className:`icon-btn ${F?"active":""}`,onClick:()=>V(Z=>!Z),title:"Developer Tools",children:c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[c.jsx("path",{d:"M5.5 2L2 5.5 5.5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M10.5 7L14 10.5 10.5 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),$==="workspace"&&c.jsx(iV,{boardStore:Ln,chatStore:Si,sessionStore:fn,agents:B,officeMap:kr,execMode:q,companyProfile:J,taskPreferredAgent:K,projectId:Ri.activeProjectId,orgInfoData:te,onNavigateToOrg:()=>W("org"),savedOrgsList:Yt,activeSavedOrg:Re,onSavedOrgsList:sr,onSavedOrgLoad:ns,recoveryStatus:oe,onRecoveryResume:Z=>t.current?.recoveryAction(at(),"resume",Z),onRecoveryCancel:Z=>t.current?.recoveryAction(at(),"cancel",Z),commsState:se,commsMessage:we,onCommsRefresh:Z=>{const{project_id:z,...ne}=Z??{};t.current?.commsState(at(),ne)},onCommsReadMessage:Z=>t.current?.commsReadMessage(at(),Z),onRunTask:(Z,z,ne,ae,pe)=>{t.current?.send({type:"run_task",project_id:at(),task_id:Z,title:z,description:ne,mode:ae,profile:pe})},onCreateTask:(Z,z,ne,ae)=>{t.current?.send({type:"kanban_create_task",project_id:at(),title:Z,board_id:z,column_id:ne,task_id:ae})},onMoveTask:(Z,z)=>{t.current?.send({type:"kanban_move_task",project_id:at(),task_id:Z,column_id:z})},onCreateSession:()=>{if(dt.current||yt.current)return;const Z=at();bn(Z),t.current?.createSession(Z,void 0,q,Cy(q),K,Po(q,Re))},onSessionSend:(Z,z,ne,ae)=>t.current?.sessionSend(at(),Z,z,ne,ae),onSecretarySend:Z=>t.current?.secretarySend(at(),Z),onDeleteSession:Z=>t.current?.deleteSession(at(),Z),onTitleChange:(Z,z)=>t.current?.sessionUpdateTitle(at(),Z,z),onSessionConfigChange:Bl,onSessionTaskAgentChange:$l,onContinueInNewChat:bo,onSessionStop:Uu,onSessionResume:ap,onSessionComplete:Z=>t.current?.sessionComplete(at(),Z),onLoadSessionDetail:(Z,z)=>t.current?.sessionDetail(at(),Z,{...z,include:z?.detailLevel==="full"?["messages","session_state","progress","work_items","runtime_context"]:["messages","session_state"],viewGeneration:Jt.current}),onOpenExecutionPanel:Z=>Et(Z),onCollabSync:()=>t.current?.collabSync(at(),void 0,Jt.current)}),$==="org"&&c.jsx("div",{className:"org-page",children:c.jsx(eJ,{data:te,sessionRecruitmentByRole:Hu,talents:Be,employeeDetail:zt,reorgProposals:Nt,isCustomMode:Os,onRequestData:()=>t.current?.orgInfo(),onRequestTalents:()=>t.current?.talentList(),onRequestEmployeeDetail:Z=>t.current?.employeeDetail(Z),onHireTalent:(Z,z)=>{Wn(Z),t.current?.talentHire(Z,z,void 0,te?.organization_id||Re||void 0)},hiringTemplateId:$t,onImportEmployee:Z=>t.curre Line truncated
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="data:," /> <link rel="icon" href="data:," />
<title>OpenOPC Pixel Office</title> <title>OpenOPC Pixel Office</title>
<script type="module" crossorigin src="./assets/index-cOg8E2rt.js"></script> <script type="module" crossorigin src="./assets/index-D7a_jL_7.js"></script>
<link rel="modulepreload" crossorigin href="./assets/phaser-DFK5Ua9d.js"> <link rel="modulepreload" crossorigin href="./assets/phaser-DFK5Ua9d.js">
<link rel="stylesheet" crossorigin href="./assets/index-CMqG6mW8.css"> <link rel="stylesheet" crossorigin href="./assets/index-CMqG6mW8.css">
</head> </head>
@@ -18,6 +18,7 @@ export const INLINE_PROGRESS_ENTRY_TYPES = new Set<ProgressEntryType>(['thinking
const ENTRY_CONFIG: Record<ProgressEntryType, { icon: React.ReactNode; color: string; label: string }> = { const ENTRY_CONFIG: Record<ProgressEntryType, { icon: React.ReactNode; color: string; label: string }> = {
thinking: { icon: <IconBrain />, color: 'var(--accent)', label: 'Thinking' }, thinking: { icon: <IconBrain />, color: 'var(--accent)', label: 'Thinking' },
assistant: { icon: <IconSparkle />, color: 'var(--accent)', label: 'Reply' },
tool_call: { icon: <IconTool />, color: 'var(--green)', label: 'Tool' }, tool_call: { icon: <IconTool />, color: 'var(--green)', label: 'Tool' },
autonomy: { icon: <IconShield />, color: 'var(--yellow)', label: 'Autonomy' }, autonomy: { icon: <IconShield />, color: 'var(--yellow)', label: 'Autonomy' },
handoff: { icon: <IconArrowRight />, color: 'var(--accent)', label: 'Handoff' }, handoff: { icon: <IconArrowRight />, color: 'var(--accent)', label: 'Handoff' },
@@ -257,7 +258,7 @@ export const AgentProgressEntryCard = React.memo(function AgentProgressEntryCard
) )
} }
if (entry.type === 'thinking') { if (entry.type === 'thinking' || entry.type === 'assistant') {
return ( return (
<div className="ptl-tool-card"> <div className="ptl-tool-card">
<button <button
@@ -114,3 +114,38 @@ permissionLog = appendProgressEntry(permissionLog, {
assert.equal(permissionLog.length, 1) assert.equal(permissionLog.length, 1)
assert.equal(permissionLog[0]?.summary, 'shell_exec: allow') assert.equal(permissionLog[0]?.summary, 'shell_exec: allow')
// Native company assistant replies stream like thinking: same-stream deltas
// accumulate into one entry instead of replacing each other, and separate
// iterations (distinct item_id) stay separate entries.
let assistantLog = appendProgressEntry([], {
timestamp: 30,
type: 'assistant',
summary: '文件已成功写入',
detail: '文件已成功写入',
turnId: 'rt-1:4',
itemId: 'rt-1:4:iter:2:assistant',
seq: 1,
})
assistantLog = appendProgressEntry(assistantLog, {
timestamp: 31,
type: 'assistant',
summary: '(278 行)。',
detail: '(278 行)。',
turnId: 'rt-1:4',
itemId: 'rt-1:4:iter:2:assistant',
seq: 2,
})
assistantLog = appendProgressEntry(assistantLog, {
timestamp: 32,
type: 'assistant',
summary: '采集完成报告',
detail: '采集完成报告',
turnId: 'rt-1:4',
itemId: 'rt-1:4:iter:3:assistant',
seq: 1,
})
assert.equal(assistantLog.length, 2)
assert.equal(assistantLog[0]?.detail, '文件已成功写入(278 行)。')
assert.equal(assistantLog[0]?.summary, '文件已成功写入(278 行)。')
assert.equal(assistantLog[1]?.detail, '采集完成报告')
@@ -68,7 +68,7 @@ function canMergeProgress(left: ProgressEntry, right: ProgressEntry): boolean {
if (leftKey && rightKey) return leftKey === rightKey if (leftKey && rightKey) return leftKey === rightKey
if (right.timestamp - left.timestamp > STREAM_MERGE_WINDOW_MS) return false if (right.timestamp - left.timestamp > STREAM_MERGE_WINDOW_MS) return false
if (left.type !== right.type) return false if (left.type !== right.type) return false
if (left.type === 'thinking') return true if (left.type === 'thinking' || left.type === 'assistant') return true
if (left.type === 'tool_call') return left.summary === right.summary if (left.type === 'tool_call') return left.summary === right.summary
return false return false
} }
@@ -83,14 +83,15 @@ function isDuplicateProgress(left: ProgressEntry, right: ProgressEntry): boolean
} }
function mergeProgress(left: ProgressEntry, right: ProgressEntry): ProgressEntry { function mergeProgress(left: ProgressEntry, right: ProgressEntry): ProgressEntry {
if (left.type === 'thinking') { if (left.type === 'thinking' || left.type === 'assistant') {
// Merge detail text only: summary is a label/preview ("Thinking", // Merge detail text only: summary is a label/preview ("Thinking",
// truncated excerpt), so falling back to it would splice label text // truncated excerpt), so falling back to it would splice label text
// into the middle of the merged thinking stream. // into the middle of the merged stream. Assistant reply streams merge
// the same way as thinking streams.
const detail = mergeText(left.detail ?? '', right.detail ?? '', 'thinking') const detail = mergeText(left.detail ?? '', right.detail ?? '', 'thinking')
return { return {
timestamp: right.timestamp, timestamp: right.timestamp,
type: 'thinking', type: left.type,
summary: summarizeThinking(detail, right.summary || left.summary), summary: summarizeThinking(detail, right.summary || left.summary),
detail: detail || undefined, detail: detail || undefined,
turnId: right.turnId ?? left.turnId, turnId: right.turnId ?? left.turnId,
@@ -136,8 +137,12 @@ export function appendProgressEntry(
const actualIndex = targetIndex >= 0 ? log.length - 1 - targetIndex : log.length - 1 const actualIndex = targetIndex >= 0 ? log.length - 1 - targetIndex : log.length - 1
const last = log[actualIndex] const last = log[actualIndex]
if (!last) return [normalized] if (!last) return [normalized]
// The seq guard only applies within the SAME stream: when the key was not
// found, `last` is an unrelated entry and a fresh stream legitimately
// restarts at seq 1 (per-iteration thinking/assistant streams).
if ( if (
normalizedKey normalizedKey
&& targetIndex >= 0
&& typeof last.seq === 'number' && typeof last.seq === 'number'
&& typeof normalized.seq === 'number' && typeof normalized.seq === 'number'
&& normalized.seq <= last.seq && normalized.seq <= last.seq
@@ -215,7 +215,7 @@ export interface KanbanTask {
// ── Progress Entry (per-task activity log) ────────────────────────────────── // ── Progress Entry (per-task activity log) ──────────────────────────────────
export type ProgressEntryType = export type ProgressEntryType =
| 'thinking' | 'tool_call' | 'autonomy' | 'handoff' | 'gate_result' | 'status_change' | 'thinking' | 'assistant' | 'tool_call' | 'autonomy' | 'handoff' | 'gate_result' | 'status_change'
| 'work_item_started' | 'gate_approved' | 'gate_rejected' | 'work_item_started' | 'gate_approved' | 'gate_rejected'
| 'awaiting_manager_review' | 'awaiting_human' | 'awaiting_review' | 'awaiting_peer' | 'awaiting_manager_review' | 'awaiting_human' | 'awaiting_review' | 'awaiting_peer'
| 'work_item_failed' | 'deadlock' | 'needs_input' | 'verification' | 'work_item_failed' | 'deadlock' | 'needs_input' | 'verification'
+10 -1
View File
@@ -230,6 +230,11 @@ def _transcript_message_hidden_from_ui(
) -> bool: ) -> bool:
metadata = dict(getattr(message, "metadata", {}) or {}) metadata = dict(getattr(message, "metadata", {}) or {})
kind = str(metadata.get("kind", "") or "").strip() kind = str(metadata.get("kind", "") or "").strip()
if metadata.get("company_final_turn"):
# The role's final reply of a company turn is the user-visible result
# (intake/aggregate turns have no engine-recorded result surface, so
# hiding this would drop the reply from the chat entirely).
return False
return detail_level != "full" and kind in _FULL_DETAIL_ONLY_TRANSCRIPT_KINDS return detail_level != "full" and kind in _FULL_DETAIL_ONLY_TRANSCRIPT_KINDS
@@ -1122,7 +1127,11 @@ def _transcript_item_to_ui_message(
"role": role, "role": role,
"task_id": task_id, "task_id": task_id,
"transcript_kind": kind, "transcript_kind": kind,
"detail_visibility": _transcript_message_visibility(kind), "detail_visibility": (
"summary"
if message_metadata.get("company_final_turn")
else _transcript_message_visibility(kind)
),
**({"type": "system"} if kind == "runtime_v2_user_turn" else {}), **({"type": "system"} if kind == "runtime_v2_user_turn" else {}),
**({"verification_verdict": verification_footer} if verification_footer else {}), **({"verification_verdict": verification_footer} if verification_footer else {}),
**({"runtime_thinking": runtime_thinking} if runtime_thinking else {}), **({"runtime_thinking": runtime_thinking} if runtime_thinking else {}),
+31 -9
View File
@@ -1691,6 +1691,12 @@ class WSHandler:
return return
entry["timestamp"] = time.time() entry["timestamp"] = time.time()
_add_execution_turn_aliases(entry, raw_task_id) _add_execution_turn_aliases(entry, raw_task_id)
# Buffer BEFORE broadcasting: broadcast awaits can interleave a
# session_detail read, and any entry a client has already seen must be
# visible in buffer∪DB or the snapshot will erase it from the live log.
buf = self._progress_buffer.setdefault(task_id, [])
buf.append(entry)
self._progress_project_ids[task_id] = pid
await self.broadcast({ await self.broadcast({
"type": "session_progress", "type": "session_progress",
"payload": { "payload": {
@@ -1711,10 +1717,9 @@ class WSHandler:
"entry": entry, "entry": entry,
}, },
}) })
buf = self._progress_buffer.setdefault(task_id, []) # Re-read the buffer: a concurrent flush during the broadcast awaits
buf.append(entry) # may have popped it, leaving `buf` as a stale detached list.
self._progress_project_ids[task_id] = pid if len(self._progress_buffer.get(task_id, [])) >= self._PROGRESS_FLUSH_THRESHOLD:
if len(buf) >= self._PROGRESS_FLUSH_THRESHOLD:
await self._flush_progress(task_id, project_id=pid) await self._flush_progress(task_id, project_id=pid)
if runtime_type in {"turn_completed", "turn_failed", "checkpoint_saved"}: if runtime_type in {"turn_completed", "turn_failed", "checkpoint_saved"}:
await self._sync_task_transcript_messages(task_id, engine=runtime_engine) await self._sync_task_transcript_messages(task_id, engine=runtime_engine)
@@ -2213,6 +2218,11 @@ class WSHandler:
if not entry.get("work_item_projection_title"): if not entry.get("work_item_projection_title"):
entry["work_item_projection_title"] = _role_label or None entry["work_item_projection_title"] = _role_label or None
_add_execution_turn_aliases(entry, raw_task_id or task_id) _add_execution_turn_aliases(entry, raw_task_id or task_id)
# Buffer BEFORE broadcasting: broadcast awaits can interleave a
# session_detail read, and any entry a client has already seen
# must be visible in buffer∪DB or the snapshot will erase it.
self._progress_buffer.setdefault(task_id, []).append(entry)
self._progress_project_ids[task_id] = pid
await self.broadcast({"type": "session_progress", "payload": { await self.broadcast({"type": "session_progress", "payload": {
"project_id": pid, "project_id": pid,
"task_id": task_id, "task_id": task_id,
@@ -2229,11 +2239,9 @@ class WSHandler:
"entry": entry, "entry": entry,
}}) }})
# ── Accumulate for persistence (flushed at threshold / task end) ── # ── Persist at threshold (re-read: a concurrent flush during the
buf = self._progress_buffer.setdefault(task_id, []) # broadcast awaits may have popped the buffer) ──
buf.append(entry) if len(self._progress_buffer.get(task_id, [])) >= self._PROGRESS_FLUSH_THRESHOLD:
self._progress_project_ids[task_id] = pid
if len(buf) >= self._PROGRESS_FLUSH_THRESHOLD:
await self._flush_progress(task_id, project_id=pid) await self._flush_progress(task_id, project_id=pid)
is_work_item_event = text.startswith("[Company:") is_work_item_event = text.startswith("[Company:")
@@ -2651,7 +2659,16 @@ class WSHandler:
entry_type = "work_item_started" entry_type = "work_item_started"
summary = f"Turn {payload.get('iteration', '?')} started" summary = f"Turn {payload.get('iteration', '?')} started"
elif runtime_type == "assistant_delta": elif runtime_type == "assistant_delta":
# Company mode only (task mode is filtered out above and already
# streams assistant text as the draft reply): surface the role's
# narration and final reply in its progress transcript, matching
# what external agents get via [External:*:result] parsing.
entry_type = "assistant"
detail = str(payload.get("text", "") or "")
if not detail.strip():
return None return None
preview = " ".join(detail.split())
summary = preview[:120].rstrip() + ("..." if len(preview) > 120 else "")
elif runtime_type == "member_idle": elif runtime_type == "member_idle":
return None return None
elif runtime_type == "thinking_delta": elif runtime_type == "thinking_delta":
@@ -5613,6 +5630,11 @@ class WSHandler:
} }
if "progress" in include_set or "work_items" in include_set or detail_level == "full": if "progress" in include_set or "work_items" in include_set or detail_level == "full":
try: try:
# Flush the in-memory progress buffer first: entries are
# broadcast to clients before they reach the DB, so a snapshot
# built from the DB alone would erase freshly streamed entries
# from the client's live log (visible as flickering rows).
await self._flush_progress(task_id, project_id=project_id)
progress_log = await self.chat_store.get_progress(task_id, project_id=project_id) progress_log = await self.chat_store.get_progress(task_id, project_id=project_id)
except Exception: except Exception:
progress_log = [] progress_log = []
+23 -1
View File
@@ -409,9 +409,31 @@ class NativeRuntimeV2Tests(unittest.IsolatedAsyncioTestCase):
self.assertEqual(metadata["execution_mode"], "company_mode") self.assertEqual(metadata["execution_mode"], "company_mode")
self.assertTrue(metadata["company_runtime_raw_turn"]) self.assertTrue(metadata["company_runtime_raw_turn"])
self.assertEqual(metadata["role_id"], "chao") self.assertEqual(metadata["role_id"], "chao")
self.assertEqual(metadata["ui_message_id"], "runtime-v2-company-assistant:ui-turn:company") # No tool calls ⇒ terminal iteration: flagged as the role's final
# reply and given its own UI row id so the id-keyed backfill merge
# cannot swallow it into the frozen shared-iteration row.
self.assertTrue(metadata["company_final_turn"])
self.assertEqual(metadata["ui_message_id"], "runtime-v2-company-assistant-final:ui-turn:company")
self.assertNotIn("visible_speaker", metadata) self.assertNotIn("visible_speaker", metadata)
await runtime._persist_assistant_turn(
task,
"中间轮叙述",
[{"id": "call-1", "function": "file_read", "arguments": {}}],
runtime_session_id="rt_company",
turn_id="ui-turn:company:iter:1",
conversation_turn_id="ui-turn:company",
iteration=1,
)
intermediate_metadata = memory.appended_messages[-1]["kwargs"]["metadata"]
self.assertEqual(intermediate_metadata["kind"], "runtime_v2_company_assistant")
self.assertNotIn("company_final_turn", intermediate_metadata)
self.assertEqual(
intermediate_metadata["ui_message_id"],
"runtime-v2-company-assistant:ui-turn:company",
)
async def test_task_mode_assistant_turn_with_company_defaults_stays_opc_task_reply(self) -> None: async def test_task_mode_assistant_turn_with_company_defaults_stays_opc_task_reply(self) -> None:
memory = _StubMemoryManager(_StubStore()) memory = _StubMemoryManager(_StubStore())
runtime = NativeRuntimeV2( runtime = NativeRuntimeV2(
+25 -2
View File
@@ -80,9 +80,32 @@ class WSHandlerProgressParsingTests(unittest.TestCase):
self.assertIsNone(entry) self.assertIsNone(entry)
def test_runtime_assistant_delta_is_not_recorded_as_progress_entry(self) -> None: def test_company_assistant_delta_becomes_assistant_progress_entry(self) -> None:
# Company mode surfaces the role's narration/final reply in its
# progress transcript (parity with external agents' [External:*:result]).
entry = WSHandler._runtime_event_to_progress_entry( entry = WSHandler._runtime_event_to_progress_entry(
{"type": "assistant_delta", "text": "final answer token"}, {
"type": "assistant_delta",
"text": "final answer token",
"execution_mode": "company_mode",
},
)
self.assertIsNotNone(entry)
assert entry is not None
self.assertEqual(entry["type"], "assistant")
self.assertEqual(entry["summary"], "final answer token")
self.assertEqual(entry["detail"], "final answer token")
def test_task_mode_assistant_delta_is_not_recorded_as_progress_entry(self) -> None:
# Task mode already streams the reply as the draft; a progress entry
# would duplicate it.
entry = WSHandler._runtime_event_to_progress_entry(
{
"type": "assistant_delta",
"text": "final answer token",
"execution_mode": "task_mode",
},
) )
self.assertIsNone(entry) self.assertIsNone(entry)