@clawos-dev/clawd 0.2.656 → 0.2.657

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.cjs CHANGED
@@ -74529,7 +74529,7 @@ function computeMethodAccess(args) {
74529
74529
  }
74530
74530
 
74531
74531
  // src/version.ts
74532
- var version = "0.2.656".length > 0 ? "0.2.656" : "dev";
74532
+ var version = "0.2.657".length > 0 ? "0.2.657" : "dev";
74533
74533
 
74534
74534
  // src/cli-probe/probe.ts
74535
74535
  var fs85 = __toESM(require("fs"), 1);
@@ -516,7 +516,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
516
516
  `)},EW=0,la=[];function IW(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),i=g.useState(EW++)[0],s=g.useState(M4)[0],o=g.useRef(e);g.useEffect(function(){o.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var v=GU([e.lockRef.current],(e.shards||[]).map(rk),!0).filter(Boolean);return v.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),v.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=g.useCallback(function(v,w){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!o.current.allowPinchZoom;var x=zd(v),_=n.current,b="deltaX"in v?v.deltaX:_[0]-x[0],S="deltaY"in v?v.deltaY:_[1]-x[1],C,k=v.target,T=Math.abs(b)>Math.abs(S)?"h":"v";if("touches"in v&&T==="h"&&k.type==="range")return!1;var I=window.getSelection(),D=I&&I.anchorNode,R=D?D===k||D.contains(k):!1;if(R)return!1;var j=tk(T,k);if(!j)return!0;if(j?C=T:(C=T==="v"?"h":"v",j=tk(T,k)),!j)return!1;if(!r.current&&"changedTouches"in v&&(b||S)&&(r.current=C),!C)return!0;var P=r.current||C;return SW(P,w,v,P==="h"?b:S)},[]),l=g.useCallback(function(v){var w=v;if(!(!la.length||la[la.length-1]!==s)){var x="deltaY"in w?nk(w):zd(w),_=t.current.filter(function(C){return C.name===w.type&&(C.target===w.target||w.target===C.shadowParent)&&kW(C.delta,x)})[0];if(_&&_.should){w.cancelable&&w.preventDefault();return}if(!_){var b=(o.current.shards||[]).map(rk).filter(Boolean).filter(function(C){return C.contains(w.target)}),S=b.length>0?a(w,b[0]):!o.current.noIsolation;S&&w.cancelable&&w.preventDefault()}}},[]),c=g.useCallback(function(v,w,x,_){var b={name:v,delta:w,target:x,should:_,shadowParent:TW(x)};t.current.push(b),setTimeout(function(){t.current=t.current.filter(function(S){return S!==b})},1)},[]),u=g.useCallback(function(v){n.current=zd(v),r.current=void 0},[]),d=g.useCallback(function(v){c(v.type,nk(v),v.target,a(v,e.lockRef.current))},[]),f=g.useCallback(function(v){c(v.type,zd(v),v.target,a(v,e.lockRef.current))},[]);g.useEffect(function(){return la.push(s),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,aa),document.addEventListener("touchmove",l,aa),document.addEventListener("touchstart",u,aa),function(){la=la.filter(function(v){return v!==s}),document.removeEventListener("wheel",l,aa),document.removeEventListener("touchmove",l,aa),document.removeEventListener("touchstart",u,aa)}},[]);var p=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(s,{styles:CW(i)}):null,p?g.createElement(gW,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function TW(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const NW=rW(A4,IW);var Uy=g.forwardRef(function(e,t){return g.createElement(Up,ci({},e,{ref:t,sideCar:NW}))});Uy.classNames=Up.classNames;var Vv=["Enter"," "],RW=["ArrowDown","PageUp","Home"],O4=["ArrowUp","PageDown","End"],PW=[...RW,...O4],AW={ltr:[...Vv,"ArrowRight"],rtl:[...Vv,"ArrowLeft"]},MW={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Fu="Menu",[mu,LW,jW]=V5(Fu),[Go,B4]=Ko(Fu,[jW,Hp,S4]),Hu=Hp(),z4=S4(),[$4,Js]=Go(Fu),[DW,Uu]=Go(Fu),F4=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,a=Hu(t),[l,c]=g.useState(null),u=g.useRef(!1),d=_i(s),f=K5(i);return g.useEffect(()=>{const p=()=>{u.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>u.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),h.jsx(Fy,{...a,children:h.jsx($4,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:h.jsx(DW,{scope:t,onClose:g.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};F4.displayName=Fu;var OW="MenuAnchor",Wy=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Hu(n);return h.jsx(y4,{...i,...r,ref:t})});Wy.displayName=OW;var qy="MenuPortal",[BW,H4]=Go(qy,{forceMount:void 0}),U4=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=Js(qy,t);return h.jsx(BW,{scope:t,forceMount:n,children:h.jsx(ns,{present:n||s.open,children:h.jsx(Hy,{asChild:!0,container:i,children:r})})})};U4.displayName=qy;var Tr="MenuContent",[zW,Vy]=Go(Tr),W4=g.forwardRef((e,t)=>{const n=H4(Tr,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Js(Tr,e.__scopeMenu),o=Uu(Tr,e.__scopeMenu);return h.jsx(mu.Provider,{scope:e.__scopeMenu,children:h.jsx(ns,{present:r||s.open,children:h.jsx(mu.Slot,{scope:e.__scopeMenu,children:o.modal?h.jsx($W,{...i,ref:t}):h.jsx(FW,{...i,ref:t})})})})}),$W=g.forwardRef((e,t)=>{const n=Js(Tr,e.__scopeMenu),r=g.useRef(null),i=Qt(t,r);return g.useEffect(()=>{const s=r.current;if(s)return N4(s)},[]),h.jsx(Ky,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Le(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),FW=g.forwardRef((e,t)=>{const n=Js(Tr,e.__scopeMenu);return h.jsx(Ky,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),HW=fu("MenuContent.ScrollLock"),Ky=g.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...v}=e,w=Js(Tr,n),x=Uu(Tr,n),_=Hu(n),b=z4(n),S=LW(n),[C,k]=g.useState(null),T=g.useRef(null),I=Qt(t,T,w.onContentChange),D=g.useRef(0),R=g.useRef(""),j=g.useRef(0),P=g.useRef(null),A=g.useRef("right"),M=g.useRef(0),L=m?Uy:g.Fragment,$=m?{as:HW,allowPinchZoom:!0}:void 0,F=B=>{var me,Ie;const E=R.current+B,U=S().filter(ue=>!ue.disabled),q=document.activeElement,O=(me=U.find(ue=>ue.ref.current===q))==null?void 0:me.textValue,te=U.map(ue=>ue.textValue),se=eq(te,E,O),G=(Ie=U.find(ue=>ue.textValue===se))==null?void 0:Ie.ref.current;(function ue(Ae){R.current=Ae,window.clearTimeout(D.current),Ae!==""&&(D.current=window.setTimeout(()=>ue(""),1e3))})(E),G&&setTimeout(()=>G.focus())};g.useEffect(()=>()=>window.clearTimeout(D.current),[]),X5();const z=g.useCallback(B=>{var U,q;return A.current===((U=P.current)==null?void 0:U.side)&&nq(B,(q=P.current)==null?void 0:q.area)},[]);return h.jsx(zW,{scope:n,searchRef:R,onItemEnter:g.useCallback(B=>{z(B)&&B.preventDefault()},[z]),onItemLeave:g.useCallback(B=>{var E;z(B)||((E=T.current)==null||E.focus(),k(null))},[z]),onTriggerLeave:g.useCallback(B=>{z(B)&&B.preventDefault()},[z]),pointerGraceTimerRef:j,onPointerGraceIntentChange:g.useCallback(B=>{P.current=B},[]),children:h.jsx(L,{...$,children:h.jsx(Ay,{asChild:!0,trapped:i,onMountAutoFocus:Le(s,B=>{var E;B.preventDefault(),(E=T.current)==null||E.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:h.jsx(Op,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:h.jsx(UU,{asChild:!0,...b,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:k,onEntryFocus:Le(l,B=>{x.isUsingKeyboardRef.current||B.preventDefault()}),preventScrollOnEntryFocus:!0,children:h.jsx(_4,{role:"menu","aria-orientation":"vertical","data-state":a3(w.open),"data-radix-menu-content":"",dir:x.dir,..._,...v,ref:I,style:{outline:"none",...v.style},onKeyDown:Le(v.onKeyDown,B=>{const U=B.target.closest("[data-radix-menu-content]")===B.currentTarget,q=B.ctrlKey||B.altKey||B.metaKey,O=B.key.length===1;U&&(B.key==="Tab"&&B.preventDefault(),!q&&O&&F(B.key));const te=T.current;if(B.target!==te||!PW.includes(B.key))return;B.preventDefault();const G=S().filter(me=>!me.disabled).map(me=>me.ref.current);O4.includes(B.key)&&G.reverse(),QW(G)}),onBlur:Le(e.onBlur,B=>{B.currentTarget.contains(B.target)||(window.clearTimeout(D.current),R.current="")}),onPointerMove:Le(e.onPointerMove,gu(B=>{const E=B.target,U=M.current!==B.clientX;if(B.currentTarget.contains(E)&&U){const q=B.clientX>M.current?"right":"left";A.current=q,M.current=B.clientX}}))})})})})})})});W4.displayName=Tr;var UW="MenuGroup",Gy=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Mt.div,{role:"group",...r,ref:t})});Gy.displayName=UW;var WW="MenuLabel",q4=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Mt.div,{...r,ref:t})});q4.displayName=WW;var Af="MenuItem",ik="menu.itemSelect",Wp=g.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=g.useRef(null),o=Uu(Af,e.__scopeMenu),a=Vy(Af,e.__scopeMenu),l=Qt(t,s),c=g.useRef(!1),u=()=>{const d=s.current;if(!n&&d){const f=new CustomEvent(ik,{bubbles:!0,cancelable:!0});d.addEventListener(ik,p=>r==null?void 0:r(p),{once:!0}),q5(d,f),f.defaultPrevented?c.current=!1:o.onClose()}};return h.jsx(V4,{...i,ref:l,disabled:n,onClick:Le(e.onClick,u),onPointerDown:d=>{var f;(f=e.onPointerDown)==null||f.call(e,d),c.current=!0},onPointerUp:Le(e.onPointerUp,d=>{var f;c.current||(f=d.currentTarget)==null||f.click()}),onKeyDown:Le(e.onKeyDown,d=>{const f=a.searchRef.current!=="";n||f&&d.key===" "||Vv.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});Wp.displayName=Af;var V4=g.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=Vy(Af,n),a=z4(n),l=g.useRef(null),c=Qt(t,l),[u,d]=g.useState(!1),[f,p]=g.useState("");return g.useEffect(()=>{const m=l.current;m&&p((m.textContent??"").trim())},[s.children]),h.jsx(mu.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:h.jsx(WU,{asChild:!0,...a,focusable:!r,children:h.jsx(Mt.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:Le(e.onPointerMove,gu(m=>{r?o.onItemLeave(m):(o.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Le(e.onPointerLeave,gu(m=>o.onItemLeave(m))),onFocus:Le(e.onFocus,()=>d(!0)),onBlur:Le(e.onBlur,()=>d(!1))})})})}),qW="MenuCheckboxItem",K4=g.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return h.jsx(Q4,{scope:e.__scopeMenu,checked:n,children:h.jsx(Wp,{role:"menuitemcheckbox","aria-checked":Mf(n)?"mixed":n,...i,ref:t,"data-state":Zy(n),onSelect:Le(i.onSelect,()=>r==null?void 0:r(Mf(n)?!0:!n),{checkForDefaultPrevented:!1})})})});K4.displayName=qW;var G4="MenuRadioGroup",[VW,KW]=Go(G4,{value:void 0,onValueChange:()=>{}}),Y4=g.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=_i(r);return h.jsx(VW,{scope:e.__scopeMenu,value:n,onValueChange:s,children:h.jsx(Gy,{...i,ref:t})})});Y4.displayName=G4;var X4="MenuRadioItem",Z4=g.forwardRef((e,t)=>{const{value:n,...r}=e,i=KW(X4,e.__scopeMenu),s=n===i.value;return h.jsx(Q4,{scope:e.__scopeMenu,checked:s,children:h.jsx(Wp,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":Zy(s),onSelect:Le(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});Z4.displayName=X4;var Yy="MenuItemIndicator",[Q4,GW]=Go(Yy,{checked:!1}),J4=g.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=GW(Yy,n);return h.jsx(ns,{present:r||Mf(s.checked)||s.checked===!0,children:h.jsx(Mt.span,{...i,ref:t,"data-state":Zy(s.checked)})})});J4.displayName=Yy;var YW="MenuSeparator",e3=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(Mt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});e3.displayName=YW;var XW="MenuArrow",t3=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Hu(n);return h.jsx(b4,{...i,...r,ref:t})});t3.displayName=XW;var Xy="MenuSub",[ZW,n3]=Go(Xy),r3=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,s=Js(Xy,t),o=Hu(t),[a,l]=g.useState(null),[c,u]=g.useState(null),d=_i(i);return g.useEffect(()=>(s.open===!1&&d(!1),()=>d(!1)),[s.open,d]),h.jsx(Fy,{...o,children:h.jsx($4,{scope:t,open:r,onOpenChange:d,content:c,onContentChange:u,children:h.jsx(ZW,{scope:t,contentId:Fi(),triggerId:Fi(),trigger:a,onTriggerChange:l,children:n})})})};r3.displayName=Xy;var mc="MenuSubTrigger",i3=g.forwardRef((e,t)=>{const n=Js(mc,e.__scopeMenu),r=Uu(mc,e.__scopeMenu),i=n3(mc,e.__scopeMenu),s=Vy(mc,e.__scopeMenu),o=g.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,c={__scopeMenu:e.__scopeMenu},u=g.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return g.useEffect(()=>u,[u]),g.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),h.jsx(Wy,{asChild:!0,...c,children:h.jsx(V4,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":a3(n.open),...e,ref:Ou(t,i.onTriggerChange),onClick:d=>{var f;(f=e.onClick)==null||f.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Le(e.onPointerMove,gu(d=>{s.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:Le(e.onPointerLeave,gu(d=>{var p,m;u();const f=(p=n.content)==null?void 0:p.getBoundingClientRect();if(f){const v=(m=n.content)==null?void 0:m.dataset.side,w=v==="right",x=w?-5:5,_=f[w?"left":"right"],b=f[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+x,y:d.clientY},{x:_,y:f.top},{x:b,y:f.top},{x:b,y:f.bottom},{x:_,y:f.bottom}],side:v}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(d),d.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:Le(e.onKeyDown,d=>{var p;const f=s.searchRef.current!=="";e.disabled||f&&d.key===" "||AW[r.dir].includes(d.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),d.preventDefault())})})})});i3.displayName=mc;var s3="MenuSubContent",o3=g.forwardRef((e,t)=>{const n=H4(Tr,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Js(Tr,e.__scopeMenu),o=Uu(Tr,e.__scopeMenu),a=n3(s3,e.__scopeMenu),l=g.useRef(null),c=Qt(t,l);return h.jsx(mu.Provider,{scope:e.__scopeMenu,children:h.jsx(ns,{present:r||s.open,children:h.jsx(mu.Slot,{scope:e.__scopeMenu,children:h.jsx(Ky,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:c,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var d;o.isUsingKeyboardRef.current&&((d=l.current)==null||d.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Le(e.onFocusOutside,u=>{u.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Le(e.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:Le(e.onKeyDown,u=>{var p;const d=u.currentTarget.contains(u.target),f=MW[o.dir].includes(u.key);d&&f&&(s.onOpenChange(!1),(p=a.trigger)==null||p.focus(),u.preventDefault())})})})})})});o3.displayName=s3;function a3(e){return e?"open":"closed"}function Mf(e){return e==="indeterminate"}function Zy(e){return Mf(e)?"indeterminate":e?"checked":"unchecked"}function QW(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function JW(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function eq(e,t,n){const i=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let o=JW(e,Math.max(s,0));i.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function tq(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s],l=t[o],c=a.x,u=a.y,d=l.x,f=l.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(i=!i)}return i}function nq(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return tq(n,t)}function gu(e){return t=>t.pointerType==="mouse"?e(t):void 0}var rq=F4,iq=Wy,sq=U4,oq=W4,aq=Gy,lq=q4,cq=Wp,uq=K4,dq=Y4,hq=Z4,fq=J4,pq=e3,mq=t3,gq=r3,vq=i3,xq=o3,qp="DropdownMenu",[yq]=Ko(qp,[B4]),Tn=B4(),[_q,l3]=yq(qp),c3=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,l=Tn(t),c=g.useRef(null),[u,d]=Bu({prop:i,defaultProp:s??!1,onChange:o,caller:qp});return h.jsx(_q,{scope:t,triggerId:Fi(),triggerRef:c,contentId:Fi(),open:u,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(f=>!f),[d]),modal:a,children:h.jsx(rq,{...l,open:u,onOpenChange:d,dir:r,modal:a,children:n})})};c3.displayName=qp;var u3="DropdownMenuTrigger",d3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,s=l3(u3,n),o=Tn(n);return h.jsx(iq,{asChild:!0,...o,children:h.jsx(Mt.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:Ou(t,s.triggerRef),onPointerDown:Le(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:Le(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});d3.displayName=u3;var bq="DropdownMenuPortal",h3=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Tn(t);return h.jsx(sq,{...r,...n})};h3.displayName=bq;var f3="DropdownMenuContent",p3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=l3(f3,n),s=Tn(n),o=g.useRef(!1);return h.jsx(oq,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:t,onCloseAutoFocus:Le(e.onCloseAutoFocus,a=>{var l;o.current||(l=i.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:Le(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!i.modal||u)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});p3.displayName=f3;var wq="DropdownMenuGroup",Sq=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(aq,{...i,...r,ref:t})});Sq.displayName=wq;var kq="DropdownMenuLabel",m3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(lq,{...i,...r,ref:t})});m3.displayName=kq;var Cq="DropdownMenuItem",g3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(cq,{...i,...r,ref:t})});g3.displayName=Cq;var Eq="DropdownMenuCheckboxItem",v3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(uq,{...i,...r,ref:t})});v3.displayName=Eq;var Iq="DropdownMenuRadioGroup",Tq=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(dq,{...i,...r,ref:t})});Tq.displayName=Iq;var Nq="DropdownMenuRadioItem",Rq=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(hq,{...i,...r,ref:t})});Rq.displayName=Nq;var Pq="DropdownMenuItemIndicator",x3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(fq,{...i,...r,ref:t})});x3.displayName=Pq;var Aq="DropdownMenuSeparator",y3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(pq,{...i,...r,ref:t})});y3.displayName=Aq;var Mq="DropdownMenuArrow",Lq=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(mq,{...i,...r,ref:t})});Lq.displayName=Mq;var jq=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:s}=e,o=Tn(t),[a,l]=Bu({prop:r,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return h.jsx(gq,{...o,open:a,onOpenChange:l,children:n})},Dq="DropdownMenuSubTrigger",_3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(vq,{...i,...r,ref:t})});_3.displayName=Dq;var Oq="DropdownMenuSubContent",b3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tn(n);return h.jsx(xq,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});b3.displayName=Oq;var Bq=c3,zq=d3,w3=h3,S3=p3,k3=m3,C3=g3,E3=v3,$q=x3,I3=y3,Fq=jq,T3=_3,N3=b3;const R3=Bq,P3=zq,Qy=g.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx(w3,{children:h.jsx(S3,{ref:r,sideOffset:t,className:re("z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-elevated p-1","text-text-100 shadow-md",e),...n})}));Qy.displayName=S3.displayName;const Hq=Fq,A3=g.forwardRef(({className:e,...t},n)=>h.jsx(T3,{ref:n,className:re("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none","focus:bg-bg-200 focus:text-text-100 data-[highlighted]:bg-bg-200 data-[highlighted]:text-text-100 data-[state=open]:bg-bg-200","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t}));A3.displayName=T3.displayName;const M3=g.forwardRef(({className:e,...t},n)=>h.jsx(w3,{children:h.jsx(N3,{ref:n,className:re("z-50 min-w-[6rem] overflow-hidden rounded-md border border-border bg-elevated p-1","text-text-100 shadow-md",e),...t})}));M3.displayName=N3.displayName;const mo=g.forwardRef(({className:e,inset:t,...n},r)=>h.jsx(C3,{ref:r,className:re("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none","focus:bg-bg-200 focus:text-text-100 data-[highlighted]:bg-bg-200 data-[highlighted]:text-text-100","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));mo.displayName=C3.displayName;const Uq=g.forwardRef(({className:e,children:t,checked:n,...r},i)=>h.jsxs(E3,{ref:i,checked:n,className:re("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-7 pr-2 text-sm outline-none","focus:bg-bg-200 focus:text-text-100 data-[highlighted]:bg-bg-200 data-[highlighted]:text-text-100","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx($q,{children:h.jsx(Du,{className:"h-3.5 w-3.5"})})}),t]}));Uq.displayName=E3.displayName;const Jy=g.forwardRef(({className:e,...t},n)=>h.jsx(I3,{ref:n,className:re("-mx-1 my-1 h-px bg-border",e),...t}));Jy.displayName=I3.displayName;const L3=g.forwardRef(({className:e,...t},n)=>h.jsx(k3,{ref:n,className:re("px-2 py-1.5 text-xs font-semibold text-text-400",e),...t}));L3.displayName=k3.displayName;function Wq({tool:e,className:t}){const n=OF(e);return h.jsx("span",{"data-testid":n?`session-icon-${e}`:"session-icon-default","aria-label":n?Ry(e):"未知引擎",className:re("w-3.5 h-3.5 shrink-0 inline-flex items-center justify-center",Dp(e),t),children:h.jsx(jp,{tool:e,className:"w-full h-full"})})}function qq({sessionId:e,hasUnread:t,running:n=!1,awaitingUser:r=!1,style:i}){return r?h.jsx(a$,{"data-testid":`awaiting-dot-${e}`,style:i,className:"w-3 h-3 text-warning shrink-0 animate-pulse",strokeWidth:2.25,"aria-label":"awaiting user"}):t?h.jsx("span",{"data-testid":`unread-dot-${e}`,style:i,className:"w-2 h-2 rounded-full bg-error shrink-0","aria-label":"unread"}):n?h.jsx("span",{"data-testid":`running-dot-${e}`,style:i,className:"w-2 h-2 rounded-full bg-success shrink-0 animate-pulse","aria-label":"running"}):null}function j3(e){return e.compositionActive||!!e.nativeIsComposing||e.keyCode===229}function D3(e){return e.key==="Enter"&&!e.shiftKey&&!j3(e)}function Wu(e,t){const n=g.useRef(!1),r=g.useCallback(()=>{n.current=!0},[]),i=g.useCallback(()=>{setTimeout(()=>{n.current=!1},0)},[]);return{onKeyDown:g.useCallback(o=>{const a=o.nativeEvent;if(D3({key:o.key,shiftKey:o.shiftKey,compositionActive:n.current,nativeIsComposing:a.isComposing,keyCode:a.keyCode})){o.preventDefault(),e();return}t&&o.key==="Escape"&&(o.preventDefault(),t())},[e,t]),onCompositionStart:r,onCompositionEnd:i}}function Vq({open:e,initialLabel:t,placeholder:n,onSubmit:r,onCancel:i,title:s="Edit session",fieldLabel:o="Label",testId:a="session-edit-dialog",requireNonEmpty:l=!1}){const[c,u]=g.useState(t);g.useEffect(()=>{e&&u(t)},[e,t]);const d=c.trim(),f=l&&d==="",p=()=>{f||r({label:d})},m=Wu(p,i);return e?wl.createPortal(h.jsx("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-bg-0/40 backdrop-blur-[2px]",onClick:i,"data-testid":`${a}-overlay`,children:h.jsxs("div",{"data-testid":a,className:"w-[420px] max-w-[calc(100vw-32px)] rounded-2xl border border-text-100/[0.12] flex flex-col gap-4 p-5",style:{backgroundColor:"var(--bg-0)",boxShadow:"0 12px 40px rgba(0,0,0,0.04)"},onClick:v=>v.stopPropagation(),children:[h.jsx("div",{className:"text-[15px] font-semibold text-text-100",children:s}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-[12px] font-semibold text-text-200 mb-1",children:o}),h.jsx("input",{autoFocus:!0,type:"text",value:c,onChange:v=>u(v.target.value),...m,placeholder:n,"data-testid":`${a}-label`,className:"w-full px-3 py-2 text-[13px] bg-bg-50 border border-bg-300 rounded-lg focus:outline-none focus:border-text-300 transition-colors"})]}),h.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[h.jsx("button",{type:"button",onClick:i,className:"px-4 py-1.5 text-[12px] text-text-300 rounded-lg hover:bg-text-100/5 transition-colors cursor-pointer",children:"Cancel"}),h.jsx("button",{type:"button",onClick:p,disabled:f,"data-testid":`${a}-save`,className:"px-4 py-1.5 text-[12px] font-medium text-bg-0 rounded-lg bg-text-100 hover:bg-text-200 transition-colors cursor-pointer disabled:cursor-not-allowed disabled:opacity-40",children:"Save"})]})]})}),document.body):null}var Kq=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Gq="VisuallyHidden",O3=g.forwardRef((e,t)=>h.jsx(Mt.span,{...e,ref:t,style:{...Kq,...e.style}}));O3.displayName=Gq;var Yq=O3,[Vp]=Ko("Tooltip",[Hp]),Kp=Hp(),B3="TooltipProvider",Xq=700,Kv="tooltip.open",[Zq,e_]=Vp(B3),z3=e=>{const{__scopeTooltip:t,delayDuration:n=Xq,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,o=g.useRef(!0),a=g.useRef(!1),l=g.useRef(0);return g.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),h.jsx(Zq,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:g.useCallback(()=>{window.clearTimeout(l.current),o.current=!1},[]),onClose:g.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:g.useCallback(c=>{a.current=c},[]),disableHoverableContent:i,children:s})};z3.displayName=B3;var vu="Tooltip",[Qq,Gp]=Vp(vu),$3=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=e,l=e_(vu,e.__scopeTooltip),c=Kp(t),[u,d]=g.useState(null),f=Fi(),p=g.useRef(0),m=o??l.disableHoverableContent,v=a??l.delayDuration,w=g.useRef(!1),[x,_]=Bu({prop:r,defaultProp:i??!1,onChange:T=>{T?(l.onOpen(),document.dispatchEvent(new CustomEvent(Kv))):l.onClose(),s==null||s(T)},caller:vu}),b=g.useMemo(()=>x?w.current?"delayed-open":"instant-open":"closed",[x]),S=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w.current=!1,_(!0)},[_]),C=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),k=g.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{w.current=!0,_(!0),p.current=0},v)},[v,_]);return g.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),h.jsx(Fy,{...c,children:h.jsx(Qq,{scope:t,contentId:f,open:x,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:g.useCallback(()=>{l.isOpenDelayedRef.current?k():S()},[l.isOpenDelayedRef,k,S]),onTriggerLeave:g.useCallback(()=>{m?C():(window.clearTimeout(p.current),p.current=0)},[C,m]),onOpen:S,onClose:C,disableHoverableContent:m,children:n})})};$3.displayName=vu;var Gv="TooltipTrigger",F3=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Gp(Gv,n),s=e_(Gv,n),o=Kp(n),a=g.useRef(null),l=Qt(t,a,i.onTriggerChange),c=g.useRef(!1),u=g.useRef(!1),d=g.useCallback(()=>c.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),h.jsx(y4,{asChild:!0,...o,children:h.jsx(Mt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:Le(e.onPointerMove,f=>{f.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:Le(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:Le(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Le(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Le(e.onBlur,i.onClose),onClick:Le(e.onClick,i.onClose)})})});F3.displayName=Gv;var Jq="TooltipPortal",[tue,eV]=Vp(Jq,{forceMount:void 0}),al="TooltipContent",H3=g.forwardRef((e,t)=>{const n=eV(al,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=Gp(al,e.__scopeTooltip);return h.jsx(ns,{present:r||o.open,children:o.disableHoverableContent?h.jsx(U3,{side:i,...s,ref:t}):h.jsx(tV,{side:i,...s,ref:t})})}),tV=g.forwardRef((e,t)=>{const n=Gp(al,e.__scopeTooltip),r=e_(al,e.__scopeTooltip),i=g.useRef(null),s=Qt(t,i),[o,a]=g.useState(null),{trigger:l,onClose:c}=n,u=i.current,{onPointerInTransitChange:d}=r,f=g.useCallback(()=>{a(null),d(!1)},[d]),p=g.useCallback((m,v)=>{const w=m.currentTarget,x={x:m.clientX,y:m.clientY},_=oV(x,w.getBoundingClientRect()),b=aV(x,_),S=lV(v.getBoundingClientRect()),C=uV([...b,...S]);a(C),d(!0)},[d]);return g.useEffect(()=>()=>f(),[f]),g.useEffect(()=>{if(l&&u){const m=w=>p(w,u),v=w=>p(w,l);return l.addEventListener("pointerleave",m),u.addEventListener("pointerleave",v),()=>{l.removeEventListener("pointerleave",m),u.removeEventListener("pointerleave",v)}}},[l,u,p,f]),g.useEffect(()=>{if(o){const m=v=>{const w=v.target,x={x:v.clientX,y:v.clientY},_=(l==null?void 0:l.contains(w))||(u==null?void 0:u.contains(w)),b=!cV(x,o);_?f():b&&(f(),c())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[l,u,o,c,f]),h.jsx(U3,{...e,ref:s})}),[nV,rV]=Vp(vu,{isInside:!1}),iV=KF("TooltipContent"),U3=g.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=e,l=Gp(al,n),c=Kp(n),{onClose:u}=l;return g.useEffect(()=>(document.addEventListener(Kv,u),()=>document.removeEventListener(Kv,u)),[u]),g.useEffect(()=>{if(l.trigger){const d=f=>{const p=f.target;p!=null&&p.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),h.jsx(Op,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:h.jsxs(_4,{"data-state":l.stateAttribute,...c,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[h.jsx(iV,{children:r}),h.jsx(nV,{scope:n,isInside:!0,children:h.jsx(Yq,{id:l.contentId,role:"tooltip",children:i||r})})]})})});H3.displayName=al;var W3="TooltipArrow",sV=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Kp(n);return rV(W3,n).isInside?null:h.jsx(b4,{...i,...r,ref:t})});sV.displayName=W3;function oV(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function aV(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function lV(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function cV(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s],l=t[o],c=a.x,u=a.y,d=l.x,f=l.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(i=!i)}return i}function uV(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),dV(t)}function dV(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var hV=z3,fV=$3,pV=F3,q3=H3;const xu=hV,qu=fV,Vu=pV,Al=g.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx(q3,{ref:r,sideOffset:t,className:re("z-50 overflow-hidden rounded-sm border border-border bg-bg-0 px-2 py-1 text-xs text-text-300 shadow-md",e),...n}));Al.displayName=q3.displayName;const mV={held:!1,indexBySessionId:new Map},gV=g.createContext(mV);function vV(){return g.useContext(gV)}const xV=Array.from({length:9},(e,t)=>({id:`switch-session-${t+1}`,combo:{key:String(t+1),mod:!0},label:`切换到第 ${t+1} 个会话`,group:"会话",desktopOnly:!0,hiddenInList:!0})),yV=[{id:"new-session",combo:{key:"n",mod:!0},label:"新建任务",description:"打开快捷新建弹窗",group:"通用",desktopOnly:!0},{id:"open-search",combo:{key:"k",mod:!0},label:"全局搜索",description:"搜会话内容 / persona / 联系人",group:"通用",desktopOnly:!0},{id:"search-tab-prev",combo:{key:"ArrowLeft",mod:!0},label:"搜索:上一组",description:"搜索浮层里切到左边那个 tab(会话 / persona / 联系人)",group:"通用"},{id:"search-tab-next",combo:{key:"ArrowRight",mod:!0},label:"搜索:下一组",description:"搜索浮层里切到右边那个 tab",group:"通用"},...xV,{id:"archive-session",combo:{key:"Backspace",mod:!0,shift:!0},label:"归档当前会话",description:"归档当前聊天区的会话,Enter 确认 / Esc 取消",group:"会话",desktopOnly:!0},{id:"tab-prev",combo:{key:"ArrowLeft",mod:!0,shift:!0},label:"上一个标签页",description:"连按快速移动,停下或松开修饰键后切换",group:"标签页"},{id:"tab-next",combo:{key:"ArrowRight",mod:!0,shift:!0},label:"下一个标签页",description:"连按快速移动,停下或松开修饰键后切换",group:"标签页"},{id:"toggle-hive",combo:{key:"h",mod:!0,shift:!0},label:"Hive 看板",description:"全屏看所有 agent 在干什么;Esc 或点任意行退出",group:"通用"},{id:"send-message",combo:{key:"Enter"},label:"发送消息",description:"在输入框中发送当前内容",group:"输入",displayOnly:!0},{id:"newline",combo:{key:"Enter",shift:!0},label:"换行",description:"在输入框中插入换行",group:"输入",displayOnly:!0},{id:"interrupt",combo:{key:"Escape"},label:"打断回复",description:"打断当前回复;2 秒内按两次停止任务",group:"输入",displayOnly:!0}];yV.filter(e=>!e.displayOnly);function _V(){return/Mac|iP(hone|od|ad)/.test(navigator.platform)}const bV=10,wV=20,SV=16,sk=20,ok=60,kV=4;function $d({testId:e,label:t,children:n}){return h.jsxs(qu,{children:[h.jsx(Vu,{asChild:!0,children:h.jsx("span",{"data-testid":e,role:"img","aria-label":t,tabIndex:0,className:"inline-flex shrink-0",children:n})}),h.jsx(Al,{side:"bottom",children:t})]})}function CV({session:e,active:t,hasUnread:n,running:r=!1,awaitingUser:i=!1,onSelect:s,onEdit:o,onDelete:a,onPin:l,onArchive:c,quickAction:u,depth:d=0,chevron:f,showCopyResume:p=!0,contactDisplayName:m,ownerPrincipalId:v,creatorDisplayName:w,dispatchedFromSessionTitle:x}){const[_,b]=g.useState(!1),S=vV(),C=S.held?S.indexBySessionId.get(e.sessionId):void 0,k=!!e.pinnedAt,T=d===0,I=d===0&&!!c,D=bV+d*wV;let R=null;u==="pin"&&T&&l?R={icon:k?h.jsx(wS,{className:"w-4 h-4"}):h.jsx(SS,{className:"w-4 h-4"}),label:k?"取消置顶":"置顶",run:()=>l(e.sessionId,!k)}:u==="archive"&&I&&c?R={icon:h.jsx(yS,{className:"w-4 h-4"}),label:"归档",run:()=>c(e.sessionId,!0)}:u==="rename"&&o&&(R={icon:h.jsx(Ov,{className:"w-4 h-4"}),label:"重命名",run:()=>b(!0)});const j=g.useCallback(async()=>{const $=U5(e);if($)try{await navigator.clipboard.writeText($)}catch{}},[e]),P=Py(e),A=e.originOwnerPrincipalId,M=A?`@${m??`…${A.slice(-8)}`}`:null,L=!!(e.ownerPersonaId&&v&&e.creatorPrincipalId&&e.creatorPrincipalId!==v&&!e.larkChatId&&!e.shiftFiredFromSessionId&&!e.dispatchedFromSessionId);return h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-testid":`session-item-${e.sessionId}`,onClick:s,style:{paddingLeft:D,display:"grid",gridTemplateColumns:f?`${SV}px ${sk}px 1fr auto ${ok}px`:`${sk}px 1fr auto ${ok}px`,gridTemplateAreas:f?'"chev icon name dot time"':'"icon name dot time"',columnGap:`${kV}px`,alignItems:"center"},className:re("group relative rounded-lg cursor-pointer transition-all duration-150 pr-2.5 py-1.5",t?"bg-accent-dim":"hover:bg-sidebar-hover-bg"),children:[t?h.jsx("span",{"aria-hidden":"true",className:"absolute left-0 top-1/2 -translate-y-1/2 w-[3px] h-7 rounded-r-full bg-accent"}):null,h.jsx("div",{style:{gridArea:"chev"},className:"flex items-center justify-center",children:f??null}),h.jsx("div",{style:{gridArea:"icon"},className:"flex items-center justify-center",children:h.jsx(Wq,{tool:e.tool})}),h.jsxs("div",{style:{gridArea:"name"},className:"flex items-center gap-1 min-w-0",children:[h.jsxs(xu,{delayDuration:200,skipDelayDuration:100,children:[e.dispatchedFromSessionId?h.jsx($d,{testId:`dispatched-icon-${e.sessionId}`,label:`来自【${x??"另一会话"}】dispatch`,children:h.jsx(R$,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null,e.shiftFiredFromSessionId?h.jsx($d,{testId:`shift-fired-icon-${e.sessionId}`,label:"定时任务",children:h.jsx(Qz,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null,e.larkChatId?h.jsx($d,{testId:`lark-chat-icon-${e.sessionId}`,label:e.larkChatType==="p2p"?"来自飞书DM":"来自飞书群",children:h.jsx(s7,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null,L?h.jsx($d,{testId:`guest-created-icon-${e.sessionId}`,label:w?`${w}创建`:"其他人创建",children:h.jsx($7,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null]}),h.jsx("span",{"data-testid":`session-title-${e.sessionId}`,className:re("text-[13px] truncate min-w-0","group-hover:whitespace-normal group-hover:overflow-visible group-hover:break-words",t?"text-text-100 font-medium":"text-text-200"),children:P}),M?h.jsx("span",{"data-testid":`session-mirror-chip-${e.sessionId}`,title:`在 ${M.replace(/^@/,"")} 的设备上`,className:"shrink-0 inline-flex items-center px-1.5 py-0 rounded text-[10px] bg-accent-dim/40 text-accent border border-accent/20 max-w-[120px] truncate",children:M}):null]}),h.jsx(qq,{sessionId:e.sessionId,hasUnread:n,running:r,awaitingUser:i,style:{gridArea:"dot"}}),C!=null?h.jsx("span",{style:{gridArea:"time"},"data-testid":`session-quick-switch-badge-${e.sessionId}`,className:"text-right shrink-0 transition-opacity duration-150 group-hover:opacity-0",children:h.jsx("span",{className:"inline-flex items-center justify-center h-[18px] px-1.5 rounded-[5px] border border-border bg-bg-200/70 text-[11px] text-text-200 font-medium leading-none",children:_V()?`⌘${C}`:`Ctrl+${C}`})}):h.jsx("span",{style:{gridArea:"time"},className:re("text-[11px] text-text-400/70 text-right shrink-0","transition-opacity duration-150 group-hover:opacity-0"),children:e.updatedAt?BF(e.updatedAt):""}),o||a||l||c?h.jsxs("div",{className:"absolute right-2 top-[3px] flex items-center opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100 transition-opacity",children:[R?h.jsx(xu,{delayDuration:200,skipDelayDuration:100,children:h.jsxs(qu,{children:[h.jsx(Vu,{asChild:!0,children:h.jsx("button",{type:"button",onClick:$=>{$.stopPropagation(),R.run()},className:"flex items-center justify-center w-7 h-7 rounded-md text-text-400 hover:text-text-100 hover:bg-text-100/5 transition-colors cursor-pointer","aria-label":R.label,"data-testid":`quick-action-${u}-${e.sessionId}`,children:R.icon})}),h.jsx(Al,{side:"bottom",children:R.label})]})}):null,h.jsxs(R3,{modal:!1,children:[h.jsx(P3,{asChild:!0,children:h.jsx("button",{type:"button",onClick:$=>$.stopPropagation(),className:"flex items-center justify-center w-7 h-7 rounded-md text-text-400 hover:text-text-100 hover:bg-text-100/5 transition-colors cursor-pointer","aria-label":"session actions","data-testid":`session-menu-${e.sessionId}`,children:h.jsx(x5,{className:"w-4 h-4"})})}),h.jsxs(Qy,{align:"end",onClick:$=>$.stopPropagation(),children:[l&&T&&h.jsxs(mo,{onSelect:()=>l(e.sessionId,!k),"data-testid":`session-${k?"unpin":"pin"}-${e.sessionId}`,children:[k?h.jsx(wS,{className:"w-3 h-3 mr-2 text-text-400"}):h.jsx(SS,{className:"w-3 h-3 mr-2 text-text-400"}),k?"Unpin":"Pin"]}),I&&c&&h.jsxs(mo,{onSelect:()=>c(e.sessionId,!0),"data-testid":`session-archive-${e.sessionId}`,children:[h.jsx(yS,{className:"w-3 h-3 mr-2 text-text-400"}),"Archive"]}),o&&h.jsxs(mo,{onSelect:()=>b(!0),"data-testid":`session-rename-${e.sessionId}`,children:[h.jsx(Ov,{className:"w-3 h-3 mr-2 text-text-400"}),"Rename"]}),p&&e.toolSessionId?h.jsxs(mo,{onSelect:()=>void j(),"data-testid":`session-copy-resume-${e.sessionId}`,children:[h.jsx(ky,{className:"w-3 h-3 mr-2 text-text-400"}),"Copy Resume Command"]}):null,(l||o||p&&e.toolSessionId)&&a&&h.jsx(Jy,{}),a&&h.jsxs(mo,{onSelect:()=>void a(e.sessionId),className:"text-destructive focus:text-destructive focus:bg-destructive/10","data-testid":`session-delete-${e.sessionId}`,children:[h.jsx(Iy,{className:"w-3 h-3 mr-2"}),"Delete"]})]})]})]}):null]}),o?h.jsx(Vq,{open:_,initialLabel:e.label??"",placeholder:e.cwd.split("/").pop()||"",onSubmit:$=>{o(e.sessionId,$),b(!1)},onCancel:()=>b(!1)}):null]})}function t_({node:e,depth:t=0,activeId:n,unreadIds:r,runningIds:i,awaitingIds:s,onSelect:o,onEdit:a,onDelete:l,onPin:c,onArchive:u,quickAction:d,getContactDisplayName:f,showCopyResume:p,ownerPrincipalId:m,getCreatorDisplayName:v,getSessionDisplayName:w,parentSession:x}){const _=e.children.length>0,{isCollapsed:b,toggle:S}=qz(),C=!b(e.session.sessionId),k=g.useCallback(I=>{I.stopPropagation(),S(e.session.sessionId)},[S,e.session.sessionId]),T=_?h.jsx("button",{type:"button",onClick:k,"data-testid":`session-chevron-${e.session.sessionId}`,"aria-label":C?"collapse":"expand","aria-expanded":C,className:"shrink-0 flex items-center justify-center w-4 h-4 text-text-400 hover:text-text-100 cursor-pointer",children:C?h.jsx(Zn,{className:"w-3 h-3"}):h.jsx(zn,{className:"w-3 h-3"})}):null;return h.jsxs("div",{"data-testid":`session-tree-node-${e.session.sessionId}`,children:[h.jsx(CV,{session:e.session,active:n===e.session.sessionId,hasUnread:(r==null?void 0:r.has(e.session.sessionId))??!1,running:(i==null?void 0:i.has(e.session.sessionId))??!1,awaitingUser:(s==null?void 0:s.has(e.session.sessionId))??!1,onSelect:()=>o(e.session.sessionId),onEdit:a,onDelete:l,onPin:c,onArchive:u,quickAction:d,showCopyResume:p,ownerPrincipalId:m,creatorDisplayName:e.session.creatorPrincipalId?v==null?void 0:v(e.session.creatorPrincipalId):void 0,dispatchedFromSessionTitle:e.session.dispatchedFromSessionId?(w==null?void 0:w(e.session.dispatchedFromSessionId))??((x==null?void 0:x.sessionId)===e.session.dispatchedFromSessionId?Py(x):void 0):void 0,depth:t,chevron:T,contactDisplayName:e.session.originOwnerPrincipalId?f==null?void 0:f(e.session.originOwnerPrincipalId):void 0}),_&&C?h.jsx("div",{"data-testid":`session-tree-children-${e.session.sessionId}`,children:e.children.map(I=>h.jsx(t_,{node:I,depth:t+1,activeId:n,unreadIds:r,runningIds:i,awaitingIds:s,onSelect:o,onEdit:a,onDelete:l,onPin:c,onArchive:u,quickAction:d,getContactDisplayName:f,showCopyResume:p,ownerPrincipalId:m,getCreatorDisplayName:v,getSessionDisplayName:w,parentSession:e.session},I.session.sessionId))}):null]})}function EV(e){return e.forkedFromSessionId??e.dispatchedFromSessionId??e.shiftFiredFromSessionId}function n_(e,t){return e.updatedAt<t.updatedAt?1:e.updatedAt>t.updatedAt?-1:0}function V3(e){e=e.filter(s=>!s.ephemeral&&s.deployId===void 0&&s.testReleaseId===void 0);const t=new Map;for(const s of e)t.set(s.sessionId,s);const n=new Map,r=[];for(const s of e){const o=EV(s);if(o&&t.has(o)){const a=n.get(o)??[];a.push(s),n.set(o,a)}else r.push(s)}const i=s=>{const a=[...n.get(s.sessionId)??[]].sort(n_);return{session:s,children:a.map(i)}};return[...r].sort(IV).map(i)}function K3(e){return[...e].sort((t,n)=>n_(t.session,n.session))}function IV(e,t){const n=typeof e.pinnedAt=="number",r=typeof t.pinnedAt=="number";if(n&&r){const i=typeof e.pinSortOrder=="number",s=typeof t.pinSortOrder=="number";return i&&s?e.pinSortOrder-t.pinSortOrder:i?-1:s?1:t.pinnedAt-e.pinnedAt}return n?-1:r?1:n_(e,t)}function TV(e){return e.label?e.label:e.aiLabel?e.aiLabel:e.cwd.split("/").filter(Boolean).pop()??""}function ak(e,t){const n=t.trim().toLowerCase();return n===""?!0:e.toLowerCase().includes(n)}const NV={isCollapsed:()=>!1,toggle:()=>{},prune:()=>{}};function RV({personas:e,activePersonaId:t,onSelectPersona:n,onCreateSession:r,sessions:i,activeSessionId:s,awaitingIds:o,runningIds:a,unreadIds:l,onSelectSession:c,onDeleteSession:u,ownerPrincipalId:d,creatorDisplayNameByOwnerId:f,isPersonaExpanded:p,onTogglePersonaExpanded:m,onEditSession:v,onPinSession:w,showCopyResume:x,treatSessionsAsRoots:_,searchQuery:b}){const[S,C]=g.useState(null),[k,T]=g.useState(()=>new Set),I=p??(L=>k.has(L)),D=g.useCallback(L=>{if(m){m(L);return}T($=>{const F=new Set($);return F.has(L)?F.delete(L):F.add(L),F})},[m]),R=g.useMemo(()=>i==null?void 0:i.filter(L=>!L.ephemeral),[i]),j=g.useMemo(()=>new Map((R??[]).map(L=>[L.sessionId,Py(L)])),[R]),P=g.useCallback(L=>f==null?void 0:f.get(L),[f]),A=g.useCallback(L=>j.get(L),[j]);if(e.length===0)return h.jsx(PV,{});const M=(b??"").trim();return M?h.jsx(wy.Provider,{value:NV,children:h.jsx("div",{"data-testid":"my-personas-list",className:"flex flex-col gap-0.5",children:e.map(L=>{const $=R?R.filter(E=>E.ownerPersonaId===L.personaId).sort((E,U)=>U.updatedAt>E.updatedAt?1:-1):[],F=ak(L.label,M),z=$.filter(E=>ak(TV(E),M));if(!F&&z.length===0)return null;const B=F?$:z;return h.jsx(lk,{persona:L,active:L.personaId===t,editing:!1,onSelectPersona:n,onSubmitCreateSession:()=>{},onCancelCreateSession:()=>{},personaSessions:B,collapsed:!1,onToggleCollapsed:()=>{},activeSessionId:s??null,awaitingIds:o,runningIds:a,unreadIds:l,onSelectSession:c,onDeleteSession:u,onEditSession:v,onPinSession:w,showCopyResume:x,treatSessionsAsRoots:_,ownerPrincipalId:d,creatorDisplayNameByOwnerId:f,getCreatorDisplayName:P,getSessionDisplayName:A},L.personaId)})})}):h.jsx("div",{"data-testid":"my-personas-list",className:"flex flex-col gap-0.5",children:e.map(L=>{const $=R?R.filter(F=>F.ownerPersonaId===L.personaId).sort((F,z)=>z.updatedAt>F.updatedAt?1:-1):[];return h.jsx(lk,{persona:L,active:L.personaId===t,editing:L.personaId===S,onSelectPersona:n,onStartCreateSession:r?()=>C(L.personaId):void 0,onSubmitCreateSession:F=>{C(null),r==null||r(L.personaId,F)},onCancelCreateSession:()=>C(null),personaSessions:$,collapsed:!I(L.personaId),onToggleCollapsed:()=>D(L.personaId),activeSessionId:s??null,awaitingIds:o,runningIds:a,unreadIds:l,onSelectSession:c,onDeleteSession:u,onEditSession:v,onPinSession:w,showCopyResume:x,treatSessionsAsRoots:_,ownerPrincipalId:d,creatorDisplayNameByOwnerId:f,getCreatorDisplayName:P,getSessionDisplayName:A},L.personaId)})})}function PV(){return h.jsx("div",{className:"px-3 py-3 text-[11px] leading-relaxed text-text-400",children:"还没有 persona。点上方 Personas 标题右侧 + 创建第一个。"})}function lk({persona:e,active:t,editing:n,onSelectPersona:r,onStartCreateSession:i,onSubmitCreateSession:s,onCancelCreateSession:o,personaSessions:a,collapsed:l,onToggleCollapsed:c,activeSessionId:u,awaitingIds:d,runningIds:f,unreadIds:p,onSelectSession:m,onDeleteSession:v,onEditSession:w,onPinSession:x,showCopyResume:_,treatSessionsAsRoots:b,ownerPrincipalId:S,creatorDisplayNameByOwnerId:C,getCreatorDisplayName:k,getSessionDisplayName:T}){const I=a.length>0,D=!l,R=g.useMemo(()=>{const A=[],M=new Map;for(const L of a){const $=L.creatorPrincipalId;if(L.larkChatId!=null||!$||S&&$===S){A.push(L);continue}const F=$,z=(C==null?void 0:C.get(F))??`…${F.slice(-8)}`,B=M.get(F);B?B.sessions.push(L):M.set(F,{groupKey:F,displayName:z,sessions:[L]})}return{self:A,byPeer:[...M.values()]}},[a,S,C]),j=R.byPeer.length>0,P=g.useMemo(()=>D&&!j?K3(V3(a)):[],[D,j,a]);return h.jsxs("div",{"data-testid":`persona-node-${e.personaId}`,children:[h.jsxs("div",{className:re("group flex items-center gap-1 px-2 py-1.5 cursor-pointer",t?"bg-accent-dim text-text-100":"hover:bg-bg-200 text-text-200"),onClick:()=>r==null?void 0:r(e.personaId),role:"button",tabIndex:0,children:[I?h.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),c()},"aria-label":D?"collapse":"expand","aria-expanded":D,"data-testid":`persona-chevron-${e.personaId}`,className:"flex h-4 w-4 shrink-0 items-center justify-center text-text-400 hover:text-text-100",children:D?h.jsx(Zn,{className:"h-3 w-3"}):h.jsx(zn,{className:"h-3 w-3"})}):h.jsx("span",{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),h.jsx(jp,{tool:e.tool,className:re("h-3.5 w-3.5 shrink-0",Dp(e.tool))}),h.jsx("span",{className:"flex-1 truncate text-[13px]",children:e.label}),I?h.jsx("span",{className:"shrink-0 text-[10px] text-text-400 tabular-nums","aria-label":`${a.length} sessions`,children:a.length}):null,i?h.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),i()},"aria-label":"新建会话",title:"新建会话","data-testid":`persona-create-session-${e.personaId}`,className:"flex h-5 w-5 shrink-0 items-center justify-center rounded text-text-400 opacity-0 hover:bg-text-100/10 hover:text-text-100 focus-visible:opacity-100 group-hover:opacity-100",children:h.jsx(x7,{className:"h-3.5 w-3.5"})}):null]}),n?h.jsx(AV,{personaId:e.personaId,tool:e.tool,onSubmit:s,onCancel:o}):null,I&&D?h.jsx("div",{"data-testid":`persona-sessions-${e.personaId}`,children:j?h.jsxs(h.Fragment,{children:[R.self.length>0&&h.jsx(ck,{groupKey:`${e.personaId}-self`,label:"我自己",testId:`persona-sessions-${e.personaId}-self`,sessions:R.self,activeSessionId:u,awaitingIds:d,runningIds:f,unreadIds:p,onSelectSession:m,onDeleteSession:v,onEditSession:w,onPinSession:x,showCopyResume:_,ownerPrincipalId:S,getCreatorDisplayName:k,getSessionDisplayName:T}),R.byPeer.map(A=>h.jsx(ck,{groupKey:`${e.personaId}-peer-${A.groupKey}`,label:A.displayName,testId:`persona-sessions-${e.personaId}-peer-${A.groupKey}`,sessions:A.sessions,activeSessionId:u,awaitingIds:d,runningIds:f,unreadIds:p,onSelectSession:m,onDeleteSession:v,onEditSession:w,onPinSession:x,showCopyResume:_,ownerPrincipalId:S,getCreatorDisplayName:k,getSessionDisplayName:T},`${e.personaId}-peer-${A.groupKey}`))]}):P.map(A=>h.jsx(t_,{node:A,depth:b?0:1,activeId:u,unreadIds:p,runningIds:f,awaitingIds:d,onSelect:M=>m==null?void 0:m(M),onDelete:v,onEdit:w,onPin:x,showCopyResume:_,ownerPrincipalId:S,getCreatorDisplayName:k,getSessionDisplayName:T},A.session.sessionId))}):null]})}function ck({label:e,testId:t,sessions:n,activeSessionId:r,awaitingIds:i,runningIds:s,unreadIds:o,onSelectSession:a,onDeleteSession:l,onEditSession:c,onPinSession:u,showCopyResume:d,ownerPrincipalId:f,getCreatorDisplayName:p,getSessionDisplayName:m}){const[v,w]=g.useState(!1),x=!v,_=g.useMemo(()=>x?K3(V3(n)):[],[x,n]);return h.jsxs("div",{"data-testid":t,children:[h.jsxs("button",{type:"button",onClick:()=>w(b=>!b),"aria-label":x?"collapse":"expand","aria-expanded":x,"data-testid":`${t}-chevron`,className:"flex items-center gap-1 w-full pl-7 pr-2 py-0.5 text-[11px] text-text-400 hover:text-text-200 transition-colors",children:[x?h.jsx(Zn,{className:"h-3 w-3"}):h.jsx(zn,{className:"h-3 w-3"}),h.jsx(C5,{className:"h-3 w-3","aria-hidden":!0}),h.jsx("span",{className:"truncate",children:e}),h.jsx("span",{className:"ml-auto tabular-nums",children:n.length})]}),x&&h.jsx("div",{children:_.map(b=>h.jsx(t_,{node:b,depth:2,activeId:r,unreadIds:o,runningIds:s,awaitingIds:i,onSelect:S=>a==null?void 0:a(S),onDelete:l,onEdit:c,onPin:u,showCopyResume:d,ownerPrincipalId:f,getCreatorDisplayName:p,getSessionDisplayName:m},b.session.sessionId))})]})}function AV({personaId:e,tool:t,onSubmit:n,onCancel:r}){const[i,s]=g.useState(""),o=g.useRef(null),a=i.trim(),l=a.length>0;g.useEffect(()=>{var d;(d=o.current)==null||d.focus()},[]);const c=g.useCallback(()=>{l&&n(a)},[l,a,n]),u=Wu(c,r);return h.jsxs("div",{className:"flex items-center gap-1.5 pl-9 pr-2 py-1","data-testid":`persona-new-session-row-${e}`,children:[h.jsx(jp,{tool:t,className:re("h-3 w-3 shrink-0",Dp(t))}),h.jsx("input",{ref:o,type:"text",value:i,onChange:d=>s(d.target.value),...u,onBlur:r,placeholder:"session label...","data-testid":`persona-new-session-input-${e}`,className:"flex-1 min-w-0 bg-bg-100 border border-text-100/15 rounded px-1.5 py-0.5 text-[12px] text-text-100 placeholder:text-text-400 focus:outline-none focus:border-text-100/40"}),h.jsx("button",{type:"button",onMouseDown:d=>{d.preventDefault(),c()},disabled:!l,"aria-label":"确认",title:"确认(Enter)","data-testid":`persona-new-session-confirm-${e}`,className:"flex h-4 w-4 shrink-0 items-center justify-center rounded text-text-300 hover:bg-text-100/10 hover:text-text-100 disabled:opacity-30 disabled:hover:bg-transparent disabled:hover:text-text-300",children:h.jsx(Du,{className:"h-3 w-3"})}),h.jsx("button",{type:"button",onMouseDown:d=>{d.preventDefault(),r()},"aria-label":"取消",title:"取消(Esc)","data-testid":`persona-new-session-cancel-${e}`,className:"flex h-4 w-4 shrink-0 items-center justify-center rounded text-text-300 hover:bg-text-100/10 hover:text-text-100",children:h.jsx(Xr,{className:"h-3 w-3"})})]})}function MV(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function LV(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),r=parseFloat(n.fontSize);return t*r}function jV(e){return e/100*window.innerHeight}function DV(e){return e/100*window.innerWidth}function OV(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function gc({groupSize:e,panelElement:t,styleProp:n}){let r;const[i,s]=OV(n);switch(s){case"%":{r=i/100*e;break}case"px":{r=i;break}case"rem":{r=LV(t,i);break}case"em":{r=MV(t,i);break}case"vh":{r=jV(i);break}case"vw":{r=DV(i);break}}return r}function Ln(e){return parseFloat(e.toFixed(3))}function ll({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,i)=>(r+=t==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,r),0)}function Yv(e){const{panels:t}=e,n=ll({group:e});return n===0?t.map(r=>({groupResizeBehavior:r.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:r.panelConstraints.disabled,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:i,panelConstraints:s}=r;let o=0;if(s.collapsedSize!==void 0){const u=gc({groupSize:n,panelElement:i,styleProp:s.collapsedSize});o=Ln(u/n*100)}let a;if(s.defaultSize!==void 0){const u=gc({groupSize:n,panelElement:i,styleProp:s.defaultSize});a=Ln(u/n*100)}let l=0;if(s.minSize!==void 0){const u=gc({groupSize:n,panelElement:i,styleProp:s.minSize});l=Ln(u/n*100)}let c=100;if(s.maxSize!==void 0){const u=gc({groupSize:n,panelElement:i,styleProp:s.maxSize});c=Ln(u/n*100)}return{groupResizeBehavior:s.groupResizeBehavior,collapsedSize:o,collapsible:s.collapsible===!0,defaultSize:a,disabled:s.disabled,minSize:l,maxSize:c,panelId:r.id}})}function ct(e,t="Assertion error"){if(!e)throw Error(t)}function Xv(e,t){return Array.from(t).sort(e==="horizontal"?BV:zV)}function BV(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function zV(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function G3(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Y3(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function $V({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let i,s=Number.MAX_VALUE;for(const o of t){const{x:a,y:l}=Y3(r,o),c=e==="horizontal"?a:l;c<s&&(s=c,i=o)}return ct(i,"No rect found"),i}let Fd;function FV(){return Fd===void 0&&(typeof matchMedia=="function"?Fd=!!matchMedia("(pointer:coarse)").matches:Fd=!1),Fd}function X3(e){const{element:t,orientation:n,panels:r,separators:i}=e,s=Xv(n,Array.from(t.children).filter(G3).map(m=>({element:m}))).map(({element:m})=>m),o=[];let a=!1,l=!1,c=-1,u=-1,d=0,f,p=[];{let m=-1;for(const v of s)v.hasAttribute("data-panel")&&(m++,v.hasAttribute("data-disabled")||(d++,c===-1&&(c=m),u=m))}if(d>1){let m=-1;for(const v of s)if(v.hasAttribute("data-panel")){m++;const w=r.find(x=>x.element===v);if(w){if(f){const x=f.element.getBoundingClientRect(),_=v.getBoundingClientRect();let b;if(l){const S=n==="horizontal"?new DOMRect(x.right,x.top,0,x.height):new DOMRect(x.left,x.bottom,x.width,0),C=n==="horizontal"?new DOMRect(_.left,_.top,0,_.height):new DOMRect(_.left,_.top,_.width,0);switch(p.length){case 0:{b=[S,C];break}case 1:{const k=p[0],T=$V({orientation:n,rects:[x,_],targetRect:k.element.getBoundingClientRect()});b=[k,T===x?C:S];break}default:{b=p;break}}}else p.length?b=p:b=[n==="horizontal"?new DOMRect(x.right,_.top,_.left-x.right,_.height):new DOMRect(_.left,x.bottom,_.width,_.top-x.bottom)];for(const S of b){let C="width"in S?S:S.element.getBoundingClientRect();const k=FV()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(C.width<k){const I=k-C.width;C=new DOMRect(C.x-I/2,C.y,C.width+I,C.height)}if(C.height<k){const I=k-C.height;C=new DOMRect(C.x,C.y-I/2,C.width,C.height+I)}const T=m<=c||m>u;!a&&!T&&o.push({group:e,groupSize:ll({group:e}),panels:[f,w],separator:"width"in S?void 0:S,rect:C}),a=!1}}l=!1,f=w,p=[]}}else if(v.hasAttribute("data-separator")){v.ariaDisabled!==null&&(a=!0);const w=i.find(x=>x.element===v);w?p.push(w):(f=void 0,p=[])}else l=!0}return o}var ks;class Z3{constructor(){rb(this,ks,{})}addListener(t,n){const r=Ul(this,ks)[t];return r===void 0?Ul(this,ks)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=Ul(this,ks)[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let i=!1,s=null;const o=Array.from(r);for(let a=0;a<o.length;a++){const l=o[a];try{l.call(null,n)}catch(c){s===null&&(i=!0,s=c)}}if(i)throw s}}removeAllListeners(){ib(this,ks,{})}removeListener(t,n){const r=Ul(this,ks)[t];if(r!==void 0){const i=r.indexOf(n);i>=0&&r.splice(i,1)}}}ks=new WeakMap;let Ua={cursorFlags:0,state:"inactive"};const r_=new Z3;function jo(){return Ua}function HV(e){return r_.addListener("change",e)}function UV(e){const t=Ua,n={...Ua};n.cursorFlags=e,Ua=n,r_.emit("change",{prev:t,next:n})}function Wa(e){const t=Ua;Ua=e,r_.emit("change",{prev:t,next:e})}const WV=e=>e,ug=()=>{},Q3=1,J3=2,eR=4,tR=8,uk=3,dk=12;let Hd;function hk(){return Hd===void 0&&(Hd=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Hd=!0)),Hd}function qV({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case"active":case"hover":t.forEach(s=>{if(!s.mutableState.disableCursor)switch(s.orientation){case"horizontal":{r++;break}case"vertical":{i++;break}}})}if(!(r===0&&i===0)){switch(n){case"active":{if(e&&hk()){const s=(e&Q3)!==0,o=(e&J3)!==0,a=(e&eR)!==0,l=(e&tR)!==0;if(s)return a?"se-resize":l?"ne-resize":"e-resize";if(o)return a?"sw-resize":l?"nw-resize":"w-resize";if(a)return"s-resize";if(l)return"n-resize"}break}}return hk()?r>0&&i>0?"move":r>0?"ew-resize":"ns-resize":r>0&&i>0?"grab":r>0?"col-resize":"row-resize"}}const fk=new WeakMap;function i_(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=fk.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));const r=jo();switch(r.state){case"active":case"hover":{const i=qV({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(o=>o.group),state:r.state}),s=`*, *:hover {cursor: ${i} !important; }`;if(t===s)return;t=s,i?n.cssRules.length===0?n.insertRule(s):n.replaceSync(s):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}fk.set(e,{prevStyle:t,styleSheet:n})}let di=new Map;const nR=new Z3;function VV(e){di=new Map(di),di.delete(e)}function pk(e,t){for(const[n]of di)if(n.id===e)return n}function Bs(e,t){for(const[n,r]of di)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Yo(){return di}function s_(e,t){return nR.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function Zi(e,t,n){const r=di.get(e);di=new Map(di),di.set(e,t),nR.emit("groupChange",{group:e,isUserInteraction:(n==null?void 0:n.isUserInteraction)===!0,prev:r,next:t})}function rR(e){const t=jo();let n=!1;switch(t.state){case"active":Wa({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(i_(e),n=!0,t.hitRegions.forEach(r=>{const i=Bs(r.group.id,!0);Zi(r.group,i,{isUserInteraction:!0})}))}return n}function mk(e){e.defaultPrevented||rR(e.currentTarget)}function KV(e,t,n){let r,i={x:1/0,y:1/0};for(const s of t){const o=Y3(n,s.rect);switch(e){case"horizontal":{o.x<=i.x&&(r=s,i=o);break}case"vertical":{o.y<=i.y&&(r=s,i=o);break}}}return r?{distance:i,hitRegion:r}:void 0}function GV(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function YV(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:xk(e),b:xk(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();ct(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:vk(gk(n.a)),b:vk(gk(n.b))};if(i.a===i.b){const s=r.childNodes,o={a:n.a.at(-1),b:n.b.at(-1)};let a=s.length;for(;a--;){const l=s[a];if(l===o.a)return 1;if(l===o.b)return-1}}return Math.sign(i.a-i.b)}const XV=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function ZV(e){const t=getComputedStyle(iR(e)??e).display;return t==="flex"||t==="inline-flex"}function QV(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||ZV(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||XV.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function gk(e){let t=e.length;for(;t--;){const n=e[t];if(ct(n,"Missing node"),QV(n))return n}return null}function vk(e){return e&&Number(getComputedStyle(e).zIndex)||0}function xk(e){const t=[];for(;e;)t.push(e),e=iR(e);return t}function iR(e){const{parentNode:t}=e;return GV(t)?t.host:t}function JV(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function eK({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!G3(n)||n.contains(e)||e.contains(n))return!0;if(YV(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(JV(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function o_(e,t){const n=[];return t.forEach((r,i)=>{if(i.disabled)return;const s=X3(i),o=KV(i.orientation,s,{x:e.clientX,y:e.clientY});o&&o.distance.x<=0&&o.distance.y<=0&&eK({groupElement:i.element,hitRegion:o.hitRegion.rect,pointerEventTarget:e.target})&&n.push(o.hitRegion)}),n}function tK(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function kn(e,t,n=0){return Math.abs(Ln(e)-Ln(t))<=n}function ai(e,t){return kn(e,t)?0:e>t?1:-1}function Pa({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){const{collapsedSize:i=0,collapsible:s,disabled:o,maxSize:a=100,minSize:l=0}=t;if(o&&!e)return n;if(ai(r,l)<0)if(s){const c=(i+l)/2;ai(r,c)<0?r=i:r=l}else r=l;return r=Math.min(a,r),r=Ln(r),r}function yu({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:s}){if(kn(e,0))return t;const o=s==="imperative-api",a=Object.values(t),l=Object.values(i),c=[...a],[u,d]=r;ct(u!=null,"Invalid first pivot index"),ct(d!=null,"Invalid second pivot index");let f=0;switch(s){case"keyboard":{{const v=e<0?d:u,w=n[v];ct(w,`Panel constraints not found for index ${v}`);const{collapsedSize:x=0,collapsible:_,minSize:b=0}=w;if(_){const S=a[v];if(ct(S!=null,`Previous layout not found for panel index ${v}`),kn(S,x)){const C=b-S;ai(C,Math.abs(e))>0&&(e=e<0?0-C:C)}}}{const v=e<0?u:d,w=n[v];ct(w,`No panel constraints found for index ${v}`);const{collapsedSize:x=0,collapsible:_,minSize:b=0}=w;if(_){const S=a[v];if(ct(S!=null,`Previous layout not found for panel index ${v}`),kn(S,b)){const C=S-x;ai(C,Math.abs(e))>0&&(e=e<0?0-C:C)}}}break}default:{const v=e<0?d:u,w=n[v];ct(w,`Panel constraints not found for index ${v}`);const x=a[v],{collapsible:_,collapsedSize:b,minSize:S}=w;if(_&&ai(x,S)<0)if(e>0){const C=S-b,k=C/2,T=x+e;ai(T,S)<0&&(e=ai(e,k)<=0?0:C)}else{const C=S-b,k=100-C/2,T=x-e;ai(T,S)<0&&(e=ai(100+e,k)>0?0:-C)}break}}{const v=e<0?1:-1;let w=e<0?d:u,x=0;for(;;){const b=a[w];ct(b!=null,`Previous layout not found for panel index ${w}`);const S=Pa({overrideDisabledPanels:o,panelConstraints:n[w],prevSize:b,size:100})-b;if(x+=S,w+=v,w<0||w>=n.length)break}const _=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-_:_}{let v=e<0?u:d;for(;v>=0&&v<n.length;){const w=Math.abs(e)-Math.abs(f),x=a[v];ct(x!=null,`Previous layout not found for panel index ${v}`);const _=x-w,b=Pa({overrideDisabledPanels:o,panelConstraints:n[v],prevSize:x,size:_});if(!kn(x,b)&&(f+=x-b,c[v]=b,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?v--:v++}}if(tK(l,c))return i;{const v=e<0?d:u,w=a[v];ct(w!=null,`Previous layout not found for panel index ${v}`);const x=w+f,_=Pa({overrideDisabledPanels:o,panelConstraints:n[v],prevSize:w,size:x});if(c[v]=_,!kn(_,x)){let b=x-_,S=e<0?d:u;for(;S>=0&&S<n.length;){const C=c[S];ct(C!=null,`Previous layout not found for panel index ${S}`);const k=C+b,T=Pa({overrideDisabledPanels:o,panelConstraints:n[S],prevSize:C,size:k});if(kn(C,T)||(b-=T-C,c[S]=T),kn(b,0))break;e>0?S--:S++}}}const p=Object.values(c).reduce((v,w)=>w+v,0);if(!kn(p,100,.1))return i;const m=Object.keys(i);return c.reduce((v,w,x)=>(v[m[x]]=w,v),{})}function Do(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||ai(e[n],t[n])!==0)return!1;return!0}function Oo({layout:e,panelConstraints:t}){const n=Object.values(e),r=[...n],i=r.reduce((a,l)=>a+l,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(a=>`${a}%`).join(", ")}`);if(!kn(i,100)&&r.length>0)for(let a=0;a<t.length;a++){const l=r[a];ct(l!=null,`No layout data found for index ${a}`);const c=100/i*l;r[a]=c}let s=0;for(let a=0;a<t.length;a++){const l=n[a];ct(l!=null,`No layout data found for index ${a}`);const c=r[a];ct(c!=null,`No layout data found for index ${a}`);const u=Pa({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:l,size:c});c!=u&&(s+=c-u,r[a]=u)}if(!kn(s,0))for(let a=0;a<t.length;a++){const l=r[a];ct(l!=null,`No layout data found for index ${a}`);const c=l+s,u=Pa({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:l,size:c});if(l!==u&&(s-=u-l,r[a]=u,kn(s,0)))break}const o=Object.keys(e);return r.reduce((a,l,c)=>(a[o[c]]=l,a),{})}function sR({groupId:e,panelId:t}){const n=()=>{const l=Yo();for(const[c,{defaultLayoutDeferred:u,derivedPanelConstraints:d,layout:f,groupSize:p,separatorToPanels:m}]of l)if(c.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:c,groupSize:p,layout:f,separatorToPanels:m};throw Error(`Group ${e} not found`)},r=()=>{const l=n().derivedPanelConstraints.find(c=>c.panelId===t);if(l!==void 0)return l;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const l=n().group.panels.find(c=>c.id===t);if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const l=n().layout[t];if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:l,panels:c,prevLayout:u,derivedPanelConstraints:d})=>{const f=s(),p=c.findIndex(w=>w.id===t),m=p===0,v=p===c.length-1;if(v&&l<f&&(m||c.slice(0,p).every((w,x)=>{const _=d[x];return(_==null?void 0:_.collapsible)&&kn(_.collapsedSize,u[_.panelId])}))){const w=c.slice(0,p).reduce((x,_)=>x+u[_.id],0);return{...u,[t]:Ln(100-w)}}return yu({delta:v?f-l:l-f,initialLayout:u,panelConstraints:d,pivotIndices:v?[p-1,p]:[p,p+1],prevLayout:u,trigger:"imperative-api"})},a=l=>{const c=s();if(l===c)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:f,groupSize:p,layout:m,separatorToPanels:v}=n(),w=o({nextSize:l,panels:f.panels,prevLayout:m,derivedPanelConstraints:d}),x=Oo({layout:w,panelConstraints:d});Do(m,x)||Zi(f,{defaultLayoutDeferred:u,derivedPanelConstraints:d,groupSize:p,layout:x,separatorToPanels:v})};return{collapse:()=>{const{collapsible:l,collapsedSize:c}=r(),{mutableValues:u}=i(),d=s();l&&d!==c&&(u.expandToSize=d,a(c))},expand:()=>{const{collapsible:l,collapsedSize:c,minSize:u}=r(),{mutableValues:d}=i(),f=s();if(l&&f===c){let p=d.expandToSize??u;p===0&&(p=1),a(p)}},getSize:()=>{const{group:l}=n(),c=s(),{element:u}=i(),d=l.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:c,inPixels:d}},isCollapsed:()=>{const{collapsible:l,collapsedSize:c}=r(),u=s();return l&&kn(c,u)},resize:l=>{const{group:c}=n(),{element:u}=i(),d=ll({group:c}),f=gc({groupSize:d,panelElement:u,styleProp:l}),p=Ln(f/d*100);a(p)}}}function yk(e){if(e.defaultPrevented)return;const t=Yo();o_(e,t).forEach(n=>{if(n.separator&&!n.separator.disableDoubleClick){const r=n.panels.find(i=>i.panelConstraints.defaultSize!==void 0);if(r){const i=r.panelConstraints.defaultSize,s=sR({groupId:n.group.id,panelId:r.id});s&&i!==void 0&&(s.resize(i),e.preventDefault())}}})}function Eh(e){const t=Yo();for(const[n]of t)if(n.separators.some(r=>r.element===e))return n;throw Error("Could not find parent Group for separator element")}function oR({groupId:e}){const t=()=>{const n=Yo();for(const[r,i]of n)if(r.id===e)return{group:r,...i};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:s,groupSize:o,layout:a,separatorToPanels:l}=t(),c=Oo({layout:n,panelConstraints:i});return r?a:(Do(a,c)||Zi(s,{defaultLayoutDeferred:r,derivedPanelConstraints:i,groupSize:o,layout:c,separatorToPanels:l}),c)}}}function oo(e,t){const n=Eh(e),r=Bs(n.id,!0),i=n.separators.find(u=>u.element===e);ct(i,"Matching separator not found");const s=r.separatorToPanels.get(i);ct(s,"Matching panels not found");const o=s.map(u=>n.panels.indexOf(u)),a=oR({groupId:n.id}).getLayout(),l=yu({delta:t,initialLayout:a,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:a,trigger:"keyboard"}),c=Oo({layout:l,panelConstraints:r.derivedPanelConstraints});Do(a,c)||Zi(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function _k(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=Eh(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&oo(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&oo(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&oo(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&oo(t,-5);break}case"End":{e.preventDefault(),oo(t,100);break}case"Enter":{e.preventDefault();const r=Eh(t),i=Bs(r.id,!0),{derivedPanelConstraints:s,layout:o,separatorToPanels:a}=i,l=r.separators.find(f=>f.element===t);ct(l,"Matching separator not found");const c=a.get(l);ct(c,"Matching panels not found");const u=c[0],d=s.find(f=>f.panelId===u.id);if(ct(d,"Panel metadata not found"),d.collapsible){const f=o[u.id],p=d.collapsedSize===f?r.mutableState.expandedPanelSizes[u.id]??d.minSize:d.collapsedSize;oo(t,p-f)}break}case"F6":{e.preventDefault();const r=Eh(t).separators.map(o=>o.element),i=Array.from(r).findIndex(o=>o===e.currentTarget);ct(i!==null,"Index not found");const s=e.shiftKey?i>0?i-1:r.length-1:i+1<r.length?i+1:0;r[s].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),oo(t,-100);break}}}function bk(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=Yo(),n=o_(e,t),r=new Map;let i=!1;n.forEach(s=>{s.separator&&(i||(i=!0,s.separator.element.focus({focusVisible:!1,preventScroll:!0})));const o=t.get(s.group);o&&r.set(s.group,o.layout)}),Wa({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}function aR({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:s,prevCursorFlags:o}){let a=0;n.forEach(c=>{const{group:u,groupSize:d}=c,{orientation:f,panels:p}=u,{disableCursor:m}=u.mutableState;let v=0;s?f==="horizontal"?v=(t.clientX-s.x)/d*100:v=(t.clientY-s.y)/d*100:f==="horizontal"?v=t.clientX<0?-100:100:v=t.clientY<0?-100:100;const w=r.get(u),x=i.get(u);if(!w||!x)return;const{defaultLayoutDeferred:_,derivedPanelConstraints:b,groupSize:S,layout:C,separatorToPanels:k}=x;if(b&&C&&k){const T=yu({delta:v,initialLayout:w,panelConstraints:b,pivotIndices:c.panels.map(I=>p.indexOf(I)),prevLayout:C,trigger:"mouse-or-touch"});if(Do(T,C)){if(v!==0&&!m)switch(f){case"horizontal":{a|=v<0?Q3:J3;break}case"vertical":{a|=v<0?eR:tR;break}}}else Zi(c.group,{defaultLayoutDeferred:_,derivedPanelConstraints:b,groupSize:S,layout:T,separatorToPanels:k})}});let l=0;t.movementX===0?l|=o&uk:l|=a&uk,t.movementY===0?l|=o&dk:l|=a&dk,UV(l),i_(e)}function wk(e){const t=Yo(),n=jo();switch(n.state){case"active":aR({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Sk(e){var r,i;if(e.defaultPrevented)return;const t=jo(),n=Yo();switch(t.state){case"active":{if(e.buttons===0){Wa({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(s=>{const o=Bs(s.group.id,!0);Zi(s.group,o,{isUserInteraction:!0})});return}for(const s of t.hitRegions)if(s.separator){const{element:o}=s.separator;(r=o.hasPointerCapture)!=null&&r.call(o,e.pointerId)||((i=o.setPointerCapture)==null||i.call(o,e.pointerId))}aR({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const s=o_(e,n);s.length===0?t.state!=="inactive"&&Wa({cursorFlags:0,state:"inactive"}):Wa({cursorFlags:0,hitRegions:s,state:"hover"}),i_(e.currentTarget);break}}}function kk(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(jo().state){case"hover":Wa({cursorFlags:0,state:"inactive"})}}function Ck(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||rR(e.currentTarget)&&e.preventDefault()}function Ek(e){let t=0,n=0;const r={};for(const s of e)if(s.defaultSize!==void 0){t++;const o=Ln(s.defaultSize);n+=o,r[s.panelId]=o}else r[s.panelId]=void 0;const i=e.length-t;if(i!==0){const s=Ln((100-n)/i);for(const o of e)o.defaultSize===void 0&&(r[o.panelId]=s)}return r}function nK(e,t,n){if(!n[0])return;const r=e.panels.find(l=>l.element===t);if(!r||!r.onResize)return;const i=ll({group:e}),s=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,a={asPercentage:Ln(s/i*100),inPixels:s};r.mutableValues.prevSize=a,r.onResize(a,r.id,o)}function rK(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function iK({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,s=0,o=!1;const a=new Map,l=[];for(const d of e.panels){const f=r[d.id]??0;switch(d.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{o=!0;const p=f/100*n,m=Ln(p/t*100);a.set(d.id,m),i+=m;break}case"preserve-relative-size":default:{l.push(d.id),s+=f;break}}}if(!o||l.length===0)return r;const c=100-i,u={...r};if(a.forEach((d,f)=>{u[f]=d}),s>0)for(const d of l){const f=r[d]??0;u[d]=Ln(f/s*c)}else{const d=Ln(c/l.length);for(const f of l)u[f]=d}return u}function sK(e,t){const n=e.map(i=>i.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n)if(!r.includes(i))return!1;return!0}const ca=new Map;function oK(e){let t=!0;ct(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,s=new n(m=>{for(const v of m){const{borderBoxSize:w,target:x}=v;if(x===e.element){if(t){const _=ll({group:e});if(_===0)return;const b=Bs(e.id);if(!b)return;const S=Yv(e),C=b.defaultLayoutDeferred?Ek(S):b.layout,k=iK({group:e,nextGroupSize:_,prevGroupSize:b.groupSize,prevLayout:C}),T=Oo({layout:k,panelConstraints:S});if(!b.defaultLayoutDeferred&&Do(b.layout,T)&&rK(b.derivedPanelConstraints,S)&&b.groupSize===_)return;Zi(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:S,groupSize:_,layout:T,separatorToPanels:b.separatorToPanels})}}else nK(e,x,w)}});s.observe(e.element),e.panels.forEach(m=>{ct(!r.has(m.id),`Panel ids must be unique; id "${m.id}" was used more than once`),r.add(m.id),m.onResize&&s.observe(m.element)});const o=ll({group:e}),a=Yv(e),l=e.panels.map(({id:m})=>m).join(",");let c=e.mutableState.defaultLayout;c&&(sK(e.panels,c)||(c=void 0));const u=e.mutableState.layouts[l]??c??Ek(a),d=Oo({layout:u,panelConstraints:a}),f=e.element.ownerDocument;ca.set(f,(ca.get(f)??0)+1);const p=new Map;return X3(e).forEach(m=>{m.separator&&p.set(m.separator,m.panels)}),Zi(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:a,groupSize:o,layout:d,separatorToPanels:p}),e.separators.forEach(m=>{ct(!i.has(m.id),`Separator ids must be unique; id "${m.id}" was used more than once`),i.add(m.id),m.element.addEventListener("keydown",_k)}),ca.get(f)===1&&(f.addEventListener("contextmenu",mk,!0),f.addEventListener("dblclick",yk,!0),f.addEventListener("pointerdown",bk,!0),f.addEventListener("pointerleave",wk),f.addEventListener("pointermove",Sk),f.addEventListener("pointerout",kk),f.addEventListener("pointerup",Ck,!0)),function(){t=!1,ca.set(f,Math.max(0,(ca.get(f)??0)-1)),VV(e),e.separators.forEach(m=>{m.element.removeEventListener("keydown",_k)}),ca.get(f)||(f.removeEventListener("contextmenu",mk,!0),f.removeEventListener("dblclick",yk,!0),f.removeEventListener("pointerdown",bk,!0),f.removeEventListener("pointerleave",wk),f.removeEventListener("pointermove",Sk),f.removeEventListener("pointerout",kk),f.removeEventListener("pointerup",Ck,!0)),s.disconnect()}}function aK(){const[e,t]=g.useState({}),n=g.useCallback(()=>t({}),[]);return[e,n]}function a_(e){const t=g.useId();return`${e??t}`}const Xo=typeof window<"u"?g.useLayoutEffect:g.useEffect;function jc(e){const t=g.useRef(e);return Xo(()=>{t.current=e},[e]),g.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function l_(...e){return jc(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function c_(e){const t=g.useRef({...e});return Xo(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const lR=g.createContext(null);function lK(e,t){const n=g.useRef({getLayout:()=>({}),setLayout:WV});g.useImperativeHandle(t,()=>n.current,[]),Xo(()=>{Object.assign(n.current,oR({groupId:e}))})}function u_({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:s,groupRef:o,id:a,onLayoutChange:l,onLayoutChanged:c,orientation:u="horizontal",resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){const m=g.useRef({onLayoutChange:{},onLayoutChanged:{}}),v=jc(j=>{Do(m.current.onLayoutChange,j)||(m.current.onLayoutChange=j,l==null||l(j))}),w=jc((j,P)=>{Do(m.current.onLayoutChanged,j)||(m.current.onLayoutChanged=j,c==null||c(j,{isUserInteraction:P}))}),x=a_(a),_=g.useRef(null),[b,S]=aK(),C=g.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),k=l_(_,s);lK(x,o);const T=jc((j,P)=>{const A=jo(),M=pk(j),L=Bs(j);if(L){let $=!1;switch(A.state){case"active":{$=A.hitRegions.some(F=>F.group===M);break}}return{flexGrow:L.layout[P]??1,pointerEvents:$?"none":void 0}}if(n!=null&&n[P])return{flexGrow:n==null?void 0:n[P]}}),I=c_({defaultLayout:n,disableCursor:r}),D=g.useMemo(()=>({get disableCursor(){return!!I.disableCursor},getPanelStyles:T,id:x,orientation:u,registerPanel:j=>{const P=C.current;return P.panels=Xv(u,[...P.panels,j]),S(),()=>{P.panels=P.panels.filter(A=>A!==j),S()}},registerSeparator:j=>{const P=C.current;return P.separators=Xv(u,[...P.separators,j]),S(),()=>{P.separators=P.separators.filter(A=>A!==j),S()}},updatePanelProps:(j,{disabled:P})=>{const A=C.current.panels.find($=>$.id===j);A&&(A.panelConstraints.disabled=P);const M=pk(x),L=Bs(x);M&&L&&Zi(M,{...L,derivedPanelConstraints:Yv(M)})},updateSeparatorProps:(j,{disabled:P,disableDoubleClick:A})=>{const M=C.current.separators.find(L=>L.id===j);M&&(M.disabled=P,M.disableDoubleClick=A)}}),[T,x,S,u,I]),R=g.useRef(null);return Xo(()=>{const j=_.current;if(j===null)return;const P=C.current;let A;if(I.defaultLayout!==void 0&&Object.keys(I.defaultLayout).length===P.panels.length){A={};for(const E of P.panels){const U=I.defaultLayout[E.id];U!==void 0&&(A[E.id]=U)}}const M={disabled:!!i,element:j,id:x,mutableState:{defaultLayout:A,disableCursor:!!I.disableCursor,expandedPanelSizes:C.current.lastExpandedPanelSizes,layouts:C.current.layouts},orientation:u,panels:P.panels,resizeTargetMinimumSize:P.resizeTargetMinimumSize,separators:P.separators};R.current=M;const L=oK(M),{defaultLayoutDeferred:$,derivedPanelConstraints:F,layout:z}=Bs(M.id,!0);!$&&F.length>0&&(v(z),w(z,!1));const B=s_(x,E=>{const{defaultLayoutDeferred:U,derivedPanelConstraints:q,layout:O}=E.next;if(U||q.length===0)return;const te=M.panels.map(({id:G})=>G).join(",");M.mutableState.layouts[te]=O,q.forEach(G=>{if(G.collapsible){const{layout:me}=E.prev??{};if(me){const Ie=kn(G.collapsedSize,O[G.panelId]),ue=kn(G.collapsedSize,me[G.panelId]);Ie&&!ue&&(M.mutableState.expandedPanelSizes[G.panelId]=me[G.panelId])}}});const se=jo().state!=="active";v(O),se&&w(O,E.isUserInteraction)});return()=>{R.current=null,L(),B()}},[i,x,w,v,u,b,I]),g.useEffect(()=>{const j=R.current;j&&(j.mutableState.defaultLayout=n,j.mutableState.disableCursor=!!r)}),h.jsx(lR.Provider,{value:D,children:h.jsx("div",{...p,className:t,"data-group":!0,"data-testid":x,id:x,ref:k,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:u==="horizontal"?"pan-y":"pan-x"},children:e})})}u_.displayName="Group";function d_(){const e=g.useContext(lR);return ct(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function cK(e,t){const{id:n}=d_(),r=g.useRef({collapse:ug,expand:ug,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ug});g.useImperativeHandle(t,()=>r.current,[]),Xo(()=>{Object.assign(r.current,sR({groupId:n,panelId:e}))})}function Lf({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:i,disabled:s,elementRef:o,groupResizeBehavior:a="preserve-relative-size",id:l,maxSize:c="100%",minSize:u="0%",onResize:d,panelRef:f,style:p,...m}){const v=!!l,w=a_(l),x=c_({disabled:s}),_=g.useRef(null),b=l_(_,o),{getPanelStyles:S,id:C,orientation:k,registerPanel:T,updatePanelProps:I}=d_(),D=d!==null,R=jc((M,L,$)=>{d==null||d(M,l,$)});Xo(()=>{const M=_.current;if(M!==null){const L={element:M,id:w,idIsStable:v,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:D?R:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsible:r,defaultSize:i,disabled:x.disabled,maxSize:c,minSize:u}};return T(L)}},[a,n,r,i,D,w,v,c,u,R,T,x]),g.useEffect(()=>{I(w,{disabled:s})},[s,w,I]),cK(w,f);const j=()=>{const M=S(C,w);if(M)return JSON.stringify(M)},P=g.useSyncExternalStore(M=>s_(C,M),j,j);let A;return P?A=JSON.parse(P):i!==void 0?A={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:A={flexGrow:1},h.jsx("div",{...m,"data-disabled":s||void 0,"data-panel":!0,"data-testid":w,id:w,ref:b,style:{...uK,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...A},children:h.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...p,touchAction:k==="horizontal"?"pan-y":"pan-x"},children:e})})}Lf.displayName="Panel";const uK={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function dK({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,s;const o=e[n],a=t.find(l=>l.panelId===n);if(a){const l=a.maxSize,c=a.collapsible?a.collapsedSize:a.minSize,u=[r,r+1];s=Oo({layout:yu({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Oo({layout:yu({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:s,valueNow:o}}function cR({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:s,style:o,...a}){const l=a_(s),c=c_({disabled:n,disableDoubleClick:r}),[u,d]=g.useState({}),[f,p]=g.useState("inactive"),[m,v]=g.useState(!1),w=g.useRef(null),x=l_(w,i),{disableCursor:_,id:b,orientation:S,registerSeparator:C,updateSeparatorProps:k}=d_(),T=S==="horizontal"?"vertical":"horizontal";Xo(()=>{const R=w.current;if(R!==null){const j={disabled:c.disabled,disableDoubleClick:c.disableDoubleClick,element:R,id:l},P=C(j),A=HV(L=>{p(L.next.state!=="inactive"&&L.next.hitRegions.some($=>$.separator===j)?L.next.state:"inactive")}),M=s_(b,L=>{const{derivedPanelConstraints:$,layout:F,separatorToPanels:z}=L.next,B=z.get(j);if(B){const E=B[0],U=B.indexOf(E);d(dK({layout:F,panelConstraints:$,panelId:E.id,panelIndex:U}))}});return()=>{A(),M(),P()}}},[b,l,C,c]),g.useEffect(()=>{k(l,{disabled:n,disableDoubleClick:r})},[n,r,l,k]);let I;n&&!_&&(I="not-allowed");let D;if(n)D="disabled";else switch(f){case"active":{D="active";break}default:m?D="focus":D=f}return h.jsx("div",{...a,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":T,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":D,"data-testid":l,id:l,onBlur:()=>v(!1),onFocus:()=>v(!0),ref:x,role:"separator",style:{flexBasis:"auto",cursor:I,...o,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}cR.displayName="Separator";function hK(e){if(!e)return;const t=e.contextUsage,n=e.contextWindowSize;if(!t||!n||n<=0)return;const r=t.inputTokens+(t.cacheReadTokens??0)+(t.cacheCreateTokens??0);if(!(r<=0))return Math.round(r/n*100)}function uR(e,t){const n=Zs(),r=e?`session/${e}`:"",i=Gi(r)??hu,s=g.useCallback(d=>{!e||!r||n.setData(r,f=>u5(f??hu,d,e))},[n,r,e]),o=g.useCallback(()=>{e&&s({type:"session:change",sessionId:e})},[s,e]),a=g.useCallback(d=>{e&&s({type:"permission:clear",sessionId:e,requestId:d})},[s,e]),l=g.useCallback(d=>{e&&s({type:"permission:request",sessionId:e,requestId:d.requestId,tool:d.tool,input:d.input,...d.toolUseId?{toolUseId:d.toolUseId}:{}})},[s,e]),c=g.useCallback(d=>{e&&s({type:"session:question:clear",sessionId:e,toolUseId:d})},[s,e]),u=g.useCallback((d,f)=>{e&&s({type:"session:question:submitted",sessionId:e,toolUseId:d,answers:f})},[s,e]);return{...i,reset:o,clearPermission:a,restorePermission:l,clearQuestion:c,markQuestionSubmitted:u}}function fK(e){return e.kind!=="user-text"?!1:e.meta===void 0||e.meta==="slash-command"||Ap(e.meta)}function pK(e,t={}){let n=0;if(t.implicitCloseOnUserText){for(const r of e)fK(r)&&n++;return n}for(const r of e)r.kind==="turn-end"&&n++;return n}const mK=g.createContext(null);function dR(){return g.useContext(mK)}const gK=50;function vK({api:e,sessionId:t,focused:n=!0,toolSessionId:r,initialTurns:i,implicitCloseOnUserText:s,pageSize:o=gK,enabled:a=!0,refreshVersion:l=0}){const c=dR(),[u,d]=g.useState({messages:[],total:0,loading:!1,error:null}),f=g.useRef(r),p=g.useRef(n),m=g.useRef(null),v=g.useRef(l),w=g.useRef(0),x=g.useRef(!0);return g.useEffect(()=>(x.current=!0,()=>{x.current=!1}),[]),g.useEffect(()=>{const _=f.current;f.current=r;const b=n&&!p.current;if(p.current=n,!a){m.current!==null&&(m.current=null,++w.current,d({messages:[],total:0,loading:!1,error:null}));return}const S=m.current!==t,C=v.current!==l;v.current=l;const k=typeof _=="string"&&_!==r,T=b&&u.error!==null;if(_!==r&&(c==null||c.push({level:"info",msg:"chatflow.history.identity",sessionId:t,meta:{previousToolSessionId:_??null,toolSessionId:r??null,willReload:S||k}})),!S&&!k&&!T&&!C)return;if((S||k)&&d({messages:[],total:0,loading:!1,error:null}),!t){m.current=null;return}m.current=t;const I=++w.current;c==null||c.push({level:"info",msg:"chatflow.history.read.start",sessionId:t,meta:{toolSessionId:r??null,initialTurns:i??null,pageSize:i===void 0?null:o,readSeq:I}}),d(D=>({...D,loading:!0,error:null})),(async()=>{var M;let D=[],R=!1,j,P=i===void 0?{}:{limit:o},A=Number.POSITIVE_INFINITY;for(;;){let L;try{L=await e.historyRead({sessionId:t,...P})}catch(q){if(I!==w.current||!x.current)return;const O=q.message??"history load failed";c==null||c.push({level:"warn",msg:"chatflow.history.read.error",sessionId:t,meta:{readSeq:I,shown:R,errorCode:q&&typeof q=="object"&&"code"in q?String(q.code):null}}),d(te=>({...te,loading:!1,error:O}));return}if(I!==w.current||!x.current)return;c==null||c.push({level:"info",msg:"chatflow.history.read.result",sessionId:t,meta:{readSeq:I,pageMessages:((M=L.messages)==null?void 0:M.length)??0,total:L.total??0,offset:L.offset??null}}),j&&L.snapshotId&&j!==L.snapshotId&&(D=[],R=!1,A=Number.POSITIVE_INFINITY,d({messages:[],total:0,loading:!0,error:null})),j=L.snapshotId,D=[...L.messages??[],...D];const $=L.total??0,F=typeof L.offset=="number"?L.offset:0,z=F>=A,B=F<=0||z;A=F;const E=i!==void 0&&pK(D,{implicitCloseOnUserText:s})>=i;if(R?d({messages:D,total:$,loading:!1,error:null}):(B||E)&&(R=!0,d({messages:D,total:$,loading:!1,error:null})),B)return;const U=Math.max(0,F-o);P={offset:U,limit:F-U,...j?{snapshotId:j}:{}}}})()},[e,t,r,n,o,i,a,l,c]),u}const xK=["TaskCreate","TaskUpdate","TaskList","TaskGet"];function yK(e){return xK.includes(e)}function hR(e){return e==="in_progress"||e==="completed"?e:"pending"}function _K(e,t){if(!t||typeof t!="object")return e;const n=t,r=typeof n.subject=="string"&&n.subject?n.subject:typeof n.content=="string"&&n.content?n.content:null;if(!r)return e;const i=typeof n.activeForm=="string"?n.activeForm:void 0,s=typeof n.description=="string"?n.description:void 0;return[...e,{id:String(e.length+1),content:r,status:hR(n.status),activeForm:i,description:s}]}function bK(e,t){if(!t||typeof t!="object")return e;const n=t,r=typeof n.taskId=="string"&&n.taskId?n.taskId:typeof n.id=="string"&&n.id?n.id:null;if(!r)return e;const i=e.findIndex(a=>a.id===r);if(i<0)return e;const s=[...e],o={...s[i]};return"status"in n&&(o.status=hR(n.status)),typeof n.subject=="string"&&(o.content=n.subject),typeof n.content=="string"&&(o.content=n.content),typeof n.activeForm=="string"&&(o.activeForm=n.activeForm),typeof n.description=="string"&&(o.description=n.description),s[i]=o,s}function wK(e){let t=[],n=-1;for(let r=0;r<e.length;r++){const i=e[r];if(i.kind==="task-event")switch(n=r,i.name){case"TaskCreate":t=_K(t,i.input);break;case"TaskUpdate":t=bK(t,i.input);break}}return{tasks:t,lastEventIndex:n}}function SK(e){return e==="TodoWrite"}function kK(e){if(!e||typeof e!="object")return null;const t=e;if(!Array.isArray(t.todos))return null;const n=[];for(const r of t.todos){if(!r||typeof r!="object")continue;const i=r,s=typeof i.content=="string"?i.content:"";if(!s)continue;const o=i.status==="in_progress"||i.status==="completed"?i.status:"pending",a=typeof i.activeForm=="string"?i.activeForm:void 0;n.push({content:s,status:o,activeForm:a})}return n}function Ih(e,t,n){var o;const r=[],i=new Map;for(let a=0;a<e.length;a++){const l=e[a],c=typeof l.seq=="number"?l.seq:a;switch(l.kind){case"session_init":r.push({kind:"session-init",seq:c,toolSessionId:l.toolSessionId});break;case"text":Ik(r,c,"assistant-text",l.text,l.partialId,l.uuid);break;case"thinking":Ik(r,c,"assistant-thinking",l.text,l.partialId);break;case"user_text":{l.meta==="task-notification"?r.push({kind:"agent-notification",seq:c,text:l.text,taskId:l.taskId,parentToolUseId:l.parentToolUseId}):l.meta?r.push({kind:"user-meta",seq:c,metaKind:l.meta,text:l.text}):r.push({kind:"user-text",seq:c,text:l.text,uuid:l.uuid,...l.sender&&(l.sender.principal!=="owner"||t5.test(l.text))?{senderDisplayName:l.sender.displayName}:{},senderPrincipal:((o=l.sender)==null?void 0:o.principal)==="guest"?"guest":"owner"});break}case"tool_call":fR(r,c,l.toolUseId,l.tool,l.input,l.toolKind);break;case"tool_result":{const u=i.get(l.toolUseId);if(u!==void 0){if(l.askQuestionAnswers){const f=r[u];f.submittedAnswers=l.askQuestionAnswers}i.delete(l.toolUseId);break}const d={kind:"tool-result",seq:c,toolUseId:l.toolUseId,output:l.output,error:l.error};l.toolResultExtra&&(d.toolResultExtra=l.toolResultExtra),r.push(d);break}case"attachment_memories":r.push({kind:"memory-callout",seq:c,memories:l.memories});break;case"permission_request":{if(!t||l.requestId!==t)break;r.push({kind:"permission-inline",seq:c,requestId:l.requestId,tool:l.tool,input:l.input});break}case"ask_user_question":i.set(l.toolUseId,r.length),r.push({kind:"question-card",seq:c,toolUseId:l.toolUseId,questions:l.questions});break;case"turn_end":{const u={kind:"turn-end",seq:c};l.durationMs!==void 0&&(u.durationMs=l.durationMs),l.reason!==void 0&&(u.reason=l.reason),l.turnId!==void 0&&(u.turnId=l.turnId),r.push(u);break}case"subagent_progress":{const u={kind:"agent-progress",seq:c,toolUseId:l.toolUseId,agentId:l.agentId,status:l.status};l.description&&(u.description=l.description),l.lastToolName&&(u.lastToolName=l.lastToolName),l.prompt&&(u.prompt=l.prompt),l.stats&&(u.stats=l.stats),r.push(u);break}case"error":r.push({kind:"error",seq:c,message:l.message});break}}const s=new Map(e.flatMap((a,l)=>a.turnId?[[a.seq??l,a.turnId]]:[]));for(const a of r){const l=s.get(a.seq);l&&(a.turnId=l)}return r}function fR(e,t,n,r,i,s){if(SK(r)){const o=kK(i);if(o){e.push({kind:"todo-checklist",seq:t,toolUseId:n,todos:o});return}}if(r==="Agent"){const o=i??{},a=typeof o.description=="string"&&o.description?o.description:typeof o.subagent_type=="string"&&o.subagent_type?o.subagent_type:"Subagent";e.push({kind:"agent-call",seq:t,toolUseId:n,description:a,input:i});return}if(yK(r)){e.push({kind:"task-event",seq:t,toolUseId:n,name:r,input:i});return}e.push({kind:"tool-call",seq:t,toolUseId:n,tool:r,toolKind:s,input:i})}function Ik(e,t,n,r,i,s){let o=-1;for(let c=e.length-1;c>=0;c--)if(e[c].kind===n){o=c;break}const a=o>=0?e[o]:null;if(i){if(a&&a.partialId===i){const u=n==="assistant-text"?{kind:n,seq:a.seq,text:a.text+r,partialId:i,...s?{uuid:s}:{}}:{kind:n,seq:a.seq,text:a.text+r,partialId:i};e[o]=u;return}const c=n==="assistant-text"?{kind:n,seq:t,text:r,partialId:i,...s?{uuid:s}:{}}:{kind:n,seq:t,text:r,partialId:i};e.push(c);return}if(a&&a.partialId){const c=n==="assistant-text"?{kind:n,seq:a.seq,text:r,...s?{uuid:s}:{}}:{kind:n,seq:a.seq,text:r};e[o]=c;return}const l=n==="assistant-text"?{kind:n,seq:t,text:r,...s?{uuid:s}:{}}:{kind:n,seq:t,text:r};e.push(l)}const CK="AskUserQuestion";function h_(e,t=0,n){var o;const r=[],i=new Map;let s=t;for(const a of e){const l=s++,c=a.toolUseId??`hist-${l}`;switch(a.kind){case"user-text":if(a.meta==="task-notification")r.push({kind:"agent-notification",seq:l,text:a.text??"",taskId:a.taskId,parentToolUseId:a.parentToolUseId});else if(a.meta)r.push({kind:"user-meta",seq:l,metaKind:a.meta,text:a.text??""});else{const u=t5.exec(a.text??""),d=(o=H9.exec(a.text??""))==null?void 0:o[1],f=(u==null?void 0:u[2])??d,p=(u==null?void 0:u[1])==="guest"||d?"guest":"owner";r.push({kind:"user-text",seq:l,text:a.text??"",uuid:a.uuid,...f?{senderDisplayName:f}:{},senderPrincipal:p})}break;case"assistant-text":r.push({kind:"assistant-text",seq:l,text:a.text??"",uuid:a.uuid});break;case"tool_call":{if(a.tool===CK){const u=a.input??{},d=Array.isArray(u.questions)?u.questions:[];i.set(c,r.length),r.push({kind:"question-card",seq:l,toolUseId:c,questions:d});break}fR(r,l,c,a.tool??"",a.input,n);break}case"tool_result":{const u=i.get(c);if(u!==void 0){if(a.askQuestionAnswers){const f=r[u];f.submittedAnswers=a.askQuestionAnswers}i.delete(c);break}const d={kind:"tool-result",seq:l,toolUseId:c,output:a.output};a.error!==void 0&&(d.error=a.error),a.toolResultExtra&&(d.toolResultExtra=a.toolResultExtra),r.push(d);break}case"attachment_memories":a.memories&&a.memories.length>0&&r.push({kind:"memory-callout",seq:l,memories:a.memories});break;case"summary":break;case"turn-end":{const u={kind:"turn-end",seq:l};typeof a.durationMs=="number"&&(u.durationMs=a.durationMs),typeof a.turnId=="string"&&(u.turnId=a.turnId),r.push(u);break}}}return r}const EK=5e5;function IK(e){const t=EK-e.length;return e.map(n=>({...n,seq:n.seq+t}))}const _r=e=>typeof e=="string"?e:"",Tk=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):[];function TK(e){var s;if(e.type==="userMessage"){const a=(Array.isArray(e.content)?e.content:[]).map(c=>c.type==="text"?_r(c.text):c.type==="image"?`![图片](${_r(c.url)})`:c.type==="localImage"?`[图片](${_r(c.path)})`:"").filter(Boolean).join(`
517
517
  `),l=U9(a);return h_([{kind:"user-text",text:a,uuid:e.id,...l?{meta:l==="task"?"dispatch-task":"dispatch-result"}:{}}],0,"codex")}if(e.type==="agentMessage")return[{kind:"assistant-text",seq:0,text:_r(e.text),uuid:e.id}];if(e.type==="reasoning")return[{kind:"assistant-thinking",seq:0,text:[...Tk(e.summary),...Tk(e.content)].join(`
518
518
  `)}];if(e.type==="plan")return[{kind:"assistant-text",seq:0,text:_r(e.text),uuid:e.id}];if(e.type==="hookPrompt"||e.type==="contextCompaction")return[];if(e.type==="subAgentActivity"){const o=_r(e.agentThreadId);return e.kind==="started"?Ih([{kind:"tool_call",tool:"Agent",toolKind:"codex",toolUseId:`codex-agent-${o}`,input:{agentId:o,description:_r(e.agentPath)}}]):e.kind==="completed"||e.kind==="interrupted"?Ih([{kind:"tool_result",toolUseId:`codex-agent-${o}`,output:e.kind==="completed"?"已完成":"已中断"}]):[]}const t=e.type==="mcpToolCall"?`${_r(e.server)}.${_r(e.tool)}`:e.type==="dynamicToolCall"?_r(e.tool):e.type,n=e.type==="commandExecution"?{command:e.command,cwd:e.cwd}:e.type==="fileChange"?{changes:e.changes}:e.arguments??e,r=e.type==="commandExecution"?e.aggregatedOutput:e.type==="fileChange"?(Array.isArray(e.changes)?e.changes:[]).map(o=>_r(o.diff)).join(`
519
- `):e.result??e.contentItems??e.output??e,i=e.status==="failed"||e.status==="declined"||e.success===!1?_r((s=e.error)==null?void 0:s.message)||"执行失败":e.type==="commandExecution"&&typeof e.exitCode=="number"&&e.exitCode!==0?`exit ${e.exitCode}`:void 0;return Ih([{kind:"tool_call",tool:t,toolKind:"codex",toolUseId:e.id,input:n},{kind:"tool_result",toolUseId:e.id,output:r,...i?{error:i}:{}}])}function NK(e,t,n){const r=new Set,s=(t===void 0?e.items:[...e.items.filter(a=>a.type==="userMessage"&&!t.some(l=>l.id===a.id)),...t,...e.items.filter(a=>a.type!=="userMessage"&&!t.some(l=>l.id===a.id))]).flatMap(a=>r.has(a.id)?[]:(r.add(a.id),TK(a)));let o=!1;for(const a of s)a.kind==="user-text"&&(o&&(a.continuesTurn=!0),o=!0);return e.error&&s.push({kind:"error",seq:0,message:e.error.message}),s.push({kind:"turn-end",seq:0,turnId:e.id,...e.durationMs!==null?{durationMs:e.durationMs}:{},reason:e.status==="interrupted"?"interrupted":"completed"}),s.map((a,l)=>({...a,seq:n+l}))}function RK(e,t){const n=new Set(t.flatMap(s=>s.turnId?[s.turnId]:[])),r=new Set(t.flatMap(s=>"uuid"in s&&s.uuid?[s.uuid]:[]));let i=0;for(let s=0;s<e.length;s++){const o=e[s];if(o.kind==="turn-end"){if(o.turnId&&n.has(o.turnId))return e.slice(0,i);i=s+1}else if("uuid"in o&&o.uuid&&r.has(o.uuid))return e.slice(0,i)}return e}const Ud=()=>({turns:[],details:{},nextCursor:null,loading:!1,loadingOlder:!1,error:null});function dg(e,t){if(e.view!==t||!Array.isArray(e.data))throw new Error("历史分页需要更新对端 daemon;未退回全量加载")}function PK(e){const{api:t,sessionId:n,toolSessionId:r,forkedFromSessionId:i,initialTurnStarted:s=!1,enabled:o,focused:a=!0,refreshVersion:l=0}=e,c=`${o}:${n}:${r??""}`,u=g.useRef(c);u.current=c;const d=g.useRef(0),f=g.useRef(!0),[p,m]=g.useState(Ud),v=g.useRef(p);v.current=p;const w=g.useRef(!1),x=g.useRef(new Set),_=g.useRef(),b=g.useRef({sessionId:n,toolSessionId:r,enabled:o,focused:a,refreshVersion:l,api:t,hasAssignedThread:!!r});g.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]);const S=g.useCallback(async()=>{if(!o||!r)return;_.current={identity:c,version:l,api:t};const D=++d.current,R=c;w.current=!1,x.current.clear(),m(j=>({...j,loading:!0,loadingOlder:!1,error:null}));try{const j=await t.historyPage({sessionId:n,view:"turns",limit:10});if(dg(j,"turns"),!f.current||d.current!==D||u.current!==R||j.view!=="turns")return;m({...Ud(),turns:[...j.data].reverse(),snapshotId:j.snapshotId,nextCursor:j.nextCursor})}catch(j){if(!f.current||d.current!==D||u.current!==R)return;m(P=>({...P,loading:!1,error:j.message}))}},[t,c,o,r,n,l]);g.useEffect(()=>{const D=b.current,R=D.sessionId===n&&D.enabled,j=!!r||R&&D.hasAssignedThread;if(b.current={sessionId:n,toolSessionId:r,enabled:o,focused:a,refreshVersion:l,api:t,hasAssignedThread:j},!o||!r){d.current++,_.current=void 0,m(Ud());return}if(!a)return;const P=!!i&&!D.hasAssignedThread;if(R&&D.focused&&!D.toolSessionId&&s&&!P&&D.refreshVersion===l&&D.api===t){_.current={identity:c,version:l,api:t,deferred:!0};return}const A=_.current,M=R&&!D.focused&&((A==null?void 0:A.deferred)||v.current.error!==null);(A==null?void 0:A.identity)===c&&A.version===l&&A.api===t&&!M||(((A==null?void 0:A.identity)!==c||A.api!==t)&&m(Ud()),_.current={identity:c,version:l,api:t},S())},[t,c,n,o,r,i,s,a,l,S]);const C=g.useCallback(async()=>{const D=v.current;if(!o||D.loading||w.current||!D.nextCursor||!D.snapshotId)return;const R=d.current,j=c;w.current=!0,m(P=>({...P,loadingOlder:!0,error:null}));try{const P=await t.historyPage({sessionId:n,view:"turns",limit:10,cursor:D.nextCursor,snapshotId:D.snapshotId});if(dg(P,"turns"),!f.current||R!==d.current||j!==u.current||P.view!=="turns")return;if(P.snapshotId!==D.snapshotId||P.nextCursor===D.nextCursor)throw new Error("历史分页快照或游标失效,请刷新历史");m(A=>{const M=new Set(A.turns.map(L=>L.id));return{...A,turns:[...P.data.filter(L=>!M.has(L.id)).reverse(),...A.turns],nextCursor:P.nextCursor,loadingOlder:!1}})}catch(P){f.current&&R===d.current&&j===u.current&&m(A=>({...A,loadingOlder:!1,error:P.message}))}finally{R===d.current&&(w.current=!1)}},[t,o,c,n]),k=g.useCallback(async(D,R=!1)=>{const j=v.current,P=j.details[D];if(!o||j.loading||!j.snapshotId||x.current.has(D)||P&&!P.error&&!R||R&&!(P!=null&&P.nextCursor))return;const A=d.current,M=c;x.current.add(D);const L=P??{items:[],loading:!1,error:null,nextCursor:null};m($=>({...$,details:{...$.details,[D]:{...L,loading:!0,error:null}}}));try{const $=await t.historyPage({sessionId:n,view:"items",turnId:D,limit:50,snapshotId:j.snapshotId,...P!=null&&P.nextCursor?{cursor:P.nextCursor}:{}});if(dg($,"items"),!f.current||A!==d.current||M!==u.current||$.view!=="items")return;if($.snapshotId!==j.snapshotId||P!=null&&P.nextCursor&&$.nextCursor===P.nextCursor)throw new Error("轮次详情快照或游标失效,请刷新历史");if($.data.some(B=>B.turnId!==D))throw new Error("轮次详情身份不匹配");const F=new Set(L.items.map(B=>B.id)),z=[...L.items,...$.data.map(B=>B.item).filter(B=>!F.has(B.id))];m(B=>({...B,details:{...B.details,[D]:{items:z,loading:!1,error:null,nextCursor:$.nextCursor}}}))}catch($){f.current&&A===d.current&&M===u.current&&m(F=>({...F,details:{...F.details,[D]:{...L,loading:!1,error:$.message}}}))}finally{A===d.current&&x.current.delete(D)}},[t,o,c,n]),T=g.useMemo(()=>p.turns.flatMap((D,R)=>{var j;return NK(D,(j=p.details[D.id])==null?void 0:j.items,(R-p.turns.length)*1e6)}),[p.turns,p.details]),I=g.useMemo(()=>T.map(D=>({kind:D.kind,..."text"in D?{text:D.text}:{},..."uuid"in D?{uuid:D.uuid}:{}})),[T]);return{...p,lines:T,messages:I,total:p.turns.length,loadOlder:C,loadDetails:k,refresh:S}}const AK=/<command-name>([\s\S]*?)<\/command-name>/i,MK=/<command-message>([\s\S]*?)<\/command-message>/i,LK=/<command-args>([\s\S]*?)<\/command-args>/i,jK=/<(local-command-[a-z]+|command-(?:stdout|stderr))>[\s\S]*?<\/\1>/gi;function Yp(e){if(!e)return{commandName:null,commandMessage:null,commandArgs:null,body:""};const t=e.match(AK),n=e.match(MK),r=e.match(LK);let i=e;return t&&(i=i.replace(t[0],"")),n&&(i=i.replace(n[0],"")),r&&(i=i.replace(r[0],"")),i=i.replace(jK,""),i=i.trim(),{commandName:t?t[1].trim():null,commandMessage:n?n[1].trim():null,commandArgs:r?r[1].trim():null,body:i}}function Nk(e){const t=Yp(e);return t.commandName?t.commandArgs?`${t.commandName} ${t.commandArgs}`:t.commandName:e}function Rk(e){return e.kind==="user-text"?!0:e.kind!=="user-meta"?!1:e.metaKind==="slash-command"||Ap(e.metaKind)}function DK(e,t){const n=t.find(Rk);if(!n)return e;const r=Nk(n.text);for(let s=e.length-1;s>=0;s--){const o=e[s];if(Rk(o)&&Nk(o.text)===r)return e.slice(0,s)}const i=e[e.length-1];return i!==void 0&&i.kind!=="turn-end"?[...e,{kind:"turn-end",seq:i.seq+1}]:e}function OK(e){return e==="running"||e==="observing"}function pR(e){return e==="running"||e==="running-idle"||e==="observing"}const BK=1e6,zK=5;function mR(e,t=!0){const n=dR(),r=es(),i=g.useMemo(()=>new by(r),[r]),s=Gi("sessions"),o=g.useMemo(()=>s==null?void 0:s.find(ie=>ie.sessionId===e),[s,e]),a=o==null?void 0:o.toolSessionId,l=o==null?void 0:o.tool,[c,u]=g.useState(0),[d,f]=g.useState(null),p=Zs(),m=g.useRef(p);m.current=p;const[v,w]=g.useState(null),x=g.useRef(null),_=g.useRef(null);g.useEffect(()=>(f(null),w(null),_.current=null,r.on("session:control",ie=>{const We=ie;if(!((We==null?void 0:We.sessionId)!==e||We.kind!==s9))if(We.synchronized===!0){const Ce=m.current.read(`session/${e}`);Ce!=null&&Ce.events.length&&w({first:Ce.events[0],count:Ce.events.length,historyBefore:x.current}),f(null),u($e=>$e+1)}else f("断线期间的部分内容未显示,完整内容已保存在云端")})),[r,e]);const b=g.useCallback(()=>{const ie=m.current.read(`session/${e}`),We=(ie==null?void 0:ie.events)??[];let Ce=We.length;for(;Ce>0&&We[Ce-1].kind!=="turn_end";)Ce--;Ce>0&&w({first:We[0],count:Ce,historyBefore:x.current}),_.current={historyBefore:x.current},u($e=>$e+1)},[e]),S=uR(e),{events:C,pendingPermissions:k,queued:T,status:I,clearPermission:D,restorePermission:R}=S,j=gz(),P=l==="codex",A=vK({api:i,sessionId:e,focused:t,toolSessionId:a,enabled:j!==void 0&&!P,refreshVersion:c,initialTurns:j==="owner"?void 0:zK,implicitCloseOnUserText:l==="codex"}),M=PK({api:i,sessionId:e,focused:t,toolSessionId:a,forkedFromSessionId:o==null?void 0:o.forkedFromSessionId,initialTurnStarted:C.some(ie=>ie.kind==="user_text"),enabled:j!==void 0&&P,refreshVersion:c}),L=P?M:A,$=g.useMemo(()=>({details:M.details,turnIds:new Set(M.turns.map(ie=>ie.id)),loadDetails:M.loadDetails}),[M.details,M.turns,M.loadDetails]);x.current=L.messages,g.useEffect(()=>{const ie=_.current;!ie||L.loading||L.messages===ie.historyBefore||(_.current=null,f(null))},[L.messages,L.loading]);const F=g.useMemo(()=>L.messages.filter(ie=>!ie.isSidechain),[L.messages]),z=g.useMemo(()=>{const ie=v;return!ie||L.messages===ie.historyBefore||L.loading||C[0]!==ie.first||C.length<ie.count?C:C.slice(ie.count)},[C,v,L.messages,L.loading]),B=g.useMemo(()=>P?M.lines:IK(h_(F,0,l)),[F,l,P,M.lines]),E=k[0]??null,U=g.useMemo(()=>Ih(z,(E==null?void 0:E.requestId)??null),[z,E==null?void 0:E.requestId]),q=g.useMemo(()=>P?RK(B,U):DK(B,U),[B,U,P]),O=g.useMemo(()=>U.map((ie,We)=>({...ie,seq:BK+We})),[U]),te=g.useMemo(()=>[...q,...O],[q,O]),se=g.useRef(L.messages);g.useEffect(()=>{se.current!==L.messages&&(se.current=L.messages,!L.loading&&(n==null||n.push({level:"info",msg:"chatflow.history.display",sessionId:e,meta:{historyMessages:L.messages.length,mainChainMessages:F.length,historyLines:q.length,panelLines:te.length,total:L.total,error:L.error!==null}})))},[L.messages,L.loading,L.total,L.error,F.length,q.length,te.length,n,e]);const G=pR(I),me=OK(I),Ie=(o==null?void 0:o.resolvedModel)??(o==null?void 0:o.model),ue=g.useMemo(()=>({sessionLabel:(o==null?void 0:o.label)||(o==null?void 0:o.aiLabel)||(o==null?void 0:o.larkChatName)||(o==null?void 0:o.larkChatId)||e,sessionId:e,...o!=null&&o.larkChatId?{larkChatName:o.larkChatName??o.larkChatId,larkChatType:o.larkChatType??"group"}:{},...Ie?{model:Ie}:{},...(()=>{const ie=o==null?void 0:o.gitBranch;return ie?{gitBranch:ie}:{}})(),...(()=>{const ie=hK(o);return ie!==void 0?{contextPct:ie}:{}})(),...o!=null&&o.cwd?{cwd:o.cwd}:{},...(()=>{const ie=o==null?void 0:o.permissionMode;return ie?{permissionMode:ie}:{}})(),procAlive:G,streamInProgress:me,pinnedAt:(o==null?void 0:o.pinnedAt)??null}),[o,e,Ie,G,me]),Ae=g.useMemo(()=>r.isOpen?I==="error"?{kind:"error",message:"session error"}:{kind:"ready"}:{kind:"closed"},[r.isOpen,I]),Oe=g.useCallback(async(ie,We)=>{await i.sessionSend(e,ie,We)},[i,e]),je=g.useCallback(async ie=>{await i.sessionDequeue(e,ie)},[i,e]),ge=g.useCallback(async()=>(await i.sessionInterrupt(e)).queued??[],[i,e]),Ze=g.useCallback(async ie=>{if(!(o!=null&&o.cwd)||!a)throw new Error("fork requires sessionFile with cwd + toolSessionId");await i.sessionFork({cwd:o.cwd,toolSessionId:a,messageUuid:ie})},[i,o==null?void 0:o.cwd,a]),dt=g.useCallback(async ie=>{await i.sessionRewind({sessionId:e,userMessageId:ie,dryRun:!1})},[i,e]),nt=g.useCallback(async ie=>{await i.sessionUpdate(e,{model:ie})},[i,e]),vt=g.useCallback(async()=>{await i.sessionNew(e)},[i,e]),jt=g.useCallback(async(ie,We)=>{const Ce=k.find($e=>$e.requestId===ie);Ce&&D(ie);try{await i.permissionRespond({sessionId:e,permissionRequestId:ie,allow:We==="allow"})}catch($e){throw!(($e==null?void 0:$e.message)??"").startsWith("PERMISSION_REQUEST_STALE")&&Ce&&R(Ce),$e}},[i,e,k,D,R]);return g.useMemo(()=>({lines:te,connState:Ae,meta:ue,historyLoading:L.loading,historyError:L.error,...P?{codexHistory:$,historyHasMore:M.nextCursor!==null,historyLoaded:M.snapshotId!==void 0,historyLoadingOlder:M.loadingOlder,loadOlderHistory:M.loadOlder,refreshHistory:M.refresh}:{},historySyncError:d,pendingPermissions:k,queued:T,sendText:Oe,dequeue:je,interrupt:ge,fork:Ze,rewind:dt,switchModel:nt,clearSession:vt,respondPermission:jt,reloadFromCloud:b}),[te,Ae,ue,L.loading,L.error,P,$,M.nextCursor,M.snapshotId,M.loadingOlder,M.loadOlder,M.refresh,d,k,T,Oe,je,ge,Ze,dt,nt,vt,jt,b])}const $K={codex:"on-request",claude:"bypassPermissions",pi:"never"};function FK(e){const t={cwd:e.cwd,permissionMode:e.sourcePermissionMode??$K[e.sourceTool??"claude"]??"bypassPermissions",forkedFromSessionId:e.sourceSessionId};return e.sourceOwnerPersonaId&&(t.ownerPersonaId=e.sourceOwnerPersonaId),e.sourceTool&&(t.tool=e.sourceTool),e.sourceModel&&(t.model=e.sourceModel),e.sourceEffort&&(t.effort=e.sourceEffort),e.sourceProjectPath&&(t.projectPath=e.sourceProjectPath),t}async function HK(e,t,n,r={}){if(!t.toolSessionId)return null;const i=await e.sessionCreate({...FK({cwd:t.cwd,sourceSessionId:t.sessionId,sourcePermissionMode:t.permissionMode,sourceOwnerPersonaId:t.ownerPersonaId,sourceTool:t.tool,sourceModel:t.model,sourceEffort:t.effort,sourceProjectPath:t.projectPath}),...r.ephemeral?{ephemeral:!0}:{}});try{const{forkedToolSessionId:s}=await e.sessionFork({cwd:t.cwd,toolSessionId:t.toolSessionId,...t.tool==="codex"?{sourceSessionId:t.sessionId,turnId:n}:{messageUuid:n},targetCwd:i.cwd});await e.sessionResume(i.sessionId,s)}catch(s){throw e.sessionDelete(i.sessionId).catch(o=>De("quick-ask","fork rollback failed",o)),s}return i}async function UK(e,t,n){return HK(e,t,n,{ephemeral:!0})}function Wd(e){return e!=null&&e.ephemeral!==!1}async function WK(e,t){return t.stillEphemeral?(await e.sessionUpdate(t.sessionId,{ephemeral:!1}),!0):!1}function qK(e){try{const t=new URL(e);return t.protocol==="ws:"?t.protocol="http:":t.protocol==="wss:"&&(t.protocol="https:"),`${t.protocol}//${t.host}`}catch{return e}}function VK(e,t){try{const n=new URL(e),r=new URL(t);return n.protocol=r.protocol,n.host=r.host,n.toString()}catch{return e}}async function f_(e,t,n,r,i){const s=await e.attachmentSignUrl({sessionId:n,relPath:r,...i!==void 0?{ttlSeconds:i}:{}});return VK(s.url,qK(t.url))}async function Pk(e,t,n,r,i=60,s){const o=window.open("about:blank","_blank");try{s&&await s();const a=await f_(e,t,n,r,i);o?o.location.href=a:window.open(a,"_blank")}catch(a){throw o&&o.close(),a}}async function KK(e){var t;try{if((t=navigator.clipboard)!=null&&t.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.left="-9999px",n.style.top="0",n.setAttribute("readonly",""),document.body.appendChild(n),n.select();const r=document.execCommand("copy");return document.body.removeChild(n),r}catch{return!1}}const GK=300;function YK(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function XK(e,t){const n=Y1(),[r,i]=g.useState(null),s=g.useRef(null);g.useEffect(()=>{let a=!1;return(async()=>{try{const l=await n.kv.get(e);if(a)return;const c=YK(l);typeof c=="number"&&Number.isFinite(c)&&c>0?i(c):i(t)}catch{a||i(t)}})(),()=>{a=!0}},[n,e,t]);const o=g.useCallback(a=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{s.current=null,n.kv.set(e,a).catch(()=>{})},GK)},[n,e]);return g.useEffect(()=>()=>{s.current&&(clearTimeout(s.current),s.current=null)},[]),{initialSize:r??t,setSize:o,loading:r===null}}function ZK(){return{quickAsk:null,mds:[],active:null}}function QK(e,t){return{...e,quickAsk:{sessionId:t.sessionId,ephemeral:!0},active:"quick-ask"}}function JK(e,t){const n=e.mds.includes(t);return{...e,mds:n?e.mds:[...e.mds,t],active:{kind:"md",relPath:t}}}function eG(e){if(!e.quickAsk)return e;const t=e.active==="quick-ask",n=e.mds[0],r=t?n?{kind:"md",relPath:n}:null:e.active;return{...e,quickAsk:null,active:r}}function tG(e){return e.quickAsk?{...e,quickAsk:{...e.quickAsk,ephemeral:!1}}:e}function nG(e,t){const n=e.mds.indexOf(t);if(n<0)return e;const r=e.mds.filter(l=>l!==t);if(!(e.active!==null&&e.active!=="quick-ask"&&e.active.relPath===t))return{...e,mds:r};const s=r[n],o=n>0?r[n-1]:void 0;let a=null;return s?a={kind:"md",relPath:s}:o?a={kind:"md",relPath:o}:e.quickAsk&&(a="quick-ask"),{...e,mds:r,active:a}}function rG(e,t){return{...e,active:t}}function iG(e,t){return e===null||t===null||e==="quick-ask"||t==="quick-ask"?e===t:e.relPath===t.relPath}function gR(e){return e.quickAsk!==null||e.mds.length>0}function sG(e,t,n,r=!0){const i=g.useRef({sid:null,tsid:void 0});g.useEffect(()=>{const s=i.current;i.current={sid:t,tsid:n},!(!r||!n||s.sid===t&&(s.tsid===void 0||s.tsid===null)&&typeof n=="string")&&e.sessionObserve({sessionId:t,toolSessionId:n}).catch(()=>{})},[e,t,n,r])}function oG(e,t,n){const r=g.useRef(e),i=g.useRef(t),s=g.useRef(n);s.current=n,g.useEffect(()=>{const o=r.current,a=i.current;r.current=e,i.current=t;const l=o!==e,c=typeof a=="string"&&t==null;!l&&!c||s.current()},[e,t])}const aG=/^Scheduled (?:recurring job|one-shot task) ([0-9a-f]{8}) \(([^)]+)\)/;function lG(e){const t=new Map,n=new Map,r=new Map;for(const i of e)if(i.kind==="tool_call"&&i.tool==="CronCreate"){const s=i.input;if(!s||typeof s.cron!="string"||typeof s.prompt!="string")continue;const o=i.ts;t.set(i.toolUseId,{cron:s.cron,prompt:s.prompt,recurring:s.recurring!==!1,ts:typeof o=="string"?o:"",toolUseId:i.toolUseId})}else if(i.kind==="tool_call"&&i.tool==="CronDelete"){const s=i.input;if(!s||typeof s.id!="string")continue;n.set(i.toolUseId,s.id)}else if(i.kind==="tool_result"){const s=t.get(i.toolUseId);if(s){if(t.delete(i.toolUseId),i.error||typeof i.output!="string")continue;const a=i.output.match(aG);if(!a)continue;r.set(a[1],{id:a[1],cron:s.cron,prompt:s.prompt,recurring:s.recurring,humanSchedule:a[2],createdAt:s.ts,toolUseId:s.toolUseId});continue}const o=n.get(i.toolUseId);o!==void 0&&(n.delete(i.toolUseId),i.error||r.delete(o))}return Array.from(r.values()).sort((i,s)=>i.createdAt.localeCompare(s.createdAt))}function vR(e){var n;if(e.error)return!1;if(e.pending)return!0;if(e.notifications.length>0)return!1;const t=(n=e.progress)==null?void 0:n.status;return t==="running"?!0:t==="started"?cG(e.input):!1}function cG(e){return!e||typeof e!="object"?!1:e.run_in_background===!0}function uG(e){return e.filter(t=>t.kind==="merged-agent"&&vR(t))}function xR(e){var d;const{tasks:t,lastEventIndex:n}=wK(e);let r=-1;for(let f=e.length-1;f>=0;f--)if(e[f].kind==="todo-checklist"){r=f;break}const i=[],s=new Map,o=new Map,a=new Map,l=new Map,c=new Map,u=(f,p)=>{var _,b,S,C,k,T;const m=i[f],v=c.get(f),w=v!==void 0&&v!==p.toolUseId;if(!w&&(((_=m.progress)==null?void 0:_.status)==="completed"||((b=m.progress)==null?void 0:b.status)==="failed"))return;if(c.set(f,p.toolUseId),l.set(p.agentId,f),w&&(m.pending=!0,(S=m.toolResultExtra)!=null&&S.stats)){const{stats:I,...D}=m.toolResultExtra;m.toolResultExtra=D}const x={agentId:p.agentId,status:p.status};p.description?x.description=p.description:(C=m.progress)!=null&&C.description&&(x.description=m.progress.description),p.lastToolName?x.lastToolName=p.lastToolName:!w&&((k=m.progress)!=null&&k.lastToolName)&&(x.lastToolName=m.progress.lastToolName),p.stats?x.stats=p.stats:!w&&((T=m.progress)!=null&&T.stats)&&(x.stats=m.progress.stats),m.progress=x,(p.status==="completed"||p.status==="failed")&&(m.pending=!1)};for(let f=0;f<e.length;f++){const p=e[f];switch(p.kind){case"tool-call":{const m={kind:"merged-tool",seq:p.seq,tool:p.tool,toolKind:p.toolKind,toolUseId:p.toolUseId,input:p.input,pending:!0};s.set(p.toolUseId,i.length),i.push(m);break}case"tool-result":{const m=s.get(p.toolUseId);if(m!==void 0){const w=i[m];w.output=p.output,w.error=p.error,w.pending=!1,s.delete(p.toolUseId);break}const v=o.get(p.toolUseId);if(v!==void 0){const w=i[v];w.output=p.output,w.error=p.error,w.pending=!1,p.toolResultExtra&&(w.toolResultExtra=p.toolResultExtra),(d=p.toolResultExtra)!=null&&d.agentId&&(l.set(p.toolResultExtra.agentId,v),c.set(v,p.toolUseId));break}break}case"agent-call":{const m={kind:"merged-agent",seq:p.seq,toolUseId:p.toolUseId,description:p.description,input:p.input,pending:!0,notifications:[]},v=i.length;o.set(p.toolUseId,v),i.push(m);const w=a.get(p.toolUseId);w&&(u(v,w),a.delete(p.toolUseId));break}case"agent-progress":{const m=o.get(p.toolUseId)??l.get(p.agentId);if(m!==void 0){u(m,p);break}const v=a.get(p.toolUseId);if((v==null?void 0:v.status)==="completed"||(v==null?void 0:v.status)==="failed")break;a.set(p.toolUseId,p);break}case"agent-notification":{const m=(p.parentToolUseId?o.get(p.parentToolUseId):void 0)??(p.taskId?l.get(p.taskId):void 0);if(m!==void 0){i[m].notifications.push({text:p.text,taskId:p.taskId});break}i.push({kind:"agent-notification",seq:p.seq,text:p.text,taskId:p.taskId,parentToolUseId:p.parentToolUseId});break}case"todo-checklist":{f===r&&p.todos.length>0&&i.push({kind:"todo-checklist",seq:p.seq,toolUseId:p.toolUseId,todos:p.todos});break}case"task-event":{f===n&&t.length>0&&i.push({kind:"plan-card",seq:p.seq,tasks:t});break}default:i.push(p)}}return i}const dG=new Set(["permission-inline","question-card"]);function hG(e){return e.kind==="user-text"?!0:e.kind!=="user-meta"?!1:e.metaKind==="slash-command"||Ap(e.metaKind)}function fG(e){return e.kind==="user-text"&&e.continuesTurn===!0}function pG(e,t={}){const n=[];let r=null;const i=(s,o)=>{r&&(n.push(mG(r,s,o)),r=null)};for(const s of e){if(s.kind==="turn-end"){i(s,!0);continue}if(hG(s)&&(r===null||!fG(s))){i(void 0,!0),r={query:s,body:[]};continue}r===null?r={body:[s]}:r.body.push(s)}return i(void 0,t.closeTrailing===!0),n}function mG(e,t,n){const{query:r,body:i}=e,s=gG(i,t,n),o=vG(i,s),a=yG(i,o),l=r??i[0]??t,c={kind:"turn",seq:l?l.seq:0,status:s,process:a,tail:o};return t!=null&&t.turnId&&(c.turnId=t.turnId),r&&(c.query=r),(t==null?void 0:t.durationMs)!==void 0&&(c.durationMs=t.durationMs),c}function gG(e,t,n){if(!n)return"running";if((t==null?void 0:t.reason)==="interrupted")return"interrupted";const r=Zv(e,i=>i.kind==="error");return r>=0&&!e.slice(r+1).some(s=>s.kind==="assistant-text")?"error":"done"}function vG(e,t){if(t==="running"){const r=[];for(let i=e.length-1;i>=0&&dG.has(e[i].kind);i--)r.unshift(e[i]);return r}const n=t==="error"?Zv(e,r=>r.kind==="error"):Zv(e,r=>r.kind==="assistant-text");return n>=0?[e[n]]:[]}const xG=new Set(["assistant-thinking","user-meta"]);function yG(e,t){const n=new Set(t),r=[];let i=null;const s=()=>{i&&(r.push({kind:"tool-group",seq:i[0].seq,items:i}),i=null)};for(const o of e){if(n.has(o)){s();continue}if(o.kind==="merged-tool"){i?i.push(o):i=[o];continue}if(xG.has(o.kind)){r.push(o);continue}s(),r.push(o)}return s(),r}function Zv(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}const _G={Read:["正在读取","已读取"],Bash:["正在运行","已运行"],Grep:["正在搜索","已搜索"],Glob:["正在搜索","已搜索"],Edit:["正在编辑","已编辑"],Write:["正在写入","已写入"],WebFetch:["正在抓取","已抓取"],WebSearch:["正在搜索","已搜索"],Skill:["正在读取","已读取"]};function bG(e){if(!e||typeof e!="object")return"";const t=e,n=t.command??t.file_path??t.path??t.pattern??t.query??t.url??t.description;if(typeof n=="string")return n;for(const r of Object.values(t))if(typeof r=="string"&&r)return r;return""}function yR(e){const t=_G[e.tool],n=t?e.pending?t[0]:t[1]:e.pending?`正在执行 ${e.tool}`:`已执行 ${e.tool}`,r=bG(e.input);return r?`${n} ${r}`:n}function wG({item:e,renderItemDetail:t}){const[n,r]=g.useState(!1),i=n?Zn:zn,s=n?(t==null?void 0:t(e))??null:null;return h.jsxs("div",{className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>r(o=>!o),"aria-expanded":n,"data-testid":"tool-call-group-row",className:re("flex w-full items-center gap-1.5 text-left cursor-pointer min-w-0 py-0.5 text-[13px] hover:text-text-200",e.error?"text-destructive/80":"text-text-400"),children:[e.pending?h.jsx(dr,{className:"w-3.5 h-3.5 animate-spin shrink-0"}):h.jsx(i,{className:"w-3.5 h-3.5 shrink-0 opacity-60"}),h.jsx("span",{className:"truncate min-w-0",children:yR(e)})]}),n?h.jsx("div",{"data-testid":"tool-call-group-row-detail",className:"pl-5 py-1 min-w-0 space-y-1.5 text-[12px] text-text-300",children:s!==null?s:h.jsxs(h.Fragment,{children:[h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono",children:JSON.stringify(e.input,null,2)}),e.output!==void 0?h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono text-text-400",children:typeof e.output=="string"?e.output:JSON.stringify(e.output,null,2)}):null,e.error?h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono text-destructive",children:e.error}):null]})}):null]})}function SG({items:e,renderItemDetail:t}){const[n,r]=g.useState(!1);if(e.length===0)return null;const i=e.some(l=>l.pending),s=i?[...e].reverse().find(l=>l.pending):e[e.length-1],o=!i&&e.length>1?` 等 ${e.length} 项`:"",a=n?Zn:zn;return h.jsxs("div",{"data-testid":"tool-call-group",className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>r(l=>!l),"aria-expanded":n,"data-testid":"tool-call-group-header",className:"flex w-full items-center gap-1.5 text-left cursor-pointer min-w-0 py-0.5 text-[13px] text-text-400 hover:text-text-200",children:[i&&!n?h.jsx(dr,{className:"w-3.5 h-3.5 animate-spin shrink-0"}):h.jsx(a,{className:"w-3.5 h-3.5 shrink-0"}),n?h.jsx("span",{className:"min-w-0 truncate opacity-70",children:i?"正在执行":`${e.length} 项`}):h.jsxs("span",{className:re("truncate min-w-0",i&&"text-text-300"),children:[yR(s),o]})]}),n?h.jsx("div",{className:"mt-0.5 flex flex-col pl-5",children:e.map(l=>h.jsx(wG,{item:l,renderItemDetail:t},l.toolUseId))}):null]})}function kG(e){const t=Math.round(e/1e3);if(t<60)return`${t}秒`;const n=Math.floor(t/60),r=t%60;return r>0?`${n}分${r}秒`:`${n}分钟`}function CG(e,t){const n=t!==void 0?`耗时 ${kG(t)}`:"";switch(e){case"interrupted":return n?`已中断 · ${n}`:"已中断";case"error":return n?`出错 · ${n}`:"出错";default:return n||"已完成"}}function EG({status:e="done",durationMs:t,defaultExpanded:n=!1,onExpandedChange:r,children:i}){const[s,o]=g.useState(n),a=s?Zn:zn;return h.jsxs("div",{"data-testid":"turn-process-block",className:"min-w-0 max-w-full border-t border-border pt-2",children:[h.jsxs("button",{type:"button",onClick:()=>{const l=!s;o(l),r==null||r(l)},"aria-expanded":s,"data-testid":"turn-process-block-header",className:re("flex w-full items-center gap-1 text-left cursor-pointer min-w-0 py-0.5 text-[13px]",e!=="done"?"text-destructive/80 hover:text-destructive":"text-text-400 hover:text-text-200"),children:[h.jsx("span",{className:"truncate min-w-0",children:CG(e,t)}),h.jsx(a,{className:"w-3.5 h-3.5 shrink-0"})]}),s?h.jsx("div",{"data-testid":"turn-process-body",className:"mt-2 flex flex-col gap-2 border-l-2 border-border pl-3",children:i}):null]})}const IG=/<(system-reminder|related-dir|clawd-shift-fire)\b[^>]*>[\s\S]*?<\/\1>/gi,TG=/<builder-preview\b[^>]*\/>/gi,NG=/<(clawd-dispatch-task|clawd-dispatch-result)\b[^>]*>([\s\S]*?)<\/\1>/gi,RG=/<\/?(brief|detail|files)>/gi;function _R(e){return e?e.replace(NG,(t,n,r)=>Y9(r.replace(RG,"")).trim()).replace(IG,"").replace(TG,"").trim():""}const PG=_R;function AG(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const MG=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,LG=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jG={};function Ak(e,t){return(jG.jsx?LG:MG).test(e)}const DG=/[ \t\n\f\r]/g;function OG(e){return typeof e=="object"?e.type==="text"?Mk(e.value):!1:Mk(e)}function Mk(e){return e.replace(DG,"")===""}class Ku{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ku.prototype.normal={};Ku.prototype.property={};Ku.prototype.space=void 0;function bR(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Ku(n,r,t)}function Qv(e){return e.toLowerCase()}class Qn{constructor(t,n){this.attribute=n,this.property=t}}Qn.prototype.attribute="";Qn.prototype.booleanish=!1;Qn.prototype.boolean=!1;Qn.prototype.commaOrSpaceSeparated=!1;Qn.prototype.commaSeparated=!1;Qn.prototype.defined=!1;Qn.prototype.mustUseProperty=!1;Qn.prototype.number=!1;Qn.prototype.overloadedBoolean=!1;Qn.prototype.property="";Qn.prototype.spaceSeparated=!1;Qn.prototype.space=void 0;let BG=0;const Be=Zo(),zt=Zo(),Jv=Zo(),J=Zo(),ht=Zo(),qa=Zo(),nr=Zo();function Zo(){return 2**++BG}const ex=Object.freeze(Object.defineProperty({__proto__:null,boolean:Be,booleanish:zt,commaOrSpaceSeparated:nr,commaSeparated:qa,number:J,overloadedBoolean:Jv,spaceSeparated:ht},Symbol.toStringTag,{value:"Module"})),hg=Object.keys(ex);class p_ extends Qn{constructor(t,n,r,i){let s=-1;if(super(t,n),Lk(this,"space",i),typeof r=="number")for(;++s<hg.length;){const o=hg[s];Lk(this,hg[s],(r&ex[o])===ex[o])}}}p_.prototype.defined=!0;function Lk(e,t,n){n&&(e[t]=n)}function Ml(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new p_(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Qv(r)]=r,n[Qv(s.attribute)]=r}return new Ku(t,n,e.space)}const wR=Ml({properties:{ariaActiveDescendant:null,ariaAtomic:zt,ariaAutoComplete:null,ariaBusy:zt,ariaChecked:zt,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:ht,ariaCurrent:null,ariaDescribedBy:ht,ariaDetails:null,ariaDisabled:zt,ariaDropEffect:ht,ariaErrorMessage:null,ariaExpanded:zt,ariaFlowTo:ht,ariaGrabbed:zt,ariaHasPopup:null,ariaHidden:zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ht,ariaLevel:J,ariaLive:null,ariaModal:zt,ariaMultiLine:zt,ariaMultiSelectable:zt,ariaOrientation:null,ariaOwns:ht,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:zt,ariaReadOnly:zt,ariaRelevant:null,ariaRequired:zt,ariaRoleDescription:ht,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:zt,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function SR(e,t){return t in e?e[t]:t}function kR(e,t){return SR(e,t.toLowerCase())}const zG=Ml({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:qa,acceptCharset:ht,accessKey:ht,action:null,allow:null,allowFullScreen:Be,allowPaymentRequest:Be,allowUserMedia:Be,alt:null,as:null,async:Be,autoCapitalize:null,autoComplete:ht,autoFocus:Be,autoPlay:Be,blocking:ht,capture:null,charSet:null,checked:Be,cite:null,className:ht,cols:J,colSpan:null,content:null,contentEditable:zt,controls:Be,controlsList:ht,coords:J|qa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Be,defer:Be,dir:null,dirName:null,disabled:Be,download:Jv,draggable:zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Be,formTarget:null,headers:ht,height:J,hidden:Jv,high:J,href:null,hrefLang:null,htmlFor:ht,httpEquiv:ht,id:null,imageSizes:null,imageSrcSet:null,inert:Be,inputMode:null,integrity:null,is:null,isMap:Be,itemId:null,itemProp:ht,itemRef:ht,itemScope:Be,itemType:ht,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Be,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:Be,muted:Be,name:null,nonce:null,noModule:Be,noValidate:Be,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Be,optimum:J,pattern:null,ping:ht,placeholder:null,playsInline:Be,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Be,referrerPolicy:null,rel:ht,required:Be,reversed:Be,rows:J,rowSpan:J,sandbox:ht,scope:null,scoped:Be,seamless:Be,selected:Be,shadowRootClonable:Be,shadowRootDelegatesFocus:Be,shadowRootMode:null,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:zt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:Be,useMap:null,value:zt,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ht,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Be,declare:Be,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:Be,noHref:Be,noShade:Be,noWrap:Be,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:zt,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Be,disableRemotePlayback:Be,prefix:null,property:null,results:J,security:null,unselectable:null},space:"html",transform:kR}),$G=Ml({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:nr,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:ht,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:Be,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:qa,g2:qa,glyphName:qa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:nr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:J,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ht,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:nr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:nr,rev:nr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:nr,requiredFeatures:nr,requiredFonts:nr,requiredFormats:nr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:nr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:nr,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:nr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:SR}),CR=Ml({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),ER=Ml({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:kR}),IR=Ml({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),FG={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},HG=/[A-Z]/g,jk=/-[a-z]/g,UG=/^data[-\w.:]+$/i;function WG(e,t){const n=Qv(t);let r=t,i=Qn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&UG.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(jk,VG);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!jk.test(s)){let o=s.replace(HG,qG);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=p_}return new i(r,t)}function qG(e){return"-"+e.toLowerCase()}function VG(e){return e.charAt(1).toUpperCase()}const KG=bR([wR,zG,CR,ER,IR],"html"),m_=bR([wR,$G,CR,ER,IR],"svg");function GG(e){return e.join(" ").trim()}var g_={},Dk=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,YG=/\n/g,XG=/^\s*/,ZG=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,QG=/^:\s*/,JG=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,eY=/^[;\s]*/,tY=/^\s+|\s+$/g,nY=`
519
+ `):e.result??e.contentItems??e.output??e,i=e.status==="failed"||e.status==="declined"||e.success===!1?_r((s=e.error)==null?void 0:s.message)||"执行失败":e.type==="commandExecution"&&typeof e.exitCode=="number"&&e.exitCode!==0?`exit ${e.exitCode}`:void 0;return Ih([{kind:"tool_call",tool:t,toolKind:"codex",toolUseId:e.id,input:n},{kind:"tool_result",toolUseId:e.id,output:r,...i?{error:i}:{}}])}function NK(e,t,n){const r=new Set,s=(t===void 0?e.items:[...e.items.filter(a=>a.type==="userMessage"&&!t.some(l=>l.id===a.id)),...t,...e.items.filter(a=>a.type!=="userMessage"&&!t.some(l=>l.id===a.id))]).flatMap(a=>r.has(a.id)?[]:(r.add(a.id),TK(a)));let o=!1;for(const a of s)a.kind==="user-text"&&(o&&(a.continuesTurn=!0),o=!0);return e.error&&s.push({kind:"error",seq:0,message:e.error.message}),s.push({kind:"turn-end",seq:0,turnId:e.id,...e.durationMs!==null?{durationMs:e.durationMs}:{},reason:e.status==="interrupted"?"interrupted":"completed"}),s.map((a,l)=>({...a,seq:n+l}))}function RK(e,t){const n=new Map;let r=0;for(let s=0;s<t.length;s++){const o=t[s];o.kind==="turn-end"&&(o.turnId&&n.set(o.turnId,t.slice(r,s)),r=s+1)}r=0;let i;for(let s=0;s<e.length;s++){const o=e[s];if(o.kind!=="turn-end")continue;const a=o.turnId?n.get(o.turnId):void 0;let l=0;i=s>r&&a!==void 0&&e.slice(r,s).every(u=>{for(;l<a.length;){const d=a[l++];if(!((u.kind==="user-text"||u.kind==="user-meta")&&d.turnId!==o.turnId&&!("uuid"in u&&u.uuid&&"uuid"in d&&d.uuid===u.uuid))&&d.kind===u.kind&&(!d.turnId||d.turnId===o.turnId)&&"text"in u&&"text"in d&&d.text===u.text)return!0}return!1})?i??r:void 0,r=s+1}return i!==void 0&&r===e.length?e.slice(0,i):e}const Ud=()=>({turns:[],details:{},nextCursor:null,loading:!1,loadingOlder:!1,error:null});function dg(e,t){if(e.view!==t||!Array.isArray(e.data))throw new Error("历史分页需要更新对端 daemon;未退回全量加载")}function PK(e){const{api:t,sessionId:n,toolSessionId:r,forkedFromSessionId:i,initialTurnStarted:s=!1,enabled:o,focused:a=!0,refreshVersion:l=0}=e,c=`${o}:${n}:${r??""}`,u=g.useRef(c);u.current=c;const d=g.useRef(0),f=g.useRef(!0),[p,m]=g.useState(Ud),v=g.useRef(p);v.current=p;const w=g.useRef(!1),x=g.useRef(new Set),_=g.useRef(),b=g.useRef({sessionId:n,toolSessionId:r,enabled:o,focused:a,refreshVersion:l,api:t,hasAssignedThread:!!r});g.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]);const S=g.useCallback(async()=>{if(!o||!r)return;_.current={identity:c,version:l,api:t};const D=++d.current,R=c;w.current=!1,x.current.clear(),m(j=>({...j,loading:!0,loadingOlder:!1,error:null}));try{const j=await t.historyPage({sessionId:n,view:"turns",limit:10});if(dg(j,"turns"),!f.current||d.current!==D||u.current!==R||j.view!=="turns")return;m({...Ud(),turns:[...j.data].reverse(),snapshotId:j.snapshotId,nextCursor:j.nextCursor})}catch(j){if(!f.current||d.current!==D||u.current!==R)return;m(P=>({...P,loading:!1,error:j.message}))}},[t,c,o,r,n,l]);g.useEffect(()=>{const D=b.current,R=D.sessionId===n&&D.enabled,j=!!r||R&&D.hasAssignedThread;if(b.current={sessionId:n,toolSessionId:r,enabled:o,focused:a,refreshVersion:l,api:t,hasAssignedThread:j},!o||!r){d.current++,_.current=void 0,m(Ud());return}if(!a)return;const P=!!i&&!D.hasAssignedThread;if(R&&D.focused&&!D.toolSessionId&&s&&!P&&D.refreshVersion===l&&D.api===t){_.current={identity:c,version:l,api:t,deferred:!0};return}const A=_.current,M=R&&!D.focused&&((A==null?void 0:A.deferred)||v.current.error!==null);(A==null?void 0:A.identity)===c&&A.version===l&&A.api===t&&!M||(((A==null?void 0:A.identity)!==c||A.api!==t)&&m(Ud()),_.current={identity:c,version:l,api:t},S())},[t,c,n,o,r,i,s,a,l,S]);const C=g.useCallback(async()=>{const D=v.current;if(!o||D.loading||w.current||!D.nextCursor||!D.snapshotId)return;const R=d.current,j=c;w.current=!0,m(P=>({...P,loadingOlder:!0,error:null}));try{const P=await t.historyPage({sessionId:n,view:"turns",limit:10,cursor:D.nextCursor,snapshotId:D.snapshotId});if(dg(P,"turns"),!f.current||R!==d.current||j!==u.current||P.view!=="turns")return;if(P.snapshotId!==D.snapshotId||P.nextCursor===D.nextCursor)throw new Error("历史分页快照或游标失效,请刷新历史");m(A=>{const M=new Set(A.turns.map(L=>L.id));return{...A,turns:[...P.data.filter(L=>!M.has(L.id)).reverse(),...A.turns],nextCursor:P.nextCursor,loadingOlder:!1}})}catch(P){f.current&&R===d.current&&j===u.current&&m(A=>({...A,loadingOlder:!1,error:P.message}))}finally{R===d.current&&(w.current=!1)}},[t,o,c,n]),k=g.useCallback(async(D,R=!1)=>{const j=v.current,P=j.details[D];if(!o||j.loading||!j.snapshotId||x.current.has(D)||P&&!P.error&&!R||R&&!(P!=null&&P.nextCursor))return;const A=d.current,M=c;x.current.add(D);const L=P??{items:[],loading:!1,error:null,nextCursor:null};m($=>({...$,details:{...$.details,[D]:{...L,loading:!0,error:null}}}));try{const $=await t.historyPage({sessionId:n,view:"items",turnId:D,limit:50,snapshotId:j.snapshotId,...P!=null&&P.nextCursor?{cursor:P.nextCursor}:{}});if(dg($,"items"),!f.current||A!==d.current||M!==u.current||$.view!=="items")return;if($.snapshotId!==j.snapshotId||P!=null&&P.nextCursor&&$.nextCursor===P.nextCursor)throw new Error("轮次详情快照或游标失效,请刷新历史");if($.data.some(B=>B.turnId!==D))throw new Error("轮次详情身份不匹配");const F=new Set(L.items.map(B=>B.id)),z=[...L.items,...$.data.map(B=>B.item).filter(B=>!F.has(B.id))];m(B=>({...B,details:{...B.details,[D]:{items:z,loading:!1,error:null,nextCursor:$.nextCursor}}}))}catch($){f.current&&A===d.current&&M===u.current&&m(F=>({...F,details:{...F.details,[D]:{...L,loading:!1,error:$.message}}}))}finally{A===d.current&&x.current.delete(D)}},[t,o,c,n]),T=g.useMemo(()=>p.turns.flatMap((D,R)=>{var j;return NK(D,(j=p.details[D.id])==null?void 0:j.items,(R-p.turns.length)*1e6)}),[p.turns,p.details]),I=g.useMemo(()=>T.map(D=>({kind:D.kind,..."text"in D?{text:D.text}:{},..."uuid"in D?{uuid:D.uuid}:{}})),[T]);return{...p,lines:T,messages:I,total:p.turns.length,loadOlder:C,loadDetails:k,refresh:S}}const AK=/<command-name>([\s\S]*?)<\/command-name>/i,MK=/<command-message>([\s\S]*?)<\/command-message>/i,LK=/<command-args>([\s\S]*?)<\/command-args>/i,jK=/<(local-command-[a-z]+|command-(?:stdout|stderr))>[\s\S]*?<\/\1>/gi;function Yp(e){if(!e)return{commandName:null,commandMessage:null,commandArgs:null,body:""};const t=e.match(AK),n=e.match(MK),r=e.match(LK);let i=e;return t&&(i=i.replace(t[0],"")),n&&(i=i.replace(n[0],"")),r&&(i=i.replace(r[0],"")),i=i.replace(jK,""),i=i.trim(),{commandName:t?t[1].trim():null,commandMessage:n?n[1].trim():null,commandArgs:r?r[1].trim():null,body:i}}function Nk(e){const t=Yp(e);return t.commandName?t.commandArgs?`${t.commandName} ${t.commandArgs}`:t.commandName:e}function Rk(e){return e.kind==="user-text"?!0:e.kind!=="user-meta"?!1:e.metaKind==="slash-command"||Ap(e.metaKind)}function DK(e,t){const n=t.find(Rk);if(!n)return e;const r=Nk(n.text);for(let s=e.length-1;s>=0;s--){const o=e[s];if(Rk(o)&&Nk(o.text)===r)return e.slice(0,s)}const i=e[e.length-1];return i!==void 0&&i.kind!=="turn-end"?[...e,{kind:"turn-end",seq:i.seq+1}]:e}function OK(e){return e==="running"||e==="observing"}function pR(e){return e==="running"||e==="running-idle"||e==="observing"}const BK=1e6,zK=5;function mR(e,t=!0){const n=dR(),r=es(),i=g.useMemo(()=>new by(r),[r]),s=Gi("sessions"),o=g.useMemo(()=>s==null?void 0:s.find(ie=>ie.sessionId===e),[s,e]),a=o==null?void 0:o.toolSessionId,l=o==null?void 0:o.tool,[c,u]=g.useState(0),[d,f]=g.useState(null),p=Zs(),m=g.useRef(p);m.current=p;const[v,w]=g.useState(null),x=g.useRef(null),_=g.useRef(null);g.useEffect(()=>(f(null),w(null),_.current=null,r.on("session:control",ie=>{const We=ie;if(!((We==null?void 0:We.sessionId)!==e||We.kind!==s9))if(We.synchronized===!0){const Ce=m.current.read(`session/${e}`);Ce!=null&&Ce.events.length&&w({first:Ce.events[0],count:Ce.events.length,historyBefore:x.current}),f(null),u($e=>$e+1)}else f("断线期间的部分内容未显示,完整内容已保存在云端")})),[r,e]);const b=g.useCallback(()=>{const ie=m.current.read(`session/${e}`),We=(ie==null?void 0:ie.events)??[];let Ce=We.length;for(;Ce>0&&We[Ce-1].kind!=="turn_end";)Ce--;Ce>0&&w({first:We[0],count:Ce,historyBefore:x.current}),_.current={historyBefore:x.current},u($e=>$e+1)},[e]),S=uR(e),{events:C,pendingPermissions:k,queued:T,status:I,clearPermission:D,restorePermission:R}=S,j=gz(),P=l==="codex",A=vK({api:i,sessionId:e,focused:t,toolSessionId:a,enabled:j!==void 0&&!P,refreshVersion:c,initialTurns:j==="owner"?void 0:zK,implicitCloseOnUserText:l==="codex"}),M=PK({api:i,sessionId:e,focused:t,toolSessionId:a,forkedFromSessionId:o==null?void 0:o.forkedFromSessionId,initialTurnStarted:C.some(ie=>ie.kind==="user_text"),enabled:j!==void 0&&P,refreshVersion:c}),L=P?M:A,$=g.useMemo(()=>({details:M.details,turnIds:new Set(M.turns.map(ie=>ie.id)),loadDetails:M.loadDetails}),[M.details,M.turns,M.loadDetails]);x.current=L.messages,g.useEffect(()=>{const ie=_.current;!ie||L.loading||L.messages===ie.historyBefore||(_.current=null,f(null))},[L.messages,L.loading]);const F=g.useMemo(()=>L.messages.filter(ie=>!ie.isSidechain),[L.messages]),z=g.useMemo(()=>{const ie=v;return!ie||L.messages===ie.historyBefore||L.loading||C[0]!==ie.first||C.length<ie.count?C:C.slice(ie.count)},[C,v,L.messages,L.loading]),B=g.useMemo(()=>P?M.lines:IK(h_(F,0,l)),[F,l,P,M.lines]),E=k[0]??null,U=g.useMemo(()=>Ih(z,(E==null?void 0:E.requestId)??null),[z,E==null?void 0:E.requestId]),q=g.useMemo(()=>P?RK(B,U):DK(B,U),[B,U,P]),O=g.useMemo(()=>U.map((ie,We)=>({...ie,seq:BK+We})),[U]),te=g.useMemo(()=>[...q,...O],[q,O]),se=g.useRef(L.messages);g.useEffect(()=>{se.current!==L.messages&&(se.current=L.messages,!L.loading&&(n==null||n.push({level:"info",msg:"chatflow.history.display",sessionId:e,meta:{historyMessages:L.messages.length,mainChainMessages:F.length,historyLines:q.length,panelLines:te.length,total:L.total,error:L.error!==null}})))},[L.messages,L.loading,L.total,L.error,F.length,q.length,te.length,n,e]);const G=pR(I),me=OK(I),Ie=(o==null?void 0:o.resolvedModel)??(o==null?void 0:o.model),ue=g.useMemo(()=>({sessionLabel:(o==null?void 0:o.label)||(o==null?void 0:o.aiLabel)||(o==null?void 0:o.larkChatName)||(o==null?void 0:o.larkChatId)||e,sessionId:e,...o!=null&&o.larkChatId?{larkChatName:o.larkChatName??o.larkChatId,larkChatType:o.larkChatType??"group"}:{},...Ie?{model:Ie}:{},...(()=>{const ie=o==null?void 0:o.gitBranch;return ie?{gitBranch:ie}:{}})(),...(()=>{const ie=hK(o);return ie!==void 0?{contextPct:ie}:{}})(),...o!=null&&o.cwd?{cwd:o.cwd}:{},...(()=>{const ie=o==null?void 0:o.permissionMode;return ie?{permissionMode:ie}:{}})(),procAlive:G,streamInProgress:me,pinnedAt:(o==null?void 0:o.pinnedAt)??null}),[o,e,Ie,G,me]),Ae=g.useMemo(()=>r.isOpen?I==="error"?{kind:"error",message:"session error"}:{kind:"ready"}:{kind:"closed"},[r.isOpen,I]),Oe=g.useCallback(async(ie,We)=>{await i.sessionSend(e,ie,We)},[i,e]),je=g.useCallback(async ie=>{await i.sessionDequeue(e,ie)},[i,e]),ge=g.useCallback(async()=>(await i.sessionInterrupt(e)).queued??[],[i,e]),Ze=g.useCallback(async ie=>{if(!(o!=null&&o.cwd)||!a)throw new Error("fork requires sessionFile with cwd + toolSessionId");await i.sessionFork({cwd:o.cwd,toolSessionId:a,messageUuid:ie})},[i,o==null?void 0:o.cwd,a]),dt=g.useCallback(async ie=>{await i.sessionRewind({sessionId:e,userMessageId:ie,dryRun:!1})},[i,e]),nt=g.useCallback(async ie=>{await i.sessionUpdate(e,{model:ie})},[i,e]),vt=g.useCallback(async()=>{await i.sessionNew(e)},[i,e]),jt=g.useCallback(async(ie,We)=>{const Ce=k.find($e=>$e.requestId===ie);Ce&&D(ie);try{await i.permissionRespond({sessionId:e,permissionRequestId:ie,allow:We==="allow"})}catch($e){throw!(($e==null?void 0:$e.message)??"").startsWith("PERMISSION_REQUEST_STALE")&&Ce&&R(Ce),$e}},[i,e,k,D,R]);return g.useMemo(()=>({lines:te,connState:Ae,meta:ue,historyLoading:L.loading,historyError:L.error,...P?{codexHistory:$,historyHasMore:M.nextCursor!==null,historyLoaded:M.snapshotId!==void 0,historyLoadingOlder:M.loadingOlder,loadOlderHistory:M.loadOlder,refreshHistory:M.refresh}:{},historySyncError:d,pendingPermissions:k,queued:T,sendText:Oe,dequeue:je,interrupt:ge,fork:Ze,rewind:dt,switchModel:nt,clearSession:vt,respondPermission:jt,reloadFromCloud:b}),[te,Ae,ue,L.loading,L.error,P,$,M.nextCursor,M.snapshotId,M.loadingOlder,M.loadOlder,M.refresh,d,k,T,Oe,je,ge,Ze,dt,nt,vt,jt,b])}const $K={codex:"on-request",claude:"bypassPermissions",pi:"never"};function FK(e){const t={cwd:e.cwd,permissionMode:e.sourcePermissionMode??$K[e.sourceTool??"claude"]??"bypassPermissions",forkedFromSessionId:e.sourceSessionId};return e.sourceOwnerPersonaId&&(t.ownerPersonaId=e.sourceOwnerPersonaId),e.sourceTool&&(t.tool=e.sourceTool),e.sourceModel&&(t.model=e.sourceModel),e.sourceEffort&&(t.effort=e.sourceEffort),e.sourceProjectPath&&(t.projectPath=e.sourceProjectPath),t}async function HK(e,t,n,r={}){if(!t.toolSessionId)return null;const i=await e.sessionCreate({...FK({cwd:t.cwd,sourceSessionId:t.sessionId,sourcePermissionMode:t.permissionMode,sourceOwnerPersonaId:t.ownerPersonaId,sourceTool:t.tool,sourceModel:t.model,sourceEffort:t.effort,sourceProjectPath:t.projectPath}),...r.ephemeral?{ephemeral:!0}:{}});try{const{forkedToolSessionId:s}=await e.sessionFork({cwd:t.cwd,toolSessionId:t.toolSessionId,...t.tool==="codex"?{sourceSessionId:t.sessionId,turnId:n}:{messageUuid:n},targetCwd:i.cwd});await e.sessionResume(i.sessionId,s)}catch(s){throw e.sessionDelete(i.sessionId).catch(o=>De("quick-ask","fork rollback failed",o)),s}return i}async function UK(e,t,n){return HK(e,t,n,{ephemeral:!0})}function Wd(e){return e!=null&&e.ephemeral!==!1}async function WK(e,t){return t.stillEphemeral?(await e.sessionUpdate(t.sessionId,{ephemeral:!1}),!0):!1}function qK(e){try{const t=new URL(e);return t.protocol==="ws:"?t.protocol="http:":t.protocol==="wss:"&&(t.protocol="https:"),`${t.protocol}//${t.host}`}catch{return e}}function VK(e,t){try{const n=new URL(e),r=new URL(t);return n.protocol=r.protocol,n.host=r.host,n.toString()}catch{return e}}async function f_(e,t,n,r,i){const s=await e.attachmentSignUrl({sessionId:n,relPath:r,...i!==void 0?{ttlSeconds:i}:{}});return VK(s.url,qK(t.url))}async function Pk(e,t,n,r,i=60,s){const o=window.open("about:blank","_blank");try{s&&await s();const a=await f_(e,t,n,r,i);o?o.location.href=a:window.open(a,"_blank")}catch(a){throw o&&o.close(),a}}async function KK(e){var t;try{if((t=navigator.clipboard)!=null&&t.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.left="-9999px",n.style.top="0",n.setAttribute("readonly",""),document.body.appendChild(n),n.select();const r=document.execCommand("copy");return document.body.removeChild(n),r}catch{return!1}}const GK=300;function YK(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function XK(e,t){const n=Y1(),[r,i]=g.useState(null),s=g.useRef(null);g.useEffect(()=>{let a=!1;return(async()=>{try{const l=await n.kv.get(e);if(a)return;const c=YK(l);typeof c=="number"&&Number.isFinite(c)&&c>0?i(c):i(t)}catch{a||i(t)}})(),()=>{a=!0}},[n,e,t]);const o=g.useCallback(a=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{s.current=null,n.kv.set(e,a).catch(()=>{})},GK)},[n,e]);return g.useEffect(()=>()=>{s.current&&(clearTimeout(s.current),s.current=null)},[]),{initialSize:r??t,setSize:o,loading:r===null}}function ZK(){return{quickAsk:null,mds:[],active:null}}function QK(e,t){return{...e,quickAsk:{sessionId:t.sessionId,ephemeral:!0},active:"quick-ask"}}function JK(e,t){const n=e.mds.includes(t);return{...e,mds:n?e.mds:[...e.mds,t],active:{kind:"md",relPath:t}}}function eG(e){if(!e.quickAsk)return e;const t=e.active==="quick-ask",n=e.mds[0],r=t?n?{kind:"md",relPath:n}:null:e.active;return{...e,quickAsk:null,active:r}}function tG(e){return e.quickAsk?{...e,quickAsk:{...e.quickAsk,ephemeral:!1}}:e}function nG(e,t){const n=e.mds.indexOf(t);if(n<0)return e;const r=e.mds.filter(l=>l!==t);if(!(e.active!==null&&e.active!=="quick-ask"&&e.active.relPath===t))return{...e,mds:r};const s=r[n],o=n>0?r[n-1]:void 0;let a=null;return s?a={kind:"md",relPath:s}:o?a={kind:"md",relPath:o}:e.quickAsk&&(a="quick-ask"),{...e,mds:r,active:a}}function rG(e,t){return{...e,active:t}}function iG(e,t){return e===null||t===null||e==="quick-ask"||t==="quick-ask"?e===t:e.relPath===t.relPath}function gR(e){return e.quickAsk!==null||e.mds.length>0}function sG(e,t,n,r=!0){const i=g.useRef({sid:null,tsid:void 0});g.useEffect(()=>{const s=i.current;i.current={sid:t,tsid:n},!(!r||!n||s.sid===t&&(s.tsid===void 0||s.tsid===null)&&typeof n=="string")&&e.sessionObserve({sessionId:t,toolSessionId:n}).catch(()=>{})},[e,t,n,r])}function oG(e,t,n){const r=g.useRef(e),i=g.useRef(t),s=g.useRef(n);s.current=n,g.useEffect(()=>{const o=r.current,a=i.current;r.current=e,i.current=t;const l=o!==e,c=typeof a=="string"&&t==null;!l&&!c||s.current()},[e,t])}const aG=/^Scheduled (?:recurring job|one-shot task) ([0-9a-f]{8}) \(([^)]+)\)/;function lG(e){const t=new Map,n=new Map,r=new Map;for(const i of e)if(i.kind==="tool_call"&&i.tool==="CronCreate"){const s=i.input;if(!s||typeof s.cron!="string"||typeof s.prompt!="string")continue;const o=i.ts;t.set(i.toolUseId,{cron:s.cron,prompt:s.prompt,recurring:s.recurring!==!1,ts:typeof o=="string"?o:"",toolUseId:i.toolUseId})}else if(i.kind==="tool_call"&&i.tool==="CronDelete"){const s=i.input;if(!s||typeof s.id!="string")continue;n.set(i.toolUseId,s.id)}else if(i.kind==="tool_result"){const s=t.get(i.toolUseId);if(s){if(t.delete(i.toolUseId),i.error||typeof i.output!="string")continue;const a=i.output.match(aG);if(!a)continue;r.set(a[1],{id:a[1],cron:s.cron,prompt:s.prompt,recurring:s.recurring,humanSchedule:a[2],createdAt:s.ts,toolUseId:s.toolUseId});continue}const o=n.get(i.toolUseId);o!==void 0&&(n.delete(i.toolUseId),i.error||r.delete(o))}return Array.from(r.values()).sort((i,s)=>i.createdAt.localeCompare(s.createdAt))}function vR(e){var n;if(e.error)return!1;if(e.pending)return!0;if(e.notifications.length>0)return!1;const t=(n=e.progress)==null?void 0:n.status;return t==="running"?!0:t==="started"?cG(e.input):!1}function cG(e){return!e||typeof e!="object"?!1:e.run_in_background===!0}function uG(e){return e.filter(t=>t.kind==="merged-agent"&&vR(t))}function xR(e){var d;const{tasks:t,lastEventIndex:n}=wK(e);let r=-1;for(let f=e.length-1;f>=0;f--)if(e[f].kind==="todo-checklist"){r=f;break}const i=[],s=new Map,o=new Map,a=new Map,l=new Map,c=new Map,u=(f,p)=>{var _,b,S,C,k,T;const m=i[f],v=c.get(f),w=v!==void 0&&v!==p.toolUseId;if(!w&&(((_=m.progress)==null?void 0:_.status)==="completed"||((b=m.progress)==null?void 0:b.status)==="failed"))return;if(c.set(f,p.toolUseId),l.set(p.agentId,f),w&&(m.pending=!0,(S=m.toolResultExtra)!=null&&S.stats)){const{stats:I,...D}=m.toolResultExtra;m.toolResultExtra=D}const x={agentId:p.agentId,status:p.status};p.description?x.description=p.description:(C=m.progress)!=null&&C.description&&(x.description=m.progress.description),p.lastToolName?x.lastToolName=p.lastToolName:!w&&((k=m.progress)!=null&&k.lastToolName)&&(x.lastToolName=m.progress.lastToolName),p.stats?x.stats=p.stats:!w&&((T=m.progress)!=null&&T.stats)&&(x.stats=m.progress.stats),m.progress=x,(p.status==="completed"||p.status==="failed")&&(m.pending=!1)};for(let f=0;f<e.length;f++){const p=e[f];switch(p.kind){case"tool-call":{const m={kind:"merged-tool",seq:p.seq,tool:p.tool,toolKind:p.toolKind,toolUseId:p.toolUseId,input:p.input,pending:!0};s.set(p.toolUseId,i.length),i.push(m);break}case"tool-result":{const m=s.get(p.toolUseId);if(m!==void 0){const w=i[m];w.output=p.output,w.error=p.error,w.pending=!1,s.delete(p.toolUseId);break}const v=o.get(p.toolUseId);if(v!==void 0){const w=i[v];w.output=p.output,w.error=p.error,w.pending=!1,p.toolResultExtra&&(w.toolResultExtra=p.toolResultExtra),(d=p.toolResultExtra)!=null&&d.agentId&&(l.set(p.toolResultExtra.agentId,v),c.set(v,p.toolUseId));break}break}case"agent-call":{const m={kind:"merged-agent",seq:p.seq,toolUseId:p.toolUseId,description:p.description,input:p.input,pending:!0,notifications:[]},v=i.length;o.set(p.toolUseId,v),i.push(m);const w=a.get(p.toolUseId);w&&(u(v,w),a.delete(p.toolUseId));break}case"agent-progress":{const m=o.get(p.toolUseId)??l.get(p.agentId);if(m!==void 0){u(m,p);break}const v=a.get(p.toolUseId);if((v==null?void 0:v.status)==="completed"||(v==null?void 0:v.status)==="failed")break;a.set(p.toolUseId,p);break}case"agent-notification":{const m=(p.parentToolUseId?o.get(p.parentToolUseId):void 0)??(p.taskId?l.get(p.taskId):void 0);if(m!==void 0){i[m].notifications.push({text:p.text,taskId:p.taskId});break}i.push({kind:"agent-notification",seq:p.seq,text:p.text,taskId:p.taskId,parentToolUseId:p.parentToolUseId});break}case"todo-checklist":{f===r&&p.todos.length>0&&i.push({kind:"todo-checklist",seq:p.seq,toolUseId:p.toolUseId,todos:p.todos});break}case"task-event":{f===n&&t.length>0&&i.push({kind:"plan-card",seq:p.seq,tasks:t});break}default:i.push(p)}}return i}const dG=new Set(["permission-inline","question-card"]);function hG(e){return e.kind==="user-text"?!0:e.kind!=="user-meta"?!1:e.metaKind==="slash-command"||Ap(e.metaKind)}function fG(e){return e.kind==="user-text"&&e.continuesTurn===!0}function pG(e,t={}){const n=[];let r=null;const i=(s,o)=>{r&&(n.push(mG(r,s,o)),r=null)};for(const s of e){if(s.kind==="turn-end"){i(s,!0);continue}if(hG(s)&&(r===null||!fG(s))){i(void 0,!0),r={query:s,body:[]};continue}r===null?r={body:[s]}:r.body.push(s)}return i(void 0,t.closeTrailing===!0),n}function mG(e,t,n){const{query:r,body:i}=e,s=gG(i,t,n),o=vG(i,s),a=yG(i,o),l=r??i[0]??t,c={kind:"turn",seq:l?l.seq:0,status:s,process:a,tail:o};return t!=null&&t.turnId&&(c.turnId=t.turnId),r&&(c.query=r),(t==null?void 0:t.durationMs)!==void 0&&(c.durationMs=t.durationMs),c}function gG(e,t,n){if(!n)return"running";if((t==null?void 0:t.reason)==="interrupted")return"interrupted";const r=Zv(e,i=>i.kind==="error");return r>=0&&!e.slice(r+1).some(s=>s.kind==="assistant-text")?"error":"done"}function vG(e,t){if(t==="running"){const r=[];for(let i=e.length-1;i>=0&&dG.has(e[i].kind);i--)r.unshift(e[i]);return r}const n=t==="error"?Zv(e,r=>r.kind==="error"):Zv(e,r=>r.kind==="assistant-text");return n>=0?[e[n]]:[]}const xG=new Set(["assistant-thinking","user-meta"]);function yG(e,t){const n=new Set(t),r=[];let i=null;const s=()=>{i&&(r.push({kind:"tool-group",seq:i[0].seq,items:i}),i=null)};for(const o of e){if(n.has(o)){s();continue}if(o.kind==="merged-tool"){i?i.push(o):i=[o];continue}if(xG.has(o.kind)){r.push(o);continue}s(),r.push(o)}return s(),r}function Zv(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}const _G={Read:["正在读取","已读取"],Bash:["正在运行","已运行"],Grep:["正在搜索","已搜索"],Glob:["正在搜索","已搜索"],Edit:["正在编辑","已编辑"],Write:["正在写入","已写入"],WebFetch:["正在抓取","已抓取"],WebSearch:["正在搜索","已搜索"],Skill:["正在读取","已读取"]};function bG(e){if(!e||typeof e!="object")return"";const t=e,n=t.command??t.file_path??t.path??t.pattern??t.query??t.url??t.description;if(typeof n=="string")return n;for(const r of Object.values(t))if(typeof r=="string"&&r)return r;return""}function yR(e){const t=_G[e.tool],n=t?e.pending?t[0]:t[1]:e.pending?`正在执行 ${e.tool}`:`已执行 ${e.tool}`,r=bG(e.input);return r?`${n} ${r}`:n}function wG({item:e,renderItemDetail:t}){const[n,r]=g.useState(!1),i=n?Zn:zn,s=n?(t==null?void 0:t(e))??null:null;return h.jsxs("div",{className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>r(o=>!o),"aria-expanded":n,"data-testid":"tool-call-group-row",className:re("flex w-full items-center gap-1.5 text-left cursor-pointer min-w-0 py-0.5 text-[13px] hover:text-text-200",e.error?"text-destructive/80":"text-text-400"),children:[e.pending?h.jsx(dr,{className:"w-3.5 h-3.5 animate-spin shrink-0"}):h.jsx(i,{className:"w-3.5 h-3.5 shrink-0 opacity-60"}),h.jsx("span",{className:"truncate min-w-0",children:yR(e)})]}),n?h.jsx("div",{"data-testid":"tool-call-group-row-detail",className:"pl-5 py-1 min-w-0 space-y-1.5 text-[12px] text-text-300",children:s!==null?s:h.jsxs(h.Fragment,{children:[h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono",children:JSON.stringify(e.input,null,2)}),e.output!==void 0?h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono text-text-400",children:typeof e.output=="string"?e.output:JSON.stringify(e.output,null,2)}):null,e.error?h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono text-destructive",children:e.error}):null]})}):null]})}function SG({items:e,renderItemDetail:t}){const[n,r]=g.useState(!1);if(e.length===0)return null;const i=e.some(l=>l.pending),s=i?[...e].reverse().find(l=>l.pending):e[e.length-1],o=!i&&e.length>1?` 等 ${e.length} 项`:"",a=n?Zn:zn;return h.jsxs("div",{"data-testid":"tool-call-group",className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>r(l=>!l),"aria-expanded":n,"data-testid":"tool-call-group-header",className:"flex w-full items-center gap-1.5 text-left cursor-pointer min-w-0 py-0.5 text-[13px] text-text-400 hover:text-text-200",children:[i&&!n?h.jsx(dr,{className:"w-3.5 h-3.5 animate-spin shrink-0"}):h.jsx(a,{className:"w-3.5 h-3.5 shrink-0"}),n?h.jsx("span",{className:"min-w-0 truncate opacity-70",children:i?"正在执行":`${e.length} 项`}):h.jsxs("span",{className:re("truncate min-w-0",i&&"text-text-300"),children:[yR(s),o]})]}),n?h.jsx("div",{className:"mt-0.5 flex flex-col pl-5",children:e.map(l=>h.jsx(wG,{item:l,renderItemDetail:t},l.toolUseId))}):null]})}function kG(e){const t=Math.round(e/1e3);if(t<60)return`${t}秒`;const n=Math.floor(t/60),r=t%60;return r>0?`${n}分${r}秒`:`${n}分钟`}function CG(e,t){const n=t!==void 0?`耗时 ${kG(t)}`:"";switch(e){case"interrupted":return n?`已中断 · ${n}`:"已中断";case"error":return n?`出错 · ${n}`:"出错";default:return n||"已完成"}}function EG({status:e="done",durationMs:t,defaultExpanded:n=!1,onExpandedChange:r,children:i}){const[s,o]=g.useState(n),a=s?Zn:zn;return h.jsxs("div",{"data-testid":"turn-process-block",className:"min-w-0 max-w-full border-t border-border pt-2",children:[h.jsxs("button",{type:"button",onClick:()=>{const l=!s;o(l),r==null||r(l)},"aria-expanded":s,"data-testid":"turn-process-block-header",className:re("flex w-full items-center gap-1 text-left cursor-pointer min-w-0 py-0.5 text-[13px]",e!=="done"?"text-destructive/80 hover:text-destructive":"text-text-400 hover:text-text-200"),children:[h.jsx("span",{className:"truncate min-w-0",children:CG(e,t)}),h.jsx(a,{className:"w-3.5 h-3.5 shrink-0"})]}),s?h.jsx("div",{"data-testid":"turn-process-body",className:"mt-2 flex flex-col gap-2 border-l-2 border-border pl-3",children:i}):null]})}const IG=/<(system-reminder|related-dir|clawd-shift-fire)\b[^>]*>[\s\S]*?<\/\1>/gi,TG=/<builder-preview\b[^>]*\/>/gi,NG=/<(clawd-dispatch-task|clawd-dispatch-result)\b[^>]*>([\s\S]*?)<\/\1>/gi,RG=/<\/?(brief|detail|files)>/gi;function _R(e){return e?e.replace(NG,(t,n,r)=>Y9(r.replace(RG,"")).trim()).replace(IG,"").replace(TG,"").trim():""}const PG=_R;function AG(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const MG=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,LG=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jG={};function Ak(e,t){return(jG.jsx?LG:MG).test(e)}const DG=/[ \t\n\f\r]/g;function OG(e){return typeof e=="object"?e.type==="text"?Mk(e.value):!1:Mk(e)}function Mk(e){return e.replace(DG,"")===""}class Ku{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ku.prototype.normal={};Ku.prototype.property={};Ku.prototype.space=void 0;function bR(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Ku(n,r,t)}function Qv(e){return e.toLowerCase()}class Qn{constructor(t,n){this.attribute=n,this.property=t}}Qn.prototype.attribute="";Qn.prototype.booleanish=!1;Qn.prototype.boolean=!1;Qn.prototype.commaOrSpaceSeparated=!1;Qn.prototype.commaSeparated=!1;Qn.prototype.defined=!1;Qn.prototype.mustUseProperty=!1;Qn.prototype.number=!1;Qn.prototype.overloadedBoolean=!1;Qn.prototype.property="";Qn.prototype.spaceSeparated=!1;Qn.prototype.space=void 0;let BG=0;const Be=Zo(),zt=Zo(),Jv=Zo(),J=Zo(),ht=Zo(),qa=Zo(),nr=Zo();function Zo(){return 2**++BG}const ex=Object.freeze(Object.defineProperty({__proto__:null,boolean:Be,booleanish:zt,commaOrSpaceSeparated:nr,commaSeparated:qa,number:J,overloadedBoolean:Jv,spaceSeparated:ht},Symbol.toStringTag,{value:"Module"})),hg=Object.keys(ex);class p_ extends Qn{constructor(t,n,r,i){let s=-1;if(super(t,n),Lk(this,"space",i),typeof r=="number")for(;++s<hg.length;){const o=hg[s];Lk(this,hg[s],(r&ex[o])===ex[o])}}}p_.prototype.defined=!0;function Lk(e,t,n){n&&(e[t]=n)}function Ml(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new p_(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Qv(r)]=r,n[Qv(s.attribute)]=r}return new Ku(t,n,e.space)}const wR=Ml({properties:{ariaActiveDescendant:null,ariaAtomic:zt,ariaAutoComplete:null,ariaBusy:zt,ariaChecked:zt,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:ht,ariaCurrent:null,ariaDescribedBy:ht,ariaDetails:null,ariaDisabled:zt,ariaDropEffect:ht,ariaErrorMessage:null,ariaExpanded:zt,ariaFlowTo:ht,ariaGrabbed:zt,ariaHasPopup:null,ariaHidden:zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ht,ariaLevel:J,ariaLive:null,ariaModal:zt,ariaMultiLine:zt,ariaMultiSelectable:zt,ariaOrientation:null,ariaOwns:ht,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:zt,ariaReadOnly:zt,ariaRelevant:null,ariaRequired:zt,ariaRoleDescription:ht,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:zt,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function SR(e,t){return t in e?e[t]:t}function kR(e,t){return SR(e,t.toLowerCase())}const zG=Ml({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:qa,acceptCharset:ht,accessKey:ht,action:null,allow:null,allowFullScreen:Be,allowPaymentRequest:Be,allowUserMedia:Be,alt:null,as:null,async:Be,autoCapitalize:null,autoComplete:ht,autoFocus:Be,autoPlay:Be,blocking:ht,capture:null,charSet:null,checked:Be,cite:null,className:ht,cols:J,colSpan:null,content:null,contentEditable:zt,controls:Be,controlsList:ht,coords:J|qa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Be,defer:Be,dir:null,dirName:null,disabled:Be,download:Jv,draggable:zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Be,formTarget:null,headers:ht,height:J,hidden:Jv,high:J,href:null,hrefLang:null,htmlFor:ht,httpEquiv:ht,id:null,imageSizes:null,imageSrcSet:null,inert:Be,inputMode:null,integrity:null,is:null,isMap:Be,itemId:null,itemProp:ht,itemRef:ht,itemScope:Be,itemType:ht,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Be,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:Be,muted:Be,name:null,nonce:null,noModule:Be,noValidate:Be,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Be,optimum:J,pattern:null,ping:ht,placeholder:null,playsInline:Be,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Be,referrerPolicy:null,rel:ht,required:Be,reversed:Be,rows:J,rowSpan:J,sandbox:ht,scope:null,scoped:Be,seamless:Be,selected:Be,shadowRootClonable:Be,shadowRootDelegatesFocus:Be,shadowRootMode:null,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:zt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:Be,useMap:null,value:zt,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ht,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Be,declare:Be,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:Be,noHref:Be,noShade:Be,noWrap:Be,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:zt,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Be,disableRemotePlayback:Be,prefix:null,property:null,results:J,security:null,unselectable:null},space:"html",transform:kR}),$G=Ml({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:nr,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:ht,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:Be,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:qa,g2:qa,glyphName:qa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:nr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:J,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ht,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:nr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:nr,rev:nr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:nr,requiredFeatures:nr,requiredFonts:nr,requiredFormats:nr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:nr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:nr,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:nr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:SR}),CR=Ml({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),ER=Ml({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:kR}),IR=Ml({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),FG={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},HG=/[A-Z]/g,jk=/-[a-z]/g,UG=/^data[-\w.:]+$/i;function WG(e,t){const n=Qv(t);let r=t,i=Qn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&UG.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(jk,VG);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!jk.test(s)){let o=s.replace(HG,qG);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=p_}return new i(r,t)}function qG(e){return"-"+e.toLowerCase()}function VG(e){return e.charAt(1).toUpperCase()}const KG=bR([wR,zG,CR,ER,IR],"html"),m_=bR([wR,$G,CR,ER,IR],"svg");function GG(e){return e.join(" ").trim()}var g_={},Dk=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,YG=/\n/g,XG=/^\s*/,ZG=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,QG=/^:\s*/,JG=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,eY=/^[;\s]*/,tY=/^\s+|\s+$/g,nY=`
520
520
  `,Ok="/",Bk="*",go="",rY="comment",iY="declaration";function sY(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(m){var v=m.match(YG);v&&(n+=v.length);var w=m.lastIndexOf(nY);r=~w?m.length-w:r+m.length}function s(){var m={line:n,column:r};return function(v){return v.position=new o(m),c(),v}}function o(m){this.start=m,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(m){var v=new Error(t.source+":"+n+":"+r+": "+m);if(v.reason=m,v.filename=t.source,v.line=n,v.column=r,v.source=e,!t.silent)throw v}function l(m){var v=m.exec(e);if(v){var w=v[0];return i(w),e=e.slice(w.length),v}}function c(){l(XG)}function u(m){var v;for(m=m||[];v=d();)v!==!1&&m.push(v);return m}function d(){var m=s();if(!(Ok!=e.charAt(0)||Bk!=e.charAt(1))){for(var v=2;go!=e.charAt(v)&&(Bk!=e.charAt(v)||Ok!=e.charAt(v+1));)++v;if(v+=2,go===e.charAt(v-1))return a("End of comment missing");var w=e.slice(2,v-2);return r+=2,i(w),e=e.slice(v),r+=2,m({type:rY,comment:w})}}function f(){var m=s(),v=l(ZG);if(v){if(d(),!l(QG))return a("property missing ':'");var w=l(JG),x=m({type:iY,property:zk(v[0].replace(Dk,go)),value:w?zk(w[0].replace(Dk,go)):go});return l(eY),x}}function p(){var m=[];u(m);for(var v;v=f();)v!==!1&&(m.push(v),u(m));return m}return c(),p()}function zk(e){return e?e.replace(tY,go):go}var oY=sY,aY=Oh&&Oh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(g_,"__esModule",{value:!0});g_.default=cY;const lY=aY(oY);function cY(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,lY.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;i?t(o,a,s):a&&(n=n||{},n[o]=a)}),n}var Xp={};Object.defineProperty(Xp,"__esModule",{value:!0});Xp.camelCase=void 0;var uY=/^--[a-zA-Z0-9_-]+$/,dY=/-([a-z])/g,hY=/^[^-]+$/,fY=/^-(webkit|moz|ms|o|khtml)-/,pY=/^-(ms)-/,mY=function(e){return!e||hY.test(e)||uY.test(e)},gY=function(e,t){return t.toUpperCase()},$k=function(e,t){return"".concat(t,"-")},vY=function(e,t){return t===void 0&&(t={}),mY(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(pY,$k):e=e.replace(fY,$k),e.replace(dY,gY))};Xp.camelCase=vY;var xY=Oh&&Oh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},yY=xY(g_),_Y=Xp;function tx(e,t){var n={};return!e||typeof e!="string"||(0,yY.default)(e,function(r,i){r&&i&&(n[(0,_Y.camelCase)(r,t)]=i)}),n}tx.default=tx;var bY=tx;const wY=Iu(bY),TR=NR("end"),v_=NR("start");function NR(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 SY(e){const t=v_(e),n=TR(e);if(t&&n)return{start:t,end:n}}function Dc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Fk(e.position):"start"in e||"end"in e?Fk(e):"line"in e||"column"in e?nx(e):""}function nx(e){return Hk(e&&e.line)+":"+Hk(e&&e.column)}function Fk(e){return nx(e&&e.start)+"-"+nx(e&&e.end)}function Hk(e){return e&&typeof e=="number"?e:1}class Nn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=Dc(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Nn.prototype.file="";Nn.prototype.name="";Nn.prototype.reason="";Nn.prototype.message="";Nn.prototype.stack="";Nn.prototype.column=void 0;Nn.prototype.line=void 0;Nn.prototype.ancestors=void 0;Nn.prototype.cause=void 0;Nn.prototype.fatal=void 0;Nn.prototype.place=void 0;Nn.prototype.ruleId=void 0;Nn.prototype.source=void 0;const x_={}.hasOwnProperty,kY=new Map,CY=/[A-Z]/g,EY=new Set(["table","tbody","thead","tfoot","tr"]),IY=new Set(["td","th"]),RR="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function TY(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.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=DY(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=jY(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?m_:KG,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=PR(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function PR(e,t,n){if(t.type==="element")return NY(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return RY(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return AY(e,t,n);if(t.type==="mdxjsEsm")return PY(e,t);if(t.type==="root")return MY(e,t,n);if(t.type==="text")return LY(e,t)}function NY(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=m_,e.schema=i),e.ancestors.push(t);const s=MR(e,t.tagName,!1),o=OY(e,t);let a=__(e,t);return EY.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!OG(l):!0})),AR(e,o,s,t),y_(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function RY(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}_u(e,t.position)}function PY(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);_u(e,t.position)}function AY(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=m_,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:MR(e,t.name,!0),o=BY(e,t),a=__(e,t);return AR(e,o,s,t),y_(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function MY(e,t,n){const r={};return y_(r,__(e,t)),e.create(t,e.Fragment,r,n)}function LY(e,t){return t.value}function AR(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function y_(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function jY(e,t,n){return r;function r(i,s,o,a){const c=Array.isArray(o.children)?n:t;return a?c(s,o,a):c(s,o)}}function DY(e,t){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=v_(r);return t(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function OY(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&x_.call(t.properties,i)){const s=zY(e,i,t.properties[i]);if(s){const[o,a]=s;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&IY.has(t.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function BY(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else _u(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,s=e.evaluater.evaluateExpression(a.expression)}else _u(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function __(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:kY;for(;++r<t.children.length;){const s=t.children[r];let o;if(e.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=i.get(l)||0;o=l+"-"+c,i.set(l,c+1)}}const a=PR(e,s,o);a!==void 0&&n.push(a)}return n}function zY(e,t,n){const r=WG(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?AG(n):GG(n)),r.property==="style"){let i=typeof n=="object"?n:$Y(e,String(n));return e.stylePropertyNameCase==="css"&&(i=FY(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?FG[r.property]||r.property:r.attribute,n]}}function $Y(e,t){try{return wY(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Nn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=RR+"#cannot-parse-style-attribute",i}}function MR(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const a=Ak(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=o}else r=Ak(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return x_.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);_u(e)}function _u(e,t){const n=new Nn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=RR+"#cannot-handle-mdx-estrees-without-createevaluater",n}function FY(e){const t={};let n;for(n in e)x_.call(e,n)&&(t[HY(n)]=e[n]);return t}function HY(e){let t=e.replace(CY,UY);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function UY(e){return"-"+e.toLowerCase()}const fg={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},WY={};function b_(e,t){const n=WY,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return LR(e,r,i)}function LR(e,t,n){if(qY(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Uk(e.children,t,n)}return Array.isArray(e)?Uk(e,t,n):""}function Uk(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=LR(e[i],t,n);return r.join("")}function qY(e){return!!(e&&typeof e=="object")}const Wk=document.createElement("i");function w_(e){const t="&"+e+";";Wk.innerHTML=t;const n=Wk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function yn(e,t,n,r){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function gn(e,t){return e.length>0?(yn(e,e.length,0,t),e):t}const qk={}.hasOwnProperty;function jR(e){const t={};let n=-1;for(;++n<e.length;)VY(t,e[n]);return t}function VY(e,t){let n;for(n in t){const i=(qk.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){qk.call(i,o)||(i[o]=[]);const a=s[o];KY(i[o],Array.isArray(a)?a:a?[a]:[])}}}function KY(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);yn(e,0,0,r)}function DR(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Vr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Mn=eo(/[A-Za-z]/),En=eo(/[\dA-Za-z]/),GY=eo(/[#-'*+\--9=?A-Z^-~]/);function jf(e){return e!==null&&(e<32||e===127)}const rx=eo(/\d/),YY=eo(/[\dA-Fa-f]/),XY=eo(/[!-/:-@[-`{-~]/);function ke(e){return e!==null&&e<-2}function ut(e){return e!==null&&(e<0||e===32)}function Ge(e){return e===-2||e===-1||e===32}const Zp=eo(new RegExp("\\p{P}|\\p{S}","u")),Bo=eo(/\s/);function eo(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ll(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&En(e.charCodeAt(n+1))&&En(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Qe(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Ge(l)?(e.enter(n),a(l)):t(l)}function a(l){return Ge(l)&&s++<i?(e.consume(l),a):(e.exit(n),t(l))}}const ZY={tokenize:QY};function QY(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Qe(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),s(a)}function s(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return ke(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),o)}}const JY={tokenize:eX},Vk={tokenize:tX};function eX(e){const t=this,n=[];let r=0,i,s,o;return a;function a(b){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,l,c)(b)}return c(b)}function l(b){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&_();const S=t.events.length;let C=S,k;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){k=t.events[C][1].end;break}x(r);let T=S;for(;T<t.events.length;)t.events[T][1].end={...k},T++;return yn(t.events,C+1,0,t.events.slice(S)),t.events.length=T,c(b)}return a(b)}function c(b){if(r===n.length){if(!i)return f(b);if(i.currentConstruct&&i.currentConstruct.concrete)return m(b);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Vk,u,d)(b)}function u(b){return i&&_(),x(r),f(b)}function d(b){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(b)}function f(b){return t.containerState={},e.attempt(Vk,p,m)(b)}function p(b){return r++,n.push([t.currentConstruct,t.containerState]),f(b)}function m(b){if(b===null){i&&_(),x(0),e.consume(b);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),v(b)}function v(b){if(b===null){w(e.exit("chunkFlow"),!0),x(0),e.consume(b);return}return ke(b)?(e.consume(b),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(b),v)}function w(b,S){const C=t.sliceStream(b);if(S&&C.push(null),b.previous=s,s&&(s.next=b),s=b,i.defineSkip(b.start),i.write(C),t.parser.lazy[b.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<o&&(!i.events[k][1].end||i.events[k][1].end.offset>o))return;const T=t.events.length;let I=T,D,R;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){if(D){R=t.events[I][1].end;break}D=!0}for(x(r),k=T;k<t.events.length;)t.events[k][1].end={...R},k++;yn(t.events,I+1,0,t.events.slice(T)),t.events.length=k}}function x(b){let S=n.length;for(;S-- >b;){const C=n[S];t.containerState=C[1],C[0].exit.call(t,e)}n.length=b}function _(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function tX(e,t,n){return Qe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function cl(e){if(e===null||ut(e)||Bo(e))return 1;if(Zp(e))return 2}function jl(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const ix={name:"attention",resolveAll:nX,tokenize:rX};function nX(e,t){let n=-1,r,i,s,o,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[n][1].start};Kk(d,-l),Kk(f,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},s={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=gn(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=gn(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=gn(c,jl(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=gn(c,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=gn(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,yn(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function rX(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=cl(r);let s;return o;function o(l){return s=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===s)return e.consume(l),a;const c=e.exit("attentionSequence"),u=cl(l),d=!u||u===2&&i||n.includes(l),f=!i||i===2&&u||n.includes(r);return c._open=!!(s===42?d:d&&(i||!f)),c._close=!!(s===42?f:f&&(u||!d)),t(l)}}function Kk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const iX={name:"autolink",tokenize:sX};function sX(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(p){return Mn(p)?(e.consume(p),o):p===64?n(p):c(p)}function o(p){return p===43||p===45||p===46||En(p)?(r=1,a(p)):c(p)}function a(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||En(p))&&r++<32?(e.consume(p),a):(r=0,c(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||jf(p)?n(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),u):GY(p)?(e.consume(p),c):n(p)}function u(p){return En(p)?d(p):n(p)}function d(p){return p===46?(e.consume(p),r=0,u):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||En(p))&&r++<63){const m=p===45?f:d;return e.consume(p),m}return n(p)}}const Gu={partial:!0,tokenize:oX};function oX(e,t,n){return r;function r(s){return Ge(s)?Qe(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||ke(s)?t(s):n(s)}}const OR={continuation:{tokenize:lX},exit:cX,name:"blockQuote",tokenize:aX};function aX(e,t,n){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return n(o)}function s(o){return Ge(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function lX(e,t,n){const r=this;return i;function i(o){return Ge(o)?Qe(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(OR,t,n)(o)}}function cX(e){e.exit("blockQuote")}const BR={name:"characterEscape",tokenize:uX};function uX(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return XY(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const zR={name:"characterReference",tokenize:dX};function dX(e,t,n){const r=this;let i=0,s,o;return a;function a(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),s=31,o=En,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=YY,u):(e.enter("characterReferenceValue"),s=7,o=rx,u(d))}function u(d){if(d===59&&i){const f=e.exit("characterReferenceValue");return o===En&&!w_(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&i++<s?(e.consume(d),u):n(d)}}const Gk={partial:!0,tokenize:fX},Yk={concrete:!0,name:"codeFenced",tokenize:hX};function hX(e,t,n){const r=this,i={partial:!0,tokenize:C};let s=0,o=0,a;return l;function l(k){return c(k)}function c(k){const T=r.events[r.events.length-1];return s=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,a=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(k)}function u(k){return k===a?(o++,e.consume(k),u):o<3?n(k):(e.exit("codeFencedFenceSequence"),Ge(k)?Qe(e,d,"whitespace")(k):d(k))}function d(k){return k===null||ke(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(Gk,v,S)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(k))}function f(k){return k===null||ke(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(k)):Ge(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Qe(e,p,"whitespace")(k)):k===96&&k===a?n(k):(e.consume(k),f)}function p(k){return k===null||ke(k)?d(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||ke(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(k)):k===96&&k===a?n(k):(e.consume(k),m)}function v(k){return e.attempt(i,S,w)(k)}function w(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),x}function x(k){return s>0&&Ge(k)?Qe(e,_,"linePrefix",s+1)(k):_(k)}function _(k){return k===null||ke(k)?e.check(Gk,v,S)(k):(e.enter("codeFlowValue"),b(k))}function b(k){return k===null||ke(k)?(e.exit("codeFlowValue"),_(k)):(e.consume(k),b)}function S(k){return e.exit("codeFenced"),t(k)}function C(k,T,I){let D=0;return R;function R(L){return k.enter("lineEnding"),k.consume(L),k.exit("lineEnding"),j}function j(L){return k.enter("codeFencedFence"),Ge(L)?Qe(k,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):P(L)}function P(L){return L===a?(k.enter("codeFencedFenceSequence"),A(L)):I(L)}function A(L){return L===a?(D++,k.consume(L),A):D>=o?(k.exit("codeFencedFenceSequence"),Ge(L)?Qe(k,M,"whitespace")(L):M(L)):I(L)}function M(L){return L===null||ke(L)?(k.exit("codeFencedFence"),T(L)):I(L)}}}function fX(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const pg={name:"codeIndented",tokenize:mX},pX={partial:!0,tokenize:gX};function mX(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),Qe(e,s,"linePrefix",5)(c)}function s(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):ke(c)?e.attempt(pX,o,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||ke(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function gX(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):ke(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Qe(e,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):ke(o)?i(o):n(o)}}const vX={name:"codeText",previous:yX,resolve:xX,tokenize:_X};function xX(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function yX(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _X(e,t,n){let r=0,i,s;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),a(d)}function a(d){return d===96?(e.consume(d),r++,a):(e.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),l):d===96?(s=e.enter("codeTextSequence"),i=0,u(d)):ke(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||ke(d)?(e.exit("codeTextData"),l(d)):(e.consume(d),c)}function u(d){return d===96?(e.consume(d),i++,u):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(s.type="codeTextData",c(d))}}class bX{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&tc(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),tc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),tc(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);tc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);tc(this.left,n.reverse())}}}function tc(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function $R(e){const t={};let n=-1,r,i,s,o,a,l,c;const u=new bX(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,wX(u,n)),n=t[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=u.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},a=u.slice(i,n),a.unshift(r),u.splice(i,n-i+1,a))}}return yn(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function wX(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let u,d,f=-1,p=n,m=0,v=0;const w=[v];for(;p;){for(;e.get(++i)[1]!==p;);s.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(v=f+1,w.push(v),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):w.pop(),f=w.length;f--;){const x=a.slice(w[f],w[f+1]),_=s.pop();l.push([_,_+x.length-1]),e.splice(_,2,x)}for(l.reverse(),f=-1;++f<l.length;)c[m+l[f][0]]=m+l[f][1],m+=l[f][1]-l[f][0]-1;return c}const SX={resolve:CX,tokenize:EX},kX={partial:!0,tokenize:IX};function CX(e){return $R(e),e}function EX(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):ke(a)?e.check(kX,o,s)(a):(e.consume(a),i)}function s(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function IX(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Qe(e,s,"linePrefix")}function s(o){if(o===null||ke(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function FR(e,t,n,r,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(x){return x===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(x),e.exit(s),f):x===null||x===32||x===41||jf(x)?n(x):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),v(x))}function f(x){return x===62?(e.enter(s),e.consume(x),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===62?(e.exit("chunkString"),e.exit(a),f(x)):x===null||x===60||ke(x)?n(x):(e.consume(x),x===92?m:p)}function m(x){return x===60||x===62||x===92?(e.consume(x),p):p(x)}function v(x){return!u&&(x===null||x===41||ut(x))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(x)):u<c&&x===40?(e.consume(x),u++,v):x===41?(e.consume(x),u--,v):x===null||x===32||x===40||jf(x)?n(x):(e.consume(x),x===92?w:v)}function w(x){return x===40||x===41||x===92?(e.consume(x),v):v(x)}}function HR(e,t,n,r,i,s){const o=this;let a=0,l;return c;function c(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(s),u}function u(p){return a>999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(s),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):ke(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||ke(p)||a++>999?(e.exit("chunkString"),u(p)):(e.consume(p),l||(l=!Ge(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(e.consume(p),a++,d):d(p)}}function UR(e,t,n,r,i,s){let o;return a;function a(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,l):n(f)}function l(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(s),c(f))}function c(f){return f===o?(e.exit(s),l(o)):f===null?n(f):ke(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Qe(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===o||f===null||ke(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:u)}function d(f){return f===o||f===92?(e.consume(f),u):u(f)}}function Oc(e,t){let n;return r;function r(i){return ke(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Ge(i)?Qe(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const TX={name:"definition",tokenize:RX},NX={partial:!0,tokenize:PX};function RX(e,t,n){const r=this;let i;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return HR.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return i=Vr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return ut(p)?Oc(e,c)(p):c(p)}function c(p){return FR(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(NX,d,d)(p)}function d(p){return Ge(p)?Qe(e,f,"whitespace")(p):f(p)}function f(p){return p===null||ke(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function PX(e,t,n){return r;function r(a){return ut(a)?Oc(e,i)(a):n(a)}function i(a){return UR(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Ge(a)?Qe(e,o,"whitespace")(a):o(a)}function o(a){return a===null||ke(a)?t(a):n(a)}}const AX={name:"hardBreakEscape",tokenize:MX};function MX(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return ke(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const LX={name:"headingAtx",resolve:jX,tokenize:DX};function jX(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},yn(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function DX(e,t,n){let r=0;return i;function i(u){return e.enter("atxHeading"),s(u)}function s(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(e.consume(u),o):u===null||ut(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||ke(u)?(e.exit("atxHeading"),t(u)):Ge(u)?Qe(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||ut(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const OX=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Xk=["pre","script","style","textarea"],BX={concrete:!0,name:"htmlFlow",resolveTo:FX,tokenize:HX},zX={partial:!0,tokenize:WX},$X={partial:!0,tokenize:UX};function FX(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function HX(e,t,n){const r=this;let i,s,o,a,l;return c;function c(O){return u(O)}function u(O){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(O),d}function d(O){return O===33?(e.consume(O),f):O===47?(e.consume(O),s=!0,v):O===63?(e.consume(O),i=3,r.interrupt?t:E):Mn(O)?(e.consume(O),o=String.fromCharCode(O),w):n(O)}function f(O){return O===45?(e.consume(O),i=2,p):O===91?(e.consume(O),i=5,a=0,m):Mn(O)?(e.consume(O),i=4,r.interrupt?t:E):n(O)}function p(O){return O===45?(e.consume(O),r.interrupt?t:E):n(O)}function m(O){const te="CDATA[";return O===te.charCodeAt(a++)?(e.consume(O),a===te.length?r.interrupt?t:P:m):n(O)}function v(O){return Mn(O)?(e.consume(O),o=String.fromCharCode(O),w):n(O)}function w(O){if(O===null||O===47||O===62||ut(O)){const te=O===47,se=o.toLowerCase();return!te&&!s&&Xk.includes(se)?(i=1,r.interrupt?t(O):P(O)):OX.includes(o.toLowerCase())?(i=6,te?(e.consume(O),x):r.interrupt?t(O):P(O)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(O):s?_(O):b(O))}return O===45||En(O)?(e.consume(O),o+=String.fromCharCode(O),w):n(O)}function x(O){return O===62?(e.consume(O),r.interrupt?t:P):n(O)}function _(O){return Ge(O)?(e.consume(O),_):R(O)}function b(O){return O===47?(e.consume(O),R):O===58||O===95||Mn(O)?(e.consume(O),S):Ge(O)?(e.consume(O),b):R(O)}function S(O){return O===45||O===46||O===58||O===95||En(O)?(e.consume(O),S):C(O)}function C(O){return O===61?(e.consume(O),k):Ge(O)?(e.consume(O),C):b(O)}function k(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(e.consume(O),l=O,T):Ge(O)?(e.consume(O),k):I(O)}function T(O){return O===l?(e.consume(O),l=null,D):O===null||ke(O)?n(O):(e.consume(O),T)}function I(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||ut(O)?C(O):(e.consume(O),I)}function D(O){return O===47||O===62||Ge(O)?b(O):n(O)}function R(O){return O===62?(e.consume(O),j):n(O)}function j(O){return O===null||ke(O)?P(O):Ge(O)?(e.consume(O),j):n(O)}function P(O){return O===45&&i===2?(e.consume(O),$):O===60&&i===1?(e.consume(O),F):O===62&&i===4?(e.consume(O),U):O===63&&i===3?(e.consume(O),E):O===93&&i===5?(e.consume(O),B):ke(O)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(zX,q,A)(O)):O===null||ke(O)?(e.exit("htmlFlowData"),A(O)):(e.consume(O),P)}function A(O){return e.check($X,M,q)(O)}function M(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),L}function L(O){return O===null||ke(O)?A(O):(e.enter("htmlFlowData"),P(O))}function $(O){return O===45?(e.consume(O),E):P(O)}function F(O){return O===47?(e.consume(O),o="",z):P(O)}function z(O){if(O===62){const te=o.toLowerCase();return Xk.includes(te)?(e.consume(O),U):P(O)}return Mn(O)&&o.length<8?(e.consume(O),o+=String.fromCharCode(O),z):P(O)}function B(O){return O===93?(e.consume(O),E):P(O)}function E(O){return O===62?(e.consume(O),U):O===45&&i===2?(e.consume(O),E):P(O)}function U(O){return O===null||ke(O)?(e.exit("htmlFlowData"),q(O)):(e.consume(O),U)}function q(O){return e.exit("htmlFlow"),t(O)}}function UX(e,t,n){const r=this;return i;function i(o){return ke(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function WX(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Gu,t,n)}}const qX={name:"htmlText",tokenize:VX};function VX(e,t,n){const r=this;let i,s,o;return a;function a(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),l}function l(E){return E===33?(e.consume(E),c):E===47?(e.consume(E),C):E===63?(e.consume(E),b):Mn(E)?(e.consume(E),I):n(E)}function c(E){return E===45?(e.consume(E),u):E===91?(e.consume(E),s=0,m):Mn(E)?(e.consume(E),_):n(E)}function u(E){return E===45?(e.consume(E),p):n(E)}function d(E){return E===null?n(E):E===45?(e.consume(E),f):ke(E)?(o=d,F(E)):(e.consume(E),d)}function f(E){return E===45?(e.consume(E),p):d(E)}function p(E){return E===62?$(E):E===45?f(E):d(E)}function m(E){const U="CDATA[";return E===U.charCodeAt(s++)?(e.consume(E),s===U.length?v:m):n(E)}function v(E){return E===null?n(E):E===93?(e.consume(E),w):ke(E)?(o=v,F(E)):(e.consume(E),v)}function w(E){return E===93?(e.consume(E),x):v(E)}function x(E){return E===62?$(E):E===93?(e.consume(E),x):v(E)}function _(E){return E===null||E===62?$(E):ke(E)?(o=_,F(E)):(e.consume(E),_)}function b(E){return E===null?n(E):E===63?(e.consume(E),S):ke(E)?(o=b,F(E)):(e.consume(E),b)}function S(E){return E===62?$(E):b(E)}function C(E){return Mn(E)?(e.consume(E),k):n(E)}function k(E){return E===45||En(E)?(e.consume(E),k):T(E)}function T(E){return ke(E)?(o=T,F(E)):Ge(E)?(e.consume(E),T):$(E)}function I(E){return E===45||En(E)?(e.consume(E),I):E===47||E===62||ut(E)?D(E):n(E)}function D(E){return E===47?(e.consume(E),$):E===58||E===95||Mn(E)?(e.consume(E),R):ke(E)?(o=D,F(E)):Ge(E)?(e.consume(E),D):$(E)}function R(E){return E===45||E===46||E===58||E===95||En(E)?(e.consume(E),R):j(E)}function j(E){return E===61?(e.consume(E),P):ke(E)?(o=j,F(E)):Ge(E)?(e.consume(E),j):D(E)}function P(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),i=E,A):ke(E)?(o=P,F(E)):Ge(E)?(e.consume(E),P):(e.consume(E),M)}function A(E){return E===i?(e.consume(E),i=void 0,L):E===null?n(E):ke(E)?(o=A,F(E)):(e.consume(E),A)}function M(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||ut(E)?D(E):(e.consume(E),M)}function L(E){return E===47||E===62||ut(E)?D(E):n(E)}function $(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function F(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),z}function z(E){return Ge(E)?Qe(e,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):B(E)}function B(E){return e.enter("htmlTextData"),o(E)}}const S_={name:"labelEnd",resolveAll:XX,resolveTo:ZX,tokenize:QX},KX={tokenize:JX},GX={tokenize:eZ},YX={tokenize:tZ};function XX(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&yn(e,0,e.length,n),e}function ZX(e,t){let n=e.length,r=0,i,s,o,a;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",c,t]],a=gn(a,e.slice(s+1,s+r+3)),a=gn(a,[["enter",u,t]]),a=gn(a,jl(t.parser.constructs.insideSpan.null,e.slice(s+r+4,o-3),t)),a=gn(a,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),a=gn(a,e.slice(o+1)),a=gn(a,[["exit",l,t]]),yn(e,s,e.length,a),e}function QX(e,t,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(f){return s?s._inactive?d(f):(o=r.parser.defined.includes(Vr(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt(KX,u,o?u:d)(f):f===91?e.attempt(GX,u,o?c:d)(f):o?u(f):d(f)}function c(f){return e.attempt(YX,u,d)(f)}function u(f){return t(f)}function d(f){return s._balanced=!0,n(f)}}function JX(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),i}function i(d){return ut(d)?Oc(e,s)(d):s(d)}function s(d){return d===41?u(d):FR(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return ut(d)?Oc(e,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?UR(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return ut(d)?Oc(e,u)(d):u(d)}function u(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function eZ(e,t,n){const r=this;return i;function i(a){return HR.call(r,e,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(Vr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function tZ(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const nZ={name:"labelStartImage",resolveAll:S_.resolveAll,tokenize:rZ};function rZ(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const iZ={name:"labelStartLink",resolveAll:S_.resolveAll,tokenize:sZ};function sZ(e,t,n){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const mg={name:"lineEnding",tokenize:oZ};function oZ(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Qe(e,t,"linePrefix")}}const Th={name:"thematicBreak",tokenize:aZ};function aZ(e,t,n){let r=0,i;return s;function s(c){return e.enter("thematicBreak"),o(c)}function o(c){return i=c,a(c)}function a(c){return c===i?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||ke(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Ge(c)?Qe(e,a,"whitespace")(c):a(c))}}const qn={continuation:{tokenize:dZ},exit:fZ,name:"list",tokenize:uZ},lZ={partial:!0,tokenize:pZ},cZ={partial:!0,tokenize:hZ};function uZ(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:rx(p)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Th,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return rx(p)&&++o<10?(e.consume(p),l):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Gu,r.interrupt?n:u,e.attempt(lZ,f,d))}function u(p){return r.containerState.initialBlankLine=!0,s++,f(p)}function d(p){return Ge(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function dZ(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Gu,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Qe(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!Ge(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(cZ,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Qe(e,e.attempt(qn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function hZ(e,t,n){const r=this;return Qe(e,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(s):n(s)}}function fZ(e){e.exit(this.containerState.type)}function pZ(e,t,n){const r=this;return Qe(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!Ge(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Zk={name:"setextUnderline",resolveTo:mZ,tokenize:gZ};function mZ(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function gZ(e,t,n){const r=this;let i;return s;function s(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Ge(c)?Qe(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||ke(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const vZ={tokenize:xZ};function xZ(e){const t=this,n=e.attempt(Gu,r,e.attempt(this.parser.constructs.flowInitial,i,Qe(e,e.attempt(this.parser.constructs.flow,i,e.attempt(SX,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const yZ={resolveAll:qR()},_Z=WR("string"),bZ=WR("text");function WR(e){return{resolveAll:qR(e==="text"?wZ:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,a);return o;function o(u){return c(u)?s(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),s(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=i[u];let f=-1;if(d)for(;++f<d.length;){const p=d[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function qR(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function wZ(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let s=i.length,o=-1,a=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const SZ={42:qn,43:qn,45:qn,48:qn,49:qn,50:qn,51:qn,52:qn,53:qn,54:qn,55:qn,56:qn,57:qn,62:OR},kZ={91:TX},CZ={[-2]:pg,[-1]:pg,32:pg},EZ={35:LX,42:Th,45:[Zk,Th],60:BX,61:Zk,95:Th,96:Yk,126:Yk},IZ={38:zR,92:BR},TZ={[-5]:mg,[-4]:mg,[-3]:mg,33:nZ,38:zR,42:ix,60:[iX,qX],91:iZ,92:[AX,BR],93:S_,95:ix,96:vX},NZ={null:[ix,yZ]},RZ={null:[42,95]},PZ={null:[]},AZ=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:RZ,contentInitial:kZ,disable:PZ,document:SZ,flow:EZ,flowInitial:CZ,insideSpan:NZ,string:IZ,text:TZ},Symbol.toStringTag,{value:"Module"}));function MZ(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],a=[];const l={attempt:T(C),check:T(k),consume:_,enter:b,exit:S,interrupt:T(k,{interrupt:!0})},c={code:null,containerState:{},defineSkip:v,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d};let u=t.tokenize.call(c,l);return t.resolveAll&&s.push(t),c;function d(j){return o=gn(o,j),w(),o[o.length-1]!==null?[]:(I(t,0),c.events=jl(s,c.events,c),c.events)}function f(j,P){return jZ(p(j),P)}function p(j){return LZ(o,j)}function m(){const{_bufferIndex:j,_index:P,line:A,column:M,offset:L}=r;return{_bufferIndex:j,_index:P,line:A,column:M,offset:L}}function v(j){i[j.line]=j.column,R()}function w(){let j;for(;r._index<o.length;){const P=o[r._index];if(typeof P=="string")for(j=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===j&&r._bufferIndex<P.length;)x(P.charCodeAt(r._bufferIndex));else x(P)}}function x(j){u=u(j)}function _(j){ke(j)?(r.line++,r.column=1,r.offset+=j===-3?2:1,R()):j!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=j}function b(j,P){const A=P||{};return A.type=j,A.start=m(),c.events.push(["enter",A,c]),a.push(A),A}function S(j){const P=a.pop();return P.end=m(),c.events.push(["exit",P,c]),P}function C(j,P){I(j,P.from)}function k(j,P){P.restore()}function T(j,P){return A;function A(M,L,$){let F,z,B,E;return Array.isArray(M)?q(M):"tokenize"in M?q([M]):U(M);function U(G){return me;function me(Ie){const ue=Ie!==null&&G[Ie],Ae=Ie!==null&&G.null,Oe=[...Array.isArray(ue)?ue:ue?[ue]:[],...Array.isArray(Ae)?Ae:Ae?[Ae]:[]];return q(Oe)(Ie)}}function q(G){return F=G,z=0,G.length===0?$:O(G[z])}function O(G){return me;function me(Ie){return E=D(),B=G,G.partial||(c.currentConstruct=G),G.name&&c.parser.constructs.disable.null.includes(G.name)?se():G.tokenize.call(P?Object.assign(Object.create(c),P):c,l,te,se)(Ie)}}function te(G){return j(B,E),L}function se(G){return E.restore(),++z<F.length?O(F[z]):$}}}function I(j,P){j.resolveAll&&!s.includes(j)&&s.push(j),j.resolve&&yn(c.events,P,c.events.length-P,j.resolve(c.events.slice(P),c)),j.resolveTo&&(c.events=j.resolveTo(c.events,c))}function D(){const j=m(),P=c.previous,A=c.currentConstruct,M=c.events.length,L=Array.from(a);return{from:M,restore:$};function $(){r=j,c.previous=P,c.currentConstruct=A,c.events.length=M,a=L,R()}}function R(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function LZ(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,s)];else{if(o=e.slice(n,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function jZ(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
521
521
  `;break}case-3:{o=`\r
522
522
  `;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function DZ(e){const r={constructs:jR([AZ,...(e||{}).extensions||[]]),content:i(ZY),defined:[],document:i(JY),flow:i(vZ),lazy:{},string:i(_Z),text:i(bZ)};return r;function i(s){return o;function o(a){return MZ(r,s,a)}}}function OZ(e){for(;!$R(e););return e}const Qk=/[\0\t\n\r]/g;function BZ(){let e=1,t="",n=!0,r;return i;function i(s,o,a){const l=[];let c,u,d,f,p;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),d=0,t="",n&&(s.charCodeAt(0)===65279&&d++,n=void 0);d<s.length;){if(Qk.lastIndex=d,c=Qk.exec(s),f=c&&c.index!==void 0?c.index:s.length,p=s.charCodeAt(f),!c){t=s.slice(d);break}if(p===10&&d===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<f&&(l.push(s.slice(d,f)),e+=f-d),p){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}d=f+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const zZ=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function $Z(e){return e.replace(zZ,FZ)}function FZ(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return DR(n.slice(s?2:1),s?16:10)}return w_(n)||e}const VR={}.hasOwnProperty;function HZ(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),UZ(n)(OZ(DZ(n).document().write(BZ()(e,t,!0))))}function UZ(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(ie),autolinkProtocol:D,autolinkEmail:D,atxHeading:s(dt),blockQuote:s(Ae),characterEscape:D,characterReference:D,codeFenced:s(Oe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Oe,o),codeText:s(je,o),codeTextData:D,data:D,codeFlowValue:D,definition:s(ge),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Ze),hardBreakEscape:s(nt),hardBreakTrailing:s(nt),htmlFlow:s(vt,o),htmlFlowData:D,htmlText:s(vt,o),htmlTextData:D,image:s(jt),label:o,link:s(ie),listItem:s(Ce),listItemValue:f,listOrdered:s(We,d),listUnordered:s(We),paragraph:s($e),reference:O,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(dt),strong:s(_t),thematicBreak:s(Rn)},exit:{atxHeading:l(),atxHeadingSequence:C,autolink:l(),autolinkEmail:ue,autolinkProtocol:Ie,blockQuote:l(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:G,characterReference:me,codeFenced:l(w),codeFencedFence:v,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:R,codeIndented:l(x),codeText:l(L),codeTextData:R,data:R,definition:l(),definitionDestinationString:S,definitionLabelString:_,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(P),hardBreakTrailing:l(P),htmlFlow:l(A),htmlFlowData:R,htmlText:l(M),htmlTextData:R,image:l(F),label:B,labelText:z,lineEnding:j,link:l($),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:te,resourceDestinationString:E,resourceTitleString:U,resource:q,setextHeading:l(I),setextHeadingLineSequence:T,setextHeadingText:k,strong:l(),thematicBreak:l()}};KR(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(W){let ee={type:"root",children:[]};const we={stack:[ee],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:u,data:n},Me=[];let qe=-1;for(;++qe<W.length;)if(W[qe][1].type==="listOrdered"||W[qe][1].type==="listUnordered")if(W[qe][0]==="enter")Me.push(qe);else{const Tt=Me.pop();qe=i(W,Tt,qe)}for(qe=-1;++qe<W.length;){const Tt=t[W[qe][0]];VR.call(Tt,W[qe][1].type)&&Tt[W[qe][1].type].call(Object.assign({sliceSerialize:W[qe][2].sliceSerialize},we),W[qe][1])}if(we.tokenStack.length>0){const Tt=we.tokenStack[we.tokenStack.length-1];(Tt[1]||Jk).call(we,void 0,Tt[0])}for(ee.position={start:hs(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:hs(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},qe=-1;++qe<t.transforms.length;)ee=t.transforms[qe](ee)||ee;return ee}function i(W,ee,we){let Me=ee-1,qe=-1,Tt=!1,en,tn,nn,ae;for(;++Me<=we;){const Se=W[Me];switch(Se[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Se[0]==="enter"?qe++:qe--,ae=void 0;break}case"lineEndingBlank":{Se[0]==="enter"&&(en&&!ae&&!qe&&!nn&&(nn=Me),ae=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ae=void 0}if(!qe&&Se[0]==="enter"&&Se[1].type==="listItemPrefix"||qe===-1&&Se[0]==="exit"&&(Se[1].type==="listUnordered"||Se[1].type==="listOrdered")){if(en){let rt=Me;for(tn=void 0;rt--;){const bt=W[rt];if(bt[1].type==="lineEnding"||bt[1].type==="lineEndingBlank"){if(bt[0]==="exit")continue;tn&&(W[tn][1].type="lineEndingBlank",Tt=!0),bt[1].type="lineEnding",tn=rt}else if(!(bt[1].type==="linePrefix"||bt[1].type==="blockQuotePrefix"||bt[1].type==="blockQuotePrefixWhitespace"||bt[1].type==="blockQuoteMarker"||bt[1].type==="listItemIndent"))break}nn&&(!tn||nn<tn)&&(en._spread=!0),en.end=Object.assign({},tn?W[tn][1].start:Se[1].end),W.splice(tn||Me,0,["exit",en,Se[2]]),Me++,we++}if(Se[1].type==="listItemPrefix"){const rt={type:"listItem",_spread:!1,start:Object.assign({},Se[1].start),end:void 0};en=rt,W.splice(Me,0,["enter",rt,Se[2]]),Me++,we++,nn=void 0,ae=!0}}}return W[ee][1]._spread=Tt,we}function s(W,ee){return we;function we(Me){a.call(this,W(Me),Me),ee&&ee.call(this,Me)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(W,ee,we){this.stack[this.stack.length-1].children.push(W),this.stack.push(W),this.tokenStack.push([ee,we||void 0]),W.position={start:hs(ee.start),end:void 0}}function l(W){return ee;function ee(we){W&&W.call(this,we),c.call(this,we)}}function c(W,ee){const we=this.stack.pop(),Me=this.tokenStack.pop();if(Me)Me[0].type!==W.type&&(ee?ee.call(this,W,Me[0]):(Me[1]||Jk).call(this,W,Me[0]));else throw new Error("Cannot close `"+W.type+"` ("+Dc({start:W.start,end:W.end})+"): it’s not open");we.position.end=hs(W.end)}function u(){return b_(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(W){if(this.data.expectingFirstListItemValue){const ee=this.stack[this.stack.length-2];ee.start=Number.parseInt(this.sliceSerialize(W),10),this.data.expectingFirstListItemValue=void 0}}function p(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.lang=W}function m(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.meta=W}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W.replace(/(\r?\n|\r)$/g,"")}function _(W){const ee=this.resume(),we=this.stack[this.stack.length-1];we.label=ee,we.identifier=Vr(this.sliceSerialize(W)).toLowerCase()}function b(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.title=W}function S(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.url=W}function C(W){const ee=this.stack[this.stack.length-1];if(!ee.depth){const we=this.sliceSerialize(W).length;ee.depth=we}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function T(W){const ee=this.stack[this.stack.length-1];ee.depth=this.sliceSerialize(W).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function D(W){const we=this.stack[this.stack.length-1].children;let Me=we[we.length-1];(!Me||Me.type!=="text")&&(Me=hn(),Me.position={start:hs(W.start),end:void 0},we.push(Me)),this.stack.push(Me)}function R(W){const ee=this.stack.pop();ee.value+=this.sliceSerialize(W),ee.position.end=hs(W.end)}function j(W){const ee=this.stack[this.stack.length-1];if(this.data.atHardBreak){const we=ee.children[ee.children.length-1];we.position.end=hs(W.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ee.type)&&(D.call(this,W),R.call(this,W))}function P(){this.data.atHardBreak=!0}function A(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W}function M(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W}function L(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W}function $(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=ee,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function F(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=ee,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function z(W){const ee=this.sliceSerialize(W),we=this.stack[this.stack.length-2];we.label=$Z(ee),we.identifier=Vr(ee).toLowerCase()}function B(){const W=this.stack[this.stack.length-1],ee=this.resume(),we=this.stack[this.stack.length-1];if(this.data.inReference=!0,we.type==="link"){const Me=W.children;we.children=Me}else we.alt=ee}function E(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.url=W}function U(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.title=W}function q(){this.data.inReference=void 0}function O(){this.data.referenceType="collapsed"}function te(W){const ee=this.resume(),we=this.stack[this.stack.length-1];we.label=ee,we.identifier=Vr(this.sliceSerialize(W)).toLowerCase(),this.data.referenceType="full"}function se(W){this.data.characterReferenceType=W.type}function G(W){const ee=this.sliceSerialize(W),we=this.data.characterReferenceType;let Me;we?(Me=DR(ee,we==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Me=w_(ee);const qe=this.stack[this.stack.length-1];qe.value+=Me}function me(W){const ee=this.stack.pop();ee.position.end=hs(W.end)}function Ie(W){R.call(this,W);const ee=this.stack[this.stack.length-1];ee.url=this.sliceSerialize(W)}function ue(W){R.call(this,W);const ee=this.stack[this.stack.length-1];ee.url="mailto:"+this.sliceSerialize(W)}function Ae(){return{type:"blockquote",children:[]}}function Oe(){return{type:"code",lang:null,meta:null,value:""}}function je(){return{type:"inlineCode",value:""}}function ge(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ze(){return{type:"emphasis",children:[]}}function dt(){return{type:"heading",depth:0,children:[]}}function nt(){return{type:"break"}}function vt(){return{type:"html",value:""}}function jt(){return{type:"image",title:null,url:"",alt:null}}function ie(){return{type:"link",title:null,url:"",children:[]}}function We(W){return{type:"list",ordered:W.type==="listOrdered",start:null,spread:W._spread,children:[]}}function Ce(W){return{type:"listItem",spread:W._spread,checked:null,children:[]}}function $e(){return{type:"paragraph",children:[]}}function _t(){return{type:"strong",children:[]}}function hn(){return{type:"text",value:""}}function Rn(){return{type:"thematicBreak"}}}function hs(e){return{line:e.line,column:e.column,offset:e.offset}}function KR(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?KR(e,r):WZ(e,r)}}function WZ(e,t){let n;for(n in t)if(VR.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Jk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Dc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Dc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Dc({start:t.start,end:t.end})+") is still open")}function qZ(e){const t=this;t.parser=n;function n(r){return HZ(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function VZ(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function KZ(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Clawd 分享</title>
7
- <script type="module" crossorigin src="/share-ui/assets/guest-3JOCTfo2.js"></script>
7
+ <script type="module" crossorigin src="/share-ui/assets/guest-B_B67yze.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/share-ui/assets/guest-CZG8PmZ5.css">
9
9
  </head>
10
10
  <body style="margin: 0">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawos-dev/clawd",
3
- "version": "0.2.656",
3
+ "version": "0.2.657",
4
4
  "description": "Standalone clawd daemon — Claude Code (and future Codex) session server over WebSocket",
5
5
  "type": "module",
6
6
  "license": "MIT",