@markus-global/cli 0.9.7-rc.0 → 0.9.7-rc.1

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.
Files changed (63) hide show
  1. package/dist/markus.mjs +223 -14
  2. package/dist/web-ui/assets/{CommentInput-Dvlq2svZ.js → CommentInput-CIxUL6dU.js} +1 -1
  3. package/dist/web-ui/assets/{ContentRenderer-BfnvpFM7.js → ContentRenderer-Bb_drUpO.js} +2 -2
  4. package/dist/web-ui/assets/{DeliverableShareModal-DkGpQmZ8.js → DeliverableShareModal-BEeIlXig.js} +1 -1
  5. package/dist/web-ui/assets/{Deliverables-CtPvquKO.js → Deliverables-CJFzxbLw.js} +1 -1
  6. package/dist/web-ui/assets/{Notifications-C_e9_V74.js → Notifications-Cz2LKhGE.js} +1 -1
  7. package/dist/web-ui/assets/{Search-DZBGpN3c.js → Search-dq45wHQN.js} +1 -1
  8. package/dist/web-ui/assets/Settings-WAXEtxMR.js +8 -0
  9. package/dist/web-ui/assets/{Store-dbJSFCFw.js → Store-DOGCOxTK.js} +1 -1
  10. package/dist/web-ui/assets/{Team-vmqHkmh8.js → Team-NM2SsmjN.js} +4 -4
  11. package/dist/web-ui/assets/{Work-Ds7q6pZg.js → Work-ornw-1Zh.js} +1 -1
  12. package/dist/web-ui/assets/{arc-BLoofCdL.js → arc-D4xcu8MX.js} +1 -1
  13. package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-BGO4nFRN.js → architectureDiagram-3BPJPVTR-DP3EZPSb.js} +1 -1
  14. package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-Cn1E0037.js → blockDiagram-GPEHLZMM-BnSHtwXa.js} +1 -1
  15. package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-DXFAnq3E.js → c4Diagram-AAUBKEIU-DpPSihlY.js} +1 -1
  16. package/dist/web-ui/assets/channel-DSB2MBEK.js +1 -0
  17. package/dist/web-ui/assets/{chunk-2J33WTMH-BXCSmrWD.js → chunk-2J33WTMH-DD5lZIGF.js} +1 -1
  18. package/dist/web-ui/assets/{chunk-4BX2VUAB-CIWJeena.js → chunk-4BX2VUAB-D9wu9GG0.js} +1 -1
  19. package/dist/web-ui/assets/{chunk-55IACEB6-BuQ5-tdz.js → chunk-55IACEB6-p_n2ARjh.js} +1 -1
  20. package/dist/web-ui/assets/{chunk-727SXJPM-q9Yx_12l.js → chunk-727SXJPM-BiTqi43c.js} +1 -1
  21. package/dist/web-ui/assets/{chunk-AQP2D5EJ-DqaehwKB.js → chunk-AQP2D5EJ-DVPMedje.js} +1 -1
  22. package/dist/web-ui/assets/{chunk-FMBD7UC4-BFs2IYjK.js → chunk-FMBD7UC4-B53AqN8D.js} +1 -1
  23. package/dist/web-ui/assets/{chunk-ND2GUHAM-DyYGWpbj.js → chunk-ND2GUHAM-sACe_lkd.js} +1 -1
  24. package/dist/web-ui/assets/{chunk-QZHKN3VN-DmbA4AU_.js → chunk-QZHKN3VN-B0qDAQUW.js} +1 -1
  25. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-D5cDjaiz.js +1 -0
  26. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-D5cDjaiz.js +1 -0
  27. package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-BLWm27gv.js → cose-bilkent-S5V4N54A-BzZayQQf.js} +1 -1
  28. package/dist/web-ui/assets/{dagre-BM42HDAG-Cb2YgHjF.js → dagre-BM42HDAG-DjcfWzm_.js} +1 -1
  29. package/dist/web-ui/assets/{diagram-2AECGRRQ-hMyyF4SK.js → diagram-2AECGRRQ-CEK9T3rW.js} +1 -1
  30. package/dist/web-ui/assets/{diagram-5GNKFQAL-DQvYRI_z.js → diagram-5GNKFQAL-BJsJPwEI.js} +1 -1
  31. package/dist/web-ui/assets/{diagram-KO2AKTUF-CPOv2Kga.js → diagram-KO2AKTUF-BZlki2qo.js} +1 -1
  32. package/dist/web-ui/assets/{diagram-LMA3HP47-DvgOU39M.js → diagram-LMA3HP47-Bkmh3WcY.js} +1 -1
  33. package/dist/web-ui/assets/{diagram-OG6HWLK6-DhLJ9Bog.js → diagram-OG6HWLK6-4THSXHiA.js} +1 -1
  34. package/dist/web-ui/assets/{erDiagram-TEJ5UH35-C4MKvJYc.js → erDiagram-TEJ5UH35-CPj2HGe-.js} +1 -1
  35. package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-C4KiUPBX.js → flowDiagram-I6XJVG4X-Bu8HgFqR.js} +1 -1
  36. package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-CFiAe8nx.js → ganttDiagram-6RSMTGT7-C5gs9b9P.js} +1 -1
  37. package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-y6rZo1sT.js → gitGraphDiagram-PVQCEYII-DxnBgR_T.js} +1 -1
  38. package/dist/web-ui/assets/{index-CcppNtga.js → index-CiAGgfZx.js} +6 -6
  39. package/dist/web-ui/assets/{infoDiagram-5YYISTIA-LLlnmiVb.js → infoDiagram-5YYISTIA-D4M-cR8I.js} +1 -1
  40. package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-Brs-NT84.js → ishikawaDiagram-YF4QCWOH-Oiq6jknk.js} +1 -1
  41. package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-um06-20P.js → journeyDiagram-JHISSGLW-D2gmyCKv.js} +1 -1
  42. package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-yws0Rgw8.js → kanban-definition-UN3LZRKU-DqjzkO8l.js} +1 -1
  43. package/dist/web-ui/assets/{mermaid.core-C0Q8mcc_.js → mermaid.core-N5tL3hIv.js} +5 -5
  44. package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-xCtHajk4.js → mindmap-definition-RKZ34NQL-ATHsVy0v.js} +1 -1
  45. package/dist/web-ui/assets/{pieDiagram-4H26LBE5-BhKiwY7r.js → pieDiagram-4H26LBE5-CprLr2Gv.js} +1 -1
  46. package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-CGmxw13s.js → quadrantDiagram-W4KKPZXB-0uN86dlU.js} +1 -1
  47. package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-CYJRHrZE.js → requirementDiagram-4Y6WPE33-CQmWbZXW.js} +1 -1
  48. package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-CgkdSCTc.js → sankeyDiagram-5OEKKPKP-D6kdJsQI.js} +1 -1
  49. package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-BD2dXCDe.js → sequenceDiagram-3UESZ5HK-1Y79snKt.js} +1 -1
  50. package/dist/web-ui/assets/{stateDiagram-AJRCARHV-DdEvCrm2.js → stateDiagram-AJRCARHV-BqmCPSIN.js} +1 -1
  51. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-DRaoGsBn.js +1 -0
  52. package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-CWfdKPN1.js → timeline-definition-PNZ67QCA-OG71KAzb.js} +1 -1
  53. package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-BTiDdRt6.js → vennDiagram-CIIHVFJN-V9c-71bn.js} +1 -1
  54. package/dist/web-ui/assets/{wardley-L42UT6IY-eDkltTBC.js → wardley-L42UT6IY-C3A6_LpL.js} +1 -1
  55. package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-DLOZOKTX.js → wardleyDiagram-YWT4CUSO-B54ZiT7U.js} +1 -1
  56. package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-RU8GlPu6.js → xychartDiagram-2RQKCTM6-DpWlpUfV.js} +1 -1
  57. package/dist/web-ui/index.html +1 -1
  58. package/package.json +1 -1
  59. package/dist/web-ui/assets/Settings-6xm2sHhm.js +0 -8
  60. package/dist/web-ui/assets/channel-Cw25sYRm.js +0 -1
  61. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-CDWjvgnK.js +0 -1
  62. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-CDWjvgnK.js +0 -1
  63. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-DKPteYMC.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-C0Q8mcc_.js","assets/transform-CpIVI4vC.js","assets/Team-vmqHkmh8.js","assets/CommentInput-Dvlq2svZ.js","assets/ContentRenderer-BfnvpFM7.js","assets/DeliverableShareModal-DkGpQmZ8.js","assets/Team-DFuMZ0ql.css","assets/Work-Ds7q6pZg.js","assets/value-DIujSiJ7.js","assets/Work-BZV40eAE.css","assets/Deliverables-CtPvquKO.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-N5tL3hIv.js","assets/transform-CpIVI4vC.js","assets/Team-NM2SsmjN.js","assets/CommentInput-CIxUL6dU.js","assets/ContentRenderer-Bb_drUpO.js","assets/DeliverableShareModal-BEeIlXig.js","assets/Team-DFuMZ0ql.css","assets/Work-ornw-1Zh.js","assets/value-DIujSiJ7.js","assets/Work-BZV40eAE.css","assets/Deliverables-CJFzxbLw.js"])))=>i.map(i=>d[i]);
2
2
  (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}})();function Tc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zf={exports:{}},ql={};var Ey;function g7(){if(Ey)return ql;Ey=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,l){var c=null;if(l!==void 0&&(c=""+l),o.key!==void 0&&(c=""+o.key),"key"in o){l={};for(var d in o)d!=="key"&&(l[d]=o[d])}else l=o;return o=l.ref,{$$typeof:e,type:r,key:c,ref:o!==void 0?o:null,props:l}}return ql.Fragment=t,ql.jsx=n,ql.jsxs=n,ql}var _y;function b7(){return _y||(_y=1,Zf.exports=g7()),Zf.exports}var s=b7(),Jf={exports:{}},Ot={};var jy;function x7(){if(jy)return Ot;jy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),y=Symbol.iterator;function x(W){return W===null||typeof W!="object"?null:(W=y&&W[y]||W["@@iterator"],typeof W=="function"?W:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,T={};function S(W,pe,P){this.props=W,this.context=pe,this.refs=T,this.updater=P||w}S.prototype.isReactComponent={},S.prototype.setState=function(W,pe){if(typeof W!="object"&&typeof W!="function"&&W!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,W,pe,"setState")},S.prototype.forceUpdate=function(W){this.updater.enqueueForceUpdate(this,W,"forceUpdate")};function E(){}E.prototype=S.prototype;function j(W,pe,P){this.props=W,this.context=pe,this.refs=T,this.updater=P||w}var L=j.prototype=new E;L.constructor=j,C(L,S.prototype),L.isPureReactComponent=!0;var I=Array.isArray;function O(){}var F={H:null,A:null,T:null,S:null},V=Object.prototype.hasOwnProperty;function X(W,pe,P){var _e=P.ref;return{$$typeof:e,type:W,key:pe,ref:_e!==void 0?_e:null,props:P}}function z(W,pe){return X(W.type,pe,W.props)}function G(W){return typeof W=="object"&&W!==null&&W.$$typeof===e}function se(W){var pe={"=":"=0",":":"=2"};return"$"+W.replace(/[=:]/g,function(P){return pe[P]})}var ee=/\/+/g;function q(W,pe){return typeof W=="object"&&W!==null&&W.key!=null?se(""+W.key):pe.toString(36)}function re(W){switch(W.status){case"fulfilled":return W.value;case"rejected":throw W.reason;default:switch(typeof W.status=="string"?W.then(O,O):(W.status="pending",W.then(function(pe){W.status==="pending"&&(W.status="fulfilled",W.value=pe)},function(pe){W.status==="pending"&&(W.status="rejected",W.reason=pe)})),W.status){case"fulfilled":return W.value;case"rejected":throw W.reason}}throw W}function B(W,pe,P,_e,He){var Pe=typeof W;(Pe==="undefined"||Pe==="boolean")&&(W=null);var Ge=!1;if(W===null)Ge=!0;else switch(Pe){case"bigint":case"string":case"number":Ge=!0;break;case"object":switch(W.$$typeof){case e:case t:Ge=!0;break;case h:return Ge=W._init,B(Ge(W._payload),pe,P,_e,He)}}if(Ge)return He=He(W),Ge=_e===""?"."+q(W,0):_e,I(He)?(P="",Ge!=null&&(P=Ge.replace(ee,"$&/")+"/"),B(He,pe,P,"",function(Ct){return Ct})):He!=null&&(G(He)&&(He=z(He,P+(He.key==null||W&&W.key===He.key?"":(""+He.key).replace(ee,"$&/")+"/")+Ge)),pe.push(He)),1;Ge=0;var ct=_e===""?".":_e+":";if(I(W))for(var mt=0;mt<W.length;mt++)_e=W[mt],Pe=ct+q(_e,mt),Ge+=B(_e,pe,P,Pe,He);else if(mt=x(W),typeof mt=="function")for(W=mt.call(W),mt=0;!(_e=W.next()).done;)_e=_e.value,Pe=ct+q(_e,mt++),Ge+=B(_e,pe,P,Pe,He);else if(Pe==="object"){if(typeof W.then=="function")return B(re(W),pe,P,_e,He);throw pe=String(W),Error("Objects are not valid as a React child (found: "+(pe==="[object Object]"?"object with keys {"+Object.keys(W).join(", ")+"}":pe)+"). If you meant to render a collection of children, use an array instead.")}return Ge}function J(W,pe,P){if(W==null)return W;var _e=[],He=0;return B(W,_e,"","",function(Pe){return pe.call(P,Pe,He++)}),_e}function fe(W){if(W._status===-1){var pe=W._result;pe=pe(),pe.then(function(P){(W._status===0||W._status===-1)&&(W._status=1,W._result=P)},function(P){(W._status===0||W._status===-1)&&(W._status=2,W._result=P)}),W._status===-1&&(W._status=0,W._result=pe)}if(W._status===1)return W._result.default;throw W._result}var Se=typeof reportError=="function"?reportError:function(W){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var pe=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof W=="object"&&W!==null&&typeof W.message=="string"?String(W.message):String(W),error:W});if(!window.dispatchEvent(pe))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",W);return}console.error(W)},U={map:J,forEach:function(W,pe,P){J(W,function(){pe.apply(this,arguments)},P)},count:function(W){var pe=0;return J(W,function(){pe++}),pe},toArray:function(W){return J(W,function(pe){return pe})||[]},only:function(W){if(!G(W))throw Error("React.Children.only expected to receive a single React element child.");return W}};return Ot.Activity=g,Ot.Children=U,Ot.Component=S,Ot.Fragment=n,Ot.Profiler=o,Ot.PureComponent=j,Ot.StrictMode=r,Ot.Suspense=m,Ot.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=F,Ot.__COMPILER_RUNTIME={__proto__:null,c:function(W){return F.H.useMemoCache(W)}},Ot.cache=function(W){return function(){return W.apply(null,arguments)}},Ot.cacheSignal=function(){return null},Ot.cloneElement=function(W,pe,P){if(W==null)throw Error("The argument must be a React element, but you passed "+W+".");var _e=C({},W.props),He=W.key;if(pe!=null)for(Pe in pe.key!==void 0&&(He=""+pe.key),pe)!V.call(pe,Pe)||Pe==="key"||Pe==="__self"||Pe==="__source"||Pe==="ref"&&pe.ref===void 0||(_e[Pe]=pe[Pe]);var Pe=arguments.length-2;if(Pe===1)_e.children=P;else if(1<Pe){for(var Ge=Array(Pe),ct=0;ct<Pe;ct++)Ge[ct]=arguments[ct+2];_e.children=Ge}return X(W.type,He,_e)},Ot.createContext=function(W){return W={$$typeof:c,_currentValue:W,_currentValue2:W,_threadCount:0,Provider:null,Consumer:null},W.Provider=W,W.Consumer={$$typeof:l,_context:W},W},Ot.createElement=function(W,pe,P){var _e,He={},Pe=null;if(pe!=null)for(_e in pe.key!==void 0&&(Pe=""+pe.key),pe)V.call(pe,_e)&&_e!=="key"&&_e!=="__self"&&_e!=="__source"&&(He[_e]=pe[_e]);var Ge=arguments.length-2;if(Ge===1)He.children=P;else if(1<Ge){for(var ct=Array(Ge),mt=0;mt<Ge;mt++)ct[mt]=arguments[mt+2];He.children=ct}if(W&&W.defaultProps)for(_e in Ge=W.defaultProps,Ge)He[_e]===void 0&&(He[_e]=Ge[_e]);return X(W,Pe,He)},Ot.createRef=function(){return{current:null}},Ot.forwardRef=function(W){return{$$typeof:d,render:W}},Ot.isValidElement=G,Ot.lazy=function(W){return{$$typeof:h,_payload:{_status:-1,_result:W},_init:fe}},Ot.memo=function(W,pe){return{$$typeof:f,type:W,compare:pe===void 0?null:pe}},Ot.startTransition=function(W){var pe=F.T,P={};F.T=P;try{var _e=W(),He=F.S;He!==null&&He(P,_e),typeof _e=="object"&&_e!==null&&typeof _e.then=="function"&&_e.then(O,Se)}catch(Pe){Se(Pe)}finally{pe!==null&&P.types!==null&&(pe.types=P.types),F.T=pe}},Ot.unstable_useCacheRefresh=function(){return F.H.useCacheRefresh()},Ot.use=function(W){return F.H.use(W)},Ot.useActionState=function(W,pe,P){return F.H.useActionState(W,pe,P)},Ot.useCallback=function(W,pe){return F.H.useCallback(W,pe)},Ot.useContext=function(W){return F.H.useContext(W)},Ot.useDebugValue=function(){},Ot.useDeferredValue=function(W,pe){return F.H.useDeferredValue(W,pe)},Ot.useEffect=function(W,pe){return F.H.useEffect(W,pe)},Ot.useEffectEvent=function(W){return F.H.useEffectEvent(W)},Ot.useId=function(){return F.H.useId()},Ot.useImperativeHandle=function(W,pe,P){return F.H.useImperativeHandle(W,pe,P)},Ot.useInsertionEffect=function(W,pe){return F.H.useInsertionEffect(W,pe)},Ot.useLayoutEffect=function(W,pe){return F.H.useLayoutEffect(W,pe)},Ot.useMemo=function(W,pe){return F.H.useMemo(W,pe)},Ot.useOptimistic=function(W,pe){return F.H.useOptimistic(W,pe)},Ot.useReducer=function(W,pe,P){return F.H.useReducer(W,pe,P)},Ot.useRef=function(W){return F.H.useRef(W)},Ot.useState=function(W){return F.H.useState(W)},Ot.useSyncExternalStore=function(W,pe,P){return F.H.useSyncExternalStore(W,pe,P)},Ot.useTransition=function(){return F.H.useTransition()},Ot.version="19.2.4",Ot}var My;function A0(){return My||(My=1,Jf.exports=x7()),Jf.exports}var k=A0();const PY=Tc(k);var ep={exports:{}},Gl={},tp={exports:{}},np={};var Ry;function y7(){return Ry||(Ry=1,(function(e){function t(B,J){var fe=B.length;B.push(J);e:for(;0<fe;){var Se=fe-1>>>1,U=B[Se];if(0<o(U,J))B[Se]=J,B[fe]=U,fe=Se;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var J=B[0],fe=B.pop();if(fe!==J){B[0]=fe;e:for(var Se=0,U=B.length,W=U>>>1;Se<W;){var pe=2*(Se+1)-1,P=B[pe],_e=pe+1,He=B[_e];if(0>o(P,fe))_e<U&&0>o(He,P)?(B[Se]=He,B[_e]=fe,Se=_e):(B[Se]=P,B[pe]=fe,Se=pe);else if(_e<U&&0>o(He,fe))B[Se]=He,B[_e]=fe,Se=_e;else break e}}return J}function o(B,J){var fe=B.sortIndex-J.sortIndex;return fe!==0?fe:B.id-J.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var m=[],f=[],h=1,g=null,y=3,x=!1,w=!1,C=!1,T=!1,S=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function L(B){for(var J=n(f);J!==null;){if(J.callback===null)r(f);else if(J.startTime<=B)r(f),J.sortIndex=J.expirationTime,t(m,J);else break;J=n(f)}}function I(B){if(C=!1,L(B),!w)if(n(m)!==null)w=!0,O||(O=!0,se());else{var J=n(f);J!==null&&re(I,J.startTime-B)}}var O=!1,F=-1,V=5,X=-1;function z(){return T?!0:!(e.unstable_now()-X<V)}function G(){if(T=!1,O){var B=e.unstable_now();X=B;var J=!0;try{e:{w=!1,C&&(C=!1,E(F),F=-1),x=!0;var fe=y;try{t:{for(L(B),g=n(m);g!==null&&!(g.expirationTime>B&&z());){var Se=g.callback;if(typeof Se=="function"){g.callback=null,y=g.priorityLevel;var U=Se(g.expirationTime<=B);if(B=e.unstable_now(),typeof U=="function"){g.callback=U,L(B),J=!0;break t}g===n(m)&&r(m),L(B)}else r(m);g=n(m)}if(g!==null)J=!0;else{var W=n(f);W!==null&&re(I,W.startTime-B),J=!1}}break e}finally{g=null,y=fe,x=!1}J=void 0}}finally{J?se():O=!1}}}var se;if(typeof j=="function")se=function(){j(G)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,q=ee.port2;ee.port1.onmessage=G,se=function(){q.postMessage(null)}}else se=function(){S(G,0)};function re(B,J){F=S(function(){B(e.unstable_now())},J)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(B){B.callback=null},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(B){switch(y){case 1:case 2:case 3:var J=3;break;default:J=y}var fe=y;y=J;try{return B()}finally{y=fe}},e.unstable_requestPaint=function(){T=!0},e.unstable_runWithPriority=function(B,J){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var fe=y;y=B;try{return J()}finally{y=fe}},e.unstable_scheduleCallback=function(B,J,fe){var Se=e.unstable_now();switch(typeof fe=="object"&&fe!==null?(fe=fe.delay,fe=typeof fe=="number"&&0<fe?Se+fe:Se):fe=Se,B){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=fe+U,B={id:h++,callback:J,priorityLevel:B,startTime:fe,expirationTime:U,sortIndex:-1},fe>Se?(B.sortIndex=fe,t(f,B),n(m)===null&&B===n(f)&&(C?(E(F),F=-1):C=!0,re(I,fe-Se))):(B.sortIndex=U,t(m,B),w||x||(w=!0,O||(O=!0,se()))),B},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(B){var J=y;return function(){var fe=y;y=J;try{return B.apply(this,arguments)}finally{y=fe}}}})(np)),np}var Ly;function v7(){return Ly||(Ly=1,tp.exports=y7()),tp.exports}var rp={exports:{}},nr={};var Oy;function w7(){if(Oy)return nr;Oy=1;var e=A0();function t(m){var f="https://react.dev/errors/"+m;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)f+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+m+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function l(m,f,h){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:m,containerInfo:f,implementation:h}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(m,f){if(m==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return nr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,nr.createPortal=function(m,f){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return l(m,f,null,h)},nr.flushSync=function(m){var f=c.T,h=r.p;try{if(c.T=null,r.p=2,m)return m()}finally{c.T=f,r.p=h,r.d.f()}},nr.preconnect=function(m,f){typeof m=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,r.d.C(m,f))},nr.prefetchDNS=function(m){typeof m=="string"&&r.d.D(m)},nr.preinit=function(m,f){if(typeof m=="string"&&f&&typeof f.as=="string"){var h=f.as,g=d(h,f.crossOrigin),y=typeof f.integrity=="string"?f.integrity:void 0,x=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;h==="style"?r.d.S(m,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:g,integrity:y,fetchPriority:x}):h==="script"&&r.d.X(m,{crossOrigin:g,integrity:y,fetchPriority:x,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},nr.preinitModule=function(m,f){if(typeof m=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var h=d(f.as,f.crossOrigin);r.d.M(m,{crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&r.d.M(m)},nr.preload=function(m,f){if(typeof m=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var h=f.as,g=d(h,f.crossOrigin);r.d.L(m,h,{crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},nr.preloadModule=function(m,f){if(typeof m=="string")if(f){var h=d(f.as,f.crossOrigin);r.d.m(m,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else r.d.m(m)},nr.requestFormReset=function(m){r.d.r(m)},nr.unstable_batchedUpdates=function(m,f){return m(f)},nr.useFormState=function(m,f,h){return c.H.useFormState(m,f,h)},nr.useFormStatus=function(){return c.H.useHostTransitionStatus()},nr.version="19.2.4",nr}var Dy;function sw(){if(Dy)return rp.exports;Dy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),rp.exports=w7(),rp.exports}var Iy;function k7(){if(Iy)return Gl;Iy=1;var e=v7(),t=A0(),n=sw();function r(a){var i="https://react.dev/errors/"+a;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)i+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+a+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function l(a){var i=a,u=a;if(a.alternate)for(;i.return;)i=i.return;else{a=i;do i=a,(i.flags&4098)!==0&&(u=i.return),a=i.return;while(a)}return i.tag===3?u:null}function c(a){if(a.tag===13){var i=a.memoizedState;if(i===null&&(a=a.alternate,a!==null&&(i=a.memoizedState)),i!==null)return i.dehydrated}return null}function d(a){if(a.tag===31){var i=a.memoizedState;if(i===null&&(a=a.alternate,a!==null&&(i=a.memoizedState)),i!==null)return i.dehydrated}return null}function m(a){if(l(a)!==a)throw Error(r(188))}function f(a){var i=a.alternate;if(!i){if(i=l(a),i===null)throw Error(r(188));return i!==a?null:a}for(var u=a,p=i;;){var b=u.return;if(b===null)break;var v=b.alternate;if(v===null){if(p=b.return,p!==null){u=p;continue}break}if(b.child===v.child){for(v=b.child;v;){if(v===u)return m(b),a;if(v===p)return m(b),i;v=v.sibling}throw Error(r(188))}if(u.return!==p.return)u=b,p=v;else{for(var _=!1,D=b.child;D;){if(D===u){_=!0,u=b,p=v;break}if(D===p){_=!0,p=b,u=v;break}D=D.sibling}if(!_){for(D=v.child;D;){if(D===u){_=!0,u=v,p=b;break}if(D===p){_=!0,p=v,u=b;break}D=D.sibling}if(!_)throw Error(r(189))}}if(u.alternate!==p)throw Error(r(190))}if(u.tag!==3)throw Error(r(188));return u.stateNode.current===u?a:i}function h(a){var i=a.tag;if(i===5||i===26||i===27||i===6)return a;for(a=a.child;a!==null;){if(i=h(a),i!==null)return i;a=a.sibling}return null}var g=Object.assign,y=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),j=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),X=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),G=Symbol.iterator;function se(a){return a===null||typeof a!="object"?null:(a=G&&a[G]||a["@@iterator"],typeof a=="function"?a:null)}var ee=Symbol.for("react.client.reference");function q(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===ee?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case C:return"Fragment";case S:return"Profiler";case T:return"StrictMode";case I:return"Suspense";case O:return"SuspenseList";case X:return"Activity"}if(typeof a=="object")switch(a.$$typeof){case w:return"Portal";case j:return a.displayName||"Context";case E:return(a._context.displayName||"Context")+".Consumer";case L:var i=a.render;return a=a.displayName,a||(a=i.displayName||i.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case F:return i=a.displayName||null,i!==null?i:q(a.type)||"Memo";case V:i=a._payload,a=a._init;try{return q(a(i))}catch{}}return null}var re=Array.isArray,B=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,fe={pending:!1,data:null,method:null,action:null},Se=[],U=-1;function W(a){return{current:a}}function pe(a){0>U||(a.current=Se[U],Se[U]=null,U--)}function P(a,i){U++,Se[U]=a.current,a.current=i}var _e=W(null),He=W(null),Pe=W(null),Ge=W(null);function ct(a,i){switch(P(Pe,i),P(He,a),P(_e,null),i.nodeType){case 9:case 11:a=(a=i.documentElement)&&(a=a.namespaceURI)?Qx(a):0;break;default:if(a=i.tagName,i=i.namespaceURI)i=Qx(i),a=Zx(i,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}pe(_e),P(_e,a)}function mt(){pe(_e),pe(He),pe(Pe)}function Ct(a){a.memoizedState!==null&&P(Ge,a);var i=_e.current,u=Zx(i,a.type);i!==u&&(P(He,a),P(_e,u))}function Mt(a){He.current===a&&(pe(_e),pe(He)),Ge.current===a&&(pe(Ge),$l._currentValue=fe)}var Pt,Kt;function yt(a){if(Pt===void 0)try{throw Error()}catch(u){var i=u.stack.trim().match(/\n( *(at )?)/);Pt=i&&i[1]||"",Kt=-1<u.stack.indexOf(`
3
3
  at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
4
4
  `+Pt+a+Kt}var Ue=!1;function dt(a,i){if(!a||Ue)return"";Ue=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={DetermineComponentFrameRoot:function(){try{if(i){var De=function(){throw Error()};if(Object.defineProperty(De.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(De,[])}catch(Ce){var ke=Ce}Reflect.construct(a,[],De)}else{try{De.call()}catch(Ce){ke=Ce}a.call(De.prototype)}}else{try{throw Error()}catch(Ce){ke=Ce}(De=a())&&typeof De.catch=="function"&&De.catch(function(){})}}catch(Ce){if(Ce&&ke&&typeof Ce.stack=="string")return[Ce.stack,ke.stack]}return[null,null]}};p.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(p.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(p.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=p.DetermineComponentFrameRoot(),_=v[0],D=v[1];if(_&&D){var ie=_.split(`
@@ -16,7 +16,7 @@ Agent ID: {{externalAgentId}}
16
16
  Step 1: Read the integration handbook at GET {{gwUrl}}/manual (set header Authorization: Bearer <token above>). It describes the full Markus concept model, API endpoints, and collaboration patterns.
17
17
  Step 2: Start a sync loop — call POST {{gwUrl}}/sync every 30 seconds with your status. The response includes assigned tasks, inbox messages, team context (colleagues), and project context (requirements).
18
18
  Step 3: Accept and execute tasks, report progress, and communicate with teammates via the sync message system.`,bearerTokenLine:`Bearer Token: {{token}}
19
- `,done:"Done"},deleteTeam:{confirmTitle:'Delete "{{name}}"?',message:"This team will be removed from the database. Check options below to also delete members and disk files.",deleteMembers:"Also delete all members in this team",purgeFiles:"Also delete disk files (workspace, memory, logs)"},removeFromTeam:{title:"Move out of team?",message:"This member will be moved to Ungrouped."},removeAgent:{confirmTitle:'Remove "{{name}}"?',message:"This agent will be removed from the database. Check the option below to also delete its workspace, memory, and other files from disk.",purgeFiles:"Also delete disk files (workspace, memory, logs)"},removeHuman:{message:"This user will lose access.",confirmTitle:'Remove "{{name}}"?'},pauseAll:{title:"Pause All Agents",message:"All agents will be paused. Events will still enter the mailbox but will not be processed. In-progress tasks will be blocked."},resumeAll:{title:"Resume All Agents",message:"All agents will resume processing events from their mailbox."},createGroupChat:{title:"Create Group Chat",subtitle:"Add agents and humans to chat together",groupNamePlaceholder:"Group name...",searchPlaceholder:"Search members...",noMembersFound:"No members found",selected:"{{count}} selected",creating:"Creating...",create:"Create"},deleteGroupChat:{title:"Delete group chat?",message:'Delete "{{name}}" and all its messages?',confirm:"Delete",menuLabel:"Delete Group"}},jT={bellTitle:"Notifications",approvals:"Approvals",notifications:"Notifications",noApprovals:"No approval requests",noNotifications:"No notifications",markAllRead:"Mark all read",confirmReject:"Confirm Reject",rejectReasonPlaceholder:"Reason for rejection (optional, Enter to submit)",freeformPlaceholder:"Or type your opinion...",commentPlaceholder:"Add comment (optional)",needsAdjustment:"Needs Adjustment",adjustmentPlaceholder:"Describe the adjustments needed...",confirmAdjustment:"Submit Adjustment",actionHints:{openChat:"Open chat →",viewDetails:"View details →",viewTask:"View task →",viewRequirement:"View requirement →",viewAgent:"View agent →",viewApproval:"View approval →"},approvalType:{task:"Task",requirement:"Requirement",requirementResubmit:"Requirement (resubmitted)",taskReview:"Task Review",toolExecution:"Tool Execution"},approvalHistory:"History"},MT={respond:"Respond",submit:"Submit",submitted:"Submitted",next:"Next",previous:"Previous",questionProgress:"Question {{current}} of {{total}}",textPlaceholder:"Type your answer…",freeformPlaceholder:"Or write your own answer…"},RT={secretary:"I just set up Markus. Help me get started — what can I do here?",agent:"Introduce yourself — what can you do?"},LT={succeeded:"{{count}} agent(s) {{action}}",failed:"{{action}}: {{ok}} succeeded, {{fail}} failed",moveFailed:"Move failed: {{error}}",failedToRun:"Failed to {{action}}: {{error}}",past:{start:"started",stop:"stopped",pause:"paused",resume:"resumed"},operation:{start:"Start",stop:"Stop",pause:"Pause",resume:"Resume"}},OT={defaultInsufficientCredits:"Insufficient credits",defaultInvalidApiKey:"Invalid API key",defaultTooManyRequests:"Too many requests",defaultServiceDown:"Service temporarily down",markusCuExceeded:"⚠ Insufficient balance. Please top up or upgrade: https://markus.global/settings?tab=billing",markusRateLimited:"⚠ Upstream model provider rate-limited the request (OpenRouter / model vendor). This usually clears in a few seconds to a minute; if many agents are running, retry shortly or stagger tasks.",markusWindowExceeded:"⚠ Upstream temporarily limited request rate. Please retry shortly; if you are out of credits, top up or upgrade: https://markus.global/settings?tab=billing",creditModalTitle:"Credits Exhausted",creditModalDesc:"Your Markus Cloud AI credits have been used up. Please purchase more credits or upgrade your subscription to continue.",creditModalDismiss:"Later",creditModalUpgrade:"Top Up / Upgrade",ai402:"⚠ AI service error: {{detail}}. Please top up the API balance or contact your administrator.",ai401:"⚠ AI service authentication failed: {{detail}}. Please check the configuration.",ai429:"⚠ Rate limit exceeded: {{detail}}. Please wait a moment and try again.",ai409:"⚠ Request conflict: {{detail}}. Please retry.",ai502:"⚠ AI upstream service error: {{detail}}. The LLM provider may be temporarily down. Please try again later.",ai503:"⚠ AI service unavailable: {{detail}}. Please try again later.",aiUpstreamBillingMismatch:"⚠ Upstream billing error, but your Markus credits still remain. Please retry shortly or switch model. {{detail}}",aiRegionBlocked:"⚠ Model {{model}} is not available in your region. Please switch to another model in the chat composer.",aiGeneric:"⚠ AI service error: {{detail}}",defaultUpstreamDown:"LLM provider returned 502 Bad Gateway",defaultUpstreamBillingMismatch:"Upstream payment error with remaining local credits",defaultConflict:"Conflicting request"},DT={userInputPrompt_one:"{{count}} question awaiting your response",userInputPrompt_other:"{{count}} questions awaiting your response",userInputRespond:"Respond",notifyUserPrompt:"Agent notification awaiting your attention",notifyUserView:"View",notifyUserGotIt:"Got it",viewProfileArrow:"View Profile →",viewAgentProfileArrow:"View Agent Profile →",viewMindArrow:"View Mind →",messageActions:{resumeTitle:"Resume",reaskTitle:"Re-ask",retryTitle:"Retry",replyTitle:"Reply",rememberTitle:"Remember",rememberModalTitle:"Remember this experience?",rememberModalHint:"Optional: tell the agent what to encode from this conversation.",rememberModalPlaceholder:"e.g. Always confirm before editing ROLE.md",rememberConfirm:"Start evolution",rememberCancel:"Cancel",evolvedFrom:"Evolution session — reviewing a previous conversation",aiGeneratedDisclaimer:"AI-generated content — please verify carefully"},stopped:"Stopped",emptyReply:"The assistant didn't produce a reply this time. This usually means the request was too large or the AI service was briefly unavailable. Please retry — if it keeps happening, check your credits or switch models in Settings.",fallbackAgent:"Agent",fallbackYou:"You",systemName:"System",workerRole:"worker",selectAgent:"Select Agent",directMessage:"Direct Message",chatTitle:"Chat",teamTab:"Team",profileTab:"Profile",newChat:"New Chat",newChatPlus:"+ New",newChatButton:"+ New Chat",historyTitle:"History",rightPanelToggle:"Toggle side panel",sessionMain:"Main",sessionConversation:"Conversation",noConversationsYet:"No conversations yet",chatGreetings:["How can I help you?","What would you like me to do?","Ready when you are ✨","What's on your mind?","What shall we work on today?"],dateToday:"Today",dateYesterday:"Yesterday",datePrevious7Days:"Previous 7 days",dateOlder:"Older",loadingEarlierMessages:"Loading earlier messages…",emptyChannel:"No messages in {{name}} yet.",emptySelectAgent:"Select an agent from the sidebar to start.",emptyNewConversation:"Start a new conversation with {{name}}.",agentThinking:"Agent is thinking…",scrollToBottom:"Scroll to bottom",toggleSidebar:"Toggle sidebar",newMessages:"{{count}} new message(s)",mentionAgent:"Mention an agent",slashSkill:"Skills",mentionType:{agent:"Agent",project:"Project",requirement:"Requirement",task:"Task",deliverable:"Deliverable",workflow:"Workflow"},slashCmd:{skill:"Skills"},addMoreFiles:"Add more files",attachFilesTitle:"Attach files (images, PDF, Word, Excel, PowerPoint...)",visionWarning:"Images will be converted to text (model does not support vision)",stopAgent:"Stop agent",messageCount:"{{count}} messages",privateNotepad:"· Private notepad",dmWith:"· Direct message with {{name}}",members:"Members",addMemberPlaceholder:"+ Add member...",placeholder:{channelWithMention:"Message {{name}}… (use @name to mention)",channel:"Message {{name}}…",dmSelf:"Write a note to yourself…",dmOther:"Message {{name}}…",direct:"Type a message…",directOptions:["What can I do for you?","How can I help you today?","What's on your mind?","Ready when you are…","Tell me what you need…"],noAgent:"Select an agent to start chatting",agentOffline:"Agent is offline. Start the agent to send messages."},newTaskTitle:"New Conversation Task",taskFromChat:"Created from chat with {{name}}",errorWithMessage:"Error: {{message}}",retryConfirmSingular:"This will discard one message after this point and re-generate. Continue?",retryConfirmPlural:"This will discard {{count}} messages after this point and re-generate. Continue?",errorDetails:"Error Details",recentErrorDetails:"Recent Error",errorRecovered:"Agent has recovered and is running normally.",currentActivity:"Current Activity",workingOnTaskHint:"Working on task · Click to view",agentErrorFallback:"Agent encountered an error. Check profile for details.",processing:"Processing...",activityHeartbeat:"Heartbeat: {{name}}",activityTask:"Task: {{label}}",activityDescHeartbeat:"Periodic check-in task",activityDescChat:"Responding to conversation",activityDescFallback:"Agent is thinking or communicating",searchMessages:"Search messages",searchPlaceholder:"Search messages...",searching:"Searching...",noSearchResults:"No messages found"},IT={title:"Model",search:"Search models",applyGlobal:"Apply to global",empty:"No enabled providers / models"},PT={chat:TT,teamProfile:AT,contextMenu:ET,modals:_T,notifications:jT,userInput:MT,intro:RT,batchAction:LT,errors:OT,page:DT,chatModel:IT},zT="Work",BT={allProjects:"All Projects",newProject:"New Project",projectName:"Project Name *",projectNamePlaceholder:"e.g. Mobile App, Website Redesign",projectNameRequired:"Project name is required",description:"Description",descriptionPlaceholder:"What is this project about?",assignTeams:"Assign Teams",noTeamsAvailable:"No teams available",repositoryUrl:"Repository URL",repositoryPlaceholder:"https://github.com/org/repo (optional)",branch:"Branch",branchPlaceholder:"main",createProject:"Create Project",failedToCreate:"Failed to create project",settings:"Settings",status:"Status",repositories:"Repositories",deleteProject:"Delete Project",archiveProject:"Archive Project",settingsTitle:"Project settings",editProject:"Edit project",descriptionPlaceholderLong:"Add a project description…",projectStatusHeading:"Project Status",statusActive:"Active",statusActiveDesc:"Work is ongoing",statusPaused:"Paused",statusPausedDesc:"Temporarily on hold",statusArchived:"Archived",statusArchivedDesc:"No longer active",taskOverview:"Task Overview",requirementsHeading:"Requirements",agentsHeading:"Agents ({{count}})",agentTaskCounts:"{{active}} active / {{total}} total",addRepo:"+ Add",noReposLinked:"No repositories linked.",removeRepo:"Remove repository",repoPathPlaceholder:"Local path (e.g. /Users/me/project)",repoBranchPlaceholder:"Branch (default: main)",dangerZone:"Danger Zone",dangerZoneDeleteHint:"Deleting a project is permanent and cannot be undone. Tasks and requirements will be unlinked.",deleteProjectConfirmTitle:"Delete this project?",deleteProjectConfirmBody:'"{{name}}" will be permanently deleted, and its {{tasks}} task(s) and {{reqs}} requirement(s) will be unlinked. This action cannot be undone.',statTotal:"Total",statCompleted:"Completed",statInProgress:"In Progress",statInReview:"In Review",statBlocked:"Blocked",statFailed:"Failed",statActive:"Active",createdLabel:"Created",updatedLabel:"Updated"},$T=JSON.parse(`{"tasks":"Tasks","newTask":"New Task","noTasks":"No tasks yet","assignee":"Assignee","unassigned":"Unassigned","priority":"Priority","dueDate":"Due Date","description":"Description","comments":"Comments","activity":"Activity","subtasks":"Subtasks","dependencies":"Dependencies","deliverables":"Deliverables","status":"Status","assignTo":"Assign to","addComment":"Add comment...","retry":"Retry","cancel":"Cancel","commentPlaceholder":"Add a comment… (type @ to mention an agent)","activityCommentsHeading":"Activity & Comments","noActivityYet":"No activity yet. Post the first comment below.","reviewer":"Reviewer","noProject":"No Project","noRequirement":"No Requirement","requirementLabel":"Requirement","projectLabel":"Project","removeDependency":"Remove dependency","noDependencies":"No dependencies","abnormalBlock":"Abnormal","abnormalBlockHint":"This task is blocked but has no unfinished dependencies — it may need manual intervention.","addDependency":"+ Add dependency…","addDescription":"Add a description…","noDescription":"No description","collapse":"Collapse","subtasksProgress":"{{done}}/{{total}} done","hideCompleted":"Hide completed","showCompleted":"Show completed ({{count}})","addSubtask":"+ Add subtask","noSubtasksYet":"No subtasks yet.","subtaskTitlePlaceholder":"Subtask title...","add":"Add","deliverablesCount":"Deliverables ({{count}})","noDeliverablesYet":"No deliverables yet.","createdBy":"Created by {{name}}","updatedBy":"Updated by {{name}}","started":"Started {{date}}","updatedMeta":"Updated {{date}}","executionRound":"Round {{n}}","detailsTab":"Details","executionLogTab":"Execution Log","historyTab":"History","loadingHistory":"Loading history...","noHistory":"No status change history.","statusHistory":"Status History","showAllHistory":"Show all {{count}} transitions","failedToStart":"Failed to start:","scrollToTop":"Scroll to top","scrollToBottom":"Scroll to bottom","approve":"Approve","startExecution":"Start Execution","reject":"Reject","approveCheck":"✓ Approve","requestRevision":"↻ Request Revision","revisionReasonPlaceholder":"Revision reason…","revisionsNeededDefault":"Revisions needed","pause":"Pause","resume":"Resume","resuming":"Resuming…","runNow":"Run Now","running":"Running…","resumeSchedule":"▶ Resume Schedule","pauseSchedule":"⏸ Pause Schedule","archive":"Archive","reopen":"Reopen","resumeFailed":"Resume","cancelTask":"Cancel","deleteSubtaskTitle":"Delete subtask \\"{{title}}\\"?","deleteSubtaskMessage":"This subtask will be permanently deleted.","cancelTaskModalTitle":"Cancel Task","cancelTaskDependent_one":"This task has {{count}} dependent task that is currently blocked by it.","cancelTaskDependent_other":"This task has {{count}} dependent tasks that are currently blocked by it.","cancelTaskOnly":"Cancel this task only","cancelTaskOnlyHint":"Dependent tasks will start if they have no other blockers","cancelWithDependents":"Cancel with all dependents","cancelWithDependentsHint":"Also cancels {{count}} blocked task","cancelWithDependentsHint_plural":"Also cancels {{count}} blocked tasks","keepTaskRunning":"Keep task running","rejectConfirmTitle":"Reject Task","rejectConfirmMessage":"Reject this task? The proposal will be denied and cannot be undone.","archiveConfirmTitle":"Archive Task","archiveConfirmMessage":"Archive this task? It will be moved to historical records.","archiveScheduledConfirmMessage":"Archive this scheduled task? The recurring schedule will be permanently stopped.","cancelConfirmMessage":"Cancel this task? This will stop all work and cannot be undone.","cancelScheduledConfirmMessage":"Cancel this scheduled task? The recurring schedule will be paused and all work will be stopped.","continueTask":"Continue","editSchedule":"Edit","scheduleEveryMode":"Interval","scheduleCronMode":"Cron","scheduleMaxRuns":"Max runs:","scheduleMaxRunsPlaceholder":"Unlimited","viewAll":"View all →","schedulePaused":"⏸ Schedule Paused","scheduled":"Scheduled","scheduleEvery":"Every {{interval}}","scheduleCron":"Cron: {{expr}}","scheduleOneShot":"One-shot","scheduleNA":"N/A","scheduleNext":"Next: {{when}}","scheduleDueNow":"due now","scheduleInMinutes":"in {{count}}m","scheduleInHoursMinutes":"in {{h}}h {{m}}m","scheduleInDaysHours":"in {{d}}d {{h}}h","scheduleRuns":"Runs: {{current}}{{max}}","scheduleRunsMax":" / {{max}}","scheduleLast":"Last: {{when}}","scheduleApproveTitle":"Approve Scheduled Task","scheduleApproveDesc":"This task is configured with a schedule ({{schedule}}). The next execution is at {{nextRun}}.","scheduleApproveRunNow":"Run Now","scheduleApproveWait":"Wait for Schedule","serverError":"Server error","assignToRequired":"Assign to","reviewerRequired":"Reviewer","taskType":"Task Type","taskTypeStandard":"Standard","taskTypeScheduled":"Scheduled (recurring)","frequency":"Frequency","freq30m":"Every 30 min","freq1h":"Every 1 hour","freq2h":"Every 2 hours","freq4h":"Every 4 hours","freq8h":"Every 8 hours","freq12h":"Every 12 hours","freq1d":"Every day","freq1w":"Every week","blockedBy":"Blocked By (dependencies)","selectAgent":"Select agent…","selectReviewer":"Select reviewer…","selectDependency":"Select a task to depend on…","selectRequirement":"Select a requirement…","titleLabel":"Title","depsShort":"⏳ {{count}} dep","depsShort_plural":"⏳ {{count}} deps","byCreator":"by {{name}}","statusFlash":"Requirement status → {{status}}","assignedReviewerDifferent":"Assigned agent and reviewer must be different","errorCreatingTask":"Error creating task: {{message}}","errorCode_task_limit_reached":"This agent has reached its task limit. Please wait for existing tasks to complete","errorCode_requirement_required":"Please select a requirement. Tasks must be linked to an approved requirement","errorCode_agent_not_found":"The selected agent no longer exists or has been removed","errorCode_unknown":"Operation failed. Please try again later","pleaseReqTitle":"Please enter a title for this requirement","pleaseReqDesc":"Please enter a description for this requirement","pleaseReqProject":"Please select a project for this requirement","projectCreated":"Project created","projectDeleted":"Project deleted","requirementCreated":"Requirement created","requirementApproved":"Requirement approved","requirementRejected":"Requirement rejected","requirementCancelled":"Requirement cancelled","deleteProjectConfirm":"Delete this project and unlink all its tasks?","errorGeneric":"Error: {{message}}","commentInstructionPlaceholder":"Add a comment or instruction…","agentProcessing":"processing…","attachImage":"Attach image","loadingLogs":"Loading logs…","noExecutionLogs":"No execution logs yet.","runWithAgentHint":"Click \\"Run with Agent\\" to start.","emptyLogs":{"default":"No execution logs yet","defaultHint":"Send instructions via the comment box below","noAgent":"No agent assigned","noAgentHint":"Assign an agent to start execution","pending":"Task is queued for execution","pendingHint":"The agent will process tasks by priority","agentBusy":"{{agent}} is working on another task","agentBusyHint":"This task is queued in the agent's mailbox","starting":"Agent is preparing to execute","startingHint":"Logs will appear shortly…"},"relatedSessions":"{{agent}} processed this task in other sessions ({{count}} records)","sessionLive":"Live","agent":"Agent","loadingExecutionLog":"Loading execution log...","noExecutionLogAvailable":"No execution log available.","roundHeader":"Round #{{n}}","loadingRound":"Loading round #{{n}}…","toolCount_one":"{{count}} tool","toolCount_other":"{{count}} tools","dropHere":"Drop here","backToKanban":"Back to Kanban","projectsCount":"{{count}} Projects","projects":"Projects","all":"All","oneProject":"{{name}}","shortProject":"+ Project","shortReq":"+ Req","shortTask":"+ Task","backlog":"Backlog","kanban":"Kanban","dag":"DAG","workflows":"Workflows","team":"Team","selectProjectForWorkflows":"Select a project with a team to view workflows","noWorkflows":"No workflow templates for this team","workflowEmptyTitle":"No workflow templates yet","workflowEmptyDesc":"Workflows automate repeatable multi-step processes. Define a sequence of tasks as a DAG — the system handles dependencies, role assignment, and scheduling automatically.","workflowHowItWorks":"How it works","workflowStep1Title":"Requirement","workflowStep1Desc":"A workflow run creates a Requirement to group all its tasks under one trackable goal.","workflowStep2Title":"Task DAG","workflowStep2Desc":"Each step becomes a Task assigned to the right team member. Dependencies are tracked — downstream tasks wait for upstream ones to finish.","workflowStep3Title":"Auto-execution","workflowStep3Desc":"Agents pick up tasks, pass deliverables downstream, and the workflow completes automatically. Optionally, schedule it to run on a recurring basis.","workflowAskManager":"Ask {{name}} to create a workflow","workflowCreatePrompt":"Please create a workflow template for our team. Review the team composition, then design a multi-step process that matches our regular work. Use the workflow_create tool to save it. If the user specifies a project, bind the workflow to that project by including a project_id parameter. Otherwise, leave project as an optional runtime parameter so users can choose when starting a run.","saveAsWorkflow":"Save as Workflow","saveAsWorkflowDesc":"Turn this task structure into a reusable workflow template","workflowName":"Name","roles":"Roles","workflowSteps":"Steps","dependsOn":"Depends on","removeStep":"Remove step","saveWorkflow":"Save Workflow","saving":"Saving...","role":"Role","workflowLoading":"Loading...","workflowRun":"Run","workflowRunning":"Running","workflowScheduled":"Scheduled","workflowRecentRuns":"Recent Runs","workflowStarting":"Starting...","workflowStartRun":"Start Run","workflowProject":"Project","workflowSelectProject":"— Select a project —","workflowNoProject":"Please select a project","workflowNoTeam":"Cannot determine team for this workflow","workflowCancel":"Cancel","workflowCancelRun":"Cancel Run","workflowCancelling":"Cancelling...","workflowConfirmCancelTitle":"Cancel Workflow Run","workflowConfirmCancelDesc":"This will cancel all running and pending tasks in this workflow run. This action cannot be undone.","workflowConfirmCancelBtn":"Confirm Cancel","workflowNo":"No","workflowPause":"Pause","workflowResume":"Resume","workflowSendToAgent":"Send to agent chat","workflowNoRecentRuns":"No recent runs","workflowStepsCount":"{{count}} steps","workflowRolesCount":"{{count}} roles","workflowParamsCount":"{{count}} params","workflowRunTitle":"Run: {{name}}","workflowViewTasks":"View Tasks","workflowRequired":"required","workflowSavedSuccess":"Workflow saved successfully","backlogEmptyTitle":"Backlog is empty","backlogEmptyDesc":"The backlog shows all tasks in a flat list. Create a requirement and approve it — agents will break it into tasks that appear here.","dagEmptyTitle":"No task dependencies yet","dagEmptyDesc":"The dependency graph visualizes how tasks depend on each other. When tasks have \\"blocked by\\" relationships, they form a DAG (directed acyclic graph) shown here.","hideArchived":"Hide archived","hideArchivedWithCount":"Hide {{count}} archived","archivedCount":"{{count}} archived","filter":"Filter","filterWithCount":"Filter ({{count}})","clear":"Clear","myTasks":"My tasks","newRequirement":"+ Requirement","newTaskBtn":"+ Task","noItemsYet":"No items yet","emptyStateHint":"Create a requirement to tell agents what you need.\\n\\nOnce approved, tasks will appear here automatically.","emptyNoProjectsTitle":"Get started by creating a project","emptyNoProjectsHint":"Projects organize your work. Create a project first, then add requirements to describe what you need. Agents will break them into tasks automatically.","emptyNoReqsTitle":"Ready to add some work","emptyNoReqsHint":"Create a requirement to tell agents what you need.\\nOnce approved, tasks will appear here automatically.","emptyFilteredTitle":"No matching work","emptyFilteredHint":"Nothing matches the current assignee filter. Clear filters to see all items in this project.","emptyDetailTitle":"No item selected","emptyDetailHint":"Select a requirement or task from the list, or create one to get started.","createRequirementCta":"+ Create a requirement","filtersSheetTitle":"Filters","clearAll":"Clear all","projectsFilterGroup":"Projects","agentsFilterGroup":"Agents","newRequirementModalTitle":"New Requirement","newRequirementModalHint":"Describe what you need. Agents will break approved requirements into tasks.","selectProject":"Select a project…","reqTitleExample":"e.g. Add user authentication","reqDescPlaceholder":"What is needed and why...","rejectRequirementTitle":"Reject Requirement","rejectReasonLabel":"Reason","rejectReasonPlaceholder":"Why is this being rejected...","cronLabel":"Cron","scheduledShort":"Scheduled","everyInterval":"Every {{interval}}","reply":"Reply","hideLog":"Hide log","viewLog":"View log","viewProfile":"View Profile →","agentNotFound":"Agent not found: {{id}}…","workerRole":"worker","clickToEdit":"Click to edit","systemAuthor":"System","noteTimeJustNow":"just now","noteTimeMinutes":"{{count}}m ago","noteTimeHours":"{{count}}h ago","noteTimeDays":"{{count}}d ago","online":"Online","working":"Working","error":"Error","offline":"Offline","paused":"Paused","filePreviewLoading":"Loading...","emptyDirectory":"Empty directory","openInFinder":"Open in file browser","openInDeliverables":"Open in Output","requirementDetailDescription":"Description","requirementNoDescription":"No description","createdByLabel":"Created by","agentTag":"(Agent)","createdLabel":"Created","approvedBy":"Approved by","rejectionReason":"Rejection Reason","linkedTasks":"Linked Tasks ({{count}})","cancelRequirement":"Cancel Requirement","commentsWithCount":"Comments ({{count}})","noCommentsYet":"No comments yet.","requirementShort":"REQ","taskShort":"TASK","schedShort":"SCHED","backlogTitle":"Title","backlogUpdated":"Updated","noItems":"No items","loadingPage":"Loading…","adminFallback":"Admin","titleField":"Title","descriptionField":"Description","priorityField":"Priority","projectsCountLabel_one":"{{count}} Project","projectsCountLabel_other":"{{count}} Projects","noMatches":"No matches","searchPlaceholder":"Type to search…"}`),HT={requirements:"Requirements",newRequirement:"New Requirement",noRequirements:"No requirements yet",approved:"Approved",rejected:"Rejected",approveRequirement:"Approve",rejectRequirement:"Reject",cancelConfirmTitle:"Cancel Requirement",cancelConfirmMessage:"Are you sure you want to cancel this requirement? This action cannot be undone.",cancelConfirmLabel:"Cancel Requirement",createTask:"Task",noLinkedTasks:"No tasks linked yet. Create one to get started.",goal:"Goal Loop",goalActive:"Active",goalMaxReached:"Max Reached",goalIteration:"Iteration {{current}}/{{max}}",goalLastChecked:"Last checked: {{time}}",goalAutoResume:"Auto-resume"},UT={all:"All",active:"Active",completed:"Completed",search:"Search tasks...",status:"Status",assignee:"Assignee",priority:"Priority",sortBy:"Sort by",groupBy:"Group by"},FT={pending:"Pending",inProgress:"In Progress",review:"Review",completed:"Completed",failed:"Failed",blocked:"Blocked"},qT={failed:"Failed",todo:"To Do",in_progress:"In Progress",review:"In Review",done:"Done",closed:"Closed"},GT={task:{pending:"Pending",in_progress:"In Progress",blocked:"Blocked",review:"In Review",revision:"Revision",completed:"Completed",failed:"Failed",rejected:"Rejected",cancelled:"Cancelled",archived:"Archived"},requirement:{pending:"Pending",in_progress:"Active",completed:"Done",rejected:"Rejected",cancelled:"Cancelled",archived:"Archived"},sub:{pending:"Pending",blocked:"Blocked",failed:"Failed",rejected:"Rejected"},project:{active:"Active",planning:"Planning",review:"Review",completed:"Completed",archived:"Archived",paused:"Paused"}},VT={low:"Low",medium:"Medium",high:"High",urgent:"Urgent"},KT={noProjects:"No projects yet",createFirst:"Create your first project to get started"},WT={justNow:"just now",minutesAgo:"{{count}}m ago",hoursAgo:"{{count}}h ago",daysAgo:"{{count}}d ago"},YT={filter:{todo:"To Do",in_progress:"In Progress",review:"In Review",done:"Done"},reset:"Reset",archivedToggle:"{{count}} archived",expandHint:"Click a card to expand dependencies",backToOverview:"← Back to overview",dragHint:"Drag to link · Click edge to remove",noTasks:"No tasks to display",reqLabel:"REQ",taskCount_one:"{{count}} task",taskCount_other:"{{count}} tasks",depCount_one:"{{count}} dep",depCount_other:"{{count}} deps",removeDependencyTitle:"Remove dependency?",removeDependencyBody:"{{target}} will no longer be blocked by {{source}}.",toast:{dependencyExists:"Dependency already exists",cycleError:"Cannot add: would create a cycle",dependencyAdded:"Dependency added",dependencyRemoved:"Dependency removed",failed:"Failed: {{message}}"}},XT={title:zT,project:BT,task:$T,requirement:HT,filters:UT,board:FT,boardColumn:qT,status:GT,priority:VT,empty:KT,relative:WT,dag:YT},QT="Settings",ZT={appearance:"General",providers:"Model Providers",execution:"Agent Configuration",browser:"Browser Automation",search:"Web Search",codingTools:"Coding Tools",storage:"Data & Storage",users:"User Management",remote:"Remote Access",integrations:"Integrations",license:"License",organization:"Organization",account:"Account",group:{general:"Preferences",aiConfig:"AI Configuration",tools:"Tools & Capabilities",connections:"Connections",account:"Account"}},JT={title:"General",theme:"Theme",themeDesc:"Choose a visual style for the interface",language:"Language",languageDesc:"Choose the display language",launchAtLogin:"Launch at startup",launchAtLoginDesc:"Automatically start Markus in the background when you sign in to your computer",modes:{system:"System",light:"Light",dark:"Dark",cyberpunk:"Cyberpunk",mono:"Mono"}},eA={title:"Welcome — Configure Your LLM",subtitle:"Markus needs at least one LLM provider to work. Choose a way to get started:",skip:"Skip",fromEnv:{step:"1",title:"From Environment Variables",description:"Automatically detected API keys from .env or system environment.",noKeysHint:"No API keys found. Set environment variables like <code>ANTHROPIC_API_KEY</code> or <code>OPENAI_API_KEY</code> and restart the server."},fromOllama:{step:"2",title:"Local Ollama",description:"Auto-detect a locally running Ollama service and select a model."},fromOpenClaw:{step:"3",title:"From OpenClaw Config",description:"Import model configs from an existing OpenClaw installation."},manual:{step:"4",title:"Manual Configuration",description:"Edit <code>~/.markus/markus.json</code> directly, then restart the server."},browserExtension:{step:"5",title:"Install Browser Automation Extension",description:"Let AI agents control Chrome to browse, test apps, and inspect pages — no permission dialog each time.",notChrome:"Your current browser is not Chrome. Open Markus in Chrome to install the extension.",alreadyConnected:"Extension is already connected.",downloadBtn:"Download Extension",openChromeBtn:"Open Extensions Page",loadHint:'After unzipping, go to Chrome Extensions page → enable "Developer mode" → "Load unpacked" → select the unzipped folder'},applyProviders:"Apply {{count}} Provider(s)",foundPrefix:"Found:"},tA={title:"System Status",status:"Status",healthy:"Healthy",version:"Version",activeAgents:"Active Agents"},nA={title:"Default LLM Provider",primaryProvider:"Primary Provider",primaryProviderDesc:"Used for all agent interactions unless overridden",noProviders:"No providers configured",updated:"Default provider updated to {{name}}",autoFallback:"Auto-switch Model",autoFallbackDesc:"Off by default. When on, try other providers/models if the primary fails; when off, surface the error so you can switch manually."},rA={title:"Model Routing",defaultModelTitle:"Default Model",defaultModelDesc:"Used as fallback when no specific model is assigned for a capability.",defaultModelPlaceholder:"Select a default model...",capabilityAssignTitle:"Capability Assignments",capabilityAssignDesc:"Each capability type uses the assigned model. Unassigned capabilities use the default model above.",capabilityGroups:{text:"Text",image:"Image",audio:"Audio",video:"Video",other:"Other"},capabilities:{text:"General",image_recognition:"Image Recognition",image_generation:"Image Generation",audio_tts:"Text-to-Speech",audio_stt:"Speech-to-Text",video_generation:"Video Generation"},auto:"Use default",selectModel:"Select model...",suggested:"suggested",noModelAvailable:"No capable model available",addProviderHint:"add a provider that supports this capability above",clear:"Clear",loadError:"Failed to load routing settings: {{error}}",saving:"Saving...",saved:"Saved",saveError:"Save failed",mismatchHint:"Model does not match this capability type — please select a compatible model",staleProvider:"Provider not configured — clear or reconfigure",noProvidersHint:"Configure at least one provider above to assign models to capabilities.",restoreRecommended:"Restore Markus recommendations",restoreWorking:"Restoring…",restoreConfirm:"Replace your model routing with Markus recommendations and set Markus as the default provider? Your current capability assignments will be overwritten.",loadingModels:"Loading model list…",tier:{base:"Base",pro:"Pro",max:"Max"}},aA={loading:"Loading models...",empty:"No models available for this provider.",filterPlaceholder:"Filter models...",searchPlaceholder:"Search models...",showAll:"Show all {{count}} models...",showLess:"Show less",allCount:"All ({{count}})",tierCount:"{{tier}} ({{count}})",active:"Active",perMillion:"per 1M",ctx:"ctx",costFree:"Free",capabilities:{tools:"Tools",vision:"Vision",reasoning:"Reasoning",caching:"Caching",search:"Search"}},sA={title:"Model Providers & Pricing",disabled:"disabled",notConfigured:"Click to set up",addProvider:"+ Add Provider",addNewProvider:"Add New Provider",providerName:"Provider",selectProvider:"Select a provider...",customProvider:"Custom (OpenAI-compatible)",customName:"Custom Provider Name",validatingKey:"Validating key & loading models...",selectModel:"Select Model",advancedSettings:"Advanced settings (base URL, pricing overrides...)",providerNameHint:"Use anthropic, openai, google, ollama for first-party; any other name uses OpenAI-compatible API",apiKey:"API Key",apiKeyPlaceholder:"Leave blank to keep current",baseUrl:"Base URL (optional)",baseUrlLabel:"Base URL",defaultModel:"Default Model",contextWindow:"Context Window",maxOutputTokens:"Max Output Tokens",inputCost:"$/1M Input",outputCost:"$/1M Output",editProvider:"Edit Provider",deleteConfirm:'Delete provider "{{name}}"?',providerAdded:"Provider {{name}} added",notConfiguredHint:'Not configured. Use the "Add Provider" button below, or set API keys in environment variables.',quickSetupHint:"Enter your API Key to start using this provider immediately.",markusKeyHint:"Get your Markus Cloud AI API key from",markusKeyLink:"Hub Settings",quickSetupPlaceholder:"Paste your API Key here...",quickSetupSubmit:"Activate",quickSetupSaving:"Activating...",quickSetupSuccess:"{{name}} is now ready to use!",keyReadOnly:"Key (read-only)",pricingTitle:"Pricing (per 1M tokens)",input:"Input",output:"Output",cacheRead:"Cache Read",cacheWrite:"Cache Write",availableModels:"Available Models",addModel:"+ Add Model",addModelTitle:"Add Model",browseFromCatalog:"Browse Catalog",browse:"Browse",selectFromCatalog:"Select from catalog",loadingCatalog:"Loading models from catalog...",loadingHubCatalog:"Loading models from Hub…",hubCatalogEmpty:"No models loaded. Check that Hub is running at the address in Settings → Hub, then collapse and re-expand Markus.",hubCatalogError:"Failed to load Hub catalog: {{error}}",moreCatalogModels:"{{count}} more models available from catalog...",modelsAvailable:"{{count}} models available",andMoreModels:"... and {{count}} more models",catalogModelsAvailable:"{{count}} more models supported by this provider",showAllModels:"Show all {{count}} models",filterModels:"Filter models…",noFilterMatches:"No models match this filter",collapseModels:"Collapse",modelId:"Model ID",displayName:"Display Name",reasoning:"reasoning",vision:"vision",capImageGen:"image",capTts:"tts",capStt:"stt",capVideo:"video",custom:"custom",use:"Use",switching:"Switching...",model:"Model",ctxTokens:"{{size}}K ctx",costPerMillion:"${{input}}/{{output}} per 1M",badgeDefault:"default",badgeOAuth:"OAuth",clickToDisable:"Click to disable",clickToEnable:"Click to enable",maxOutput:"Max Output",kTokens:"{{k}}K tokens",notApplicable:"N/A",baseUrlDisplayDefault:"Default",active:"active",deleteCustomModelTitle:"Delete custom model",costPair:"${{input}}/{{output}}",adding:"Adding...",costPerMillionIn:"$/1M in:",costPerMillionOut:"out:",placeholderContextTokens:"Context (tokens)",placeholderProviderName:"e.g. deepseek, openrouter, my-provider",placeholderApiKeySk:"sk-...",placeholderBaseUrl:"https://api.example.com/v1",placeholderDefaultModel:"e.g. deepseek-chat, gpt-4o",placeholderContextExample:"e.g. 128000",placeholderMaxOutputExample:"e.g. 16384",placeholderCostInput:"e.g. 1",placeholderCostOutput:"e.g. 5",addProviderSubmit:"Add Provider",saveFailed:"Save failed",failedToAdd:"Failed to add",test:"Test",testing:"Testing...",testOk:"OK ({{ms}}ms)",testFailed:"Failed",testFailedCode:"Error {{code}}",testSuccess:"Connected in {{ms}}ms — reply: {{reply}}",testDetail:{requestUrl:"Request URL",model:"Model",requestBody:"Request Body",response:"Response",duration:"Duration",tokens:"Tokens",inputTokens:"input",outputTokens:"output"},configuredCount:"configured",groupConfigured:"Configured ({{count}})",groupUnconfigured:"More Providers",markusHint:"Connect to Markus Cloud AI service",markusSetup:"Enter your Markus API key to connect. You can get one from your Markus Hub account.",markusSetupLogin:"Log in to your Markus Hub account to automatically connect to Markus Cloud AI.",markusConnected:"Connected",markusConnectedHint:"Your Markus Cloud AI connection is managed through your Hub account. Visit Settings to manage your subscription and credits.",goToAccount:"Go to Account",connect:"Connect"},iA={title:"Network Proxy",description:"Configure an HTTP proxy for ChatGPT OAuth login and Codex API calls. Other LLM providers use system/TUN proxy automatically.",active:"Active:",noProxy:"No proxy detected",sourceConfig:"markus.json",sourceEnv:"env var",sourceSystem:"macOS system",placeholder:"http://127.0.0.1:7890 (leave empty for auto-detect)",saving:"Saving...",save:"Save",saved:"Saved. Restart server to apply.",saveFailed:"Save failed",networkError:"Network error",refresh:"Re-detect",disabled:"Proxy disabled"},oA={title:"OAuth Authentication",description:"Sign in with your ChatGPT account to use Codex models via your subscription (no API key required).",signInWith:"Sign in with {{name}}",connecting:"Connecting...",device:"Device",deviceTitle:"Device Code login (for remote/headless environments)",deviceCodeTitle:"Device Code Login",deviceInstructions:"Open the verification URL and enter the code:",deviceWaiting:"Waiting for authorization... (expires in 15 min)",manualCallbackHint:"If the browser didn't open or you're on a remote machine, paste the callback URL below:",manualPlaceholder:"http://localhost:1455/auth/callback?code=...",submit:"Submit",connectedAccounts:"Connected Accounts",expired:"Token expired / invalid",reconnect:"Re-authenticate",disconnect:"Disconnect",noProviders:"No OAuth providers available",deviceCodeFailed:"Device code login failed"},lA={loginFailed:"Login failed",networkErrorDuringLogin:"Network error during OAuth login",callbackFailed:"Callback failed"},cA={title:"Auto-detect & Import",description:"Discover LLM providers from environment variables, local Ollama service, or existing configurations."},uA={title:"Local Ollama",description:"Auto-detect a locally running Ollama service and configure it as a model provider. No API key required.",detect:"Detect Ollama",detecting:"Detecting...",foundModels:"Found {{count}} model(s) at {{url}}",notRunning:"Ollama is not running locally. Start Ollama first, then click detect.",detectFailed:"Failed to detect Ollama service",useModel:"Use {{model}}",configured:"Ollama configured with model {{model}}",applyFailed:"Failed to configure Ollama",switchModel:"Switch Model"},dA={title:"Environment Variable Configuration",description:"Detect model API keys from environment variables and write them to the config file.",refreshEnv:"Refresh Environment Variables",detectedProviders:"Detected Providers — select to apply:",noKeysFound:"No model API keys found in environment variables",detectionFailed:"Detection failed",failedToDetect:"Failed to detect environment variables",applyToConfig:"Apply {{count}} Provider(s) to Config",selectAtLeastOne:"Select at least one provider to apply",applyFailed:"Apply failed (HTTP {{status}})",failedToApply:"Failed to apply environment configs",detectionFailedHttp:"Detection failed (HTTP {{status}})",keyLabel:"Key:",modelLabel:"Model:",urlLabel:"URL:",llmTimeout:"LLM Timeout: {{ms}}ms (from LLM_TIMEOUT_MS)"},mA={title:"Agent Execution",maxToolIterations:"Max Tool Iterations",maxToolIterationsDesc:"Safety cap on tool call loops per agent turn (0 = unlimited, applies to all agents and subagents)",saved:"Saved",failedToSave:"Failed to save"},fA={title:"Cognitive Preparation Pipeline",description:"Before each main LLM call, the agent runs a lightweight appraisal to assess the stimulus and prepare persona-aware context. This can improve response relevance at the cost of a small extra LLM call (~500ms).",enabled:"Enable CPP",enabledDesc:"When enabled, agents run a cognitive appraisal before responding",maxDepth:"Max Cognitive Depth",maxDepthDesc:"Controls how much preparation is done before each response",depthD1:"Appraisal only",depthD2:"Appraisal + Retrieval + Reflection",depthD3:"Full pipeline + post-evaluation",saved:"Saved",failedToSave:"Failed to save"},pA={title:"Web Search",description:"Priority: Hub connected with balance → Markus hosted first; otherwise your API keys first.",serper:"Serper (Google)",serperHint:"serper.dev",tavily:"Tavily",tavilyHint:"tavily.com",bing:"Bing Web Search",bingHint:"Azure Cognitive Services",google:"Google Custom Search",googleHint:"API key + Search Engine ID",googleCxPlaceholder:"Search Engine ID (cx)...",serpapi:"SerpAPI",serpapiHint:"serpapi.com",brave:"Brave Search",braveHint:"brave.com",exa:"Exa",exaHint:"exa.ai",bocha:"Bocha (博查)",bochaHint:"bochaai.com",configured:"Configured",notConfigured:"Not configured",apiKeyPlaceholder:"Paste API Key here...",saved:"Search API keys saved",failedToSave:"Failed to save search API keys",envDetected:"from env",markus:"Markus Hosted Search",markusBadge:"Recommended",markusHint:"No third-party key · uses your Markus Cloud balance",markusProviderLabel:"Search engine",markusProviderBocha:"Bocha (Chinese)",markusProviderTavily:"Tavily",markusUnavailable:"Sign in to Markus",markusUnavailableHint:"Connect Markus under Model Providers to enable hosted search.",modelLabel:"Retrieval model",modelHint:"Hosted search bills per call. Prefer your own API keys above when available — those skip this model. Sonar is cheaper than Sonar Pro.",modelSonar:"Perplexity Sonar (default, lower cost)",modelSonarPro:"Perplexity Sonar Pro (higher quality)",ownKeysTitle:"Your own API keys",ownKeysHint:"Optional fallback",test:"Test",testing:"Testing…",testOk:"Success — {{count}} results",testFailed:"Test failed",enabled:"Enabled",disabled:"Disabled"},hA={title:"Browser Automation",description:"Settings for the Chrome DevTools browser skill. Agents use Chrome to browse, test web apps, and inspect pages.",bringToFront:"Bring to Foreground",bringToFrontDesc:"When enabled, Chrome tabs will be brought to the foreground when agents navigate. When disabled (default), agents work silently in the background without stealing focus.",autoCloseTabs:"Auto-close Tabs",autoCloseTabsDesc:"Automatically close agent-owned browser tabs when the agent task completes or the agent is removed.",remoteDebuggingPort:"Remote Debugging Port",remoteDebuggingPortDesc:"Set a persistent debugging port (e.g. 9222) to avoid Chrome's permission dialog every time an agent connects.",remoteDebuggingPortDescLead:"Set a persistent debugging port (e.g. 9222) to avoid Chrome's permission dialog every time an agent connects. Start Chrome with",remoteDebuggingPortDescTail:"then set the same port here. Set to 0 to use auto-connect (requires manual permission approval).",tabsForeground:"Tabs will be brought to foreground",tabsBackground:"Tabs will stay in background",usingPort:"Using persistent connection on port {{port}} (no more permission dialogs)",usingAutoConnect:"Using auto-connect mode (permission dialog required on each connection)",autoClickAllowDialog:"Auto-Allow Chrome Debugging Dialog",autoClickAllowDialogDesc:'Chrome shows an "Allow remote debugging?" dialog each time Markus connects. When enabled, Markus auto-clicks "Allow" via OS accessibility APIs.',autoClickAllowDialogMacNote:"macOS: Grant Accessibility permission in System Settings > Privacy & Security > Accessibility for the app running Markus (Markus.app / Terminal / iTerm).",autoClickAllowDialogWinNote:"Windows: No additional permissions needed. Uses built-in UI Automation.",autoClickAllowDialogLinuxNote:"Linux: Not yet supported. Use Remote Debugging Port (above) as an alternative.",autoClickAllowDialogSupported:"Supported on this platform",autoClickAllowDialogUnsupported:"Not supported on this platform",autoClickTest:"Test",autoClickTesting:"Testing...",autoClickTestSuccess:"Auto-click verified! Successfully connected to Chrome and loaded a test page ({{title}}).",autoClickTestNoPermission:"Accessibility permission not granted. The system settings page has been opened — please add this app to the list.",autoClickTestChromeNotRunning:"Chrome is not running. Please start Chrome first.",autoClickTestUnsupported:"Auto-click is not supported on this platform. Use Remote Debugging Port instead.",autoClickTestError:"Test failed: {{error}}",modeExtension:"Chrome Extension (Active)",modeExtensionDesc:"Browser tools route through the extension — no debugging dialog, no extra permissions, works when screen is locked.",modeDebuggingPort:"Remote Debugging Port :{{port}} (Active)",modeDebuggingPortDesc:"Connected via persistent debugging port — no permission dialog on each connection.",modeAutoClick:"Auto-Connect + Auto-Click (Active)",modeAutoClickDesc:"Using chrome-devtools-mcp with OS auto-click to handle the debugging dialog. May not work when screen is locked.",modeManual:"Auto-Connect (Manual Approval Required)",modeManualDesc:"Chrome will show a permission dialog each time an agent connects. You must click Allow manually.",modeRecommended:"recommended",generalSettings:"General",fallbackModes:"Connection Mode (Fallback)",extensionStatus:"Chrome Extension",extensionStatusDesc:"Enables browser automation without the debugging dialog. No Accessibility permissions needed, works even when screen is locked.",extensionConnected:"Connected",extensionDisconnected:"Not Connected",extensionActiveNote:"Extension active — browser tools route through extension (no debugging dialog)",extensionSetupTitle:"Install Chrome Extension",extensionStep1:"Download & Unzip",extensionStep1Desc:"Download the zip and extract it to any location (e.g. Desktop)",extensionStep1Btn:"Download markus-browser-extension.zip",extensionStep1Downloading:"Preparing download...",extensionStep2:"Open Chrome Extensions",extensionStep2Desc:"Open the extensions management page in Chrome",extensionStep2Btn:"Open chrome://extensions",extensionStep3:"Load Extension",extensionStep3Desc:'Enable "Developer mode" (top right toggle), click "Load unpacked", and select the folder extracted in step 1',extensionDownloadError:"Failed to download extension",extensionOpenError:"Failed to open Chrome extensions page"},gA={title:"Data & Storage",scanning:"Scanning storage...",openInFinder:"Open in Finder",storageBreakdown:"Storage Breakdown",agentStorage:"Agent Storage ({{count}})",openFolder:"Open folder",orphanedDirectories:"Orphaned Directories",orphanedDesc:"These directories have no matching database record and were likely left behind when agents or teams were deleted.",orphanedTotal:"Total: {{size}} across {{count}} director(ies).",cleanSelected:"Clean Selected ({{size}})",cleanAll:"Clean All ({{size}})",cleaning:"Cleaning...",cleaned:"Cleaned {{count}} dir(s), freed {{size}}",bytesZero:"0 B",unitB:"B",unitKB:"KB",unitMB:"MB",unitGB:"GB",teamKind:"team",selectedWithSize:"{{count}} selected ({{size}})",cleanupFailed:"Cleanup failed",cleanedWithFailureNote:"{{base}} ({{count}} failed)",sortedBySize:"Sorted by size",clearableHint:"About {{size}} ({{percent}}%) is clearable debug logs and won’t affect day-to-day use.",safetyLevel:{safe:"Clearable"},items:{database:{label:"Database",blurb:"Core data for tasks, agents, and chat"},agents:{label:"Agents",blurb:"Workspaces, memory, roles, and sessions"},skills:{label:"Skills",blurb:"Installed skill packages"},llmLogs:{label:"LLM logs",blurb:"Request/response audit logs — safe to clear for space"},builderArtifacts:{label:"Creations",blurb:"Local source files for Assets → My Creations"},teams:{label:"Teams",blurb:"Team announcements and norms"},shared:{label:"Shared files",blurb:"Cross-agent shared files and deliverables"},knowledge:{label:"Knowledge",blurb:"Knowledge-base entries used for retrieval"}}},bA="Connected to {{provider}} via OAuth",xA="Auth profile deleted",yA="Browser opened for authorization. Complete the login in the browser window...",vA={title:"Remote Access",description:"Access this Markus instance from your phone or any device via WebRTC P2P connection through Markus Hub.",loginRequired:"Sign in to Markus Hub to enable remote access.",signIn:"Sign In",signedInAs:"Signed in as",enabled:"Remote access enabled",disabled:"Remote access disabled",connecting:"Connecting to signal server...",registering:"Registering with Hub...",connected:"Connected",disconnected:"Disconnected",peerCount_one:"{{count}} peer",peerCount_other:"{{count}} peers",url:"Remote URL",copy:"Copy",copied:"Copied!",qrCode:"QR Code",scanQr:"Scan with your phone camera to connect",enableFailed:"Failed to enable remote access",disableFailed:"Failed to disable remote access",connectedPeers:"Connected Peers",connectedSince:"Connected since {{time}}",peerConnecting:"Connecting"},wA={title:"Local Markus",sharedInstanceDesc:"Manage user accounts on this machine's Markus instance. All accounts share the same workspace, AI agents, and teams. For example: on a shared Linux server, multiple colleagues each log in with their own account to the same Markus.",orgHint:'If team members each use their own Markus on separate computers, go to the "Account" tab to view your organization and manage it on Hub.',orgLink:"",name:"Name",email:"Email",role:"Role",actions:"Actions",noUsers:"No users found",editUser:"Edit",deleteUser:"Delete",resetPassword:"Reset Password",save:"Save",cancel:"Cancel",confirmDelete:"Are you sure you want to remove this user? This action cannot be undone.",confirmDeleteTitle:"Remove User",newPassword:"New Password",confirmReset:"Reset",resetSuccess:"Password has been reset",addUser:"Add User",addSuccess:"User created",password:"Password",updateSuccess:"User updated",deleteSuccess:"User removed",error:"Operation failed",cannotDeleteSelf:"You cannot delete your own account",cannotDeleteOwner:"Cannot remove the primary owner",inviteLink:"Invite",inviteLinkGenerated:"Invite link generated — copy and send to the user",copyInviteLink:"Send this link to the user so they can set up their account:",linkCopied:"Link copied to clipboard",copy:"Copy",roles:{owner:"Owner",admin:"Admin",member:"Member",guest:"Guest"}},kA={title:"License",currentPlan:"Current Plan",planFree:"Community",planEnterprise:"Enterprise",instanceId:"Instance ID",username:"Username",licenseKey:"License Key",validUntil:"Valid until",statusActive:"Active",daysRemaining:"{{count}} days remaining",daysRemaining_one:"{{count}} day remaining",daysRemaining_other:"{{count}} days remaining",expired:"Expired",expiresOn:"Expires on {{date}}",expiredWarning:"License has expired. Enterprise features are no longer available.",renewalWarning:"License expires in {{count}} days",renewalWarning_one:"License expires in {{count}} day",renewalWarning_other:"License expires in {{count}} days",renewalHint:"Contact sales for a new license key and enter it below to renew.",renew:"Renew",refresh:"Refresh",trial:"Trial",offline:"Offline",details:"License Details",manage:"License Management",upgrade:"Upgrade to Enterprise",updateKey:"Replace or renew license key",activateDesc:"Have a license key? Enter it to unlock all Enterprise features.",keyPlaceholder:"Enter license key…",activate:"Activate",activated:"License activated successfully!",activationFailed:"Failed to activate license.",tryEnterprise:"Try Enterprise Free for 7 Days",trialActivated:"7-day Enterprise trial activated!",trialFailed:"Failed to start trial.",trialDesc:"Full access to all Enterprise features. No credit card required. Reverts to Community automatically.",contactSales:"Get Enterprise License",contactSalesDesc:"Copy the following info and send it to sales ({{email}}) to receive your license key.",copyInfo:"Copy",copied:"Copied",emailSales:"Email Sales",salesEmail:"business@markus.global",enterpriseFeatures:"Enterprise Features",freeFeatures:"Community Plan Includes",freeFeaturesDesc:"1,000 reward credits, all models, unlimited local usage",enterpriseFeaturesDesc:"Everything in Community, plus:",featureMultiUser:"Multi-user collaboration",featureSso:"SSO / SAML support",featureAudit:"Enhanced audit logging",featureMultiInstance:"Multi-instance management",featureOffline:"Offline license support",website:"markus.global",docs:"Documentation",learnMore:"Learn more about Enterprise",trialAlreadyUsed:"Trial has already been used for this account.",licenseNotFound:"License not found or not active.",instanceLimitReached:"Maximum number of instances reached for this license.",organization:"Organization",seats:"Seats",notOwnedHint:"This license is managed by the organization owner. License details are only visible to the license owner.",cloudAi:"Cloud AI",cloudAiDesc:"Manage your Markus Cloud AI subscription, API keys, credits usage, and billing on the Hub website.",manageSubscription:"Manage Subscription & API Keys",apiDocs:"API Documentation"},SA={title:"Account",subtitle:"Manage Cloud AI subscription, organization, and local users.",cloudAiTitle:"Cloud AI",currentPlan:"Current Plan",credits:"Credits",personalLimit:"Personal Limit",bonus:"bonus",manageBilling:"Manage Subscription",manageOrg:"Manage Organization",orgSection:"Organization",memberCount:"Members"},NA={title:"My Organization",description:"Manage your organization on Markus Hub. Organization members each install Markus on their own computer and share a single enterprise license. For example: a team of 5 people, each running an independent Markus instance on their own laptop, sharing the organization's license quota.",usersHint:'If your team runs Markus on one shared server (e.g. a single Linux server used by multiple people), go to the "Local Markus" tab to add local user accounts instead.',nameLabel:"Organization Name",nameSaved:"Name updated",orgId:"Org ID",licenseStatus:"License",seats:"Seats",members:"Members",inviteLabel:"Invite Member",invitePlaceholder:"Enter email address",invite:"Invite",invited:"Invitation sent",seatsFullHint:"Member limit reached. Upgrade your plan or contact sales for more capacity.",invalidEmail:"Please enter a valid email address",errorUserNotFound:"No user found for this email, invitation email has been sent",errorAlreadyMember:"This user is already a member or has a pending invitation",errorAlreadySent:"An invitation has already been sent to this email",errorInviteFailed:"Invite failed",invitedBy:"invited by",accept:"Accept",remove:"Remove",leave:"Leave Organization",leaveConfirmTitle:"Leave Organization",leaveConfirmMsg:`Are you sure you want to leave "{{name}}"? You will lose access to this organization's resources and will need to be re-invited to rejoin.`,leaveConfirmBtn:"Confirm Leave",leaveCancel:"Cancel",pending:"pending",noMembers:"No members",noOrg:"No organization found. Connect to Markus Hub to get started.",roleOwner:"Owner",roleAdmin:"Admin",roleMember:"Member",connectHub:"Connect to Markus Hub",reconnectHub:"Reconnect Markus Hub",staleSessionHint:"A Hub login was found locally but the organization could not be loaded. Reconnect to refresh the session.",popupBlocked:"Popup blocked by browser. Please allow popups for this site and try again.",loginCancelled:"Login cancelled.",connecting:"Connecting…",loadFailed:"Failed to load organizations. Please check your network.",noOrgAfterConnect:"Connected successfully, but no organizations found. You may need to create one on Markus Hub.",switchOrg:"Switch Organization:",roleUpdated:"Role updated",yourRole:"Your Role",changeRole:"Change Role"},CA={description:"Configure Feishu integration for notifications and approvals",connectionSettings:"Connection Settings",longConnectionMode:"Using long connection mode (WebSocket) — no public IP required",actions:"Actions",testConnection:"Test Connection",integrationState:"Integration State",enableIntegration:"Enable Feishu Integration",enableHint:"When enabled, Markus will establish a long connection to Feishu and start processing events",notificationForwarding:"Notification Forwarding",notifyChatId:"Send Notifications To",notifyChatIdHint:"Select a group chat, or use private messages (default).",forwardApprovals:"Forward Approval Requests",forwardApprovalsHint:"Send approval requests to Feishu as interactive cards",forwardNotifications:"Forward General Notifications",forwardNotificationsHint:"Send system notifications to Feishu chat",notifyPriority:"Minimum Notification Priority",priorityHint:"Only notifications with the selected priority levels will be forwarded",setupGuide:"Setup Guide",setupGuideDesc:"Follow these steps to set up the Feishu integration:",guideStep1:"Go to Feishu Open Platform (open.feishu.cn) and create an enterprise self-built app",guideStep2:"Go to App → Features → Bot, enable bot capability",guideStep3:"Go to App → Permissions, enable im:message and im:message.receive_v1",guideStep4:'Go to App → Events & Callbacks → Subscription mode, select "Use long connection"',guideStep5:'On the Events & Callbacks page, subscribe to "Receive messages v2.0" (im.message.receive_v1)',guideStep6:"Go to App → Credentials, copy App ID and App Secret into the fields above",guideStep7:'Click "Test Connection" to verify credentials, then enable the integration',guideStep8:"Add the bot to a group chat (or send a direct message to the bot)",longConnectionNote:"Long connection mode requires an enterprise self-built app. Store apps are not supported. No public IP or domain is needed.",quickSetup:"Quick Setup",oneClickTitle:"One-Click Feishu Integration",oneClickDesc:"Scan a QR code with Feishu to automatically create and configure the app. No manual setup needed.",scanToCreate:"Scan QR Code to Create App",oneClickPermissions:"The app will be created with permissions: bot messaging, message receiving, user info reading, and group chat management.",generatingQR:"Generating QR code...",scanWithFeishu:"Scan with Feishu app",scanHint:"Use your Feishu mobile app to scan and authorize. The app will be created in your organization.",qrExpire:"QR code expires in {{minutes}} minutes",registerSuccess:"App created successfully! Integration is now active.",registerFailed:"Registration failed",manualConfig:"Manual configuration (advanced)",appInfo:"App Information",removeApp:"Remove",sendTestMessage:"Send Test Message",chatIdPlaceholder:"Enter Chat ID (oc_xxxxxxxx)",send:"Send",chatIdHint:"Chat ID can be found in the Feishu group chat URL or via the API",chatIdRequired:"Please select a group chat",selectChat:"— Private message (default) —",loadingChats:"Loading groups...",refreshChats:"Refresh",noChatHint:"No groups found. Add the bot to a group chat to enable group notifications.",noChatFallbackHint:"No group selected — notifications will be sent to you as private messages.",selectTestChat:"— Select a group chat —",testMsgSent:"Test message sent",testMsgFailed:"Failed to send test message",saved:"Feishu configuration saved",fillRequired:"Please fill in App ID and App Secret first",testSuccess:"Connection successful",testFailed:"Connection failed",disconnected:"Disconnected from Feishu",disconnect:"Disconnect"},TA={title:"Coding Tools",description:"Configure external AI coding tools (Claude Code, Codex, Cursor) that agents can invoke for implementation tasks.",globalEnable:"Enable coding tools",globalEnableDesc:"Allow agents with the coding-tools skill to invoke external CLI coding assistants.",ready:"Ready",needsAuth:"Needs authentication",available:"Installed",notInstalled:"Not installed",installHint:"Install:",enabled:"Enabled",stepInstall:"Install CLI tool",stepAuth:"Authenticate",stepEnable:"Enable in Markus",authHint:"Login via browser or enter an API key to authenticate",sectionModelExec:"Model & Execution",sectionAdvanced:"Advanced",loginBtn:"Login via browser",apiKeyBtn:"Use API Key",loginWaiting:"Waiting for browser login…",authSuccess:"Authentication successful!",authFailed:"Authentication failed. Please try again.",authBrowserHint:"Browser opened. Complete login there — status will update automatically.",authPolling:"Waiting for login to complete… checking automatically every 15s",authPollTimeout:"Auto-detect timed out. Please complete login and click Re-detect.",apiKeySaved:"API key saved to {{envVar}}",useApiKeyInstead:"Use API Key instead",binaryPath:"Custom binary path",binaryPathPlaceholder:"Leave empty to use PATH",defaultArgs:"Default CLI arguments",defaultArgsPlaceholder:"e.g. --verbose",testConfig:"Test Configuration",testing:"Testing…",testConfigHint:"Sends a minimal request to verify credentials, API keys, and connectivity",timeout:"Timeout",timeoutUnit:"min",defaultModel:"Default model",defaultModelHint:"Leave empty to use tool's own default. Agent can override per invocation.",modelPlaceholder:"Select or type a model name…",noModelsFound:"Type a model name manually",modelsEmpty:"No models returned — CLI may be slow or need restart. You can type manually.",modelsFetchError:"Failed to fetch models — server may need restart after update",modelsLoading:"Fetching available models (may take a few seconds)…",modelsRetry:"Retry fetching models",useToolDefault:"Use tool default (no override)",budgetCap:"Session budget cap",budgetCapHint:"Hard limit enforced by Claude Code via --max-budget-usd",approvalRequired:"Require approval before use",approvalRequiredHint:"Agent must get user approval before each invocation of this tool",redetect:"Re-detect",detecting:"Detecting…",detectingTool:"Detecting…",saved:"Coding tools settings saved",failedToSave:"Failed to save coding tools settings",failedToLoad:"Failed to load coding tools settings",detectionRefreshed:"Tool detection refreshed",detectionFailed:"Tool detection failed",modelSourceApi:"via API",modelSourceCli:"via CLI",modelSourceStatic:"built-in",cursorApiKeyHint:"For the full model list, add a Cursor API Key from your <0>Dashboard</0>",cursorApiKeyNote:"Cursor API Key (Pro plan) — enables complete model list",cursorDashboardUrl:"https://cursor.com/dashboard/cloud-agents",recheckAuth:"Check now",testSuccess:"Configuration verified",testFailed:"Configuration test failed",testModel:"Model: {{model}}",testAuthVia:"Auth: {{source}}",testFailedHint:"Check your API key, endpoint URL, or CLI installation above",modelGuidanceCursor:"Models available in the Cursor CLI. Select 'auto' to let Cursor choose the best model automatically.",modelGuidanceClaude:"Standard models shown. Custom models can be typed manually.",modelGuidanceCodex:"Standard models shown. Custom models can be typed manually."},AA={title:QT,nav:ZT,appearance:JT,setupGuide:eA,systemStatus:tA,defaultProvider:nA,modelRouting:rA,modelPicker:aA,modelProviders:sA,networkProxy:iA,oauthAuth:oA,oauth:lA,autoDetect:cA,ollama:uA,envConfig:dA,agentExecution:mA,cognitive:fA,searchApi:pA,browserAutomation:hA,dataStorage:gA,oauthConnected:bA,authProfileDeleted:xA,browserOpened:yA,remoteAccess:vA,userManagement:wA,license:kA,account:SA,org:NA,feishu:CA,codingTools:TA},EA={title:"Welcome to Markus",subtitle:"Your AI workforce, ready in minutes",description:"Markus lets you build and run <strong>autonomous AI agent teams</strong> that collaborate, learn, and deliver results around the clock. Let's get you set up in a few quick steps."},_A={title:"Choose Your Theme",subtitle:"You can change this anytime in Settings",system:"System",systemDesc:"Follow your OS setting",light:"Light",lightDesc:"Always light background",dark:"Dark",darkDesc:"Warm charcoal, refined accents",cyberpunk:"Cyberpunk",cyberpunkDesc:"Neon pink, dark violet",mono:"Mono",monoDesc:"Pure black & white"},jA={title:"Configure LLM",subtitle:"Agents need an LLM to think and act",configured:"LLM provider configured",configuredHint:"You can manage providers anytime in Settings.",selectDefault:"Click to set the default model for agents:",default:"Default",fromEnv:"From Environment Variables",detectingKeys:"Detecting API keys...",noKeysFound:"No API keys found. Set <code>ANTHROPIC_API_KEY</code>, <code>OPENAI_API_KEY</code>, etc. in your <code>.env</code> file and restart.",applyProviders:"Apply {{count}} Provider(s)",or:"or",fromOpenClaw:"From OpenClaw",detectOpenClaw:"Detect OpenClaw Config",importModelConfigs:"Import Model Configs",noOpenClawFound:"No OpenClaw config found.",importedModels:"Imported {{count}} model configs",failedToApply:"Failed to apply",importFailed:"Import failed",skipForNow:"Skip for now",openClawFoundLabel:"Found:",openClawProviders:"({{count}} providers)",autoFallback:"Auto-switch model on failure",autoFallbackDesc:"Optional; off by default. When on, try other providers if the primary fails"},MA={title:"Web Search (Optional)",subtitle:"Give agents the ability to search the web",description:"Configure Markus hosted search or at least one search API key so agents can find real-time information.",serper:"Serper (Google)",tavily:"Tavily",bing:"Bing Web Search",google:"Google Custom Search",serpapi:"SerpAPI",brave:"Brave Search",exa:"Exa",bocha:"Bocha (博查)",apiKeyPlaceholder:"Paste API Key...",save:"Save Search Keys",saving:"Saving...",saved:"Search API keys configured",savedHint:"You can manage search API keys anytime in Settings.",failedToSave:"Failed to save",detectingKeys:"Detecting search API keys...",detected:"Detected from environment variables:",skipForNow:"Skip for now"},RA={title:"Set Up Your Profile",subtitle:"Tell us who you are",saved:"Profile saved",nameLabel:"Your Name",namePlaceholder:"Enter your name",emailLabel:"Email",emailPlaceholder:"your@email.com",newPasswordLabel:"New Password",newPasswordPlaceholder:"Set a secure password (min 6 characters)",confirmPasswordLabel:"Confirm Password",confirmPasswordPlaceholder:"Repeat your password",saveProfile:"Save Profile",errors:{nameRequired:"Please enter your name",emailRequired:"Please enter your email",emailInvalid:"Please enter a valid email address",passwordTooShort:"Password must be at least 6 characters",passwordMismatch:"Passwords do not match",saveFailed:"Failed to save profile. Please try again."}},LA={title:"You're All Set",subtitle:"Start building your AI workforce",chat:"Chat",chatDesc:"Talk to agents or use Smart Route to auto-delegate tasks",projects:"Projects",projectsDesc:"Create projects with requirements, tasks, and deliverables",builder:"Builder",builderDesc:"Hire new agents from templates or build custom roles",settings:"Settings",settingsDesc:"Manage LLM providers, integrations, and governance",telemetry:"Share anonymous usage data to help improve Markus",telemetryNote:"No code, prompts, or personal data is ever collected. You can change this in Settings at any time."},OA={title:"How will you use Markus?",subtitle:"This helps us tailor your experience.",personal:"Personal",personalDesc:"Individual use with your own AI agents.",organization:"Team & Enterprise",organizationDesc:"For teams sharing licenses and collaborating.",orgNameLabel:"Organization Name",orgNamePlaceholder:"Your team's name",defaultOrgName:"{{name}}'s Team",setOrgName:"Set Organization Name",orgNameSaved:"Saved",orgNameSaveFailed:"Could not save the organization name. Please try again.",pendingInvitations:"You have pending organization invitations",invitedBy:"Invited by: {{name}}",acceptAndJoin:"Accept & Join",accepting:"Joining...",accepted:"Joined",orCreateNew:"Or create a new organization"},DA="Get Started",IA={welcome:EA,theme:_A,llm:jA,search:MA,profile:RA,done:LA,usageType:OA,getStarted:DA},PA="Builder",zA="Hire agents, build teams, and create skills. Your Secretary handles the entire process — from sourcing to onboarding.",BA={hireAgent:"Hire an Agent",hireAgentDesc:"Hire from templates, create custom agents, or find specialists on Markus Hub",hireAgentExamples:["Hire a senior React developer","Create a custom code reviewer","Find a DevOps specialist on Hub"],hireAgentPrompt:"I need you to help me create or hire an agent: ",buildTeam:"Build a Team",buildTeamDesc:"Compose an optimal team for your project or deploy a team template",buildTeamExamples:["A web dev team with PM, devs, and QA","A data engineering squad","A content creation team"],buildTeamPrompt:"I need you to help me create or build a team for: ",createSkill:"Create a Skill",createSkillDesc:"Design new capabilities that agents can learn and use",createSkillExamples:["A Git changelog generator","A web scraping skill","A database migration tool"],createSkillPrompt:"I need you to help me create a skill: "},$A={title:"My Creations",subtitle:"Saved builder artifacts — install to deploy, or share to Markus Hub.",filterAll:"All",filterAgents:"Agents",filterTeams:"Teams",filterSkills:"Skills",loadingArtifacts:"Loading artifacts...",noArtifacts:"No artifacts found.",noArtifactsHint:"Use a builder above to create agents, teams, or skills.",openInBuilder:"Open in Builder"},HA={title:"Org Assets",noItems:"No assets found in this organization.",noOrgs:"You are not a member of any organization.",loading:"Loading...",by:"by"},UA="Unshare: remove from Markus Hub, keep local files",FA="Unshare",qA="Unshare",GA="Delete local files (does not remove the Hub listing)",VA="Delete local files",KA="Copy Hub link",WA="Confirm Delete",YA='Delete local files for "{{name}}"? This cannot be undone. The Hub listing is not removed automatically.',XA='Unshare "{{name}}" from Markus Hub? Others will no longer be able to download it. Local files are kept.',QA="Confirm Install",ZA='Install "{{name}}" into this organization? It will become available for your teams.',JA="Confirm Uninstall",eE='Uninstall "{{name}}"? Deployed instances will be removed from this organization. Local creation files are kept.',tE="Install failed: {{error}}",nE="Uninstall failed: {{error}}",rE="Share failed: {{error}}",aE="Failed to remove from Hub: {{error}}",sE={agent:"Agent",team:"Team",skill:"Skill",name:"Name",description:"Description",category:"Category",baseTemplate:"Base Template",agentRole:"Agent Role",llmProvider:"LLM Provider",llmModel:"LLM Model",requiredEnv:"Required Env",skills:"Skills",files:"Files ({{count}})",members:"Members ({{count}})"},iE={imagePrompt:"Would you like to add images before sharing? Images help attract more users on the Hub.",directly:"Share Directly",addImagesFirst:"Add Images First",toHub:"Share to Hub",sharing:"Sharing...",updating:"Updating...",updateVersion:"Update v{{version}}",viewOnHub:"View on Hub",submittedForReview:'Submitted for review. Only you can see it until a moderator approves it — others who open the link will see an "under review" page.',convertedSlug:'Package slug auto-converted from "{{previous}}" to "{{slug}}" (Chinese title kept as display name). You can rename the slug later if you want a more readable English id.',convertedAndSubmitted:'Package slug auto-converted from "{{previous}}" to "{{slug}}", then submitted for review. The Chinese title stays as the display name.',updateSubmitted:"Update submitted for review. The previously approved version stays public until the new version is approved.",underReview:"Under review",underReviewTip:"This item is waiting for moderator approval. Only you can see it for now.",rejected:"Rejected",rejectedTip:"A moderator rejected this item, so it is not publicly visible.",updateUnderReview:"Update under review",updateUnderReviewTip:"Your latest changes are awaiting approval. The previously approved version stays public."},oE={label:"Price",enableTips:"Let users send tips",reviewNote:"Public and link-only items are reviewed by a moderator before they become visible to others."},lE={title:"Choose Share Mode",titleUpdate:"Update Share Settings",free:"Free",freeDesc:"Anyone can download for free",donation:"Accept Donations",donationDesc:"Free download, users can optionally tip",paid:"Paid Download",paidDesc:"Users must pay to download",priceLabel:"Price (USD)",pricePlaceholder:"e.g. 4.99",update:"Update",share:"Share"},cE={label:"Share to the community",subtitle:"Choose who can see it and set a price. Public items are reviewed, then appear in the Markus 广场.",public:"Public",publicDesc:"Visible to everyone, appears in Hub search",org:"Organization",orgDesc:"Only visible to members of the selected organization",unlisted:"Link Only",unlistedDesc:"Not listed in search, accessible via link",orgSelect:"Select organization",orgNone:"No organizations found",shared:"Shared",sharedOrg:"Org",sharedUnlisted:"Link Only"},uE={contentModified:"Content has been modified. Consider updating the version number.",bumpVersion:"Bump Version",newVersion:"New version:"},dE={dropOrClick:"Drop images or click to upload",hint:"Screenshots, demos, or previews showing your artifact in action"},mE={backToBuilder:"Back to Builder",notFound:"Artifact not found",saving:"Saving...",saved:"Saved",saveFailed:"Save failed",edit:"Edit",overview:"Overview",untitled:"Untitled",addDescription:"Click to add a description...",typeTagAndEnter:"Type and press Enter",pasteEmojiOrUrl:"Paste emoji or image URL...",upload:"Upload"},fE={info:"Info",type:"Type",category:"Category",version:"Version",author:"Author",agentSpecs:"Agent Specs",role:"Role",provider:"Provider",model:"Model",temperature:"Temperature",composition:"Composition",totalMembers:"Total members",managers:"Managers",workers:"Workers",skillInfo:"Skill Info",alwaysOn:"Always On",skillFile:"Skill File",permissions:"Permissions",yes:"Yes",no:"No",dependencies:"Dependencies",skills:"Skills",environment:"Environment",openInFinder:"Open in Finder"},pE={title:PA,subtitle:zA,prompts:BA,myCreations:$A,orgAssets:HA,removeFromHubTooltip:UA,unshare:FA,confirmUnshare:qA,deleteLocalTooltip:GA,confirmDeleteLocal:VA,copyHubLinkTooltip:KA,confirmDelete:WA,deleteCannotUndo:YA,removeFromHub:XA,confirmInstall:QA,confirmInstallMsg:ZA,confirmUninstall:JA,confirmUninstallMsg:eE,installFailed:tE,uninstallFailed:nE,shareFailed:rE,hubDeleteFailed:aE,artifact:sE,share:iE,pricing:oE,shareMode:lE,visibility:cE,versionBump:uE,images:dE,detail:mE,sidebar:fE},hE="Community",gE={fromHub:"From Markus Hub",loading:"Loading item from Hub…",missing:"This Hub item could not be loaded. It may be private, removed, or Hub is unreachable.",install:"Install",installing:"Installing…",installed:"Installed",purchaseRequired:"Purchase required on Hub before installing",failed:"Install failed",dismiss:"Dismiss"},bE={discover:"Discover",agents:"Agents",teams:"Teams",skills:"Skills",connectors:"Connectors",installed:"Installed"},xE={title:"Markus Plaza",subtitle:"Discover agents, AI squads, skills and connectors shared by the community — an open ecosystem built by creators.",trending:"Trending",trendingSub:"Fastest-growing assets by downloads and ratings",fresh:"New arrivals",freshSub:"The latest work from creators",topCreators:"Top creators",topCreatorsSub:"Ecosystem contribution leaderboard",empty:"The ecosystem is growing",emptyHint:"Be one of the first creators — share your first asset"},yE={searchPlaceholder:"Search connectors (MCP)...",empty:"No connectors yet",emptyHint:"Connectors let agents plug into external tools and services (MCP)"},vE={title:"Agent Store",builtin:"Built-in",markusHub:"Markus Hub",searchPlaceholder:"Search agents...",loading:"Loading agents...",available:"{{count}} agent(s) available",noHub:"No agents found on Markus Hub",noHubHint:"Hub may be offline or empty. Check your network connection or hub URL configuration.",noResults:'No agents match "{{search}}"',noAgents:"No agents found",noResultsHint:"Try different search terms.",noAgentsHint:"Agents come from the built-in registry.",hireAgent:"Hire Agent",skills:"Skills",noSkills:"No required skills",roleConfig:"Role Configuration",role:"Role:",position:"Position:",starterTasks:"Starter Tasks"},wE={title:"Team Store",builtin:"Built-in",markusHub:"Markus Hub",searchPlaceholder:"Search teams...",loading:"Loading teams...",available:"{{count}} team(s) available",noHub:"No teams found on Markus Hub",noHubHint:"Hub may be offline or empty. Check your network connection or hub URL configuration.",noResults:'No teams match "{{search}}"',noTeams:"No teams available",noResultsHint:"Try different search terms.",noTeamsHint:"Go to the Builder page to create a team.",deployTeam:"Deploy Team",deploying:"Deploying...",teamComposition:"Team Composition",details:"Details",version:"Version:",author:"Author:",members:"Members:",agents:"{{count}} agents",tags:"Tags:",hasManager:"has manager"},kE={title:"Skill Store",tabs:{installed:"Installed",all:"Skills",builtin:"Built-in",skillhub:"SkillHub",skillssh:"skills.sh",markusHub:"Markus Hub"},searchInstalled:"Search installed skills...",skillCount:"{{count}} skill(s)",noInstalled:"No installed skills found.",noInstalledHint:"Browse SkillHub or skills.sh to discover and install skills.",builtinCount:"{{count}} built-in skill(s) available",refresh:"Refresh",loadingBuiltin:"Loading built-in skills...",noBuiltin:"No built-in skills found.",noBuiltinHint:"Built-in skills are provided in templates/skills/.",loadingSkillhub:"Loading SkillHub skills...",noSkillhub:"No matching skills found",skillhubTotal:"{{count}} skills total",allCategories:"All Categories",sortScore:"Comprehensive",sortDownloads:"Downloads",sortStars:"Stars",sortInstalls:"Installs",searchSkillhub:"Search SkillHub skills...",visitSite:"Visit site →",searchSkillssh:"Search skills.sh...",loadingSkillssh:"Searching skills.sh...",browseSkillssh:"Browse 84,000+ skills on skills.sh",browseSkillsshHint:"Top skills are loaded automatically. Search for specific skills above.",searchMarkusHub:"Search Markus Hub skills...",communitySkills:"Community skills from Markus Hub",loadingHub:"Loading from Hub...",noHub:"No skills found on Markus Hub",noHubHint:"Hub may be offline or empty. Check your network connection or hub URL configuration.",prevPage:"← Previous",nextPage:"Next →",pageInfo:"Page {{current}} / {{total}}",downloads:"downloads",autoDiscovered:"Auto-discovered by agents",uninstall:"Uninstall",details:"Details",category:"Category",version:"Version",integration:"Integration",instructions:"Instructions",permissions:"Permissions",tags:"Tags"},SE={install:"Install",installing:"Installing...",installed:"Installed",upgrade:"Upgrade → v{{version}}",upgrading:"Upgrading...",upgraded:"Upgraded!",failed:"Failed",purchaseRequired:"Purchase required",buy:"Buy",waitingPurchase:"Waiting for purchase...",buyOnHub:"Buy on Hub",view:"View →"},NE={title:"Installed Items",searchPlaceholder:"Search installed items...",noItems:"No installed items found.",noItemsHint:"Install agents, teams, or skills from the store.",loading:"Loading installed items...",filterAll:"All",filterAgents:"Agents",filterTeams:"Teams",filterSkills:"Skills",updateAvailable:"Update available",updateTo:"Update → v{{version}}",updating:"Updating...",updateSuccess:"Updated {{name}} to v{{version}}",updateFailed:"Failed to update {{name}}"},CE={searchPlaceholder:"Search templates...",noResults:"No templates found",install:"Install",installed:"Installed",hire:"Hire",category:"Category",allCategories:"All Categories",hubAgents:"Hub Agents",hubTeams:"Hub Teams",hubSkills:"Hub Skills",templates:"Templates",featured:"Featured",popular:"Popular",recent:"Recent"},TE={description:"Description",skills:"Skills",tools:"Tools",members:"Members",requirements:"Requirements",configuration:"Configuration"},AE={successTitle:"Installed Successfully!",successDesc:"{{name}} has been installed and is ready to use.",done:"Done",errorTitle:"Installation Failed",errorDesc:"Something went wrong. Please try again.",close:"Close",retry:"Retry",paidNote:"This is a paid item. You need to purchase it on the Hub before installing.",cancel:"Cancel",buyOnHub:"Buy on Hub",installing:"Installing...",install:"Install"},EE={title:"Hire Agent",creating:'Creating agent from "{{name}}"',agentName:"Agent Name",assignTeam:"Assign to Team (optional)",noTeam:"No team",agentConfig:"Agent Configuration",role:"Role:",position:"Position:",skills:"Skills:",none:"None",cancel:"Cancel",create:"Create Agent",creating_progress:"Creating..."},_E={title:hE,deepLink:gE,tabs:bE,discover:xE,connectorStore:yE,agentStore:vE,teamStore:wE,skillStore:kE,card:SE,installedTab:NE,marketplace:CE,detail:TE,installDialog:AE,hireModal:EE},jE={title:"Agent Profile",status:"Status",role:"Role",team:"Team",uptime:"Uptime",created:"Created",lastActive:"Last Active"},ME={overview:"Overview",mind:"Mind",activity:"Activity",memory:"Memory",tools:"Capabilities",settings:"Settings",files:"Files",skills:"Skills",heartbeat:"Heartbeat",deliverables:"Output"},RE={title:"Agent Mind",currentActivity:"Current Activity",attention:"Attention",focused:"Focused",deciding:"Deciding",reasoning:"Current reasoning",noActivity:"No current activity"},LE={title:"Activity Log",noActivity:"No activity recorded yet",timeline:"Timeline",thinking:"Thinking",toolCall:"Tool Call",message:"Message",error:"Error"},OE={title:"Memory",layers:{working:"Notebook",shortTerm:"Observations",longTerm:"Knowledge (MEMORY.md)",episodic:"Episodic Memory",semantic:"Semantic Memory"},noMemories:"No memories stored yet",clear:"Clear",clearConfirm:"Clear all memories in this layer?"},DE={title:"Tools",noTools:"No tools available",enabled:"Enabled",disabled:"Disabled"},IE={title:"Agent Settings",llmProvider:"LLM Provider",llmModel:"LLM Model",temperature:"Temperature",maxTokens:"Max Tokens",systemPrompt:"System Prompt",skills:"Skills"},PE={start:"Start",stop:"Stop",restart:"Restart",pause:"Pause",resume:"Resume",viewProfile:"View Profile",sendMessage:"Send Message"},zE={score:"Health Score",tokens:"Tokens Used",requests:"Requests",errors:"Errors",cost:"Estimated Cost"},BE={files:"Files",search:"Search",runtime:"Runtime",web:"Web",multimodal:"Multimodal",browser:"Browser",tasks:"Tasks",requirements:"Requirements",projects:"Projects",deliverables:"Output",packages:"Packages & Hub",communication:"Communication",memory:"Memory",mailbox:"Mailbox",planning:"Planning",teamManager:"Team Management",subagents:"Subagents",system:"System",llm:"LLM",other:"Other",mcp:"MCP: {{server}}"},$E=JSON.parse(`{"taskStatus":{"pending":"Pending","assigned":"Assigned","in_progress":"In Progress","completed":"Completed","failed":"Failed","cancelled":"Cancelled","review":"Review","approved":"Approved","rejected":"Rejected","draft":"Draft"},"loadingAgent":"Loading agent...","chat":"Chat","hub":"Hub","publishTitle":"Publish to Markus Hub","publishSuccess":"Published \\"{{name}}\\" to Markus Hub","publishFailed":"Failed to publish: {{error}}","badges":{"external":"External","manager":"Manager"},"never":"Never","emDash":"—","roles":{"managerDisplay":"★ Manager","workerDisplay":"◆ Worker","worker":"worker"},"overview":{"identity":"Identity","connectionStatus":"Connection Status","externalAgentDetails":"External Agent Details","syncContextTitle":"Sync Context (received every sync cycle)","gatewayEndpoints":"Gateway API Endpoints","recentTasks":"Recent Tasks","runtimeStatus":"Runtime Status","usage":"Usage","storage":"Storage","openFolder":"Open folder →","llmConfiguration":"LLM Configuration","recentHeartbeats":"Recent Heartbeats","recentA2A":"Recent A2A Communications","heartbeatRuns_one":"{{count}} run","heartbeatRuns_other":"{{count}} runs","conversations_one":"{{count}} conversation","conversations_other":"{{count}} conversations","labels":{"name":"Name","agentRole":"Agent Role","roleTemplate":"Role Template","markusAgentId":"Markus Agent ID","agentId":"Agent ID","organization":"Organization","created":"Created","connection":"Connection","platform":"Platform","activeTasks":"Active Tasks","lastSync":"Last Sync","externalAgentId":"External Agent ID","registered":"Registered","capabilities":"Capabilities","lastHeartbeat":"Last Heartbeat","status":"Status","tokensToday":"Tokens Today","totalTokens":"Total Tokens","requests":"Requests","toolCalls":"Tool Calls","promptTokens":"Prompt Tokens","completionTokens":"Completion Tokens","estCost":"Est. Cost","modelMode":"Model Mode","primaryModel":"Primary Model","fallback":"Fallback","maxTokensRequest":"Max Tokens/Request","maxTokensDay":"Max Tokens/Day","type":"Type","importance":"Importance"},"systemDefault":"System Default","custom":"Custom","systemDefaultShort":"◎ System Default","customShort":"⚙ Custom","followsSystemDefault":"follows system default ({{provider}})","systemDefaultParen":"(system default)","noneOption":"none","defaultValue":"default","unlimited":"unlimited","noneDeclared":"none declared","errorDetails":"Error Details","errorFallback":"Agent encountered an error. Check logs for more details.","recentError":"Recent Error (Recovered)","errorRecovered":"Agent has automatically recovered and is running normally.","currentlyWorking":"Currently Working","activeTasksCount_one":"{{count}} active task","activeTasksCount_other":"{{count}} active tasks","startAgent":"▶ Start","stopAgent":"⏹ Stop","openClaw":"OpenClaw"},"syncContext":{"assignedTasks":"Tasks with requirement & project traceability","inboxMessages":"Messages from teammates","teamContext":"Colleagues (id, name, role, status) + manager","projectContext":"Projects and active requirements"},"gateway":{"sync":"Exchange status, tasks, messages, team & project context","manual":"Download integration handbook (dynamic, includes colleagues & projects)","team":"Query team members, roles, and manager","projects":"List projects with governance","requirements":"Query requirements (filter by project/status)"},"filesTab":{"loading":"Loading files...","templateUpdateAvailable":"Template Update Available","filesDiffer_one":"{{count}} file differs from the {{templateId}} template:","filesDiffer_other":"{{count}} files differ from the {{templateId}} template:","syncing":"Syncing...","syncAll":"Sync All","sendToAgent":"Send to Agent","sendToAgentTitle":"Send the template changes to the agent for review via chat","agentConfigFiles":"Agent Configuration Files","templateLabel":"Template:","upToDate":" (up to date)","updatesAvailable":" (updates available)","customAgentNoTemplate":"Custom agent — no linked template","hideDiff":"Hide Diff","viewDiff":"View Diff","smartSyncTitle":"Use AI to intelligently merge template changes while preserving your customizations","merging":"Merging...","smartSync":"Smart Sync","overwriteTemplateTitle":"Overwrite with template content","syncThisFile":"Sync This File","undoMergeTitle":"Undo smart sync and restore previous content","undoMerge":"Undo Merge","unsaved":"unsaved","smartSyncResult":"Smart Sync Result","reviewAndSave":"— review and save to apply","roleMdHint":"Changes to ROLE.md will update the agent's runtime system prompt immediately.","noConfigFiles":"No configuration files found for this role","copyPath":"Copy path","pathCopied":"Copied","openInFinder":"Open in file browser","fileLabels":{"roleMd":"System Prompt / Role Definition","heartbeatMd":"Heartbeat Tasks","policiesMd":"Policies & Guardrails","contextMd":"Context & Instructions"}},"diff":{"title":"Diff: Current vs Template ({{templateId}})","showFullFile":"Show full file","showChangesOnly":"Show changes only","linesHidden":"··· {{count}} lines hidden ···","identical":"Files are identical"},"toolsTab":{"registeredCount":"{{count}} tools registered","noToolsRegistered":"No tools registered"},"skillsTab":{"alwaysOn":"always-on","builtIn":"built-in","installed":"installed","usesStats":"{{uses}} uses · {{successes}} successes","lastUsed":" · last {{date}}","loadingDetails":"Loading skill details…","toolsHeading":"Tools ({{count}})","detailsUnavailable":"Skill details not available (skill may not be registered in the store)","installedCount":"{{count}} skills installed — descriptions auto-injected into agent context","noSkills":"No skills installed","byAuthor":"by {{author}}"},"memoryTab":{"loading":"Loading memory...","loadFailed":"Failed to load memory data","recent":"Recent ({{count}})","sessions":"Sessions ({{count}})","dailyLogs":"Daily Logs","longTerm":"Long-term","recentEntries":"Recent Memory Entries","noEntries":"No memory entries","chatSessions":"Chat Sessions","noSessions":"No sessions","msgs":"msgs","loadingMessages":"Loading messages...","noMessagesInSession":"No messages in this session","longTermTitle":"Long-term Memory","noDailyLogs":"No daily logs","noLongTerm":"No long-term memory stored","roles":{"user":"user","system":"system","assistant":"assistant"},"userEditedSource":"User-edited"},"heartbeatTab":{"loading":"Loading heartbeat data...","noData":"No heartbeat data available","scheduler":"Rhythm & Schedule","triggering":"Triggering...","triggerNow":"Trigger Now","interval":"Interval","safetyNetInterval":"Safety-net interval","intervalMinutes_one":"{{count}} min","intervalMinutes_other":"{{count}} min","intervalHours_one":"{{count}} hour","intervalHours_other":"{{count}} hours","intervalCustom":"Custom…","intervalCustomUnit":"minutes","intervalSave":"Save","intervalSaving":"Saving…","intervalRangeHint":"Allowed range: 5 min – 24 h.","lastRun":"Last Run","nextRun":"Next Run","nextWake":"Next Wake","rhythmHint":"The agent schedules precise follow-ups with wakeups; the safety-net interval is only a coarse fallback patrol.","running":"Running","stopped":"Stopped","pending":"Pending","wakeupsTitle":"Scheduled Wakeups","wakeupsCount_one":"{{count}} wakeup","wakeupsCount_other":"{{count}} wakeups","wakeupNoNote":"(no note)","recurring":"recurring","deliveryInSession":"in-session","deliveryMailbox":"mailbox","cancelWakeup":"Cancel","pendingOpsTitle":"Pending Async Operations","pendingOpsCount_one":"{{count}} in flight","pendingOpsCount_other":"{{count}} in flight","timesOut":"times out","callbackType":{"background_exec":"Background process","a2a_reply":"Awaiting agent reply","wakeup":"Wakeup"},"lastSummary":"Last Heartbeat Summary","recentRuns":"Recent Runs","runsThisSession_one":"{{count}} run this session","runsThisSession_other":"{{count}} runs this session","actionsCount_one":"{{count}} action","actionsCount_other":"{{count}} actions","noRunsYet":"No heartbeat runs yet this session.","firstHeartbeatSoon":"First heartbeat will trigger in ~{{when}}.","schedulerStopped":"Heartbeat scheduler is stopped.","runFirstNow":"Run First Heartbeat Now","soon":"soon"},"relative":{"inSeconds":"in {{count}}s","inMinutes":"in {{count}}m","inHours":"in {{hours}}h","secondsAgo":"{{count}}s ago","minutesAgo":"{{count}}m ago","hoursAgo":"{{hours}}h ago"},"taskLog":{"loading":"Loading...","noLogs":"No execution logs yet."},"activityLog":{"loading":"Loading...","noLogs":"No activity logs available."},"mind":{"loading":"Loading agent mind state...","idleWaiting":"Idle — waiting for new mail","queuedButIdle":"Queue has {{count}} item(s) — attention loop should pick them up…","decidingWaiting":"Deciding which item to process ({{count}} queued)…","deliberationInProgress":"Deliberation in progress","since":"since {{time}}","refresh":"↻ Refresh","pauseBtn":"Pause","continueBtn":"Continue","cancelCurrentBtn":"Cancel","cancelConfirmTitle":"Cancel Processing","cancelConfirmMessage":"Are you sure you want to cancel this task? The agent will stop processing immediately.","queue":"Queue ({{count}})","expandQueue":"Show {{count}} more…","collapseQueue":"Collapse","staleProcessingWarning":"Stale processing items detected (agent is idle)","agentDetails":"Agent Details","triageDecision":"Triage Decision","processingItem":"Processing: {{id}}…","deferred":"Deferred: {{count}}","dropped":"Dropped: {{count}}","inlineCompleted":"Inline Completed: {{count}}","mailboxHistory":"Mailbox History","noHistory":"No mailbox history yet","loadEarlier":"Load Earlier...","decisions":"Decisions","activityHeading":"Activity — {{label}}","success":"✓ Success","failed":"✗ Failed","processing":"Processing...","noActivityLog":"No activity log recorded","from":"From:","tokensCount":"{{count}} tokens","toolsCount":"{{count}} tools","categoryFilters":{"all":"All","interaction":"Interaction","task":"Task","notification":"Notification","system":"System"},"statusFilters":{"all":"All","queued":"Queued","processing":"Processing","completed":"Completed","merged":"Merged","deferred":"Deferred","dropped":"Dropped"},"activityFilters":{"all":"All","task":"Task","chat":"Chat","heartbeat":"Heartbeat","a2a":"A2A","internal":"Internal","respond_in_session":"Session"},"priority":{"0":"Critical","1":"High","2":"Normal","3":"Low","4":"Background"},"attention":{"idle":"IDLE","focused":"FOCUSED","deciding":"DECIDING"},"mailbox":{"commentFrom":"Comment from {{name}}","commentFromAuthor":"{{author}}: {{text}}","humanChat":"Human Chat","chatFrom":"Chat from {{sender}}","agentMessage":"Agent Message","messageFrom":"Message from {{sender}}","mentionedBy":"Mentioned by {{name}}","mention":"Mention","reviewRequestFrom":"Review request from {{sender}}","reviewRequest":"Review Request","replyInSession":"Reply in session ({{sender}})","sessionReply":"Session Reply","scheduledHeartbeat":"Scheduled heartbeat check-in","dailyReport":"Daily Report","memoryConsolidation":"Memory Consolidation","systemAnnouncement":"System Announcement","systemEvent":"System Event","statusArrow":"{{from}} → {{to}}"}}}`),HE={empty:"No deliverables yet",emptyHint:"Deliverables created by this agent will appear here",count:"{{count}} deliverable(s)",summary:"Summary",reference:"Reference",format:"Format",created:"Created",updated:"Updated",accessed:"Accessed {{count}} time(s)",openInPage:"Open in Output"},UE={profile:jE,tabs:ME,mind:RE,activity:LE,memory:OE,tools:DE,settings:IE,actions:PE,health:zE,toolCategories:BE,profilePage:$E,deliverables:HE},FE="Output",qE="+ Create",GE="Search deliverables...",VE={allTypes:"All types",allProjects:"All projects",active:"Active",verified:"Verified",outdated:"Outdated",group:"Group:",clearAll:"Clear all",filtersLabel:"Filters",refreshing:"Refreshing..."},KE={date:"Date",project:"Project",team:"Team",agent:"Agent"},WE="▶ Expand",YE="▼ Collapse",XE="Expand all",QE="Collapse all",ZE="Flagged as outdated",JE="Removed",e9={agent:"Agent",team:"Team",skill:"Skill"},t9={title:"No deliverables yet",subtitle:"Deliverables are automatically created when agents complete tasks",goToWork:"Go to Tasks",noResults:"No matching deliverables",noResultsHint:"Try adjusting your search or filters"},n9={selectToView:"Select a deliverable to view details",keyboardHint:"Use ↑↓ arrow keys to navigate, ⌘F to search",details:"Details",verify:"Verify",flagOutdated:"Flag Outdated",flagging:"Flagging...",openInBuilder:"Open in Builder",builderWithType:"Builder {{type}}",noContent:"No content",cannotPreview:"This {{type}} cannot be previewed in the browser.",loadingPreview:"Loading preview...",artifactDirectory:"Artifact Directory",copyFailed:"Copy failed — try long-pressing to copy manually",failedToOpen:"Failed to open",failedToOpenBrowser:"Failed to open file browser",openInFileBrowser:"Open in file browser",revealInFinder:"Reveal in Finder",copyPath:"Copy path to clipboard",fileMissing:"Referenced file no longer exists on disk",confirmRemoveTitle:"Remove deliverable",confirmRemoveMessage:'"{{name}}" will be removed. This action cannot be undone.',openUrl:"Open in New Tab",edit:"Edit",preview:"Preview",save:"Save",saving:"Saving...",saved:"Saved",saveFailed:"Save failed",unsavedTitle:"Unsaved Changes",unsavedMessage:"You have unsaved changes. Do you want to save before leaving?",discard:"Discard",saveAndLeave:"Save"},r9={title:"Diff Stats",files:"{{count}} files"},a9={title:"Tests",passed:"{{count}} passed",failed:"{{count}} failed",skipped:"{{count}} skipped"},s9={title:"Links",task:"Task: {{id}}",agent:"Agent: {{name}}",project:"Project: {{name}}"},i9={created:"Created:",updated:"Updated:",accessed:"Accessed:",id:"ID: {{id}}"},o9="No Project",l9="No Team",c9={title:"Create Deliverable",type:"Type",titleField:"Title",titleRequired:"Title is required",titlePlaceholder:"Clear, searchable title",reference:"Reference",referenceHint:"file path, URL, branch name",referencePlaceholder:"/path/to/file or https://...",summary:"Summary",summaryHint:"Markdown",summaryPlaceholder:"Describe the deliverable...",tags:"Tags",tagsHint:"comma separated",tagsPlaceholder:"react, api, docs",project:"Project",created:"Deliverable created",required:"*"},u9={partial:"{{loaded}} / {{total}} deliverables",total:"{{total}} deliverables"},d9={collapse:"Collapse sidebar",expand:"Expand sidebar"},m9={openChat:"Chat with agent",closeChat:"Close chat",placeholder:"Message agent...",currentDeliverable:"Current deliverable",selectedFrom:"Selected from"},f9={addToConversation:"Add to conversation"},p9={title:"Share to Markus Hub",needHubLogin:"You need to sign in to your Markus Hub account to share this deliverable.",loggingIn:"Opening sign-in…",loginHub:"Sign in to Markus Hub",loginHint:"Unlock one-click public / link sharing for your deliverables.",visibility:"Visibility",public:"Public (visible to everyone + search engines)",publicHint:"Public deliverables are published after Hub review; then visible to all and indexed",publicVisibility:"Public",link:"Anyone with the link",linkHint:"Only people with the link can view; not indexed; also requires Hub review",linkVisibility:"Link-only",titleField:"Title",titlePlaceholder:"A clear, searchable title",summary:"Summary",summaryPlaceholder:"Briefly describe this deliverable…",tags:"Tags",tagsPlaceholder:"Type a tag and press Enter",shareToHub:"Share to Hub",sharing:"Sharing…",published:"Published",pendingReview:"Under review",pendingHint:"Your deliverable has been submitted for review. A shareable link will be generated once approved.",rejected:"Rejected",revoked:"Sharing removed; this deliverable is no longer publicly accessible.",resubmit:"Resubmit",shareAgain:"Share again",revoke:"Remove sharing",urlPending:"Generating link… refresh shortly to view"},h9={justNow:"just now",minutesAgo:"{{count}}m ago",hoursAgo:"{{count}}h ago",yesterday:"yesterday",daysAgo:"{{count}}d ago",monthsAgo:"{{count}}mo ago",yearsAgo:"{{count}}y ago"},g9={title:FE,create:qE,searchPlaceholder:GE,filters:VE,groupBy:KE,expandAll:WE,collapseAll:YE,expandAllTooltip:XE,collapseAllTooltip:QE,flaggedOutdated:ZE,removed:JE,artifactTypes:e9,empty:t9,detail:n9,diffStats:r9,testResults:a9,links:s9,metadata:i9,noProject:o9,noTeam:l9,createModal:c9,count:u9,sidebar:d9,chat:m9,contextMenu:f9,share:p9,time:h9},b9="Reports",x9={dashboard:"Dashboard",history:"History"},y9={tasksCompleted:"Tasks Completed",ofTotal:"of {{total}} total",activeContributors:"Active Contributors",agentsAndHumans:"{{agents}} agents · {{humans}} humans",cuConsumed:"CU Consumed",tokensConsumed:"Tokens Used",todayAmount:"Today: {{amount}}",successRate:"Success Rate",healthScore:"Health: {{score}}/100"},v9={title:"Cloud AI",personalLimitLabel:"Personal Limit",personalLimit:"Your organization admin has set a personal credit limit for you.",notConnected:"Not connected to Markus Hub",connect:"Connect",bonus:"Bonus: {{amount}}",resetsAt:"Resets {{date}}",topUp:"Top Up",windowQuota:"5h window: {{amount}} CU (upgradable)",windowUsageLabel:"5h window usage",windowQuotaNone:"5h window: not enforced",rateLimit:"No Markus request-frequency cap; upstream model providers may still rate-limit"},w9={title:"Agent Rankings",noData:"No agent data yet. Start agents to see their activity here.",name:"Agent",team:"Team",tasks:"Tasks",cuUsed:"CU Used",tokens:"Tokens",efficiency:"Efficiency",total:"Total ({{count}} agents)",mixedProviders:"Mixed providers — CU only tracks Cloud AI",showAll:"Show all {{count}}",showLess:"Show less"},k9={title:"Team Members",name:"Name",role:"Role",team:"Team"},S9={title:"Team Performance",members:"{{agents}}A · {{humans}}H",tasks:"Tasks",cuUsed:"CU",tokens:"Tokens",managedBy:"Managed by {{name}}"},N9={title:"Usage Trends",byDay:"By Day",byHour:"By Hour",days:"days",totalCredits:"Credits Used",totalTokens:"Tokens Used",totalRequests:"Requests",creditsChart:"Credits",tokensChart:"Tokens",max:"Max",noData:"No usage data yet. Connect to Markus Hub to see trends.",models:"Models"},C9={planPending:"Plan pending",planStatus:"Plan {{status}}",taskMetrics:"Task Metrics",metric:{completed:"Completed",inProgress:"In Progress",created:"Created",blocked:"Blocked",failed:"Failed"},costOverview:"Cost Overview",totalTokens:"Total Tokens",cuUsed:"CU Used",trend:"Trend",taskSummary:"Task Summary",completedCount:"Completed ({{count}})",inProgressCount:"In Progress ({{count}})",blockedCount:"Blocked ({{count}})",noTasks:"No tasks in this period.",highlights:"Highlights",blockers:"Blockers",upcomingPlan:"Upcoming Plan",approvePlan:"Approve Plan",rejectPlan:"Reject Plan",rejectionReason:"Rejection reason:",planApproved:"Plan approved",planRejected:"Plan rejected",noDetailedMetrics:"This report does not contain detailed metrics data.",feedbackTitle:"Feedback ({{count}})",feedbackPlaceholder:"Add feedback or instructions…",feedbackAdded:"Feedback added"},T9="No reports generated yet.",A9="{{type}} Report",E9="← Back to list",_9={title:b9,tabs:x9,kpi:y9,quota:v9,agents:w9,humans:k9,teamPerf:S9,trends:N9,history:C9,noReportsYet:T9,reportType:A9,backToList:E9},j9={alex:{name:"Alex Chen"},sarah:{name:"Sarah Liu"},james:{name:"James Wang"},emily:{name:"Emily Zhang"},michael:{name:"Michael Li"}},M9={secretary:{name:"Secretary",role:"Executive Coordinator",activity:"Orchestrating daily operations"},chiefOfStaff:{name:"Chief of Staff",role:"Cross-team Coordinator",activity:"Cross-team coordination"},strategyAnalyst:{name:"Strategy Analyst",role:"Competitive Intelligence",activity:"Competitive intelligence"},engLead:{name:"Engineering Lead",role:"Engineering Manager",activity:"Sprint planning & code review"},srBackend:{name:"Senior Backend Dev",role:"Backend Engineer",activity:"Building payment API"},backend:{name:"Backend Developer",role:"Backend Engineer",activity:"Database migration"},srFrontend:{name:"Senior Frontend Dev",role:"Frontend Engineer",activity:"Dashboard redesign"},frontend:{name:"Frontend Developer",role:"Frontend Engineer",activity:"Component library"},mobile:{name:"Mobile Developer",role:"Mobile Engineer",activity:"Waiting for API"},devops:{name:"DevOps Engineer",role:"Infrastructure Engineer",activity:"CI/CD pipeline"},qaLead:{name:"QA Lead",role:"Quality Assurance Manager",activity:"Test automation"},qaEng:{name:"QA Engineer",role:"Quality Assurance",activity:"Regression testing"},security:{name:"Security Auditor",role:"Security Engineer",activity:"Weekly scan scheduled"},pm:{name:"Product Manager",role:"Product Management",activity:"Sprint planning"},uxResearcher:{name:"UX Researcher",role:"User Experience",activity:"Interview synthesis"},uiDesigner:{name:"UI Designer",role:"Visual Design",activity:"Design system update"},dataAnalyst:{name:"Data Analyst",role:"Business Intelligence",activity:"Funnel analysis"},researchLead:{name:"Research Lead",role:"Research Director",activity:"Competitive landscape"},mlEngineer:{name:"ML Engineer",role:"Machine Learning",activity:"Model fine-tuning"},researchAnalyst:{name:"Research Analyst",role:"Research & Analysis",activity:"Patent analysis"},techWriter:{name:"Technical Writer",role:"Documentation",activity:"API documentation"},contentLead:{name:"Content Lead",role:"Content Strategy",activity:"Editorial calendar"},seo:{name:"SEO Specialist",role:"Search Optimization",activity:"Keyword research done"},socialMedia:{name:"Social Media Manager",role:"Social & Growth",activity:"Campaign scheduling"},copywriter:{name:"Copywriter",role:"Content Creation",activity:"Landing page copy"},hr:{name:"HR Coordinator",role:"Human Resources",activity:"Onboarding docs ready"},legal:{name:"Legal & Compliance",role:"Legal Affairs",activity:"Privacy review done"},finance:{name:"Finance Analyst",role:"Financial Analysis",activity:"Monthly report"}},R9={engineering:{name:"Core Engineering",desc:"Backend, frontend, mobile, DevOps, QA, and security"},productDesign:{name:"Product & Design",desc:"Product management, UX research, UI design, and data analysis"},research:{name:"Research & AI",desc:"Research, ML engineering, and technical documentation"},content:{name:"Content & Growth",desc:"Content strategy, SEO, social media, and copywriting"},operations:{name:"Operations",desc:"HR, legal, compliance, and finance"},projectAlpha:{name:"Project Alpha",desc:"Cross-functional sprint team for payment platform launch"}},L9={payment:{name:"Payment Platform v2",desc:"Complete payment infrastructure with Stripe, PayPal, and crypto support"},dashboard:{name:"Dashboard Redesign",desc:"Modern analytics dashboard with real-time data visualization"},research:{name:"Q2 Market Research",desc:"Competitive landscape analysis and market positioning"},mobile:{name:"Mobile App MVP",desc:"Cross-platform mobile application with core features"},securityAudit:{name:"Security Audit Q1",desc:"Comprehensive security audit and vulnerability assessment"}},O9={paymentWebhook:"Implement Stripe & PayPal webhook endpoints",dbSchema:"Design payment transaction database schema",userResearch:"Synthesize 24 user interviews into insight report",competitorReport:"Q2 competitive landscape analysis across 12 players",cicdSetup:"Set up 6-stage CI/CD pipeline with canary deploys",designTokens:"Export design system tokens: 42 colors, 8 spacing scales",authFlow:"Implement OAuth 2.0 + API key authentication flow",loadTesting:"Build load testing harness for 10K concurrent users",seoMatrix:"Research 1,200+ keywords across 8 product verticals",privacyDraft:"Draft GDPR-compliant privacy policy for EU launch",q1Finance:"Compile Q1 financial summary with departmental P&L",testFramework:"Build end-to-end test framework with Playwright",paymentReconciliation:"Build payment reconciliation API with idempotency",dashboardCharts:"Implement interactive chart components with D3.js",mobileOnboarding:"Design & build 5-step mobile onboarding experience",mlPipeline:"Set up fraud detection model training pipeline",rateLimiting:"Implement API rate limiting at 1,000 req/min",editorialCalendar:"Plan Q3 editorial calendar across 4 content channels",funnelAnalysis:"Analyze user funnel: signup → activation → retention",componentDocs:"Write documentation for 47 React UI components",regressionSuite:"Expand regression suite to 312 test cases",socialCampaign:"Create 60+ assets for product launch campaign",idempotency:"Add idempotency key validation to all write endpoints",landingMockup:"Redesign landing page with 8 high-fidelity screens",patentReport:"Analyze 847 patents in AI workflow automation space",apiDocsV2:"Write developer portal docs for 86 API endpoints",monthlyFinance:"Prepare May monthly financial close report",securityScan:"Automate weekly OWASP Top 10 security scans",disputeHandling:"Build payment dispute workflow with Stripe API",darkMode:"Implement dashboard dark mode with theme switching",pushNotifications:"Build push notification service with FCM/APNs",abTesting:"Set up A/B testing framework with feature flags",blogAiWorkforce:"Write blog post: 'The AI-Native Workforce Revolution'",offlineMode:"Implement offline-first data sync for mobile app",perfBenchmarks:"Run performance benchmarks: API p99, FCP, TTI",emailOnboarding:"Design 5-email onboarding sequence with analytics",mobilePayment:"Integrate Stripe SDK into React Native payment flow",deepLinking:"Implement universal links & deep linking for iOS/Android",legacyMigration:"Legacy data migration script",legacyMigrationError:"Schema mismatch — legacy field types incompatible"},D9={paymentWebhook:"Handle incoming Stripe/PayPal webhook events. Validate signatures, parse event payloads, update transaction status in DB, and trigger downstream reconciliation workflows.",dbSchema:"Design normalized schema for transactions, settlements, and disputes. Support multi-currency, partial refunds, and audit trail with created_at/updated_at timestamps.",userResearch:"Synthesize findings from 24 user interviews across 4 personas. Produce affinity diagrams, key insight cards, and prioritized recommendation matrix.",competitorReport:"Deep-dive analysis of 12 competitors across 5 market segments. Feature comparison matrix, pricing analysis, and strategic recommendations.",cicdSetup:"Configure GitHub Actions pipeline: lint → test → build → canary (5%) → production. Include Cosign image signing and SBOM generation.",designTokens:"Export Figma design tokens to CSS custom properties and Tailwind config. Cover colors, spacing, typography, shadows, and border-radius scales.",authFlow:"Implement OAuth 2.0 authorization code flow with PKCE, API key authentication, and JWT token rotation with configurable TTL.",loadTesting:"Build k6 load testing harness simulating 10K concurrent users across payment, dashboard, and auth endpoints. Output Grafana-compatible metrics.",seoMatrix:"Research 1,200+ keywords across 8 verticals. Score by search volume, difficulty, and intent. Map to content calendar with projected traffic impact.",privacyDraft:"Draft privacy policy covering data collection, processing, retention, and deletion. Align with GDPR Articles 13-14 and CCPA requirements.",q1Finance:"Compile Q1 financial summary: revenue $6.8M, gross margin 76%, departmental P&L breakdown, and cash flow forecast through Q3.",testFramework:"Build end-to-end test framework with Playwright. Cover API, UI, and visual regression. Parallel execution across 4 workers with Slack reporting.",paymentReconciliation:"Build reconciliation engine matching incoming transactions to expected payments. Handle partial matches, timing discrepancies, and currency conversion.",dashboardCharts:"Implement 6 chart types (line, bar, pie, area, scatter, heatmap) using D3.js. Support responsive sizing, tooltips, drill-down, and data export.",mobileOnboarding:"Design and implement 5-step onboarding: welcome → profile → permissions → tutorial → dashboard. Track completion rate per step.",mlPipeline:"Set up MLflow pipeline for fraud detection: data ingestion → feature engineering → model training → evaluation → A/B deployment manifest.",rateLimiting:"Implement sliding-window rate limiting with Redis. 1,000 req/min per API key, burst allowance 2,000, with graceful 429 responses.",editorialCalendar:"Plan Q3 content across blog, social, newsletter, and docs. Map to product launches, seasonal trends, and SEO opportunities.",funnelAnalysis:"Analyze conversion funnel from signup to paid: identify top 3 drop-off points, segment by source/device, recommend optimizations.",componentDocs:"Generate interactive documentation for 47 React components using Storybook. Include prop tables, accessibility audit, and bundle size impact.",regressionSuite:"Expand regression suite to 312 test cases across 8 modules. Fix 5 flaky tests, add retry logic, achieve 98.4% pass rate.",socialCampaign:"Create 60+ assets for product launch: carousels, video storyboards, A/B headlines. Size for LinkedIn, Twitter/X, and Instagram.",idempotency:"Add idempotency key validation to all write endpoints. Store keys in Redis with 24h TTL, return cached response on duplicate requests.",landingMockup:"Redesign landing page: hero section, feature showcase, social proof, pricing. 8 high-fidelity screens with mobile-responsive variants.",patentReport:"Analyze 847 patents across AI workflow automation. Map claims to our features, identify FTO risks, and whitespace for IP filing.",apiDocsV2:"Write developer docs for 86 endpoints with code examples in Python, Node, Go, Ruby, and cURL. Include auth guide and webhook setup.",monthlyFinance:"Prepare May close: revenue $2.4M (+18% MoM), SaaS ARR $24M milestone, CAC payback 11 months, gross margin 78%.",securityScan:"Automate OWASP Top 10 scanning via ZAP + Semgrep in CI. Generate weekly security dashboard with remediation priority queue.",disputeHandling:"Build dispute lifecycle: open → evidence → arbitration → resolved. Integrate Stripe Disputes API and auto-generate response templates.",darkMode:"Implement system-aware dark mode with CSS custom properties. Support manual toggle with localStorage persistence.",pushNotifications:"Build push service with FCM (Android) and APNs (iOS). Topic-based subscriptions, rich notifications, and delivery analytics.",abTesting:"Set up A/B testing with LaunchDarkly feature flags. Server-side bucketing, conversion tracking, and statistical significance calculator.",blogAiWorkforce:"Write 2,500-word blog post on the AI-native workforce paradigm. Cover autonomous agents, self-organizing teams, and real-world ROI.",offlineMode:"Implement offline-first architecture using IndexedDB + background sync. Queue mutations locally, resolve conflicts on reconnect.",perfBenchmarks:"Benchmark API p99 latency (target: <200ms), FCP (<1.5s), TTI (<3s). Compare against baseline and generate regression alerts.",emailOnboarding:"Design 5-email drip sequence: welcome → key features → tips → case study → upsell. Track open rate, CTR, and conversion.",mobilePayment:"Integrate Stripe React Native SDK. Support Apple Pay, Google Pay, card entry, and 3D Secure. Handle edge cases for poor connectivity.",deepLinking:"Configure universal links (iOS) and app links (Android). Route deep links to specific screens with fallback to web."},I9={stripePaypal:"Payment Platform v2 must support Stripe, PayPal, and crypto",dashboardPerf:"Dashboard must load in under 2s on 3G",openApiDocs:"All API endpoints must have OpenAPI docs",offlineCore:"Mobile app must work offline for core features",gdpr:"GDPR compliance for all user data",monthlyReport:"Monthly executive report by the 5th",competitiveQuarterly:"Competitive analysis updated quarterly",paymentSla:"99.9% uptime SLA for payments"},P9={stripePaypal:"Integrate Stripe and PayPal payment gateways with full lifecycle support: authorization, capture, refunds, disputes, and webhook-driven status updates. Crypto via Coinbase Commerce as phase 2.",dashboardPerf:"All dashboard views must achieve First Contentful Paint <1.5s and Time to Interactive <2s on simulated 3G. Implement code splitting, lazy loading, and edge caching.",openApiDocs:"Every public and internal API endpoint must have a complete OpenAPI 3.1 spec with request/response schemas, auth requirements, rate limits, and code examples in 5 languages.",offlineCore:"Core features (task viewing, message drafting, deliverable browsing) must work offline using IndexedDB. Queue writes locally and sync on reconnect with conflict resolution.",gdpr:"All user data processing must comply with GDPR Articles 5-9. Implement data subject access requests, right to erasure, data portability, and consent management.",monthlyReport:"Automated monthly executive report covering revenue, agent efficiency, task metrics, and system health. Delivered to all founders by the 5th of each month.",competitiveQuarterly:"Comprehensive competitive analysis covering market positioning, feature parity, pricing strategy, and emerging threats. Updated every quarter with actionable recommendations.",paymentSla:"Payment processing endpoints must maintain 99.9% uptime SLA. Implement multi-region failover, circuit breakers, and automated incident response."},z9={paymentApiSpec:"Payment API v2 — OpenAPI Spec",dashboardMockups:"Dashboard Redesign Mockups",q2Report:"Q2 Competitive Landscape Report",cicdConfig:"CI/CD Pipeline Configuration",componentDocs:"Component Library Documentation",securityReport:"Security Audit Report Q1",mlResults:"ML Model Training Results",seoMatrix:"SEO Keyword Research Matrix",financeReport:"Monthly Financial Report — May",apiDocsV2:"API Documentation v2",interviewNotes:"User Research Interview Notes",wireframes:"Mobile App Wireframes",patentAnalysis:"Patent Landscape Analysis",testFramework:"Test Automation Framework",socialAssets:"Social Media Campaign Assets"},B9={paymentApiSpec:`### Payment Reconciliation API v2
19
+ `,done:"Done"},deleteTeam:{confirmTitle:'Delete "{{name}}"?',message:"This team will be removed from the database. Check options below to also delete members and disk files.",deleteMembers:"Also delete all members in this team",purgeFiles:"Also delete disk files (workspace, memory, logs)"},removeFromTeam:{title:"Move out of team?",message:"This member will be moved to Ungrouped."},removeAgent:{confirmTitle:'Remove "{{name}}"?',message:"This agent will be removed from the database. Check the option below to also delete its workspace, memory, and other files from disk.",purgeFiles:"Also delete disk files (workspace, memory, logs)"},removeHuman:{message:"This user will lose access.",confirmTitle:'Remove "{{name}}"?'},pauseAll:{title:"Pause All Agents",message:"All agents will be paused. Events will still enter the mailbox but will not be processed. In-progress tasks will be blocked."},resumeAll:{title:"Resume All Agents",message:"All agents will resume processing events from their mailbox."},createGroupChat:{title:"Create Group Chat",subtitle:"Add agents and humans to chat together",groupNamePlaceholder:"Group name...",searchPlaceholder:"Search members...",noMembersFound:"No members found",selected:"{{count}} selected",creating:"Creating...",create:"Create"},deleteGroupChat:{title:"Delete group chat?",message:'Delete "{{name}}" and all its messages?',confirm:"Delete",menuLabel:"Delete Group"}},jT={bellTitle:"Notifications",approvals:"Approvals",notifications:"Notifications",noApprovals:"No approval requests",noNotifications:"No notifications",markAllRead:"Mark all read",confirmReject:"Confirm Reject",rejectReasonPlaceholder:"Reason for rejection (optional, Enter to submit)",freeformPlaceholder:"Or type your opinion...",commentPlaceholder:"Add comment (optional)",needsAdjustment:"Needs Adjustment",adjustmentPlaceholder:"Describe the adjustments needed...",confirmAdjustment:"Submit Adjustment",actionHints:{openChat:"Open chat →",viewDetails:"View details →",viewTask:"View task →",viewRequirement:"View requirement →",viewAgent:"View agent →",viewApproval:"View approval →"},approvalType:{task:"Task",requirement:"Requirement",requirementResubmit:"Requirement (resubmitted)",taskReview:"Task Review",toolExecution:"Tool Execution"},approvalHistory:"History"},MT={respond:"Respond",submit:"Submit",submitted:"Submitted",next:"Next",previous:"Previous",questionProgress:"Question {{current}} of {{total}}",textPlaceholder:"Type your answer…",freeformPlaceholder:"Or write your own answer…"},RT={secretary:"I just set up Markus. Help me get started — what can I do here?",agent:"Introduce yourself — what can you do?"},LT={succeeded:"{{count}} agent(s) {{action}}",failed:"{{action}}: {{ok}} succeeded, {{fail}} failed",moveFailed:"Move failed: {{error}}",failedToRun:"Failed to {{action}}: {{error}}",past:{start:"started",stop:"stopped",pause:"paused",resume:"resumed"},operation:{start:"Start",stop:"Stop",pause:"Pause",resume:"Resume"}},OT={defaultInsufficientCredits:"Insufficient credits",defaultInvalidApiKey:"Invalid API key",defaultTooManyRequests:"Too many requests",defaultServiceDown:"Service temporarily down",markusCuExceeded:"⚠ Insufficient balance. Please top up or upgrade: https://markus.global/settings?tab=billing",markusRateLimited:"⚠ Upstream model provider rate-limited the request (OpenRouter / model vendor). This usually clears in a few seconds to a minute; if many agents are running, retry shortly or stagger tasks.",markusWindowExceeded:"⚠ Upstream temporarily limited request rate. Please retry shortly; if you are out of credits, top up or upgrade: https://markus.global/settings?tab=billing",creditModalTitle:"Credits Exhausted",creditModalDesc:"Your Markus Cloud AI credits have been used up. Please purchase more credits or upgrade your subscription to continue.",creditModalDismiss:"Later",creditModalUpgrade:"Top Up / Upgrade",ai402:"⚠ AI service error: {{detail}}. Please top up the API balance or contact your administrator.",ai401:"⚠ AI service authentication failed: {{detail}}. Please check the configuration.",ai429:"⚠ Rate limit exceeded: {{detail}}. Please wait a moment and try again.",ai409:"⚠ Request conflict: {{detail}}. Please retry.",ai502:"⚠ AI upstream service error: {{detail}}. The LLM provider may be temporarily down. Please try again later.",ai503:"⚠ AI service unavailable: {{detail}}. Please try again later.",aiUpstreamBillingMismatch:"⚠ Upstream billing error, but your Markus credits still remain. Please retry shortly or switch model. {{detail}}",aiRegionBlocked:"⚠ Model {{model}} is not available in your region. Please switch to another model in the chat composer.",aiGeneric:"⚠ AI service error: {{detail}}",defaultUpstreamDown:"LLM provider returned 502 Bad Gateway",defaultUpstreamBillingMismatch:"Upstream payment error with remaining local credits",defaultConflict:"Conflicting request"},DT={userInputPrompt_one:"{{count}} question awaiting your response",userInputPrompt_other:"{{count}} questions awaiting your response",userInputRespond:"Respond",notifyUserPrompt:"Agent notification awaiting your attention",notifyUserView:"View",notifyUserGotIt:"Got it",viewProfileArrow:"View Profile →",viewAgentProfileArrow:"View Agent Profile →",viewMindArrow:"View Mind →",messageActions:{resumeTitle:"Resume",reaskTitle:"Re-ask",retryTitle:"Retry",replyTitle:"Reply",rememberTitle:"Remember",rememberModalTitle:"Remember this experience?",rememberModalHint:"Optional: tell the agent what to encode from this conversation.",rememberModalPlaceholder:"e.g. Always confirm before editing ROLE.md",rememberConfirm:"Start evolution",rememberCancel:"Cancel",evolvedFrom:"Evolution session — reviewing a previous conversation",aiGeneratedDisclaimer:"AI-generated content — please verify carefully"},stopped:"Stopped",emptyReply:"The assistant didn't produce a reply this time. This usually means the request was too large or the AI service was briefly unavailable. Please retry — if it keeps happening, check your credits or switch models in Settings.",fallbackAgent:"Agent",fallbackYou:"You",systemName:"System",workerRole:"worker",selectAgent:"Select Agent",directMessage:"Direct Message",chatTitle:"Chat",teamTab:"Team",profileTab:"Profile",newChat:"New Chat",newChatPlus:"+ New",newChatButton:"+ New Chat",historyTitle:"History",rightPanelToggle:"Toggle side panel",sessionMain:"Main",sessionConversation:"Conversation",noConversationsYet:"No conversations yet",chatGreetings:["How can I help you?","What would you like me to do?","Ready when you are ✨","What's on your mind?","What shall we work on today?"],dateToday:"Today",dateYesterday:"Yesterday",datePrevious7Days:"Previous 7 days",dateOlder:"Older",loadingEarlierMessages:"Loading earlier messages…",emptyChannel:"No messages in {{name}} yet.",emptySelectAgent:"Select an agent from the sidebar to start.",emptyNewConversation:"Start a new conversation with {{name}}.",agentThinking:"Agent is thinking…",scrollToBottom:"Scroll to bottom",toggleSidebar:"Toggle sidebar",newMessages:"{{count}} new message(s)",mentionAgent:"Mention an agent",slashSkill:"Skills",mentionType:{agent:"Agent",project:"Project",requirement:"Requirement",task:"Task",deliverable:"Deliverable",workflow:"Workflow"},slashCmd:{skill:"Skills"},addMoreFiles:"Add more files",attachFilesTitle:"Attach files (images, PDF, Word, Excel, PowerPoint...)",visionWarning:"Images will be converted to text (model does not support vision)",stopAgent:"Stop agent",messageCount:"{{count}} messages",privateNotepad:"· Private notepad",dmWith:"· Direct message with {{name}}",members:"Members",addMemberPlaceholder:"+ Add member...",placeholder:{channelWithMention:"Message {{name}}… (use @name to mention)",channel:"Message {{name}}…",dmSelf:"Write a note to yourself…",dmOther:"Message {{name}}…",direct:"Type a message…",directOptions:["What can I do for you?","How can I help you today?","What's on your mind?","Ready when you are…","Tell me what you need…"],noAgent:"Select an agent to start chatting",agentOffline:"Agent is offline. Start the agent to send messages."},newTaskTitle:"New Conversation Task",taskFromChat:"Created from chat with {{name}}",errorWithMessage:"Error: {{message}}",retryConfirmSingular:"This will discard one message after this point and re-generate. Continue?",retryConfirmPlural:"This will discard {{count}} messages after this point and re-generate. Continue?",errorDetails:"Error Details",recentErrorDetails:"Recent Error",errorRecovered:"Agent has recovered and is running normally.",currentActivity:"Current Activity",workingOnTaskHint:"Working on task · Click to view",agentErrorFallback:"Agent encountered an error. Check profile for details.",processing:"Processing...",activityHeartbeat:"Heartbeat: {{name}}",activityTask:"Task: {{label}}",activityDescHeartbeat:"Periodic check-in task",activityDescChat:"Responding to conversation",activityDescFallback:"Agent is thinking or communicating",searchMessages:"Search messages",searchPlaceholder:"Search messages...",searching:"Searching...",noSearchResults:"No messages found"},IT={title:"Model",search:"Search models",applyGlobal:"Apply to global",empty:"No enabled providers / models"},PT={chat:TT,teamProfile:AT,contextMenu:ET,modals:_T,notifications:jT,userInput:MT,intro:RT,batchAction:LT,errors:OT,page:DT,chatModel:IT},zT="Work",BT={allProjects:"All Projects",newProject:"New Project",projectName:"Project Name *",projectNamePlaceholder:"e.g. Mobile App, Website Redesign",projectNameRequired:"Project name is required",description:"Description",descriptionPlaceholder:"What is this project about?",assignTeams:"Assign Teams",noTeamsAvailable:"No teams available",repositoryUrl:"Repository URL",repositoryPlaceholder:"https://github.com/org/repo (optional)",branch:"Branch",branchPlaceholder:"main",createProject:"Create Project",failedToCreate:"Failed to create project",settings:"Settings",status:"Status",repositories:"Repositories",deleteProject:"Delete Project",archiveProject:"Archive Project",settingsTitle:"Project settings",editProject:"Edit project",descriptionPlaceholderLong:"Add a project description…",projectStatusHeading:"Project Status",statusActive:"Active",statusActiveDesc:"Work is ongoing",statusPaused:"Paused",statusPausedDesc:"Temporarily on hold",statusArchived:"Archived",statusArchivedDesc:"No longer active",taskOverview:"Task Overview",requirementsHeading:"Requirements",agentsHeading:"Agents ({{count}})",agentTaskCounts:"{{active}} active / {{total}} total",addRepo:"+ Add",noReposLinked:"No repositories linked.",removeRepo:"Remove repository",repoPathPlaceholder:"Local path (e.g. /Users/me/project)",repoBranchPlaceholder:"Branch (default: main)",dangerZone:"Danger Zone",dangerZoneDeleteHint:"Deleting a project is permanent and cannot be undone. Tasks and requirements will be unlinked.",deleteProjectConfirmTitle:"Delete this project?",deleteProjectConfirmBody:'"{{name}}" will be permanently deleted, and its {{tasks}} task(s) and {{reqs}} requirement(s) will be unlinked. This action cannot be undone.',statTotal:"Total",statCompleted:"Completed",statInProgress:"In Progress",statInReview:"In Review",statBlocked:"Blocked",statFailed:"Failed",statActive:"Active",createdLabel:"Created",updatedLabel:"Updated"},$T=JSON.parse(`{"tasks":"Tasks","newTask":"New Task","noTasks":"No tasks yet","assignee":"Assignee","unassigned":"Unassigned","priority":"Priority","dueDate":"Due Date","description":"Description","comments":"Comments","activity":"Activity","subtasks":"Subtasks","dependencies":"Dependencies","deliverables":"Deliverables","status":"Status","assignTo":"Assign to","addComment":"Add comment...","retry":"Retry","cancel":"Cancel","commentPlaceholder":"Add a comment… (type @ to mention an agent)","activityCommentsHeading":"Activity & Comments","noActivityYet":"No activity yet. Post the first comment below.","reviewer":"Reviewer","noProject":"No Project","noRequirement":"No Requirement","requirementLabel":"Requirement","projectLabel":"Project","removeDependency":"Remove dependency","noDependencies":"No dependencies","abnormalBlock":"Abnormal","abnormalBlockHint":"This task is blocked but has no unfinished dependencies — it may need manual intervention.","addDependency":"+ Add dependency…","addDescription":"Add a description…","noDescription":"No description","collapse":"Collapse","subtasksProgress":"{{done}}/{{total}} done","hideCompleted":"Hide completed","showCompleted":"Show completed ({{count}})","addSubtask":"+ Add subtask","noSubtasksYet":"No subtasks yet.","subtaskTitlePlaceholder":"Subtask title...","add":"Add","deliverablesCount":"Deliverables ({{count}})","noDeliverablesYet":"No deliverables yet.","createdBy":"Created by {{name}}","updatedBy":"Updated by {{name}}","started":"Started {{date}}","updatedMeta":"Updated {{date}}","executionRound":"Round {{n}}","detailsTab":"Details","executionLogTab":"Execution Log","historyTab":"History","loadingHistory":"Loading history...","noHistory":"No status change history.","statusHistory":"Status History","showAllHistory":"Show all {{count}} transitions","failedToStart":"Failed to start:","scrollToTop":"Scroll to top","scrollToBottom":"Scroll to bottom","approve":"Approve","startExecution":"Start Execution","reject":"Reject","approveCheck":"✓ Approve","requestRevision":"↻ Request Revision","revisionReasonPlaceholder":"Revision reason…","revisionsNeededDefault":"Revisions needed","pause":"Pause","resume":"Resume","resuming":"Resuming…","runNow":"Run Now","running":"Running…","resumeSchedule":"▶ Resume Schedule","pauseSchedule":"⏸ Pause Schedule","archive":"Archive","reopen":"Reopen","resumeFailed":"Resume","cancelTask":"Cancel","deleteSubtaskTitle":"Delete subtask \\"{{title}}\\"?","deleteSubtaskMessage":"This subtask will be permanently deleted.","cancelTaskModalTitle":"Cancel Task","cancelTaskDependent_one":"This task has {{count}} dependent task that is currently blocked by it.","cancelTaskDependent_other":"This task has {{count}} dependent tasks that are currently blocked by it.","cancelTaskOnly":"Cancel this task only","cancelTaskOnlyHint":"Dependent tasks will start if they have no other blockers","cancelWithDependents":"Cancel with all dependents","cancelWithDependentsHint":"Also cancels {{count}} blocked task","cancelWithDependentsHint_plural":"Also cancels {{count}} blocked tasks","keepTaskRunning":"Keep task running","rejectConfirmTitle":"Reject Task","rejectConfirmMessage":"Reject this task? The proposal will be denied and cannot be undone.","archiveConfirmTitle":"Archive Task","archiveConfirmMessage":"Archive this task? It will be moved to historical records.","archiveScheduledConfirmMessage":"Archive this scheduled task? The recurring schedule will be permanently stopped.","cancelConfirmMessage":"Cancel this task? This will stop all work and cannot be undone.","cancelScheduledConfirmMessage":"Cancel this scheduled task? The recurring schedule will be paused and all work will be stopped.","continueTask":"Continue","editSchedule":"Edit","scheduleEveryMode":"Interval","scheduleCronMode":"Cron","scheduleMaxRuns":"Max runs:","scheduleMaxRunsPlaceholder":"Unlimited","viewAll":"View all →","schedulePaused":"⏸ Schedule Paused","scheduled":"Scheduled","scheduleEvery":"Every {{interval}}","scheduleCron":"Cron: {{expr}}","scheduleOneShot":"One-shot","scheduleNA":"N/A","scheduleNext":"Next: {{when}}","scheduleDueNow":"due now","scheduleInMinutes":"in {{count}}m","scheduleInHoursMinutes":"in {{h}}h {{m}}m","scheduleInDaysHours":"in {{d}}d {{h}}h","scheduleRuns":"Runs: {{current}}{{max}}","scheduleRunsMax":" / {{max}}","scheduleLast":"Last: {{when}}","scheduleApproveTitle":"Approve Scheduled Task","scheduleApproveDesc":"This task is configured with a schedule ({{schedule}}). The next execution is at {{nextRun}}.","scheduleApproveRunNow":"Run Now","scheduleApproveWait":"Wait for Schedule","serverError":"Server error","assignToRequired":"Assign to","reviewerRequired":"Reviewer","taskType":"Task Type","taskTypeStandard":"Standard","taskTypeScheduled":"Scheduled (recurring)","frequency":"Frequency","freq30m":"Every 30 min","freq1h":"Every 1 hour","freq2h":"Every 2 hours","freq4h":"Every 4 hours","freq8h":"Every 8 hours","freq12h":"Every 12 hours","freq1d":"Every day","freq1w":"Every week","blockedBy":"Blocked By (dependencies)","selectAgent":"Select agent…","selectReviewer":"Select reviewer…","selectDependency":"Select a task to depend on…","selectRequirement":"Select a requirement…","titleLabel":"Title","depsShort":"⏳ {{count}} dep","depsShort_plural":"⏳ {{count}} deps","byCreator":"by {{name}}","statusFlash":"Requirement status → {{status}}","assignedReviewerDifferent":"Assigned agent and reviewer must be different","errorCreatingTask":"Error creating task: {{message}}","errorCode_task_limit_reached":"This agent has reached its task limit. Please wait for existing tasks to complete","errorCode_requirement_required":"Please select a requirement. Tasks must be linked to an approved requirement","errorCode_agent_not_found":"The selected agent no longer exists or has been removed","errorCode_unknown":"Operation failed. Please try again later","pleaseReqTitle":"Please enter a title for this requirement","pleaseReqDesc":"Please enter a description for this requirement","pleaseReqProject":"Please select a project for this requirement","projectCreated":"Project created","projectDeleted":"Project deleted","requirementCreated":"Requirement created","requirementApproved":"Requirement approved","requirementRejected":"Requirement rejected","requirementCancelled":"Requirement cancelled","deleteProjectConfirm":"Delete this project and unlink all its tasks?","errorGeneric":"Error: {{message}}","commentInstructionPlaceholder":"Add a comment or instruction…","agentProcessing":"processing…","attachImage":"Attach image","loadingLogs":"Loading logs…","noExecutionLogs":"No execution logs yet.","runWithAgentHint":"Click \\"Run with Agent\\" to start.","emptyLogs":{"default":"No execution logs yet","defaultHint":"Send instructions via the comment box below","noAgent":"No agent assigned","noAgentHint":"Assign an agent to start execution","pending":"Task is queued for execution","pendingHint":"The agent will process tasks by priority","agentBusy":"{{agent}} is working on another task","agentBusyHint":"This task is queued in the agent's mailbox","starting":"Agent is preparing to execute","startingHint":"Logs will appear shortly…"},"relatedSessions":"{{agent}} processed this task in other sessions ({{count}} records)","sessionLive":"Live","agent":"Agent","loadingExecutionLog":"Loading execution log...","noExecutionLogAvailable":"No execution log available.","roundHeader":"Round #{{n}}","loadingRound":"Loading round #{{n}}…","toolCount_one":"{{count}} tool","toolCount_other":"{{count}} tools","dropHere":"Drop here","backToKanban":"Back to Kanban","projectsCount":"{{count}} Projects","projects":"Projects","all":"All","oneProject":"{{name}}","shortProject":"+ Project","shortReq":"+ Req","shortTask":"+ Task","backlog":"Backlog","kanban":"Kanban","dag":"DAG","workflows":"Workflows","team":"Team","selectProjectForWorkflows":"Select a project with a team to view workflows","noWorkflows":"No workflow templates for this team","workflowEmptyTitle":"No workflow templates yet","workflowEmptyDesc":"Workflows automate repeatable multi-step processes. Define a sequence of tasks as a DAG — the system handles dependencies, role assignment, and scheduling automatically.","workflowHowItWorks":"How it works","workflowStep1Title":"Requirement","workflowStep1Desc":"A workflow run creates a Requirement to group all its tasks under one trackable goal.","workflowStep2Title":"Task DAG","workflowStep2Desc":"Each step becomes a Task assigned to the right team member. Dependencies are tracked — downstream tasks wait for upstream ones to finish.","workflowStep3Title":"Auto-execution","workflowStep3Desc":"Agents pick up tasks, pass deliverables downstream, and the workflow completes automatically. Optionally, schedule it to run on a recurring basis.","workflowAskManager":"Ask {{name}} to create a workflow","workflowCreatePrompt":"Please create a workflow template for our team. Review the team composition, then design a multi-step process that matches our regular work. Use the workflow_create tool to save it. If the user specifies a project, bind the workflow to that project by including a project_id parameter. Otherwise, leave project as an optional runtime parameter so users can choose when starting a run.","saveAsWorkflow":"Save as Workflow","saveAsWorkflowDesc":"Turn this task structure into a reusable workflow template","workflowName":"Name","roles":"Roles","workflowSteps":"Steps","dependsOn":"Depends on","removeStep":"Remove step","saveWorkflow":"Save Workflow","saving":"Saving...","role":"Role","workflowLoading":"Loading...","workflowRun":"Run","workflowRunning":"Running","workflowScheduled":"Scheduled","workflowRecentRuns":"Recent Runs","workflowStarting":"Starting...","workflowStartRun":"Start Run","workflowProject":"Project","workflowSelectProject":"— Select a project —","workflowNoProject":"Please select a project","workflowNoTeam":"Cannot determine team for this workflow","workflowCancel":"Cancel","workflowCancelRun":"Cancel Run","workflowCancelling":"Cancelling...","workflowConfirmCancelTitle":"Cancel Workflow Run","workflowConfirmCancelDesc":"This will cancel all running and pending tasks in this workflow run. This action cannot be undone.","workflowConfirmCancelBtn":"Confirm Cancel","workflowNo":"No","workflowPause":"Pause","workflowResume":"Resume","workflowSendToAgent":"Send to agent chat","workflowNoRecentRuns":"No recent runs","workflowStepsCount":"{{count}} steps","workflowRolesCount":"{{count}} roles","workflowParamsCount":"{{count}} params","workflowRunTitle":"Run: {{name}}","workflowViewTasks":"View Tasks","workflowRequired":"required","workflowSavedSuccess":"Workflow saved successfully","backlogEmptyTitle":"Backlog is empty","backlogEmptyDesc":"The backlog shows all tasks in a flat list. Create a requirement and approve it — agents will break it into tasks that appear here.","dagEmptyTitle":"No task dependencies yet","dagEmptyDesc":"The dependency graph visualizes how tasks depend on each other. When tasks have \\"blocked by\\" relationships, they form a DAG (directed acyclic graph) shown here.","hideArchived":"Hide archived","hideArchivedWithCount":"Hide {{count}} archived","archivedCount":"{{count}} archived","filter":"Filter","filterWithCount":"Filter ({{count}})","clear":"Clear","myTasks":"My tasks","newRequirement":"+ Requirement","newTaskBtn":"+ Task","noItemsYet":"No items yet","emptyStateHint":"Create a requirement to tell agents what you need.\\n\\nOnce approved, tasks will appear here automatically.","emptyNoProjectsTitle":"Get started by creating a project","emptyNoProjectsHint":"Projects organize your work. Create a project first, then add requirements to describe what you need. Agents will break them into tasks automatically.","emptyNoReqsTitle":"Ready to add some work","emptyNoReqsHint":"Create a requirement to tell agents what you need.\\nOnce approved, tasks will appear here automatically.","emptyFilteredTitle":"No matching work","emptyFilteredHint":"Nothing matches the current assignee filter. Clear filters to see all items in this project.","emptyDetailTitle":"No item selected","emptyDetailHint":"Select a requirement or task from the list, or create one to get started.","createRequirementCta":"+ Create a requirement","filtersSheetTitle":"Filters","clearAll":"Clear all","projectsFilterGroup":"Projects","agentsFilterGroup":"Agents","newRequirementModalTitle":"New Requirement","newRequirementModalHint":"Describe what you need. Agents will break approved requirements into tasks.","selectProject":"Select a project…","reqTitleExample":"e.g. Add user authentication","reqDescPlaceholder":"What is needed and why...","rejectRequirementTitle":"Reject Requirement","rejectReasonLabel":"Reason","rejectReasonPlaceholder":"Why is this being rejected...","cronLabel":"Cron","scheduledShort":"Scheduled","everyInterval":"Every {{interval}}","reply":"Reply","hideLog":"Hide log","viewLog":"View log","viewProfile":"View Profile →","agentNotFound":"Agent not found: {{id}}…","workerRole":"worker","clickToEdit":"Click to edit","systemAuthor":"System","noteTimeJustNow":"just now","noteTimeMinutes":"{{count}}m ago","noteTimeHours":"{{count}}h ago","noteTimeDays":"{{count}}d ago","online":"Online","working":"Working","error":"Error","offline":"Offline","paused":"Paused","filePreviewLoading":"Loading...","emptyDirectory":"Empty directory","openInFinder":"Open in file browser","openInDeliverables":"Open in Output","requirementDetailDescription":"Description","requirementNoDescription":"No description","createdByLabel":"Created by","agentTag":"(Agent)","createdLabel":"Created","approvedBy":"Approved by","rejectionReason":"Rejection Reason","linkedTasks":"Linked Tasks ({{count}})","cancelRequirement":"Cancel Requirement","commentsWithCount":"Comments ({{count}})","noCommentsYet":"No comments yet.","requirementShort":"REQ","taskShort":"TASK","schedShort":"SCHED","backlogTitle":"Title","backlogUpdated":"Updated","noItems":"No items","loadingPage":"Loading…","adminFallback":"Admin","titleField":"Title","descriptionField":"Description","priorityField":"Priority","projectsCountLabel_one":"{{count}} Project","projectsCountLabel_other":"{{count}} Projects","noMatches":"No matches","searchPlaceholder":"Type to search…"}`),HT={requirements:"Requirements",newRequirement:"New Requirement",noRequirements:"No requirements yet",approved:"Approved",rejected:"Rejected",approveRequirement:"Approve",rejectRequirement:"Reject",cancelConfirmTitle:"Cancel Requirement",cancelConfirmMessage:"Are you sure you want to cancel this requirement? This action cannot be undone.",cancelConfirmLabel:"Cancel Requirement",createTask:"Task",noLinkedTasks:"No tasks linked yet. Create one to get started.",goal:"Goal Loop",goalActive:"Active",goalMaxReached:"Max Reached",goalIteration:"Iteration {{current}}/{{max}}",goalLastChecked:"Last checked: {{time}}",goalAutoResume:"Auto-resume"},UT={all:"All",active:"Active",completed:"Completed",search:"Search tasks...",status:"Status",assignee:"Assignee",priority:"Priority",sortBy:"Sort by",groupBy:"Group by"},FT={pending:"Pending",inProgress:"In Progress",review:"Review",completed:"Completed",failed:"Failed",blocked:"Blocked"},qT={failed:"Failed",todo:"To Do",in_progress:"In Progress",review:"In Review",done:"Done",closed:"Closed"},GT={task:{pending:"Pending",in_progress:"In Progress",blocked:"Blocked",review:"In Review",revision:"Revision",completed:"Completed",failed:"Failed",rejected:"Rejected",cancelled:"Cancelled",archived:"Archived"},requirement:{pending:"Pending",in_progress:"Active",completed:"Done",rejected:"Rejected",cancelled:"Cancelled",archived:"Archived"},sub:{pending:"Pending",blocked:"Blocked",failed:"Failed",rejected:"Rejected"},project:{active:"Active",planning:"Planning",review:"Review",completed:"Completed",archived:"Archived",paused:"Paused"}},VT={low:"Low",medium:"Medium",high:"High",urgent:"Urgent"},KT={noProjects:"No projects yet",createFirst:"Create your first project to get started"},WT={justNow:"just now",minutesAgo:"{{count}}m ago",hoursAgo:"{{count}}h ago",daysAgo:"{{count}}d ago"},YT={filter:{todo:"To Do",in_progress:"In Progress",review:"In Review",done:"Done"},reset:"Reset",archivedToggle:"{{count}} archived",expandHint:"Click a card to expand dependencies",backToOverview:"← Back to overview",dragHint:"Drag to link · Click edge to remove",noTasks:"No tasks to display",reqLabel:"REQ",taskCount_one:"{{count}} task",taskCount_other:"{{count}} tasks",depCount_one:"{{count}} dep",depCount_other:"{{count}} deps",removeDependencyTitle:"Remove dependency?",removeDependencyBody:"{{target}} will no longer be blocked by {{source}}.",toast:{dependencyExists:"Dependency already exists",cycleError:"Cannot add: would create a cycle",dependencyAdded:"Dependency added",dependencyRemoved:"Dependency removed",failed:"Failed: {{message}}"}},XT={title:zT,project:BT,task:$T,requirement:HT,filters:UT,board:FT,boardColumn:qT,status:GT,priority:VT,empty:KT,relative:WT,dag:YT},QT="Settings",ZT={appearance:"General",providers:"Model Providers",execution:"Agent Configuration",browser:"Browser Automation",search:"Web Search",codingTools:"Coding Tools",storage:"Data & Storage",users:"User Management",remote:"Remote Access",integrations:"Integrations",license:"License",organization:"Organization",account:"Account",group:{general:"Preferences",aiConfig:"AI Configuration",tools:"Tools & Capabilities",connections:"Connections",account:"Account"}},JT={title:"General",theme:"Theme",themeDesc:"Choose a visual style for the interface",language:"Language",languageDesc:"Choose the display language",launchAtLogin:"Launch at startup",launchAtLoginDesc:"Automatically start Markus in the background when you sign in to your computer",modes:{system:"System",light:"Light",dark:"Dark",cyberpunk:"Cyberpunk",mono:"Mono"}},eA={title:"Welcome — Configure Your LLM",subtitle:"Markus needs at least one LLM provider to work. Choose a way to get started:",skip:"Skip",fromEnv:{step:"1",title:"From Environment Variables",description:"Automatically detected API keys from .env or system environment.",noKeysHint:"No API keys found. Set environment variables like <code>ANTHROPIC_API_KEY</code> or <code>OPENAI_API_KEY</code> and restart the server."},fromOllama:{step:"2",title:"Local Ollama",description:"Auto-detect a locally running Ollama service and select a model."},fromOpenClaw:{step:"3",title:"From OpenClaw Config",description:"Import model configs from an existing OpenClaw installation."},manual:{step:"4",title:"Manual Configuration",description:"Edit <code>~/.markus/markus.json</code> directly, then restart the server."},browserExtension:{step:"5",title:"Install Browser Automation Extension",description:"Let AI agents control Chrome to browse, test apps, and inspect pages — no permission dialog each time.",notChrome:"Your current browser is not Chrome. Open Markus in Chrome to install the extension.",alreadyConnected:"Extension is already connected.",downloadBtn:"Download Extension",openChromeBtn:"Open Extensions Page",loadHint:'After unzipping, go to Chrome Extensions page → enable "Developer mode" → "Load unpacked" → select the unzipped folder'},applyProviders:"Apply {{count}} Provider(s)",foundPrefix:"Found:"},tA={title:"System Status",status:"Status",healthy:"Healthy",version:"Version",activeAgents:"Active Agents"},nA={title:"Default LLM Provider",primaryProvider:"Primary Provider",primaryProviderDesc:"Used for all agent interactions unless overridden",noProviders:"No providers configured",updated:"Default provider updated to {{name}}",autoFallback:"Auto-switch Model",autoFallbackDesc:"Off by default. When on, try other providers/models if the primary fails; when off, surface the error so you can switch manually."},rA={title:"Model Routing",defaultModelTitle:"Default Model",defaultModelDesc:"Used as fallback when no specific model is assigned for a capability.",defaultModelPlaceholder:"Select a default model...",capabilityAssignTitle:"Capability Assignments",capabilityAssignDesc:"Each capability type uses the assigned model. Unassigned capabilities use the default model above.",capabilityGroups:{text:"Text",image:"Image",audio:"Audio",video:"Video",other:"Other"},capabilities:{text:"General",image_recognition:"Image Recognition",image_generation:"Image Generation",audio_tts:"Text-to-Speech",audio_stt:"Speech-to-Text",video_generation:"Video Generation"},auto:"Use default",selectModel:"Select model...",suggested:"suggested",noModelAvailable:"No capable model available",addProviderHint:"add a provider that supports this capability above",clear:"Clear",loadError:"Failed to load routing settings: {{error}}",saving:"Saving...",saved:"Saved",saveError:"Save failed",mismatchHint:"Model does not match this capability type — please select a compatible model",staleProvider:"Provider not configured — clear or reconfigure",noProvidersHint:"Configure at least one provider above to assign models to capabilities.",restoreRecommended:"Restore Markus recommendations",restoreWorking:"Restoring…",restoreConfirm:"Replace your model routing with Markus recommendations and set Markus as the default provider? Your current capability assignments will be overwritten.",loadingModels:"Loading model list…",tier:{base:"Base",pro:"Pro",max:"Max"}},aA={loading:"Loading models...",empty:"No models available for this provider.",filterPlaceholder:"Filter models...",searchPlaceholder:"Search models...",showAll:"Show all {{count}} models...",showLess:"Show less",allCount:"All ({{count}})",tierCount:"{{tier}} ({{count}})",active:"Active",perMillion:"per 1M",ctx:"ctx",costFree:"Free",capabilities:{tools:"Tools",vision:"Vision",reasoning:"Reasoning",caching:"Caching",search:"Search"}},sA={title:"Model Providers & Pricing",disabled:"disabled",notConfigured:"Click to set up",addProvider:"+ Add Provider",addNewProvider:"Add New Provider",providerName:"Provider",selectProvider:"Select a provider...",customProvider:"Custom (OpenAI-compatible)",customName:"Custom Provider Name",validatingKey:"Validating key & loading models...",selectModel:"Select Model",advancedSettings:"Advanced settings (base URL, pricing overrides...)",providerNameHint:"Use anthropic, openai, google, ollama for first-party; any other name uses OpenAI-compatible API",apiKey:"API Key",apiKeyPlaceholder:"Leave blank to keep current",baseUrl:"Base URL (optional)",baseUrlLabel:"Base URL",defaultModel:"Default Model",contextWindow:"Context Window",maxOutputTokens:"Max Output Tokens",inputCost:"$/1M Input",outputCost:"$/1M Output",editProvider:"Edit Provider",deleteConfirm:'Delete provider "{{name}}"?',providerAdded:"Provider {{name}} added",notConfiguredHint:'Not configured. Use the "Add Provider" button below, or set API keys in environment variables.',quickSetupHint:"Enter your API Key to start using this provider immediately.",markusKeyHint:"Get your Markus Cloud AI API key from",markusKeyLink:"Hub Settings",quickSetupPlaceholder:"Paste your API Key here...",quickSetupSubmit:"Activate",quickSetupSaving:"Activating...",quickSetupSuccess:"{{name}} is now ready to use!",keyReadOnly:"Key (read-only)",pricingTitle:"Pricing (per 1M tokens)",input:"Input",output:"Output",cacheRead:"Cache Read",cacheWrite:"Cache Write",availableModels:"Available Models",addModel:"+ Add Model",addModelTitle:"Add Model",browseFromCatalog:"Browse Catalog",browse:"Browse",selectFromCatalog:"Select from catalog",loadingCatalog:"Loading models from catalog...",loadingHubCatalog:"Loading models from Hub…",hubCatalogEmpty:"No models loaded. Check that Hub is running at the address in Settings → Hub, then collapse and re-expand Markus.",hubCatalogError:"Failed to load Hub catalog: {{error}}",moreCatalogModels:"{{count}} more models available from catalog...",modelsAvailable:"{{count}} models available",andMoreModels:"... and {{count}} more models",catalogModelsAvailable:"{{count}} more models supported by this provider",showAllModels:"Show all {{count}} models",filterModels:"Filter models…",noFilterMatches:"No models match this filter",collapseModels:"Collapse",modelId:"Model ID",displayName:"Display Name",reasoning:"reasoning",vision:"vision",capImageGen:"image",capTts:"tts",capStt:"stt",capVideo:"video",custom:"custom",use:"Use",switching:"Switching...",model:"Model",ctxTokens:"{{size}}K ctx",costPerMillion:"${{input}}/{{output}} per 1M",badgeDefault:"default",badgeOAuth:"OAuth",clickToDisable:"Click to disable",clickToEnable:"Click to enable",maxOutput:"Max Output",kTokens:"{{k}}K tokens",notApplicable:"N/A",baseUrlDisplayDefault:"Default",active:"active",deleteCustomModelTitle:"Delete custom model",costPair:"${{input}}/{{output}}",adding:"Adding...",costPerMillionIn:"$/1M in:",costPerMillionOut:"out:",placeholderContextTokens:"Context (tokens)",placeholderProviderName:"e.g. deepseek, openrouter, my-provider",placeholderApiKeySk:"sk-...",placeholderBaseUrl:"https://api.example.com/v1",placeholderDefaultModel:"e.g. deepseek-chat, gpt-4o",placeholderContextExample:"e.g. 128000",placeholderMaxOutputExample:"e.g. 16384",placeholderCostInput:"e.g. 1",placeholderCostOutput:"e.g. 5",addProviderSubmit:"Add Provider",saveFailed:"Save failed",failedToAdd:"Failed to add",test:"Test",testing:"Testing...",testOk:"OK ({{ms}}ms)",testModel:"Test model",testDefaultModel:"(use default model)",testFailed:"Failed",testFailedCode:"Error {{code}}",testSuccess:"Connected in {{ms}}ms — reply: {{reply}}",testDetail:{requestUrl:"Request URL",model:"Model",requestBody:"Request Body",response:"Response",duration:"Duration",tokens:"Tokens",inputTokens:"input",outputTokens:"output"},configuredCount:"configured",groupConfigured:"Configured ({{count}})",groupUnconfigured:"More Providers",markusHint:"Connect to Markus Cloud AI service",markusSetup:"Enter your Markus API key to connect. You can get one from your Markus Hub account.",markusSetupLogin:"Log in to your Markus Hub account to automatically connect to Markus Cloud AI.",markusConnected:"Connected",markusConnectedHint:"Your Markus Cloud AI connection is managed through your Hub account. Visit Settings to manage your subscription and credits.",goToAccount:"Go to Account",connect:"Connect"},iA={title:"Network Proxy",description:"Configure an HTTP proxy for ChatGPT OAuth login and Codex API calls. Other LLM providers use system/TUN proxy automatically.",active:"Active:",noProxy:"No proxy detected",sourceConfig:"markus.json",sourceEnv:"env var",sourceSystem:"macOS system",placeholder:"http://127.0.0.1:7890 (leave empty for auto-detect)",saving:"Saving...",save:"Save",saved:"Saved. Restart server to apply.",saveFailed:"Save failed",networkError:"Network error",refresh:"Re-detect",disabled:"Proxy disabled"},oA={title:"OAuth Authentication",description:"Sign in with your ChatGPT account to use Codex models via your subscription (no API key required).",signInWith:"Sign in with {{name}}",connecting:"Connecting...",device:"Device",deviceTitle:"Device Code login (for remote/headless environments)",deviceCodeTitle:"Device Code Login",deviceInstructions:"Open the verification URL and enter the code:",deviceWaiting:"Waiting for authorization... (expires in 15 min)",manualCallbackHint:"If the browser didn't open or you're on a remote machine, paste the callback URL below:",manualPlaceholder:"http://localhost:1455/auth/callback?code=...",submit:"Submit",connectedAccounts:"Connected Accounts",expired:"Token expired / invalid",reconnect:"Re-authenticate",disconnect:"Disconnect",noProviders:"No OAuth providers available",deviceCodeFailed:"Device code login failed"},lA={loginFailed:"Login failed",networkErrorDuringLogin:"Network error during OAuth login",callbackFailed:"Callback failed"},cA={title:"Auto-detect & Import",description:"Discover LLM providers from environment variables, local Ollama service, or existing configurations."},uA={title:"Local Ollama",description:"Auto-detect a locally running Ollama service and configure it as a model provider. No API key required.",detect:"Detect Ollama",detecting:"Detecting...",foundModels:"Found {{count}} model(s) at {{url}}",notRunning:"Ollama is not running locally. Start Ollama first, then click detect.",detectFailed:"Failed to detect Ollama service",useModel:"Use {{model}}",configured:"Ollama configured with model {{model}}",applyFailed:"Failed to configure Ollama",switchModel:"Switch Model"},dA={title:"Environment Variable Configuration",description:"Detect model API keys from environment variables and write them to the config file.",refreshEnv:"Refresh Environment Variables",detectedProviders:"Detected Providers — select to apply:",noKeysFound:"No model API keys found in environment variables",detectionFailed:"Detection failed",failedToDetect:"Failed to detect environment variables",applyToConfig:"Apply {{count}} Provider(s) to Config",selectAtLeastOne:"Select at least one provider to apply",applyFailed:"Apply failed (HTTP {{status}})",failedToApply:"Failed to apply environment configs",detectionFailedHttp:"Detection failed (HTTP {{status}})",keyLabel:"Key:",modelLabel:"Model:",urlLabel:"URL:",llmTimeout:"LLM Timeout: {{ms}}ms (from LLM_TIMEOUT_MS)"},mA={title:"Agent Execution",maxToolIterations:"Max Tool Iterations",maxToolIterationsDesc:"Safety cap on tool call loops per agent turn (0 = unlimited, applies to all agents and subagents)",saved:"Saved",failedToSave:"Failed to save"},fA={title:"Cognitive Preparation Pipeline",description:"Before each main LLM call, the agent runs a lightweight appraisal to assess the stimulus and prepare persona-aware context. This can improve response relevance at the cost of a small extra LLM call (~500ms).",enabled:"Enable CPP",enabledDesc:"When enabled, agents run a cognitive appraisal before responding",maxDepth:"Max Cognitive Depth",maxDepthDesc:"Controls how much preparation is done before each response",depthD1:"Appraisal only",depthD2:"Appraisal + Retrieval + Reflection",depthD3:"Full pipeline + post-evaluation",saved:"Saved",failedToSave:"Failed to save"},pA={title:"Web Search",description:"Priority: Hub connected with balance → Markus hosted first; otherwise your API keys first.",serper:"Serper (Google)",serperHint:"serper.dev",tavily:"Tavily",tavilyHint:"tavily.com",bing:"Bing Web Search",bingHint:"Azure Cognitive Services",google:"Google Custom Search",googleHint:"API key + Search Engine ID",googleCxPlaceholder:"Search Engine ID (cx)...",serpapi:"SerpAPI",serpapiHint:"serpapi.com",brave:"Brave Search",braveHint:"brave.com",exa:"Exa",exaHint:"exa.ai",bocha:"Bocha (博查)",bochaHint:"bochaai.com",configured:"Configured",notConfigured:"Not configured",apiKeyPlaceholder:"Paste API Key here...",saved:"Search API keys saved",failedToSave:"Failed to save search API keys",envDetected:"from env",markus:"Markus Hosted Search",markusBadge:"Recommended",markusHint:"No third-party key · uses your Markus Cloud balance",markusProviderLabel:"Search engine",markusProviderBocha:"Bocha (Chinese)",markusProviderTavily:"Tavily",markusUnavailable:"Sign in to Markus",markusUnavailableHint:"Connect Markus under Model Providers to enable hosted search.",modelLabel:"Retrieval model",modelHint:"Hosted search bills per call. Prefer your own API keys above when available — those skip this model. Sonar is cheaper than Sonar Pro.",modelSonar:"Perplexity Sonar (default, lower cost)",modelSonarPro:"Perplexity Sonar Pro (higher quality)",ownKeysTitle:"Your own API keys",ownKeysHint:"Optional fallback",test:"Test",testing:"Testing…",testOk:"Success — {{count}} results",testFailed:"Test failed",enabled:"Enabled",disabled:"Disabled"},hA={title:"Browser Automation",description:"Settings for the Chrome DevTools browser skill. Agents use Chrome to browse, test web apps, and inspect pages.",bringToFront:"Bring to Foreground",bringToFrontDesc:"When enabled, Chrome tabs will be brought to the foreground when agents navigate. When disabled (default), agents work silently in the background without stealing focus.",autoCloseTabs:"Auto-close Tabs",autoCloseTabsDesc:"Automatically close agent-owned browser tabs when the agent task completes or the agent is removed.",remoteDebuggingPort:"Remote Debugging Port",remoteDebuggingPortDesc:"Set a persistent debugging port (e.g. 9222) to avoid Chrome's permission dialog every time an agent connects.",remoteDebuggingPortDescLead:"Set a persistent debugging port (e.g. 9222) to avoid Chrome's permission dialog every time an agent connects. Start Chrome with",remoteDebuggingPortDescTail:"then set the same port here. Set to 0 to use auto-connect (requires manual permission approval).",tabsForeground:"Tabs will be brought to foreground",tabsBackground:"Tabs will stay in background",usingPort:"Using persistent connection on port {{port}} (no more permission dialogs)",usingAutoConnect:"Using auto-connect mode (permission dialog required on each connection)",autoClickAllowDialog:"Auto-Allow Chrome Debugging Dialog",autoClickAllowDialogDesc:'Chrome shows an "Allow remote debugging?" dialog each time Markus connects. When enabled, Markus auto-clicks "Allow" via OS accessibility APIs.',autoClickAllowDialogMacNote:"macOS: Grant Accessibility permission in System Settings > Privacy & Security > Accessibility for the app running Markus (Markus.app / Terminal / iTerm).",autoClickAllowDialogWinNote:"Windows: No additional permissions needed. Uses built-in UI Automation.",autoClickAllowDialogLinuxNote:"Linux: Not yet supported. Use Remote Debugging Port (above) as an alternative.",autoClickAllowDialogSupported:"Supported on this platform",autoClickAllowDialogUnsupported:"Not supported on this platform",autoClickTest:"Test",autoClickTesting:"Testing...",autoClickTestSuccess:"Auto-click verified! Successfully connected to Chrome and loaded a test page ({{title}}).",autoClickTestNoPermission:"Accessibility permission not granted. The system settings page has been opened — please add this app to the list.",autoClickTestChromeNotRunning:"Chrome is not running. Please start Chrome first.",autoClickTestUnsupported:"Auto-click is not supported on this platform. Use Remote Debugging Port instead.",autoClickTestError:"Test failed: {{error}}",modeExtension:"Chrome Extension (Active)",modeExtensionDesc:"Browser tools route through the extension — no debugging dialog, no extra permissions, works when screen is locked.",modeDebuggingPort:"Remote Debugging Port :{{port}} (Active)",modeDebuggingPortDesc:"Connected via persistent debugging port — no permission dialog on each connection.",modeAutoClick:"Auto-Connect + Auto-Click (Active)",modeAutoClickDesc:"Using chrome-devtools-mcp with OS auto-click to handle the debugging dialog. May not work when screen is locked.",modeManual:"Auto-Connect (Manual Approval Required)",modeManualDesc:"Chrome will show a permission dialog each time an agent connects. You must click Allow manually.",modeRecommended:"recommended",generalSettings:"General",fallbackModes:"Connection Mode (Fallback)",extensionStatus:"Chrome Extension",extensionStatusDesc:"Enables browser automation without the debugging dialog. No Accessibility permissions needed, works even when screen is locked.",extensionConnected:"Connected",extensionDisconnected:"Not Connected",extensionActiveNote:"Extension active — browser tools route through extension (no debugging dialog)",extensionSetupTitle:"Install Chrome Extension",extensionStep1:"Download & Unzip",extensionStep1Desc:"Download the zip and extract it to any location (e.g. Desktop)",extensionStep1Btn:"Download markus-browser-extension.zip",extensionStep1Downloading:"Preparing download...",extensionStep2:"Open Chrome Extensions",extensionStep2Desc:"Open the extensions management page in Chrome",extensionStep2Btn:"Open chrome://extensions",extensionStep3:"Load Extension",extensionStep3Desc:'Enable "Developer mode" (top right toggle), click "Load unpacked", and select the folder extracted in step 1',extensionDownloadError:"Failed to download extension",extensionOpenError:"Failed to open Chrome extensions page"},gA={title:"Data & Storage",scanning:"Scanning storage...",openInFinder:"Open in Finder",storageBreakdown:"Storage Breakdown",agentStorage:"Agent Storage ({{count}})",openFolder:"Open folder",orphanedDirectories:"Orphaned Directories",orphanedDesc:"These directories have no matching database record and were likely left behind when agents or teams were deleted.",orphanedTotal:"Total: {{size}} across {{count}} director(ies).",cleanSelected:"Clean Selected ({{size}})",cleanAll:"Clean All ({{size}})",cleaning:"Cleaning...",cleaned:"Cleaned {{count}} dir(s), freed {{size}}",bytesZero:"0 B",unitB:"B",unitKB:"KB",unitMB:"MB",unitGB:"GB",teamKind:"team",selectedWithSize:"{{count}} selected ({{size}})",cleanupFailed:"Cleanup failed",cleanedWithFailureNote:"{{base}} ({{count}} failed)",sortedBySize:"Sorted by size",clearableHint:"About {{size}} ({{percent}}%) is clearable debug logs and won’t affect day-to-day use.",safetyLevel:{safe:"Clearable"},items:{database:{label:"Database",blurb:"Core data for tasks, agents, and chat"},agents:{label:"Agents",blurb:"Workspaces, memory, roles, and sessions"},skills:{label:"Skills",blurb:"Installed skill packages"},llmLogs:{label:"LLM logs",blurb:"Request/response audit logs — safe to clear for space"},builderArtifacts:{label:"Creations",blurb:"Local source files for Assets → My Creations"},teams:{label:"Teams",blurb:"Team announcements and norms"},shared:{label:"Shared files",blurb:"Cross-agent shared files and deliverables"},knowledge:{label:"Knowledge",blurb:"Knowledge-base entries used for retrieval"}}},bA="Connected to {{provider}} via OAuth",xA="Auth profile deleted",yA="Browser opened for authorization. Complete the login in the browser window...",vA={title:"Remote Access",description:"Access this Markus instance from your phone or any device via WebRTC P2P connection through Markus Hub.",loginRequired:"Sign in to Markus Hub to enable remote access.",signIn:"Sign In",signedInAs:"Signed in as",enabled:"Remote access enabled",disabled:"Remote access disabled",connecting:"Connecting to signal server...",registering:"Registering with Hub...",connected:"Connected",disconnected:"Disconnected",peerCount_one:"{{count}} peer",peerCount_other:"{{count}} peers",url:"Remote URL",copy:"Copy",copied:"Copied!",qrCode:"QR Code",scanQr:"Scan with your phone camera to connect",enableFailed:"Failed to enable remote access",disableFailed:"Failed to disable remote access",connectedPeers:"Connected Peers",connectedSince:"Connected since {{time}}",peerConnecting:"Connecting"},wA={title:"Local Markus",sharedInstanceDesc:"Manage user accounts on this machine's Markus instance. All accounts share the same workspace, AI agents, and teams. For example: on a shared Linux server, multiple colleagues each log in with their own account to the same Markus.",orgHint:'If team members each use their own Markus on separate computers, go to the "Account" tab to view your organization and manage it on Hub.',orgLink:"",name:"Name",email:"Email",role:"Role",actions:"Actions",noUsers:"No users found",editUser:"Edit",deleteUser:"Delete",resetPassword:"Reset Password",save:"Save",cancel:"Cancel",confirmDelete:"Are you sure you want to remove this user? This action cannot be undone.",confirmDeleteTitle:"Remove User",newPassword:"New Password",confirmReset:"Reset",resetSuccess:"Password has been reset",addUser:"Add User",addSuccess:"User created",password:"Password",updateSuccess:"User updated",deleteSuccess:"User removed",error:"Operation failed",cannotDeleteSelf:"You cannot delete your own account",cannotDeleteOwner:"Cannot remove the primary owner",inviteLink:"Invite",inviteLinkGenerated:"Invite link generated — copy and send to the user",copyInviteLink:"Send this link to the user so they can set up their account:",linkCopied:"Link copied to clipboard",copy:"Copy",roles:{owner:"Owner",admin:"Admin",member:"Member",guest:"Guest"}},kA={title:"License",currentPlan:"Current Plan",planFree:"Community",planEnterprise:"Enterprise",instanceId:"Instance ID",username:"Username",licenseKey:"License Key",validUntil:"Valid until",statusActive:"Active",daysRemaining:"{{count}} days remaining",daysRemaining_one:"{{count}} day remaining",daysRemaining_other:"{{count}} days remaining",expired:"Expired",expiresOn:"Expires on {{date}}",expiredWarning:"License has expired. Enterprise features are no longer available.",renewalWarning:"License expires in {{count}} days",renewalWarning_one:"License expires in {{count}} day",renewalWarning_other:"License expires in {{count}} days",renewalHint:"Contact sales for a new license key and enter it below to renew.",renew:"Renew",refresh:"Refresh",trial:"Trial",offline:"Offline",details:"License Details",manage:"License Management",upgrade:"Upgrade to Enterprise",updateKey:"Replace or renew license key",activateDesc:"Have a license key? Enter it to unlock all Enterprise features.",keyPlaceholder:"Enter license key…",activate:"Activate",activated:"License activated successfully!",activationFailed:"Failed to activate license.",tryEnterprise:"Try Enterprise Free for 7 Days",trialActivated:"7-day Enterprise trial activated!",trialFailed:"Failed to start trial.",trialDesc:"Full access to all Enterprise features. No credit card required. Reverts to Community automatically.",contactSales:"Get Enterprise License",contactSalesDesc:"Copy the following info and send it to sales ({{email}}) to receive your license key.",copyInfo:"Copy",copied:"Copied",emailSales:"Email Sales",salesEmail:"business@markus.global",enterpriseFeatures:"Enterprise Features",freeFeatures:"Community Plan Includes",freeFeaturesDesc:"1,000 reward credits, all models, unlimited local usage",enterpriseFeaturesDesc:"Everything in Community, plus:",featureMultiUser:"Multi-user collaboration",featureSso:"SSO / SAML support",featureAudit:"Enhanced audit logging",featureMultiInstance:"Multi-instance management",featureOffline:"Offline license support",website:"markus.global",docs:"Documentation",learnMore:"Learn more about Enterprise",trialAlreadyUsed:"Trial has already been used for this account.",licenseNotFound:"License not found or not active.",instanceLimitReached:"Maximum number of instances reached for this license.",organization:"Organization",seats:"Seats",notOwnedHint:"This license is managed by the organization owner. License details are only visible to the license owner.",cloudAi:"Cloud AI",cloudAiDesc:"Manage your Markus Cloud AI subscription, API keys, credits usage, and billing on the Hub website.",manageSubscription:"Manage Subscription & API Keys",apiDocs:"API Documentation"},SA={title:"Account",subtitle:"Manage Cloud AI subscription, organization, and local users.",cloudAiTitle:"Cloud AI",currentPlan:"Current Plan",credits:"Credits",personalLimit:"Personal Limit",bonus:"bonus",manageBilling:"Manage Subscription",manageOrg:"Manage Organization",orgSection:"Organization",memberCount:"Members"},NA={title:"My Organization",description:"Manage your organization on Markus Hub. Organization members each install Markus on their own computer and share a single enterprise license. For example: a team of 5 people, each running an independent Markus instance on their own laptop, sharing the organization's license quota.",usersHint:'If your team runs Markus on one shared server (e.g. a single Linux server used by multiple people), go to the "Local Markus" tab to add local user accounts instead.',nameLabel:"Organization Name",nameSaved:"Name updated",orgId:"Org ID",licenseStatus:"License",seats:"Seats",members:"Members",inviteLabel:"Invite Member",invitePlaceholder:"Enter email address",invite:"Invite",invited:"Invitation sent",seatsFullHint:"Member limit reached. Upgrade your plan or contact sales for more capacity.",invalidEmail:"Please enter a valid email address",errorUserNotFound:"No user found for this email, invitation email has been sent",errorAlreadyMember:"This user is already a member or has a pending invitation",errorAlreadySent:"An invitation has already been sent to this email",errorInviteFailed:"Invite failed",invitedBy:"invited by",accept:"Accept",remove:"Remove",leave:"Leave Organization",leaveConfirmTitle:"Leave Organization",leaveConfirmMsg:`Are you sure you want to leave "{{name}}"? You will lose access to this organization's resources and will need to be re-invited to rejoin.`,leaveConfirmBtn:"Confirm Leave",leaveCancel:"Cancel",pending:"pending",noMembers:"No members",noOrg:"No organization found. Connect to Markus Hub to get started.",roleOwner:"Owner",roleAdmin:"Admin",roleMember:"Member",connectHub:"Connect to Markus Hub",reconnectHub:"Reconnect Markus Hub",staleSessionHint:"A Hub login was found locally but the organization could not be loaded. Reconnect to refresh the session.",popupBlocked:"Popup blocked by browser. Please allow popups for this site and try again.",loginCancelled:"Login cancelled.",connecting:"Connecting…",loadFailed:"Failed to load organizations. Please check your network.",noOrgAfterConnect:"Connected successfully, but no organizations found. You may need to create one on Markus Hub.",switchOrg:"Switch Organization:",roleUpdated:"Role updated",yourRole:"Your Role",changeRole:"Change Role"},CA={description:"Configure Feishu integration for notifications and approvals",connectionSettings:"Connection Settings",longConnectionMode:"Using long connection mode (WebSocket) — no public IP required",actions:"Actions",testConnection:"Test Connection",integrationState:"Integration State",enableIntegration:"Enable Feishu Integration",enableHint:"When enabled, Markus will establish a long connection to Feishu and start processing events",notificationForwarding:"Notification Forwarding",notifyChatId:"Send Notifications To",notifyChatIdHint:"Select a group chat, or use private messages (default).",forwardApprovals:"Forward Approval Requests",forwardApprovalsHint:"Send approval requests to Feishu as interactive cards",forwardNotifications:"Forward General Notifications",forwardNotificationsHint:"Send system notifications to Feishu chat",notifyPriority:"Minimum Notification Priority",priorityHint:"Only notifications with the selected priority levels will be forwarded",setupGuide:"Setup Guide",setupGuideDesc:"Follow these steps to set up the Feishu integration:",guideStep1:"Go to Feishu Open Platform (open.feishu.cn) and create an enterprise self-built app",guideStep2:"Go to App → Features → Bot, enable bot capability",guideStep3:"Go to App → Permissions, enable im:message and im:message.receive_v1",guideStep4:'Go to App → Events & Callbacks → Subscription mode, select "Use long connection"',guideStep5:'On the Events & Callbacks page, subscribe to "Receive messages v2.0" (im.message.receive_v1)',guideStep6:"Go to App → Credentials, copy App ID and App Secret into the fields above",guideStep7:'Click "Test Connection" to verify credentials, then enable the integration',guideStep8:"Add the bot to a group chat (or send a direct message to the bot)",longConnectionNote:"Long connection mode requires an enterprise self-built app. Store apps are not supported. No public IP or domain is needed.",quickSetup:"Quick Setup",oneClickTitle:"One-Click Feishu Integration",oneClickDesc:"Scan a QR code with Feishu to automatically create and configure the app. No manual setup needed.",scanToCreate:"Scan QR Code to Create App",oneClickPermissions:"The app will be created with permissions: bot messaging, message receiving, user info reading, and group chat management.",generatingQR:"Generating QR code...",scanWithFeishu:"Scan with Feishu app",scanHint:"Use your Feishu mobile app to scan and authorize. The app will be created in your organization.",qrExpire:"QR code expires in {{minutes}} minutes",registerSuccess:"App created successfully! Integration is now active.",registerFailed:"Registration failed",manualConfig:"Manual configuration (advanced)",appInfo:"App Information",removeApp:"Remove",sendTestMessage:"Send Test Message",chatIdPlaceholder:"Enter Chat ID (oc_xxxxxxxx)",send:"Send",chatIdHint:"Chat ID can be found in the Feishu group chat URL or via the API",chatIdRequired:"Please select a group chat",selectChat:"— Private message (default) —",loadingChats:"Loading groups...",refreshChats:"Refresh",noChatHint:"No groups found. Add the bot to a group chat to enable group notifications.",noChatFallbackHint:"No group selected — notifications will be sent to you as private messages.",selectTestChat:"— Select a group chat —",testMsgSent:"Test message sent",testMsgFailed:"Failed to send test message",saved:"Feishu configuration saved",fillRequired:"Please fill in App ID and App Secret first",testSuccess:"Connection successful",testFailed:"Connection failed",disconnected:"Disconnected from Feishu",disconnect:"Disconnect"},TA={title:"Coding Tools",description:"Configure external AI coding tools (Claude Code, Codex, Cursor) that agents can invoke for implementation tasks.",globalEnable:"Enable coding tools",globalEnableDesc:"Allow agents with the coding-tools skill to invoke external CLI coding assistants.",ready:"Ready",needsAuth:"Needs authentication",available:"Installed",notInstalled:"Not installed",installHint:"Install:",enabled:"Enabled",stepInstall:"Install CLI tool",stepAuth:"Authenticate",stepEnable:"Enable in Markus",authHint:"Login via browser or enter an API key to authenticate",sectionModelExec:"Model & Execution",sectionAdvanced:"Advanced",loginBtn:"Login via browser",apiKeyBtn:"Use API Key",loginWaiting:"Waiting for browser login…",authSuccess:"Authentication successful!",authFailed:"Authentication failed. Please try again.",authBrowserHint:"Browser opened. Complete login there — status will update automatically.",authPolling:"Waiting for login to complete… checking automatically every 15s",authPollTimeout:"Auto-detect timed out. Please complete login and click Re-detect.",apiKeySaved:"API key saved to {{envVar}}",useApiKeyInstead:"Use API Key instead",binaryPath:"Custom binary path",binaryPathPlaceholder:"Leave empty to use PATH",defaultArgs:"Default CLI arguments",defaultArgsPlaceholder:"e.g. --verbose",testConfig:"Test Configuration",testing:"Testing…",testConfigHint:"Sends a minimal request to verify credentials, API keys, and connectivity",timeout:"Timeout",timeoutUnit:"min",defaultModel:"Default model",defaultModelHint:"Leave empty to use tool's own default. Agent can override per invocation.",modelPlaceholder:"Select or type a model name…",noModelsFound:"Type a model name manually",modelsEmpty:"No models returned — CLI may be slow or need restart. You can type manually.",modelsFetchError:"Failed to fetch models — server may need restart after update",modelsLoading:"Fetching available models (may take a few seconds)…",modelsRetry:"Retry fetching models",useToolDefault:"Use tool default (no override)",budgetCap:"Session budget cap",budgetCapHint:"Hard limit enforced by Claude Code via --max-budget-usd",approvalRequired:"Require approval before use",approvalRequiredHint:"Agent must get user approval before each invocation of this tool",redetect:"Re-detect",detecting:"Detecting…",detectingTool:"Detecting…",saved:"Coding tools settings saved",failedToSave:"Failed to save coding tools settings",failedToLoad:"Failed to load coding tools settings",detectionRefreshed:"Tool detection refreshed",detectionFailed:"Tool detection failed",modelSourceApi:"via API",modelSourceCli:"via CLI",modelSourceStatic:"built-in",cursorApiKeyHint:"For the full model list, add a Cursor API Key from your <0>Dashboard</0>",cursorApiKeyNote:"Cursor API Key (Pro plan) — enables complete model list",cursorDashboardUrl:"https://cursor.com/dashboard/cloud-agents",recheckAuth:"Check now",testSuccess:"Configuration verified",testFailed:"Configuration test failed",testModel:"Model: {{model}}",testAuthVia:"Auth: {{source}}",testFailedHint:"Check your API key, endpoint URL, or CLI installation above",modelGuidanceCursor:"Models available in the Cursor CLI. Select 'auto' to let Cursor choose the best model automatically.",modelGuidanceClaude:"Standard models shown. Custom models can be typed manually.",modelGuidanceCodex:"Standard models shown. Custom models can be typed manually."},AA={title:QT,nav:ZT,appearance:JT,setupGuide:eA,systemStatus:tA,defaultProvider:nA,modelRouting:rA,modelPicker:aA,modelProviders:sA,networkProxy:iA,oauthAuth:oA,oauth:lA,autoDetect:cA,ollama:uA,envConfig:dA,agentExecution:mA,cognitive:fA,searchApi:pA,browserAutomation:hA,dataStorage:gA,oauthConnected:bA,authProfileDeleted:xA,browserOpened:yA,remoteAccess:vA,userManagement:wA,license:kA,account:SA,org:NA,feishu:CA,codingTools:TA},EA={title:"Welcome to Markus",subtitle:"Your AI workforce, ready in minutes",description:"Markus lets you build and run <strong>autonomous AI agent teams</strong> that collaborate, learn, and deliver results around the clock. Let's get you set up in a few quick steps."},_A={title:"Choose Your Theme",subtitle:"You can change this anytime in Settings",system:"System",systemDesc:"Follow your OS setting",light:"Light",lightDesc:"Always light background",dark:"Dark",darkDesc:"Warm charcoal, refined accents",cyberpunk:"Cyberpunk",cyberpunkDesc:"Neon pink, dark violet",mono:"Mono",monoDesc:"Pure black & white"},jA={title:"Configure LLM",subtitle:"Agents need an LLM to think and act",configured:"LLM provider configured",configuredHint:"You can manage providers anytime in Settings.",selectDefault:"Click to set the default model for agents:",default:"Default",fromEnv:"From Environment Variables",detectingKeys:"Detecting API keys...",noKeysFound:"No API keys found. Set <code>ANTHROPIC_API_KEY</code>, <code>OPENAI_API_KEY</code>, etc. in your <code>.env</code> file and restart.",applyProviders:"Apply {{count}} Provider(s)",or:"or",fromOpenClaw:"From OpenClaw",detectOpenClaw:"Detect OpenClaw Config",importModelConfigs:"Import Model Configs",noOpenClawFound:"No OpenClaw config found.",importedModels:"Imported {{count}} model configs",failedToApply:"Failed to apply",importFailed:"Import failed",skipForNow:"Skip for now",openClawFoundLabel:"Found:",openClawProviders:"({{count}} providers)",autoFallback:"Auto-switch model on failure",autoFallbackDesc:"Optional; off by default. When on, try other providers if the primary fails"},MA={title:"Web Search (Optional)",subtitle:"Give agents the ability to search the web",description:"Configure Markus hosted search or at least one search API key so agents can find real-time information.",serper:"Serper (Google)",tavily:"Tavily",bing:"Bing Web Search",google:"Google Custom Search",serpapi:"SerpAPI",brave:"Brave Search",exa:"Exa",bocha:"Bocha (博查)",apiKeyPlaceholder:"Paste API Key...",save:"Save Search Keys",saving:"Saving...",saved:"Search API keys configured",savedHint:"You can manage search API keys anytime in Settings.",failedToSave:"Failed to save",detectingKeys:"Detecting search API keys...",detected:"Detected from environment variables:",skipForNow:"Skip for now"},RA={title:"Set Up Your Profile",subtitle:"Tell us who you are",saved:"Profile saved",nameLabel:"Your Name",namePlaceholder:"Enter your name",emailLabel:"Email",emailPlaceholder:"your@email.com",newPasswordLabel:"New Password",newPasswordPlaceholder:"Set a secure password (min 6 characters)",confirmPasswordLabel:"Confirm Password",confirmPasswordPlaceholder:"Repeat your password",saveProfile:"Save Profile",errors:{nameRequired:"Please enter your name",emailRequired:"Please enter your email",emailInvalid:"Please enter a valid email address",passwordTooShort:"Password must be at least 6 characters",passwordMismatch:"Passwords do not match",saveFailed:"Failed to save profile. Please try again."}},LA={title:"You're All Set",subtitle:"Start building your AI workforce",chat:"Chat",chatDesc:"Talk to agents or use Smart Route to auto-delegate tasks",projects:"Projects",projectsDesc:"Create projects with requirements, tasks, and deliverables",builder:"Builder",builderDesc:"Hire new agents from templates or build custom roles",settings:"Settings",settingsDesc:"Manage LLM providers, integrations, and governance",telemetry:"Share anonymous usage data to help improve Markus",telemetryNote:"No code, prompts, or personal data is ever collected. You can change this in Settings at any time."},OA={title:"How will you use Markus?",subtitle:"This helps us tailor your experience.",personal:"Personal",personalDesc:"Individual use with your own AI agents.",organization:"Team & Enterprise",organizationDesc:"For teams sharing licenses and collaborating.",orgNameLabel:"Organization Name",orgNamePlaceholder:"Your team's name",defaultOrgName:"{{name}}'s Team",setOrgName:"Set Organization Name",orgNameSaved:"Saved",orgNameSaveFailed:"Could not save the organization name. Please try again.",pendingInvitations:"You have pending organization invitations",invitedBy:"Invited by: {{name}}",acceptAndJoin:"Accept & Join",accepting:"Joining...",accepted:"Joined",orCreateNew:"Or create a new organization"},DA="Get Started",IA={welcome:EA,theme:_A,llm:jA,search:MA,profile:RA,done:LA,usageType:OA,getStarted:DA},PA="Builder",zA="Hire agents, build teams, and create skills. Your Secretary handles the entire process — from sourcing to onboarding.",BA={hireAgent:"Hire an Agent",hireAgentDesc:"Hire from templates, create custom agents, or find specialists on Markus Hub",hireAgentExamples:["Hire a senior React developer","Create a custom code reviewer","Find a DevOps specialist on Hub"],hireAgentPrompt:"I need you to help me create or hire an agent: ",buildTeam:"Build a Team",buildTeamDesc:"Compose an optimal team for your project or deploy a team template",buildTeamExamples:["A web dev team with PM, devs, and QA","A data engineering squad","A content creation team"],buildTeamPrompt:"I need you to help me create or build a team for: ",createSkill:"Create a Skill",createSkillDesc:"Design new capabilities that agents can learn and use",createSkillExamples:["A Git changelog generator","A web scraping skill","A database migration tool"],createSkillPrompt:"I need you to help me create a skill: "},$A={title:"My Creations",subtitle:"Saved builder artifacts — install to deploy, or share to Markus Hub.",filterAll:"All",filterAgents:"Agents",filterTeams:"Teams",filterSkills:"Skills",loadingArtifacts:"Loading artifacts...",noArtifacts:"No artifacts found.",noArtifactsHint:"Use a builder above to create agents, teams, or skills.",openInBuilder:"Open in Builder"},HA={title:"Org Assets",noItems:"No assets found in this organization.",noOrgs:"You are not a member of any organization.",loading:"Loading...",by:"by"},UA="Unshare: remove from Markus Hub, keep local files",FA="Unshare",qA="Unshare",GA="Delete local files (does not remove the Hub listing)",VA="Delete local files",KA="Copy Hub link",WA="Confirm Delete",YA='Delete local files for "{{name}}"? This cannot be undone. The Hub listing is not removed automatically.',XA='Unshare "{{name}}" from Markus Hub? Others will no longer be able to download it. Local files are kept.',QA="Confirm Install",ZA='Install "{{name}}" into this organization? It will become available for your teams.',JA="Confirm Uninstall",eE='Uninstall "{{name}}"? Deployed instances will be removed from this organization. Local creation files are kept.',tE="Install failed: {{error}}",nE="Uninstall failed: {{error}}",rE="Share failed: {{error}}",aE="Failed to remove from Hub: {{error}}",sE={agent:"Agent",team:"Team",skill:"Skill",name:"Name",description:"Description",category:"Category",baseTemplate:"Base Template",agentRole:"Agent Role",llmProvider:"LLM Provider",llmModel:"LLM Model",requiredEnv:"Required Env",skills:"Skills",files:"Files ({{count}})",members:"Members ({{count}})"},iE={imagePrompt:"Would you like to add images before sharing? Images help attract more users on the Hub.",directly:"Share Directly",addImagesFirst:"Add Images First",toHub:"Share to Hub",sharing:"Sharing...",updating:"Updating...",updateVersion:"Update v{{version}}",viewOnHub:"View on Hub",submittedForReview:'Submitted for review. Only you can see it until a moderator approves it — others who open the link will see an "under review" page.',convertedSlug:'Package slug auto-converted from "{{previous}}" to "{{slug}}" (Chinese title kept as display name). You can rename the slug later if you want a more readable English id.',convertedAndSubmitted:'Package slug auto-converted from "{{previous}}" to "{{slug}}", then submitted for review. The Chinese title stays as the display name.',updateSubmitted:"Update submitted for review. The previously approved version stays public until the new version is approved.",underReview:"Under review",underReviewTip:"This item is waiting for moderator approval. Only you can see it for now.",rejected:"Rejected",rejectedTip:"A moderator rejected this item, so it is not publicly visible.",updateUnderReview:"Update under review",updateUnderReviewTip:"Your latest changes are awaiting approval. The previously approved version stays public."},oE={label:"Price",enableTips:"Let users send tips",reviewNote:"Public and link-only items are reviewed by a moderator before they become visible to others."},lE={title:"Choose Share Mode",titleUpdate:"Update Share Settings",free:"Free",freeDesc:"Anyone can download for free",donation:"Accept Donations",donationDesc:"Free download, users can optionally tip",paid:"Paid Download",paidDesc:"Users must pay to download",priceLabel:"Price (USD)",pricePlaceholder:"e.g. 4.99",update:"Update",share:"Share"},cE={label:"Share to the community",subtitle:"Choose who can see it and set a price. Public items are reviewed, then appear in the Markus 广场.",public:"Public",publicDesc:"Visible to everyone, appears in Hub search",org:"Organization",orgDesc:"Only visible to members of the selected organization",unlisted:"Link Only",unlistedDesc:"Not listed in search, accessible via link",orgSelect:"Select organization",orgNone:"No organizations found",shared:"Shared",sharedOrg:"Org",sharedUnlisted:"Link Only"},uE={contentModified:"Content has been modified. Consider updating the version number.",bumpVersion:"Bump Version",newVersion:"New version:"},dE={dropOrClick:"Drop images or click to upload",hint:"Screenshots, demos, or previews showing your artifact in action"},mE={backToBuilder:"Back to Builder",notFound:"Artifact not found",saving:"Saving...",saved:"Saved",saveFailed:"Save failed",edit:"Edit",overview:"Overview",untitled:"Untitled",addDescription:"Click to add a description...",typeTagAndEnter:"Type and press Enter",pasteEmojiOrUrl:"Paste emoji or image URL...",upload:"Upload"},fE={info:"Info",type:"Type",category:"Category",version:"Version",author:"Author",agentSpecs:"Agent Specs",role:"Role",provider:"Provider",model:"Model",temperature:"Temperature",composition:"Composition",totalMembers:"Total members",managers:"Managers",workers:"Workers",skillInfo:"Skill Info",alwaysOn:"Always On",skillFile:"Skill File",permissions:"Permissions",yes:"Yes",no:"No",dependencies:"Dependencies",skills:"Skills",environment:"Environment",openInFinder:"Open in Finder"},pE={title:PA,subtitle:zA,prompts:BA,myCreations:$A,orgAssets:HA,removeFromHubTooltip:UA,unshare:FA,confirmUnshare:qA,deleteLocalTooltip:GA,confirmDeleteLocal:VA,copyHubLinkTooltip:KA,confirmDelete:WA,deleteCannotUndo:YA,removeFromHub:XA,confirmInstall:QA,confirmInstallMsg:ZA,confirmUninstall:JA,confirmUninstallMsg:eE,installFailed:tE,uninstallFailed:nE,shareFailed:rE,hubDeleteFailed:aE,artifact:sE,share:iE,pricing:oE,shareMode:lE,visibility:cE,versionBump:uE,images:dE,detail:mE,sidebar:fE},hE="Community",gE={fromHub:"From Markus Hub",loading:"Loading item from Hub…",missing:"This Hub item could not be loaded. It may be private, removed, or Hub is unreachable.",install:"Install",installing:"Installing…",installed:"Installed",purchaseRequired:"Purchase required on Hub before installing",failed:"Install failed",dismiss:"Dismiss"},bE={discover:"Discover",agents:"Agents",teams:"Teams",skills:"Skills",connectors:"Connectors",installed:"Installed"},xE={title:"Markus Plaza",subtitle:"Discover agents, AI squads, skills and connectors shared by the community — an open ecosystem built by creators.",trending:"Trending",trendingSub:"Fastest-growing assets by downloads and ratings",fresh:"New arrivals",freshSub:"The latest work from creators",topCreators:"Top creators",topCreatorsSub:"Ecosystem contribution leaderboard",empty:"The ecosystem is growing",emptyHint:"Be one of the first creators — share your first asset"},yE={searchPlaceholder:"Search connectors (MCP)...",empty:"No connectors yet",emptyHint:"Connectors let agents plug into external tools and services (MCP)"},vE={title:"Agent Store",builtin:"Built-in",markusHub:"Markus Hub",searchPlaceholder:"Search agents...",loading:"Loading agents...",available:"{{count}} agent(s) available",noHub:"No agents found on Markus Hub",noHubHint:"Hub may be offline or empty. Check your network connection or hub URL configuration.",noResults:'No agents match "{{search}}"',noAgents:"No agents found",noResultsHint:"Try different search terms.",noAgentsHint:"Agents come from the built-in registry.",hireAgent:"Hire Agent",skills:"Skills",noSkills:"No required skills",roleConfig:"Role Configuration",role:"Role:",position:"Position:",starterTasks:"Starter Tasks"},wE={title:"Team Store",builtin:"Built-in",markusHub:"Markus Hub",searchPlaceholder:"Search teams...",loading:"Loading teams...",available:"{{count}} team(s) available",noHub:"No teams found on Markus Hub",noHubHint:"Hub may be offline or empty. Check your network connection or hub URL configuration.",noResults:'No teams match "{{search}}"',noTeams:"No teams available",noResultsHint:"Try different search terms.",noTeamsHint:"Go to the Builder page to create a team.",deployTeam:"Deploy Team",deploying:"Deploying...",teamComposition:"Team Composition",details:"Details",version:"Version:",author:"Author:",members:"Members:",agents:"{{count}} agents",tags:"Tags:",hasManager:"has manager"},kE={title:"Skill Store",tabs:{installed:"Installed",all:"Skills",builtin:"Built-in",skillhub:"SkillHub",skillssh:"skills.sh",markusHub:"Markus Hub"},searchInstalled:"Search installed skills...",skillCount:"{{count}} skill(s)",noInstalled:"No installed skills found.",noInstalledHint:"Browse SkillHub or skills.sh to discover and install skills.",builtinCount:"{{count}} built-in skill(s) available",refresh:"Refresh",loadingBuiltin:"Loading built-in skills...",noBuiltin:"No built-in skills found.",noBuiltinHint:"Built-in skills are provided in templates/skills/.",loadingSkillhub:"Loading SkillHub skills...",noSkillhub:"No matching skills found",skillhubTotal:"{{count}} skills total",allCategories:"All Categories",sortScore:"Comprehensive",sortDownloads:"Downloads",sortStars:"Stars",sortInstalls:"Installs",searchSkillhub:"Search SkillHub skills...",visitSite:"Visit site →",searchSkillssh:"Search skills.sh...",loadingSkillssh:"Searching skills.sh...",browseSkillssh:"Browse 84,000+ skills on skills.sh",browseSkillsshHint:"Top skills are loaded automatically. Search for specific skills above.",searchMarkusHub:"Search Markus Hub skills...",communitySkills:"Community skills from Markus Hub",loadingHub:"Loading from Hub...",noHub:"No skills found on Markus Hub",noHubHint:"Hub may be offline or empty. Check your network connection or hub URL configuration.",prevPage:"← Previous",nextPage:"Next →",pageInfo:"Page {{current}} / {{total}}",downloads:"downloads",autoDiscovered:"Auto-discovered by agents",uninstall:"Uninstall",details:"Details",category:"Category",version:"Version",integration:"Integration",instructions:"Instructions",permissions:"Permissions",tags:"Tags"},SE={install:"Install",installing:"Installing...",installed:"Installed",upgrade:"Upgrade → v{{version}}",upgrading:"Upgrading...",upgraded:"Upgraded!",failed:"Failed",purchaseRequired:"Purchase required",buy:"Buy",waitingPurchase:"Waiting for purchase...",buyOnHub:"Buy on Hub",view:"View →"},NE={title:"Installed Items",searchPlaceholder:"Search installed items...",noItems:"No installed items found.",noItemsHint:"Install agents, teams, or skills from the store.",loading:"Loading installed items...",filterAll:"All",filterAgents:"Agents",filterTeams:"Teams",filterSkills:"Skills",updateAvailable:"Update available",updateTo:"Update → v{{version}}",updating:"Updating...",updateSuccess:"Updated {{name}} to v{{version}}",updateFailed:"Failed to update {{name}}"},CE={searchPlaceholder:"Search templates...",noResults:"No templates found",install:"Install",installed:"Installed",hire:"Hire",category:"Category",allCategories:"All Categories",hubAgents:"Hub Agents",hubTeams:"Hub Teams",hubSkills:"Hub Skills",templates:"Templates",featured:"Featured",popular:"Popular",recent:"Recent"},TE={description:"Description",skills:"Skills",tools:"Tools",members:"Members",requirements:"Requirements",configuration:"Configuration"},AE={successTitle:"Installed Successfully!",successDesc:"{{name}} has been installed and is ready to use.",done:"Done",errorTitle:"Installation Failed",errorDesc:"Something went wrong. Please try again.",close:"Close",retry:"Retry",paidNote:"This is a paid item. You need to purchase it on the Hub before installing.",cancel:"Cancel",buyOnHub:"Buy on Hub",installing:"Installing...",install:"Install"},EE={title:"Hire Agent",creating:'Creating agent from "{{name}}"',agentName:"Agent Name",assignTeam:"Assign to Team (optional)",noTeam:"No team",agentConfig:"Agent Configuration",role:"Role:",position:"Position:",skills:"Skills:",none:"None",cancel:"Cancel",create:"Create Agent",creating_progress:"Creating..."},_E={title:hE,deepLink:gE,tabs:bE,discover:xE,connectorStore:yE,agentStore:vE,teamStore:wE,skillStore:kE,card:SE,installedTab:NE,marketplace:CE,detail:TE,installDialog:AE,hireModal:EE},jE={title:"Agent Profile",status:"Status",role:"Role",team:"Team",uptime:"Uptime",created:"Created",lastActive:"Last Active"},ME={overview:"Overview",mind:"Mind",activity:"Activity",memory:"Memory",tools:"Capabilities",settings:"Settings",files:"Files",skills:"Skills",heartbeat:"Heartbeat",deliverables:"Output"},RE={title:"Agent Mind",currentActivity:"Current Activity",attention:"Attention",focused:"Focused",deciding:"Deciding",reasoning:"Current reasoning",noActivity:"No current activity"},LE={title:"Activity Log",noActivity:"No activity recorded yet",timeline:"Timeline",thinking:"Thinking",toolCall:"Tool Call",message:"Message",error:"Error"},OE={title:"Memory",layers:{working:"Notebook",shortTerm:"Observations",longTerm:"Knowledge (MEMORY.md)",episodic:"Episodic Memory",semantic:"Semantic Memory"},noMemories:"No memories stored yet",clear:"Clear",clearConfirm:"Clear all memories in this layer?"},DE={title:"Tools",noTools:"No tools available",enabled:"Enabled",disabled:"Disabled"},IE={title:"Agent Settings",llmProvider:"LLM Provider",llmModel:"LLM Model",temperature:"Temperature",maxTokens:"Max Tokens",systemPrompt:"System Prompt",skills:"Skills"},PE={start:"Start",stop:"Stop",restart:"Restart",pause:"Pause",resume:"Resume",viewProfile:"View Profile",sendMessage:"Send Message"},zE={score:"Health Score",tokens:"Tokens Used",requests:"Requests",errors:"Errors",cost:"Estimated Cost"},BE={files:"Files",search:"Search",runtime:"Runtime",web:"Web",multimodal:"Multimodal",browser:"Browser",tasks:"Tasks",requirements:"Requirements",projects:"Projects",deliverables:"Output",packages:"Packages & Hub",communication:"Communication",memory:"Memory",mailbox:"Mailbox",planning:"Planning",teamManager:"Team Management",subagents:"Subagents",system:"System",llm:"LLM",other:"Other",mcp:"MCP: {{server}}"},$E=JSON.parse(`{"taskStatus":{"pending":"Pending","assigned":"Assigned","in_progress":"In Progress","completed":"Completed","failed":"Failed","cancelled":"Cancelled","review":"Review","approved":"Approved","rejected":"Rejected","draft":"Draft"},"loadingAgent":"Loading agent...","chat":"Chat","hub":"Hub","publishTitle":"Publish to Markus Hub","publishSuccess":"Published \\"{{name}}\\" to Markus Hub","publishFailed":"Failed to publish: {{error}}","badges":{"external":"External","manager":"Manager"},"never":"Never","emDash":"—","roles":{"managerDisplay":"★ Manager","workerDisplay":"◆ Worker","worker":"worker"},"overview":{"identity":"Identity","connectionStatus":"Connection Status","externalAgentDetails":"External Agent Details","syncContextTitle":"Sync Context (received every sync cycle)","gatewayEndpoints":"Gateway API Endpoints","recentTasks":"Recent Tasks","runtimeStatus":"Runtime Status","usage":"Usage","storage":"Storage","openFolder":"Open folder →","llmConfiguration":"LLM Configuration","recentHeartbeats":"Recent Heartbeats","recentA2A":"Recent A2A Communications","heartbeatRuns_one":"{{count}} run","heartbeatRuns_other":"{{count}} runs","conversations_one":"{{count}} conversation","conversations_other":"{{count}} conversations","labels":{"name":"Name","agentRole":"Agent Role","roleTemplate":"Role Template","markusAgentId":"Markus Agent ID","agentId":"Agent ID","organization":"Organization","created":"Created","connection":"Connection","platform":"Platform","activeTasks":"Active Tasks","lastSync":"Last Sync","externalAgentId":"External Agent ID","registered":"Registered","capabilities":"Capabilities","lastHeartbeat":"Last Heartbeat","status":"Status","tokensToday":"Tokens Today","totalTokens":"Total Tokens","requests":"Requests","toolCalls":"Tool Calls","promptTokens":"Prompt Tokens","completionTokens":"Completion Tokens","estCost":"Est. Cost","modelMode":"Model Mode","primaryModel":"Primary Model","fallback":"Fallback","maxTokensRequest":"Max Tokens/Request","maxTokensDay":"Max Tokens/Day","type":"Type","importance":"Importance"},"systemDefault":"System Default","custom":"Custom","systemDefaultShort":"◎ System Default","customShort":"⚙ Custom","followsSystemDefault":"follows system default ({{provider}})","systemDefaultParen":"(system default)","noneOption":"none","defaultValue":"default","unlimited":"unlimited","noneDeclared":"none declared","errorDetails":"Error Details","errorFallback":"Agent encountered an error. Check logs for more details.","recentError":"Recent Error (Recovered)","errorRecovered":"Agent has automatically recovered and is running normally.","currentlyWorking":"Currently Working","activeTasksCount_one":"{{count}} active task","activeTasksCount_other":"{{count}} active tasks","startAgent":"▶ Start","stopAgent":"⏹ Stop","openClaw":"OpenClaw"},"syncContext":{"assignedTasks":"Tasks with requirement & project traceability","inboxMessages":"Messages from teammates","teamContext":"Colleagues (id, name, role, status) + manager","projectContext":"Projects and active requirements"},"gateway":{"sync":"Exchange status, tasks, messages, team & project context","manual":"Download integration handbook (dynamic, includes colleagues & projects)","team":"Query team members, roles, and manager","projects":"List projects with governance","requirements":"Query requirements (filter by project/status)"},"filesTab":{"loading":"Loading files...","templateUpdateAvailable":"Template Update Available","filesDiffer_one":"{{count}} file differs from the {{templateId}} template:","filesDiffer_other":"{{count}} files differ from the {{templateId}} template:","syncing":"Syncing...","syncAll":"Sync All","sendToAgent":"Send to Agent","sendToAgentTitle":"Send the template changes to the agent for review via chat","agentConfigFiles":"Agent Configuration Files","templateLabel":"Template:","upToDate":" (up to date)","updatesAvailable":" (updates available)","customAgentNoTemplate":"Custom agent — no linked template","hideDiff":"Hide Diff","viewDiff":"View Diff","smartSyncTitle":"Use AI to intelligently merge template changes while preserving your customizations","merging":"Merging...","smartSync":"Smart Sync","overwriteTemplateTitle":"Overwrite with template content","syncThisFile":"Sync This File","undoMergeTitle":"Undo smart sync and restore previous content","undoMerge":"Undo Merge","unsaved":"unsaved","smartSyncResult":"Smart Sync Result","reviewAndSave":"— review and save to apply","roleMdHint":"Changes to ROLE.md will update the agent's runtime system prompt immediately.","noConfigFiles":"No configuration files found for this role","copyPath":"Copy path","pathCopied":"Copied","openInFinder":"Open in file browser","fileLabels":{"roleMd":"System Prompt / Role Definition","heartbeatMd":"Heartbeat Tasks","policiesMd":"Policies & Guardrails","contextMd":"Context & Instructions"}},"diff":{"title":"Diff: Current vs Template ({{templateId}})","showFullFile":"Show full file","showChangesOnly":"Show changes only","linesHidden":"··· {{count}} lines hidden ···","identical":"Files are identical"},"toolsTab":{"registeredCount":"{{count}} tools registered","noToolsRegistered":"No tools registered"},"skillsTab":{"alwaysOn":"always-on","builtIn":"built-in","installed":"installed","usesStats":"{{uses}} uses · {{successes}} successes","lastUsed":" · last {{date}}","loadingDetails":"Loading skill details…","toolsHeading":"Tools ({{count}})","detailsUnavailable":"Skill details not available (skill may not be registered in the store)","installedCount":"{{count}} skills installed — descriptions auto-injected into agent context","noSkills":"No skills installed","byAuthor":"by {{author}}"},"memoryTab":{"loading":"Loading memory...","loadFailed":"Failed to load memory data","recent":"Recent ({{count}})","sessions":"Sessions ({{count}})","dailyLogs":"Daily Logs","longTerm":"Long-term","recentEntries":"Recent Memory Entries","noEntries":"No memory entries","chatSessions":"Chat Sessions","noSessions":"No sessions","msgs":"msgs","loadingMessages":"Loading messages...","noMessagesInSession":"No messages in this session","longTermTitle":"Long-term Memory","noDailyLogs":"No daily logs","noLongTerm":"No long-term memory stored","roles":{"user":"user","system":"system","assistant":"assistant"},"userEditedSource":"User-edited"},"heartbeatTab":{"loading":"Loading heartbeat data...","noData":"No heartbeat data available","scheduler":"Rhythm & Schedule","triggering":"Triggering...","triggerNow":"Trigger Now","interval":"Interval","safetyNetInterval":"Safety-net interval","intervalMinutes_one":"{{count}} min","intervalMinutes_other":"{{count}} min","intervalHours_one":"{{count}} hour","intervalHours_other":"{{count}} hours","intervalCustom":"Custom…","intervalCustomUnit":"minutes","intervalSave":"Save","intervalSaving":"Saving…","intervalRangeHint":"Allowed range: 5 min – 24 h.","lastRun":"Last Run","nextRun":"Next Run","nextWake":"Next Wake","rhythmHint":"The agent schedules precise follow-ups with wakeups; the safety-net interval is only a coarse fallback patrol.","running":"Running","stopped":"Stopped","pending":"Pending","wakeupsTitle":"Scheduled Wakeups","wakeupsCount_one":"{{count}} wakeup","wakeupsCount_other":"{{count}} wakeups","wakeupNoNote":"(no note)","recurring":"recurring","deliveryInSession":"in-session","deliveryMailbox":"mailbox","cancelWakeup":"Cancel","pendingOpsTitle":"Pending Async Operations","pendingOpsCount_one":"{{count}} in flight","pendingOpsCount_other":"{{count}} in flight","timesOut":"times out","callbackType":{"background_exec":"Background process","a2a_reply":"Awaiting agent reply","wakeup":"Wakeup"},"lastSummary":"Last Heartbeat Summary","recentRuns":"Recent Runs","runsThisSession_one":"{{count}} run this session","runsThisSession_other":"{{count}} runs this session","actionsCount_one":"{{count}} action","actionsCount_other":"{{count}} actions","noRunsYet":"No heartbeat runs yet this session.","firstHeartbeatSoon":"First heartbeat will trigger in ~{{when}}.","schedulerStopped":"Heartbeat scheduler is stopped.","runFirstNow":"Run First Heartbeat Now","soon":"soon"},"relative":{"inSeconds":"in {{count}}s","inMinutes":"in {{count}}m","inHours":"in {{hours}}h","secondsAgo":"{{count}}s ago","minutesAgo":"{{count}}m ago","hoursAgo":"{{hours}}h ago"},"taskLog":{"loading":"Loading...","noLogs":"No execution logs yet."},"activityLog":{"loading":"Loading...","noLogs":"No activity logs available."},"mind":{"loading":"Loading agent mind state...","idleWaiting":"Idle — waiting for new mail","queuedButIdle":"Queue has {{count}} item(s) — attention loop should pick them up…","decidingWaiting":"Deciding which item to process ({{count}} queued)…","deliberationInProgress":"Deliberation in progress","since":"since {{time}}","refresh":"↻ Refresh","pauseBtn":"Pause","continueBtn":"Continue","cancelCurrentBtn":"Cancel","cancelConfirmTitle":"Cancel Processing","cancelConfirmMessage":"Are you sure you want to cancel this task? The agent will stop processing immediately.","queue":"Queue ({{count}})","expandQueue":"Show {{count}} more…","collapseQueue":"Collapse","staleProcessingWarning":"Stale processing items detected (agent is idle)","agentDetails":"Agent Details","triageDecision":"Triage Decision","processingItem":"Processing: {{id}}…","deferred":"Deferred: {{count}}","dropped":"Dropped: {{count}}","inlineCompleted":"Inline Completed: {{count}}","mailboxHistory":"Mailbox History","noHistory":"No mailbox history yet","loadEarlier":"Load Earlier...","decisions":"Decisions","activityHeading":"Activity — {{label}}","success":"✓ Success","failed":"✗ Failed","processing":"Processing...","noActivityLog":"No activity log recorded","from":"From:","tokensCount":"{{count}} tokens","toolsCount":"{{count}} tools","categoryFilters":{"all":"All","interaction":"Interaction","task":"Task","notification":"Notification","system":"System"},"statusFilters":{"all":"All","queued":"Queued","processing":"Processing","completed":"Completed","merged":"Merged","deferred":"Deferred","dropped":"Dropped"},"activityFilters":{"all":"All","task":"Task","chat":"Chat","heartbeat":"Heartbeat","a2a":"A2A","internal":"Internal","respond_in_session":"Session"},"priority":{"0":"Critical","1":"High","2":"Normal","3":"Low","4":"Background"},"attention":{"idle":"IDLE","focused":"FOCUSED","deciding":"DECIDING"},"mailbox":{"commentFrom":"Comment from {{name}}","commentFromAuthor":"{{author}}: {{text}}","humanChat":"Human Chat","chatFrom":"Chat from {{sender}}","agentMessage":"Agent Message","messageFrom":"Message from {{sender}}","mentionedBy":"Mentioned by {{name}}","mention":"Mention","reviewRequestFrom":"Review request from {{sender}}","reviewRequest":"Review Request","replyInSession":"Reply in session ({{sender}})","sessionReply":"Session Reply","scheduledHeartbeat":"Scheduled heartbeat check-in","dailyReport":"Daily Report","memoryConsolidation":"Memory Consolidation","systemAnnouncement":"System Announcement","systemEvent":"System Event","statusArrow":"{{from}} → {{to}}"}}}`),HE={empty:"No deliverables yet",emptyHint:"Deliverables created by this agent will appear here",count:"{{count}} deliverable(s)",summary:"Summary",reference:"Reference",format:"Format",created:"Created",updated:"Updated",accessed:"Accessed {{count}} time(s)",openInPage:"Open in Output"},UE={profile:jE,tabs:ME,mind:RE,activity:LE,memory:OE,tools:DE,settings:IE,actions:PE,health:zE,toolCategories:BE,profilePage:$E,deliverables:HE},FE="Output",qE="+ Create",GE="Search deliverables...",VE={allTypes:"All types",allProjects:"All projects",active:"Active",verified:"Verified",outdated:"Outdated",group:"Group:",clearAll:"Clear all",filtersLabel:"Filters",refreshing:"Refreshing..."},KE={date:"Date",project:"Project",team:"Team",agent:"Agent"},WE="▶ Expand",YE="▼ Collapse",XE="Expand all",QE="Collapse all",ZE="Flagged as outdated",JE="Removed",e9={agent:"Agent",team:"Team",skill:"Skill"},t9={title:"No deliverables yet",subtitle:"Deliverables are automatically created when agents complete tasks",goToWork:"Go to Tasks",noResults:"No matching deliverables",noResultsHint:"Try adjusting your search or filters"},n9={selectToView:"Select a deliverable to view details",keyboardHint:"Use ↑↓ arrow keys to navigate, ⌘F to search",details:"Details",verify:"Verify",flagOutdated:"Flag Outdated",flagging:"Flagging...",openInBuilder:"Open in Builder",builderWithType:"Builder {{type}}",noContent:"No content",cannotPreview:"This {{type}} cannot be previewed in the browser.",loadingPreview:"Loading preview...",artifactDirectory:"Artifact Directory",copyFailed:"Copy failed — try long-pressing to copy manually",failedToOpen:"Failed to open",failedToOpenBrowser:"Failed to open file browser",openInFileBrowser:"Open in file browser",revealInFinder:"Reveal in Finder",copyPath:"Copy path to clipboard",fileMissing:"Referenced file no longer exists on disk",confirmRemoveTitle:"Remove deliverable",confirmRemoveMessage:'"{{name}}" will be removed. This action cannot be undone.',openUrl:"Open in New Tab",edit:"Edit",preview:"Preview",save:"Save",saving:"Saving...",saved:"Saved",saveFailed:"Save failed",unsavedTitle:"Unsaved Changes",unsavedMessage:"You have unsaved changes. Do you want to save before leaving?",discard:"Discard",saveAndLeave:"Save"},r9={title:"Diff Stats",files:"{{count}} files"},a9={title:"Tests",passed:"{{count}} passed",failed:"{{count}} failed",skipped:"{{count}} skipped"},s9={title:"Links",task:"Task: {{id}}",agent:"Agent: {{name}}",project:"Project: {{name}}"},i9={created:"Created:",updated:"Updated:",accessed:"Accessed:",id:"ID: {{id}}"},o9="No Project",l9="No Team",c9={title:"Create Deliverable",type:"Type",titleField:"Title",titleRequired:"Title is required",titlePlaceholder:"Clear, searchable title",reference:"Reference",referenceHint:"file path, URL, branch name",referencePlaceholder:"/path/to/file or https://...",summary:"Summary",summaryHint:"Markdown",summaryPlaceholder:"Describe the deliverable...",tags:"Tags",tagsHint:"comma separated",tagsPlaceholder:"react, api, docs",project:"Project",created:"Deliverable created",required:"*"},u9={partial:"{{loaded}} / {{total}} deliverables",total:"{{total}} deliverables"},d9={collapse:"Collapse sidebar",expand:"Expand sidebar"},m9={openChat:"Chat with agent",closeChat:"Close chat",placeholder:"Message agent...",currentDeliverable:"Current deliverable",selectedFrom:"Selected from"},f9={addToConversation:"Add to conversation"},p9={title:"Share to Markus Hub",needHubLogin:"You need to sign in to your Markus Hub account to share this deliverable.",loggingIn:"Opening sign-in…",loginHub:"Sign in to Markus Hub",loginHint:"Unlock one-click public / link sharing for your deliverables.",visibility:"Visibility",public:"Public (visible to everyone + search engines)",publicHint:"Public deliverables are published after Hub review; then visible to all and indexed",publicVisibility:"Public",link:"Anyone with the link",linkHint:"Only people with the link can view; not indexed; also requires Hub review",linkVisibility:"Link-only",titleField:"Title",titlePlaceholder:"A clear, searchable title",summary:"Summary",summaryPlaceholder:"Briefly describe this deliverable…",tags:"Tags",tagsPlaceholder:"Type a tag and press Enter",shareToHub:"Share to Hub",sharing:"Sharing…",published:"Published",pendingReview:"Under review",pendingHint:"Your deliverable has been submitted for review. A shareable link will be generated once approved.",rejected:"Rejected",revoked:"Sharing removed; this deliverable is no longer publicly accessible.",resubmit:"Resubmit",shareAgain:"Share again",revoke:"Remove sharing",urlPending:"Generating link… refresh shortly to view"},h9={justNow:"just now",minutesAgo:"{{count}}m ago",hoursAgo:"{{count}}h ago",yesterday:"yesterday",daysAgo:"{{count}}d ago",monthsAgo:"{{count}}mo ago",yearsAgo:"{{count}}y ago"},g9={title:FE,create:qE,searchPlaceholder:GE,filters:VE,groupBy:KE,expandAll:WE,collapseAll:YE,expandAllTooltip:XE,collapseAllTooltip:QE,flaggedOutdated:ZE,removed:JE,artifactTypes:e9,empty:t9,detail:n9,diffStats:r9,testResults:a9,links:s9,metadata:i9,noProject:o9,noTeam:l9,createModal:c9,count:u9,sidebar:d9,chat:m9,contextMenu:f9,share:p9,time:h9},b9="Reports",x9={dashboard:"Dashboard",history:"History"},y9={tasksCompleted:"Tasks Completed",ofTotal:"of {{total}} total",activeContributors:"Active Contributors",agentsAndHumans:"{{agents}} agents · {{humans}} humans",cuConsumed:"CU Consumed",tokensConsumed:"Tokens Used",todayAmount:"Today: {{amount}}",successRate:"Success Rate",healthScore:"Health: {{score}}/100"},v9={title:"Cloud AI",personalLimitLabel:"Personal Limit",personalLimit:"Your organization admin has set a personal credit limit for you.",notConnected:"Not connected to Markus Hub",connect:"Connect",bonus:"Bonus: {{amount}}",resetsAt:"Resets {{date}}",topUp:"Top Up",windowQuota:"5h window: {{amount}} CU (upgradable)",windowUsageLabel:"5h window usage",windowQuotaNone:"5h window: not enforced",rateLimit:"No Markus request-frequency cap; upstream model providers may still rate-limit"},w9={title:"Agent Rankings",noData:"No agent data yet. Start agents to see their activity here.",name:"Agent",team:"Team",tasks:"Tasks",cuUsed:"CU Used",tokens:"Tokens",efficiency:"Efficiency",total:"Total ({{count}} agents)",mixedProviders:"Mixed providers — CU only tracks Cloud AI",showAll:"Show all {{count}}",showLess:"Show less"},k9={title:"Team Members",name:"Name",role:"Role",team:"Team"},S9={title:"Team Performance",members:"{{agents}}A · {{humans}}H",tasks:"Tasks",cuUsed:"CU",tokens:"Tokens",managedBy:"Managed by {{name}}"},N9={title:"Usage Trends",byDay:"By Day",byHour:"By Hour",days:"days",totalCredits:"Credits Used",totalTokens:"Tokens Used",totalRequests:"Requests",creditsChart:"Credits",tokensChart:"Tokens",max:"Max",noData:"No usage data yet. Connect to Markus Hub to see trends.",models:"Models"},C9={planPending:"Plan pending",planStatus:"Plan {{status}}",taskMetrics:"Task Metrics",metric:{completed:"Completed",inProgress:"In Progress",created:"Created",blocked:"Blocked",failed:"Failed"},costOverview:"Cost Overview",totalTokens:"Total Tokens",cuUsed:"CU Used",trend:"Trend",taskSummary:"Task Summary",completedCount:"Completed ({{count}})",inProgressCount:"In Progress ({{count}})",blockedCount:"Blocked ({{count}})",noTasks:"No tasks in this period.",highlights:"Highlights",blockers:"Blockers",upcomingPlan:"Upcoming Plan",approvePlan:"Approve Plan",rejectPlan:"Reject Plan",rejectionReason:"Rejection reason:",planApproved:"Plan approved",planRejected:"Plan rejected",noDetailedMetrics:"This report does not contain detailed metrics data.",feedbackTitle:"Feedback ({{count}})",feedbackPlaceholder:"Add feedback or instructions…",feedbackAdded:"Feedback added"},T9="No reports generated yet.",A9="{{type}} Report",E9="← Back to list",_9={title:b9,tabs:x9,kpi:y9,quota:v9,agents:w9,humans:k9,teamPerf:S9,trends:N9,history:C9,noReportsYet:T9,reportType:A9,backToList:E9},j9={alex:{name:"Alex Chen"},sarah:{name:"Sarah Liu"},james:{name:"James Wang"},emily:{name:"Emily Zhang"},michael:{name:"Michael Li"}},M9={secretary:{name:"Secretary",role:"Executive Coordinator",activity:"Orchestrating daily operations"},chiefOfStaff:{name:"Chief of Staff",role:"Cross-team Coordinator",activity:"Cross-team coordination"},strategyAnalyst:{name:"Strategy Analyst",role:"Competitive Intelligence",activity:"Competitive intelligence"},engLead:{name:"Engineering Lead",role:"Engineering Manager",activity:"Sprint planning & code review"},srBackend:{name:"Senior Backend Dev",role:"Backend Engineer",activity:"Building payment API"},backend:{name:"Backend Developer",role:"Backend Engineer",activity:"Database migration"},srFrontend:{name:"Senior Frontend Dev",role:"Frontend Engineer",activity:"Dashboard redesign"},frontend:{name:"Frontend Developer",role:"Frontend Engineer",activity:"Component library"},mobile:{name:"Mobile Developer",role:"Mobile Engineer",activity:"Waiting for API"},devops:{name:"DevOps Engineer",role:"Infrastructure Engineer",activity:"CI/CD pipeline"},qaLead:{name:"QA Lead",role:"Quality Assurance Manager",activity:"Test automation"},qaEng:{name:"QA Engineer",role:"Quality Assurance",activity:"Regression testing"},security:{name:"Security Auditor",role:"Security Engineer",activity:"Weekly scan scheduled"},pm:{name:"Product Manager",role:"Product Management",activity:"Sprint planning"},uxResearcher:{name:"UX Researcher",role:"User Experience",activity:"Interview synthesis"},uiDesigner:{name:"UI Designer",role:"Visual Design",activity:"Design system update"},dataAnalyst:{name:"Data Analyst",role:"Business Intelligence",activity:"Funnel analysis"},researchLead:{name:"Research Lead",role:"Research Director",activity:"Competitive landscape"},mlEngineer:{name:"ML Engineer",role:"Machine Learning",activity:"Model fine-tuning"},researchAnalyst:{name:"Research Analyst",role:"Research & Analysis",activity:"Patent analysis"},techWriter:{name:"Technical Writer",role:"Documentation",activity:"API documentation"},contentLead:{name:"Content Lead",role:"Content Strategy",activity:"Editorial calendar"},seo:{name:"SEO Specialist",role:"Search Optimization",activity:"Keyword research done"},socialMedia:{name:"Social Media Manager",role:"Social & Growth",activity:"Campaign scheduling"},copywriter:{name:"Copywriter",role:"Content Creation",activity:"Landing page copy"},hr:{name:"HR Coordinator",role:"Human Resources",activity:"Onboarding docs ready"},legal:{name:"Legal & Compliance",role:"Legal Affairs",activity:"Privacy review done"},finance:{name:"Finance Analyst",role:"Financial Analysis",activity:"Monthly report"}},R9={engineering:{name:"Core Engineering",desc:"Backend, frontend, mobile, DevOps, QA, and security"},productDesign:{name:"Product & Design",desc:"Product management, UX research, UI design, and data analysis"},research:{name:"Research & AI",desc:"Research, ML engineering, and technical documentation"},content:{name:"Content & Growth",desc:"Content strategy, SEO, social media, and copywriting"},operations:{name:"Operations",desc:"HR, legal, compliance, and finance"},projectAlpha:{name:"Project Alpha",desc:"Cross-functional sprint team for payment platform launch"}},L9={payment:{name:"Payment Platform v2",desc:"Complete payment infrastructure with Stripe, PayPal, and crypto support"},dashboard:{name:"Dashboard Redesign",desc:"Modern analytics dashboard with real-time data visualization"},research:{name:"Q2 Market Research",desc:"Competitive landscape analysis and market positioning"},mobile:{name:"Mobile App MVP",desc:"Cross-platform mobile application with core features"},securityAudit:{name:"Security Audit Q1",desc:"Comprehensive security audit and vulnerability assessment"}},O9={paymentWebhook:"Implement Stripe & PayPal webhook endpoints",dbSchema:"Design payment transaction database schema",userResearch:"Synthesize 24 user interviews into insight report",competitorReport:"Q2 competitive landscape analysis across 12 players",cicdSetup:"Set up 6-stage CI/CD pipeline with canary deploys",designTokens:"Export design system tokens: 42 colors, 8 spacing scales",authFlow:"Implement OAuth 2.0 + API key authentication flow",loadTesting:"Build load testing harness for 10K concurrent users",seoMatrix:"Research 1,200+ keywords across 8 product verticals",privacyDraft:"Draft GDPR-compliant privacy policy for EU launch",q1Finance:"Compile Q1 financial summary with departmental P&L",testFramework:"Build end-to-end test framework with Playwright",paymentReconciliation:"Build payment reconciliation API with idempotency",dashboardCharts:"Implement interactive chart components with D3.js",mobileOnboarding:"Design & build 5-step mobile onboarding experience",mlPipeline:"Set up fraud detection model training pipeline",rateLimiting:"Implement API rate limiting at 1,000 req/min",editorialCalendar:"Plan Q3 editorial calendar across 4 content channels",funnelAnalysis:"Analyze user funnel: signup → activation → retention",componentDocs:"Write documentation for 47 React UI components",regressionSuite:"Expand regression suite to 312 test cases",socialCampaign:"Create 60+ assets for product launch campaign",idempotency:"Add idempotency key validation to all write endpoints",landingMockup:"Redesign landing page with 8 high-fidelity screens",patentReport:"Analyze 847 patents in AI workflow automation space",apiDocsV2:"Write developer portal docs for 86 API endpoints",monthlyFinance:"Prepare May monthly financial close report",securityScan:"Automate weekly OWASP Top 10 security scans",disputeHandling:"Build payment dispute workflow with Stripe API",darkMode:"Implement dashboard dark mode with theme switching",pushNotifications:"Build push notification service with FCM/APNs",abTesting:"Set up A/B testing framework with feature flags",blogAiWorkforce:"Write blog post: 'The AI-Native Workforce Revolution'",offlineMode:"Implement offline-first data sync for mobile app",perfBenchmarks:"Run performance benchmarks: API p99, FCP, TTI",emailOnboarding:"Design 5-email onboarding sequence with analytics",mobilePayment:"Integrate Stripe SDK into React Native payment flow",deepLinking:"Implement universal links & deep linking for iOS/Android",legacyMigration:"Legacy data migration script",legacyMigrationError:"Schema mismatch — legacy field types incompatible"},D9={paymentWebhook:"Handle incoming Stripe/PayPal webhook events. Validate signatures, parse event payloads, update transaction status in DB, and trigger downstream reconciliation workflows.",dbSchema:"Design normalized schema for transactions, settlements, and disputes. Support multi-currency, partial refunds, and audit trail with created_at/updated_at timestamps.",userResearch:"Synthesize findings from 24 user interviews across 4 personas. Produce affinity diagrams, key insight cards, and prioritized recommendation matrix.",competitorReport:"Deep-dive analysis of 12 competitors across 5 market segments. Feature comparison matrix, pricing analysis, and strategic recommendations.",cicdSetup:"Configure GitHub Actions pipeline: lint → test → build → canary (5%) → production. Include Cosign image signing and SBOM generation.",designTokens:"Export Figma design tokens to CSS custom properties and Tailwind config. Cover colors, spacing, typography, shadows, and border-radius scales.",authFlow:"Implement OAuth 2.0 authorization code flow with PKCE, API key authentication, and JWT token rotation with configurable TTL.",loadTesting:"Build k6 load testing harness simulating 10K concurrent users across payment, dashboard, and auth endpoints. Output Grafana-compatible metrics.",seoMatrix:"Research 1,200+ keywords across 8 verticals. Score by search volume, difficulty, and intent. Map to content calendar with projected traffic impact.",privacyDraft:"Draft privacy policy covering data collection, processing, retention, and deletion. Align with GDPR Articles 13-14 and CCPA requirements.",q1Finance:"Compile Q1 financial summary: revenue $6.8M, gross margin 76%, departmental P&L breakdown, and cash flow forecast through Q3.",testFramework:"Build end-to-end test framework with Playwright. Cover API, UI, and visual regression. Parallel execution across 4 workers with Slack reporting.",paymentReconciliation:"Build reconciliation engine matching incoming transactions to expected payments. Handle partial matches, timing discrepancies, and currency conversion.",dashboardCharts:"Implement 6 chart types (line, bar, pie, area, scatter, heatmap) using D3.js. Support responsive sizing, tooltips, drill-down, and data export.",mobileOnboarding:"Design and implement 5-step onboarding: welcome → profile → permissions → tutorial → dashboard. Track completion rate per step.",mlPipeline:"Set up MLflow pipeline for fraud detection: data ingestion → feature engineering → model training → evaluation → A/B deployment manifest.",rateLimiting:"Implement sliding-window rate limiting with Redis. 1,000 req/min per API key, burst allowance 2,000, with graceful 429 responses.",editorialCalendar:"Plan Q3 content across blog, social, newsletter, and docs. Map to product launches, seasonal trends, and SEO opportunities.",funnelAnalysis:"Analyze conversion funnel from signup to paid: identify top 3 drop-off points, segment by source/device, recommend optimizations.",componentDocs:"Generate interactive documentation for 47 React components using Storybook. Include prop tables, accessibility audit, and bundle size impact.",regressionSuite:"Expand regression suite to 312 test cases across 8 modules. Fix 5 flaky tests, add retry logic, achieve 98.4% pass rate.",socialCampaign:"Create 60+ assets for product launch: carousels, video storyboards, A/B headlines. Size for LinkedIn, Twitter/X, and Instagram.",idempotency:"Add idempotency key validation to all write endpoints. Store keys in Redis with 24h TTL, return cached response on duplicate requests.",landingMockup:"Redesign landing page: hero section, feature showcase, social proof, pricing. 8 high-fidelity screens with mobile-responsive variants.",patentReport:"Analyze 847 patents across AI workflow automation. Map claims to our features, identify FTO risks, and whitespace for IP filing.",apiDocsV2:"Write developer docs for 86 endpoints with code examples in Python, Node, Go, Ruby, and cURL. Include auth guide and webhook setup.",monthlyFinance:"Prepare May close: revenue $2.4M (+18% MoM), SaaS ARR $24M milestone, CAC payback 11 months, gross margin 78%.",securityScan:"Automate OWASP Top 10 scanning via ZAP + Semgrep in CI. Generate weekly security dashboard with remediation priority queue.",disputeHandling:"Build dispute lifecycle: open → evidence → arbitration → resolved. Integrate Stripe Disputes API and auto-generate response templates.",darkMode:"Implement system-aware dark mode with CSS custom properties. Support manual toggle with localStorage persistence.",pushNotifications:"Build push service with FCM (Android) and APNs (iOS). Topic-based subscriptions, rich notifications, and delivery analytics.",abTesting:"Set up A/B testing with LaunchDarkly feature flags. Server-side bucketing, conversion tracking, and statistical significance calculator.",blogAiWorkforce:"Write 2,500-word blog post on the AI-native workforce paradigm. Cover autonomous agents, self-organizing teams, and real-world ROI.",offlineMode:"Implement offline-first architecture using IndexedDB + background sync. Queue mutations locally, resolve conflicts on reconnect.",perfBenchmarks:"Benchmark API p99 latency (target: <200ms), FCP (<1.5s), TTI (<3s). Compare against baseline and generate regression alerts.",emailOnboarding:"Design 5-email drip sequence: welcome → key features → tips → case study → upsell. Track open rate, CTR, and conversion.",mobilePayment:"Integrate Stripe React Native SDK. Support Apple Pay, Google Pay, card entry, and 3D Secure. Handle edge cases for poor connectivity.",deepLinking:"Configure universal links (iOS) and app links (Android). Route deep links to specific screens with fallback to web."},I9={stripePaypal:"Payment Platform v2 must support Stripe, PayPal, and crypto",dashboardPerf:"Dashboard must load in under 2s on 3G",openApiDocs:"All API endpoints must have OpenAPI docs",offlineCore:"Mobile app must work offline for core features",gdpr:"GDPR compliance for all user data",monthlyReport:"Monthly executive report by the 5th",competitiveQuarterly:"Competitive analysis updated quarterly",paymentSla:"99.9% uptime SLA for payments"},P9={stripePaypal:"Integrate Stripe and PayPal payment gateways with full lifecycle support: authorization, capture, refunds, disputes, and webhook-driven status updates. Crypto via Coinbase Commerce as phase 2.",dashboardPerf:"All dashboard views must achieve First Contentful Paint <1.5s and Time to Interactive <2s on simulated 3G. Implement code splitting, lazy loading, and edge caching.",openApiDocs:"Every public and internal API endpoint must have a complete OpenAPI 3.1 spec with request/response schemas, auth requirements, rate limits, and code examples in 5 languages.",offlineCore:"Core features (task viewing, message drafting, deliverable browsing) must work offline using IndexedDB. Queue writes locally and sync on reconnect with conflict resolution.",gdpr:"All user data processing must comply with GDPR Articles 5-9. Implement data subject access requests, right to erasure, data portability, and consent management.",monthlyReport:"Automated monthly executive report covering revenue, agent efficiency, task metrics, and system health. Delivered to all founders by the 5th of each month.",competitiveQuarterly:"Comprehensive competitive analysis covering market positioning, feature parity, pricing strategy, and emerging threats. Updated every quarter with actionable recommendations.",paymentSla:"Payment processing endpoints must maintain 99.9% uptime SLA. Implement multi-region failover, circuit breakers, and automated incident response."},z9={paymentApiSpec:"Payment API v2 — OpenAPI Spec",dashboardMockups:"Dashboard Redesign Mockups",q2Report:"Q2 Competitive Landscape Report",cicdConfig:"CI/CD Pipeline Configuration",componentDocs:"Component Library Documentation",securityReport:"Security Audit Report Q1",mlResults:"ML Model Training Results",seoMatrix:"SEO Keyword Research Matrix",financeReport:"Monthly Financial Report — May",apiDocsV2:"API Documentation v2",interviewNotes:"User Research Interview Notes",wireframes:"Mobile App Wireframes",patentAnalysis:"Patent Landscape Analysis",testFramework:"Test Automation Framework",socialAssets:"Social Media Campaign Assets"},B9={paymentApiSpec:`### Payment Reconciliation API v2
20
20
 
21
21
  OpenAPI 3.1 specification covering the full payment lifecycle.
22
22
 
@@ -188,7 +188,7 @@ Production-ready model with SOTA performance.
188
188
  `,done:"完成"},deleteTeam:{confirmTitle:"删除「{{name}}」?",message:"该团队将从数据库中移除。勾选下方选项可同时删除成员与磁盘文件。",deleteMembers:"同时删除团队内所有成员",purgeFiles:"同时删除磁盘文件(工作区、记忆、日志)"},removeFromTeam:{title:"移出团队?",message:"该成员将移至「未分组」。"},removeAgent:{confirmTitle:"移除「{{name}}」?",message:"该智能体将从数据库中移除。勾选下方选项可同时删除其工作区、记忆及其他磁盘文件。",purgeFiles:"同时删除磁盘文件(工作区、记忆、日志)"},removeHuman:{message:"该用户将失去访问权限。",confirmTitle:"移除「{{name}}」?"},pauseAll:{title:"暂停所有智能体",message:"所有智能体将暂停。事件仍会进入邮箱但不会处理。进行中的任务将被阻塞。"},resumeAll:{title:"恢复所有智能体",message:"所有智能体将恢复处理邮箱中的事件。"},createGroupChat:{title:"创建群聊",subtitle:"添加智能体和成员一起聊天",groupNamePlaceholder:"群组名称…",searchPlaceholder:"搜索成员…",noMembersFound:"未找到成员",selected:"已选 {{count}} 个",creating:"创建中…",create:"创建"},deleteGroupChat:{title:"删除群聊?",message:"删除「{{name}}」及其所有消息?",confirm:"删除",menuLabel:"删除群聊"}},DM={bellTitle:"通知",approvals:"审批",notifications:"通知",noApprovals:"暂无审批请求",noNotifications:"暂无通知",markAllRead:"全部标为已读",confirmReject:"确认拒绝",rejectReasonPlaceholder:"拒绝原因(可选,按 Enter 提交)",freeformPlaceholder:"或输入你的意见…",commentPlaceholder:"附加意见(可选)",needsAdjustment:"需调整",adjustmentPlaceholder:"请输入调整建议…",confirmAdjustment:"提交调整建议",actionHints:{openChat:"打开聊天 →",viewDetails:"查看详情 →",viewTask:"查看任务 →",viewRequirement:"查看需求 →",viewAgent:"查看智能体 →",viewApproval:"查看审批 →"},approvalType:{task:"任务",requirement:"需求",requirementResubmit:"需求(重新提交)",taskReview:"任务审核",toolExecution:"工具执行"},approvalHistory:"历史记录"},IM={respond:"回复",submit:"提交",submitted:"已提交",next:"下一题",previous:"上一题",questionProgress:"第 {{current}} / {{total}} 题",textPlaceholder:"输入你的回答…",freeformPlaceholder:"或自行填写答案…"},PM={secretary:"我刚装好 Markus,帮我上手吧——这里能做什么?",agent:"介绍一下你自己——你能做什么?"},zM={succeeded:"{{count}} 个智能体 {{action}}",failed:"{{action}}:{{ok}} 成功,{{fail}} 失败",moveFailed:"移动失败:{{error}}",failedToRun:"{{action}} 失败:{{error}}",past:{start:"已启动",stop:"已停止",pause:"已暂停",resume:"已恢复"},operation:{start:"启动",stop:"停止",pause:"暂停",resume:"恢复"}},BM={defaultInsufficientCredits:"余额不足",defaultInvalidApiKey:"API 密钥无效",defaultTooManyRequests:"请求过于频繁",defaultServiceDown:"服务暂时不可用",markusCuExceeded:"⚠ 余额不足,请充值或升级计划:https://markus.global/settings?tab=billing",markusRateLimited:"⚠ 上游模型服务暂时限流(OpenRouter / 模型供应商)。通常几秒到一分钟后即可恢复;若有大量智能体并发,可稍后再试或错开任务。",markusWindowExceeded:"⚠ 上游暂时限制了请求频率。请稍后再试;额度不足请充值或升级:https://markus.global/settings?tab=billing",creditModalTitle:"积分已用完",creditModalDesc:"您的 Markus Cloud AI 积分已耗尽,请购买更多积分或升级订阅计划以继续使用。",creditModalDismiss:"稍后再说",creditModalUpgrade:"充值 / 升级",ai402:"⚠ AI 服务错误:{{detail}}。请充值 API 余额或联系管理员。",ai401:"⚠ AI 服务认证失败:{{detail}}。请检查配置。",ai429:"⚠ 超出速率限制:{{detail}}。请稍后再试。",ai409:"⚠ 请求冲突:{{detail}}。请重试。",ai502:"⚠ AI 上游服务异常:{{detail}}。LLM 供应商可能暂时宕机,请稍后重试。",ai503:"⚠ AI 服务不可用:{{detail}}。请稍后重试。",aiUpstreamBillingMismatch:"⚠ 上游返回计费错误,但您的 Markus 积分仍有余额。请稍后重试或切换模型。{{detail}}",aiRegionBlocked:"⚠ 当前地区无法使用模型 {{model}}。请在输入框右下角手动切换到其他可用模型。",aiGeneric:"⚠ AI 服务错误:{{detail}}",defaultUpstreamDown:"LLM 供应商返回 502 Bad Gateway",defaultUpstreamBillingMismatch:"上游计费异常且本地仍有余额",defaultConflict:"请求冲突"},$M={userInputPrompt_one:"有 {{count}} 个问题等待你回复",userInputPrompt_other:"有 {{count}} 个问题等待你回复",userInputRespond:"回复",notifyUserPrompt:"有一条来自智能体的通知待查看",notifyUserView:"查看",notifyUserGotIt:"知道了",viewProfileArrow:"查看资料 →",viewAgentProfileArrow:"查看智能体资料 →",viewMindArrow:"查看 Mind →",messageActions:{resumeTitle:"继续",reaskTitle:"重新提问",retryTitle:"重试",replyTitle:"回复",rememberTitle:"记住这次经验",rememberModalTitle:"记住这次经验?",rememberModalHint:"可选:告诉智能体希望沉淀什么。",rememberModalPlaceholder:"例如:修改 ROLE.md 前先征求确认",rememberConfirm:"开始进化",rememberCancel:"取消",evolvedFrom:"进化会话 — 正在复盘此前的对话",aiGeneratedDisclaimer:"内容由 AI 生成,请仔细甄别"},stopped:"已停止",emptyReply:"本次助手没有返回回复,通常是因为请求内容过大或 AI 服务暂时不可用。请点击重试;若持续出现,请在设置中检查积分或切换模型。",fallbackAgent:"智能体",fallbackYou:"你",systemName:"系统",workerRole:"工作者",selectAgent:"选择智能体",directMessage:"私信",chatTitle:"聊天",teamTab:"团队",profileTab:"资料",newChat:"新对话",newChatPlus:"+ 新建",newChatButton:"+ 新对话",historyTitle:"历史",rightPanelToggle:"开关侧边栏",sessionMain:"主会话",sessionConversation:"对话",noConversationsYet:"暂无对话",chatGreetings:["您有什么吩咐?","有什么我可以帮您的?","请问需要什么帮助?","随时为您效劳 ✨","今天想完成什么?"],dateToday:"今天",dateYesterday:"昨天",datePrevious7Days:"过去 7 天",dateOlder:"更早",loadingEarlierMessages:"正在加载更早的消息…",emptyChannel:"{{name}} 中还没有消息。",emptySelectAgent:"在侧边栏选择一名智能体以开始。",emptyNewConversation:"开始与 {{name}} 的新对话。",agentThinking:"智能体思考中…",scrollToBottom:"回到底部",toggleSidebar:"展开侧边栏",newMessages:"{{count}} 条新消息",mentionAgent:"提及智能体",slashSkill:"技能",mentionType:{agent:"智能体",project:"项目",requirement:"需求",task:"任务",deliverable:"交付物",workflow:"工作流"},slashCmd:{skill:"技能"},addMoreFiles:"添加更多文件",attachFilesTitle:"附加文件(图片、PDF、Word、Excel、PowerPoint…)",visionWarning:"图片将转为文本(当前模型不支持视觉)",stopAgent:"停止智能体",messageCount:"{{count}} 条消息",privateNotepad:"· 私人笔记",dmWith:"· 与 {{name}} 的私信",members:"成员",addMemberPlaceholder:"+ 添加成员...",placeholder:{channelWithMention:"在 {{name}} 中发消息…(使用 @名称 提及)",channel:"在 {{name}} 中发消息…",dmSelf:"给自己写条笔记…",dmOther:"给 {{name}} 发消息…",direct:"输入消息…",directOptions:["您有什么吩咐?","有什么我能帮您的?","请问需要做什么?","随时听候您的指示","说说您的想法吧…"],noAgent:"选择智能体以开始聊天",agentOffline:"智能体已离线,请先启动智能体再发送消息。"},newTaskTitle:"来自对话的新任务",taskFromChat:"在与 {{name}} 的聊天中创建",errorWithMessage:"错误:{{message}}",retryConfirmSingular:"将丢弃此点之后的一条消息并重新生成,是否继续?",retryConfirmPlural:"将丢弃此点之后的 {{count}} 条消息并重新生成,是否继续?",errorDetails:"错误详情",recentErrorDetails:"近期错误",errorRecovered:"智能体已恢复正常运行。",currentActivity:"当前活动",workingOnTaskHint:"正在处理任务 · 点击查看",agentErrorFallback:"智能体遇到错误。请在资料页查看详情。",processing:"处理中…",activityHeartbeat:"心跳:{{name}}",activityTask:"任务:{{label}}",activityDescHeartbeat:"周期性签到任务",activityDescChat:"回复对话中",activityDescFallback:"智能体正在思考或通信",searchMessages:"搜索消息",searchPlaceholder:"搜索消息…",searching:"搜索中…",noSearchResults:"未找到相关消息"},HM={title:"模型",search:"搜索模型",applyGlobal:"应用到全局",empty:"没有已启用的 Provider / 模型"},UM={chat:MM,teamProfile:RM,contextMenu:LM,modals:OM,notifications:DM,userInput:IM,intro:PM,batchAction:zM,errors:BM,page:$M,chatModel:HM},FM="工作",qM={allProjects:"全部项目",newProject:"新建项目",projectName:"项目名称 *",projectNamePlaceholder:"例如:移动应用、网站改版",projectNameRequired:"项目名称为必填项",description:"描述",descriptionPlaceholder:"这个项目是关于什么的?",assignTeams:"分配团队",noTeamsAvailable:"暂无可用团队",repositoryUrl:"仓库 URL",repositoryPlaceholder:"https://github.com/org/repo(可选)",branch:"分支",branchPlaceholder:"main",createProject:"创建项目",failedToCreate:"创建项目失败",settings:"设置",status:"状态",repositories:"仓库",deleteProject:"删除项目",archiveProject:"归档项目",settingsTitle:"项目设置",editProject:"编辑项目",descriptionPlaceholderLong:"添加项目描述…",projectStatusHeading:"项目状态",statusActive:"进行中",statusActiveDesc:"工作正在进行",statusPaused:"已暂停",statusPausedDesc:"暂时搁置",statusArchived:"已归档",statusArchivedDesc:"不再活跃",taskOverview:"任务概览",requirementsHeading:"需求",agentsHeading:"智能体({{count}})",agentTaskCounts:"{{active}} 进行中 / {{total}} 总计",addRepo:"+ 添加",noReposLinked:"尚未关联仓库。",removeRepo:"移除仓库",repoPathPlaceholder:"本地路径(例如 /Users/me/project)",repoBranchPlaceholder:"分支(默认:main)",dangerZone:"危险操作",dangerZoneDeleteHint:"删除项目不可恢复。相关任务和需求将被解除关联。",deleteProjectConfirmTitle:"确认删除该项目?",deleteProjectConfirmBody:"项目「{{name}}」将被永久删除,其下 {{tasks}} 个任务和 {{reqs}} 个需求将被解除关联。此操作无法撤销。",statTotal:"总计",statCompleted:"已完成",statInProgress:"进行中",statInReview:"审核中",statBlocked:"已阻塞",statFailed:"失败",statActive:"活跃",createdLabel:"创建时间",updatedLabel:"更新时间"},GM={tasks:"任务",newTask:"新建任务",noTasks:"暂无任务",assignee:"负责人",unassigned:"未分配",priority:"优先级",dueDate:"截止日期",description:"描述",comments:"评论",activity:"动态",subtasks:"子任务",dependencies:"依赖",deliverables:"交付物",status:"状态",assignTo:"分配给",addComment:"添加评论…",retry:"重试",cancel:"取消",commentPlaceholder:"添加评论…(输入 @ 提及智能体)",activityCommentsHeading:"动态与评论",noActivityYet:"暂无动态。在下方发表第一条评论。",reviewer:"审核人",noProject:"无项目",noRequirement:"无需求",requirementLabel:"需求",projectLabel:"项目",removeDependency:"移除依赖",noDependencies:"无依赖",abnormalBlock:"异常阻塞",abnormalBlockHint:"此任务处于阻塞状态,但没有未完成的依赖项——可能需要人工介入。",addDependency:"+ 添加依赖…",addDescription:"添加描述…",noDescription:"暂无描述",collapse:"收起",subtasksProgress:"{{done}}/{{total}} 已完成",hideCompleted:"隐藏已完成",showCompleted:"显示已完成({{count}})",addSubtask:"+ 添加子任务",noSubtasksYet:"暂无子任务。",subtaskTitlePlaceholder:"子任务标题…",add:"添加",deliverablesCount:"交付物({{count}})",noDeliverablesYet:"暂无交付物。",createdBy:"创建者 {{name}}",updatedBy:"更新者 {{name}}",started:"开始于 {{date}}",updatedMeta:"更新于 {{date}}",executionRound:"第 {{n}} 轮",detailsTab:"详情",executionLogTab:"执行日志",historyTab:"历史",loadingHistory:"加载历史...",noHistory:"暂无状态变更记录。",statusHistory:"状态历史",showAllHistory:"显示全部 {{count}} 条记录",failedToStart:"启动失败:",scrollToTop:"滚动到顶部",scrollToBottom:"滚动到底部",approve:"批准",startExecution:"启动执行",reject:"拒绝",approveCheck:"✓ 批准",requestRevision:"↻ 请求修改",revisionReasonPlaceholder:"修改原因…",revisionsNeededDefault:"需要修改",pause:"暂停",resume:"继续",resuming:"正在继续…",runNow:"立即运行",running:"运行中…",resumeSchedule:"▶ 恢复计划",pauseSchedule:"⏸ 暂停计划",archive:"归档",reopen:"重新打开",resumeFailed:"继续执行",cancelTask:"取消",deleteSubtaskTitle:"删除子任务「{{title}}」?",deleteSubtaskMessage:"该子任务将被永久删除。",cancelTaskModalTitle:"取消任务",cancelTaskDependent_one:"该任务有 {{count}} 个依赖任务因此被阻塞。",cancelTaskDependent_other:"该任务有 {{count}} 个依赖任务因此被阻塞。",cancelTaskOnly:"仅取消此任务",cancelTaskOnlyHint:"若无其他阻塞,依赖任务将可开始",cancelWithDependents:"连同依赖一并取消",cancelWithDependentsHint:"同时取消 {{count}} 个被阻塞的任务",cancelWithDependentsHint_plural:"同时取消 {{count}} 个被阻塞的任务",keepTaskRunning:"保留任务",rejectConfirmTitle:"驳回任务",rejectConfirmMessage:"确定驳回此任务?提案将被拒绝且无法撤销。",archiveConfirmTitle:"归档任务",archiveConfirmMessage:"确定归档此任务?它将被移至历史记录。",archiveScheduledConfirmMessage:"确定归档此定时任务?定时计划将被永久停止。",cancelConfirmMessage:"确定取消此任务?所有进行中的工作将被终止且无法撤销。",cancelScheduledConfirmMessage:"确定取消此定时任务?定时计划将被暂停,所有进行中的工作将被终止。",continueTask:"继续",editSchedule:"编辑",scheduleEveryMode:"定时间隔",scheduleCronMode:"Cron 表达式",scheduleMaxRuns:"最大运行次数:",scheduleMaxRunsPlaceholder:"不限",viewAll:"查看全部 →",schedulePaused:"⏸ 计划已暂停",scheduled:"已计划",scheduleEvery:"每 {{interval}}",scheduleCron:"Cron:{{expr}}",scheduleOneShot:"单次",scheduleNA:"无",scheduleNext:"下次:{{when}}",scheduleDueNow:"即将到期",scheduleInMinutes:"{{count}} 分钟后",scheduleInHoursMinutes:"{{h}} 小时 {{m}} 分钟后",scheduleInDaysHours:"{{d}} 天 {{h}} 小时后",scheduleRuns:"运行:{{current}}{{max}}",scheduleRunsMax:" / {{max}}",scheduleLast:"上次:{{when}}",scheduleApproveTitle:"批准定时任务",scheduleApproveDesc:"该任务已配置定时调度({{schedule}}),下一次执行时间为 {{nextRun}}。",scheduleApproveRunNow:"立即执行",scheduleApproveWait:"等待调度",serverError:"服务器错误",assignToRequired:"分配给",reviewerRequired:"审核人",taskType:"任务类型",taskTypeStandard:"标准",taskTypeScheduled:"计划(重复)",frequency:"频率",freq30m:"每 30 分钟",freq1h:"每 1 小时",freq2h:"每 2 小时",freq4h:"每 4 小时",freq8h:"每 8 小时",freq12h:"每 12 小时",freq1d:"每天",freq1w:"每周",blockedBy:"阻塞于(依赖)",selectAgent:"选择智能体…",selectReviewer:"选择审核人…",selectDependency:"选择要依赖的任务…",selectRequirement:"选择需求…",titleLabel:"标题",depsShort:"⏳ {{count}} 个依赖",depsShort_plural:"⏳ {{count}} 个依赖",byCreator:"由 {{name}}",statusFlash:"需求状态 → {{status}}",assignedReviewerDifferent:"执行人与审核人不能相同",errorCreatingTask:"创建任务失败:{{message}}",errorCode_task_limit_reached:"该 Agent 当前任务已满,请等待现有任务完成后再创建",errorCode_requirement_required:"请先选择一个需求,任务必须关联已批准的需求",errorCode_agent_not_found:"所选 Agent 不存在或已被移除",errorCode_unknown:"操作失败,请稍后重试",pleaseReqTitle:"请填写需求标题",pleaseReqDesc:"请填写需求描述",pleaseReqProject:"请选择所属项目",projectCreated:"项目已创建",projectDeleted:"项目已删除",requirementCreated:"需求已创建",requirementApproved:"需求已批准",requirementRejected:"需求已拒绝",requirementCancelled:"需求已取消",deleteProjectConfirm:"删除此项目并解除所有任务关联?",errorGeneric:"错误:{{message}}",commentInstructionPlaceholder:"添加评论或指令…",agentProcessing:"处理中…",attachImage:"附加图片",loadingLogs:"正在加载日志…",noExecutionLogs:"尚无执行日志。",runWithAgentHint:"点击「使用智能体运行」以开始。",emptyLogs:{default:"暂无执行日志",defaultHint:"可通过评论框向智能体发送指令",noAgent:"尚未分配智能体",noAgentHint:"分配智能体后即可开始执行",pending:"任务在队列中等待执行",pendingHint:"智能体将按优先级依次处理",agentBusy:"{{agent}} 正在处理其他任务",agentBusyHint:"此任务已进入邮箱队列,将自动排队执行",starting:"智能体正在准备执行",startingHint:"日志即将出现…"},relatedSessions:"{{agent}} 在其他会话中处理了此任务({{count}} 条记录)",sessionLive:"进行中",agent:"智能体",loadingExecutionLog:"正在加载执行日志…",noExecutionLogAvailable:"暂无执行日志。",roundHeader:"第 {{n}} 轮",loadingRound:"正在加载第 {{n}} 轮…",toolCount_one:"{{count}} 个工具",toolCount_other:"{{count}} 个工具",dropHere:"拖放到此处",backToKanban:"返回看板",projectsCount:"{{count}} 个项目",projects:"项目",all:"全部",oneProject:"{{name}}",shortProject:"+ 项目",shortReq:"+ 需求",shortTask:"+ 任务",backlog:"待办列表",kanban:"看板",dag:"依赖图",workflows:"工作流",team:"团队",selectProjectForWorkflows:"选择一个关联团队的项目以查看工作流",noWorkflows:"该团队暂无工作流模板",workflowEmptyTitle:"暂无工作流模板",workflowEmptyDesc:"工作流可以将重复性的多步骤流程自动化。定义一组任务的 DAG(有向无环图),系统自动处理依赖关系、角色分配和定时调度。",workflowHowItWorks:"工作原理",workflowStep1Title:"需求",workflowStep1Desc:"每次运行会创建一个需求(Requirement),将所有任务归集到同一个可追踪的目标下。",workflowStep2Title:"任务 DAG",workflowStep2Desc:"每个步骤对应一个任务,自动分配给合适的团队成员。依赖关系自动追踪——下游任务等待上游完成后再开始。",workflowStep3Title:"自动执行",workflowStep3Desc:"智能体自动领取任务,将交付物传递给下游,工作流自动完成。还可以设置定时调度,周期性运行。",workflowAskManager:"让 {{name}} 创建工作流",workflowCreatePrompt:"请为我们团队创建一个工作流模板。先看看团队成员的构成,然后设计一个符合我们日常工作的多步骤流程。使用 workflow_create 工具保存。如果用户指定了项目,请在工作流中绑定该项目(添加 project_id 参数)。如果不确定,将项目留为可选的运行时参数,让用户在启动运行时选择。",saveAsWorkflow:"保存为工作流",saveAsWorkflowDesc:"将当前任务结构转化为可复用的工作流模板",workflowName:"名称",roles:"角色",workflowSteps:"步骤",dependsOn:"依赖于",removeStep:"移除步骤",saveWorkflow:"保存工作流",saving:"保存中...",role:"角色",workflowLoading:"加载中...",workflowRun:"运行",workflowRunning:"运行中",workflowScheduled:"定时",workflowRecentRuns:"最近运行",workflowStarting:"启动中...",workflowStartRun:"开始运行",workflowProject:"项目",workflowSelectProject:"— 选择项目 —",workflowNoProject:"请选择一个项目",workflowNoTeam:"无法确定此工作流所属的团队",workflowCancel:"取消",workflowCancelRun:"取消运行",workflowCancelling:"取消中...",workflowConfirmCancelTitle:"取消工作流运行",workflowConfirmCancelDesc:"这将取消此工作流运行中所有正在运行和待处理的任务。此操作无法撤销。",workflowConfirmCancelBtn:"确认取消",workflowNo:"否",workflowPause:"暂停",workflowResume:"恢复",workflowSendToAgent:"发送到智能体对话",workflowNoRecentRuns:"暂无运行记录",workflowStepsCount:"{{count}} 步骤",workflowRolesCount:"{{count}} 角色",workflowParamsCount:"{{count}} 参数",workflowRunTitle:"运行: {{name}}",workflowViewTasks:"查看任务",workflowRequired:"必填",workflowSavedSuccess:"工作流保存成功",backlogEmptyTitle:"待办列表为空",backlogEmptyDesc:"待办列表以平铺方式显示所有任务。创建一个需求并审批通过后,智能体会将其拆分为具体任务,显示在此处。",dagEmptyTitle:"暂无任务依赖关系",dagEmptyDesc:"依赖图展示任务之间的依赖关系。当任务设置了「阻塞」关系后,它们会形成有向无环图(DAG),在此处可视化呈现。",hideArchived:"隐藏已归档",hideArchivedWithCount:"隐藏 {{count}} 个已归档",archivedCount:"{{count}} 个已归档",filter:"筛选",filterWithCount:"筛选({{count}})",clear:"清除",myTasks:"我的任务",newRequirement:"+ 需求",newTaskBtn:"+ 任务",noItemsYet:"暂无条目",emptyStateHint:`创建需求以说明你需要什么。
189
189
 
190
190
  批准后,任务将自动出现在此处。`,emptyNoProjectsTitle:"从创建项目开始",emptyNoProjectsHint:"项目用于组织你的工作。先创建一个项目,然后添加需求来描述你需要什么。智能体会自动将需求拆分为任务。",emptyNoReqsTitle:"准备好添加工作了",emptyNoReqsHint:`创建需求以说明你需要什么。
191
- 批准后,任务将自动出现在此处。`,emptyFilteredTitle:"没有匹配的工作项",emptyFilteredHint:"当前负责人筛选下没有结果。清除筛选以查看此项目的全部内容。",emptyDetailTitle:"未选择条目",emptyDetailHint:"从列表中选择一条需求或任务,或新建一条开始工作。",createRequirementCta:"+ 创建需求",filtersSheetTitle:"筛选",clearAll:"全部清除",projectsFilterGroup:"项目",agentsFilterGroup:"智能体",newRequirementModalTitle:"新建需求",newRequirementModalHint:"描述你的需求。智能体将把已批准的需求拆分为任务。",selectProject:"选择项目…",reqTitleExample:"例如:添加用户认证",reqDescPlaceholder:"需要什么以及原因…",rejectRequirementTitle:"拒绝需求",rejectReasonLabel:"原因",rejectReasonPlaceholder:"拒绝原因…",cronLabel:"Cron",scheduledShort:"已计划",everyInterval:"每 {{interval}}",reply:"回复",hideLog:"隐藏日志",viewLog:"查看日志",viewProfile:"查看资料 →",agentNotFound:"未找到智能体:{{id}}…",workerRole:"工作者",clickToEdit:"点击编辑",systemAuthor:"系统",noteTimeJustNow:"刚刚",noteTimeMinutes:"{{count}} 分钟前",noteTimeHours:"{{count}} 小时前",noteTimeDays:"{{count}} 天前",online:"在线",working:"工作中",error:"错误",offline:"离线",paused:"已暂停",filePreviewLoading:"加载中…",emptyDirectory:"空目录",openInFinder:"在文件管理器中打开",openInDeliverables:"在产出页面中打开",requirementDetailDescription:"描述",requirementNoDescription:"暂无描述",createdByLabel:"创建者",agentTag:"(智能体)",createdLabel:"创建时间",approvedBy:"批准人",rejectionReason:"拒绝原因",linkedTasks:"关联任务({{count}})",cancelRequirement:"取消需求",commentsWithCount:"评论({{count}})",noCommentsYet:"暂无评论。",requirementShort:"需求",taskShort:"任务",schedShort:"计划",backlogTitle:"标题",backlogUpdated:"更新",noItems:"无条目",loadingPage:"加载中…",adminFallback:"管理员",titleField:"标题",descriptionField:"描述",priorityField:"优先级",projectsCountLabel_one:"{{count}} 个项目",projectsCountLabel_other:"{{count}} 个项目",noMatches:"无匹配项",searchPlaceholder:"输入以搜索…"},VM={requirements:"需求",newRequirement:"新建需求",noRequirements:"暂无需求",approved:"已批准",rejected:"已拒绝",approveRequirement:"批准",rejectRequirement:"拒绝",cancelConfirmTitle:"取消需求",cancelConfirmMessage:"确定要取消此需求吗?此操作不可撤销。",cancelConfirmLabel:"取消需求",createTask:"任务",noLinkedTasks:"暂无关联任务,创建一个来开始吧。",goal:"目标循环",goalActive:"活跃",goalMaxReached:"已达上限",goalIteration:"迭代 {{current}}/{{max}}",goalLastChecked:"上次检查:{{time}}",goalAutoResume:"自动恢复"},KM={all:"全部",active:"活跃",completed:"已完成",search:"搜索任务…",status:"状态",assignee:"负责人",priority:"优先级",sortBy:"排序",groupBy:"分组"},WM={pending:"待处理",inProgress:"进行中",review:"审核中",completed:"已完成",failed:"失败",blocked:"已阻塞"},YM={failed:"失败",todo:"待办",in_progress:"进行中",review:"审核中",done:"完成",closed:"已关闭"},XM={task:{pending:"待处理",in_progress:"进行中",blocked:"已阻塞",review:"审核中",revision:"修改中",completed:"已完成",failed:"失败",rejected:"已拒绝",cancelled:"已取消",archived:"已归档"},requirement:{pending:"待处理",in_progress:"进行中",completed:"完成",rejected:"已拒绝",cancelled:"已取消",archived:"已归档"},sub:{pending:"待处理",blocked:"已阻塞",failed:"失败",rejected:"已拒绝"},project:{active:"进行中",planning:"规划中",review:"审核中",completed:"已完成",archived:"已归档",paused:"已暂停"}},QM={low:"低",medium:"中",high:"高",urgent:"紧急"},ZM={noProjects:"暂无项目",createFirst:"创建第一个项目以开始"},JM={justNow:"刚刚",minutesAgo:"{{count}} 分钟前",hoursAgo:"{{count}} 小时前",daysAgo:"{{count}} 天前"},eR={filter:{todo:"待办",in_progress:"进行中",review:"审核中",done:"已完成"},reset:"重置",archivedToggle:"{{count}} 个已归档",expandHint:"点击卡片展开依赖关系",backToOverview:"← 返回概览",dragHint:"拖拽连线 · 点击边线移除",noTasks:"暂无任务可显示",reqLabel:"需求",taskCount_one:"{{count}} 个任务",taskCount_other:"{{count}} 个任务",depCount_one:"{{count}} 个依赖",depCount_other:"{{count}} 个依赖",removeDependencyTitle:"移除依赖?",removeDependencyBody:"「{{target}}」将不再被「{{source}}」阻塞。",toast:{dependencyExists:"依赖关系已存在",cycleError:"无法添加:会形成循环依赖",dependencyAdded:"已添加依赖",dependencyRemoved:"已移除依赖",failed:"失败:{{message}}"}},tR={title:FM,project:qM,task:GM,requirement:VM,filters:KM,board:WM,boardColumn:YM,status:XM,priority:QM,empty:ZM,relative:JM,dag:eR},nR="设置",rR={appearance:"通用",providers:"模型配置",execution:"智能体配置",browser:"浏览器自动化",search:"网络搜索",codingTools:"编程工具",storage:"数据与存储",users:"用户管理",remote:"远程访问",integrations:"外部IM集成",license:"许可证",organization:"组织",account:"账户",group:{general:"偏好",aiConfig:"AI 配置",tools:"工具与能力",connections:"连接与集成",account:"账户"}},aR={title:"通用",theme:"主题",themeDesc:"选择界面视觉样式",language:"语言",languageDesc:"选择界面显示语言",launchAtLogin:"开机自动启动",launchAtLoginDesc:"登录电脑后在后台自动启动 Markus",modes:{system:"跟随系统",light:"浅色",dark:"深色",cyberpunk:"赛博朋克",mono:"黑白"}},sR={title:"欢迎 — 配置你的 LLM",subtitle:"Markus 至少需要配置一个 LLM 提供商才能工作。选择一种入门方式:",skip:"跳过",fromEnv:{step:"1",title:"从环境变量读取",description:"自动检测来自 .env 或系统环境的 API Key。",noKeysHint:"未找到 API Key。请设置诸如 <code>ANTHROPIC_API_KEY</code> 或 <code>OPENAI_API_KEY</code> 等环境变量,然后重启服务器。"},fromOllama:{step:"2",title:"本地 Ollama",description:"自动检测本地运行的 Ollama 服务并选择模型。"},fromOpenClaw:{step:"3",title:"从 OpenClaw 配置导入",description:"从已有的 OpenClaw 安装导入模型配置。"},manual:{step:"4",title:"手动配置",description:"直接编辑 <code>~/.markus/markus.json</code>,然后重启服务器。"},browserExtension:{step:"5",title:"安装浏览器自动化扩展",description:"让 AI 智能体能直接操控 Chrome 浏览网页、测试应用,无需每次弹窗授权。",notChrome:"当前浏览器不是 Chrome,请在 Chrome 中打开 Markus 以安装扩展。",alreadyConnected:"扩展已连接,无需操作。",downloadBtn:"下载扩展",openChromeBtn:"打开扩展页面",loadHint:"解压后,在 Chrome 扩展页面开启「开发者模式」→「加载已解压的扩展程序」→ 选择解压文件夹"},applyProviders:"应用 {{count}} 个提供商",foundPrefix:"已找到:"},iR={title:"系统状态",status:"状态",healthy:"正常",version:"版本",activeAgents:"活跃智能体"},oR={title:"默认 LLM 提供商",primaryProvider:"主提供商",primaryProviderDesc:"除非另行指定,否则用于所有智能体交互",noProviders:"尚未配置提供商",updated:"默认提供商已更新为 {{name}}",autoFallback:"自动切换模型",autoFallbackDesc:"默认关闭。开启后主模型出错时会自动尝试其他提供商/模型;关闭则直接报错,由你手动切换。"},lR={title:"模型路由",defaultModelTitle:"默认模型",defaultModelDesc:"当能力没有指定模型时,使用此默认模型。",defaultModelPlaceholder:"选择默认模型...",capabilityAssignTitle:"能力分配",capabilityAssignDesc:"为每种能力类型指定使用的模型。未指定的能力将使用上方的默认模型。",capabilityGroups:{text:"文本",image:"图像",audio:"音频",video:"视频",other:"其他"},capabilities:{text:"通用",image_recognition:"图像识别",image_generation:"图像生成",audio_tts:"文字转语音",audio_stt:"语音转文字",video_generation:"视频生成"},auto:"使用默认",selectModel:"选择模型...",suggested:"推荐",noModelAvailable:"无可用模型",addProviderHint:"可在上方添加支持此功能的服务商",clear:"清除",loadError:"加载路由设置失败:{{error}}",saving:"保存中...",saved:"已保存",saveError:"保存失败",mismatchHint:"模型与此能力类型不匹配 — 请选择兼容的模型",staleProvider:"服务商未配置 — 请清除或重新配置",noProvidersHint:"请先在上方配置至少一个服务商,才能为能力指定模型。",restoreRecommended:"恢复 Markus 推荐",restoreWorking:"恢复中…",restoreConfirm:"用 Markus 推荐覆盖当前模型路由,并将默认提供商切换为 Markus?您已自定义的能力映射将被覆盖。",loadingModels:"正在加载模型列表…",tier:{base:"基础",pro:"专业",max:"旗舰"}},cR={loading:"正在加载模型…",empty:"此提供商暂无可用模型。",filterPlaceholder:"筛选模型…",searchPlaceholder:"搜索模型…",showAll:"显示全部 {{count}} 个模型…",showLess:"收起",allCount:"全部 ({{count}})",tierCount:"{{tier}} ({{count}})",active:"当前",perMillion:"每百万",ctx:"上下文",costFree:"免费",capabilities:{tools:"工具",vision:"视觉",reasoning:"推理",caching:"缓存",search:"搜索"}},uR={title:"模型提供商",disabled:"已禁用",notConfigured:"点击配置",addProvider:"+ 添加提供商",addNewProvider:"添加新提供商",providerName:"提供商",selectProvider:"选择提供商...",customProvider:"自定义 (OpenAI 兼容)",customName:"自定义提供商名称",validatingKey:"正在验证密钥并加载模型...",selectModel:"选择模型",advancedSettings:"高级设置 (Base URL、定价覆盖...)",providerNameHint:"使用 anthropic、openai、google、ollama 表示官方接口;其他名称将按 OpenAI 兼容 API 处理",apiKey:"API Key",apiKeyPlaceholder:"留空则保留当前值",baseUrl:"Base URL(可选)",baseUrlLabel:"Base URL",defaultModel:"默认模型",contextWindow:"上下文窗口",maxOutputTokens:"最大输出 Token",inputCost:"$/1M 输入",outputCost:"$/1M 输出",editProvider:"编辑提供商",deleteConfirm:"删除提供商「{{name}}」?",providerAdded:"已添加提供商 {{name}}",notConfiguredHint:"尚未配置。请使用下方「添加提供商」按钮,或在环境变量中设置 API Key。",quickSetupHint:"输入 API Key 即可立即启用此提供商。",markusKeyHint:"前往以下页面获取 Markus Cloud AI API Key:",markusKeyLink:"Hub 设置",quickSetupPlaceholder:"在此粘贴 API Key...",quickSetupSubmit:"启用",quickSetupSaving:"启用中...",quickSetupSuccess:"{{name}} 已就绪!",keyReadOnly:"密钥(只读)",pricingTitle:"定价(每百万 Token)",input:"输入",output:"输出",cacheRead:"缓存读取",cacheWrite:"缓存写入",availableModels:"可用模型",addModel:"+ 添加模型",addModelTitle:"添加模型",browseFromCatalog:"从目录浏览",browse:"浏览",selectFromCatalog:"从目录选择",loadingCatalog:"正在从目录加载模型...",loadingHubCatalog:"正在从 Hub 加载模型…",hubCatalogEmpty:"未能加载模型列表。请确认设置中的 Hub 地址可访问,然后折叠再展开 Markus。",hubCatalogError:"加载 Hub 模型目录失败:{{error}}",moreCatalogModels:"目录中还有 {{count}} 个模型可用...",modelsAvailable:"{{count}} 个模型可用",andMoreModels:"... 以及另外 {{count}} 个模型",catalogModelsAvailable:"该提供商还支持 {{count}} 个其他模型",showAllModels:"显示全部 {{count}} 个模型",filterModels:"筛选模型…",noFilterMatches:"没有匹配的模型",collapseModels:"收起",modelId:"模型 ID",displayName:"显示名称",reasoning:"推理",vision:"视觉",capImageGen:"生图",capTts:"语音",capStt:"听写",capVideo:"视频",custom:"自定义",use:"使用",switching:"正在切换…",model:"模型",ctxTokens:"{{size}}K 上下文",costPerMillion:"${{input}}/{{output}} 每百万",badgeDefault:"默认",badgeOAuth:"OAuth",clickToDisable:"点击禁用",clickToEnable:"点击启用",maxOutput:"最大输出",kTokens:"{{k}}K tokens",notApplicable:"不适用",baseUrlDisplayDefault:"默认",active:"当前",deleteCustomModelTitle:"删除自定义模型",costPair:"${{input}}/{{output}}",adding:"正在添加…",costPerMillionIn:"$/1M 入:",costPerMillionOut:"出:",placeholderContextTokens:"上下文(tokens)",placeholderProviderName:"例如 deepseek、openrouter、my-provider",placeholderApiKeySk:"sk-...",placeholderBaseUrl:"https://api.example.com/v1",placeholderDefaultModel:"例如 deepseek-chat、gpt-4o",placeholderContextExample:"例如 128000",placeholderMaxOutputExample:"例如 16384",placeholderCostInput:"例如 1",placeholderCostOutput:"例如 5",addProviderSubmit:"添加提供商",saveFailed:"保存失败",failedToAdd:"添加失败",test:"测试",testing:"测试中…",testOk:"正常({{ms}}ms)",testFailed:"不可用",testFailedCode:"错误 {{code}}",testSuccess:"连接成功,耗时 {{ms}}ms — 回复:{{reply}}",testDetail:{requestUrl:"请求地址",model:"模型",requestBody:"请求参数",response:"响应内容",duration:"耗时",tokens:"Token 用量",inputTokens:"输入",outputTokens:"输出"},configuredCount:"已配置",groupConfigured:"已配置({{count}}个)",groupUnconfigured:"更多提供商",markusHint:"连接到 Markus Cloud AI 服务",markusSetup:"输入您的 Markus API 密钥进行连接。您可以从 Markus Hub 账户中获取。",markusSetupLogin:"登录您的 Markus Hub 账户即可自动连接 Markus Cloud AI。",markusConnected:"已连接",markusConnectedHint:"您的 Markus Cloud AI 连接通过 Hub 账户管理。前往设置管理您的订阅和积分。",goToAccount:"前往账户设置",connect:"连接"},dR={title:"网络代理",description:"配置用于 ChatGPT OAuth 登录和 Codex API 调用的 HTTP 代理。其他 LLM 服务商通过系统/TUN 代理自动生效。",active:"生效中:",noProxy:"未检测到代理",sourceConfig:"markus.json",sourceEnv:"环境变量",sourceSystem:"macOS 系统",placeholder:"http://127.0.0.1:7890(留空则自动检测)",saving:"保存中...",save:"保存",saved:"已保存,重启服务后生效。",saveFailed:"保存失败",networkError:"网络错误",refresh:"重新检测",disabled:"代理已禁用"},mR={title:"OAuth 认证",description:"使用 ChatGPT 账号登录,通过订阅额度使用 Codex 模型(无需 API Key)。",signInWith:"使用 {{name}} 登录",connecting:"连接中...",device:"设备码",deviceTitle:"设备码登录(适用于远程/无头环境)",deviceCodeTitle:"设备码登录",deviceInstructions:"请打开验证地址并输入以下代码:",deviceWaiting:"等待授权中...(15 分钟后过期)",manualCallbackHint:"如果浏览器未打开或您在远程机器上,请粘贴回调 URL:",manualPlaceholder:"http://localhost:1455/auth/callback?code=...",submit:"提交",connectedAccounts:"已连接账号",expired:"令牌已过期/失效",reconnect:"重新认证",disconnect:"断开",noProviders:"无可用 OAuth 提供商",deviceCodeFailed:"设备码登录失败"},fR={loginFailed:"登录失败",networkErrorDuringLogin:"OAuth 登录时网络错误",callbackFailed:"回调失败"},pR={title:"自动检测与导入",description:"从环境变量、本地 Ollama 服务或已有配置中发现 LLM 提供商。"},hR={title:"本地 Ollama",description:"自动检测本地运行的 Ollama 服务,并将其配置为模型提供商。无需 API Key。",detect:"检测 Ollama",detecting:"检测中…",foundModels:"在 {{url}} 发现 {{count}} 个模型",notRunning:"本地未检测到 Ollama 服务。请先启动 Ollama,然后点击检测。",detectFailed:"检测 Ollama 服务失败",useModel:"使用 {{model}}",configured:"已配置 Ollama,模型为 {{model}}",applyFailed:"配置 Ollama 失败",switchModel:"切换模型"},gR={title:"环境变量配置",description:"从环境变量检测模型 API Key,并写入配置文件。",refreshEnv:"刷新环境变量",detectedProviders:"已检测到的提供商 — 选择要应用的项:",noKeysFound:"环境变量中未找到模型 API Key",detectionFailed:"检测失败",failedToDetect:"无法检测环境变量",applyToConfig:"将 {{count}} 个提供商应用到配置",selectAtLeastOne:"请至少选择一个提供商再应用",applyFailed:"应用失败(HTTP {{status}})",failedToApply:"无法应用环境配置",detectionFailedHttp:"检测失败(HTTP {{status}})",keyLabel:"密钥:",modelLabel:"模型:",urlLabel:"URL:",llmTimeout:"LLM 超时:{{ms}}ms(来自 LLM_TIMEOUT_MS)"},bR={title:"智能体执行",maxToolIterations:"最大工具迭代次数",maxToolIterationsDesc:"单次智能体回合中工具调用循环的安全上限(0 表示无限制,适用于所有智能体与子智能体)",saved:"已保存",failedToSave:"保存失败"},xR={title:"认知准备管线",description:"每次主 LLM 调用之前,智能体会运行一次轻量的认知评估,分析刺激并准备角色感知上下文。这可以提升响应相关性,代价是增加一次小型 LLM 调用(约 500ms)。",enabled:"启用 CPP",enabledDesc:"启用后,智能体在响应前会运行认知评估",maxDepth:"最大认知深度",maxDepthDesc:"控制每次响应前的准备工作深度",depthD1:"仅评估",depthD2:"评估 + 检索 + 反思",depthD3:"完整管线 + 事后评估",saved:"已保存",failedToSave:"保存失败"},yR={title:"网络搜索",description:"优先级:已连接 Hub 且余额不为 0 时优先 Markus 托管;否则优先自备 API。",serper:"Serper (Google)",serperHint:"serper.dev",tavily:"Tavily",tavilyHint:"tavily.com",bing:"Bing 网页搜索",bingHint:"Azure",google:"Google 自定义搜索",googleHint:"API Key + 搜索引擎 ID",googleCxPlaceholder:"搜索引擎 ID (cx)...",serpapi:"SerpAPI",serpapiHint:"serpapi.com",brave:"Brave Search",braveHint:"brave.com",exa:"Exa",exaHint:"exa.ai",bocha:"博查 (Bocha)",bochaHint:"bochaai.com",configured:"已配置",notConfigured:"未配置",apiKeyPlaceholder:"在此粘贴 API Key...",saved:"搜索 API 密钥已保存",failedToSave:"保存搜索 API 密钥失败",envDetected:"来自环境变量",markus:"Markus 托管搜索",markusBadge:"推荐",markusHint:"无需第三方密钥 · 使用 Markus Cloud 余额",markusProviderLabel:"搜索引擎",markusProviderBocha:"博查(中文)",markusProviderTavily:"Tavily",markusUnavailable:"需登录 Markus",markusUnavailableHint:"请先在「模型服务商」连接 Markus。",modelLabel:"检索模型",modelHint:"托管搜索按次计费。若已配置上方自备密钥,将优先使用(不走该模型)。Sonar 比 Sonar Pro 更便宜。",modelSonar:"Perplexity Sonar(默认,更省)",modelSonarPro:"Perplexity Sonar Pro(质量更高)",ownKeysTitle:"自备 API 密钥",ownKeysHint:"可选后备",test:"测试",testing:"测试中…",testOk:"成功,返回 {{count}} 条结果",testFailed:"测试失败",enabled:"已启用",disabled:"已禁用"},vR={title:"浏览器自动化",description:"Chrome DevTools 浏览器技能相关设置。智能体使用 Chrome 浏览网页、测试 Web 应用并检查页面。",bringToFront:"置于前台",bringToFrontDesc:"启用后,智能体导航时 Chrome 标签页会被提到前台。关闭时(默认)智能体在后台静默工作,不会抢占焦点。",autoCloseTabs:"自动关闭标签页",autoCloseTabsDesc:"智能体任务结束或智能体被移除时,自动关闭由其占用的浏览器标签页。",remoteDebuggingPort:"远程调试端口",remoteDebuggingPortDesc:"设置固定调试端口(例如 9222),避免每次智能体连接 Chrome 时都弹出权限对话框。",remoteDebuggingPortDescLead:"设置固定调试端口(例如 9222),避免每次智能体连接 Chrome 时都弹出权限对话框。请使用以下参数启动 Chrome:",remoteDebuggingPortDescTail:"然后在此处填写相同端口。填 0 则使用自动连接(每次需手动批准权限)。",tabsForeground:"标签页将置于前台",tabsBackground:"标签页将保留在后台",usingPort:"正在使用端口 {{port}} 的持久连接(不再出现权限对话框)",usingAutoConnect:"正在使用自动连接模式(每次连接都需要权限对话框)",autoClickAllowDialog:"自动允许 Chrome 调试弹窗",autoClickAllowDialogDesc:"Chrome 每次被 Markus 连接时都会弹出「允许远程调试?」对话框。开启后,Markus 通过操作系统辅助功能 API 自动点击「允许」按钮。",autoClickAllowDialogMacNote:"macOS:需在「系统设置 → 隐私与安全性 → 辅助功能」中授予运行 Markus 的应用(Markus.app / Terminal / iTerm)权限。",autoClickAllowDialogWinNote:"Windows:无需额外权限,使用内置 UI Automation。",autoClickAllowDialogLinuxNote:"Linux:暂不支持。请使用上方「远程调试端口」作为替代方案。",autoClickAllowDialogSupported:"当前平台支持",autoClickAllowDialogUnsupported:"当前平台暂不支持",autoClickTest:"测试",autoClickTesting:"测试中...",autoClickTestSuccess:"自动点击验证通过!已成功连接 Chrome 并加载测试页面({{title}})。",autoClickTestNoPermission:"辅助功能权限未授予。已打开系统设置页面,请将本应用添加到列表中。",autoClickTestChromeNotRunning:"Chrome 未运行。请先启动 Chrome。",autoClickTestUnsupported:"当前平台不支持自动点击。请使用「远程调试端口」作为替代方案。",autoClickTestError:"测试失败:{{error}}",modeExtension:"Chrome 扩展(已激活)",modeExtensionDesc:"浏览器工具通过扩展运行 — 无调试弹窗、无需额外权限、锁屏可用。",modeDebuggingPort:"远程调试端口 :{{port}}(已激活)",modeDebuggingPortDesc:"通过持久调试端口连接 — 每次连接无需权限弹窗。",modeAutoClick:"自动连接 + 自动点击(已激活)",modeAutoClickDesc:"使用 chrome-devtools-mcp 并通过系统 API 自动点击调试弹窗。锁屏时可能不工作。",modeManual:"自动连接(需手动允许)",modeManualDesc:"每次 Agent 连接浏览器时,Chrome 会弹出权限对话框,需要手动点击「允许」。",modeRecommended:"推荐",generalSettings:"通用设置",fallbackModes:"连接方式(备选)",extensionStatus:"Chrome 扩展",extensionStatusDesc:"无需调试弹窗即可实现浏览器自动化。无需辅助功能权限,锁屏状态下也能正常工作。",extensionConnected:"已连接",extensionDisconnected:"未连接",extensionActiveNote:"扩展已激活 — 浏览器工具通过扩展运行(无调试弹窗)",extensionSetupTitle:"安装 Chrome 扩展",extensionStep1:"下载并解压扩展",extensionStep1Desc:"下载压缩包后,解压到任意位置(如桌面)",extensionStep1Btn:"下载 markus-browser-extension.zip",extensionStep1Downloading:"准备下载...",extensionStep2:"打开 Chrome 扩展页面",extensionStep2Desc:"在 Chrome 中打开扩展管理页面",extensionStep2Btn:"打开 chrome://extensions",extensionStep3:"加载扩展",extensionStep3Desc:"开启右上角的「开发者模式」开关,点击「加载已解压的扩展程序」,选择第 1 步解压出来的文件夹",extensionDownloadError:"下载扩展失败",extensionOpenError:"打开 Chrome 扩展页面失败"},wR={title:"数据与存储",scanning:"正在扫描存储…",openInFinder:"在访达中打开",storageBreakdown:"存储明细",agentStorage:"智能体存储({{count}})",openFolder:"打开文件夹",orphanedDirectories:"孤立目录",orphanedDesc:"这些目录没有对应的数据库记录,可能是在删除智能体或团队时遗留的。",orphanedTotal:"合计:{{size}},共 {{count}} 个目录。",cleanSelected:"清理所选({{size}})",cleanAll:"全部清理({{size}})",cleaning:"正在清理…",cleaned:"已清理 {{count}} 个目录,释放 {{size}}",bytesZero:"0 B",unitB:"B",unitKB:"KB",unitMB:"MB",unitGB:"GB",teamKind:"团队",selectedWithSize:"已选 {{count}} 项({{size}})",cleanupFailed:"清理失败",cleanedWithFailureNote:"{{base}}({{count}} 项失败)",sortedBySize:"按占用排序",clearableHint:"其中约 {{size}}({{percent}}%)是可清理的调试日志,不影响日常使用。",safetyLevel:{safe:"可清理"},items:{database:{label:"数据库",blurb:"任务、智能体、聊天等核心数据"},agents:{label:"智能体",blurb:"工作区、记忆、角色与会话文件"},skills:{label:"技能",blurb:"已安装的 Skill 包"},llmLogs:{label:"模型日志",blurb:"请求/响应审计日志,可按需清理以释放空间"},builderArtifacts:{label:"创作产物",blurb:"资产页「我的创作」的本地源文件"},teams:{label:"团队",blurb:"团队公告与规范"},shared:{label:"共享文件",blurb:"跨智能体共享文件与任务产出"},knowledge:{label:"知识库",blurb:"可供检索的知识条目"}}},kR="已通过 OAuth 连接到 {{provider}}",SR="认证配置已删除",NR="已打开浏览器以完成授权。请在浏览器窗口中完成登录…",CR={title:"远程访问",description:"通过 Markus Hub 的 WebRTC P2P 连接,从手机或任何设备访问此 Markus 实例。",loginRequired:"请先登录 Markus Hub 以启用远程访问。",signIn:"登录",signedInAs:"已登录:",enabled:"远程访问已启用",disabled:"远程访问已禁用",connecting:"正在连接信令服务器…",registering:"正在注册到 Hub…",connected:"已连接",disconnected:"已断开",peerCount_one:"{{count}} 个对等节点",peerCount_other:"{{count}} 个对等节点",url:"远程访问地址",copy:"复制",copied:"已复制!",qrCode:"二维码",scanQr:"用手机相机扫描以连接",enableFailed:"启用远程访问失败",disableFailed:"禁用远程访问失败",connectedPeers:"已连接的设备",connectedSince:"连接于 {{time}}",peerConnecting:"连接中"},TR={title:"本机的 Markus",sharedInstanceDesc:"管理当前这台机器上的 Markus 用户账号。所有账号共享同一个工作区、相同的 AI Agent 和团队。例如:一台共享的 Linux 服务器上,多位同事各自用不同的账号登录同一个 Markus。",orgHint:"如果团队成员各自在自己的电脑上使用独立的 Markus,请到「账户」标签页查看组织信息,并前往 Hub 管理组织。",orgLink:"",name:"姓名",email:"邮箱",role:"角色",actions:"操作",noUsers:"暂无用户",editUser:"编辑",deleteUser:"删除",resetPassword:"重置密码",save:"保存",cancel:"取消",confirmDelete:"确定要移除该用户吗?此操作不可撤销。",confirmDeleteTitle:"移除用户",newPassword:"新密码",confirmReset:"重置",resetSuccess:"密码已重置",addUser:"添加用户",addSuccess:"用户已创建",password:"密码",updateSuccess:"用户已更新",deleteSuccess:"用户已移除",error:"操作失败",cannotDeleteSelf:"不能删除自己的账户",cannotDeleteOwner:"不能移除主要所有者",inviteLink:"邀请",inviteLinkGenerated:"邀请链接已生成 — 复制并发送给用户",copyInviteLink:"将此链接发送给用户,以便他们设置账号:",linkCopied:"链接已复制到剪贴板",copy:"复制",roles:{owner:"所有者",admin:"管理员",member:"成员",guest:"访客"}},AR={title:"许可证",currentPlan:"当前方案",planFree:"社区版",planEnterprise:"企业版",instanceId:"实例 ID",username:"用户名",licenseKey:"许可证密钥",validUntil:"有效期至",statusActive:"已激活",daysRemaining:"剩余 {{count}} 天",daysRemaining_one:"剩余 {{count}} 天",daysRemaining_other:"剩余 {{count}} 天",expired:"已过期",expiresOn:"到期日:{{date}}",expiredWarning:"许可证已过期,企业版功能已不可用",renewalWarning:"许可证将在 {{count}} 天后到期",renewalWarning_one:"许可证将在 {{count}} 天后到期",renewalWarning_other:"许可证将在 {{count}} 天后到期",renewalHint:"请联系销售获取新的许可证密钥,在下方输入以续期。",renew:"续期",refresh:"刷新",trial:"试用",offline:"离线",details:"许可证详情",manage:"许可证管理",upgrade:"升级到企业版",updateKey:"更换或续期许可证密钥",activateDesc:"已有许可证密钥?输入后激活即可解锁企业版全部功能。",keyPlaceholder:"输入许可证密钥…",activate:"激活",activated:"许可证激活成功!",activationFailed:"许可证激活失败。",tryEnterprise:"免费试用企业版 7 天",trialActivated:"企业版 7 天试用已激活!",trialFailed:"试用激活失败。",trialDesc:"体验全部企业版功能,无需信用卡,到期自动恢复社区版。",contactSales:"获取企业版许可证",contactSalesDesc:"复制以下信息发送给销售(邮箱:{{email}}),即可获取许可证密钥。",copyInfo:"复制",copied:"已复制",emailSales:"发送邮件给销售",salesEmail:"business@markus.global",enterpriseFeatures:"企业版功能",freeFeatures:"社区版包含",freeFeaturesDesc:"1,000 奖励积分体验额度,支持所有模型,本地使用无限制",enterpriseFeaturesDesc:"包含社区版全部功能,另外还有:",featureMultiUser:"多用户协作",featureSso:"SSO / SAML 支持",featureAudit:"增强审计日志",featureMultiInstance:"多实例管理",featureOffline:"离线许可证支持",website:"markus.global",docs:"文档中心",learnMore:"了解更多企业版详情",trialAlreadyUsed:"该账号的试用机会已使用。",licenseNotFound:"未找到许可证或许可证不可用。",instanceLimitReached:"该许可证的实例数量已达上限。",organization:"组织",seats:"席位",notOwnedHint:"此许可证由组织所有者管理。许可证详情仅对许可证所有者可见。",cloudAi:"Cloud AI",cloudAiDesc:"在 Hub 网站上管理你的 Markus Cloud AI 订阅、API Key、积分用量和账单。",manageSubscription:"管理订阅与 API Key",apiDocs:"API 文档"},ER={title:"账户",subtitle:"管理 Cloud AI 订阅、组织与本机用户。",cloudAiTitle:"Cloud AI",currentPlan:"当前计划",credits:"积分",personalLimit:"个人限额",bonus:"额外",manageBilling:"管理订阅",manageOrg:"管理组织",orgSection:"组织",memberCount:"成员数"},_R={title:"我的组织",description:"管理您在 Markus Hub 上的组织。组织成员各自在自己的电脑上安装 Markus,共享同一张企业许可证。例如:团队有 5 个人,每人在各自的笔记本上运行独立的 Markus 实例,共用组织的许可证额度。",usersHint:"如果你的团队是在同一台共享服务器上运行 Markus(例如一台 Linux 服务器上多人共用),则需要到「本机的 Markus」标签页中添加本地账号。",nameLabel:"组织名称",nameSaved:"名称已更新",orgId:"组织 ID",licenseStatus:"许可证",seats:"席位",members:"成员",inviteLabel:"邀请成员",invitePlaceholder:"输入邮箱地址",invite:"邀请",invited:"邀请已发送",seatsFullHint:"成员数已达上限。请升级套餐或联系销售扩容。",invalidEmail:"请输入有效的邮箱地址",errorUserNotFound:"未找到该邮箱对应的用户,邀请邮件已发送",errorAlreadyMember:"该用户已是成员或已有待确认的邀请",errorAlreadySent:"该邮箱已有待处理的邀请",errorInviteFailed:"邀请失败",invitedBy:"邀请人",accept:"接受",remove:"移除",leave:"离开组织",leaveConfirmTitle:"确认离开组织",leaveConfirmMsg:"你确定要离开「{{name}}」吗?离开后将无法访问该组织的资源,需要重新被邀请才能加入。",leaveConfirmBtn:"确认离开",leaveCancel:"取消",pending:"待确认",noMembers:"暂无成员",noOrg:"未找到组织。请先连接 Markus Hub。",roleOwner:"所有者",roleAdmin:"管理员",roleMember:"成员",connectHub:"连接 Markus Hub",reconnectHub:"重新连接 Markus Hub",staleSessionHint:"本地仍有 Hub 登录痕迹,但无法加载组织。请重新连接以刷新会话。",popupBlocked:"弹窗被浏览器拦截,请允许本站弹窗后重试。",loginCancelled:"登录已取消。",connecting:"正在连接…",loadFailed:"加载组织失败,请检查网络连接。",noOrgAfterConnect:"连接成功,但未找到组织。您可能需要在 Markus Hub 上创建组织。",switchOrg:"切换组织:",roleUpdated:"角色已更新",yourRole:"你的角色",changeRole:"更改角色"},jR={description:"配置飞书集成,用于接收通知和审批请求",connectionSettings:"连接设置",longConnectionMode:"使用长连接模式 (WebSocket) — 无需公网 IP",actions:"操作",testConnection:"测试连接",integrationState:"集成状态",enableIntegration:"启用飞书集成",enableHint:"启用后,Markus 将通过长连接接入飞书并开始处理事件",notificationForwarding:"通知转发",notifyChatId:"通知发送到",notifyChatIdHint:"选择群聊接收通知,或使用私信(默认)",forwardApprovals:"转发审批请求",forwardApprovalsHint:"将审批请求以交互卡片形式发送到飞书",forwardNotifications:"转发一般通知",forwardNotificationsHint:"将系统通知转发到飞书聊天",notifyPriority:"最低通知优先级",priorityHint:"仅选择优先级级别及以上的通知会被转发",setupGuide:"设置指南",setupGuideDesc:"按以下步骤设置飞书集成:",guideStep1:"前往飞书开放平台 (open.feishu.cn),创建一个「企业自建应用」",guideStep2:"进入应用 → 应用功能 → 机器人,启用机器人能力",guideStep3:"进入应用 → 权限管理,开通 im:message 和 im:message.receive_v1 权限",guideStep4:"进入应用 → 事件与回调 → 订阅方式,选择「使用长连接接收事件」",guideStep5:"在事件与回调页面,添加事件订阅「接收消息 v2.0」(im.message.receive_v1)",guideStep6:"进入应用 → 凭证与基础信息,复制 App ID 和 App Secret 填入上方",guideStep7:"点击「测试连接」验证凭证,然后启用集成",guideStep8:"将机器人添加到需要接收消息的群聊中(或直接给机器人发私聊消息)",longConnectionNote:"长连接模式仅支持企业自建应用,不支持商店应用。使用长连接无需公网 IP 或域名。",quickSetup:"快速设置",oneClickTitle:"一键接入飞书",oneClickDesc:"使用飞书扫描二维码,自动创建并配置应用。无需手动设置。",scanToCreate:"扫码创建应用",oneClickPermissions:"应用将自动获取以下权限:机器人消息发送、消息接收、用户信息读取、群聊管理。",generatingQR:"正在生成二维码...",scanWithFeishu:"使用飞书扫一扫",scanHint:"打开飞书手机客户端,扫描二维码完成授权。应用将创建在你的组织中。",qrExpire:"二维码将在 {{minutes}} 分钟后过期",registerSuccess:"应用创建成功!集成已自动激活。",registerFailed:"注册失败",manualConfig:"手动配置(高级)",appInfo:"应用信息",removeApp:"移除",sendTestMessage:"发送测试消息",chatIdPlaceholder:"输入群聊 ID (oc_xxxxxxxx)",send:"发送",chatIdHint:"群聊 ID 可在飞书群聊的 URL 中找到,或通过 API 获取",chatIdRequired:"请选择一个群聊",selectChat:"— 私信通知(默认) —",loadingChats:"正在加载群列表…",refreshChats:"刷新",noChatHint:"暂无可用群聊,将机器人添加到群聊后可选择群聊通知",noChatFallbackHint:"未选择群聊 — 通知将以私信形式发送给你",selectTestChat:"— 选择一个群聊 —",testMsgSent:"测试消息已发送",testMsgFailed:"发送测试消息失败",saved:"飞书配置已保存",fillRequired:"请先填写 App ID 和 App Secret",testSuccess:"连接成功",testFailed:"连接失败",disconnected:"已断开飞书连接",disconnect:"断开连接"},MR={title:"编程工具",description:"配置外部 AI 编程工具(Claude Code、Codex、Cursor),供智能体在执行实现类任务时调用。",globalEnable:"启用编程工具",globalEnableDesc:"允许具备 coding-tools 技能的智能体调用外部 CLI 编程助手。",ready:"就绪",needsAuth:"需要认证",available:"已安装",notInstalled:"未安装",installHint:"安装方式:",enabled:"启用",stepInstall:"安装 CLI 工具",stepAuth:"完成认证",stepEnable:"在 Markus 中启用",authHint:"通过浏览器登录或输入 API Key 进行认证",sectionModelExec:"模型与执行",sectionAdvanced:"高级设置",loginBtn:"通过浏览器登录",apiKeyBtn:"使用 API Key",loginWaiting:"等待浏览器登录中…",authSuccess:"认证成功!",authFailed:"认证失败,请重试。",authBrowserHint:"浏览器已打开,请在浏览器中完成登录,状态将自动更新。",authPolling:"等待登录完成… 每 15 秒自动检测一次",authPollTimeout:"自动检测超时,请完成登录后点击重新检测。",apiKeySaved:"API Key 已保存到 {{envVar}}",useApiKeyInstead:"改用 API Key",binaryPath:"自定义二进制路径",binaryPathPlaceholder:"留空则使用 PATH",defaultArgs:"默认 CLI 参数",defaultArgsPlaceholder:"例如 --verbose",testConfig:"测试配置",testing:"测试中…",testConfigHint:"发送最小请求以验证凭据、API 密钥和连接状态",timeout:"超时时间",timeoutUnit:"分钟",defaultModel:"默认模型",defaultModelHint:"留空使用工具默认模型。Agent 可在每次调用时覆盖。",modelPlaceholder:"选择或输入模型名称…",noModelsFound:"手动输入模型名称",modelsEmpty:"未获取到模型列表 — CLI 可能较慢或需要重启服务。可手动输入。",modelsFetchError:"获取模型列表失败 — 更新后可能需要重启服务",modelsLoading:"正在获取可用模型(可能需要几秒钟)…",modelsRetry:"重新获取模型列表",useToolDefault:"使用工具默认(不指定模型)",budgetCap:"会话预算上限",budgetCapHint:"通过 --max-budget-usd 由 Claude Code 强制执行的硬限制",approvalRequired:"使用前需要审批",approvalRequiredHint:"Agent 在每次调用此工具之前必须获得用户批准",redetect:"重新检测",detecting:"检测中…",detectingTool:"检测中…",saved:"编程工具设置已保存",failedToSave:"保存编程工具设置失败",failedToLoad:"加载编程工具设置失败",detectionRefreshed:"工具检测已刷新",detectionFailed:"工具检测失败",modelSourceApi:"来自 API",modelSourceCli:"来自 CLI",modelSourceStatic:"内置",cursorApiKeyHint:"如需完整模型列表,请在 <0>控制台</0> 添加 Cursor API Key",cursorApiKeyNote:"Cursor API Key(Pro 计划)— 可获取完整模型列表",cursorDashboardUrl:"https://cursor.com/dashboard/cloud-agents",recheckAuth:"立即检查",testSuccess:"配置正确,连接正常",testFailed:"配置测试失败",testModel:"模型:{{model}}",testAuthVia:"认证方式:{{source}}",testFailedHint:"请检查上方的 API 密钥、端点 URL 或 CLI 安装状态",modelGuidanceCursor:"Cursor CLI 支持的模型。选择「auto」可让 Cursor 自动选择最佳模型。",modelGuidanceClaude:"显示标准模型列表。可手动输入自定义模型名称。",modelGuidanceCodex:"显示标准模型列表。可手动输入自定义模型名称。"},RR={title:nR,nav:rR,appearance:aR,setupGuide:sR,systemStatus:iR,defaultProvider:oR,modelRouting:lR,modelPicker:cR,modelProviders:uR,networkProxy:dR,oauthAuth:mR,oauth:fR,autoDetect:pR,ollama:hR,envConfig:gR,agentExecution:bR,cognitive:xR,searchApi:yR,browserAutomation:vR,dataStorage:wR,oauthConnected:kR,authProfileDeleted:SR,browserOpened:NR,remoteAccess:CR,userManagement:TR,license:AR,account:ER,org:_R,feishu:jR,codingTools:MR},LR={title:"欢迎使用 Markus",subtitle:"几分钟内就绪的 AI 团队",description:"Markus 帮你构建和运行<strong>自主协作的 AI 智能体团队</strong>,它们能协同工作、持续学习,并全天候交付成果。接下来几步快速完成初始设置。"},OR={title:"选择主题",subtitle:"可随时在设置中更改",system:"跟随系统",systemDesc:"跟随操作系统设置",light:"浅色",lightDesc:"始终使用浅色背景",dark:"深色",darkDesc:"暖调炭黑,优雅柔和",cyberpunk:"赛博朋克",cyberpunkDesc:"霓虹粉与深紫",mono:"黑白",monoDesc:"纯黑白极简"},DR={title:"配置 LLM",subtitle:"智能体需要 LLM 来思考与行动",configured:"已配置 LLM 提供商",configuredHint:"可随时在设置中管理提供商。",selectDefault:"点击选择智能体的默认模型:",default:"默认",fromEnv:"来自环境变量",detectingKeys:"正在检测 API keys...",noKeysFound:"未发现 API keys。请在 <code>.env</code> 中设置 <code>ANTHROPIC_API_KEY</code>、<code>OPENAI_API_KEY</code> 等,然后重启。",applyProviders:"应用 {{count}} 个提供商",or:"或",fromOpenClaw:"来自 OpenClaw",detectOpenClaw:"检测 OpenClaw 配置",importModelConfigs:"导入模型配置",noOpenClawFound:"未找到 OpenClaw 配置。",importedModels:"已导入 {{count}} 条模型配置",failedToApply:"应用失败",importFailed:"导入失败",skipForNow:"暂时跳过",openClawFoundLabel:"已找到:",openClawProviders:"({{count}} 个提供商)",autoFallback:"模型出错时自动切换",autoFallbackDesc:"可选;默认关闭。开启后主模型失败时才自动尝试其他提供商"},IR={title:"网络搜索(可选)",subtitle:"赋予智能体搜索网络的能力",description:"启用 Markus 托管搜索,或配置至少一个搜索 API 密钥,让智能体能够获取实时信息。",serper:"Serper (Google)",tavily:"Tavily",bing:"Bing 网页搜索",google:"Google 自定义搜索",serpapi:"SerpAPI",brave:"Brave Search",exa:"Exa",bocha:"博查 (Bocha)",apiKeyPlaceholder:"粘贴 API Key...",save:"保存搜索密钥",saving:"保存中...",saved:"搜索 API 密钥已配置",savedHint:"可随时在设置中管理搜索 API 密钥。",failedToSave:"保存失败",detectingKeys:"正在检测搜索 API 密钥...",detected:"从环境变量检测到:",skipForNow:"暂时跳过"},PR={title:"设置个人资料",subtitle:"介绍一下你自己",saved:"资料已保存",nameLabel:"姓名",namePlaceholder:"请输入姓名",emailLabel:"邮箱",emailPlaceholder:"your@email.com",newPasswordLabel:"新密码",newPasswordPlaceholder:"设置安全密码(至少 6 位)",confirmPasswordLabel:"确认密码",confirmPasswordPlaceholder:"再次输入密码",saveProfile:"保存资料",errors:{nameRequired:"请输入姓名",emailRequired:"请输入邮箱",emailInvalid:"请输入有效的邮箱地址",passwordTooShort:"密码至少需要 6 个字符",passwordMismatch:"两次输入的密码不一致",saveFailed:"保存资料失败,请重试。"}},zR={title:"一切就绪",subtitle:"开始搭建你的 AI 团队",chat:"对话",chatDesc:"与智能体对话或使用 Smart Route 自动委派任务",projects:"项目",projectsDesc:"创建包含需求、任务与交付物的项目",builder:"构建器",builderDesc:"从模板招聘新智能体或自定义角色",settings:"设置",settingsDesc:"管理 LLM 提供商、集成与治理",telemetry:"分享匿名使用数据以帮助改进 Markus",telemetryNote:"不会收集任何代码、提示词或个人数据。你可以随时在设置中更改此选项。"},BR={title:"你将如何使用 Markus?",subtitle:"这有助于我们为你定制体验。",personal:"个人使用",personalDesc:"使用你自己的 AI 智能体。",organization:"组织 & 企业",organizationDesc:"团队共享许可证与协作。",orgNameLabel:"组织名称",orgNamePlaceholder:"输入你的团队名称",defaultOrgName:"{{name}} 的团队",setOrgName:"设置组织名称",orgNameSaved:"已保存",orgNameSaveFailed:"保存组织名称失败,请重试。",pendingInvitations:"你有待接受的组织邀请",invitedBy:"邀请人:{{name}}",acceptAndJoin:"接受并加入",accepting:"加入中...",accepted:"已加入",orCreateNew:"或创建新组织"},$R="开始使用",HR={welcome:LR,theme:OR,llm:DR,search:IR,profile:PR,done:zR,usageType:BR,getStarted:$R},UR="创建",FR="招聘智能体、组建团队并创建技能。秘书会全程处理 — 从寻源到入职。",qR={hireAgent:"招聘智能体",hireAgentDesc:"从模板招聘、创建自定义智能体,或在 Markus Hub 上寻找专家",hireAgentExamples:["招聘一名高级 React 开发者","创建自定义代码审查智能体","在 Hub 上寻找 DevOps 专家"],hireAgentPrompt:"我需要你帮我创建或者招聘一名智能体: ",buildTeam:"组建团队",buildTeamDesc:"为项目组建最佳团队,或部署团队模板",buildTeamExamples:["包含 PM、开发与 QA 的 Web 开发团队","数据工程小组","内容创作团队"],buildTeamPrompt:"我需要你帮我创建或者为以下目标组建团队: ",createSkill:"创建技能",createSkillDesc:"设计智能体可学习并使用的新能力",createSkillExamples:["Git 变更日志生成器","网页抓取技能","数据库迁移工具"],createSkillPrompt:"我需要一个你帮我创建一个skill: "},GR={title:"我的创作",subtitle:"已保存的构建产物 — 安装即可部署,或分享到 Markus Hub。",filterAll:"全部",filterAgents:"智能体",filterTeams:"团队",filterSkills:"技能",loadingArtifacts:"正在加载产物...",noArtifacts:"未找到产物。",noArtifactsHint:"使用上方构建器创建智能体、团队或技能。",openInBuilder:"在构建器中打开"},VR={title:"组织资产",noItems:"该组织暂无共享资产。",noOrgs:"你还未加入任何组织。",loading:"加载中...",by:"作者"},KR="取消分享:从 Markus Hub 下架,本地文件保留",WR="取消分享",YR="取消分享",XR="删除本地文件(不影响已分享到 Hub 的副本)",QR="删除本地文件",ZR="复制 Hub 链接",JR="确认删除",eL="删除本地文件「{{name}}」?此操作无法撤销。已分享到 Hub 的副本不会自动下架。",tL="从 Markus Hub 取消分享「{{name}}」?其他人将无法再下载,本地文件会保留。",nL="确认安装",rL="安装「{{name}}」到当前组织?安装后可在团队中使用。",aL="确认卸载",sL="卸载「{{name}}」?将从当前组织移除已部署的实例,本地创作文件会保留。",iL="安装失败:{{error}}",oL="卸载失败:{{error}}",lL="分享失败:{{error}}",cL="从 Hub 移除失败:{{error}}",uL={agent:"智能体",team:"团队",skill:"技能",name:"名称",description:"描述",category:"分类",baseTemplate:"基础模板",agentRole:"智能体角色",llmProvider:"LLM 提供商",llmModel:"LLM 模型",requiredEnv:"所需环境变量",skills:"技能",files:"文件({{count}})",members:"成员({{count}})"},dL={imagePrompt:"分享前是否要添加一些图片?图片能帮助你的作品在 Hub 上吸引更多用户。",directly:"直接分享",addImagesFirst:"先添加图片",toHub:"分享到 Hub",sharing:"正在分享...",updating:"正在更新...",updateVersion:"更新 v{{version}}",viewOnHub:"在 Hub 查看",submittedForReview:"已提交审核。审核通过前只有你自己能看到,其他人打开链接会看到「审核中」页面。",convertedSlug:"已将包标识从「{{previous}}」自动转换为「{{slug}}」(中文标题保留为显示名)。如需更易读的英文 slug,可稍后自行修改。",convertedAndSubmitted:"已将包标识从「{{previous}}」自动转换为「{{slug}}」,并已提交审核。中文标题保留为显示名。",updateSubmitted:"更新已提交审核。在新版本审核通过前,之前已通过的版本将继续公开展示。",underReview:"审核中",underReviewTip:"此资产正在等待管理员审核。目前只有你自己能看到。",rejected:"已拒绝",rejectedTip:"管理员拒绝了此资产,因此不会公开展示。",updateUnderReview:"更新审核中",updateUnderReviewTip:"你的最新修改正在等待审核。之前已通过的版本将继续公开展示。"},mL={label:"价格",enableTips:"允许用户打赏",reviewNote:"公开和「仅链接」的资产需经管理员审核后才会对他人可见。"},fL={title:"选择分享模式",titleUpdate:"更新分享设置",free:"免费",freeDesc:"所有人均可免费下载",donation:"接受打赏",donationDesc:"免费下载,用户可自愿打赏",paid:"付费下载",paidDesc:"用户需付费才能下载",priceLabel:"价格(美元)",pricePlaceholder:"例如 4.99",update:"更新",share:"分享"},pL={label:"分享到社区",subtitle:"选择谁可以看到它并设置价格。公开资产将经过审核,随后出现在 Markus 广场。",public:"公开",publicDesc:"所有人可见,出现在 Hub 搜索中",org:"组织内",orgDesc:"仅所选组织的成员可见",unlisted:"有链接者",unlistedDesc:"不出现在搜索中,通过链接访问",orgSelect:"选择组织",orgNone:"未找到组织",shared:"已分享",sharedOrg:"组织内",sharedUnlisted:"有链接者"},hL={contentModified:"内容已修改,建议更新版本号。",bumpVersion:"更新版本",newVersion:"新版本:"},gL={dropOrClick:"拖拽图片或点击上传",hint:"上传效果图、截图或演示图片,展示你的作品"},bL={backToBuilder:"返回构建器",notFound:"未找到该产物",saving:"正在保存...",saved:"已保存",saveFailed:"保存失败",edit:"编辑",overview:"概览",untitled:"未命名",addDescription:"点击添加描述...",typeTagAndEnter:"输入后按回车",pasteEmojiOrUrl:"粘贴 emoji 或图片链接...",upload:"上传"},xL={info:"基本信息",type:"类型",category:"分类",version:"版本",author:"作者",agentSpecs:"智能体规格",role:"角色",provider:"服务商",model:"模型",temperature:"温度",composition:"团队构成",totalMembers:"总人数",managers:"管理者",workers:"工作者",skillInfo:"技能信息",alwaysOn:"始终启用",skillFile:"技能文件",permissions:"权限",yes:"是",no:"否",dependencies:"依赖",skills:"技能",environment:"环境变量",openInFinder:"在 Finder 中打开"},yL={title:UR,subtitle:FR,prompts:qR,myCreations:GR,orgAssets:VR,removeFromHubTooltip:KR,unshare:WR,confirmUnshare:YR,deleteLocalTooltip:XR,confirmDeleteLocal:QR,copyHubLinkTooltip:ZR,confirmDelete:JR,deleteCannotUndo:eL,removeFromHub:tL,confirmInstall:nL,confirmInstallMsg:rL,confirmUninstall:aL,confirmUninstallMsg:sL,installFailed:iL,uninstallFailed:oL,shareFailed:lL,hubDeleteFailed:cL,artifact:uL,share:dL,pricing:mL,shareMode:fL,visibility:pL,versionBump:hL,images:gL,detail:bL,sidebar:xL},vL="社区",wL={fromHub:"来自 Markus Hub",loading:"正在从 Hub 加载内容…",missing:"无法加载该 Hub 内容。可能已下架、未公开,或 Hub 暂时不可用。",install:"安装",installing:"安装中…",installed:"已安装",purchaseRequired:"需先在 Hub 购买后才能安装",failed:"安装失败",dismiss:"关闭"},kL={discover:"发现",agents:"智能体",teams:"团队",skills:"技能",connectors:"连接器",installed:"已安装"},SL={title:"Markus 广场",subtitle:"发现社区共享的智能体、AI 小队、技能与连接器 — 由创作者共建的开放生态。",trending:"热门趋势",trendingSub:"社区中下载与评分增长最快的资产",fresh:"新鲜上架",freshSub:"来自创作者的最新作品",topCreators:"顶尖创作者",topCreatorsSub:"生态贡献榜",empty:"生态正在成长中",emptyHint:"成为首批创作者,分享你的第一个资产"},NL={searchPlaceholder:"搜索连接器 (MCP)…",empty:"暂无连接器",emptyHint:"连接器让智能体接入外部工具与服务 (MCP)"},CL={title:"智能体商店",builtin:"内置",markusHub:"Markus Hub",searchPlaceholder:"搜索智能体…",loading:"正在加载智能体…",available:"{{count}} 个智能体可用",noHub:"Markus Hub 上未找到智能体",noHubHint:"Hub 可能离线或为空,请检查网络连接或 Hub URL 配置。",noResults:"没有匹配「{{search}}」的智能体",noAgents:"未找到智能体",noResultsHint:"请尝试其他搜索词。",noAgentsHint:"智能体来自内置注册表。",hireAgent:"聘用智能体",skills:"技能",noSkills:"无需技能",roleConfig:"角色配置",role:"角色:",position:"职位:",starterTasks:"初始任务"},TL={title:"团队商店",builtin:"内置",markusHub:"Markus Hub",searchPlaceholder:"搜索团队…",loading:"正在加载团队…",available:"{{count}} 个团队可用",noHub:"Markus Hub 上未找到团队",noHubHint:"Hub 可能离线或为空,请检查网络连接或 Hub URL 配置。",noResults:"没有匹配「{{search}}」的团队",noTeams:"暂无可用团队",noResultsHint:"请尝试其他搜索词。",noTeamsHint:"前往构建器页面创建团队。",deployTeam:"部署团队",deploying:"部署中…",teamComposition:"团队组成",details:"详情",version:"版本:",author:"作者:",members:"成员:",agents:"{{count}} 个智能体",tags:"标签:",hasManager:"包含管理者"},AL={title:"技能商店",tabs:{installed:"已安装",all:"技能",builtin:"内置",skillhub:"SkillHub",skillssh:"skills.sh",markusHub:"Markus Hub"},searchInstalled:"搜索已安装技能…",skillCount:"{{count}} 个技能",noInstalled:"未找到已安装技能。",noInstalledHint:"浏览 SkillHub 或 skills.sh 发现并安装技能。",builtinCount:"{{count}} 个内置技能可用",refresh:"刷新",loadingBuiltin:"正在加载内置技能…",noBuiltin:"未找到内置技能。",noBuiltinHint:"内置技能位于 templates/skills/ 目录下。",loadingSkillhub:"正在加载 SkillHub 技能…",noSkillhub:"未找到匹配的技能",skillhubTotal:"共 {{count}} 个技能",allCategories:"全部分类",sortScore:"综合排序",sortDownloads:"下载量",sortStars:"收藏数",sortInstalls:"安装量",searchSkillhub:"搜索 SkillHub 技能…",visitSite:"访问站点 →",searchSkillssh:"搜索 skills.sh…",loadingSkillssh:"正在搜索 skills.sh…",browseSkillssh:"浏览 skills.sh 上 84,000+ 个技能",browseSkillsshHint:"热门技能已自动加载,可在上方搜索特定技能。",searchMarkusHub:"搜索 Markus Hub 技能…",communitySkills:"来自 Markus Hub 的社区技能",loadingHub:"正在从 Hub 加载…",noHub:"Markus Hub 上未找到技能",noHubHint:"Hub 可能离线或为空,请检查网络连接或 Hub URL 配置。",prevPage:"← 上一页",nextPage:"下一页 →",pageInfo:"第 {{current}} / {{total}} 页",downloads:"下载",autoDiscovered:"由智能体自动发现",uninstall:"卸载",details:"详情",category:"分类",version:"版本",integration:"集成",instructions:"说明",permissions:"权限",tags:"标签"},EL={install:"安装",installing:"安装中…",installed:"已安装",upgrade:"升级 → v{{version}}",upgrading:"升级中…",upgraded:"已升级!",failed:"失败",purchaseRequired:"需要购买",buy:"购买",waitingPurchase:"等待支付完成…",buyOnHub:"在 Hub 购买",view:"查看 →"},_L={title:"已安装项目",searchPlaceholder:"搜索已安装项目…",noItems:"未找到已安装项目。",noItemsHint:"从商店安装智能体、团队或技能。",loading:"正在加载已安装项目…",filterAll:"全部",filterAgents:"智能体",filterTeams:"团队",filterSkills:"技能",updateAvailable:"有可用更新",updateTo:"更新 → v{{version}}",updating:"更新中…",updateSuccess:"已将 {{name}} 更新到 v{{version}}",updateFailed:"更新 {{name}} 失败"},jL={searchPlaceholder:"搜索模板…",noResults:"未找到模板",install:"安装",installed:"已安装",hire:"聘用",category:"分类",allCategories:"全部分类",hubAgents:"Markus Hub 智能体",hubTeams:"Markus Hub 团队",hubSkills:"Markus Hub 技能",templates:"模板",featured:"精选",popular:"热门",recent:"最近"},ML={description:"描述",skills:"技能",tools:"工具",members:"成员",requirements:"要求",configuration:"配置"},RL={successTitle:"安装成功!",successDesc:"{{name}} 已安装完毕,可以使用了。",done:"完成",errorTitle:"安装失败",errorDesc:"出了点问题,请重试。",close:"关闭",retry:"重试",paidNote:"这是付费内容,请先在 Hub 上购买后再安装。",cancel:"取消",buyOnHub:"去 Hub 购买",installing:"安装中…",install:"安装"},LL={title:"聘用智能体",creating:"正在从「{{name}}」创建智能体",agentName:"智能体名称",assignTeam:"分配到团队(可选)",noTeam:"不分配团队",agentConfig:"智能体配置",role:"角色:",position:"职位:",skills:"技能:",none:"无",cancel:"取消",create:"创建智能体",creating_progress:"创建中…"},OL={title:vL,deepLink:wL,tabs:kL,discover:SL,connectorStore:NL,agentStore:CL,teamStore:TL,skillStore:AL,card:EL,installedTab:_L,marketplace:jL,detail:ML,installDialog:RL,hireModal:LL},DL={title:"智能体资料",status:"状态",role:"角色",team:"团队",uptime:"运行时间",created:"创建时间",lastActive:"最近活动"},IL={overview:"概览",mind:"心智",activity:"活动",memory:"记忆",tools:"能力",settings:"设置",files:"文件",skills:"技能",heartbeat:"心跳",deliverables:"产出"},PL={title:"智能体心智",currentActivity:"当前活动",attention:"注意力",focused:"专注中",deciding:"决策中",reasoning:"当前推理",noActivity:"暂无当前活动"},zL={title:"活动日志",noActivity:"尚未记录活动",timeline:"时间线",thinking:"思考",toolCall:"工具调用",message:"消息",error:"错误"},BL={title:"记忆",layers:{working:"笔记本",shortTerm:"观察记录",longTerm:"知识 (MEMORY.md)",episodic:"情景记忆",semantic:"语义记忆"},noMemories:"尚未存储记忆",clear:"清空",clearConfirm:"清空此层的全部记忆?"},$L={title:"工具",noTools:"暂无可用工具",enabled:"已启用",disabled:"已禁用"},HL={title:"智能体设置",llmProvider:"LLM 提供商",llmModel:"LLM 模型",temperature:"温度",maxTokens:"最大 Token",systemPrompt:"系统提示",skills:"技能"},UL={start:"启动",stop:"停止",restart:"重启",pause:"暂停",resume:"继续",viewProfile:"查看资料",sendMessage:"发送消息"},FL={score:"健康度",tokens:"已用 Token",requests:"请求数",errors:"错误数",cost:"预估费用"},qL={files:"文件",search:"搜索",runtime:"运行时",web:"网络",multimodal:"多模态",browser:"浏览器",tasks:"任务",requirements:"需求",projects:"项目",deliverables:"产出",packages:"包管理 & Hub",communication:"通信",memory:"记忆",mailbox:"邮箱",planning:"规划",teamManager:"团队管理",subagents:"子智能体",system:"系统",llm:"大模型",other:"其他",mcp:"MCP:{{server}}"},GL={taskStatus:{pending:"待处理",assigned:"已分配",in_progress:"进行中",completed:"已完成",failed:"失败",cancelled:"已取消",review:"评审中",approved:"已通过",rejected:"已拒绝",draft:"草稿"},loadingAgent:"正在加载智能体…",chat:"对话",hub:"Hub",publishTitle:"发布到 Markus Hub",publishSuccess:"已将「{{name}}」发布到 Markus Hub",publishFailed:"发布失败:{{error}}",badges:{external:"外部",manager:"管理者"},never:"从未",emDash:"—",roles:{managerDisplay:"★ 管理者",workerDisplay:"◆ 工作者",worker:"工作者"},overview:{identity:"身份",connectionStatus:"连接状态",externalAgentDetails:"外部智能体详情",syncContextTitle:"同步上下文(每个同步周期接收)",gatewayEndpoints:"网关 API 端点",recentTasks:"最近任务",runtimeStatus:"运行状态",usage:"用量",storage:"存储",openFolder:"打开文件夹 →",llmConfiguration:"LLM 配置",recentHeartbeats:"最近心跳",recentA2A:"最近 A2A 通信",heartbeatRuns_one:"{{count}} 次运行",heartbeatRuns_other:"{{count}} 次运行",conversations_one:"{{count}} 个会话",conversations_other:"{{count}} 个会话",labels:{name:"名称",agentRole:"智能体角色",roleTemplate:"角色模板",markusAgentId:"Markus 智能体 ID",agentId:"智能体 ID",organization:"组织",created:"创建时间",connection:"连接",platform:"平台",activeTasks:"进行中任务",lastSync:"上次同步",externalAgentId:"外部智能体 ID",registered:"注册时间",capabilities:"能力",lastHeartbeat:"上次心跳",status:"状态",tokensToday:"今日 Token",totalTokens:"总 Token",requests:"请求数",toolCalls:"工具调用",promptTokens:"提示 Token",completionTokens:"补全 Token",estCost:"预估费用",modelMode:"模型模式",primaryModel:"主模型",fallback:"备用",maxTokensRequest:"单次最大 Token",maxTokensDay:"每日最大 Token",type:"类型",importance:"重要性"},systemDefault:"系统默认",custom:"自定义",systemDefaultShort:"◎ 系统默认",customShort:"⚙ 自定义",followsSystemDefault:"跟随系统默认({{provider}})",systemDefaultParen:"(系统默认)",noneOption:"无",defaultValue:"默认",unlimited:"不限",noneDeclared:"未声明",errorDetails:"错误详情",errorFallback:"智能体遇到错误。请查看日志获取详情。",recentError:"近期错误(已恢复)",errorRecovered:"智能体已自动恢复,当前运行正常。",currentlyWorking:"正在工作",activeTasksCount_one:"{{count}} 个进行中任务",activeTasksCount_other:"{{count}} 个进行中任务",startAgent:"▶ 启动",stopAgent:"⏹ 停止",openClaw:"OpenClaw"},syncContext:{assignedTasks:"带需求与项目可追溯性的任务",inboxMessages:"来自队友的消息",teamContext:"同事(id、姓名、角色、状态)+ 管理者",projectContext:"项目与活跃需求"},gateway:{sync:"交换状态、任务、消息、团队与项目上下文",manual:"下载集成手册(动态,含同事与项目)",team:"查询团队成员、角色与管理者",projects:"列出带治理的项目",requirements:"查询需求(可按项目/状态筛选)"},filesTab:{loading:"正在加载文件…",templateUpdateAvailable:"模板有更新",filesDiffer:"有 {{count}} 个文件与模板 {{templateId}} 不一致:",filesDiffer_plural:"有 {{count}} 个文件与模板 {{templateId}} 不一致:",syncing:"同步中…",syncAll:"全部同步",sendToAgent:"发送给智能体",sendToAgentTitle:"将模板变更通过聊天发送给智能体审阅",agentConfigFiles:"智能体配置文件",templateLabel:"模板:",upToDate:"(已是最新)",updatesAvailable:"(有可用更新)",customAgentNoTemplate:"自定义智能体 — 未关联模板",hideDiff:"隐藏差异",viewDiff:"查看差异",smartSyncTitle:"使用 AI 智能合并模板变更并尽量保留你的自定义内容",merging:"合并中…",smartSync:"智能同步",overwriteTemplateTitle:"用模板内容覆盖",syncThisFile:"同步此文件",undoMergeTitle:"撤销智能同步并恢复之前内容",undoMerge:"撤销合并",unsaved:"未保存",smartSyncResult:"智能同步结果",reviewAndSave:"— 请审阅并保存以应用",roleMdHint:"修改 ROLE.md 将立即更新智能体运行时的系统提示。",noConfigFiles:"该角色下未找到配置文件",copyPath:"复制路径",pathCopied:"已复制",openInFinder:"在文件管理器中打开",fileLabels:{roleMd:"系统提示 / 角色定义",heartbeatMd:"心跳任务",policiesMd:"策略与护栏",contextMd:"上下文与说明"}},diff:{title:"差异:当前 vs 模板({{templateId}})",showFullFile:"显示完整文件",showChangesOnly:"仅显示变更",linesHidden:"··· 已隐藏 {{count}} 行 ···",identical:"文件相同"},toolsTab:{registeredCount:"已注册 {{count}} 个工具",noToolsRegistered:"未注册任何工具"},skillsTab:{alwaysOn:"常驻",builtIn:"内置",installed:"已安装",usesStats:"{{uses}} 次使用 · {{successes}} 次成功",lastUsed:" · 最近 {{date}}",loadingDetails:"正在加载技能详情…",toolsHeading:"工具({{count}})",detailsUnavailable:"无法获取技能详情(可能未在商店注册)",installedCount:"已安装 {{count}} 个技能 — 描述会自动注入智能体上下文",noSkills:"未安装技能",byAuthor:"作者 {{author}}"},memoryTab:{loading:"正在加载记忆…",loadFailed:"加载记忆数据失败",recent:"最近({{count}})",sessions:"会话({{count}})",dailyLogs:"每日日志",longTerm:"长期",recentEntries:"最近记忆条目",noEntries:"暂无记忆条目",chatSessions:"对话会话",noSessions:"暂无会话",msgs:"条消息",loadingMessages:"正在加载消息…",noMessagesInSession:"此会话中无消息",longTermTitle:"长期记忆",noDailyLogs:"暂无每日日志",noLongTerm:"尚未存储长期记忆",roles:{user:"用户",system:"系统",assistant:"助手"},userEditedSource:"用户编辑"},heartbeatTab:{loading:"正在加载心跳数据…",noData:"暂无心跳数据",scheduler:"节奏与日程",triggering:"触发中…",triggerNow:"立即触发",interval:"间隔",safetyNetInterval:"兜底间隔",intervalMinutes_one:"{{count}} 分钟",intervalMinutes_other:"{{count}} 分钟",intervalHours_one:"{{count}} 小时",intervalHours_other:"{{count}} 小时",intervalCustom:"自定义…",intervalCustomUnit:"分钟",intervalSave:"保存",intervalSaving:"保存中…",intervalRangeHint:"允许范围:5 分钟 – 24 小时。",lastRun:"上次运行",nextRun:"下次运行",nextWake:"下次唤醒",rhythmHint:"智能体通过唤醒来安排精确的后续跟进;兜底间隔只是粗粒度的巡检回退。",running:"运行中",stopped:"已停止",pending:"待定",wakeupsTitle:"已排期唤醒",wakeupsCount_one:"{{count}} 个唤醒",wakeupsCount_other:"{{count}} 个唤醒",wakeupNoNote:"(无备注)",recurring:"循环",deliveryInSession:"会话内",deliveryMailbox:"邮箱",cancelWakeup:"取消",pendingOpsTitle:"进行中的异步操作",pendingOpsCount_one:"{{count}} 个进行中",pendingOpsCount_other:"{{count}} 个进行中",timesOut:"超时于",callbackType:{background_exec:"后台进程",a2a_reply:"等待智能体回复",wakeup:"唤醒"},lastSummary:"上次心跳摘要",recentRuns:"最近运行",runsThisSession_one:"本会话 {{count}} 次运行",runsThisSession_other:"本会话 {{count}} 次运行",actionsCount_one:"{{count}} 个操作",actionsCount_other:"{{count}} 个操作",noRunsYet:"本会话尚无心跳运行。",firstHeartbeatSoon:"首次心跳约在 {{when}} 后触发。",schedulerStopped:"心跳调度已停止。",runFirstNow:"立即运行首次心跳",soon:"很快"},relative:{inSeconds:"{{count}} 秒后",inMinutes:"{{count}} 分钟后",inHours:"{{hours}} 小时后",secondsAgo:"{{count}} 秒前",minutesAgo:"{{count}} 分钟前",hoursAgo:"{{hours}} 小时前"},taskLog:{loading:"加载中…",noLogs:"尚无执行日志。"},activityLog:{loading:"加载中…",noLogs:"暂无活动日志。"},mind:{loading:"正在加载智能体心智状态…",idleWaiting:"空闲 — 等待新邮件",queuedButIdle:"队列有 {{count}} 项待处理 — 注意力循环应即将接手…",decidingWaiting:"决策中 — 正在分拣 {{count}} 个待处理项…",deliberationInProgress:"正在深度分拣",since:"自 {{time}} 起",refresh:"↻ 刷新",pauseBtn:"暂停",continueBtn:"继续",cancelCurrentBtn:"取消",cancelConfirmTitle:"取消执行",cancelConfirmMessage:"确定要取消此任务的执行吗?Agent 将立即停止处理。",queue:"队列({{count}})",expandQueue:"展开剩余 {{count}} 项…",collapseQueue:"收起",staleProcessingWarning:"存在异常处理中项目(Agent 已空闲)",agentDetails:"Agent 详情",triageDecision:"分拣决策",processingItem:"处理中:{{id}}…",deferred:"已推迟:{{count}}",dropped:"已丢弃:{{count}}",inlineCompleted:"内联完成:{{count}}",mailboxHistory:"邮箱历史",noHistory:"暂无邮箱历史",loadEarlier:"加载更早…",decisions:"决策",activityHeading:"活动 — {{label}}",success:"✓ 成功",failed:"✗ 失败",processing:"处理中…",noActivityLog:"未记录活动日志",from:"来自:",tokensCount:"{{count}} Token",toolsCount:"{{count}} 个工具",categoryFilters:{all:"全部",interaction:"交互",task:"任务",notification:"通知",system:"系统"},statusFilters:{all:"全部",queued:"排队中",processing:"处理中",completed:"已完成",merged:"已合并",deferred:"已推迟",dropped:"已丢弃"},activityFilters:{all:"全部",task:"任务",chat:"对话",heartbeat:"心跳",a2a:"A2A",internal:"内部",respond_in_session:"会话"},priority:{0:"紧急",1:"高",2:"普通",3:"低",4:"后台"},attention:{idle:"空闲",focused:"专注",deciding:"决策中"},mailbox:{commentFrom:"来自 {{name}} 的评论",commentFromAuthor:"{{author}}:{{text}}",humanChat:"人类对话",chatFrom:"来自 {{sender}} 的对话",agentMessage:"智能体消息",messageFrom:"来自 {{sender}} 的消息",mentionedBy:"由 {{name}} 提及",mention:"提及",reviewRequestFrom:"来自 {{sender}} 的评审请求",reviewRequest:"评审请求",replyInSession:"会话内回复({{sender}})",sessionReply:"会话回复",scheduledHeartbeat:"定时心跳签到",dailyReport:"日报",memoryConsolidation:"记忆整理",systemAnnouncement:"系统公告",systemEvent:"系统事件",statusArrow:"{{from}} → {{to}}"}}},VL={empty:"暂无交付物",emptyHint:"该智能体创建的交付物将显示在这里",count:"共 {{count}} 个交付物",summary:"摘要",reference:"引用",format:"格式",created:"创建于",updated:"更新于",accessed:"访问 {{count}} 次",openInPage:"在产出页面中打开"},KL={profile:DL,tabs:IL,mind:PL,activity:zL,memory:BL,tools:$L,settings:HL,actions:UL,health:FL,toolCategories:qL,profilePage:GL,deliverables:VL},WL="产出",YL="+ 创建",XL="搜索交付物…",QL={allTypes:"全部类型",allProjects:"全部项目",active:"活跃",verified:"已验证",outdated:"已过时",group:"分组:",clearAll:"清除全部",filtersLabel:"筛选",refreshing:"刷新中..."},ZL={date:"日期",project:"项目",team:"团队",agent:"智能体"},JL="▶ 展开",eO="▼ 折叠",tO={title:"暂无交付物",subtitle:"交付物由智能体在完成任务后自动创建,无需手动添加",goToWork:"前往任务页面创建",noResults:"没有匹配的交付物",noResultsHint:"试试调整搜索词或筛选条件"},nO={selectToView:"请选择交付物以查看详情",keyboardHint:"使用 ↑↓ 方向键导航,⌘F 搜索",details:"详情",verify:"验证",flagOutdated:"标记为已过时",flagging:"正在标记…",openInBuilder:"在 Builder 中打开",noContent:"无内容",cannotPreview:"无法在浏览器中预览此 {{type}}。",loadingPreview:"正在加载预览…",artifactDirectory:"产物目录",copyFailed:"复制失败 — 请长按手动复制",failedToOpen:"打开失败",failedToOpenBrowser:"无法打开文件浏览器",openInFileBrowser:"在文件浏览器中打开",revealInFinder:"在访达中显示",copyPath:"复制路径到剪贴板",fileMissing:"引用的文件在磁盘上已不存在",confirmRemoveTitle:"移除交付物",confirmRemoveMessage:'"{{name}}" 将被移除,此操作不可撤销。',openUrl:"在新标签页中打开",edit:"编辑",preview:"预览",save:"保存",saving:"保存中...",saved:"已保存",saveFailed:"保存失败",unsavedTitle:"未保存的更改",unsavedMessage:"你有未保存的更改。离开前是否需要保存?",discard:"放弃",saveAndLeave:"保存"},rO={title:"差异统计",files:"{{count}} 个文件"},aO={title:"测试",passed:"{{count}} 通过",failed:"{{count}} 失败",skipped:"{{count}} 跳过"},sO={title:"链接",task:"任务:{{id}}",agent:"智能体:{{name}}",project:"项目:{{name}}"},iO={created:"创建时间:",updated:"更新时间:",accessed:"访问次数:",id:"ID:{{id}}"},oO="无项目",lO="无团队",cO={title:"创建交付物",type:"类型",titleField:"标题",titleRequired:"标题为必填项",titlePlaceholder:"清晰、可检索的标题",reference:"引用",referenceHint:"文件路径、URL、分支名",referencePlaceholder:"/path/to/file 或 https://...",summary:"摘要",summaryHint:"Markdown",summaryPlaceholder:"描述该交付物…",tags:"标签",tagsHint:"逗号分隔",tagsPlaceholder:"react, api, docs",project:"项目",created:"交付物已创建",required:"*"},uO={partial:"{{loaded}} / {{total}} 个交付物",total:"共 {{total}} 个交付物"},dO={collapse:"收起侧边栏",expand:"展开侧边栏"},mO={openChat:"与智能体对话",closeChat:"关闭对话",placeholder:"给智能体发消息…",currentDeliverable:"当前交付物",selectedFrom:"选自"},fO={addToConversation:"添加到对话"},pO={title:"分享到 Markus Hub",needHubLogin:"需登录 Markus Hub 账号后才能分享产出物。",loggingIn:"正在打开登录…",loginHub:"登录 Markus Hub 账号",loginHint:"解锁后将支持一键公开/链接分享产出物。",visibility:"可见性",public:"公开(所有人可见 + 搜索引擎)",publicHint:"公开产出物需经 Hub 审核后发布,发布后所有人可见并参与搜索",publicVisibility:"公开",link:"有链接可见",linkHint:"仅获得链接的人可查看,不参与搜索引擎;同样需经 Hub 审核",linkVisibility:"有链接可见",titleField:"标题",titlePlaceholder:"清晰、可检索的标题",summary:"摘要",summaryPlaceholder:"简要描述该产出物…",tags:"标签",tagsPlaceholder:"输入标签后回车添加",shareToHub:"分享到 Hub",sharing:"分享中…",published:"已发布",pendingReview:"审核中",pendingHint:"你的产出物已提交审核,通过后将生成可分享链接。",rejected:"已拒绝",revoked:"已取消分享,该产出物不再公开可访问。",resubmit:"重新提交",shareAgain:"重新分享",revoke:"取消分享",urlPending:"链接生成中,稍后刷新查看…"},hO={justNow:"刚刚",minutesAgo:"{{count}}分钟前",hoursAgo:"{{count}}小时前",yesterday:"昨天",daysAgo:"{{count}}天前",monthsAgo:"{{count}}个月前",yearsAgo:"{{count}}年前"},gO={title:WL,create:YL,searchPlaceholder:XL,filters:QL,groupBy:ZL,expandAll:JL,collapseAll:eO,empty:tO,detail:nO,diffStats:rO,testResults:aO,links:sO,metadata:iO,noProject:oO,noTeam:lO,createModal:cO,count:uO,sidebar:dO,chat:mO,contextMenu:fO,share:pO,time:hO},bO="报告",xO={dashboard:"仪表盘",history:"历史"},yO={tasksCompleted:"已完成任务",ofTotal:"共 {{total}} 项",activeContributors:"活跃贡献者",agentsAndHumans:"{{agents}} 智能体 · {{humans}} 人类",cuConsumed:"积分消耗",tokensConsumed:"Token 消耗",todayAmount:"今日:{{amount}}",successRate:"成功率",healthScore:"健康度:{{score}}/100"},vO={title:"Cloud AI",personalLimitLabel:"个人积分限额",personalLimit:"组织管理员为您设置了个人积分限额。",notConnected:"未连接到 Markus Hub",connect:"连接",bonus:"奖励:{{amount}}",resetsAt:"重置时间 {{date}}",topUp:"充值",windowQuota:"5小时窗口:{{amount}} 积分(可升级)",windowUsageLabel:"5小时窗口用量",windowQuotaNone:"5小时窗口:未启用",rateLimit:"无 Markus 侧请求次数上限;上游模型供应商仍可能限流"},wO={title:"智能体排名",noData:"暂无智能体数据。启动智能体后可在此查看。",name:"智能体",team:"团队",tasks:"任务",cuUsed:"积分消耗",tokens:"Tokens",efficiency:"效率",total:"合计({{count}} 个智能体)",mixedProviders:"混合供应商 — 积分仅统计 Cloud AI",showAll:"展开全部 {{count}} 个",showLess:"收起"},kO={title:"团队成员",name:"姓名",role:"角色",team:"团队"},SO={title:"团队表现",members:"{{agents}}A · {{humans}}H",tasks:"任务",cuUsed:"积分",tokens:"Tokens",managedBy:"管理者:{{name}}"},NO={title:"用量趋势",byDay:"按天",byHour:"按小时",days:"天",totalCredits:"积分消耗",totalTokens:"Token 消耗",totalRequests:"请求次数",creditsChart:"积分",tokensChart:"Tokens",max:"最大",noData:"暂无用量数据。连接 Markus Hub 查看趋势。",models:"模型"},CO={planPending:"计划待处理",planStatus:"计划 {{status}}",taskMetrics:"任务指标",metric:{completed:"已完成",inProgress:"进行中",created:"已创建",blocked:"已阻塞",failed:"失败"},costOverview:"费用概览",totalTokens:"Token 总计",cuUsed:"积分消耗",trend:"趋势",taskSummary:"任务摘要",completedCount:"已完成({{count}})",inProgressCount:"进行中({{count}})",blockedCount:"已阻塞({{count}})",noTasks:"该时间段内没有任务。",highlights:"要点",blockers:"阻塞项",upcomingPlan:"后续计划",approvePlan:"批准计划",rejectPlan:"拒绝计划",rejectionReason:"拒绝原因:",planApproved:"计划已批准",planRejected:"计划已拒绝",noDetailedMetrics:"此报告不包含详细指标数据。",feedbackTitle:"反馈({{count}})",feedbackPlaceholder:"添加反馈或说明…",feedbackAdded:"反馈已添加"},TO="尚未生成报告。",AO="{{type}} 报告",EO="← 返回列表",_O={title:bO,tabs:xO,kpi:yO,quota:vO,agents:wO,humans:kO,teamPerf:SO,trends:NO,history:CO,noReportsYet:TO,reportType:AO,backToList:EO},jO={alex:{name:"Alex Chen"},sarah:{name:"Sarah Liu"},james:{name:"James Wang"},emily:{name:"Emily Zhang"},michael:{name:"Michael Li"}},MO={secretary:{name:"秘书",role:"行政协调员",activity:"协调日常运营"},chiefOfStaff:{name:"首席幕僚",role:"跨团队协调员",activity:"跨团队协调"},strategyAnalyst:{name:"战略分析师",role:"竞争情报",activity:"竞争情报分析"},engLead:{name:"工程主管",role:"工程经理",activity:"迭代规划与代码审查"},srBackend:{name:"高级后端开发",role:"后端工程师",activity:"构建支付API"},backend:{name:"后端开发",role:"后端工程师",activity:"数据库迁移"},srFrontend:{name:"高级前端开发",role:"前端工程师",activity:"仪表盘重构"},frontend:{name:"前端开发",role:"前端工程师",activity:"组件库开发"},mobile:{name:"移动端开发",role:"移动端工程师",activity:"等待API就绪"},devops:{name:"运维工程师",role:"基础设施工程师",activity:"CI/CD流水线"},qaLead:{name:"测试主管",role:"质量保障经理",activity:"自动化测试"},qaEng:{name:"测试工程师",role:"质量保障",activity:"回归测试"},security:{name:"安全审计员",role:"安全工程师",activity:"每周扫描已排期"},pm:{name:"产品经理",role:"产品管理",activity:"迭代规划"},uxResearcher:{name:"用户体验研究员",role:"用户体验",activity:"访谈分析"},uiDesigner:{name:"UI设计师",role:"视觉设计",activity:"设计系统更新"},dataAnalyst:{name:"数据分析师",role:"商业智能",activity:"漏斗分析"},researchLead:{name:"研究主管",role:"研究总监",activity:"竞争格局分析"},mlEngineer:{name:"机器学习工程师",role:"机器学习",activity:"模型微调"},researchAnalyst:{name:"研究分析师",role:"研究与分析",activity:"专利分析"},techWriter:{name:"技术文档工程师",role:"技术文档",activity:"API文档编写"},contentLead:{name:"内容主管",role:"内容策略",activity:"编辑日历"},seo:{name:"SEO专家",role:"搜索优化",activity:"关键词研究完成"},socialMedia:{name:"社交媒体运营",role:"社交与增长",activity:"营销活动排期"},copywriter:{name:"文案策划",role:"内容创作",activity:"落地页文案"},hr:{name:"人力资源协调员",role:"人力资源",activity:"入职文档已就绪"},legal:{name:"法务合规",role:"法律事务",activity:"隐私审查完成"},finance:{name:"财务分析师",role:"财务分析",activity:"月度报告"}},RO={engineering:{name:"核心工程团队",desc:"后端、前端、移动端、运维、测试和安全"},productDesign:{name:"产品设计团队",desc:"产品管理、用户体验研究、UI设计和数据分析"},research:{name:"研究与AI团队",desc:"研究、机器学习工程和技术文档"},content:{name:"内容增长团队",desc:"内容策略、SEO、社交媒体和文案创作"},operations:{name:"运营团队",desc:"人力资源、法务、合规和财务"},projectAlpha:{name:"Alpha项目组",desc:"支付平台发布的跨职能冲刺团队"}},LO={payment:{name:"支付平台v2",desc:"完整的支付基础设施,支持Stripe、PayPal和加密货币"},dashboard:{name:"仪表盘重构",desc:"现代化分析仪表盘,实时数据可视化"},research:{name:"Q2市场调研",desc:"竞争格局分析和市场定位"},mobile:{name:"移动应用MVP",desc:"跨平台移动应用,核心功能集"},securityAudit:{name:"Q1安全审计",desc:"全面的安全审计和漏洞评估"}},OO={paymentWebhook:"实现Stripe和PayPal Webhook端点",dbSchema:"设计支付交易数据库Schema",userResearch:"综合24份用户访谈生成洞察报告",competitorReport:"Q2竞争格局分析:覆盖12家竞品",cicdSetup:"搭建6阶段CI/CD流水线(含金丝雀发布)",designTokens:"导出设计系统Token:42色彩、8间距",authFlow:"实现OAuth 2.0 + API Key认证流程",loadTesting:"构建万级并发压力测试平台",seoMatrix:"调研8个产品垂类1200+关键词",privacyDraft:"起草符合GDPR的欧盟版隐私政策",q1Finance:"编制Q1财务报表含各部门损益",testFramework:"基于Playwright搭建端到端测试框架",paymentReconciliation:"构建幂等支付对账API",dashboardCharts:"基于D3.js实现交互式图表组件",mobileOnboarding:"设计并实现5步移动端引导体验",mlPipeline:"搭建欺诈检测模型训练流水线",rateLimiting:"实现API限流:1000次/分钟",editorialCalendar:"规划Q3四渠道内容编辑日历",funnelAnalysis:"分析用户转化漏斗:注册→激活→留存",componentDocs:"为47个React UI组件编写文档",regressionSuite:"将回归测试扩展至312个用例",socialCampaign:"制作60+产品发布营销素材",idempotency:"为所有写入端点添加幂等键验证",landingMockup:"落地页重设计:8个高保真页面",patentReport:"分析AI工作流自动化领域847项专利",apiDocsV2:"为86个API端点编写开发者文档",monthlyFinance:"编制5月月度财务结算报告",securityScan:"自动化OWASP Top 10周度安全扫描",disputeHandling:"构建对接Stripe API的支付争议流程",darkMode:"实现系统感知的深色模式主题切换",pushNotifications:"构建FCM/APNs推送通知服务",abTesting:"搭建基于Feature Flag的A/B测试框架",blogAiWorkforce:"撰写博客:'AI原生员工团队革命'",offlineMode:"实现IndexedDB离线优先数据同步",perfBenchmarks:"性能基准测试:API p99、FCP、TTI",emailOnboarding:"设计5封引导邮件序列含数据分析",mobilePayment:"集成Stripe React Native支付SDK",deepLinking:"实现iOS Universal Links和Android App Links",legacyMigration:"遗留数据迁移脚本",legacyMigrationError:"数据结构不匹配——遗留字段类型不兼容"},DO={paymentWebhook:"处理Stripe/PayPal传入的Webhook事件。验证签名、解析事件负载、更新数据库中的交易状态,并触发下游对账工作流。",dbSchema:"设计涵盖交易、结算和争议的规范化数据库Schema。支持多币种、部分退款,以及含时间戳的完整审计追踪。",userResearch:"综合分析24份用户访谈数据(覆盖4类用户画像)。生成亲和图、关键洞察卡片和优先级推荐矩阵。",competitorReport:"深入分析5个细分市场的12家竞品。产出功能对比矩阵、定价分析和战略建议。",cicdSetup:"配置GitHub Actions流水线:lint → 测试 → 构建 → 金丝雀(5%) → 生产。包含Cosign镜像签名和SBOM生成。",designTokens:"将Figma设计Token导出为CSS自定义属性和Tailwind配置。涵盖色彩、间距、字体、阴影和圆角。",authFlow:"实现OAuth 2.0授权码流程(含PKCE)、API Key认证,以及可配置TTL的JWT Token轮换。",loadTesting:"基于k6构建压力测试工具,模拟万级并发用户访问支付、仪表盘和认证端点。输出Grafana兼容指标。",seoMatrix:"调研8个垂类1200+关键词。按搜索量、难度和意图评分。关联内容日历并预测流量影响。",privacyDraft:"起草隐私政策:涵盖数据收集、处理、保留和删除。符合GDPR第13-14条和CCPA要求。",q1Finance:"编制Q1财务报表:营收$6.8M,毛利率76%,各部门损益明细,以及至Q3的现金流预测。",testFramework:"基于Playwright搭建端到端测试框架。覆盖API、UI和视觉回归测试。4工作线程并行执行,Slack报告集成。",paymentReconciliation:"构建对账引擎:匹配入账交易与预期付款。处理部分匹配、时序差异和币种转换。",dashboardCharts:"基于D3.js实现6种图表类型(折线、柱状、饼图、面积、散点、热力图)。支持自适应尺寸、工具提示、下钻和数据导出。",mobileOnboarding:"设计并实现5步引导流程:欢迎→个人资料→权限→教程→主页。按步骤追踪完成率。",mlPipeline:"搭建MLflow训练流水线:数据采集→特征工程→模型训练→评估→A/B部署清单。",rateLimiting:"基于Redis实现滑动窗口限流。每API Key 1000次/分钟,突发上限2000次,优雅返回429响应。",editorialCalendar:"规划Q3博客、社交、Newsletter和文档四渠道内容。关联产品发布节点和SEO机会。",funnelAnalysis:"分析注册到付费的转化漏斗:定位前3大流失节点,按来源/设备细分,推荐优化方案。",componentDocs:"基于Storybook为47个React组件生成交互式文档。包含Props表格、无障碍审计和包大小影响。",regressionSuite:"将回归测试扩展至312个用例(覆盖8个模块)。修复5个不稳定测试,添加重试逻辑,通过率98.4%。",socialCampaign:"为产品发布制作60+素材:轮播图、视频脚本、A/B标题。适配LinkedIn、Twitter/X和Instagram。",idempotency:"为所有写入端点添加幂等键验证。Redis存储Key(24小时TTL),重复请求返回缓存响应。",landingMockup:"重设计落地页:首屏、功能展示、社交证明、定价。8个高保真页面含移动端响应式适配。",patentReport:"分析AI工作流自动化领域847项专利。将权利要求映射到产品功能,识别自由实施风险和IP布局空白。",apiDocsV2:"为86个端点编写开发者文档,含Python、Node、Go、Ruby和cURL代码示例。包含认证指南和Webhook配置。",monthlyFinance:"5月月度结算:营收$2.4M(环比+18%),SaaS ARR突破$24M,CAC回收期11个月,毛利率78%。",securityScan:"在CI中自动化ZAP + Semgrep的OWASP Top 10扫描。生成周度安全面板和修复优先级队列。",disputeHandling:"构建争议生命周期:开启→举证→仲裁→解决。集成Stripe Disputes API并自动生成应答模板。",darkMode:"基于CSS自定义属性实现系统感知深色模式。支持手动切换并通过localStorage持久化。",pushNotifications:"构建FCM(Android)和APNs(iOS)推送服务。支持主题订阅、富媒体通知和投递数据分析。",abTesting:"基于LaunchDarkly Feature Flag搭建A/B测试。服务端分流、转化追踪和统计显著性计算。",blogAiWorkforce:"撰写2500字博客文章:AI原生团队范式。涵盖自主Agent、自组织团队和实际ROI案例。",offlineMode:"基于IndexedDB + Background Sync实现离线优先架构。本地队列写操作,重连时冲突解决。",perfBenchmarks:"API p99延迟(目标<200ms)、FCP(<1.5s)、TTI(<3s)基准测试。对比基线并生成回归告警。",emailOnboarding:"设计5封引导邮件:欢迎→核心功能→使用技巧→案例分享→升级引导。追踪打开率、点击率和转化。",mobilePayment:"集成Stripe React Native SDK。支持Apple Pay、Google Pay、银行卡和3D Secure。处理弱网场景。",deepLinking:"配置iOS Universal Links和Android App Links。深度链接路由至指定页面,Web回退兜底。"},IO={stripePaypal:"支付平台v2需支持Stripe、PayPal和加密货币",dashboardPerf:"仪表盘在3G网络下需2秒内加载",openApiDocs:"所有API端点需有OpenAPI文档",offlineCore:"移动应用核心功能需支持离线",gdpr:"所有用户数据需符合GDPR",monthlyReport:"每月5日前提交高管报告",competitiveQuarterly:"竞品分析每季度更新",paymentSla:"支付服务99.9% SLA"},PO={stripePaypal:"集成Stripe和PayPal支付网关,支持完整生命周期:授权、扣款、退款、争议和Webhook驱动的状态更新。加密货币通过Coinbase Commerce作为第二阶段实施。",dashboardPerf:"所有仪表盘视图在模拟3G下FCP<1.5s、TTI<2s。实施代码分割、懒加载和边缘缓存。",openApiDocs:"每个公开和内部API端点必须有完整的OpenAPI 3.1规范,含请求/响应Schema、认证要求、限流策略和5种语言的代码示例。",offlineCore:"核心功能(任务查看、消息起草、交付物浏览)必须通过IndexedDB支持离线使用。本地队列写操作,重连时同步并解决冲突。",gdpr:"所有用户数据处理需符合GDPR第5-9条。实现数据主体访问请求、删除权、数据可携带性和同意管理。",monthlyReport:"自动化月度高管报告:涵盖营收、Agent效率、任务指标和系统健康状况。每月5日前交付所有创始人。",competitiveQuarterly:"全面竞争分析:涵盖市场定位、功能对标、定价策略和新兴威胁。每季度更新并附可执行建议。",paymentSla:"支付处理端点需保持99.9%可用性SLA。实施多区域故障转移、熔断器和自动化事件响应。"},zO={paymentApiSpec:"支付API v2 — OpenAPI规范",dashboardMockups:"仪表盘重设计稿",q2Report:"Q2竞争格局报告",cicdConfig:"CI/CD流水线配置",componentDocs:"组件库文档",securityReport:"Q1安全审计报告",mlResults:"ML模型训练结果",seoMatrix:"SEO关键词矩阵",financeReport:"5月月度财务报告",apiDocsV2:"API文档v2",interviewNotes:"用户研究访谈记录",wireframes:"移动应用线框图",patentAnalysis:"专利格局分析",testFramework:"自动化测试框架",socialAssets:"社交媒体营销素材"},BO={paymentApiSpec:`### 支付对账 API v2
191
+ 批准后,任务将自动出现在此处。`,emptyFilteredTitle:"没有匹配的工作项",emptyFilteredHint:"当前负责人筛选下没有结果。清除筛选以查看此项目的全部内容。",emptyDetailTitle:"未选择条目",emptyDetailHint:"从列表中选择一条需求或任务,或新建一条开始工作。",createRequirementCta:"+ 创建需求",filtersSheetTitle:"筛选",clearAll:"全部清除",projectsFilterGroup:"项目",agentsFilterGroup:"智能体",newRequirementModalTitle:"新建需求",newRequirementModalHint:"描述你的需求。智能体将把已批准的需求拆分为任务。",selectProject:"选择项目…",reqTitleExample:"例如:添加用户认证",reqDescPlaceholder:"需要什么以及原因…",rejectRequirementTitle:"拒绝需求",rejectReasonLabel:"原因",rejectReasonPlaceholder:"拒绝原因…",cronLabel:"Cron",scheduledShort:"已计划",everyInterval:"每 {{interval}}",reply:"回复",hideLog:"隐藏日志",viewLog:"查看日志",viewProfile:"查看资料 →",agentNotFound:"未找到智能体:{{id}}…",workerRole:"工作者",clickToEdit:"点击编辑",systemAuthor:"系统",noteTimeJustNow:"刚刚",noteTimeMinutes:"{{count}} 分钟前",noteTimeHours:"{{count}} 小时前",noteTimeDays:"{{count}} 天前",online:"在线",working:"工作中",error:"错误",offline:"离线",paused:"已暂停",filePreviewLoading:"加载中…",emptyDirectory:"空目录",openInFinder:"在文件管理器中打开",openInDeliverables:"在产出页面中打开",requirementDetailDescription:"描述",requirementNoDescription:"暂无描述",createdByLabel:"创建者",agentTag:"(智能体)",createdLabel:"创建时间",approvedBy:"批准人",rejectionReason:"拒绝原因",linkedTasks:"关联任务({{count}})",cancelRequirement:"取消需求",commentsWithCount:"评论({{count}})",noCommentsYet:"暂无评论。",requirementShort:"需求",taskShort:"任务",schedShort:"计划",backlogTitle:"标题",backlogUpdated:"更新",noItems:"无条目",loadingPage:"加载中…",adminFallback:"管理员",titleField:"标题",descriptionField:"描述",priorityField:"优先级",projectsCountLabel_one:"{{count}} 个项目",projectsCountLabel_other:"{{count}} 个项目",noMatches:"无匹配项",searchPlaceholder:"输入以搜索…"},VM={requirements:"需求",newRequirement:"新建需求",noRequirements:"暂无需求",approved:"已批准",rejected:"已拒绝",approveRequirement:"批准",rejectRequirement:"拒绝",cancelConfirmTitle:"取消需求",cancelConfirmMessage:"确定要取消此需求吗?此操作不可撤销。",cancelConfirmLabel:"取消需求",createTask:"任务",noLinkedTasks:"暂无关联任务,创建一个来开始吧。",goal:"目标循环",goalActive:"活跃",goalMaxReached:"已达上限",goalIteration:"迭代 {{current}}/{{max}}",goalLastChecked:"上次检查:{{time}}",goalAutoResume:"自动恢复"},KM={all:"全部",active:"活跃",completed:"已完成",search:"搜索任务…",status:"状态",assignee:"负责人",priority:"优先级",sortBy:"排序",groupBy:"分组"},WM={pending:"待处理",inProgress:"进行中",review:"审核中",completed:"已完成",failed:"失败",blocked:"已阻塞"},YM={failed:"失败",todo:"待办",in_progress:"进行中",review:"审核中",done:"完成",closed:"已关闭"},XM={task:{pending:"待处理",in_progress:"进行中",blocked:"已阻塞",review:"审核中",revision:"修改中",completed:"已完成",failed:"失败",rejected:"已拒绝",cancelled:"已取消",archived:"已归档"},requirement:{pending:"待处理",in_progress:"进行中",completed:"完成",rejected:"已拒绝",cancelled:"已取消",archived:"已归档"},sub:{pending:"待处理",blocked:"已阻塞",failed:"失败",rejected:"已拒绝"},project:{active:"进行中",planning:"规划中",review:"审核中",completed:"已完成",archived:"已归档",paused:"已暂停"}},QM={low:"低",medium:"中",high:"高",urgent:"紧急"},ZM={noProjects:"暂无项目",createFirst:"创建第一个项目以开始"},JM={justNow:"刚刚",minutesAgo:"{{count}} 分钟前",hoursAgo:"{{count}} 小时前",daysAgo:"{{count}} 天前"},eR={filter:{todo:"待办",in_progress:"进行中",review:"审核中",done:"已完成"},reset:"重置",archivedToggle:"{{count}} 个已归档",expandHint:"点击卡片展开依赖关系",backToOverview:"← 返回概览",dragHint:"拖拽连线 · 点击边线移除",noTasks:"暂无任务可显示",reqLabel:"需求",taskCount_one:"{{count}} 个任务",taskCount_other:"{{count}} 个任务",depCount_one:"{{count}} 个依赖",depCount_other:"{{count}} 个依赖",removeDependencyTitle:"移除依赖?",removeDependencyBody:"「{{target}}」将不再被「{{source}}」阻塞。",toast:{dependencyExists:"依赖关系已存在",cycleError:"无法添加:会形成循环依赖",dependencyAdded:"已添加依赖",dependencyRemoved:"已移除依赖",failed:"失败:{{message}}"}},tR={title:FM,project:qM,task:GM,requirement:VM,filters:KM,board:WM,boardColumn:YM,status:XM,priority:QM,empty:ZM,relative:JM,dag:eR},nR="设置",rR={appearance:"通用",providers:"模型配置",execution:"智能体配置",browser:"浏览器自动化",search:"网络搜索",codingTools:"编程工具",storage:"数据与存储",users:"用户管理",remote:"远程访问",integrations:"外部IM集成",license:"许可证",organization:"组织",account:"账户",group:{general:"偏好",aiConfig:"AI 配置",tools:"工具与能力",connections:"连接与集成",account:"账户"}},aR={title:"通用",theme:"主题",themeDesc:"选择界面视觉样式",language:"语言",languageDesc:"选择界面显示语言",launchAtLogin:"开机自动启动",launchAtLoginDesc:"登录电脑后在后台自动启动 Markus",modes:{system:"跟随系统",light:"浅色",dark:"深色",cyberpunk:"赛博朋克",mono:"黑白"}},sR={title:"欢迎 — 配置你的 LLM",subtitle:"Markus 至少需要配置一个 LLM 提供商才能工作。选择一种入门方式:",skip:"跳过",fromEnv:{step:"1",title:"从环境变量读取",description:"自动检测来自 .env 或系统环境的 API Key。",noKeysHint:"未找到 API Key。请设置诸如 <code>ANTHROPIC_API_KEY</code> 或 <code>OPENAI_API_KEY</code> 等环境变量,然后重启服务器。"},fromOllama:{step:"2",title:"本地 Ollama",description:"自动检测本地运行的 Ollama 服务并选择模型。"},fromOpenClaw:{step:"3",title:"从 OpenClaw 配置导入",description:"从已有的 OpenClaw 安装导入模型配置。"},manual:{step:"4",title:"手动配置",description:"直接编辑 <code>~/.markus/markus.json</code>,然后重启服务器。"},browserExtension:{step:"5",title:"安装浏览器自动化扩展",description:"让 AI 智能体能直接操控 Chrome 浏览网页、测试应用,无需每次弹窗授权。",notChrome:"当前浏览器不是 Chrome,请在 Chrome 中打开 Markus 以安装扩展。",alreadyConnected:"扩展已连接,无需操作。",downloadBtn:"下载扩展",openChromeBtn:"打开扩展页面",loadHint:"解压后,在 Chrome 扩展页面开启「开发者模式」→「加载已解压的扩展程序」→ 选择解压文件夹"},applyProviders:"应用 {{count}} 个提供商",foundPrefix:"已找到:"},iR={title:"系统状态",status:"状态",healthy:"正常",version:"版本",activeAgents:"活跃智能体"},oR={title:"默认 LLM 提供商",primaryProvider:"主提供商",primaryProviderDesc:"除非另行指定,否则用于所有智能体交互",noProviders:"尚未配置提供商",updated:"默认提供商已更新为 {{name}}",autoFallback:"自动切换模型",autoFallbackDesc:"默认关闭。开启后主模型出错时会自动尝试其他提供商/模型;关闭则直接报错,由你手动切换。"},lR={title:"模型路由",defaultModelTitle:"默认模型",defaultModelDesc:"当能力没有指定模型时,使用此默认模型。",defaultModelPlaceholder:"选择默认模型...",capabilityAssignTitle:"能力分配",capabilityAssignDesc:"为每种能力类型指定使用的模型。未指定的能力将使用上方的默认模型。",capabilityGroups:{text:"文本",image:"图像",audio:"音频",video:"视频",other:"其他"},capabilities:{text:"通用",image_recognition:"图像识别",image_generation:"图像生成",audio_tts:"文字转语音",audio_stt:"语音转文字",video_generation:"视频生成"},auto:"使用默认",selectModel:"选择模型...",suggested:"推荐",noModelAvailable:"无可用模型",addProviderHint:"可在上方添加支持此功能的服务商",clear:"清除",loadError:"加载路由设置失败:{{error}}",saving:"保存中...",saved:"已保存",saveError:"保存失败",mismatchHint:"模型与此能力类型不匹配 — 请选择兼容的模型",staleProvider:"服务商未配置 — 请清除或重新配置",noProvidersHint:"请先在上方配置至少一个服务商,才能为能力指定模型。",restoreRecommended:"恢复 Markus 推荐",restoreWorking:"恢复中…",restoreConfirm:"用 Markus 推荐覆盖当前模型路由,并将默认提供商切换为 Markus?您已自定义的能力映射将被覆盖。",loadingModels:"正在加载模型列表…",tier:{base:"基础",pro:"专业",max:"旗舰"}},cR={loading:"正在加载模型…",empty:"此提供商暂无可用模型。",filterPlaceholder:"筛选模型…",searchPlaceholder:"搜索模型…",showAll:"显示全部 {{count}} 个模型…",showLess:"收起",allCount:"全部 ({{count}})",tierCount:"{{tier}} ({{count}})",active:"当前",perMillion:"每百万",ctx:"上下文",costFree:"免费",capabilities:{tools:"工具",vision:"视觉",reasoning:"推理",caching:"缓存",search:"搜索"}},uR={title:"模型提供商",disabled:"已禁用",notConfigured:"点击配置",addProvider:"+ 添加提供商",addNewProvider:"添加新提供商",providerName:"提供商",selectProvider:"选择提供商...",customProvider:"自定义 (OpenAI 兼容)",customName:"自定义提供商名称",validatingKey:"正在验证密钥并加载模型...",selectModel:"选择模型",advancedSettings:"高级设置 (Base URL、定价覆盖...)",providerNameHint:"使用 anthropic、openai、google、ollama 表示官方接口;其他名称将按 OpenAI 兼容 API 处理",apiKey:"API Key",apiKeyPlaceholder:"留空则保留当前值",baseUrl:"Base URL(可选)",baseUrlLabel:"Base URL",defaultModel:"默认模型",contextWindow:"上下文窗口",maxOutputTokens:"最大输出 Token",inputCost:"$/1M 输入",outputCost:"$/1M 输出",editProvider:"编辑提供商",deleteConfirm:"删除提供商「{{name}}」?",providerAdded:"已添加提供商 {{name}}",notConfiguredHint:"尚未配置。请使用下方「添加提供商」按钮,或在环境变量中设置 API Key。",quickSetupHint:"输入 API Key 即可立即启用此提供商。",markusKeyHint:"前往以下页面获取 Markus Cloud AI API Key:",markusKeyLink:"Hub 设置",quickSetupPlaceholder:"在此粘贴 API Key...",quickSetupSubmit:"启用",quickSetupSaving:"启用中...",quickSetupSuccess:"{{name}} 已就绪!",keyReadOnly:"密钥(只读)",pricingTitle:"定价(每百万 Token)",input:"输入",output:"输出",cacheRead:"缓存读取",cacheWrite:"缓存写入",availableModels:"可用模型",addModel:"+ 添加模型",addModelTitle:"添加模型",browseFromCatalog:"从目录浏览",browse:"浏览",selectFromCatalog:"从目录选择",loadingCatalog:"正在从目录加载模型...",loadingHubCatalog:"正在从 Hub 加载模型…",hubCatalogEmpty:"未能加载模型列表。请确认设置中的 Hub 地址可访问,然后折叠再展开 Markus。",hubCatalogError:"加载 Hub 模型目录失败:{{error}}",moreCatalogModels:"目录中还有 {{count}} 个模型可用...",modelsAvailable:"{{count}} 个模型可用",andMoreModels:"... 以及另外 {{count}} 个模型",catalogModelsAvailable:"该提供商还支持 {{count}} 个其他模型",showAllModels:"显示全部 {{count}} 个模型",filterModels:"筛选模型…",noFilterMatches:"没有匹配的模型",collapseModels:"收起",modelId:"模型 ID",displayName:"显示名称",reasoning:"推理",vision:"视觉",capImageGen:"生图",capTts:"语音",capStt:"听写",capVideo:"视频",custom:"自定义",use:"使用",switching:"正在切换…",model:"模型",ctxTokens:"{{size}}K 上下文",costPerMillion:"${{input}}/{{output}} 每百万",badgeDefault:"默认",badgeOAuth:"OAuth",clickToDisable:"点击禁用",clickToEnable:"点击启用",maxOutput:"最大输出",kTokens:"{{k}}K tokens",notApplicable:"不适用",baseUrlDisplayDefault:"默认",active:"当前",deleteCustomModelTitle:"删除自定义模型",costPair:"${{input}}/{{output}}",adding:"正在添加…",costPerMillionIn:"$/1M 入:",costPerMillionOut:"出:",placeholderContextTokens:"上下文(tokens)",placeholderProviderName:"例如 deepseek、openrouter、my-provider",placeholderApiKeySk:"sk-...",placeholderBaseUrl:"https://api.example.com/v1",placeholderDefaultModel:"例如 deepseek-chat、gpt-4o",placeholderContextExample:"例如 128000",placeholderMaxOutputExample:"例如 16384",placeholderCostInput:"例如 1",placeholderCostOutput:"例如 5",addProviderSubmit:"添加提供商",saveFailed:"保存失败",failedToAdd:"添加失败",test:"测试",testing:"测试中…",testOk:"正常({{ms}}ms)",testModel:"测试用模型",testDefaultModel:"(使用默认模型)",testFailed:"不可用",testFailedCode:"错误 {{code}}",testSuccess:"连接成功,耗时 {{ms}}ms — 回复:{{reply}}",testDetail:{requestUrl:"请求地址",model:"模型",requestBody:"请求参数",response:"响应内容",duration:"耗时",tokens:"Token 用量",inputTokens:"输入",outputTokens:"输出"},configuredCount:"已配置",groupConfigured:"已配置({{count}}个)",groupUnconfigured:"更多提供商",markusHint:"连接到 Markus Cloud AI 服务",markusSetup:"输入您的 Markus API 密钥进行连接。您可以从 Markus Hub 账户中获取。",markusSetupLogin:"登录您的 Markus Hub 账户即可自动连接 Markus Cloud AI。",markusConnected:"已连接",markusConnectedHint:"您的 Markus Cloud AI 连接通过 Hub 账户管理。前往设置管理您的订阅和积分。",goToAccount:"前往账户设置",connect:"连接"},dR={title:"网络代理",description:"配置用于 ChatGPT OAuth 登录和 Codex API 调用的 HTTP 代理。其他 LLM 服务商通过系统/TUN 代理自动生效。",active:"生效中:",noProxy:"未检测到代理",sourceConfig:"markus.json",sourceEnv:"环境变量",sourceSystem:"macOS 系统",placeholder:"http://127.0.0.1:7890(留空则自动检测)",saving:"保存中...",save:"保存",saved:"已保存,重启服务后生效。",saveFailed:"保存失败",networkError:"网络错误",refresh:"重新检测",disabled:"代理已禁用"},mR={title:"OAuth 认证",description:"使用 ChatGPT 账号登录,通过订阅额度使用 Codex 模型(无需 API Key)。",signInWith:"使用 {{name}} 登录",connecting:"连接中...",device:"设备码",deviceTitle:"设备码登录(适用于远程/无头环境)",deviceCodeTitle:"设备码登录",deviceInstructions:"请打开验证地址并输入以下代码:",deviceWaiting:"等待授权中...(15 分钟后过期)",manualCallbackHint:"如果浏览器未打开或您在远程机器上,请粘贴回调 URL:",manualPlaceholder:"http://localhost:1455/auth/callback?code=...",submit:"提交",connectedAccounts:"已连接账号",expired:"令牌已过期/失效",reconnect:"重新认证",disconnect:"断开",noProviders:"无可用 OAuth 提供商",deviceCodeFailed:"设备码登录失败"},fR={loginFailed:"登录失败",networkErrorDuringLogin:"OAuth 登录时网络错误",callbackFailed:"回调失败"},pR={title:"自动检测与导入",description:"从环境变量、本地 Ollama 服务或已有配置中发现 LLM 提供商。"},hR={title:"本地 Ollama",description:"自动检测本地运行的 Ollama 服务,并将其配置为模型提供商。无需 API Key。",detect:"检测 Ollama",detecting:"检测中…",foundModels:"在 {{url}} 发现 {{count}} 个模型",notRunning:"本地未检测到 Ollama 服务。请先启动 Ollama,然后点击检测。",detectFailed:"检测 Ollama 服务失败",useModel:"使用 {{model}}",configured:"已配置 Ollama,模型为 {{model}}",applyFailed:"配置 Ollama 失败",switchModel:"切换模型"},gR={title:"环境变量配置",description:"从环境变量检测模型 API Key,并写入配置文件。",refreshEnv:"刷新环境变量",detectedProviders:"已检测到的提供商 — 选择要应用的项:",noKeysFound:"环境变量中未找到模型 API Key",detectionFailed:"检测失败",failedToDetect:"无法检测环境变量",applyToConfig:"将 {{count}} 个提供商应用到配置",selectAtLeastOne:"请至少选择一个提供商再应用",applyFailed:"应用失败(HTTP {{status}})",failedToApply:"无法应用环境配置",detectionFailedHttp:"检测失败(HTTP {{status}})",keyLabel:"密钥:",modelLabel:"模型:",urlLabel:"URL:",llmTimeout:"LLM 超时:{{ms}}ms(来自 LLM_TIMEOUT_MS)"},bR={title:"智能体执行",maxToolIterations:"最大工具迭代次数",maxToolIterationsDesc:"单次智能体回合中工具调用循环的安全上限(0 表示无限制,适用于所有智能体与子智能体)",saved:"已保存",failedToSave:"保存失败"},xR={title:"认知准备管线",description:"每次主 LLM 调用之前,智能体会运行一次轻量的认知评估,分析刺激并准备角色感知上下文。这可以提升响应相关性,代价是增加一次小型 LLM 调用(约 500ms)。",enabled:"启用 CPP",enabledDesc:"启用后,智能体在响应前会运行认知评估",maxDepth:"最大认知深度",maxDepthDesc:"控制每次响应前的准备工作深度",depthD1:"仅评估",depthD2:"评估 + 检索 + 反思",depthD3:"完整管线 + 事后评估",saved:"已保存",failedToSave:"保存失败"},yR={title:"网络搜索",description:"优先级:已连接 Hub 且余额不为 0 时优先 Markus 托管;否则优先自备 API。",serper:"Serper (Google)",serperHint:"serper.dev",tavily:"Tavily",tavilyHint:"tavily.com",bing:"Bing 网页搜索",bingHint:"Azure",google:"Google 自定义搜索",googleHint:"API Key + 搜索引擎 ID",googleCxPlaceholder:"搜索引擎 ID (cx)...",serpapi:"SerpAPI",serpapiHint:"serpapi.com",brave:"Brave Search",braveHint:"brave.com",exa:"Exa",exaHint:"exa.ai",bocha:"博查 (Bocha)",bochaHint:"bochaai.com",configured:"已配置",notConfigured:"未配置",apiKeyPlaceholder:"在此粘贴 API Key...",saved:"搜索 API 密钥已保存",failedToSave:"保存搜索 API 密钥失败",envDetected:"来自环境变量",markus:"Markus 托管搜索",markusBadge:"推荐",markusHint:"无需第三方密钥 · 使用 Markus Cloud 余额",markusProviderLabel:"搜索引擎",markusProviderBocha:"博查(中文)",markusProviderTavily:"Tavily",markusUnavailable:"需登录 Markus",markusUnavailableHint:"请先在「模型服务商」连接 Markus。",modelLabel:"检索模型",modelHint:"托管搜索按次计费。若已配置上方自备密钥,将优先使用(不走该模型)。Sonar 比 Sonar Pro 更便宜。",modelSonar:"Perplexity Sonar(默认,更省)",modelSonarPro:"Perplexity Sonar Pro(质量更高)",ownKeysTitle:"自备 API 密钥",ownKeysHint:"可选后备",test:"测试",testing:"测试中…",testOk:"成功,返回 {{count}} 条结果",testFailed:"测试失败",enabled:"已启用",disabled:"已禁用"},vR={title:"浏览器自动化",description:"Chrome DevTools 浏览器技能相关设置。智能体使用 Chrome 浏览网页、测试 Web 应用并检查页面。",bringToFront:"置于前台",bringToFrontDesc:"启用后,智能体导航时 Chrome 标签页会被提到前台。关闭时(默认)智能体在后台静默工作,不会抢占焦点。",autoCloseTabs:"自动关闭标签页",autoCloseTabsDesc:"智能体任务结束或智能体被移除时,自动关闭由其占用的浏览器标签页。",remoteDebuggingPort:"远程调试端口",remoteDebuggingPortDesc:"设置固定调试端口(例如 9222),避免每次智能体连接 Chrome 时都弹出权限对话框。",remoteDebuggingPortDescLead:"设置固定调试端口(例如 9222),避免每次智能体连接 Chrome 时都弹出权限对话框。请使用以下参数启动 Chrome:",remoteDebuggingPortDescTail:"然后在此处填写相同端口。填 0 则使用自动连接(每次需手动批准权限)。",tabsForeground:"标签页将置于前台",tabsBackground:"标签页将保留在后台",usingPort:"正在使用端口 {{port}} 的持久连接(不再出现权限对话框)",usingAutoConnect:"正在使用自动连接模式(每次连接都需要权限对话框)",autoClickAllowDialog:"自动允许 Chrome 调试弹窗",autoClickAllowDialogDesc:"Chrome 每次被 Markus 连接时都会弹出「允许远程调试?」对话框。开启后,Markus 通过操作系统辅助功能 API 自动点击「允许」按钮。",autoClickAllowDialogMacNote:"macOS:需在「系统设置 → 隐私与安全性 → 辅助功能」中授予运行 Markus 的应用(Markus.app / Terminal / iTerm)权限。",autoClickAllowDialogWinNote:"Windows:无需额外权限,使用内置 UI Automation。",autoClickAllowDialogLinuxNote:"Linux:暂不支持。请使用上方「远程调试端口」作为替代方案。",autoClickAllowDialogSupported:"当前平台支持",autoClickAllowDialogUnsupported:"当前平台暂不支持",autoClickTest:"测试",autoClickTesting:"测试中...",autoClickTestSuccess:"自动点击验证通过!已成功连接 Chrome 并加载测试页面({{title}})。",autoClickTestNoPermission:"辅助功能权限未授予。已打开系统设置页面,请将本应用添加到列表中。",autoClickTestChromeNotRunning:"Chrome 未运行。请先启动 Chrome。",autoClickTestUnsupported:"当前平台不支持自动点击。请使用「远程调试端口」作为替代方案。",autoClickTestError:"测试失败:{{error}}",modeExtension:"Chrome 扩展(已激活)",modeExtensionDesc:"浏览器工具通过扩展运行 — 无调试弹窗、无需额外权限、锁屏可用。",modeDebuggingPort:"远程调试端口 :{{port}}(已激活)",modeDebuggingPortDesc:"通过持久调试端口连接 — 每次连接无需权限弹窗。",modeAutoClick:"自动连接 + 自动点击(已激活)",modeAutoClickDesc:"使用 chrome-devtools-mcp 并通过系统 API 自动点击调试弹窗。锁屏时可能不工作。",modeManual:"自动连接(需手动允许)",modeManualDesc:"每次 Agent 连接浏览器时,Chrome 会弹出权限对话框,需要手动点击「允许」。",modeRecommended:"推荐",generalSettings:"通用设置",fallbackModes:"连接方式(备选)",extensionStatus:"Chrome 扩展",extensionStatusDesc:"无需调试弹窗即可实现浏览器自动化。无需辅助功能权限,锁屏状态下也能正常工作。",extensionConnected:"已连接",extensionDisconnected:"未连接",extensionActiveNote:"扩展已激活 — 浏览器工具通过扩展运行(无调试弹窗)",extensionSetupTitle:"安装 Chrome 扩展",extensionStep1:"下载并解压扩展",extensionStep1Desc:"下载压缩包后,解压到任意位置(如桌面)",extensionStep1Btn:"下载 markus-browser-extension.zip",extensionStep1Downloading:"准备下载...",extensionStep2:"打开 Chrome 扩展页面",extensionStep2Desc:"在 Chrome 中打开扩展管理页面",extensionStep2Btn:"打开 chrome://extensions",extensionStep3:"加载扩展",extensionStep3Desc:"开启右上角的「开发者模式」开关,点击「加载已解压的扩展程序」,选择第 1 步解压出来的文件夹",extensionDownloadError:"下载扩展失败",extensionOpenError:"打开 Chrome 扩展页面失败"},wR={title:"数据与存储",scanning:"正在扫描存储…",openInFinder:"在访达中打开",storageBreakdown:"存储明细",agentStorage:"智能体存储({{count}})",openFolder:"打开文件夹",orphanedDirectories:"孤立目录",orphanedDesc:"这些目录没有对应的数据库记录,可能是在删除智能体或团队时遗留的。",orphanedTotal:"合计:{{size}},共 {{count}} 个目录。",cleanSelected:"清理所选({{size}})",cleanAll:"全部清理({{size}})",cleaning:"正在清理…",cleaned:"已清理 {{count}} 个目录,释放 {{size}}",bytesZero:"0 B",unitB:"B",unitKB:"KB",unitMB:"MB",unitGB:"GB",teamKind:"团队",selectedWithSize:"已选 {{count}} 项({{size}})",cleanupFailed:"清理失败",cleanedWithFailureNote:"{{base}}({{count}} 项失败)",sortedBySize:"按占用排序",clearableHint:"其中约 {{size}}({{percent}}%)是可清理的调试日志,不影响日常使用。",safetyLevel:{safe:"可清理"},items:{database:{label:"数据库",blurb:"任务、智能体、聊天等核心数据"},agents:{label:"智能体",blurb:"工作区、记忆、角色与会话文件"},skills:{label:"技能",blurb:"已安装的 Skill 包"},llmLogs:{label:"模型日志",blurb:"请求/响应审计日志,可按需清理以释放空间"},builderArtifacts:{label:"创作产物",blurb:"资产页「我的创作」的本地源文件"},teams:{label:"团队",blurb:"团队公告与规范"},shared:{label:"共享文件",blurb:"跨智能体共享文件与任务产出"},knowledge:{label:"知识库",blurb:"可供检索的知识条目"}}},kR="已通过 OAuth 连接到 {{provider}}",SR="认证配置已删除",NR="已打开浏览器以完成授权。请在浏览器窗口中完成登录…",CR={title:"远程访问",description:"通过 Markus Hub 的 WebRTC P2P 连接,从手机或任何设备访问此 Markus 实例。",loginRequired:"请先登录 Markus Hub 以启用远程访问。",signIn:"登录",signedInAs:"已登录:",enabled:"远程访问已启用",disabled:"远程访问已禁用",connecting:"正在连接信令服务器…",registering:"正在注册到 Hub…",connected:"已连接",disconnected:"已断开",peerCount_one:"{{count}} 个对等节点",peerCount_other:"{{count}} 个对等节点",url:"远程访问地址",copy:"复制",copied:"已复制!",qrCode:"二维码",scanQr:"用手机相机扫描以连接",enableFailed:"启用远程访问失败",disableFailed:"禁用远程访问失败",connectedPeers:"已连接的设备",connectedSince:"连接于 {{time}}",peerConnecting:"连接中"},TR={title:"本机的 Markus",sharedInstanceDesc:"管理当前这台机器上的 Markus 用户账号。所有账号共享同一个工作区、相同的 AI Agent 和团队。例如:一台共享的 Linux 服务器上,多位同事各自用不同的账号登录同一个 Markus。",orgHint:"如果团队成员各自在自己的电脑上使用独立的 Markus,请到「账户」标签页查看组织信息,并前往 Hub 管理组织。",orgLink:"",name:"姓名",email:"邮箱",role:"角色",actions:"操作",noUsers:"暂无用户",editUser:"编辑",deleteUser:"删除",resetPassword:"重置密码",save:"保存",cancel:"取消",confirmDelete:"确定要移除该用户吗?此操作不可撤销。",confirmDeleteTitle:"移除用户",newPassword:"新密码",confirmReset:"重置",resetSuccess:"密码已重置",addUser:"添加用户",addSuccess:"用户已创建",password:"密码",updateSuccess:"用户已更新",deleteSuccess:"用户已移除",error:"操作失败",cannotDeleteSelf:"不能删除自己的账户",cannotDeleteOwner:"不能移除主要所有者",inviteLink:"邀请",inviteLinkGenerated:"邀请链接已生成 — 复制并发送给用户",copyInviteLink:"将此链接发送给用户,以便他们设置账号:",linkCopied:"链接已复制到剪贴板",copy:"复制",roles:{owner:"所有者",admin:"管理员",member:"成员",guest:"访客"}},AR={title:"许可证",currentPlan:"当前方案",planFree:"社区版",planEnterprise:"企业版",instanceId:"实例 ID",username:"用户名",licenseKey:"许可证密钥",validUntil:"有效期至",statusActive:"已激活",daysRemaining:"剩余 {{count}} 天",daysRemaining_one:"剩余 {{count}} 天",daysRemaining_other:"剩余 {{count}} 天",expired:"已过期",expiresOn:"到期日:{{date}}",expiredWarning:"许可证已过期,企业版功能已不可用",renewalWarning:"许可证将在 {{count}} 天后到期",renewalWarning_one:"许可证将在 {{count}} 天后到期",renewalWarning_other:"许可证将在 {{count}} 天后到期",renewalHint:"请联系销售获取新的许可证密钥,在下方输入以续期。",renew:"续期",refresh:"刷新",trial:"试用",offline:"离线",details:"许可证详情",manage:"许可证管理",upgrade:"升级到企业版",updateKey:"更换或续期许可证密钥",activateDesc:"已有许可证密钥?输入后激活即可解锁企业版全部功能。",keyPlaceholder:"输入许可证密钥…",activate:"激活",activated:"许可证激活成功!",activationFailed:"许可证激活失败。",tryEnterprise:"免费试用企业版 7 天",trialActivated:"企业版 7 天试用已激活!",trialFailed:"试用激活失败。",trialDesc:"体验全部企业版功能,无需信用卡,到期自动恢复社区版。",contactSales:"获取企业版许可证",contactSalesDesc:"复制以下信息发送给销售(邮箱:{{email}}),即可获取许可证密钥。",copyInfo:"复制",copied:"已复制",emailSales:"发送邮件给销售",salesEmail:"business@markus.global",enterpriseFeatures:"企业版功能",freeFeatures:"社区版包含",freeFeaturesDesc:"1,000 奖励积分体验额度,支持所有模型,本地使用无限制",enterpriseFeaturesDesc:"包含社区版全部功能,另外还有:",featureMultiUser:"多用户协作",featureSso:"SSO / SAML 支持",featureAudit:"增强审计日志",featureMultiInstance:"多实例管理",featureOffline:"离线许可证支持",website:"markus.global",docs:"文档中心",learnMore:"了解更多企业版详情",trialAlreadyUsed:"该账号的试用机会已使用。",licenseNotFound:"未找到许可证或许可证不可用。",instanceLimitReached:"该许可证的实例数量已达上限。",organization:"组织",seats:"席位",notOwnedHint:"此许可证由组织所有者管理。许可证详情仅对许可证所有者可见。",cloudAi:"Cloud AI",cloudAiDesc:"在 Hub 网站上管理你的 Markus Cloud AI 订阅、API Key、积分用量和账单。",manageSubscription:"管理订阅与 API Key",apiDocs:"API 文档"},ER={title:"账户",subtitle:"管理 Cloud AI 订阅、组织与本机用户。",cloudAiTitle:"Cloud AI",currentPlan:"当前计划",credits:"积分",personalLimit:"个人限额",bonus:"额外",manageBilling:"管理订阅",manageOrg:"管理组织",orgSection:"组织",memberCount:"成员数"},_R={title:"我的组织",description:"管理您在 Markus Hub 上的组织。组织成员各自在自己的电脑上安装 Markus,共享同一张企业许可证。例如:团队有 5 个人,每人在各自的笔记本上运行独立的 Markus 实例,共用组织的许可证额度。",usersHint:"如果你的团队是在同一台共享服务器上运行 Markus(例如一台 Linux 服务器上多人共用),则需要到「本机的 Markus」标签页中添加本地账号。",nameLabel:"组织名称",nameSaved:"名称已更新",orgId:"组织 ID",licenseStatus:"许可证",seats:"席位",members:"成员",inviteLabel:"邀请成员",invitePlaceholder:"输入邮箱地址",invite:"邀请",invited:"邀请已发送",seatsFullHint:"成员数已达上限。请升级套餐或联系销售扩容。",invalidEmail:"请输入有效的邮箱地址",errorUserNotFound:"未找到该邮箱对应的用户,邀请邮件已发送",errorAlreadyMember:"该用户已是成员或已有待确认的邀请",errorAlreadySent:"该邮箱已有待处理的邀请",errorInviteFailed:"邀请失败",invitedBy:"邀请人",accept:"接受",remove:"移除",leave:"离开组织",leaveConfirmTitle:"确认离开组织",leaveConfirmMsg:"你确定要离开「{{name}}」吗?离开后将无法访问该组织的资源,需要重新被邀请才能加入。",leaveConfirmBtn:"确认离开",leaveCancel:"取消",pending:"待确认",noMembers:"暂无成员",noOrg:"未找到组织。请先连接 Markus Hub。",roleOwner:"所有者",roleAdmin:"管理员",roleMember:"成员",connectHub:"连接 Markus Hub",reconnectHub:"重新连接 Markus Hub",staleSessionHint:"本地仍有 Hub 登录痕迹,但无法加载组织。请重新连接以刷新会话。",popupBlocked:"弹窗被浏览器拦截,请允许本站弹窗后重试。",loginCancelled:"登录已取消。",connecting:"正在连接…",loadFailed:"加载组织失败,请检查网络连接。",noOrgAfterConnect:"连接成功,但未找到组织。您可能需要在 Markus Hub 上创建组织。",switchOrg:"切换组织:",roleUpdated:"角色已更新",yourRole:"你的角色",changeRole:"更改角色"},jR={description:"配置飞书集成,用于接收通知和审批请求",connectionSettings:"连接设置",longConnectionMode:"使用长连接模式 (WebSocket) — 无需公网 IP",actions:"操作",testConnection:"测试连接",integrationState:"集成状态",enableIntegration:"启用飞书集成",enableHint:"启用后,Markus 将通过长连接接入飞书并开始处理事件",notificationForwarding:"通知转发",notifyChatId:"通知发送到",notifyChatIdHint:"选择群聊接收通知,或使用私信(默认)",forwardApprovals:"转发审批请求",forwardApprovalsHint:"将审批请求以交互卡片形式发送到飞书",forwardNotifications:"转发一般通知",forwardNotificationsHint:"将系统通知转发到飞书聊天",notifyPriority:"最低通知优先级",priorityHint:"仅选择优先级级别及以上的通知会被转发",setupGuide:"设置指南",setupGuideDesc:"按以下步骤设置飞书集成:",guideStep1:"前往飞书开放平台 (open.feishu.cn),创建一个「企业自建应用」",guideStep2:"进入应用 → 应用功能 → 机器人,启用机器人能力",guideStep3:"进入应用 → 权限管理,开通 im:message 和 im:message.receive_v1 权限",guideStep4:"进入应用 → 事件与回调 → 订阅方式,选择「使用长连接接收事件」",guideStep5:"在事件与回调页面,添加事件订阅「接收消息 v2.0」(im.message.receive_v1)",guideStep6:"进入应用 → 凭证与基础信息,复制 App ID 和 App Secret 填入上方",guideStep7:"点击「测试连接」验证凭证,然后启用集成",guideStep8:"将机器人添加到需要接收消息的群聊中(或直接给机器人发私聊消息)",longConnectionNote:"长连接模式仅支持企业自建应用,不支持商店应用。使用长连接无需公网 IP 或域名。",quickSetup:"快速设置",oneClickTitle:"一键接入飞书",oneClickDesc:"使用飞书扫描二维码,自动创建并配置应用。无需手动设置。",scanToCreate:"扫码创建应用",oneClickPermissions:"应用将自动获取以下权限:机器人消息发送、消息接收、用户信息读取、群聊管理。",generatingQR:"正在生成二维码...",scanWithFeishu:"使用飞书扫一扫",scanHint:"打开飞书手机客户端,扫描二维码完成授权。应用将创建在你的组织中。",qrExpire:"二维码将在 {{minutes}} 分钟后过期",registerSuccess:"应用创建成功!集成已自动激活。",registerFailed:"注册失败",manualConfig:"手动配置(高级)",appInfo:"应用信息",removeApp:"移除",sendTestMessage:"发送测试消息",chatIdPlaceholder:"输入群聊 ID (oc_xxxxxxxx)",send:"发送",chatIdHint:"群聊 ID 可在飞书群聊的 URL 中找到,或通过 API 获取",chatIdRequired:"请选择一个群聊",selectChat:"— 私信通知(默认) —",loadingChats:"正在加载群列表…",refreshChats:"刷新",noChatHint:"暂无可用群聊,将机器人添加到群聊后可选择群聊通知",noChatFallbackHint:"未选择群聊 — 通知将以私信形式发送给你",selectTestChat:"— 选择一个群聊 —",testMsgSent:"测试消息已发送",testMsgFailed:"发送测试消息失败",saved:"飞书配置已保存",fillRequired:"请先填写 App ID 和 App Secret",testSuccess:"连接成功",testFailed:"连接失败",disconnected:"已断开飞书连接",disconnect:"断开连接"},MR={title:"编程工具",description:"配置外部 AI 编程工具(Claude Code、Codex、Cursor),供智能体在执行实现类任务时调用。",globalEnable:"启用编程工具",globalEnableDesc:"允许具备 coding-tools 技能的智能体调用外部 CLI 编程助手。",ready:"就绪",needsAuth:"需要认证",available:"已安装",notInstalled:"未安装",installHint:"安装方式:",enabled:"启用",stepInstall:"安装 CLI 工具",stepAuth:"完成认证",stepEnable:"在 Markus 中启用",authHint:"通过浏览器登录或输入 API Key 进行认证",sectionModelExec:"模型与执行",sectionAdvanced:"高级设置",loginBtn:"通过浏览器登录",apiKeyBtn:"使用 API Key",loginWaiting:"等待浏览器登录中…",authSuccess:"认证成功!",authFailed:"认证失败,请重试。",authBrowserHint:"浏览器已打开,请在浏览器中完成登录,状态将自动更新。",authPolling:"等待登录完成… 每 15 秒自动检测一次",authPollTimeout:"自动检测超时,请完成登录后点击重新检测。",apiKeySaved:"API Key 已保存到 {{envVar}}",useApiKeyInstead:"改用 API Key",binaryPath:"自定义二进制路径",binaryPathPlaceholder:"留空则使用 PATH",defaultArgs:"默认 CLI 参数",defaultArgsPlaceholder:"例如 --verbose",testConfig:"测试配置",testing:"测试中…",testConfigHint:"发送最小请求以验证凭据、API 密钥和连接状态",timeout:"超时时间",timeoutUnit:"分钟",defaultModel:"默认模型",defaultModelHint:"留空使用工具默认模型。Agent 可在每次调用时覆盖。",modelPlaceholder:"选择或输入模型名称…",noModelsFound:"手动输入模型名称",modelsEmpty:"未获取到模型列表 — CLI 可能较慢或需要重启服务。可手动输入。",modelsFetchError:"获取模型列表失败 — 更新后可能需要重启服务",modelsLoading:"正在获取可用模型(可能需要几秒钟)…",modelsRetry:"重新获取模型列表",useToolDefault:"使用工具默认(不指定模型)",budgetCap:"会话预算上限",budgetCapHint:"通过 --max-budget-usd 由 Claude Code 强制执行的硬限制",approvalRequired:"使用前需要审批",approvalRequiredHint:"Agent 在每次调用此工具之前必须获得用户批准",redetect:"重新检测",detecting:"检测中…",detectingTool:"检测中…",saved:"编程工具设置已保存",failedToSave:"保存编程工具设置失败",failedToLoad:"加载编程工具设置失败",detectionRefreshed:"工具检测已刷新",detectionFailed:"工具检测失败",modelSourceApi:"来自 API",modelSourceCli:"来自 CLI",modelSourceStatic:"内置",cursorApiKeyHint:"如需完整模型列表,请在 <0>控制台</0> 添加 Cursor API Key",cursorApiKeyNote:"Cursor API Key(Pro 计划)— 可获取完整模型列表",cursorDashboardUrl:"https://cursor.com/dashboard/cloud-agents",recheckAuth:"立即检查",testSuccess:"配置正确,连接正常",testFailed:"配置测试失败",testModel:"模型:{{model}}",testAuthVia:"认证方式:{{source}}",testFailedHint:"请检查上方的 API 密钥、端点 URL 或 CLI 安装状态",modelGuidanceCursor:"Cursor CLI 支持的模型。选择「auto」可让 Cursor 自动选择最佳模型。",modelGuidanceClaude:"显示标准模型列表。可手动输入自定义模型名称。",modelGuidanceCodex:"显示标准模型列表。可手动输入自定义模型名称。"},RR={title:nR,nav:rR,appearance:aR,setupGuide:sR,systemStatus:iR,defaultProvider:oR,modelRouting:lR,modelPicker:cR,modelProviders:uR,networkProxy:dR,oauthAuth:mR,oauth:fR,autoDetect:pR,ollama:hR,envConfig:gR,agentExecution:bR,cognitive:xR,searchApi:yR,browserAutomation:vR,dataStorage:wR,oauthConnected:kR,authProfileDeleted:SR,browserOpened:NR,remoteAccess:CR,userManagement:TR,license:AR,account:ER,org:_R,feishu:jR,codingTools:MR},LR={title:"欢迎使用 Markus",subtitle:"几分钟内就绪的 AI 团队",description:"Markus 帮你构建和运行<strong>自主协作的 AI 智能体团队</strong>,它们能协同工作、持续学习,并全天候交付成果。接下来几步快速完成初始设置。"},OR={title:"选择主题",subtitle:"可随时在设置中更改",system:"跟随系统",systemDesc:"跟随操作系统设置",light:"浅色",lightDesc:"始终使用浅色背景",dark:"深色",darkDesc:"暖调炭黑,优雅柔和",cyberpunk:"赛博朋克",cyberpunkDesc:"霓虹粉与深紫",mono:"黑白",monoDesc:"纯黑白极简"},DR={title:"配置 LLM",subtitle:"智能体需要 LLM 来思考与行动",configured:"已配置 LLM 提供商",configuredHint:"可随时在设置中管理提供商。",selectDefault:"点击选择智能体的默认模型:",default:"默认",fromEnv:"来自环境变量",detectingKeys:"正在检测 API keys...",noKeysFound:"未发现 API keys。请在 <code>.env</code> 中设置 <code>ANTHROPIC_API_KEY</code>、<code>OPENAI_API_KEY</code> 等,然后重启。",applyProviders:"应用 {{count}} 个提供商",or:"或",fromOpenClaw:"来自 OpenClaw",detectOpenClaw:"检测 OpenClaw 配置",importModelConfigs:"导入模型配置",noOpenClawFound:"未找到 OpenClaw 配置。",importedModels:"已导入 {{count}} 条模型配置",failedToApply:"应用失败",importFailed:"导入失败",skipForNow:"暂时跳过",openClawFoundLabel:"已找到:",openClawProviders:"({{count}} 个提供商)",autoFallback:"模型出错时自动切换",autoFallbackDesc:"可选;默认关闭。开启后主模型失败时才自动尝试其他提供商"},IR={title:"网络搜索(可选)",subtitle:"赋予智能体搜索网络的能力",description:"启用 Markus 托管搜索,或配置至少一个搜索 API 密钥,让智能体能够获取实时信息。",serper:"Serper (Google)",tavily:"Tavily",bing:"Bing 网页搜索",google:"Google 自定义搜索",serpapi:"SerpAPI",brave:"Brave Search",exa:"Exa",bocha:"博查 (Bocha)",apiKeyPlaceholder:"粘贴 API Key...",save:"保存搜索密钥",saving:"保存中...",saved:"搜索 API 密钥已配置",savedHint:"可随时在设置中管理搜索 API 密钥。",failedToSave:"保存失败",detectingKeys:"正在检测搜索 API 密钥...",detected:"从环境变量检测到:",skipForNow:"暂时跳过"},PR={title:"设置个人资料",subtitle:"介绍一下你自己",saved:"资料已保存",nameLabel:"姓名",namePlaceholder:"请输入姓名",emailLabel:"邮箱",emailPlaceholder:"your@email.com",newPasswordLabel:"新密码",newPasswordPlaceholder:"设置安全密码(至少 6 位)",confirmPasswordLabel:"确认密码",confirmPasswordPlaceholder:"再次输入密码",saveProfile:"保存资料",errors:{nameRequired:"请输入姓名",emailRequired:"请输入邮箱",emailInvalid:"请输入有效的邮箱地址",passwordTooShort:"密码至少需要 6 个字符",passwordMismatch:"两次输入的密码不一致",saveFailed:"保存资料失败,请重试。"}},zR={title:"一切就绪",subtitle:"开始搭建你的 AI 团队",chat:"对话",chatDesc:"与智能体对话或使用 Smart Route 自动委派任务",projects:"项目",projectsDesc:"创建包含需求、任务与交付物的项目",builder:"构建器",builderDesc:"从模板招聘新智能体或自定义角色",settings:"设置",settingsDesc:"管理 LLM 提供商、集成与治理",telemetry:"分享匿名使用数据以帮助改进 Markus",telemetryNote:"不会收集任何代码、提示词或个人数据。你可以随时在设置中更改此选项。"},BR={title:"你将如何使用 Markus?",subtitle:"这有助于我们为你定制体验。",personal:"个人使用",personalDesc:"使用你自己的 AI 智能体。",organization:"组织 & 企业",organizationDesc:"团队共享许可证与协作。",orgNameLabel:"组织名称",orgNamePlaceholder:"输入你的团队名称",defaultOrgName:"{{name}} 的团队",setOrgName:"设置组织名称",orgNameSaved:"已保存",orgNameSaveFailed:"保存组织名称失败,请重试。",pendingInvitations:"你有待接受的组织邀请",invitedBy:"邀请人:{{name}}",acceptAndJoin:"接受并加入",accepting:"加入中...",accepted:"已加入",orCreateNew:"或创建新组织"},$R="开始使用",HR={welcome:LR,theme:OR,llm:DR,search:IR,profile:PR,done:zR,usageType:BR,getStarted:$R},UR="创建",FR="招聘智能体、组建团队并创建技能。秘书会全程处理 — 从寻源到入职。",qR={hireAgent:"招聘智能体",hireAgentDesc:"从模板招聘、创建自定义智能体,或在 Markus Hub 上寻找专家",hireAgentExamples:["招聘一名高级 React 开发者","创建自定义代码审查智能体","在 Hub 上寻找 DevOps 专家"],hireAgentPrompt:"我需要你帮我创建或者招聘一名智能体: ",buildTeam:"组建团队",buildTeamDesc:"为项目组建最佳团队,或部署团队模板",buildTeamExamples:["包含 PM、开发与 QA 的 Web 开发团队","数据工程小组","内容创作团队"],buildTeamPrompt:"我需要你帮我创建或者为以下目标组建团队: ",createSkill:"创建技能",createSkillDesc:"设计智能体可学习并使用的新能力",createSkillExamples:["Git 变更日志生成器","网页抓取技能","数据库迁移工具"],createSkillPrompt:"我需要一个你帮我创建一个skill: "},GR={title:"我的创作",subtitle:"已保存的构建产物 — 安装即可部署,或分享到 Markus Hub。",filterAll:"全部",filterAgents:"智能体",filterTeams:"团队",filterSkills:"技能",loadingArtifacts:"正在加载产物...",noArtifacts:"未找到产物。",noArtifactsHint:"使用上方构建器创建智能体、团队或技能。",openInBuilder:"在构建器中打开"},VR={title:"组织资产",noItems:"该组织暂无共享资产。",noOrgs:"你还未加入任何组织。",loading:"加载中...",by:"作者"},KR="取消分享:从 Markus Hub 下架,本地文件保留",WR="取消分享",YR="取消分享",XR="删除本地文件(不影响已分享到 Hub 的副本)",QR="删除本地文件",ZR="复制 Hub 链接",JR="确认删除",eL="删除本地文件「{{name}}」?此操作无法撤销。已分享到 Hub 的副本不会自动下架。",tL="从 Markus Hub 取消分享「{{name}}」?其他人将无法再下载,本地文件会保留。",nL="确认安装",rL="安装「{{name}}」到当前组织?安装后可在团队中使用。",aL="确认卸载",sL="卸载「{{name}}」?将从当前组织移除已部署的实例,本地创作文件会保留。",iL="安装失败:{{error}}",oL="卸载失败:{{error}}",lL="分享失败:{{error}}",cL="从 Hub 移除失败:{{error}}",uL={agent:"智能体",team:"团队",skill:"技能",name:"名称",description:"描述",category:"分类",baseTemplate:"基础模板",agentRole:"智能体角色",llmProvider:"LLM 提供商",llmModel:"LLM 模型",requiredEnv:"所需环境变量",skills:"技能",files:"文件({{count}})",members:"成员({{count}})"},dL={imagePrompt:"分享前是否要添加一些图片?图片能帮助你的作品在 Hub 上吸引更多用户。",directly:"直接分享",addImagesFirst:"先添加图片",toHub:"分享到 Hub",sharing:"正在分享...",updating:"正在更新...",updateVersion:"更新 v{{version}}",viewOnHub:"在 Hub 查看",submittedForReview:"已提交审核。审核通过前只有你自己能看到,其他人打开链接会看到「审核中」页面。",convertedSlug:"已将包标识从「{{previous}}」自动转换为「{{slug}}」(中文标题保留为显示名)。如需更易读的英文 slug,可稍后自行修改。",convertedAndSubmitted:"已将包标识从「{{previous}}」自动转换为「{{slug}}」,并已提交审核。中文标题保留为显示名。",updateSubmitted:"更新已提交审核。在新版本审核通过前,之前已通过的版本将继续公开展示。",underReview:"审核中",underReviewTip:"此资产正在等待管理员审核。目前只有你自己能看到。",rejected:"已拒绝",rejectedTip:"管理员拒绝了此资产,因此不会公开展示。",updateUnderReview:"更新审核中",updateUnderReviewTip:"你的最新修改正在等待审核。之前已通过的版本将继续公开展示。"},mL={label:"价格",enableTips:"允许用户打赏",reviewNote:"公开和「仅链接」的资产需经管理员审核后才会对他人可见。"},fL={title:"选择分享模式",titleUpdate:"更新分享设置",free:"免费",freeDesc:"所有人均可免费下载",donation:"接受打赏",donationDesc:"免费下载,用户可自愿打赏",paid:"付费下载",paidDesc:"用户需付费才能下载",priceLabel:"价格(美元)",pricePlaceholder:"例如 4.99",update:"更新",share:"分享"},pL={label:"分享到社区",subtitle:"选择谁可以看到它并设置价格。公开资产将经过审核,随后出现在 Markus 广场。",public:"公开",publicDesc:"所有人可见,出现在 Hub 搜索中",org:"组织内",orgDesc:"仅所选组织的成员可见",unlisted:"有链接者",unlistedDesc:"不出现在搜索中,通过链接访问",orgSelect:"选择组织",orgNone:"未找到组织",shared:"已分享",sharedOrg:"组织内",sharedUnlisted:"有链接者"},hL={contentModified:"内容已修改,建议更新版本号。",bumpVersion:"更新版本",newVersion:"新版本:"},gL={dropOrClick:"拖拽图片或点击上传",hint:"上传效果图、截图或演示图片,展示你的作品"},bL={backToBuilder:"返回构建器",notFound:"未找到该产物",saving:"正在保存...",saved:"已保存",saveFailed:"保存失败",edit:"编辑",overview:"概览",untitled:"未命名",addDescription:"点击添加描述...",typeTagAndEnter:"输入后按回车",pasteEmojiOrUrl:"粘贴 emoji 或图片链接...",upload:"上传"},xL={info:"基本信息",type:"类型",category:"分类",version:"版本",author:"作者",agentSpecs:"智能体规格",role:"角色",provider:"服务商",model:"模型",temperature:"温度",composition:"团队构成",totalMembers:"总人数",managers:"管理者",workers:"工作者",skillInfo:"技能信息",alwaysOn:"始终启用",skillFile:"技能文件",permissions:"权限",yes:"是",no:"否",dependencies:"依赖",skills:"技能",environment:"环境变量",openInFinder:"在 Finder 中打开"},yL={title:UR,subtitle:FR,prompts:qR,myCreations:GR,orgAssets:VR,removeFromHubTooltip:KR,unshare:WR,confirmUnshare:YR,deleteLocalTooltip:XR,confirmDeleteLocal:QR,copyHubLinkTooltip:ZR,confirmDelete:JR,deleteCannotUndo:eL,removeFromHub:tL,confirmInstall:nL,confirmInstallMsg:rL,confirmUninstall:aL,confirmUninstallMsg:sL,installFailed:iL,uninstallFailed:oL,shareFailed:lL,hubDeleteFailed:cL,artifact:uL,share:dL,pricing:mL,shareMode:fL,visibility:pL,versionBump:hL,images:gL,detail:bL,sidebar:xL},vL="社区",wL={fromHub:"来自 Markus Hub",loading:"正在从 Hub 加载内容…",missing:"无法加载该 Hub 内容。可能已下架、未公开,或 Hub 暂时不可用。",install:"安装",installing:"安装中…",installed:"已安装",purchaseRequired:"需先在 Hub 购买后才能安装",failed:"安装失败",dismiss:"关闭"},kL={discover:"发现",agents:"智能体",teams:"团队",skills:"技能",connectors:"连接器",installed:"已安装"},SL={title:"Markus 广场",subtitle:"发现社区共享的智能体、AI 小队、技能与连接器 — 由创作者共建的开放生态。",trending:"热门趋势",trendingSub:"社区中下载与评分增长最快的资产",fresh:"新鲜上架",freshSub:"来自创作者的最新作品",topCreators:"顶尖创作者",topCreatorsSub:"生态贡献榜",empty:"生态正在成长中",emptyHint:"成为首批创作者,分享你的第一个资产"},NL={searchPlaceholder:"搜索连接器 (MCP)…",empty:"暂无连接器",emptyHint:"连接器让智能体接入外部工具与服务 (MCP)"},CL={title:"智能体商店",builtin:"内置",markusHub:"Markus Hub",searchPlaceholder:"搜索智能体…",loading:"正在加载智能体…",available:"{{count}} 个智能体可用",noHub:"Markus Hub 上未找到智能体",noHubHint:"Hub 可能离线或为空,请检查网络连接或 Hub URL 配置。",noResults:"没有匹配「{{search}}」的智能体",noAgents:"未找到智能体",noResultsHint:"请尝试其他搜索词。",noAgentsHint:"智能体来自内置注册表。",hireAgent:"聘用智能体",skills:"技能",noSkills:"无需技能",roleConfig:"角色配置",role:"角色:",position:"职位:",starterTasks:"初始任务"},TL={title:"团队商店",builtin:"内置",markusHub:"Markus Hub",searchPlaceholder:"搜索团队…",loading:"正在加载团队…",available:"{{count}} 个团队可用",noHub:"Markus Hub 上未找到团队",noHubHint:"Hub 可能离线或为空,请检查网络连接或 Hub URL 配置。",noResults:"没有匹配「{{search}}」的团队",noTeams:"暂无可用团队",noResultsHint:"请尝试其他搜索词。",noTeamsHint:"前往构建器页面创建团队。",deployTeam:"部署团队",deploying:"部署中…",teamComposition:"团队组成",details:"详情",version:"版本:",author:"作者:",members:"成员:",agents:"{{count}} 个智能体",tags:"标签:",hasManager:"包含管理者"},AL={title:"技能商店",tabs:{installed:"已安装",all:"技能",builtin:"内置",skillhub:"SkillHub",skillssh:"skills.sh",markusHub:"Markus Hub"},searchInstalled:"搜索已安装技能…",skillCount:"{{count}} 个技能",noInstalled:"未找到已安装技能。",noInstalledHint:"浏览 SkillHub 或 skills.sh 发现并安装技能。",builtinCount:"{{count}} 个内置技能可用",refresh:"刷新",loadingBuiltin:"正在加载内置技能…",noBuiltin:"未找到内置技能。",noBuiltinHint:"内置技能位于 templates/skills/ 目录下。",loadingSkillhub:"正在加载 SkillHub 技能…",noSkillhub:"未找到匹配的技能",skillhubTotal:"共 {{count}} 个技能",allCategories:"全部分类",sortScore:"综合排序",sortDownloads:"下载量",sortStars:"收藏数",sortInstalls:"安装量",searchSkillhub:"搜索 SkillHub 技能…",visitSite:"访问站点 →",searchSkillssh:"搜索 skills.sh…",loadingSkillssh:"正在搜索 skills.sh…",browseSkillssh:"浏览 skills.sh 上 84,000+ 个技能",browseSkillsshHint:"热门技能已自动加载,可在上方搜索特定技能。",searchMarkusHub:"搜索 Markus Hub 技能…",communitySkills:"来自 Markus Hub 的社区技能",loadingHub:"正在从 Hub 加载…",noHub:"Markus Hub 上未找到技能",noHubHint:"Hub 可能离线或为空,请检查网络连接或 Hub URL 配置。",prevPage:"← 上一页",nextPage:"下一页 →",pageInfo:"第 {{current}} / {{total}} 页",downloads:"下载",autoDiscovered:"由智能体自动发现",uninstall:"卸载",details:"详情",category:"分类",version:"版本",integration:"集成",instructions:"说明",permissions:"权限",tags:"标签"},EL={install:"安装",installing:"安装中…",installed:"已安装",upgrade:"升级 → v{{version}}",upgrading:"升级中…",upgraded:"已升级!",failed:"失败",purchaseRequired:"需要购买",buy:"购买",waitingPurchase:"等待支付完成…",buyOnHub:"在 Hub 购买",view:"查看 →"},_L={title:"已安装项目",searchPlaceholder:"搜索已安装项目…",noItems:"未找到已安装项目。",noItemsHint:"从商店安装智能体、团队或技能。",loading:"正在加载已安装项目…",filterAll:"全部",filterAgents:"智能体",filterTeams:"团队",filterSkills:"技能",updateAvailable:"有可用更新",updateTo:"更新 → v{{version}}",updating:"更新中…",updateSuccess:"已将 {{name}} 更新到 v{{version}}",updateFailed:"更新 {{name}} 失败"},jL={searchPlaceholder:"搜索模板…",noResults:"未找到模板",install:"安装",installed:"已安装",hire:"聘用",category:"分类",allCategories:"全部分类",hubAgents:"Markus Hub 智能体",hubTeams:"Markus Hub 团队",hubSkills:"Markus Hub 技能",templates:"模板",featured:"精选",popular:"热门",recent:"最近"},ML={description:"描述",skills:"技能",tools:"工具",members:"成员",requirements:"要求",configuration:"配置"},RL={successTitle:"安装成功!",successDesc:"{{name}} 已安装完毕,可以使用了。",done:"完成",errorTitle:"安装失败",errorDesc:"出了点问题,请重试。",close:"关闭",retry:"重试",paidNote:"这是付费内容,请先在 Hub 上购买后再安装。",cancel:"取消",buyOnHub:"去 Hub 购买",installing:"安装中…",install:"安装"},LL={title:"聘用智能体",creating:"正在从「{{name}}」创建智能体",agentName:"智能体名称",assignTeam:"分配到团队(可选)",noTeam:"不分配团队",agentConfig:"智能体配置",role:"角色:",position:"职位:",skills:"技能:",none:"无",cancel:"取消",create:"创建智能体",creating_progress:"创建中…"},OL={title:vL,deepLink:wL,tabs:kL,discover:SL,connectorStore:NL,agentStore:CL,teamStore:TL,skillStore:AL,card:EL,installedTab:_L,marketplace:jL,detail:ML,installDialog:RL,hireModal:LL},DL={title:"智能体资料",status:"状态",role:"角色",team:"团队",uptime:"运行时间",created:"创建时间",lastActive:"最近活动"},IL={overview:"概览",mind:"心智",activity:"活动",memory:"记忆",tools:"能力",settings:"设置",files:"文件",skills:"技能",heartbeat:"心跳",deliverables:"产出"},PL={title:"智能体心智",currentActivity:"当前活动",attention:"注意力",focused:"专注中",deciding:"决策中",reasoning:"当前推理",noActivity:"暂无当前活动"},zL={title:"活动日志",noActivity:"尚未记录活动",timeline:"时间线",thinking:"思考",toolCall:"工具调用",message:"消息",error:"错误"},BL={title:"记忆",layers:{working:"笔记本",shortTerm:"观察记录",longTerm:"知识 (MEMORY.md)",episodic:"情景记忆",semantic:"语义记忆"},noMemories:"尚未存储记忆",clear:"清空",clearConfirm:"清空此层的全部记忆?"},$L={title:"工具",noTools:"暂无可用工具",enabled:"已启用",disabled:"已禁用"},HL={title:"智能体设置",llmProvider:"LLM 提供商",llmModel:"LLM 模型",temperature:"温度",maxTokens:"最大 Token",systemPrompt:"系统提示",skills:"技能"},UL={start:"启动",stop:"停止",restart:"重启",pause:"暂停",resume:"继续",viewProfile:"查看资料",sendMessage:"发送消息"},FL={score:"健康度",tokens:"已用 Token",requests:"请求数",errors:"错误数",cost:"预估费用"},qL={files:"文件",search:"搜索",runtime:"运行时",web:"网络",multimodal:"多模态",browser:"浏览器",tasks:"任务",requirements:"需求",projects:"项目",deliverables:"产出",packages:"包管理 & Hub",communication:"通信",memory:"记忆",mailbox:"邮箱",planning:"规划",teamManager:"团队管理",subagents:"子智能体",system:"系统",llm:"大模型",other:"其他",mcp:"MCP:{{server}}"},GL={taskStatus:{pending:"待处理",assigned:"已分配",in_progress:"进行中",completed:"已完成",failed:"失败",cancelled:"已取消",review:"评审中",approved:"已通过",rejected:"已拒绝",draft:"草稿"},loadingAgent:"正在加载智能体…",chat:"对话",hub:"Hub",publishTitle:"发布到 Markus Hub",publishSuccess:"已将「{{name}}」发布到 Markus Hub",publishFailed:"发布失败:{{error}}",badges:{external:"外部",manager:"管理者"},never:"从未",emDash:"—",roles:{managerDisplay:"★ 管理者",workerDisplay:"◆ 工作者",worker:"工作者"},overview:{identity:"身份",connectionStatus:"连接状态",externalAgentDetails:"外部智能体详情",syncContextTitle:"同步上下文(每个同步周期接收)",gatewayEndpoints:"网关 API 端点",recentTasks:"最近任务",runtimeStatus:"运行状态",usage:"用量",storage:"存储",openFolder:"打开文件夹 →",llmConfiguration:"LLM 配置",recentHeartbeats:"最近心跳",recentA2A:"最近 A2A 通信",heartbeatRuns_one:"{{count}} 次运行",heartbeatRuns_other:"{{count}} 次运行",conversations_one:"{{count}} 个会话",conversations_other:"{{count}} 个会话",labels:{name:"名称",agentRole:"智能体角色",roleTemplate:"角色模板",markusAgentId:"Markus 智能体 ID",agentId:"智能体 ID",organization:"组织",created:"创建时间",connection:"连接",platform:"平台",activeTasks:"进行中任务",lastSync:"上次同步",externalAgentId:"外部智能体 ID",registered:"注册时间",capabilities:"能力",lastHeartbeat:"上次心跳",status:"状态",tokensToday:"今日 Token",totalTokens:"总 Token",requests:"请求数",toolCalls:"工具调用",promptTokens:"提示 Token",completionTokens:"补全 Token",estCost:"预估费用",modelMode:"模型模式",primaryModel:"主模型",fallback:"备用",maxTokensRequest:"单次最大 Token",maxTokensDay:"每日最大 Token",type:"类型",importance:"重要性"},systemDefault:"系统默认",custom:"自定义",systemDefaultShort:"◎ 系统默认",customShort:"⚙ 自定义",followsSystemDefault:"跟随系统默认({{provider}})",systemDefaultParen:"(系统默认)",noneOption:"无",defaultValue:"默认",unlimited:"不限",noneDeclared:"未声明",errorDetails:"错误详情",errorFallback:"智能体遇到错误。请查看日志获取详情。",recentError:"近期错误(已恢复)",errorRecovered:"智能体已自动恢复,当前运行正常。",currentlyWorking:"正在工作",activeTasksCount_one:"{{count}} 个进行中任务",activeTasksCount_other:"{{count}} 个进行中任务",startAgent:"▶ 启动",stopAgent:"⏹ 停止",openClaw:"OpenClaw"},syncContext:{assignedTasks:"带需求与项目可追溯性的任务",inboxMessages:"来自队友的消息",teamContext:"同事(id、姓名、角色、状态)+ 管理者",projectContext:"项目与活跃需求"},gateway:{sync:"交换状态、任务、消息、团队与项目上下文",manual:"下载集成手册(动态,含同事与项目)",team:"查询团队成员、角色与管理者",projects:"列出带治理的项目",requirements:"查询需求(可按项目/状态筛选)"},filesTab:{loading:"正在加载文件…",templateUpdateAvailable:"模板有更新",filesDiffer:"有 {{count}} 个文件与模板 {{templateId}} 不一致:",filesDiffer_plural:"有 {{count}} 个文件与模板 {{templateId}} 不一致:",syncing:"同步中…",syncAll:"全部同步",sendToAgent:"发送给智能体",sendToAgentTitle:"将模板变更通过聊天发送给智能体审阅",agentConfigFiles:"智能体配置文件",templateLabel:"模板:",upToDate:"(已是最新)",updatesAvailable:"(有可用更新)",customAgentNoTemplate:"自定义智能体 — 未关联模板",hideDiff:"隐藏差异",viewDiff:"查看差异",smartSyncTitle:"使用 AI 智能合并模板变更并尽量保留你的自定义内容",merging:"合并中…",smartSync:"智能同步",overwriteTemplateTitle:"用模板内容覆盖",syncThisFile:"同步此文件",undoMergeTitle:"撤销智能同步并恢复之前内容",undoMerge:"撤销合并",unsaved:"未保存",smartSyncResult:"智能同步结果",reviewAndSave:"— 请审阅并保存以应用",roleMdHint:"修改 ROLE.md 将立即更新智能体运行时的系统提示。",noConfigFiles:"该角色下未找到配置文件",copyPath:"复制路径",pathCopied:"已复制",openInFinder:"在文件管理器中打开",fileLabels:{roleMd:"系统提示 / 角色定义",heartbeatMd:"心跳任务",policiesMd:"策略与护栏",contextMd:"上下文与说明"}},diff:{title:"差异:当前 vs 模板({{templateId}})",showFullFile:"显示完整文件",showChangesOnly:"仅显示变更",linesHidden:"··· 已隐藏 {{count}} 行 ···",identical:"文件相同"},toolsTab:{registeredCount:"已注册 {{count}} 个工具",noToolsRegistered:"未注册任何工具"},skillsTab:{alwaysOn:"常驻",builtIn:"内置",installed:"已安装",usesStats:"{{uses}} 次使用 · {{successes}} 次成功",lastUsed:" · 最近 {{date}}",loadingDetails:"正在加载技能详情…",toolsHeading:"工具({{count}})",detailsUnavailable:"无法获取技能详情(可能未在商店注册)",installedCount:"已安装 {{count}} 个技能 — 描述会自动注入智能体上下文",noSkills:"未安装技能",byAuthor:"作者 {{author}}"},memoryTab:{loading:"正在加载记忆…",loadFailed:"加载记忆数据失败",recent:"最近({{count}})",sessions:"会话({{count}})",dailyLogs:"每日日志",longTerm:"长期",recentEntries:"最近记忆条目",noEntries:"暂无记忆条目",chatSessions:"对话会话",noSessions:"暂无会话",msgs:"条消息",loadingMessages:"正在加载消息…",noMessagesInSession:"此会话中无消息",longTermTitle:"长期记忆",noDailyLogs:"暂无每日日志",noLongTerm:"尚未存储长期记忆",roles:{user:"用户",system:"系统",assistant:"助手"},userEditedSource:"用户编辑"},heartbeatTab:{loading:"正在加载心跳数据…",noData:"暂无心跳数据",scheduler:"节奏与日程",triggering:"触发中…",triggerNow:"立即触发",interval:"间隔",safetyNetInterval:"兜底间隔",intervalMinutes_one:"{{count}} 分钟",intervalMinutes_other:"{{count}} 分钟",intervalHours_one:"{{count}} 小时",intervalHours_other:"{{count}} 小时",intervalCustom:"自定义…",intervalCustomUnit:"分钟",intervalSave:"保存",intervalSaving:"保存中…",intervalRangeHint:"允许范围:5 分钟 – 24 小时。",lastRun:"上次运行",nextRun:"下次运行",nextWake:"下次唤醒",rhythmHint:"智能体通过唤醒来安排精确的后续跟进;兜底间隔只是粗粒度的巡检回退。",running:"运行中",stopped:"已停止",pending:"待定",wakeupsTitle:"已排期唤醒",wakeupsCount_one:"{{count}} 个唤醒",wakeupsCount_other:"{{count}} 个唤醒",wakeupNoNote:"(无备注)",recurring:"循环",deliveryInSession:"会话内",deliveryMailbox:"邮箱",cancelWakeup:"取消",pendingOpsTitle:"进行中的异步操作",pendingOpsCount_one:"{{count}} 个进行中",pendingOpsCount_other:"{{count}} 个进行中",timesOut:"超时于",callbackType:{background_exec:"后台进程",a2a_reply:"等待智能体回复",wakeup:"唤醒"},lastSummary:"上次心跳摘要",recentRuns:"最近运行",runsThisSession_one:"本会话 {{count}} 次运行",runsThisSession_other:"本会话 {{count}} 次运行",actionsCount_one:"{{count}} 个操作",actionsCount_other:"{{count}} 个操作",noRunsYet:"本会话尚无心跳运行。",firstHeartbeatSoon:"首次心跳约在 {{when}} 后触发。",schedulerStopped:"心跳调度已停止。",runFirstNow:"立即运行首次心跳",soon:"很快"},relative:{inSeconds:"{{count}} 秒后",inMinutes:"{{count}} 分钟后",inHours:"{{hours}} 小时后",secondsAgo:"{{count}} 秒前",minutesAgo:"{{count}} 分钟前",hoursAgo:"{{hours}} 小时前"},taskLog:{loading:"加载中…",noLogs:"尚无执行日志。"},activityLog:{loading:"加载中…",noLogs:"暂无活动日志。"},mind:{loading:"正在加载智能体心智状态…",idleWaiting:"空闲 — 等待新邮件",queuedButIdle:"队列有 {{count}} 项待处理 — 注意力循环应即将接手…",decidingWaiting:"决策中 — 正在分拣 {{count}} 个待处理项…",deliberationInProgress:"正在深度分拣",since:"自 {{time}} 起",refresh:"↻ 刷新",pauseBtn:"暂停",continueBtn:"继续",cancelCurrentBtn:"取消",cancelConfirmTitle:"取消执行",cancelConfirmMessage:"确定要取消此任务的执行吗?Agent 将立即停止处理。",queue:"队列({{count}})",expandQueue:"展开剩余 {{count}} 项…",collapseQueue:"收起",staleProcessingWarning:"存在异常处理中项目(Agent 已空闲)",agentDetails:"Agent 详情",triageDecision:"分拣决策",processingItem:"处理中:{{id}}…",deferred:"已推迟:{{count}}",dropped:"已丢弃:{{count}}",inlineCompleted:"内联完成:{{count}}",mailboxHistory:"邮箱历史",noHistory:"暂无邮箱历史",loadEarlier:"加载更早…",decisions:"决策",activityHeading:"活动 — {{label}}",success:"✓ 成功",failed:"✗ 失败",processing:"处理中…",noActivityLog:"未记录活动日志",from:"来自:",tokensCount:"{{count}} Token",toolsCount:"{{count}} 个工具",categoryFilters:{all:"全部",interaction:"交互",task:"任务",notification:"通知",system:"系统"},statusFilters:{all:"全部",queued:"排队中",processing:"处理中",completed:"已完成",merged:"已合并",deferred:"已推迟",dropped:"已丢弃"},activityFilters:{all:"全部",task:"任务",chat:"对话",heartbeat:"心跳",a2a:"A2A",internal:"内部",respond_in_session:"会话"},priority:{0:"紧急",1:"高",2:"普通",3:"低",4:"后台"},attention:{idle:"空闲",focused:"专注",deciding:"决策中"},mailbox:{commentFrom:"来自 {{name}} 的评论",commentFromAuthor:"{{author}}:{{text}}",humanChat:"人类对话",chatFrom:"来自 {{sender}} 的对话",agentMessage:"智能体消息",messageFrom:"来自 {{sender}} 的消息",mentionedBy:"由 {{name}} 提及",mention:"提及",reviewRequestFrom:"来自 {{sender}} 的评审请求",reviewRequest:"评审请求",replyInSession:"会话内回复({{sender}})",sessionReply:"会话回复",scheduledHeartbeat:"定时心跳签到",dailyReport:"日报",memoryConsolidation:"记忆整理",systemAnnouncement:"系统公告",systemEvent:"系统事件",statusArrow:"{{from}} → {{to}}"}}},VL={empty:"暂无交付物",emptyHint:"该智能体创建的交付物将显示在这里",count:"共 {{count}} 个交付物",summary:"摘要",reference:"引用",format:"格式",created:"创建于",updated:"更新于",accessed:"访问 {{count}} 次",openInPage:"在产出页面中打开"},KL={profile:DL,tabs:IL,mind:PL,activity:zL,memory:BL,tools:$L,settings:HL,actions:UL,health:FL,toolCategories:qL,profilePage:GL,deliverables:VL},WL="产出",YL="+ 创建",XL="搜索交付物…",QL={allTypes:"全部类型",allProjects:"全部项目",active:"活跃",verified:"已验证",outdated:"已过时",group:"分组:",clearAll:"清除全部",filtersLabel:"筛选",refreshing:"刷新中..."},ZL={date:"日期",project:"项目",team:"团队",agent:"智能体"},JL="▶ 展开",eO="▼ 折叠",tO={title:"暂无交付物",subtitle:"交付物由智能体在完成任务后自动创建,无需手动添加",goToWork:"前往任务页面创建",noResults:"没有匹配的交付物",noResultsHint:"试试调整搜索词或筛选条件"},nO={selectToView:"请选择交付物以查看详情",keyboardHint:"使用 ↑↓ 方向键导航,⌘F 搜索",details:"详情",verify:"验证",flagOutdated:"标记为已过时",flagging:"正在标记…",openInBuilder:"在 Builder 中打开",noContent:"无内容",cannotPreview:"无法在浏览器中预览此 {{type}}。",loadingPreview:"正在加载预览…",artifactDirectory:"产物目录",copyFailed:"复制失败 — 请长按手动复制",failedToOpen:"打开失败",failedToOpenBrowser:"无法打开文件浏览器",openInFileBrowser:"在文件浏览器中打开",revealInFinder:"在访达中显示",copyPath:"复制路径到剪贴板",fileMissing:"引用的文件在磁盘上已不存在",confirmRemoveTitle:"移除交付物",confirmRemoveMessage:'"{{name}}" 将被移除,此操作不可撤销。',openUrl:"在新标签页中打开",edit:"编辑",preview:"预览",save:"保存",saving:"保存中...",saved:"已保存",saveFailed:"保存失败",unsavedTitle:"未保存的更改",unsavedMessage:"你有未保存的更改。离开前是否需要保存?",discard:"放弃",saveAndLeave:"保存"},rO={title:"差异统计",files:"{{count}} 个文件"},aO={title:"测试",passed:"{{count}} 通过",failed:"{{count}} 失败",skipped:"{{count}} 跳过"},sO={title:"链接",task:"任务:{{id}}",agent:"智能体:{{name}}",project:"项目:{{name}}"},iO={created:"创建时间:",updated:"更新时间:",accessed:"访问次数:",id:"ID:{{id}}"},oO="无项目",lO="无团队",cO={title:"创建交付物",type:"类型",titleField:"标题",titleRequired:"标题为必填项",titlePlaceholder:"清晰、可检索的标题",reference:"引用",referenceHint:"文件路径、URL、分支名",referencePlaceholder:"/path/to/file 或 https://...",summary:"摘要",summaryHint:"Markdown",summaryPlaceholder:"描述该交付物…",tags:"标签",tagsHint:"逗号分隔",tagsPlaceholder:"react, api, docs",project:"项目",created:"交付物已创建",required:"*"},uO={partial:"{{loaded}} / {{total}} 个交付物",total:"共 {{total}} 个交付物"},dO={collapse:"收起侧边栏",expand:"展开侧边栏"},mO={openChat:"与智能体对话",closeChat:"关闭对话",placeholder:"给智能体发消息…",currentDeliverable:"当前交付物",selectedFrom:"选自"},fO={addToConversation:"添加到对话"},pO={title:"分享到 Markus Hub",needHubLogin:"需登录 Markus Hub 账号后才能分享产出物。",loggingIn:"正在打开登录…",loginHub:"登录 Markus Hub 账号",loginHint:"解锁后将支持一键公开/链接分享产出物。",visibility:"可见性",public:"公开(所有人可见 + 搜索引擎)",publicHint:"公开产出物需经 Hub 审核后发布,发布后所有人可见并参与搜索",publicVisibility:"公开",link:"有链接可见",linkHint:"仅获得链接的人可查看,不参与搜索引擎;同样需经 Hub 审核",linkVisibility:"有链接可见",titleField:"标题",titlePlaceholder:"清晰、可检索的标题",summary:"摘要",summaryPlaceholder:"简要描述该产出物…",tags:"标签",tagsPlaceholder:"输入标签后回车添加",shareToHub:"分享到 Hub",sharing:"分享中…",published:"已发布",pendingReview:"审核中",pendingHint:"你的产出物已提交审核,通过后将生成可分享链接。",rejected:"已拒绝",revoked:"已取消分享,该产出物不再公开可访问。",resubmit:"重新提交",shareAgain:"重新分享",revoke:"取消分享",urlPending:"链接生成中,稍后刷新查看…"},hO={justNow:"刚刚",minutesAgo:"{{count}}分钟前",hoursAgo:"{{count}}小时前",yesterday:"昨天",daysAgo:"{{count}}天前",monthsAgo:"{{count}}个月前",yearsAgo:"{{count}}年前"},gO={title:WL,create:YL,searchPlaceholder:XL,filters:QL,groupBy:ZL,expandAll:JL,collapseAll:eO,empty:tO,detail:nO,diffStats:rO,testResults:aO,links:sO,metadata:iO,noProject:oO,noTeam:lO,createModal:cO,count:uO,sidebar:dO,chat:mO,contextMenu:fO,share:pO,time:hO},bO="报告",xO={dashboard:"仪表盘",history:"历史"},yO={tasksCompleted:"已完成任务",ofTotal:"共 {{total}} 项",activeContributors:"活跃贡献者",agentsAndHumans:"{{agents}} 智能体 · {{humans}} 人类",cuConsumed:"积分消耗",tokensConsumed:"Token 消耗",todayAmount:"今日:{{amount}}",successRate:"成功率",healthScore:"健康度:{{score}}/100"},vO={title:"Cloud AI",personalLimitLabel:"个人积分限额",personalLimit:"组织管理员为您设置了个人积分限额。",notConnected:"未连接到 Markus Hub",connect:"连接",bonus:"奖励:{{amount}}",resetsAt:"重置时间 {{date}}",topUp:"充值",windowQuota:"5小时窗口:{{amount}} 积分(可升级)",windowUsageLabel:"5小时窗口用量",windowQuotaNone:"5小时窗口:未启用",rateLimit:"无 Markus 侧请求次数上限;上游模型供应商仍可能限流"},wO={title:"智能体排名",noData:"暂无智能体数据。启动智能体后可在此查看。",name:"智能体",team:"团队",tasks:"任务",cuUsed:"积分消耗",tokens:"Tokens",efficiency:"效率",total:"合计({{count}} 个智能体)",mixedProviders:"混合供应商 — 积分仅统计 Cloud AI",showAll:"展开全部 {{count}} 个",showLess:"收起"},kO={title:"团队成员",name:"姓名",role:"角色",team:"团队"},SO={title:"团队表现",members:"{{agents}}A · {{humans}}H",tasks:"任务",cuUsed:"积分",tokens:"Tokens",managedBy:"管理者:{{name}}"},NO={title:"用量趋势",byDay:"按天",byHour:"按小时",days:"天",totalCredits:"积分消耗",totalTokens:"Token 消耗",totalRequests:"请求次数",creditsChart:"积分",tokensChart:"Tokens",max:"最大",noData:"暂无用量数据。连接 Markus Hub 查看趋势。",models:"模型"},CO={planPending:"计划待处理",planStatus:"计划 {{status}}",taskMetrics:"任务指标",metric:{completed:"已完成",inProgress:"进行中",created:"已创建",blocked:"已阻塞",failed:"失败"},costOverview:"费用概览",totalTokens:"Token 总计",cuUsed:"积分消耗",trend:"趋势",taskSummary:"任务摘要",completedCount:"已完成({{count}})",inProgressCount:"进行中({{count}})",blockedCount:"已阻塞({{count}})",noTasks:"该时间段内没有任务。",highlights:"要点",blockers:"阻塞项",upcomingPlan:"后续计划",approvePlan:"批准计划",rejectPlan:"拒绝计划",rejectionReason:"拒绝原因:",planApproved:"计划已批准",planRejected:"计划已拒绝",noDetailedMetrics:"此报告不包含详细指标数据。",feedbackTitle:"反馈({{count}})",feedbackPlaceholder:"添加反馈或说明…",feedbackAdded:"反馈已添加"},TO="尚未生成报告。",AO="{{type}} 报告",EO="← 返回列表",_O={title:bO,tabs:xO,kpi:yO,quota:vO,agents:wO,humans:kO,teamPerf:SO,trends:NO,history:CO,noReportsYet:TO,reportType:AO,backToList:EO},jO={alex:{name:"Alex Chen"},sarah:{name:"Sarah Liu"},james:{name:"James Wang"},emily:{name:"Emily Zhang"},michael:{name:"Michael Li"}},MO={secretary:{name:"秘书",role:"行政协调员",activity:"协调日常运营"},chiefOfStaff:{name:"首席幕僚",role:"跨团队协调员",activity:"跨团队协调"},strategyAnalyst:{name:"战略分析师",role:"竞争情报",activity:"竞争情报分析"},engLead:{name:"工程主管",role:"工程经理",activity:"迭代规划与代码审查"},srBackend:{name:"高级后端开发",role:"后端工程师",activity:"构建支付API"},backend:{name:"后端开发",role:"后端工程师",activity:"数据库迁移"},srFrontend:{name:"高级前端开发",role:"前端工程师",activity:"仪表盘重构"},frontend:{name:"前端开发",role:"前端工程师",activity:"组件库开发"},mobile:{name:"移动端开发",role:"移动端工程师",activity:"等待API就绪"},devops:{name:"运维工程师",role:"基础设施工程师",activity:"CI/CD流水线"},qaLead:{name:"测试主管",role:"质量保障经理",activity:"自动化测试"},qaEng:{name:"测试工程师",role:"质量保障",activity:"回归测试"},security:{name:"安全审计员",role:"安全工程师",activity:"每周扫描已排期"},pm:{name:"产品经理",role:"产品管理",activity:"迭代规划"},uxResearcher:{name:"用户体验研究员",role:"用户体验",activity:"访谈分析"},uiDesigner:{name:"UI设计师",role:"视觉设计",activity:"设计系统更新"},dataAnalyst:{name:"数据分析师",role:"商业智能",activity:"漏斗分析"},researchLead:{name:"研究主管",role:"研究总监",activity:"竞争格局分析"},mlEngineer:{name:"机器学习工程师",role:"机器学习",activity:"模型微调"},researchAnalyst:{name:"研究分析师",role:"研究与分析",activity:"专利分析"},techWriter:{name:"技术文档工程师",role:"技术文档",activity:"API文档编写"},contentLead:{name:"内容主管",role:"内容策略",activity:"编辑日历"},seo:{name:"SEO专家",role:"搜索优化",activity:"关键词研究完成"},socialMedia:{name:"社交媒体运营",role:"社交与增长",activity:"营销活动排期"},copywriter:{name:"文案策划",role:"内容创作",activity:"落地页文案"},hr:{name:"人力资源协调员",role:"人力资源",activity:"入职文档已就绪"},legal:{name:"法务合规",role:"法律事务",activity:"隐私审查完成"},finance:{name:"财务分析师",role:"财务分析",activity:"月度报告"}},RO={engineering:{name:"核心工程团队",desc:"后端、前端、移动端、运维、测试和安全"},productDesign:{name:"产品设计团队",desc:"产品管理、用户体验研究、UI设计和数据分析"},research:{name:"研究与AI团队",desc:"研究、机器学习工程和技术文档"},content:{name:"内容增长团队",desc:"内容策略、SEO、社交媒体和文案创作"},operations:{name:"运营团队",desc:"人力资源、法务、合规和财务"},projectAlpha:{name:"Alpha项目组",desc:"支付平台发布的跨职能冲刺团队"}},LO={payment:{name:"支付平台v2",desc:"完整的支付基础设施,支持Stripe、PayPal和加密货币"},dashboard:{name:"仪表盘重构",desc:"现代化分析仪表盘,实时数据可视化"},research:{name:"Q2市场调研",desc:"竞争格局分析和市场定位"},mobile:{name:"移动应用MVP",desc:"跨平台移动应用,核心功能集"},securityAudit:{name:"Q1安全审计",desc:"全面的安全审计和漏洞评估"}},OO={paymentWebhook:"实现Stripe和PayPal Webhook端点",dbSchema:"设计支付交易数据库Schema",userResearch:"综合24份用户访谈生成洞察报告",competitorReport:"Q2竞争格局分析:覆盖12家竞品",cicdSetup:"搭建6阶段CI/CD流水线(含金丝雀发布)",designTokens:"导出设计系统Token:42色彩、8间距",authFlow:"实现OAuth 2.0 + API Key认证流程",loadTesting:"构建万级并发压力测试平台",seoMatrix:"调研8个产品垂类1200+关键词",privacyDraft:"起草符合GDPR的欧盟版隐私政策",q1Finance:"编制Q1财务报表含各部门损益",testFramework:"基于Playwright搭建端到端测试框架",paymentReconciliation:"构建幂等支付对账API",dashboardCharts:"基于D3.js实现交互式图表组件",mobileOnboarding:"设计并实现5步移动端引导体验",mlPipeline:"搭建欺诈检测模型训练流水线",rateLimiting:"实现API限流:1000次/分钟",editorialCalendar:"规划Q3四渠道内容编辑日历",funnelAnalysis:"分析用户转化漏斗:注册→激活→留存",componentDocs:"为47个React UI组件编写文档",regressionSuite:"将回归测试扩展至312个用例",socialCampaign:"制作60+产品发布营销素材",idempotency:"为所有写入端点添加幂等键验证",landingMockup:"落地页重设计:8个高保真页面",patentReport:"分析AI工作流自动化领域847项专利",apiDocsV2:"为86个API端点编写开发者文档",monthlyFinance:"编制5月月度财务结算报告",securityScan:"自动化OWASP Top 10周度安全扫描",disputeHandling:"构建对接Stripe API的支付争议流程",darkMode:"实现系统感知的深色模式主题切换",pushNotifications:"构建FCM/APNs推送通知服务",abTesting:"搭建基于Feature Flag的A/B测试框架",blogAiWorkforce:"撰写博客:'AI原生员工团队革命'",offlineMode:"实现IndexedDB离线优先数据同步",perfBenchmarks:"性能基准测试:API p99、FCP、TTI",emailOnboarding:"设计5封引导邮件序列含数据分析",mobilePayment:"集成Stripe React Native支付SDK",deepLinking:"实现iOS Universal Links和Android App Links",legacyMigration:"遗留数据迁移脚本",legacyMigrationError:"数据结构不匹配——遗留字段类型不兼容"},DO={paymentWebhook:"处理Stripe/PayPal传入的Webhook事件。验证签名、解析事件负载、更新数据库中的交易状态,并触发下游对账工作流。",dbSchema:"设计涵盖交易、结算和争议的规范化数据库Schema。支持多币种、部分退款,以及含时间戳的完整审计追踪。",userResearch:"综合分析24份用户访谈数据(覆盖4类用户画像)。生成亲和图、关键洞察卡片和优先级推荐矩阵。",competitorReport:"深入分析5个细分市场的12家竞品。产出功能对比矩阵、定价分析和战略建议。",cicdSetup:"配置GitHub Actions流水线:lint → 测试 → 构建 → 金丝雀(5%) → 生产。包含Cosign镜像签名和SBOM生成。",designTokens:"将Figma设计Token导出为CSS自定义属性和Tailwind配置。涵盖色彩、间距、字体、阴影和圆角。",authFlow:"实现OAuth 2.0授权码流程(含PKCE)、API Key认证,以及可配置TTL的JWT Token轮换。",loadTesting:"基于k6构建压力测试工具,模拟万级并发用户访问支付、仪表盘和认证端点。输出Grafana兼容指标。",seoMatrix:"调研8个垂类1200+关键词。按搜索量、难度和意图评分。关联内容日历并预测流量影响。",privacyDraft:"起草隐私政策:涵盖数据收集、处理、保留和删除。符合GDPR第13-14条和CCPA要求。",q1Finance:"编制Q1财务报表:营收$6.8M,毛利率76%,各部门损益明细,以及至Q3的现金流预测。",testFramework:"基于Playwright搭建端到端测试框架。覆盖API、UI和视觉回归测试。4工作线程并行执行,Slack报告集成。",paymentReconciliation:"构建对账引擎:匹配入账交易与预期付款。处理部分匹配、时序差异和币种转换。",dashboardCharts:"基于D3.js实现6种图表类型(折线、柱状、饼图、面积、散点、热力图)。支持自适应尺寸、工具提示、下钻和数据导出。",mobileOnboarding:"设计并实现5步引导流程:欢迎→个人资料→权限→教程→主页。按步骤追踪完成率。",mlPipeline:"搭建MLflow训练流水线:数据采集→特征工程→模型训练→评估→A/B部署清单。",rateLimiting:"基于Redis实现滑动窗口限流。每API Key 1000次/分钟,突发上限2000次,优雅返回429响应。",editorialCalendar:"规划Q3博客、社交、Newsletter和文档四渠道内容。关联产品发布节点和SEO机会。",funnelAnalysis:"分析注册到付费的转化漏斗:定位前3大流失节点,按来源/设备细分,推荐优化方案。",componentDocs:"基于Storybook为47个React组件生成交互式文档。包含Props表格、无障碍审计和包大小影响。",regressionSuite:"将回归测试扩展至312个用例(覆盖8个模块)。修复5个不稳定测试,添加重试逻辑,通过率98.4%。",socialCampaign:"为产品发布制作60+素材:轮播图、视频脚本、A/B标题。适配LinkedIn、Twitter/X和Instagram。",idempotency:"为所有写入端点添加幂等键验证。Redis存储Key(24小时TTL),重复请求返回缓存响应。",landingMockup:"重设计落地页:首屏、功能展示、社交证明、定价。8个高保真页面含移动端响应式适配。",patentReport:"分析AI工作流自动化领域847项专利。将权利要求映射到产品功能,识别自由实施风险和IP布局空白。",apiDocsV2:"为86个端点编写开发者文档,含Python、Node、Go、Ruby和cURL代码示例。包含认证指南和Webhook配置。",monthlyFinance:"5月月度结算:营收$2.4M(环比+18%),SaaS ARR突破$24M,CAC回收期11个月,毛利率78%。",securityScan:"在CI中自动化ZAP + Semgrep的OWASP Top 10扫描。生成周度安全面板和修复优先级队列。",disputeHandling:"构建争议生命周期:开启→举证→仲裁→解决。集成Stripe Disputes API并自动生成应答模板。",darkMode:"基于CSS自定义属性实现系统感知深色模式。支持手动切换并通过localStorage持久化。",pushNotifications:"构建FCM(Android)和APNs(iOS)推送服务。支持主题订阅、富媒体通知和投递数据分析。",abTesting:"基于LaunchDarkly Feature Flag搭建A/B测试。服务端分流、转化追踪和统计显著性计算。",blogAiWorkforce:"撰写2500字博客文章:AI原生团队范式。涵盖自主Agent、自组织团队和实际ROI案例。",offlineMode:"基于IndexedDB + Background Sync实现离线优先架构。本地队列写操作,重连时冲突解决。",perfBenchmarks:"API p99延迟(目标<200ms)、FCP(<1.5s)、TTI(<3s)基准测试。对比基线并生成回归告警。",emailOnboarding:"设计5封引导邮件:欢迎→核心功能→使用技巧→案例分享→升级引导。追踪打开率、点击率和转化。",mobilePayment:"集成Stripe React Native SDK。支持Apple Pay、Google Pay、银行卡和3D Secure。处理弱网场景。",deepLinking:"配置iOS Universal Links和Android App Links。深度链接路由至指定页面,Web回退兜底。"},IO={stripePaypal:"支付平台v2需支持Stripe、PayPal和加密货币",dashboardPerf:"仪表盘在3G网络下需2秒内加载",openApiDocs:"所有API端点需有OpenAPI文档",offlineCore:"移动应用核心功能需支持离线",gdpr:"所有用户数据需符合GDPR",monthlyReport:"每月5日前提交高管报告",competitiveQuarterly:"竞品分析每季度更新",paymentSla:"支付服务99.9% SLA"},PO={stripePaypal:"集成Stripe和PayPal支付网关,支持完整生命周期:授权、扣款、退款、争议和Webhook驱动的状态更新。加密货币通过Coinbase Commerce作为第二阶段实施。",dashboardPerf:"所有仪表盘视图在模拟3G下FCP<1.5s、TTI<2s。实施代码分割、懒加载和边缘缓存。",openApiDocs:"每个公开和内部API端点必须有完整的OpenAPI 3.1规范,含请求/响应Schema、认证要求、限流策略和5种语言的代码示例。",offlineCore:"核心功能(任务查看、消息起草、交付物浏览)必须通过IndexedDB支持离线使用。本地队列写操作,重连时同步并解决冲突。",gdpr:"所有用户数据处理需符合GDPR第5-9条。实现数据主体访问请求、删除权、数据可携带性和同意管理。",monthlyReport:"自动化月度高管报告:涵盖营收、Agent效率、任务指标和系统健康状况。每月5日前交付所有创始人。",competitiveQuarterly:"全面竞争分析:涵盖市场定位、功能对标、定价策略和新兴威胁。每季度更新并附可执行建议。",paymentSla:"支付处理端点需保持99.9%可用性SLA。实施多区域故障转移、熔断器和自动化事件响应。"},zO={paymentApiSpec:"支付API v2 — OpenAPI规范",dashboardMockups:"仪表盘重设计稿",q2Report:"Q2竞争格局报告",cicdConfig:"CI/CD流水线配置",componentDocs:"组件库文档",securityReport:"Q1安全审计报告",mlResults:"ML模型训练结果",seoMatrix:"SEO关键词矩阵",financeReport:"5月月度财务报告",apiDocsV2:"API文档v2",interviewNotes:"用户研究访谈记录",wireframes:"移动应用线框图",patentAnalysis:"专利格局分析",testFramework:"自动化测试框架",socialAssets:"社交媒体营销素材"},BO={paymentApiSpec:`### 支付对账 API v2
192
192
 
193
193
  覆盖完整支付生命周期的 OpenAPI 3.1 规范。
194
194
 
@@ -645,7 +645,7 @@ l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
645
645
  `},f]}}const eG=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),tG=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],nG=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],rG=[...tG,...nG],aG=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),o3=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),l3=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),sG=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),iG=o3.concat(l3).sort().reverse();function oG(e){const t=eG(e),n=iG,r="and or not only",o="[\\w-]+",l="("+o+"|@\\{"+o+"\\})",c=[],d=[],m=function(j){return{className:"string",begin:"~?"+j+".*?"+j}},f=function(j,L,I){return{className:j,begin:L,relevance:I}},h={$pattern:/[a-z-]+/,keyword:r,attribute:aG.join(" ")},g={begin:"\\(",end:"\\)",contains:d,keywords:h,relevance:0};d.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,m("'"),m('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,g,f("variable","@@?"+o,10),f("variable","@\\{"+o+"\\}"),f("built_in","~?`[^`]*?`"),{className:"attribute",begin:o+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const y=d.concat({begin:/\{/,end:/\}/,contains:c}),x={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(d)},w={begin:l+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+sG.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:d}}]},C={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:h,returnEnd:!0,contains:d,relevance:0}},T={className:"variable",variants:[{begin:"@"+o+"\\s*:",relevance:15},{begin:"@"+o}],starts:{end:"[;}]",returnEnd:!0,contains:y}},S={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:l,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,x,f("keyword","all\\b"),f("variable","@\\{"+o+"\\}"),{begin:"\\b("+rG.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,f("selector-tag",l,0),f("selector-id","#"+l),f("selector-class","\\."+l,0),f("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+o3.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+l3.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:y},{begin:"!important"},t.FUNCTION_DISPATCH]},E={begin:o+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[S]};return c.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,C,T,E,w,S,x,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:c}}function lG(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},o=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:o.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:o}].concat(o)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function cG(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[t,n]},o={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},l={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},c={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[t]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[e.HASH_COMMENT_MODE,t,n,r,o,l,c]}}function uG(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},o={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},l={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},c={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},d=/[A-Za-z][A-Za-z0-9+.-]*/,m={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,d,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},f={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},h={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},g=e.inherit(f,{contains:[]}),y=e.inherit(h,{contains:[]});f.contains.push(y),h.contains.push(g);let x=[n,m];return[f,h,g,y].forEach(S=>{S.contains=S.contains.concat(x)}),x=x.concat(f,h),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:x},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:x}]}]},n,l,f,h,{className:"quote",begin:"^>\\s+",contains:x,end:"$"},o,r,m,c,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function dG(e){const t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,d={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},m={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:d,illegal:"</",contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+m.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:m,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function mG(e){const t=e.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,o={$pattern:/[\w.]+/,keyword:n.join(" ")},l={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:o},c={begin:/->\{/,end:/\}/},d={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},m={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[d]},f={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},h=[e.BACKSLASH_ESCAPE,l,m],g=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],y=(C,T,S="\\1")=>{const E=S==="\\1"?S:t.concat(S,T);return t.concat(t.concat("(?:",C,")"),T,/(?:\\.|[^\\\/])*?/,E,/(?:\\.|[^\\\/])*?/,S,r)},x=(C,T,S)=>t.concat(t.concat("(?:",C,")"),T,/(?:\\.|[^\\\/])*?/,S,r),w=[m,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),c,{className:"string",contains:h,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},f,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:y("s|tr|y",t.either(...g,{capture:!0}))},{begin:y("s|tr|y","\\(","\\)")},{begin:y("s|tr|y","\\[","\\]")},{begin:y("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:x("(?:m|qr)?",/\//,/\//)},{begin:x("m|qr",t.either(...g,{capture:!0}),/\1/)},{begin:x("m|qr",/\(/,/\)/)},{begin:x("m|qr",/\[/,/\]/)},{begin:x("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,d]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,d,f]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return l.contains=w,c.contains=w,{name:"Perl",aliases:["pl","pm"],keywords:o,contains:w}}function fG(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),o=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),l=t.concat(/[A-Z]+/,n),c={scope:"variable",match:"\\$+"+r},d={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},m={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},f=e.inherit(e.APOS_STRING_MODE,{illegal:null}),h=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(m)}),g={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(m),"on:begin":(q,re)=>{re.data._beginMatch=q[1]||q[2]},"on:end":(q,re)=>{re.data._beginMatch!==q[1]&&re.ignoreMatch()}},y=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),x=`[
646
646
  ]`,w={scope:"string",variants:[h,f,g,y]},C={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},T=["false","null","true"],S=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],E=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],L={keyword:S,literal:(q=>{const re=[];return q.forEach(B=>{re.push(B),B.toLowerCase()===B?re.push(B.toUpperCase()):re.push(B.toLowerCase())}),re})(T),built_in:E},I=q=>q.map(re=>re.replace(/\|\d+$/,"")),O={variants:[{match:[/new/,t.concat(x,"+"),t.concat("(?!",I(E).join("\\b|"),"\\b)"),o],scope:{1:"keyword",4:"title.class"}}]},F=t.concat(r,"\\b(?!\\()"),V={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),F],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[o,t.concat(/::/,t.lookahead(/(?!class\b)/)),F],scope:{1:"title.class",3:"variable.constant"}},{match:[o,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[o,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},X={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},z={relevance:0,begin:/\(/,end:/\)/,keywords:L,contains:[X,c,V,e.C_BLOCK_COMMENT_MODE,w,C,O]},G={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",I(S).join("\\b|"),"|",I(E).join("\\b|"),"\\b)"),r,t.concat(x,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[z]};z.contains.push(G);const se=[X,V,e.C_BLOCK_COMMENT_MODE,w,C,O],ee={begin:t.concat(/#\[\s*\\?/,t.either(o,l)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:T,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:T,keyword:["new","array"]},contains:["self",...se]},...se,{scope:"meta",variants:[{match:o},{match:l}]}]};return{case_insensitive:!1,keywords:L,contains:[ee,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},d,{scope:"variable.language",match:/\$this\b/},c,G,V,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},O,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:L,contains:["self",ee,c,V,e.C_BLOCK_COMMENT_MODE,w,C]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},w,C]}}function pG(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function hG(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function gG(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],d={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},m={className:"meta",begin:/^(>>>|\.\.\.) /},f={className:"subst",begin:/\{/,end:/\}/,keywords:d,illegal:/#/},h={begin:/\{\{/,relevance:0},g={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,m],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,m],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,m,h,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,m,h,f]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,h,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,h,f]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},y="[0-9](_?[0-9])*",x=`(\\b(${y}))?\\.(${y})|\\b(${y})\\.`,w=`\\b|${r.join("|")}`,C={className:"number",relevance:0,variants:[{begin:`(\\b(${y})|(${x}))[eE][+-]?(${y})[jJ]?(?=${w})`},{begin:`(${x})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${w})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${w})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${w})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${w})`},{begin:`\\b(${y})[jJ](?=${w})`}]},T={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:d,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},S={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:["self",m,C,g,e.HASH_COMMENT_MODE]}]};return f.contains=[g,C,m],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:d,illegal:/(<\/|\?)|=>/,contains:[m,C,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},g,T,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[S]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[C,S,g]}]}}function bG(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function xG(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),o=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,l=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[o,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[l,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:o},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:l},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function yG(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),o=t.concat(r,/(::\w+)*/),c={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},d={className:"doctag",begin:"@[A-Za-z]+"},m={begin:"#<",end:">"},f=[e.COMMENT("#","$",{contains:[d]}),e.COMMENT("^=begin","^=end",{contains:[d],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],h={className:"subst",begin:/#\{/,end:/\}/,keywords:c},g={className:"string",contains:[e.BACKSLASH_ESCAPE,h],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,h]})]}]},y="[1-9](_?[0-9])*|0",x="[0-9](_?[0-9])*",w={className:"number",relevance:0,variants:[{begin:`\\b(${y})(\\.(${x}))?([eE][+-]?(${x})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},C={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:c}]},O=[g,{variants:[{match:[/class\s+/,o,/\s+<\s+/,o]},{match:[/\b(class|module)\s+/,o]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:c},{match:[/(include|extend)\s+/,o],scope:{2:"title.class"},keywords:c},{relevance:0,match:[o,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[C]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[g,{begin:n}],relevance:0},w,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:c},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,h],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(m,f),relevance:0}].concat(m,f);h.contains=O,C.contains=O;const z=[{begin:/^\s*=>/,starts:{end:"$",contains:O}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:c,contains:O}}];return f.unshift(m),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:c,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(z).concat(f).concat(O)}}function vG(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),o=t.concat(n,e.IDENT_RE),l={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,o,t.lookahead(/\s*\(/))},c="([ui](8|16|32|64|128|size)|f(32|64))?",d=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],m=["true","false","Some","None","Ok","Err"],f=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],h=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:h,keyword:d,literal:m,built_in:f},illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+c},{begin:"\\b0o([0-7_]+)"+c},{begin:"\\b0x([A-Fa-f0-9_]+)"+c},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+c}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:f,type:h}},{className:"punctuation",begin:"->"},l]}}const wG=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),kG=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],SG=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],NG=[...kG,...SG],CG=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),TG=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),AG=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),EG=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function _G(e){const t=wG(e),n=AG,r=TG,o="@[a-z-]+",l="and or not only",d={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+NG.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},d,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+EG.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,d,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:o,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:l,attribute:CG.join(" ")},contains:[{begin:o,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},d,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function jG(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function MG(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},o={begin:/"/,end:/"/,contains:[{match:/""/}]},l=["true","false","unknown"],c=["double precision","large object","with timezone","without timezone"],d=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],m=["add","asc","collation","desc","final","first","last","view"],f=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],h=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],g=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],y=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],x=h,w=[...f,...m].filter(I=>!h.includes(I)),C={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},T={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},S={match:t.concat(/\b/,t.either(...x),/\s*\(/),relevance:0,keywords:{built_in:x}};function E(I){return t.concat(/\b/,t.either(...I.map(O=>O.replace(/\s+/,"\\s+"))),/\b/)}const j={scope:"keyword",match:E(y),relevance:0};function L(I,{exceptions:O,when:F}={}){const V=F;return O=O||[],I.map(X=>X.match(/\|\d+$/)||O.includes(X)?X:V(X)?`${X}|0`:X)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:L(w,{when:I=>I.length<3}),literal:l,type:d,built_in:g},contains:[{scope:"type",match:E(c)},j,S,C,r,o,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,T]}}function c3(e){return e?typeof e=="string"?e:e.source:null}function Ql(e){return dn("(?=",e,")")}function dn(...e){return e.map(n=>c3(n)).join("")}function RG(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function cr(...e){return"("+(RG(e).capture?"":"?:")+e.map(r=>c3(r)).join("|")+")"}const Gg=e=>dn(/\b/,e,/\w$/.test(e)?/\b/:/\B/),LG=["Protocol","Type"].map(Gg),W2=["init","self"].map(Gg),OG=["Any","Self"],Wp=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],Y2=["false","nil","true"],DG=["assignment","associativity","higherThan","left","lowerThan","none","right"],IG=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],X2=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],u3=cr(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),d3=cr(u3,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Yp=dn(u3,d3,"*"),m3=cr(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),h0=cr(m3,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),ba=dn(m3,h0,"*"),vd=dn(/[A-Z]/,h0,"*"),PG=["attached","autoclosure",dn(/convention\(/,cr("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",dn(/objc\(/,ba,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],zG=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function BG(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],o={match:[/\./,cr(...LG,...W2)],className:{2:"keyword"}},l={match:dn(/\./,cr(...Wp)),relevance:0},c=Wp.filter(dt=>typeof dt=="string").concat(["_|0"]),d=Wp.filter(dt=>typeof dt!="string").concat(OG).map(Gg),m={variants:[{className:"keyword",match:cr(...d,...W2)}]},f={$pattern:cr(/\b\w+/,/#\w+/),keyword:c.concat(IG),literal:Y2},h=[o,l,m],g={match:dn(/\./,cr(...X2)),relevance:0},y={className:"built_in",match:dn(/\b/,cr(...X2),/(?=\()/)},x=[g,y],w={match:/->/,relevance:0},C={className:"operator",relevance:0,variants:[{match:Yp},{match:`\\.(\\.|${d3})+`}]},T=[w,C],S="([0-9]_*)+",E="([0-9a-fA-F]_*)+",j={className:"number",relevance:0,variants:[{match:`\\b(${S})(\\.(${S}))?([eE][+-]?(${S}))?\\b`},{match:`\\b0x(${E})(\\.(${E}))?([pP][+-]?(${S}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},L=(dt="")=>({className:"subst",variants:[{match:dn(/\\/,dt,/[0\\tnr"']/)},{match:dn(/\\/,dt,/u\{[0-9a-fA-F]{1,8}\}/)}]}),I=(dt="")=>({className:"subst",match:dn(/\\/,dt,/[\t ]*(?:[\r\n]|\r\n)/)}),O=(dt="")=>({className:"subst",label:"interpol",begin:dn(/\\/,dt,/\(/),end:/\)/}),F=(dt="")=>({begin:dn(dt,/"""/),end:dn(/"""/,dt),contains:[L(dt),I(dt),O(dt)]}),V=(dt="")=>({begin:dn(dt,/"/),end:dn(/"/,dt),contains:[L(dt),O(dt)]}),X={className:"string",variants:[F(),F("#"),F("##"),F("###"),V(),V("#"),V("##"),V("###")]},z=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],G={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:z},se=dt=>{const Nt=dn(dt,/\//),bt=dn(/\//,dt);return{begin:Nt,end:bt,contains:[...z,{scope:"comment",begin:`#(?!.*${bt})`,end:/$/}]}},ee={scope:"regexp",variants:[se("###"),se("##"),se("#"),G]},q={match:dn(/`/,ba,/`/)},re={className:"variable",match:/\$\d+/},B={className:"variable",match:`\\$${h0}+`},J=[q,re,B],fe={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:zG,contains:[...T,j,X]}]}},Se={scope:"keyword",match:dn(/@/,cr(...PG),Ql(cr(/\(/,/\s+/)))},U={scope:"meta",match:dn(/@/,ba)},W=[fe,Se,U],pe={match:Ql(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:dn(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,h0,"+")},{className:"type",match:vd,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:dn(/\s+&\s+/,Ql(vd)),relevance:0}]},P={begin:/</,end:/>/,keywords:f,contains:[...r,...h,...W,w,pe]};pe.contains.push(P);const _e={match:dn(ba,/\s*:/),keywords:"_|0",relevance:0},He={begin:/\(/,end:/\)/,relevance:0,keywords:f,contains:["self",_e,...r,ee,...h,...x,...T,j,X,...J,...W,pe]},Pe={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,pe]},Ge={begin:cr(Ql(dn(ba,/\s*:/)),Ql(dn(ba,/\s+/,ba,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:ba}]},ct={begin:/\(/,end:/\)/,keywords:f,contains:[Ge,...r,...h,...T,j,X,...W,pe,He],endsParent:!0,illegal:/["']/},mt={match:[/(func|macro)/,/\s+/,cr(q.match,ba,Yp)],className:{1:"keyword",3:"title.function"},contains:[Pe,ct,t],illegal:[/\[/,/%/]},Ct={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[Pe,ct,t],illegal:/\[|%/},Mt={match:[/operator/,/\s+/,Yp],className:{1:"keyword",3:"title"}},Pt={begin:[/precedencegroup/,/\s+/,vd],className:{1:"keyword",3:"title"},contains:[pe],keywords:[...DG,...Y2],end:/}/},Kt={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},yt={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Ue={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,ba,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:f,contains:[Pe,...h,{begin:/:/,end:/\{/,keywords:f,contains:[{scope:"title.class.inherited",match:vd},...h],relevance:0}]};for(const dt of X.variants){const Nt=dt.contains.find(Lt=>Lt.label==="interpol");Nt.keywords=f;const bt=[...h,...x,...T,j,X,...J];Nt.contains=[...bt,{begin:/\(/,end:/\)/,contains:["self",...bt]}]}return{name:"Swift",keywords:f,contains:[...r,mt,Ct,Kt,yt,Ue,Mt,Pt,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},ee,...h,...x,...T,j,X,...J,...W,pe,He]}}const g0="[A-Za-z$_][0-9A-Za-z$_]*",f3=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],p3=["true","false","null","undefined","NaN","Infinity"],h3=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],g3=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],b3=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],x3=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],y3=[].concat(b3,h3,g3);function $G(e){const t=e.regex,n=(fe,{after:Se})=>{const U="</"+fe[0].slice(1);return fe.input.indexOf(U,Se)!==-1},r=g0,o={begin:"<>",end:"</>"},l=/<[A-Za-z0-9\\._:-]+\s*\/>/,c={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(fe,Se)=>{const U=fe[0].length+fe.index,W=fe.input[U];if(W==="<"||W===","){Se.ignoreMatch();return}W===">"&&(n(fe,{after:U})||Se.ignoreMatch());let pe;const P=fe.input.substring(U);if(pe=P.match(/^\s*=/)){Se.ignoreMatch();return}if((pe=P.match(/^\s+extends\s+/))&&pe.index===0){Se.ignoreMatch();return}}},d={$pattern:g0,keyword:f3,literal:p3,built_in:y3,"variable.language":x3},m="[0-9](_?[0-9])*",f=`\\.(${m})`,h="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",g={className:"number",variants:[{begin:`(\\b(${h})((${f})|\\.)?|(${f}))[eE][+-]?(${m})\\b`},{begin:`\\b(${h})\\b((${f})\\b|\\.)?|(${f})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},y={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},x={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"xml"}},w={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"css"}},C={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,y],subLanguage:"graphql"}},T={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,y]},E={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},j=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,w,C,T,{match:/\$\d+/},g];y.contains=j.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(j)});const L=[].concat(E,y.contains),I=L.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(L)}]),O={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:I},F={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},V={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...h3,...g3]}},X={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},z={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[O],illegal:/%/},G={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function se(fe){return t.concat("(?!",fe.join("|"),")")}const ee={match:t.concat(/\b/,se([...b3,"super","import"].map(fe=>`${fe}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},q={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},re={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},O]},B="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",J={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(B)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[O]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:I,CLASS_REFERENCE:V},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),X,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,w,C,T,E,{match:/\$\d+/},g,V,{scope:"attr",match:r+t.lookahead(":"),relevance:0},J,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[E,e.REGEXP_MODE,{className:"function",begin:B,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:I}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:o.begin,end:o.end},{match:l},{begin:c.begin,"on:begin":c.isTrulyOpeningTag,end:c.end}],subLanguage:"xml",contains:[{begin:c.begin,end:c.end,skip:!0,contains:["self"]}]}]},z,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[O,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},q,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[O]},ee,G,F,re,{match:/\$[(.]/}]}}function HG(e){const t=e.regex,n=$G(e),r=g0,o=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],l={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},c={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:o},contains:[n.exports.CLASS_REFERENCE]},d={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},m=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],f={$pattern:g0,keyword:f3.concat(m),literal:p3,built_in:y3.concat(o),"variable.language":x3},h={className:"meta",begin:"@"+r},g=(C,T,S)=>{const E=C.contains.findIndex(j=>j.label===T);if(E===-1)throw new Error("can not find mode to replace");C.contains.splice(E,1,S)};Object.assign(n.keywords,f),n.exports.PARAMS_CONTAINS.push(h);const y=n.contains.find(C=>C.scope==="attr"),x=Object.assign({},y,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,y,x]),n.contains=n.contains.concat([h,l,c,x]),g(n,"shebang",e.SHEBANG()),g(n,"use_strict",d);const w=n.contains.find(C=>C.label==="func.def");return w.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function UG(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},o=/\d{1,2}\/\d{1,2}\/\d{4}/,l=/\d{4}-\d{1,2}-\d{1,2}/,c=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,d=/\d{1,2}(:\d{1,2}){1,2}/,m={className:"literal",variants:[{begin:t.concat(/# */,t.either(l,o),/ *#/)},{begin:t.concat(/# */,d,/ *#/)},{begin:t.concat(/# */,c,/ *#/)},{begin:t.concat(/# */,t.either(l,o),/ +/,t.either(c,d),/ *#/)}]},f={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},h={className:"label",begin:/^\w+:/},g=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),y=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,m,f,h,g,y,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[y]}]}}function FG(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],o={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},l={className:"variable",begin:/\$[\w_]+/},c={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},d={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},m={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},f={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},l,c,o,e.QUOTE_STRING_MODE,m,f,d]}}function qG(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,o={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},l={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},c=e.inherit(l,{begin:/\(/,end:/\)/}),d=e.inherit(e.APOS_STRING_MODE,{className:"string"}),m=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),f={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[o]},{begin:/'/,end:/'/,contains:[o]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[l,m,d,c,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[l,c,m,d]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},o,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[m]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[f],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[f],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:f}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function GG(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},o={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},l={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},c={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,o]},d=e.inherit(c,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),y={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},x={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},w={begin:/\{/,end:/\}/,contains:[x],illegal:"\\n",relevance:0},C={begin:"\\[",end:"\\]",contains:[x],illegal:"\\n",relevance:0},T=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},y,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},w,C,l,c],S=[...T];return S.pop(),S.push(d),x.contains=S,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:T}}const VG={arduino:Aq,bash:Eq,c:_q,cpp:jq,csharp:Mq,css:$q,diff:Hq,go:Uq,graphql:Fq,ini:qq,java:Gq,javascript:Xq,json:Qq,kotlin:Jq,less:oG,lua:lG,makefile:cG,markdown:uG,objectivec:dG,perl:mG,php:fG,"php-template":pG,plaintext:hG,python:gG,"python-repl":bG,r:xG,ruby:yG,rust:vG,scss:_G,shell:jG,sql:MG,swift:BG,typescript:HG,vbnet:UG,wasm:FG,xml:qG,yaml:GG};var Xp,Q2;function KG(){if(Q2)return Xp;Q2=1;function e(K){return K instanceof Map?K.clear=K.delete=K.set=function(){throw new Error("map is read-only")}:K instanceof Set&&(K.add=K.clear=K.delete=function(){throw new Error("set is read-only")}),Object.freeze(K),Object.getOwnPropertyNames(K).forEach(ce=>{const Te=K[ce],ze=typeof Te;(ze==="object"||ze==="function")&&!Object.isFrozen(Te)&&e(Te)}),K}class t{constructor(ce){ce.data===void 0&&(ce.data={}),this.data=ce.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(K){return K.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function r(K,...ce){const Te=Object.create(null);for(const ze in K)Te[ze]=K[ze];return ce.forEach(function(ze){for(const rt in ze)Te[rt]=ze[rt]}),Te}const o="</span>",l=K=>!!K.scope,c=(K,{prefix:ce})=>{if(K.startsWith("language:"))return K.replace("language:","language-");if(K.includes(".")){const Te=K.split(".");return[`${ce}${Te.shift()}`,...Te.map((ze,rt)=>`${ze}${"_".repeat(rt+1)}`)].join(" ")}return`${ce}${K}`};class d{constructor(ce,Te){this.buffer="",this.classPrefix=Te.classPrefix,ce.walk(this)}addText(ce){this.buffer+=n(ce)}openNode(ce){if(!l(ce))return;const Te=c(ce.scope,{prefix:this.classPrefix});this.span(Te)}closeNode(ce){l(ce)&&(this.buffer+=o)}value(){return this.buffer}span(ce){this.buffer+=`<span class="${ce}">`}}const m=(K={})=>{const ce={children:[]};return Object.assign(ce,K),ce};class f{constructor(){this.rootNode=m(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(ce){this.top.children.push(ce)}openNode(ce){const Te=m({scope:ce});this.add(Te),this.stack.push(Te)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(ce){return this.constructor._walk(ce,this.rootNode)}static _walk(ce,Te){return typeof Te=="string"?ce.addText(Te):Te.children&&(ce.openNode(Te),Te.children.forEach(ze=>this._walk(ce,ze)),ce.closeNode(Te)),ce}static _collapse(ce){typeof ce!="string"&&ce.children&&(ce.children.every(Te=>typeof Te=="string")?ce.children=[ce.children.join("")]:ce.children.forEach(Te=>{f._collapse(Te)}))}}class h extends f{constructor(ce){super(),this.options=ce}addText(ce){ce!==""&&this.add(ce)}startScope(ce){this.openNode(ce)}endScope(){this.closeNode()}__addSublanguage(ce,Te){const ze=ce.root;Te&&(ze.scope=`language:${Te}`),this.add(ze)}toHTML(){return new d(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function g(K){return K?typeof K=="string"?K:K.source:null}function y(K){return C("(?=",K,")")}function x(K){return C("(?:",K,")*")}function w(K){return C("(?:",K,")?")}function C(...K){return K.map(Te=>g(Te)).join("")}function T(K){const ce=K[K.length-1];return typeof ce=="object"&&ce.constructor===Object?(K.splice(K.length-1,1),ce):{}}function S(...K){return"("+(T(K).capture?"":"?:")+K.map(ze=>g(ze)).join("|")+")"}function E(K){return new RegExp(K.toString()+"|").exec("").length-1}function j(K,ce){const Te=K&&K.exec(ce);return Te&&Te.index===0}const L=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function I(K,{joinWith:ce}){let Te=0;return K.map(ze=>{Te+=1;const rt=Te;let vt=g(ze),Fe="";for(;vt.length>0;){const at=L.exec(vt);if(!at){Fe+=vt;break}Fe+=vt.substring(0,at.index),vt=vt.substring(at.index+at[0].length),at[0][0]==="\\"&&at[1]?Fe+="\\"+String(Number(at[1])+rt):(Fe+=at[0],at[0]==="("&&Te++)}return Fe}).map(ze=>`(${ze})`).join(ce)}const O=/\b\B/,F="[a-zA-Z]\\w*",V="[a-zA-Z_]\\w*",X="\\b\\d+(\\.\\d+)?",z="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",G="\\b(0b[01]+)",se="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",ee=(K={})=>{const ce=/^#![ ]*\//;return K.binary&&(K.begin=C(ce,/.*\b/,K.binary,/\b.*/)),r({scope:"meta",begin:ce,end:/$/,relevance:0,"on:begin":(Te,ze)=>{Te.index!==0&&ze.ignoreMatch()}},K)},q={begin:"\\\\[\\s\\S]",relevance:0},re={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[q]},B={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[q]},J={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},fe=function(K,ce,Te={}){const ze=r({scope:"comment",begin:K,end:ce,contains:[]},Te);ze.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const rt=S("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return ze.contains.push({begin:C(/[ ]+/,"(",rt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),ze},Se=fe("//","$"),U=fe("/\\*","\\*/"),W=fe("#","$"),pe={scope:"number",begin:X,relevance:0},P={scope:"number",begin:z,relevance:0},_e={scope:"number",begin:G,relevance:0},He={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[q,{begin:/\[/,end:/\]/,relevance:0,contains:[q]}]},Pe={scope:"title",begin:F,relevance:0},Ge={scope:"title",begin:V,relevance:0},ct={begin:"\\.\\s*"+V,relevance:0};var Ct=Object.freeze({__proto__:null,APOS_STRING_MODE:re,BACKSLASH_ESCAPE:q,BINARY_NUMBER_MODE:_e,BINARY_NUMBER_RE:G,COMMENT:fe,C_BLOCK_COMMENT_MODE:U,C_LINE_COMMENT_MODE:Se,C_NUMBER_MODE:P,C_NUMBER_RE:z,END_SAME_AS_BEGIN:function(K){return Object.assign(K,{"on:begin":(ce,Te)=>{Te.data._beginMatch=ce[1]},"on:end":(ce,Te)=>{Te.data._beginMatch!==ce[1]&&Te.ignoreMatch()}})},HASH_COMMENT_MODE:W,IDENT_RE:F,MATCH_NOTHING_RE:O,METHOD_GUARD:ct,NUMBER_MODE:pe,NUMBER_RE:X,PHRASAL_WORDS_MODE:J,QUOTE_STRING_MODE:B,REGEXP_MODE:He,RE_STARTERS_RE:se,SHEBANG:ee,TITLE_MODE:Pe,UNDERSCORE_IDENT_RE:V,UNDERSCORE_TITLE_MODE:Ge});function Mt(K,ce){K.input[K.index-1]==="."&&ce.ignoreMatch()}function Pt(K,ce){K.className!==void 0&&(K.scope=K.className,delete K.className)}function Kt(K,ce){ce&&K.beginKeywords&&(K.begin="\\b("+K.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",K.__beforeBegin=Mt,K.keywords=K.keywords||K.beginKeywords,delete K.beginKeywords,K.relevance===void 0&&(K.relevance=0))}function yt(K,ce){Array.isArray(K.illegal)&&(K.illegal=S(...K.illegal))}function Ue(K,ce){if(K.match){if(K.begin||K.end)throw new Error("begin & end are not supported with match");K.begin=K.match,delete K.match}}function dt(K,ce){K.relevance===void 0&&(K.relevance=1)}const Nt=(K,ce)=>{if(!K.beforeMatch)return;if(K.starts)throw new Error("beforeMatch cannot be used with starts");const Te=Object.assign({},K);Object.keys(K).forEach(ze=>{delete K[ze]}),K.keywords=Te.keywords,K.begin=C(Te.beforeMatch,y(Te.begin)),K.starts={relevance:0,contains:[Object.assign(Te,{endsParent:!0})]},K.relevance=0,delete Te.beforeMatch},bt=["of","and","for","in","not","or","if","then","parent","list","value"],Lt="keyword";function ue(K,ce,Te=Lt){const ze=Object.create(null);return typeof K=="string"?rt(Te,K.split(" ")):Array.isArray(K)?rt(Te,K):Object.keys(K).forEach(function(vt){Object.assign(ze,ue(K[vt],ce,vt))}),ze;function rt(vt,Fe){ce&&(Fe=Fe.map(at=>at.toLowerCase())),Fe.forEach(function(at){const kt=at.split("|");ze[kt[0]]=[vt,tt(kt[0],kt[1])]})}}function tt(K,ce){return ce?Number(ce):st(K)?0:1}function st(K){return bt.includes(K.toLowerCase())}const ye={},je=K=>{console.error(K)},Ae=(K,...ce)=>{console.log(`WARN: ${K}`,...ce)},oe=(K,ce)=>{ye[`${K}/${ce}`]||(console.log(`Deprecated as of ${K}. ${ce}`),ye[`${K}/${ce}`]=!0)},H=new Error;function te(K,ce,{key:Te}){let ze=0;const rt=K[Te],vt={},Fe={};for(let at=1;at<=ce.length;at++)Fe[at+ze]=rt[at],vt[at+ze]=!0,ze+=E(ce[at-1]);K[Te]=Fe,K[Te]._emit=vt,K[Te]._multi=!0}function Ne(K){if(Array.isArray(K.begin)){if(K.skip||K.excludeBegin||K.returnBegin)throw je("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),H;if(typeof K.beginScope!="object"||K.beginScope===null)throw je("beginScope must be object"),H;te(K,K.begin,{key:"beginScope"}),K.begin=I(K.begin,{joinWith:""})}}function Re(K){if(Array.isArray(K.end)){if(K.skip||K.excludeEnd||K.returnEnd)throw je("skip, excludeEnd, returnEnd not compatible with endScope: {}"),H;if(typeof K.endScope!="object"||K.endScope===null)throw je("endScope must be object"),H;te(K,K.end,{key:"endScope"}),K.end=I(K.end,{joinWith:""})}}function $e(K){K.scope&&typeof K.scope=="object"&&K.scope!==null&&(K.beginScope=K.scope,delete K.scope)}function Q(K){$e(K),typeof K.beginScope=="string"&&(K.beginScope={_wrap:K.beginScope}),typeof K.endScope=="string"&&(K.endScope={_wrap:K.endScope}),Ne(K),Re(K)}function Z(K){function ce(Fe,at){return new RegExp(g(Fe),"m"+(K.case_insensitive?"i":"")+(K.unicodeRegex?"u":"")+(at?"g":""))}class Te{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(at,kt){kt.position=this.position++,this.matchIndexes[this.matchAt]=kt,this.regexes.push([kt,at]),this.matchAt+=E(at)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const at=this.regexes.map(kt=>kt[1]);this.matcherRe=ce(I(at,{joinWith:"|"}),!0),this.lastIndex=0}exec(at){this.matcherRe.lastIndex=this.lastIndex;const kt=this.matcherRe.exec(at);if(!kt)return null;const xn=kt.findIndex((Ea,Di)=>Di>0&&Ea!==void 0),wn=this.matchIndexes[xn];return kt.splice(0,xn),Object.assign(kt,wn)}}class ze{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(at){if(this.multiRegexes[at])return this.multiRegexes[at];const kt=new Te;return this.rules.slice(at).forEach(([xn,wn])=>kt.addRule(xn,wn)),kt.compile(),this.multiRegexes[at]=kt,kt}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(at,kt){this.rules.push([at,kt]),kt.type==="begin"&&this.count++}exec(at){const kt=this.getMatcher(this.regexIndex);kt.lastIndex=this.lastIndex;let xn=kt.exec(at);if(this.resumingScanAtSamePosition()&&!(xn&&xn.index===this.lastIndex)){const wn=this.getMatcher(0);wn.lastIndex=this.lastIndex+1,xn=wn.exec(at)}return xn&&(this.regexIndex+=xn.position+1,this.regexIndex===this.count&&this.considerAll()),xn}}function rt(Fe){const at=new ze;return Fe.contains.forEach(kt=>at.addRule(kt.begin,{rule:kt,type:"begin"})),Fe.terminatorEnd&&at.addRule(Fe.terminatorEnd,{type:"end"}),Fe.illegal&&at.addRule(Fe.illegal,{type:"illegal"}),at}function vt(Fe,at){const kt=Fe;if(Fe.isCompiled)return kt;[Pt,Ue,Q,Nt].forEach(wn=>wn(Fe,at)),K.compilerExtensions.forEach(wn=>wn(Fe,at)),Fe.__beforeBegin=null,[Kt,yt,dt].forEach(wn=>wn(Fe,at)),Fe.isCompiled=!0;let xn=null;return typeof Fe.keywords=="object"&&Fe.keywords.$pattern&&(Fe.keywords=Object.assign({},Fe.keywords),xn=Fe.keywords.$pattern,delete Fe.keywords.$pattern),xn=xn||/\w+/,Fe.keywords&&(Fe.keywords=ue(Fe.keywords,K.case_insensitive)),kt.keywordPatternRe=ce(xn,!0),at&&(Fe.begin||(Fe.begin=/\B|\b/),kt.beginRe=ce(kt.begin),!Fe.end&&!Fe.endsWithParent&&(Fe.end=/\B|\b/),Fe.end&&(kt.endRe=ce(kt.end)),kt.terminatorEnd=g(kt.end)||"",Fe.endsWithParent&&at.terminatorEnd&&(kt.terminatorEnd+=(Fe.end?"|":"")+at.terminatorEnd)),Fe.illegal&&(kt.illegalRe=ce(Fe.illegal)),Fe.contains||(Fe.contains=[]),Fe.contains=[].concat(...Fe.contains.map(function(wn){return Ke(wn==="self"?Fe:wn)})),Fe.contains.forEach(function(wn){vt(wn,kt)}),Fe.starts&&vt(Fe.starts,at),kt.matcher=rt(kt),kt}if(K.compilerExtensions||(K.compilerExtensions=[]),K.contains&&K.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return K.classNameAliases=r(K.classNameAliases||{}),vt(K)}function be(K){return K?K.endsWithParent||be(K.starts):!1}function Ke(K){return K.variants&&!K.cachedVariants&&(K.cachedVariants=K.variants.map(function(ce){return r(K,{variants:null},ce)})),K.cachedVariants?K.cachedVariants:be(K)?r(K,{starts:K.starts?r(K.starts):null}):Object.isFrozen(K)?r(K):K}var Ie="11.11.1";class Ye extends Error{constructor(ce,Te){super(ce),this.name="HTMLInjectionError",this.html=Te}}const M=n,le=r,Oe=Symbol("nomatch"),ge=7,Ve=function(K){const ce=Object.create(null),Te=Object.create(null),ze=[];let rt=!0;const vt="Could not find the language '{}', did you forget to load/include a language module?",Fe={disableAutodetect:!0,name:"Plain text",contains:[]};let at={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:h};function kt(We){return at.noHighlightRe.test(We)}function xn(We){let wt=We.className+" ";wt+=We.parentNode?We.parentNode.className:"";const Ht=at.languageDetectRe.exec(wt);if(Ht){const rn=ir(Ht[1]);return rn||(Ae(vt.replace("{}",Ht[1])),Ae("Falling back to no-highlight mode for this block.",We)),rn?Ht[1]:"no-highlight"}return wt.split(/\s+/).find(rn=>kt(rn)||ir(rn))}function wn(We,wt,Ht){let rn="",Rn="";typeof wt=="object"?(rn=We,Ht=wt.ignoreIllegals,Rn=wt.language):(oe("10.7.0","highlight(lang, code, ...args) has been deprecated."),oe("10.7.0",`Please use highlight(code, options) instead.
647
647
  https://github.com/highlightjs/highlight.js/issues/2277`),Rn=We,rn=wt),Ht===void 0&&(Ht=!0);const tr={code:rn,language:Rn};Ys("before:highlight",tr);const Mr=tr.result?tr.result:Ea(tr.language,tr.code,Ht);return Mr.code=tr.code,Ys("after:highlight",Mr),Mr}function Ea(We,wt,Ht,rn){const Rn=Object.create(null);function tr(nt,ht){return nt.keywords[ht]}function Mr(){if(!Et.keywords){In.addText(an);return}let nt=0;Et.keywordPatternRe.lastIndex=0;let ht=Et.keywordPatternRe.exec(an),Dt="";for(;ht;){Dt+=an.substring(nt,ht.index);const Wt=Yn.case_insensitive?ht[0].toLowerCase():ht[0],Cn=tr(Et,Wt);if(Cn){const[Wr,nl]=Cn;if(In.addText(Dt),Dt="",Rn[Wt]=(Rn[Wt]||0)+1,Rn[Wt]<=ge&&(ls+=nl),Wr.startsWith("_"))Dt+=ht[0];else{const Hc=Yn.classNameAliases[Wr]||Wr;Rr(ht[0],Hc)}}else Dt+=ht[0];nt=Et.keywordPatternRe.lastIndex,ht=Et.keywordPatternRe.exec(an)}Dt+=an.substring(nt),In.addText(Dt)}function gr(){if(an==="")return;let nt=null;if(typeof Et.subLanguage=="string"){if(!ce[Et.subLanguage]){In.addText(an);return}nt=Ea(Et.subLanguage,an,!0,$c[Et.subLanguage]),$c[Et.subLanguage]=nt._top}else nt=Ii(an,Et.subLanguage.length?Et.subLanguage:null);Et.relevance>0&&(ls+=nt.relevance),In.__addSublanguage(nt._emitter,nt.language)}function hn(){Et.subLanguage!=null?gr():Mr(),an=""}function Rr(nt,ht){nt!==""&&(In.startScope(ht),In.addText(nt),In.endScope())}function zc(nt,ht){let Dt=1;const Wt=ht.length-1;for(;Dt<=Wt;){if(!nt._emit[Dt]){Dt++;continue}const Cn=Yn.classNameAliases[nt[Dt]]||nt[Dt],Wr=ht[Dt];Cn?Rr(Wr,Cn):(an=Wr,Mr(),an=""),Dt++}}function zi(nt,ht){return nt.scope&&typeof nt.scope=="string"&&In.openNode(Yn.classNameAliases[nt.scope]||nt.scope),nt.beginScope&&(nt.beginScope._wrap?(Rr(an,Yn.classNameAliases[nt.beginScope._wrap]||nt.beginScope._wrap),an=""):nt.beginScope._multi&&(zc(nt.beginScope,ht),an="")),Et=Object.create(nt,{parent:{value:Et}}),Et}function Jo(nt,ht,Dt){let Wt=j(nt.endRe,Dt);if(Wt){if(nt["on:end"]){const Cn=new t(nt);nt["on:end"](ht,Cn),Cn.isMatchIgnored&&(Wt=!1)}if(Wt){for(;nt.endsParent&&nt.parent;)nt=nt.parent;return nt}}if(nt.endsWithParent)return Jo(nt.parent,ht,Dt)}function Bi(nt){return Et.matcher.regexIndex===0?(an+=nt[0],1):(cs=!0,0)}function X0(nt){const ht=nt[0],Dt=nt.rule,Wt=new t(Dt),Cn=[Dt.__beforeBegin,Dt["on:begin"]];for(const Wr of Cn)if(Wr&&(Wr(nt,Wt),Wt.isMatchIgnored))return Bi(ht);return Dt.skip?an+=ht:(Dt.excludeBegin&&(an+=ht),hn(),!Dt.returnBegin&&!Dt.excludeBegin&&(an=ht)),zi(Dt,nt),Dt.returnBegin?0:ht.length}function br(nt){const ht=nt[0],Dt=wt.substring(nt.index),Wt=Jo(Et,nt,Dt);if(!Wt)return Oe;const Cn=Et;Et.endScope&&Et.endScope._wrap?(hn(),Rr(ht,Et.endScope._wrap)):Et.endScope&&Et.endScope._multi?(hn(),zc(Et.endScope,nt)):Cn.skip?an+=ht:(Cn.returnEnd||Cn.excludeEnd||(an+=ht),hn(),Cn.excludeEnd&&(an=ht));do Et.scope&&In.closeNode(),!Et.skip&&!Et.subLanguage&&(ls+=Et.relevance),Et=Et.parent;while(Et!==Wt.parent);return Wt.starts&&zi(Wt.starts,nt),Cn.returnEnd?0:ht.length}function el(){const nt=[];for(let ht=Et;ht!==Yn;ht=ht.parent)ht.scope&&nt.unshift(ht.scope);nt.forEach(ht=>In.openNode(ht))}let Xs={};function $i(nt,ht){const Dt=ht&&ht[0];if(an+=nt,Dt==null)return hn(),0;if(Xs.type==="begin"&&ht.type==="end"&&Xs.index===ht.index&&Dt===""){if(an+=wt.slice(ht.index,ht.index+1),!rt){const Wt=new Error(`0 width match regex (${We})`);throw Wt.languageName=We,Wt.badRule=Xs.rule,Wt}return 1}if(Xs=ht,ht.type==="begin")return X0(ht);if(ht.type==="illegal"&&!Ht){const Wt=new Error('Illegal lexeme "'+Dt+'" for mode "'+(Et.scope||"<unnamed>")+'"');throw Wt.mode=Et,Wt}else if(ht.type==="end"){const Wt=br(ht);if(Wt!==Oe)return Wt}if(ht.type==="illegal"&&Dt==="")return an+=`
648
- `,1;if(tl>1e5&&tl>ht.index*3)throw new Error("potential infinite loop, way more iterations than matches");return an+=Dt,Dt.length}const Yn=ir(We);if(!Yn)throw je(vt.replace("{}",We)),new Error('Unknown language: "'+We+'"');const Bc=Z(Yn);let Hi="",Et=rn||Bc;const $c={},In=new at.__emitter(at);el();let an="",ls=0,Ma=0,tl=0,cs=!1;try{if(Yn.__emitTokens)Yn.__emitTokens(wt,In);else{for(Et.matcher.considerAll();;){tl++,cs?cs=!1:Et.matcher.considerAll(),Et.matcher.lastIndex=Ma;const nt=Et.matcher.exec(wt);if(!nt)break;const ht=wt.substring(Ma,nt.index),Dt=$i(ht,nt);Ma=nt.index+Dt}$i(wt.substring(Ma))}return In.finalize(),Hi=In.toHTML(),{language:We,value:Hi,relevance:ls,illegal:!1,_emitter:In,_top:Et}}catch(nt){if(nt.message&&nt.message.includes("Illegal"))return{language:We,value:M(wt),illegal:!0,relevance:0,_illegalBy:{message:nt.message,index:Ma,context:wt.slice(Ma-100,Ma+100),mode:nt.mode,resultSoFar:Hi},_emitter:In};if(rt)return{language:We,value:M(wt),illegal:!1,relevance:0,errorRaised:nt,_emitter:In,_top:Et};throw nt}}function Di(We){const wt={value:M(We),illegal:!1,relevance:0,_top:Fe,_emitter:new at.__emitter(at)};return wt._emitter.addText(We),wt}function Ii(We,wt){wt=wt||at.languages||Object.keys(ce);const Ht=Di(We),rn=wt.filter(ir).filter(is).map(hn=>Ea(hn,We,!1));rn.unshift(Ht);const Rn=rn.sort((hn,Rr)=>{if(hn.relevance!==Rr.relevance)return Rr.relevance-hn.relevance;if(hn.language&&Rr.language){if(ir(hn.language).supersetOf===Rr.language)return 1;if(ir(Rr.language).supersetOf===hn.language)return-1}return 0}),[tr,Mr]=Rn,gr=tr;return gr.secondBest=Mr,gr}function ma(We,wt,Ht){const rn=wt&&Te[wt]||Ht;We.classList.add("hljs"),We.classList.add(`language-${rn}`)}function Mn(We){let wt=null;const Ht=xn(We);if(kt(Ht))return;if(Ys("before:highlightElement",{el:We,language:Ht}),We.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",We);return}if(We.children.length>0&&(at.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(We)),at.throwUnescapedHTML))throw new Ye("One of your code blocks includes unescaped HTML.",We.innerHTML);wt=We;const rn=wt.textContent,Rn=Ht?wn(rn,{language:Ht,ignoreIllegals:!0}):Ii(rn);We.innerHTML=Rn.value,We.dataset.highlighted="yes",ma(We,Ht,Rn.language),We.result={language:Rn.language,re:Rn.relevance,relevance:Rn.relevance},Rn.secondBest&&(We.secondBest={language:Rn.secondBest.language,relevance:Rn.secondBest.relevance}),Ys("after:highlightElement",{el:We,result:Rn,text:rn})}function er(We){at=le(at,We)}const ss=()=>{Pi(),oe("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Qo(){Pi(),oe("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Dc=!1;function Pi(){function We(){Pi()}if(document.readyState==="loading"){Dc||window.addEventListener("DOMContentLoaded",We,!1),Dc=!0;return}document.querySelectorAll(at.cssSelector).forEach(Mn)}function Ic(We,wt){let Ht=null;try{Ht=wt(K)}catch(rn){if(je("Language definition for '{}' could not be registered.".replace("{}",We)),rt)je(rn);else throw rn;Ht=Fe}Ht.name||(Ht.name=We),ce[We]=Ht,Ht.rawDefinition=wt.bind(null,K),Ht.aliases&&_a(Ht.aliases,{languageName:We})}function Ws(We){delete ce[We];for(const wt of Object.keys(Te))Te[wt]===We&&delete Te[wt]}function Zo(){return Object.keys(ce)}function ir(We){return We=(We||"").toLowerCase(),ce[We]||ce[Te[We]]}function _a(We,{languageName:wt}){typeof We=="string"&&(We=[We]),We.forEach(Ht=>{Te[Ht.toLowerCase()]=wt})}function is(We){const wt=ir(We);return wt&&!wt.disableAutodetect}function os(We){We["before:highlightBlock"]&&!We["before:highlightElement"]&&(We["before:highlightElement"]=wt=>{We["before:highlightBlock"](Object.assign({block:wt.el},wt))}),We["after:highlightBlock"]&&!We["after:highlightElement"]&&(We["after:highlightElement"]=wt=>{We["after:highlightBlock"](Object.assign({block:wt.el},wt))})}function Dn(We){os(We),ze.push(We)}function Pc(We){const wt=ze.indexOf(We);wt!==-1&&ze.splice(wt,1)}function Ys(We,wt){const Ht=We;ze.forEach(function(rn){rn[Ht]&&rn[Ht](wt)})}function ja(We){return oe("10.7.0","highlightBlock will be removed entirely in v12.0"),oe("10.7.0","Please use highlightElement now."),Mn(We)}Object.assign(K,{highlight:wn,highlightAuto:Ii,highlightAll:Pi,highlightElement:Mn,highlightBlock:ja,configure:er,initHighlighting:ss,initHighlightingOnLoad:Qo,registerLanguage:Ic,unregisterLanguage:Ws,listLanguages:Zo,getLanguage:ir,registerAliases:_a,autoDetection:is,inherit:le,addPlugin:Dn,removePlugin:Pc}),K.debugMode=function(){rt=!1},K.safeMode=function(){rt=!0},K.versionString=Ie,K.regex={concat:C,lookahead:y,either:S,optional:w,anyNumberOfTimes:x};for(const We in Ct)typeof Ct[We]=="object"&&e(Ct[We]);return Object.assign(K,Ct),K},Qe=Ve({});return Qe.newInstance=()=>Ve({}),Xp=Qe,Qe.HighlightJS=Qe,Qe.default=Qe,Xp}var WG=KG();const YG=Tc(WG),Z2={},XG="hljs-";function QG(e){const t=YG.newInstance();return e&&l(e),{highlight:n,highlightAuto:r,listLanguages:o,register:l,registerAlias:c,registered:d};function n(m,f,h){const g=h||Z2,y=typeof g.prefix=="string"?g.prefix:XG;if(!t.getLanguage(m))throw new Error("Unknown language: `"+m+"` is not registered");t.configure({__emitter:ZG,classPrefix:y});const x=t.highlight(f,{ignoreIllegals:!0,language:m});if(x.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:x.errorRaised});const w=x._emitter.root,C=w.data;return C.language=x.language,C.relevance=x.relevance,w}function r(m,f){const g=(f||Z2).subset||o();let y=-1,x=0,w;for(;++y<g.length;){const C=g[y];if(!t.getLanguage(C))continue;const T=n(C,m,f);T.data&&T.data.relevance!==void 0&&T.data.relevance>x&&(x=T.data.relevance,w=T)}return w||{type:"root",children:[],data:{language:void 0,relevance:x}}}function o(){return t.listLanguages()}function l(m,f){if(typeof m=="string")t.registerLanguage(m,f);else{let h;for(h in m)Object.hasOwn(m,h)&&t.registerLanguage(h,m[h])}}function c(m,f){if(typeof m=="string")t.registerAliases(typeof f=="string"?f:[...f],{languageName:m});else{let h;for(h in m)if(Object.hasOwn(m,h)){const g=m[h];t.registerAliases(typeof g=="string"?g:[...g],{languageName:h})}}}function d(m){return!!t.getLanguage(m)}}class ZG{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const r=this.stack[this.stack.length-1],o=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:o}):r.children.push(...o)}openNode(t){const n=this,r=t.split(".").map(function(c,d){return d?c+"_".repeat(d):n.options.classPrefix+c}),o=this.stack[this.stack.length-1],l={type:"element",tagName:"span",properties:{className:r},children:[]};o.children.push(l),this.stack.push(l)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const JG={};function v3(e){const t=e||JG,n=t.aliases,r=t.detect||!1,o=t.languages||VG,l=t.plainText,c=t.prefix,d=t.subset;let m="hljs";const f=QG(o);if(n&&f.registerAlias(n),c){const h=c.indexOf("-");m=h===-1?c:c.slice(0,h)}return function(h,g){D0(h,"element",function(y,x,w){if(y.tagName!=="code"||!w||w.type!=="element"||w.tagName!=="pre")return;const C=eV(y);if(C===!1||!C&&!r||C&&l&&l.includes(C))return;Array.isArray(y.properties.className)||(y.properties.className=[]),y.properties.className.includes(m)||y.properties.className.unshift(m);const T=Zk(y,{whitespace:"pre"});let S;try{S=C?f.highlight(C,T,{prefix:c}):f.highlightAuto(T,{prefix:c,subset:d})}catch(E){const j=E;if(C&&/Unknown language/.test(j.message)){g.message("Cannot highlight as `"+C+"`, it’s not registered",{ancestors:[w,y],cause:j,place:y.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw j}!C&&S.data&&S.data.language&&y.properties.className.push("language-"+S.data.language),S.children.length>0&&(y.children=S.children)})}}function eV(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let r;for(;++n<t.length;){const o=String(t[n]);if(o==="no-highlight"||o==="nohighlight")return!1;!r&&o.slice(0,5)==="lang-"&&(r=o.slice(5)),!r&&o.slice(0,9)==="language-"&&(r=o.slice(9))}return r}const Vg=new Set;function wi(e){e&&Vg.add(e)}function Vh(e){e&&Vg.delete(e)}const w3="markus_right_panel_v1",tV=10,Kh=new Map;function nV(e,t=3e3){Kh.set(e,Date.now()+t)}function rV(e){const t=Kh.get(e);return t==null?!1:Date.now()>t?(Kh.delete(e),!1):!0}function aV(e){return e.kind==="terminal"}function Zl(e){if(e.kind==="file")return`file:${e.path}`;if(e.kind==="url")return`url:${e.browserId||e.url}`;if(e.kind==="terminal")return`terminal:${e.terminalId}`;const t=e.deliverable;return`deliverable:${t.id||`${t.reference||""}|${t.title||""}|${t.summary?.slice(0,48)||""}`||"unknown"}`}function J2(e){return e.kind==="deliverable"?e.deliverable.title||e.deliverable.reference||"Deliverable":e.kind==="url"?e.title||e.url:e.kind==="terminal"?e.title||"Terminal":e.title||e.path.split(/[/\\]/).pop()||e.path}function Is(){return`tab_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function wd(e){let t=e;for(;t.length>tV;){let n=-1;for(let o=t.length-1;o>=0;o--)if(!t[o].pinned){n=o;break}if(n<0)break;const r=t[n];r&&(Wh(r.payload),Yh(r.payload)),t=t.filter((o,l)=>l!==n)}return t}function Wh(e){e?.kind==="url"&&e.browserId&&(nV(e.browserId),window.markusDesktop?.browser?.destroy(e.browserId))}function Yh(e){e?.kind==="terminal"&&e.terminalId&&(Vh(e.terminalId),window.markusDesktop?.terminal?.destroy(e.terminalId))}function sV(e){const t=e.payload;return t.kind==="terminal"?null:t.kind==="url"?gc(t.url||"")||gc(t.title||"")?null:{id:e.id,title:e.title,pinned:e.pinned,payload:{kind:"url",url:t.url||"about:blank",title:t.title||e.title}}:t.kind==="file"?{id:e.id,title:e.title,pinned:e.pinned,payload:{kind:"file",path:t.path,title:t.title}}:{id:e.id,title:e.title,pinned:e.pinned,payload:{kind:"deliverable",deliverable:t.deliverable}}}function iV(e,t=0){if(e.payload.kind==="url"){const n=`eb_${Date.now().toString(36)}_${t.toString(36)}_${Math.random().toString(36).slice(2,7)}`;return{...e,payload:{kind:"url",url:e.payload.url||"about:blank",title:e.payload.title||e.title,browserId:n}}}return e}function oV(){try{const e=localStorage.getItem(w3);if(!e)return null;const t=JSON.parse(e);return!t||t.mode!=="browser"&&t.mode!=="terminal"||!Array.isArray(t.browserTabs)?null:t}catch{return null}}function lV(){const e={mode:"browser",browserTabs:[],browserActiveId:null,terminalTabs:[],terminalActiveId:null,stashedBrowserTabs:[],stashedBrowserActiveId:null,stashedTerminalTabs:[],stashedTerminalActiveId:null},t=oV();if(!t)return e;const n=t.browserTabs.map((x,w)=>{try{return iV(x,w)}catch{return null}}).filter(x=>!(!x||x.payload.kind==="terminal"||x.payload.kind==="url"&&gc(x.payload.url||""))),r=n.some(x=>x.id===t.browserActiveId)?t.browserActiveId:n[0]?.id??null,o=(t.terminalTabs||[]).map((x,w)=>{const C=`term_${Date.now().toString(36)}_${w.toString(36)}_${Math.random().toString(36).slice(2,7)}`;return wi(C),{id:x.id||Is(),title:x.title||"Terminal",payload:{kind:"terminal",terminalId:C,title:x.title||"Terminal",cwd:x.cwd}}}),l=o.some(x=>x.id===t.terminalActiveId)?t.terminalActiveId:o[0]?.id??null,c=!!t.browserCollapsed&&n.length>0,d=!!t.terminalCollapsed&&o.length>0,m=c?[]:n,f=c?null:r,h=d?[]:o,g=d?null:l;let y=t.mode;return y==="terminal"&&h.length===0&&!d&&(y="browser"),y==="browser"&&m.length===0&&h.length>0&&(y="terminal"),{mode:y,browserTabs:m,browserActiveId:f,terminalTabs:h,terminalActiveId:g,stashedBrowserTabs:n,stashedBrowserActiveId:r,stashedTerminalTabs:o,stashedTerminalActiveId:l}}const k3=k.createContext(null);function cV({children:e}){const[t,n]=k.useState(()=>{try{return localStorage.getItem("markus_sidebar_c")==="1"}catch{return!1}}),r=k.useMemo(()=>lV(),[]),[o,l]=k.useState(r.mode),[c,d]=k.useState(r.browserTabs),[m,f]=k.useState(r.terminalTabs),[h,g]=k.useState(r.browserActiveId),[y,x]=k.useState(r.terminalActiveId),[w,C]=k.useState(!1),[T,S]=k.useState(!1),[E,j]=k.useState("l0"),[L,I]=k.useState(null),O=k.useCallback(ye=>j(ye),[]),F=k.useCallback(ye=>I(ye),[]);k.useEffect(()=>{const ye=Ae=>{if(!(Ae instanceof HTMLElement))return!1;const oe=Ae.tagName;return oe==="INPUT"||oe==="TEXTAREA"||oe==="SELECT"?!0:Ae.isContentEditable},je=Ae=>{if(!(Ae.target instanceof Element))return;const oe=document.activeElement;if(ye(oe)){const Ne=oe===Ae.target||oe.contains(Ae.target),Re=!!Ae.target.closest("[data-keep-edit-focus]"),$e=ye(Ae.target)||!!Ae.target.closest('input, textarea, select, [contenteditable="true"]'),Q=!!Ae.target.closest(".xterm");!Ne&&!Re&&!$e&&!Q&&oe.blur()}const H=Ae.target.closest("[data-keyboard-pane]");if(!H)return;const te=H.getAttribute("data-keyboard-pane");if(!(te!=="l0"&&te!=="l1"&&te!=="l2"&&te!=="content")&&(j(te),te==="l0")){const Re=Ae.target.closest("[data-l0-page-id]")?.getAttribute("data-l0-page-id");Re&&I(Re)}};return document.addEventListener("pointerdown",je,!0),()=>document.removeEventListener("pointerdown",je,!0)},[]);const V=k.useRef(r.stashedBrowserTabs.length>0?r.stashedBrowserTabs:r.browserTabs),X=k.useRef(r.stashedBrowserActiveId??r.browserActiveId),z=k.useRef(r.stashedTerminalTabs.length>0?r.stashedTerminalTabs:r.terminalTabs),G=k.useRef(r.stashedTerminalActiveId??r.terminalActiveId),se=k.useRef(r.browserActiveId),ee=k.useRef(r.terminalActiveId),q=k.useRef(r.browserTabs),re=k.useRef(r.terminalTabs),B=k.useRef(r.mode);se.current=h,ee.current=y,q.current=c,re.current=m,B.current=o,k.useEffect(()=>{(r.mode==="terminal"||r.browserTabs.length===0)&&window.markusDesktop?.browser?.hideAll?.()},[]),k.useEffect(()=>{const ye=c.length===0&&V.current.length>0,je=m.length===0&&z.current.length>0,Ae=ye?V.current:c,oe=je?z.current:m,H=Ae.map(sV).filter(Re=>!!Re),te=oe.filter(Re=>Re.payload.kind==="terminal").map(Re=>({id:Re.id,title:Re.title,cwd:Re.payload.kind==="terminal"?Re.payload.cwd:void 0})),Ne={mode:o,browserTabs:H,browserActiveId:ye?X.current:h,terminalTabs:te,terminalActiveId:je?G.current:y,browserCollapsed:ye,terminalCollapsed:je};try{localStorage.setItem(w3,JSON.stringify(Ne))}catch{}},[o,c,h,m,y]);const J=k.useCallback(ye=>n(ye),[]),fe=k.useCallback(()=>n(ye=>!ye),[]),Se=k.useCallback(()=>{window.markusDesktop?.browser?.hideAll?.()},[]),U=k.useCallback(ye=>{l(je=>je===ye?je:(ye==="terminal"&&Se(),ye))},[Se]),W=k.useCallback(ye=>{if(ye==="terminal"){if(Se(),l("terminal"),n(!0),m.length>0)return;if(z.current.length>0){const Re=z.current,$e=G.current&&Re.some(Q=>Q.id===G.current)?G.current:Re[0].id;f(Re),x($e),G.current=$e;return}const H=Is(),te=`term_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`;wi(te);const Ne={id:H,title:"Terminal",payload:{kind:"terminal",terminalId:te,title:"Terminal"}};z.current=[Ne],f([Ne]),x(Ne.id),G.current=Ne.id;return}if(l("browser"),n(!0),c.length>0)return;if(V.current.length>0){const H=V.current,te=X.current&&H.some(Ne=>Ne.id===X.current)?X.current:H[0].id;d(H),g(te),X.current=te;return}const je=Is(),Ae=`eb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`,oe={id:je,title:"New Tab",payload:{kind:"url",url:"about:blank",title:"New Tab",browserId:Ae}};V.current=[oe],d([oe]),g(oe.id),X.current=oe.id},[c.length,m.length,Se]),pe=k.useCallback(ye=>{const je=Zl(ye),Ae=Is();if(aV(ye)){ye.kind==="terminal"&&wi(ye.terminalId),l("terminal"),Se();const H=re.current,te=H.find($e=>Zl($e.payload)===je)??z.current.find($e=>Zl($e.payload)===je);let Ne,Re;if(te)Re=te.id,Ne=H.some($e=>$e.id===te.id)?H:wd([te,...H]);else{const $e={id:Ae,title:J2(ye),payload:ye};Ne=wd([$e,...H]),Re=Ae}z.current=Ne,re.current=Ne,f(Ne),x(Re),G.current=Re,ee.current=Re}else{l("browser");const H=q.current,te=H.find($e=>Zl($e.payload)===je)??V.current.find($e=>Zl($e.payload)===je);let Ne,Re;if(te)Re=te.id,Ne=H.some($e=>$e.id===te.id)?H:wd([te,...H]);else{const $e={id:Ae,title:J2(ye),payload:ye};Ne=wd([$e,...H]),Re=Ae}V.current=Ne,q.current=Ne,d(Ne),g(Re),X.current=Re,se.current=Re}n(!0)},[Se]),P=k.useCallback(ye=>{const je=q.current,Ae=je.findIndex(Z=>Z.id===ye);if(Ae>=0){const Z=je[Ae]?.payload,be=je.filter(M=>M.id!==ye),Ke=se.current,Ye=(je.some(M=>M.id===Ke)?Ke:je[0]?.id??null)===ye||be.length===0?be[Math.min(Ae,be.length-1)]?.id??null:void 0;V.current=be,q.current=be,d(be),be.length===0&&B.current==="browser"&&C(!1),Ye!==void 0&&(g(Ye),X.current=Ye,se.current=Ye),Wh(Z);return}const oe=re.current,H=oe.findIndex(Z=>Z.id===ye);if(H<0)return;const te=oe[H]?.payload,Ne=oe.filter(Z=>Z.id!==ye),Re=ee.current,Q=(oe.some(Z=>Z.id===Re)?Re:oe[0]?.id??null)===ye||Ne.length===0?Ne[Math.min(H,Ne.length-1)]?.id??null:void 0;z.current=Ne,re.current=Ne,f(Ne),Ne.length===0&&B.current==="terminal"&&C(!1),Q!==void 0&&(x(Q),G.current=Q,ee.current=Q),Yh(te)},[]),_e=k.useCallback(()=>{const ye=q.current.map(Ae=>Ae.payload),je=re.current.map(Ae=>Ae.payload);q.current=[],re.current=[],V.current=[],X.current=null,z.current=[],G.current=null,se.current=null,ee.current=null,d([]),f([]),g(null),x(null),C(!1);for(const Ae of ye)Wh(Ae);for(const Ae of je)Yh(Ae)},[]),He=k.useCallback(ye=>{B.current==="terminal"?(x(ye),G.current=ye):(g(ye),X.current=ye)},[]),Pe=k.useCallback((ye,je)=>{d(Ae=>{let oe=!1;const H=Ae.map(te=>{if(te.payload.kind!=="url"||te.payload.browserId!==ye)return te;const Ne=je.url??te.payload.url,Re=je.title||te.payload.title||Ne,$e=je.pageId??te.payload.pageId;return Ne===te.payload.url&&Re===(te.payload.title||te.title)&&$e===te.payload.pageId&&Re===te.title?te:(oe=!0,{...te,title:Re,payload:{...te.payload,url:Ne,title:Re,...$e!=null?{pageId:$e}:{}}})});return oe&&(V.current=H),oe?H:Ae})},[]),Ge=k.useCallback((ye,je)=>{f(Ae=>{let oe=!1;const H=Ae.map(te=>{if(te.payload.kind!=="terminal"||te.payload.terminalId!==ye)return te;const Ne=je.title||te.payload.title||te.title,Re=je.cwd??te.payload.cwd;return Ne===te.title&&Re===te.payload.cwd&&Ne===(te.payload.title||te.title)?te:(oe=!0,{...te,title:Ne,payload:{...te.payload,title:Ne,...Re!=null?{cwd:Re}:{}}})});return oe&&(z.current=H),oe?H:Ae})},[]),ct=k.useCallback(()=>{B.current==="terminal"?(f(ye=>ye.length===0?ye:(z.current=ye,ee.current&&(G.current=ee.current),[])),x(null)):(d(ye=>ye.length===0?ye:(V.current=ye,se.current&&(X.current=se.current),[])),g(null),Se()),C(!1)},[Se]),mt=k.useCallback(()=>{if(B.current==="terminal"&&m.length>0){if(l("browser"),c.length>0){n(!0);return}if(V.current.length>0){const $e=V.current,Q=X.current&&$e.some(Z=>Z.id===X.current)?X.current:$e[0].id;d($e),g(Q),X.current=Q,n(!0);return}const te=Is(),Ne=`eb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`,Re={id:te,title:"New Tab",payload:{kind:"url",url:"about:blank",title:"New Tab",browserId:Ne}};V.current=[Re],d([Re]),g(Re.id),X.current=Re.id,n(!0);return}const ye=Is(),je=`eb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`;let Ae,oe=!1,H=!1;l("browser"),d(te=>{if(te.length>0)return V.current=te,se.current&&(X.current=se.current),H=!0,Ae=null,[];if(V.current.length>0){oe=!0;const Re=V.current;return Ae=X.current&&Re.some(Q=>Q.id===X.current)?X.current:Re[0].id,Re}oe=!0;const Ne={id:ye,title:"New Tab",payload:{kind:"url",url:"about:blank",title:"New Tab",browserId:je}};return V.current=[Ne],Ae=Ne.id,[Ne]}),oe&&n(!0),H?(g(null),C(!1),Se()):Ae!=null&&(g(Ae),X.current=Ae)},[c.length,m.length,Se]),Ct=k.useCallback(()=>{if(B.current==="browser"&&c.length>0){if(l("terminal"),Se(),m.length>0){n(!0);return}if(z.current.length>0){const $e=z.current,Q=G.current&&$e.some(Z=>Z.id===G.current)?G.current:$e[0].id;f($e),x(Q),G.current=Q,n(!0);return}const te=Is(),Ne=`term_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`;wi(Ne);const Re={id:te,title:"Terminal",payload:{kind:"terminal",terminalId:Ne,title:"Terminal"}};z.current=[Re],f([Re]),x(Re.id),G.current=Re.id,n(!0);return}const ye=Is(),je=`term_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`;wi(je);let Ae,oe=!1,H=!1;l("terminal"),Se(),f(te=>{if(te.length>0)return z.current=te,ee.current&&(G.current=ee.current),H=!0,Ae=null,[];if(z.current.length>0){oe=!0;const Re=z.current;return Ae=G.current&&Re.some(Q=>Q.id===G.current)?G.current:Re[0].id,Re}oe=!0;const Ne={id:ye,title:"Terminal",payload:{kind:"terminal",terminalId:je,title:"Terminal"}};return z.current=[Ne],Ae=Ne.id,[Ne]}),oe&&n(!0),H?(x(null),C(!1)):Ae!=null&&(x(Ae),G.current=Ae)},[c.length,m.length,Se]),Mt=k.useCallback(ye=>{const je=B.current==="terminal"?m:c;if(je.length<2)return;const Ae=B.current==="terminal"?ee.current:se.current,H=(Math.max(0,je.findIndex(Ne=>Ne.id===Ae))+ye+je.length)%je.length,te=je[H].id;B.current==="terminal"?(x(te),G.current=te):(g(te),X.current=te)},[c,m]),Pt=k.useCallback(ye=>{const Ae=(B.current==="terminal"?m:c)[ye];Ae&&(B.current==="terminal"?(x(Ae.id),G.current=Ae.id):(g(Ae.id),X.current=Ae.id))},[c,m]),Kt=k.useCallback(()=>{if(B.current==="terminal"){const je=`term_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`;pe({kind:"terminal",terminalId:je,title:"Terminal"});return}const ye=`eb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`;pe({kind:"url",url:"about:blank",title:"New Tab",browserId:ye})},[pe]),yt=k.useCallback(ye=>{const je=re.current,Ae=je.findIndex($e=>$e.payload.kind==="terminal"&&$e.payload.terminalId===ye);if(Ae<0){Vh(ye),window.markusDesktop?.terminal?.destroy(ye);return}const oe=je[Ae];if(je.length>1){P(oe.id);return}Vh(ye),window.markusDesktop?.terminal?.destroy(ye);const H=`term_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`;wi(H);const te=oe.payload.kind==="terminal"&&(oe.payload.title||oe.title)||"Terminal",Ne=oe.payload.kind==="terminal"?oe.payload.cwd:void 0,Re={id:oe.id,title:te,payload:{kind:"terminal",terminalId:H,title:te,cwd:Ne}};z.current=[Re],f([Re]),x(Re.id),G.current=Re.id,B.current!=="terminal"&&l("terminal")},[P]),Ue=k.useCallback(ye=>C(ye),[]),dt=k.useCallback(()=>C(ye=>!ye),[]),Nt=o==="terminal"?m:c,bt=o==="terminal"?y:h,Lt=Nt.find(ye=>ye.id===bt)??Nt[0]??null,ue=Lt?.payload??null,tt=Nt.length>0,st=k.useMemo(()=>({leftCollapsed:t,setLeftCollapsed:J,toggleLeftCollapsed:fe,keyboardPane:E,setKeyboardPane:O,l0FocusPageId:L,setL0FocusPageId:F,rightPanelMode:o,setRightPanelMode:U,switchRightPanelMode:W,rightPanel:ue,rightPanelOpen:tt,rightPanelTabs:Nt,activeRightPanelTabId:Lt?.id??null,openRightPanel:pe,closeRightPanel:_e,closeRightPanelTab:P,setActiveRightPanelTab:He,updateRightPanelBrowserTab:Pe,updateRightPanelTerminalTab:Ge,toggleRightPanel:mt,toggleTerminalPanel:Ct,collapseRightPanelOnly:ct,cycleRightPanelTab:Mt,activateRightPanelTabAt:Pt,openNewRightPanelTab:Kt,handleTerminalExit:yt,rightPanelFullscreen:w,setRightPanelFullscreen:Ue,toggleRightPanelFullscreen:dt,hostAvailable:T,setHostAvailable:S}),[t,J,fe,E,O,L,F,o,U,W,ue,tt,Nt,Lt,pe,_e,P,He,Pe,Ge,mt,Ct,ct,Mt,Pt,Kt,yt,w,Ue,dt,T]);return s.jsx(k3.Provider,{value:st,children:e})}function Lc(){return k.useContext(k3)}function Jl(e,t){const n=/```[\s\S]*?```|`[^`\n]+`/g;let r=0,o="";for(const l of e.matchAll(n))o+=t(e.slice(r,l.index)),o+=l[0],r=l.index+l[0].length;return o+=t(e.slice(r)),o}function uV(e){let t=e.replace(/\\\[([\s\S]*?)\\\]/g,(n,r)=>`$$${r}$$`);return t=t.replace(/\\\((.+?)\\\)/g,(n,r)=>`$${r}$`),t}const kd="#mention:";function dV(e,t){if(!t||t.length===0)return e.replace(/@\[([^\]]+)\]|@([\w\p{L}\p{N}]+)/gu,(l,c,d)=>{const m=c??d;return`[@${m}](${kd}${encodeURIComponent(m)})`});const n=[...t].sort((l,c)=>c.length-l.length);let r="",o=0;for(;o<e.length;){const l=e.indexOf("@",o);if(l<0){r+=e.slice(o);break}if(r+=e.slice(o,l),e[l+1]==="["){const h=e.indexOf("]",l+2);if(h>l+2){const g=e.slice(l+2,h);r+=`[@${g}](${kd}${encodeURIComponent(g)})`,o=h+1;continue}}const c=e.slice(l+1),d=c.toLowerCase(),m=n.find(h=>d.startsWith(h.toLowerCase()));if(m){const h=c.slice(0,m.length);r+=`[@${h}](${kd}${encodeURIComponent(h)})`,o=l+1+m.length;continue}const f=c.match(/^([\w\p{L}\p{N}]+)/u);if(f){const h=f[1];r+=`[@${h}](${kd}${encodeURIComponent(h)})`,o=l+1+h.length;continue}r+="@",o=l+1}return r}const S3="#entity:",mV=new RegExp("(?<!\\[)(?<!\\()(?<!:)(?<!\\/)(?<!\\\\)\\b(tsk|req|proj|dlv|agt|team)_[a-f0-9]{6,}\\b(?!\\]\\(#entity:)","gi"),fV=/`\[([^\]]+)\]\(#entity:((?:tsk|req|proj|dlv|agt|team)_[a-f0-9]{6,})\)`/gi;function pV(e,t){const n=e.slice(0,t),r=n.lastIndexOf("](");return r===-1?!1:n.indexOf(")",r+2)===-1}function hV(e){return e.replace(fV,(t,n,r)=>`[${n}](${S3}${r})`)}function gV(e){return e.replace(mV,(t,n,r)=>pV(e,r)?t:`[${t}](${S3}${t})`)}function bV(e){const t=e.trim();return t.startsWith("@startuml")&&t.endsWith("@enduml")}const xV=/^(graph\s|flowchart\s|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt|pie|gitGraph|mindmap|timeline|journey)/m;function yV(e){return xV.test(e.trim())}const vV={js:"JavaScript",javascript:"JavaScript",ts:"TypeScript",typescript:"TypeScript",tsx:"TSX",jsx:"JSX",py:"Python",python:"Python",rb:"Ruby",ruby:"Ruby",rs:"Rust",rust:"Rust",go:"Go",java:"Java",kotlin:"Kotlin",swift:"Swift",cpp:"C++",c:"C",cs:"C#",csharp:"C#",php:"PHP",sql:"SQL",sh:"Shell",bash:"Bash",zsh:"Zsh",shell:"Shell",html:"HTML",css:"CSS",scss:"SCSS",less:"LESS",json:"JSON",yaml:"YAML",yml:"YAML",xml:"XML",toml:"TOML",ini:"INI",md:"Markdown",markdown:"Markdown",dockerfile:"Dockerfile",docker:"Dockerfile",graphql:"GraphQL",gql:"GraphQL",lua:"Lua",perl:"Perl",r:"R",scala:"Scala",elixir:"Elixir",erlang:"Erlang",haskell:"Haskell",clojure:"Clojure",dart:"Dart",zig:"Zig",nim:"Nim",powershell:"PowerShell",ps1:"PowerShell",vue:"Vue",svelte:"Svelte",plaintext:"Text",text:"Text",txt:"Text"};function wV(e){return vV[e.toLowerCase()]??e.charAt(0).toUpperCase()+e.slice(1)}function kV(e){const t=e.match(/language-(\S+)/);return t?t[1]:null}const N3=/^(?:\/|~\/|[A-Za-z]:[\\/]|\\\\)/,C3=/^\.{1,2}\//,SV=/\.[a-zA-Z0-9]{1,12}(?:$|[?#])/,T3=/^[A-Za-z]:[\\/]/,A3=/^\\\\[^\\]/;function E3(e){const t=e.trim();return t?!!(/^file:/i.test(t)||T3.test(t)||A3.test(t)||t.startsWith("~/")||t.startsWith("/")||C3.test(t)):!1}function Kg(e){let t=e.trim();if(/^file:/i.test(t)){try{t=decodeURIComponent(t.replace(/^file:\/\//i,""))}catch{t=t.replace(/^file:\/\//i,"")}/^\/[A-Za-z]:\//.test(t)&&(t=t.slice(1))}return t=t.replace(/\\+/g,"/"),t}function NV(e){return e.replace(/(!?\[[^\]]*]\()((?:[A-Za-z]:|\\\\)[^)\n]*)(\))/g,(t,n,r,o)=>`${n}${r.replace(/\\+/g,"/")}${o}`)}function _3(e){return e.trim().toLowerCase().replace(/[^\p{L}\p{N}\p{M}\s\-_]/gu,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function Sd(e,t){if(!e)return e;if(N3.test(e))return e.startsWith("~/")?e:e.replace(/\\/g,"/");if(!t)return e;const r=`${t.replace(/\\/g,"/").replace(/\/+$/,"")}/${e.replace(/^\.\//,"")}`,o=r.split("/"),l=[];for(const d of o)!d||d==="."||(d===".."?l.pop():l.push(d));const c=l.join("/");return r.startsWith("/")?`/${c}`.replace(/^\/+/,"/"):c}function e4(e){const t=e.indexOf("#");return t<0?{path:e}:{path:e.slice(0,t),fragment:decodeURIComponent(e.slice(t+1))}}function t4(e,t){if(!e)return{kind:"passthrough"};const n=e.trim();if(!n||n==="#")return{kind:"passthrough"};if(n.startsWith("#")&&!n.startsWith("#mention:")&&!n.startsWith("#entity:"))return{kind:"fragment",id:decodeURIComponent(n.slice(1))};if(T3.test(n)||A3.test(n)){const{path:l,fragment:c}=e4(n);return{kind:"file",path:Sd(l,t),fragment:c}}if(/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(n))return/^https?:\/\//i.test(n)||/^mailto:/i.test(n)?{kind:"external",url:n}:/^file:\/\//i.test(n)?{kind:"file",path:Kg(n)}:{kind:"passthrough"};const{path:r,fragment:o}=e4(n);return N3.test(r)?{kind:"file",path:Sd(r,t),fragment:o}:C3.test(r)?{kind:"file",path:Sd(r,t),fragment:o}:r&&SV.test(r)&&!r.includes("://")?{kind:"file",path:Sd(r,t),fragment:o}:{kind:"passthrough"}}function CV(e,t){if(!e||!t)return!1;let n=null;try{n=e.querySelector(`#${CSS.escape(t)}`)}catch{n=null}if(n||(n=e.querySelector(`[id="${t.replace(/"/g,'\\"')}"]`)),!n){const r=e.querySelectorAll("h1,h2,h3,h4,h5,h6");for(const o of r)if(_3(o.textContent||"")===t||o.id===t){n=o;break}}return n?(n.scrollIntoView({behavior:"smooth",block:"start"}),!0):!1}function j3(e){return e.type==="text"?e.value??"":(e.children??[]).map(j3).join("")}function M3(){return e=>{const t=new Map,n=r=>{if(r.type==="element"&&r.tagName&&/^h[1-6]$/.test(r.tagName)){const o=j3(r).trim();let l=_3(o);if(l){const c=t.get(l)??0;t.set(l,c+1),c>0&&(l=`${l}-${c}`),r.properties={...r.properties??{},id:l}}}for(const o of r.children??[])n(o)};n(e)}}function TV(e,t,n){const r=e.cloneNode(!0),o=n?.fontFamily??"-apple-system,BlinkMacSystemFont,'Segoe UI','Noto Sans',Helvetica,Arial,sans-serif",l=n?.fontSize??"15px",c=n?.headingScales??{h1:1.6,h2:1.35,h3:1.15,h4:1},d=t==="light"?{bg:"#ffffff",text:"#24292f",heading:"#1f2328",strong:"#1f2328",link:"#0969da",codeBg:"#eff1f3",codeText:"#24292f",preBg:"#f6f8fa",preText:"#24292f",preBorder:"#d0d7de",border:"#d0d7de",blockquoteBorder:"#d0d7de",blockquoteText:"#656d76",tableBorder:"#d0d7de",tableHeaderBg:"#f6f8fa",tableHeaderText:"#24292f",hrColor:"#d8dee4"}:{bg:"#0d1117",text:"#e6edf3",heading:"#f0f6fc",strong:"#f0f6fc",link:"#58a6ff",codeBg:"#161b22",codeText:"#e6edf3",preBg:"#161b22",preText:"#e6edf3",preBorder:"#30363d",border:"#30363d",blockquoteBorder:"#3b82f6",blockquoteText:"#8b949e",tableBorder:"#30363d",tableHeaderBg:"#161b22",tableHeaderText:"#e6edf3",hrColor:"#21262d"},m={p:`margin:0 0 10px;color:${d.text};line-height:1.7;`,h1:`font-size:${c.h1}em;font-weight:700;color:${d.heading};margin:20px 0 10px;line-height:1.3;border-bottom:1px solid ${d.border};padding-bottom:6px;`,h2:`font-size:${c.h2}em;font-weight:700;color:${d.heading};margin:18px 0 8px;line-height:1.3;`,h3:`font-size:${c.h3}em;font-weight:600;color:${d.heading};margin:14px 0 6px;line-height:1.3;`,h4:`font-size:${c.h4}em;font-weight:600;color:${d.heading};margin:12px 0 4px;`,strong:`font-weight:600;color:${d.strong};`,em:"font-style:italic;",a:`color:${d.link};text-decoration:underline;`,ul:"padding-left:1.5em;margin:0 0 10px;",ol:"padding-left:1.5em;margin:0 0 10px;",li:`margin:3px 0;line-height:1.7;color:${d.text};`,blockquote:`border-left:3px solid ${d.blockquoteBorder};padding:2px 0 2px 14px;margin:10px 0;color:${d.blockquoteText};`,hr:`border:none;border-top:1px solid ${d.hrColor};margin:20px 0;`,table:"border-collapse:collapse;width:100%;margin:10px 0;",thead:`background:${d.tableHeaderBg};`,th:`border:1px solid ${d.tableBorder};padding:8px 12px;text-align:left;font-weight:600;color:${d.tableHeaderText};`,td:`border:1px solid ${d.tableBorder};padding:8px 12px;color:${d.text};`,img:"max-width:100%;height:auto;"};function f(h){h.removeAttribute("class");const g=h.tagName.toLowerCase();if(g==="pre"){h.setAttribute("style",`background:${d.preBg};color:${d.preText};padding:14px;border-radius:6px;overflow-x:auto;margin:10px 0;font-size:0.88em;line-height:1.5;border:1px solid ${d.preBorder};`);const y=h.querySelector("code");y&&(y.removeAttribute("class"),y.setAttribute("style","background:transparent;padding:0;border-radius:0;color:inherit;font-family:'SFMono-Regular',Consolas,'Liberation Mono',Menlo,monospace;font-size:inherit;"));return}g==="code"?h.setAttribute("style",`background:${d.codeBg};color:${d.codeText};padding:2px 6px;border-radius:4px;font-size:0.9em;font-family:'SFMono-Regular',Consolas,'Liberation Mono',Menlo,monospace;`):m[g]&&h.setAttribute("style",m[g]),Array.from(h.children).forEach(f)}return r.removeAttribute("class"),Array.from(r.children).forEach(h=>f(h)),`<div style="background:${d.bg};color:${d.text};padding:20px 24px;font-family:${o};font-size:${l};line-height:1.7;max-width:800px;">${r.innerHTML}</div>`}async function Wg(e){try{return await navigator.clipboard.writeText(e),!0}catch{try{const t=document.createElement("textarea");t.value=e,t.style.cssText="position:fixed;left:-9999px;top:-9999px;opacity:0",document.body.appendChild(t),t.select();const n=document.execCommand("copy");return document.body.removeChild(t),n}catch{return!1}}}async function AV(e,t,n,r){const o=TV(e,t,r);try{return await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([o],{type:"text/html"}),"text/plain":new Blob([n],{type:"text/plain"})})]),{ok:!0,method:"html"}}catch{return{ok:await Wg(n),method:"text"}}}const R3="markus-copy-typography",n4={fontFamily:"default",fontSize:15,headingScale:"standard"};function L3(){try{const e=localStorage.getItem(R3);if(e)return{...n4,...JSON.parse(e)}}catch{}return n4}function EV(e){localStorage.setItem(R3,JSON.stringify(e))}function _V(e){const t={default:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif",serif:"Georgia, 'Times New Roman', Times, serif","sans-serif":"-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif",mono:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace"},n={compact:{h1:1.3,h2:1.15,h3:1.05,h4:1},standard:{h1:1.6,h2:1.35,h3:1.15,h4:1},large:{h1:2,h2:1.6,h3:1.3,h4:1.1}};return{fontFamily:t[e.fontFamily]??t.default,fontSize:`${e.fontSize}px`,headingScales:n[e.headingScale]??n.standard}}function jV({onClose:e}){const{t}=ft("common"),[n,r]=k.useState(L3);k.useEffect(()=>{EV(n)},[n]);const o=k.useCallback((l,c)=>{r(d=>({...d,[l]:c}))},[]);return s.jsxs("div",{className:"px-3 py-2 space-y-3 max-w-[260px]",children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsx("span",{className:"font-medium text-fg-primary text-xs",children:t("markdown.typographySettings")}),s.jsx("button",{onClick:e,className:"text-fg-tertiary hover:text-fg-primary p-0.5",children:s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsx("p",{className:"text-[10px] text-fg-tertiary",children:t("markdown.typographyDesc")}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:t("markdown.fontFamily")}),s.jsxs("select",{value:n.fontFamily,onChange:l=>o("fontFamily",l.target.value),className:"w-full px-2 py-1 text-xs rounded bg-surface-primary border border-border-subtle text-fg-secondary focus:outline-none focus:ring-1 focus:ring-brand-500/50",children:[s.jsx("option",{value:"default",children:t("markdown.fontDefault")}),s.jsx("option",{value:"serif",children:t("markdown.fontSerif")}),s.jsx("option",{value:"sans-serif",children:t("markdown.fontSansSerif")}),s.jsx("option",{value:"mono",children:t("markdown.fontMono")})]})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:[t("markdown.fontSize"),": ",n.fontSize,"px"]}),s.jsx("input",{type:"range",min:10,max:24,step:1,value:n.fontSize,onChange:l=>o("fontSize",Number(l.target.value)),className:"w-full h-1 rounded-full appearance-none bg-border-subtle [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-brand-500"}),s.jsxs("div",{className:"flex justify-between text-[9px] text-fg-tertiary mt-0.5",children:[s.jsx("span",{children:"10px"}),s.jsx("span",{children:"24px"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:t("markdown.headingScale")}),s.jsx("div",{className:"flex gap-1",children:["compact","standard","large"].map(l=>s.jsx("button",{onClick:()=>o("headingScale",l),className:`flex-1 px-2 py-1 rounded text-[10px] font-medium transition-colors ${n.headingScale===l?"bg-brand-600/20 text-brand-500":"bg-surface-primary text-fg-tertiary hover:text-fg-secondary border border-border-subtle"}`,children:t(`markdown.scale${l.charAt(0).toUpperCase()+l.slice(1)}`)},l))})]})]})}class MV extends k.Component{state={error:null};static getDerivedStateFromError(t){return{error:t}}componentDidUpdate(t){this.state.error&&this.props.resetKeys&&!RV(t.resetKeys,this.props.resetKeys)&&this.setState({error:null})}componentDidCatch(t,n){this.props.onError?.(t,n),console.error("[ErrorBoundary] caught render error:",t,n.componentStack)}reset=()=>this.setState({error:null});render(){const{error:t}=this.state;if(t){const{fallback:n}=this.props;return typeof n=="function"?n(t,this.reset):n??null}return this.props.children}}function RV(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}const LV=k.lazy(()=>Gr(()=>Promise.resolve().then(()=>G3),void 0).then(e=>({default:e.MarkdownMessage}))),OV={file:{icon:"📄",color:"bg-green-500/10 text-green-600"},directory:{icon:"📁",color:"bg-blue-500/10 text-blue-600"}},r4={active:{color:"text-green-600 bg-green-500/10"},verified:{color:"text-blue-600 bg-blue-500/10"},outdated:{color:"text-fg-tertiary bg-surface-elevated/50"}};function DV({item:e,onClose:t,onOpenInPage:n}){const{t:r}=ft(["agent","common"]),o=OV[e.type]??{icon:"📎",color:"bg-surface-elevated text-fg-secondary"},l=r4[e.status]??r4.active,c=/^https?:\/\//i.test(e.reference??"");k.useEffect(()=>{const m=f=>{f.key==="Escape"&&t()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[t]);const d=s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",onClick:t,children:[s.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),s.jsxs("div",{className:"relative bg-surface-primary rounded-2xl shadow-2xl border border-border-default w-full max-w-lg max-h-[85vh] overflow-y-auto",onClick:m=>m.stopPropagation(),children:[s.jsxs("div",{className:"sticky top-0 bg-surface-primary/95 backdrop-blur-sm border-b border-border-default px-5 py-4 flex items-start gap-3 rounded-t-2xl z-10",children:[s.jsx("span",{className:`inline-flex items-center justify-center w-10 h-10 rounded-xl text-lg shrink-0 ${o.color}`,children:o.icon}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-semibold text-fg-primary",children:e.title}),s.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[s.jsx("span",{className:`px-1.5 py-0.5 text-[10px] rounded font-medium ${l.color}`,children:e.status}),s.jsx("span",{className:"text-[10px] text-fg-tertiary",children:e.type}),e.format&&s.jsx("span",{className:"text-[10px] px-1.5 py-0.5 bg-surface-elevated rounded text-fg-secondary",children:e.format})]})]}),s.jsx("button",{onClick:t,className:"p-1.5 rounded-lg hover:bg-surface-overlay transition-colors shrink-0 text-fg-tertiary hover:text-fg-primary",children:s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),s.jsxs("div",{className:"px-5 py-4 space-y-4",children:[e.summary&&e.summary.trim()!==e.title.trim()&&s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:r("agent:deliverables.summary")}),s.jsx("div",{className:"mt-1.5",children:s.jsx(k.Suspense,{fallback:s.jsx("p",{className:"text-sm text-fg-secondary",children:e.summary}),children:s.jsx(LV,{content:e.summary,className:"text-sm text-fg-secondary"})})})]}),e.reference&&s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:r("agent:deliverables.reference")}),s.jsxs("div",{className:"mt-1.5 flex items-center gap-2 bg-surface-elevated rounded-lg px-3 py-2",children:[s.jsx("span",{className:"text-xs text-fg-secondary font-mono break-all flex-1 select-all",children:e.reference}),c?s.jsx("button",{onClick:()=>window.open(e.reference,"_blank","noopener,noreferrer"),className:"px-2 py-1 text-[10px] rounded bg-brand-600/20 text-brand-500 hover:bg-brand-600/30 transition-colors shrink-0",children:r("common:open")}):s.jsx("button",{onClick:()=>{Ee.files.reveal(e.reference).catch(()=>{})},className:"px-2 py-1 text-[10px] rounded bg-brand-600/20 text-brand-500 hover:bg-brand-600/30 transition-colors shrink-0",children:r("common:open")})]})]}),e.diffStats&&s.jsxs("div",{className:"flex items-center gap-3 text-xs bg-surface-elevated rounded-lg px-3 py-2",children:[s.jsx("span",{className:"text-fg-tertiary font-medium",children:"Diff:"}),s.jsxs("span",{className:"text-fg-secondary",children:[e.diffStats.filesChanged," file",e.diffStats.filesChanged!==1?"s":""]}),s.jsxs("span",{className:"text-green-500",children:["+",e.diffStats.additions]}),s.jsxs("span",{className:"text-red-500",children:["-",e.diffStats.deletions]})]}),e.testResults&&s.jsxs("div",{className:"flex items-center gap-3 text-xs bg-surface-elevated rounded-lg px-3 py-2",children:[s.jsx("span",{className:"text-fg-tertiary font-medium",children:"Tests:"}),s.jsxs("span",{className:"text-green-500",children:[e.testResults.passed," passed"]}),e.testResults.failed>0&&s.jsxs("span",{className:"text-red-500",children:[e.testResults.failed," failed"]}),e.testResults.skipped>0&&s.jsxs("span",{className:"text-fg-tertiary",children:[e.testResults.skipped," skipped"]})]}),e.tags.length>0&&s.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.tags.map(m=>s.jsx("span",{className:"px-2 py-0.5 text-[11px] bg-surface-elevated rounded-md text-fg-tertiary",children:m},m))}),s.jsxs("div",{className:"flex items-center gap-4 text-[10px] text-fg-tertiary flex-wrap pt-1 border-t border-border-default/50",children:[s.jsxs("span",{children:[r("agent:deliverables.created"),": ",new Date(e.createdAt).toLocaleString()]}),s.jsxs("span",{children:[r("agent:deliverables.updated"),": ",new Date(e.updatedAt).toLocaleString()]}),e.accessCount>0&&s.jsx("span",{children:r("agent:deliverables.accessed",{count:e.accessCount})})]})]}),s.jsxs("div",{className:"sticky bottom-0 bg-surface-primary/95 backdrop-blur-sm border-t border-border-default px-5 py-3 flex items-center justify-end gap-2 rounded-b-2xl",children:[s.jsxs("button",{onClick:()=>n(e.id),className:"px-3 py-1.5 text-xs font-medium text-brand-500 hover:bg-brand-500/10 rounded-lg transition-colors flex items-center gap-1.5",children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),s.jsx("polyline",{points:"15 3 21 3 21 9"}),s.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),r("agent:deliverables.openInPage")]}),s.jsx("button",{onClick:t,className:"px-3 py-1.5 text-xs font-medium text-fg-secondary bg-surface-elevated hover:bg-surface-overlay rounded-lg transition-colors",children:r("common:close")})]})]})]});return typeof document<"u"?Sa.createPortal(d,document.body):d}const IV={tsk:"task",req:"requirement",proj:"project",dlv:"deliverable",agt:"agent",team:"team"};function O3(e){return{task:"task",requirement:"requirement",project:"project",deliverable:"deliverable",agent:"agent",team:"team"}[e]}const D3={task:"📋",requirement:"📝",project:"📁",deliverable:"📦",agent:"🤖",team:"👥"},I3={task:"Task",requirement:"Requirement",project:"Project",deliverable:"Deliverable",agent:"Agent",team:"Team"},PV=/^(tsk|req|proj|dlv|agt|team)_[a-f0-9]{6,}$/i;function b0(e){return PV.test(e.trim())}function zV(e){const t=e.split("_")[0]?.toLowerCase();return t?IV[t]:void 0}function P3(e){e.startsWith("tsk_")?it.navigate(de.WORK,{openTask:e}):e.startsWith("req_")?it.navigate(de.WORK,{openRequirement:e}):e.startsWith("proj_")?it.navigate(de.WORK,{projectId:e}):e.startsWith("dlv_")?it.navigate(de.DELIVERABLES,{openDeliverable:e}):e.startsWith("agt_")?it.navigate(de.TEAM,{agentId:e}):e.startsWith("team_")&&it.navigate(de.TEAM,{selectTeam:e})}const Qp=new Map,Nd=new Map;async function BV(e,t){const n={id:e,type:t,title:e,loading:!1};try{switch(t){case"task":{const r=await Ee.tasks.get(e);return{...n,title:r.task.title,status:r.task.status}}case"requirement":{const r=await Ee.requirements.get(e);return{...n,title:r.requirement.title,status:r.requirement.status}}case"project":{const r=await Ee.projects.get(e);return{...n,title:r.project.name,status:r.project.status,summary:r.project.description}}case"deliverable":{const r=await Ee.deliverables.get(e);return{...n,title:r.deliverable.title,status:r.deliverable.status,summary:r.deliverable.summary,deliverable:r.deliverable}}case"agent":{const r=await Ee.agents.get(e);return{...n,title:r.name,summary:r.role}}case"team":{const o=(await Ee.teams.list()).teams.find(l=>l.id===e);return{...n,title:o?.name??e,notFound:!o}}}}catch{}return{...n,notFound:!0}}function z3(e,t){const n=t??zV(e),[r,o]=k.useState(()=>Qp.get(e)??{id:e,type:n??"task",title:e,loading:!!n});return k.useEffect(()=>{if(!n){o({id:e,type:"task",title:e,loading:!1,notFound:!0});return}const l=Qp.get(e);if(l){o(l);return}o(m=>({...m,type:n,loading:!0}));let c=!0,d=Nd.get(e);return d||(d=BV(e,n),Nd.set(e,d)),d.then(m=>{Qp.set(e,m),Nd.delete(e),c&&o(m)}).catch(()=>{Nd.delete(e),c&&o({id:e,type:n,title:e,loading:!1,notFound:!0})}),()=>{c=!1}},[e,n]),r}function B3(e){const t=(e.split("_")[0]?.length??3)+1;return e.length>t+8?`${e.slice(0,t+8)}…`:e}function lc({id:e,type:t,label:n}){const r=z3(e,t),o=Lc(),l=D3[r.type]??"🔗",c=n??(r.loading||r.notFound?B3(e):r.title),d=m=>{if(m.preventDefault(),m.stopPropagation(),r.type==="deliverable"&&r.deliverable&&o?.hostAvailable){o.openRightPanel({kind:"deliverable",deliverable:r.deliverable});return}P3(e)};return s.jsxs("span",{"data-entity-link":e,className:"inline-flex items-center gap-0.5 px-1 py-0.5 rounded bg-brand-500/10 text-brand-500 text-xs font-medium cursor-pointer hover:bg-brand-500/20 transition-colors align-baseline",onClick:d,title:`${I3[r.type]}: ${r.notFound?e:r.title} (${e})`,children:[s.jsx("span",{className:"text-[10px]",children:l}),s.jsx("span",{className:"truncate max-w-[240px] align-baseline",children:c})]})}function $V({id:e,type:t,label:n}){const r=z3(e,t),[o,l]=k.useState(!1),c=Lc(),d=D3[r.type]??"🔗",m=()=>{if(r.type==="deliverable"&&r.deliverable){if(c?.hostAvailable){c.openRightPanel({kind:"deliverable",deliverable:r.deliverable});return}l(!0);return}P3(e)},f=r.loading?B3(e):n||(r.notFound?e:r.title);return s.jsxs("span",{className:"not-prose block my-2",children:[s.jsxs("button",{type:"button",onClick:m,className:"w-full max-w-md text-left rounded-xl border border-border-default bg-surface-elevated/30 hover:border-brand-500/40 hover:bg-surface-elevated/50 transition-colors px-3 py-2.5 flex items-start gap-2.5",children:[s.jsx("span",{className:"inline-flex items-center justify-center w-8 h-8 rounded-lg text-sm shrink-0 bg-brand-500/10",children:d}),s.jsxs("span",{className:"flex-1 min-w-0 block",children:[s.jsxs("span",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-[10px] uppercase tracking-wide text-fg-tertiary font-medium",children:I3[r.type]}),r.status&&s.jsx("span",{className:"px-1.5 py-0.5 text-[10px] rounded font-medium bg-brand-500/10 text-brand-500",children:r.status})]}),s.jsx("span",{className:`block text-sm font-medium truncate mt-0.5 ${r.notFound?"font-mono text-fg-tertiary":"text-fg-primary"}`,children:f}),r.summary&&r.summary.trim()!==r.title.trim()&&s.jsx("span",{className:"block text-xs text-fg-tertiary mt-0.5 line-clamp-1",children:r.summary})]}),s.jsx("svg",{className:"w-4 h-4 text-fg-tertiary shrink-0 mt-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),o&&r.deliverable&&s.jsx(DV,{item:r.deliverable,onClose:()=>l(!1),onOpenInPage:h=>{l(!1),it.navigate(de.DELIVERABLES,{openDeliverable:h})}})]})}k.lazy(()=>Gr(()=>Promise.resolve().then(()=>G3),void 0).then(e=>({default:e.MarkdownMessage})));const HV=k.lazy(()=>Gr(()=>import("./ContentRenderer-BfnvpFM7.js"),[]).then(e=>({default:e.ContentRenderer})));let No=[],a4=60;function UV(e){const t=k.useRef(e);t.current=e;const[n]=k.useState(()=>++a4);return k.useEffect(()=>{const r=()=>t.current();No.push(r);const o=l=>{l.key==="Escape"&&No[No.length-1]===r&&(l.preventDefault(),r())};return window.addEventListener("keydown",o,!0),()=>{window.removeEventListener("keydown",o,!0),No=No.filter(l=>l!==r),No.length===0&&(a4=60)}},[]),n}const s4=500,$s=new Map,x0=new Set,qd=new Map;let Gd=null;function FV(){if($s.size<=s4)return;const e=$s.size-s4,t=$s.keys();for(let n=0;n<e;n++){const{value:r,done:o}=t.next();if(o)break;$s.delete(r)}}function i4(e,t){$s.delete(e),$s.set(e,t),FV()}function o4(e){const t=qd.get(e);if(t)for(const n of t)n()}function qV(){Gd=null;const e=[...x0];x0.clear(),e.length!==0&&Ee.files.check(e).then(({results:t})=>{for(const[n,r]of Object.entries(t))i4(n,r),o4(n)}).catch(()=>{for(const t of e)i4(t,{exists:!1,isFile:!1,type:"unknown"}),o4(t)})}function GV(e){$s.has(e)||x0.has(e)||(x0.add(e),Gd&&clearTimeout(Gd),Gd=setTimeout(qV,30))}function VV(e,t){let n=qd.get(e);return n||(n=new Set,qd.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&qd.delete(e)}}function KV(e){const t=k.useCallback(o=>VV(e,o),[e]),n=k.useCallback(()=>$s.get(e),[e]),r=k.useSyncExternalStore(t,n,n);return k.useEffect(()=>{GV(e)},[e]),r}const WV=/^(?:\/[\w.\-@+]+(?:\/[\w.\-@+ ]*)*|~\/[\w.\-@+]+(?:\/[\w.\-@+ ]*)*|[A-Za-z]:(?:\\|\/)[\w.\-@+ ]+(?:(?:\\|\/)[\w.\-@+ ]*)*|\.\.?\/[\w.\-@+]+(?:\/[\w.\-@+ ]*)*)$/;function YV(e){return e.length<2||e.length>500?!1:WV.test(e)}function XV({filePath:e,onClose:t}){const n=UV(t),[r,o]=k.useState(!0),[l,c]=k.useState(null),[d,m]=k.useState(""),[f,h]=k.useState(""),[g,y]=k.useState(""),[x,w]=k.useState(""),[C,T]=k.useState("");k.useEffect(()=>{o(!0),c(null),Ee.files.preview(e).then(E=>{m(typeof E.content=="string"?E.content:""),h(E.type),y(E.name),w(E.mimeType||""),T(E.streamUrl||(E.path?Ee.files.streamUrl(E.path):"")||(E.type==="audio"||E.type==="video"?Ee.files.streamUrl(e):""))}).catch(E=>{c(String(E?.message||E))}).finally(()=>{o(!1)})},[e]);const S=g||e.split(/[/\\]/).pop()||e;return Sa.createPortal(s.jsx("div",{className:"fixed inset-0 bg-black/40 flex items-center justify-center",style:{zIndex:n},onClick:t,children:s.jsxs("div",{className:"bg-surface-secondary border border-border-default rounded-xl shadow-2xl w-[90vw] max-w-3xl max-h-[85vh] flex flex-col overflow-hidden",onClick:E=>E.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-default bg-surface-elevated/50 shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("svg",{className:"w-4 h-4 shrink-0 text-fg-secondary",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z",clipRule:"evenodd"})}),s.jsx("span",{className:"text-sm font-medium text-fg-primary truncate",children:S}),s.jsx("span",{className:"text-xs text-fg-tertiary truncate hidden sm:inline",children:e})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx("button",{className:"text-xs text-fg-secondary hover:text-fg-primary px-2 py-1 rounded hover:bg-surface-elevated transition-colors",onClick:()=>Ee.files.reveal(e),title:"Reveal in file explorer",children:s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{d:"M4.5 17a2.5 2.5 0 01-2.5-2.5v-9A2.5 2.5 0 014.5 3h3.672a1.5 1.5 0 011.06.44L10.56 4.77a.5.5 0 00.354.147H15.5A2.5 2.5 0 0118 7.417v7.083A2.5 2.5 0 0115.5 17h-11z"})})}),s.jsx("button",{className:"text-fg-secondary hover:text-fg-primary p-1 rounded hover:bg-surface-elevated transition-colors",onClick:t,children:s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[r&&s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx("div",{className:"w-5 h-5 border-2 border-brand-500/30 border-t-brand-500 rounded-full animate-spin"})}),l&&s.jsxs("div",{className:"text-center py-12 text-fg-secondary text-sm",children:[s.jsx("p",{className:"text-red-400 mb-1",children:"Failed to load file"}),s.jsx("p",{className:"text-xs text-fg-tertiary",children:l})]}),!r&&!l&&f==="image"&&d&&s.jsx("div",{className:"flex justify-center",children:s.jsx("img",{src:`data:${x||"image/png"};base64,${d}`,alt:S,className:"max-w-full rounded"})}),!r&&!l&&f==="audio"&&C&&s.jsx("audio",{controls:!0,preload:"metadata",src:C,className:"w-full"}),!r&&!l&&f==="video"&&C&&s.jsx("video",{controls:!0,preload:"metadata",src:C,className:"w-full max-h-[60vh] rounded-lg bg-black"}),!r&&!l&&(f==="binary"||!d&&f!=="image"&&f!=="audio"&&f!=="video")&&s.jsxs("div",{className:"text-center py-8 space-y-3",children:[s.jsx("p",{className:"text-sm text-fg-secondary",children:"This file type cannot be previewed."}),s.jsx("button",{className:"px-3 py-2 text-xs rounded-lg bg-brand-600/20 text-brand-500 hover:bg-brand-600/30 transition-colors",onClick:()=>{Ee.files.reveal(e)},children:"Reveal in file explorer"})]}),!r&&!l&&d&&f!=="image"&&f!=="audio"&&f!=="video"&&f!=="binary"&&s.jsx(k.Suspense,{fallback:s.jsx("div",{className:"text-xs text-fg-tertiary",children:"Loading…"}),children:s.jsx(HV,{content:d,format:f==="text"?"text":f,className:"text-sm"})})]})]})}),document.body)}function QV({path:e}){const t=KV(e),[n,r]=k.useState(null),o=Lc(),l=t?.exists??!1,c=t?.type==="markdown"||t?.type==="html"||t?.type==="json"||t?.type==="text"||t?.type==="image"||t?.type==="audio"||t?.type==="video",d=k.useCallback(h=>{if(h.preventDefault(),h.stopPropagation(),!!l)if(c){if(o?.hostAvailable){o.openRightPanel({kind:"file",path:e});return}r(e)}else Ee.files.reveal(e)},[l,c,e,o]),m="inline w-3 h-3 align-[-0.125em]",f=c?s.jsx("svg",{className:m,viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z",clipRule:"evenodd"})}):s.jsx("svg",{className:m,viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z",clipRule:"evenodd"})});return t?l?s.jsxs(s.Fragment,{children:[s.jsxs("code",{className:"bg-brand-500/10 px-1.5 py-0.5 rounded text-xs font-mono text-brand-500 cursor-pointer hover:bg-brand-500/20 transition-colors border border-brand-500/20 hover:border-brand-500/40 break-all",onClick:d,title:c?"Click to preview":"Click to reveal in file explorer",role:"button",tabIndex:0,children:[s.jsxs("span",{className:"whitespace-nowrap",children:[f,e.charAt(0)]}),e.slice(1)]}),n&&s.jsx(XV,{filePath:n,onClose:()=>r(null)})]}):s.jsx("code",{className:"bg-surface-secondary/50 px-1.5 py-0.5 rounded text-xs font-mono text-fg-tertiary border border-border-default/30 line-through decoration-fg-tertiary/30 break-all",title:"File not found",children:e}):s.jsx("code",{className:"bg-surface-secondary px-1.5 py-0.5 rounded text-xs font-mono text-fg-secondary break-all",children:e})}let Zp=null;function ZV(){return Zp||(Zp=Gr(()=>import("./mermaid.core-C0Q8mcc_.js").then(e=>e.b9),__vite__mapDeps([0,1])).then(e=>(e.default.initialize({startOnLoad:!1,securityLevel:"loose",fontFamily:"inherit"}),e))),Zp}function JV(){const e=document.documentElement;return e.classList.contains("light")?!1:e.classList.contains("dark")||e.classList.contains("cyberpunk")||e.classList.contains("mono")?!0:!window.matchMedia("(prefers-color-scheme: light)").matches}function eK(e){const t=window.matchMedia("(prefers-color-scheme: dark)");t.addEventListener("change",e);const n=new MutationObserver(e);return n.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>{t.removeEventListener("change",e),n.disconnect()}}function tK(){return JV()}function nK(){return k.useSyncExternalStore(eK,tK)}function $3({code:e}){const t=k.useRef(null),[n,r]=k.useState(null),[o,l]=k.useState(!0),c=k.useId(),d=k.useRef(0),m=k.useRef(null),f=nK();return k.useEffect(()=>{if(!e.trim()||m.current&&m.current.code===e&&m.current.dark===f)return;let h=!1;return l(!0),r(null),d.current+=1,(async()=>{try{const g=await ZV();if(h)return;g.default.initialize({startOnLoad:!1,theme:f?"dark":"default",securityLevel:"loose",fontFamily:"inherit"});const y=`mermaid-${c.replace(/:/g,"")}-${d.current}`,{svg:x}=await g.default.render(y,e.trim());if(h)return;t.current&&(t.current.innerHTML=x,m.current={code:e,dark:f})}catch(g){h||r(g instanceof Error?g.message:String(g))}finally{h||l(!1)}})(),()=>{h=!0}},[e,c,f]),n?s.jsxs("div",{className:"my-2 rounded-lg overflow-hidden border border-red-500/30",children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-500/10 border-b border-red-500/20",children:[s.jsx("svg",{className:"w-3.5 h-3.5 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})}),s.jsx("span",{className:"text-[10px] font-medium text-red-400",children:"Mermaid render error"})]}),s.jsx("pre",{className:"p-3 bg-surface-secondary text-xs text-fg-secondary overflow-x-auto font-mono",children:e})]}):s.jsxs("div",{className:"not-prose my-2 rounded-lg bg-surface-secondary border border-border-subtle p-4 overflow-x-auto",children:[o&&s.jsxs("div",{className:"flex items-center gap-2 text-xs text-fg-tertiary",children:[s.jsx("div",{className:"w-4 h-4 border-2 border-fg-tertiary/30 border-t-fg-tertiary rounded-full animate-spin"}),"Rendering diagram…"]}),s.jsx("div",{ref:t,className:`flex justify-center [&>svg]:max-w-full${o?" hidden":""}`})]})}const rK="/assets/viz-global-C_AyN6D9.js";let Cd=!1,Jp=null;function aK(){return Cd?Promise.resolve():new Promise((e,t)=>{const n=document.querySelector("script[data-plantuml-viz]");if(n){globalThis.Viz?(Cd=!0,e()):(n.addEventListener("load",()=>{Cd=!0,e()}),n.addEventListener("error",()=>t(new Error("Failed to load viz-global.js"))));return}const r=document.createElement("script");r.setAttribute("data-plantuml-viz",""),r.src=rK,r.onload=()=>{Cd=!0,e()},r.onerror=()=>t(new Error("Failed to load viz-global.js")),document.head.appendChild(r)})}function sK(){return Jp||(Jp=aK().then(()=>Gr(()=>import("./plantuml-DezRDxd4.js"),[]))),Jp}let l4=Promise.resolve();function iK(e,t){const n=l4.then(()=>new Promise((r,o)=>{sK().then(({renderToString:l})=>{const c=e.split(/\r\n|\r|\n/);l(c,r,o,{dark:t})}).catch(o)}));return l4=n.then(()=>{},()=>{}),n}function oK(){const e=document.documentElement;return e.classList.contains("light")?!1:e.classList.contains("dark")||e.classList.contains("cyberpunk")||e.classList.contains("mono")?!0:!window.matchMedia("(prefers-color-scheme: light)").matches}function lK(e){const t=window.matchMedia("(prefers-color-scheme: dark)");t.addEventListener("change",e);const n=new MutationObserver(e);return n.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>{t.removeEventListener("change",e),n.disconnect()}}function cK(){return k.useSyncExternalStore(lK,()=>oK())}function H3({code:e}){const[t,n]=k.useState(null),[r,o]=k.useState(null),[l,c]=k.useState(!0),d=k.useRef(null),m=cK();return k.useEffect(()=>{if(!e.trim()||d.current&&d.current.code===e&&d.current.dark===m)return;let f=!1;return c(!0),o(null),iK(e.trim(),m).then(h=>{f||(n(h),d.current={code:e,dark:m})}).catch(h=>{f||o(h instanceof Error?h.message:String(h))}).finally(()=>{f||c(!1)}),()=>{f=!0}},[e,m]),r?s.jsxs("div",{className:"my-2 rounded-lg overflow-hidden border border-red-500/30",children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-500/10 border-b border-red-500/20",children:[s.jsx("svg",{className:"w-3.5 h-3.5 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})}),s.jsx("span",{className:"text-[10px] font-medium text-red-400",children:"PlantUML render error"})]}),s.jsx("pre",{className:"p-3 bg-surface-secondary text-xs text-fg-secondary overflow-x-auto font-mono",children:e})]}):s.jsxs("div",{className:"not-prose my-2 rounded-lg bg-surface-secondary border border-border-subtle p-4 overflow-x-auto",children:[l&&s.jsxs("div",{className:"flex items-center gap-2 text-xs text-fg-tertiary",children:[s.jsx("div",{className:"w-4 h-4 border-2 border-fg-tertiary/30 border-t-fg-tertiary rounded-full animate-spin"}),"Rendering diagram…"]}),t&&s.jsx("div",{className:`flex justify-center [&>svg]:max-w-full${l?" hidden":""}`,dangerouslySetInnerHTML:{__html:t}})]})}function Xh({code:e,language:t,children:n}){const{t:r}=ft("common"),[o,l]=k.useState("rendered"),[c,d]=k.useState(!1),m=k.useCallback(async()=>{await Wg(e)&&(d(!0),setTimeout(()=>d(!1),1800))},[e]);return s.jsxs("div",{className:"not-prose my-2 rounded-lg overflow-hidden border border-border-subtle",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border-subtle bg-surface-secondary",children:[s.jsx("span",{className:"text-[10px] font-medium text-fg-tertiary uppercase tracking-wider select-none",children:t}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>l("rendered"),className:`px-2 py-0.5 rounded text-[10px] font-medium transition-colors ${o==="rendered"?"bg-brand-600/20 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsxs("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),r("markdown.viewRendered")]})}),s.jsx("button",{onClick:()=>l("source"),className:`px-2 py-0.5 rounded text-[10px] font-medium transition-colors ${o==="source"?"bg-brand-600/20 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"})}),r("markdown.viewSource")]})})]})]}),o==="rendered"?s.jsx("div",{children:n}):s.jsxs("div",{className:"relative group/source",children:[s.jsx("pre",{className:"p-3 overflow-x-auto text-xs font-mono text-fg-secondary bg-surface-secondary leading-relaxed whitespace-pre-wrap break-words",children:e}),s.jsx("button",{onClick:m,className:"absolute top-2 right-2 p-1.5 rounded-md bg-surface-elevated/80 hover:bg-surface-overlay text-fg-tertiary hover:text-fg-primary backdrop-blur-sm border border-border-default/50 transition-all opacity-0 group-hover/source:opacity-100",title:r("markdown.copyContent"),children:c?s.jsx("svg",{className:"w-3.5 h-3.5 text-green-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]})]})}const uK=[$3,H3];function dK(e){for(const t of k.Children.toArray(e))if(k.isValidElement(t)&&typeof t.props?.className=="string"){const n=t.props.className;return kV(n)}return null}function cc(e){if(typeof e=="string")return e;if(typeof e=="number")return String(e);if(!e)return"";if(Array.isArray(e))return e.map(cc).join("");if(k.isValidElement(e)){const t=e.props;return cc(t.children)}return""}function mK({children:e}){const{t}=ft("common"),n=dK(e),r=k.useRef(null),[o,l]=k.useState(!1),[c,d]=k.useState("rendered"),m=k.useCallback(async()=>{let h;c==="source"?h=cc(e):h=r.current?.querySelector("code")?.textContent??"";try{await navigator.clipboard.writeText(h),l(!0),setTimeout(()=>l(!1),1800)}catch{}},[c,e]);if(k.Children.toArray(e).some(h=>k.isValidElement(h)&&uK.includes(h.type))){const h=cc(e),g=n==="mermaid"||n==="plantuml"?n:"diagram";return s.jsx(Xh,{code:h,language:g,children:e})}return n==="mermaid"||n==="plantuml"?s.jsx(s.Fragment,{children:e}):s.jsxs("div",{className:"not-prose relative group/code my-2 rounded-lg overflow-hidden bg-surface-secondary border border-border-subtle",children:[n&&s.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border-subtle",children:[s.jsx("span",{className:"text-[10px] font-medium text-fg-tertiary uppercase tracking-wider select-none",children:wV(n)}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>d("rendered"),className:`px-1.5 py-0.5 rounded text-[10px] font-medium transition-colors ${c==="rendered"?"bg-brand-600/20 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:t("markdown.viewRendered")}),s.jsx("button",{onClick:()=>d("source"),className:`px-1.5 py-0.5 rounded text-[10px] font-medium transition-colors ${c==="source"?"bg-brand-600/20 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:t("markdown.viewSource")})]})]}),s.jsxs("div",{className:"relative",children:[c==="rendered"?s.jsx("pre",{ref:r,className:"p-3 overflow-x-auto text-xs [&>code]:p-0 [&>code]:rounded-none [&>code]:text-fg-secondary",children:k.Children.map(e,h=>k.isValidElement(h)?k.cloneElement(h,{style:{background:"transparent",padding:0}}):h)}):s.jsx("pre",{className:"p-3 overflow-x-auto text-xs font-mono text-fg-secondary whitespace-pre-wrap break-words",children:cc(e)}),s.jsx("button",{onClick:m,className:"absolute top-2 right-2 p-1.5 rounded-md bg-surface-elevated/80 hover:bg-surface-overlay text-fg-tertiary hover:text-fg-primary backdrop-blur-sm border border-border-default/50 transition-all opacity-0 group-hover/code:opacity-100",title:t("markdown.copyContent"),children:o?s.jsx("svg",{className:"w-3.5 h-3.5 text-green-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]})]})}const c4="#mention:",y0="#entity:",fK=/^\[([^\]]+)\]\(#entity:((tsk|req|proj|dlv|agt|team)_[a-f0-9]{6,})\)$/i,U3=/^(workflow|task|requirement|project|deliverable|agent|team):(.+)$/,Qh="text-brand-500 hover:text-brand-500 underline break-all cursor-pointer";function Zh(e){return e.type==="text"?e.value??"":(e.children??[]).map(Zh).join("")}function pK(e){return e.type==="text"&&(e.value??"").trim()===""}function hK(e){if(!e?.children)return null;const t=e.children.filter(r=>!pK(r));if(t.length!==1)return null;const n=t[0];if(n.type==="element"&&n.tagName==="a"){const r=n.properties?.href;if(!r)return null;const o=Zh(n);if(r.startsWith(y0))return{id:r.slice(y0.length)};const l=r.match(U3);return l&&l[1]!=="workflow"?{id:l[2],type:O3(l[1]),label:o}:null}if(n.type==="element"&&n.tagName==="code"){const r=Zh(n).trim();if(b0(r))return{id:r}}if(n.type==="text"){const r=(n.value??"").trim();if(b0(r))return{id:r}}return null}const gK={p:({children:e})=>s.jsx("p",{className:"mb-2 last:mb-0 leading-relaxed text-fg-secondary",children:e}),h1:({children:e})=>s.jsx("h1",{className:"text-base font-bold mb-2 mt-3 first:mt-0 text-fg-primary",children:e}),h2:({children:e})=>s.jsx("h2",{className:"text-sm font-bold mb-2 mt-3 first:mt-0 text-fg-primary",children:e}),h3:({children:e})=>s.jsx("h3",{className:"text-sm font-semibold mb-1 mt-2 first:mt-0 text-fg-primary",children:e}),h4:({children:e})=>s.jsx("h4",{className:"text-sm font-semibold mb-1 mt-2 first:mt-0 text-fg-primary",children:e}),h5:({children:e})=>s.jsx("h5",{className:"text-xs font-semibold mb-1 mt-2 first:mt-0 text-fg-primary",children:e}),h6:({children:e})=>s.jsx("h6",{className:"text-xs font-medium mb-1 mt-2 first:mt-0 text-fg-primary",children:e}),ul:({children:e})=>s.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:e}),ol:({children:e,start:t})=>s.jsx("ol",{start:t,className:"list-decimal pl-7 mb-2 space-y-0.5",children:e}),li:({children:e,value:t})=>s.jsx("li",{value:t,className:"leading-relaxed text-fg-secondary marker:text-fg-secondary",children:e}),code:({children:e,className:t})=>{const n=typeof e=="string"?e:String(e??""),r=n.trim();if(t?.includes("language-plantuml")||bV(r))return s.jsx(Xh,{code:r,language:"plantuml",children:s.jsx(H3,{code:r})});if(t?.includes("language-mermaid")||!t&&yV(r))return s.jsx(Xh,{code:r,language:"mermaid",children:s.jsx($3,{code:r})});if(t?.includes("language-"))return s.jsx("code",{className:`${t} text-fg-secondary font-mono text-xs`,children:e});if(b0(n))return s.jsx(lc,{id:n.trim()});const o=n.match(fK);return o?s.jsx(lc,{id:o[2],label:o[1]}):YV(n)?s.jsx(QV,{path:n}):s.jsx("code",{className:"bg-surface-secondary px-1.5 py-0.5 rounded text-xs font-mono text-brand-500 break-all",children:e})},pre:({children:e})=>s.jsx(mK,{children:e}),strong:({children:e})=>s.jsx("strong",{className:"font-bold text-fg-primary",children:e}),em:({children:e})=>s.jsx("em",{className:"italic text-fg-secondary",children:e}),del:({children:e})=>s.jsx("del",{className:"line-through text-fg-tertiary",children:e}),blockquote:({children:e})=>s.jsx("blockquote",{className:"border-l-2 border-brand-500 pl-3 my-2 text-fg-secondary italic",children:e}),a:({href:e,children:t})=>s.jsx("a",{href:e,className:Qh,children:t}),hr:()=>s.jsx("hr",{className:"border-border-default my-3"}),table:({children:e})=>s.jsx("div",{className:"overflow-x-auto my-2",children:s.jsx("table",{className:"min-w-full text-sm border-collapse border border-border-default",children:e})}),thead:({children:e})=>s.jsx("thead",{className:"bg-surface-secondary",children:e}),tbody:({children:e})=>s.jsx("tbody",{className:"divide-y divide-border-default",children:e}),tr:({children:e})=>s.jsx("tr",{className:"hover:bg-surface-elevated/50 transition-colors",children:e}),th:({children:e})=>s.jsx("th",{className:"px-3 py-2 text-left text-sm font-semibold text-fg-primary border border-border-default",children:e}),td:({children:e})=>s.jsx("td",{className:"px-3 py-2 text-sm text-fg-primary border border-border-default",children:e})},bK=/\.(png|jpe?g|gif|webp|svg|bmp|ico)$/i;function xK(e){const t=Kg(e);return E3(e)&&bK.test(t.split("?")[0]??t)}function yK(e,t){const n=Kg(e);if(n.startsWith("/")||n.startsWith("~/")||/^[A-Za-z]:\//.test(n)||n.startsWith("//"))return n;if((n.startsWith("./")||n.startsWith("../"))&&t){const o=((t.replace(/\\/g,"/").endsWith("/")?t.replace(/\\/g,"/"):`${t.replace(/\\/g,"/")}/`)+n).split("/"),l=[];for(const c of o)c===".."?l.pop():c!=="."&&c!==""&&l.push(c);return"/"+l.join("/")}return n}function vK(e){return`/api/files/image?path=${encodeURIComponent(e)}`}const Co=new Map;function wK({src:e,alt:t,onPreview:n,basePath:r}){const o=k.useMemo(()=>xK(e)?vK(yK(e,r)):e,[e,r]),l=o.startsWith("/api/files/image?"),c=Co.get(o),[d,m]=k.useState(c??(l?null:o)),[f,h]=k.useState(!!c),[g,y]=k.useState(!1),[x,w]=k.useState(null),[C,T]=k.useState(0),S=k.useRef(0),E=k.useCallback(()=>{Co.delete(o),y(!1),w(null),h(!1),m(l?null:`${o}${o.includes("?")?"&":"?"}retry=${Date.now()}`),T(j=>j+1)},[o,l]);return k.useEffect(()=>{if(!l)return;const j=Co.get(o);if(j){m(j),h(!0),y(!1),w(null);return}const L=++S.current;y(!1),w(null),h(!1),m(null),(async()=>{try{const I=await fetch(o,{credentials:"same-origin"});if(L!==S.current)return;if(!I.ok){let V=`HTTP ${I.status}`;try{const X=await I.json();X.error&&(V=X.error)}catch{}throw new Error(V)}const O=await I.blob();if(L!==S.current)return;if(O.size===0)throw new Error("Empty image response");if(O.type&&!O.type.startsWith("image/")&&!O.type.includes("octet-stream"))throw new Error(`Unexpected content-type: ${O.type}`);const F=URL.createObjectURL(O);Co.set(o,F),m(F),h(!0),y(!1),w(null)}catch(I){if(L!==S.current)return;const O=I instanceof Error?I.message:String(I);console.warn("[MarkdownImage] failed to load local image",o,I),w(O),y(!0),h(!1)}})()},[l,o,C]),k.useEffect(()=>{l||(m(o),h(!!Co.get(o)),y(!1),w(null))},[o,l,C]),g?s.jsxs("button",{type:"button",onClick:E,title:x??"Click to retry",className:"inline-flex items-center gap-1.5 px-3 py-2 text-xs text-fg-tertiary bg-surface-elevated rounded-lg border border-border-default hover:bg-surface-overlay hover:text-fg-secondary cursor-pointer transition-colors max-w-full",children:[s.jsxs("svg",{className:"w-4 h-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:[s.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),s.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),s.jsx("polyline",{points:"21 15 16 10 5 21"})]}),s.jsxs("span",{className:"truncate",children:["Failed to load image — click to retry",x?` (${x})`:""]})]}):s.jsxs("span",{className:"inline-block align-middle max-w-full",children:[!f&&s.jsx("span",{className:"block w-full min-h-[80px] max-w-[400px] bg-surface-elevated rounded-lg animate-pulse"}),d?s.jsx("img",{src:d,alt:t??"",onLoad:()=>{l||Co.set(o,o),h(!0)},onError:()=>{w("Image decode failed"),y(!0)},onClick:()=>n?.(d),className:`max-w-full h-auto rounded-lg cursor-pointer hover:opacity-90 transition-opacity my-1${f?"":" absolute opacity-0 pointer-events-none"}`,style:{maxHeight:"400px",objectFit:"contain"}}):null]})}async function u4(e){const t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch image (${t.status})`);return t.blob()}async function kK(e){if(e.type==="image/png")return e;const t=await createImageBitmap(e),n=document.createElement("canvas");n.width=t.width,n.height=t.height;const r=n.getContext("2d");if(!r)throw new Error("Canvas unavailable");return r.drawImage(t,0,0),t.close(),new Promise((o,l)=>{n.toBlob(c=>c?o(c):l(new Error("PNG encode failed")),"image/png")})}function SK(e,t){try{const o=(e.startsWith("data:")?"":new URL(e,window.location.href).pathname).split("/").pop()||"";if(o&&/\.(png|jpe?g|gif|webp|svg|bmp)$/i.test(o))return decodeURIComponent(o)}catch{}return`image.${(t.type.split("/")[1]||"png").replace("jpeg","jpg")}`}function F3({src:e,onClose:t}){const{t:n}=ft("common"),[r,o]=k.useState(null),[l,c]=k.useState(null);Ho(!0),k.useEffect(()=>{const g=y=>{y.key==="Escape"&&t()};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[t]);const d=k.useCallback(g=>{o(g),window.setTimeout(()=>o(null),1600)},[]),m=k.useCallback(async g=>{if(g.stopPropagation(),!l){c("copy");try{const y=await u4(e),x=await kK(y);await navigator.clipboard.write([new ClipboardItem({"image/png":x})]),d(n("imageCopied"))}catch{d(n("imageCopyFailed"))}finally{c(null)}}},[l,d,e,n]),f=k.useCallback(async g=>{if(g.stopPropagation(),!l){c("download");try{const y=await u4(e),x=URL.createObjectURL(y),w=document.createElement("a");w.href=x,w.download=SK(e,y),document.body.appendChild(w),w.click(),w.remove(),URL.revokeObjectURL(x),d(n("imageDownloaded"))}catch{d(n("imageDownloadFailed"))}finally{c(null)}}},[l,d,e,n]),h="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-white/10 hover:bg-white/20 text-white text-sm transition-colors disabled:opacity-50";return Sa.createPortal(s.jsxs("div",{className:"fixed inset-0 z-[9999] bg-black/80 flex items-center justify-center p-4",onClick:t,children:[s.jsxs("div",{className:"absolute top-4 right-4 z-10 flex items-center gap-2",onClick:g=>g.stopPropagation(),children:[s.jsxs("button",{type:"button",className:h,onClick:m,disabled:!!l,title:n("copyImage"),children:[s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),s.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),n("copy")]}),s.jsxs("button",{type:"button",className:h,onClick:f,disabled:!!l,title:n("downloadImage"),children:[s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"}),s.jsx("polyline",{points:"7 10 12 15 17 10"}),s.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),n("downloadImage")]}),s.jsx("button",{type:"button",onClick:t,className:"w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center transition-colors",title:n("close"),children:s.jsxs("svg",{className:"w-6 h-6 text-white",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),r&&s.jsx("div",{className:"absolute top-16 left-1/2 -translate-x-1/2 z-10 px-3 py-1.5 rounded-lg bg-black/70 text-white text-xs",children:r}),s.jsx("img",{src:e,alt:"Preview",className:"max-w-full max-h-[90vh] object-contain rounded-lg",onClick:g=>g.stopPropagation()})]}),document.body)}function q3(e={}){const{onMentionClick:t,basePath:n,onImagePreview:r,contentRef:o,hostAvailable:l,openRightPanel:c}=e,d=k.useCallback((m,f)=>{const h=t4(f,n);if(h.kind!=="passthrough"){if(m.preventDefault(),m.stopPropagation(),h.kind==="fragment"){CV(o?.current??null,h.id);return}if(h.kind==="file"){l&&c?c({kind:"file",path:h.path,title:h.path.split(/[/\\]/).pop()}):Ee.files.reveal(h.path).catch(()=>{});return}if(h.kind==="external"){if(l&&c&&/^https?:\/\//i.test(h.url)){c({kind:"url",url:h.url,title:h.url});return}_i(h.url)}}},[n,o,l,c]);return k.useMemo(()=>({...gK,img:({src:m,alt:f})=>s.jsx(wK,{src:m??"",alt:f,onPreview:r,basePath:n},m??""),p:({children:m,node:f})=>{const h=hK(f);return h?s.jsx($V,{id:h.id,type:h.type,label:h.label}):s.jsx("p",{className:"mb-2 last:mb-0 leading-relaxed text-fg-secondary",children:m})},a:({href:m,children:f})=>{if(m?.startsWith(c4)){const g=decodeURIComponent(m.slice(c4.length));return s.jsx("span",{className:`text-brand-500 font-medium${t?" cursor-pointer hover:underline":""}`,onClick:t?y=>{y.preventDefault(),y.stopPropagation(),t(g,y)}:void 0,title:g,children:f})}if(m?.startsWith(y0))return s.jsx(lc,{id:m.slice(y0.length)});{const g=m?.match(U3);if(g){const[,y,x]=g;if(y==="workflow")return s.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1 py-0.5 rounded bg-brand-500/10 text-brand-500 text-xs font-medium cursor-pointer hover:bg-brand-500/20 transition-colors",onClick:C=>{C.preventDefault(),C.stopPropagation(),it.navigate(de.WORK,{boardType:"workflows"})},title:`workflow: ${x}`,children:[s.jsx("span",{className:"text-[10px]",children:"⚙️"}),s.jsx("span",{children:f})]});const w=O3(y);if(w)return s.jsx(lc,{id:x,type:w,label:f})}}if(m&&b0(m))return s.jsx(lc,{id:m.trim(),label:f});const h=t4(m,n);return h.kind==="fragment"||h.kind==="file"||h.kind==="external"?s.jsx("a",{href:m,className:Qh,onClick:g=>d(g,m),title:h.kind==="fragment"?`#${h.id}`:h.kind==="file"?h.path:h.url,children:f}):s.jsx("a",{href:m,className:Qh,onClick:g=>{yc()&&m&&!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(m)&&g.preventDefault()},children:f})}}),[t,n,r,d])}const d4=[q5,Vk,Kk],m4=[M3,[n3,{strict:"ignore"}],[v3,{detect:!0,ignoreMissing:!0}]];function f4(e){return/^(deliverable|task|requirement|project|agent|team|workflow):/i.test(e)||E3(e)?e:x5(e)}const NK=/ thinking([\s\S]*?)(<\/think>|$)/g;function CK(e){const t=[];let n=e.replace(NK,(r,o)=>{const l=o.trim();return l&&t.push(l),""});return n=n.replace(/<\/think>/g,"").replace(/ thinking/g,""),{thinking:t,rest:n.trim()}}function TK(e=640){const[t,n]=k.useState(()=>window.innerWidth<e);return k.useEffect(()=>{const r=window.matchMedia(`(max-width: ${e-1}px)`),o=l=>n(l.matches);return r.addEventListener("change",o),n(r.matches),()=>r.removeEventListener("change",o)},[e]),t}function AK({content:e,contentRef:t}){const{t:n}=ft("common"),[r,o]=k.useState(!1),[l,c]=k.useState(!1),[d,m]=k.useState(!1),[f,h]=k.useState(null),g=k.useRef(null),y=TK();k.useEffect(()=>{if(!r)return;const T=S=>{g.current&&!g.current.contains(S.target)&&(o(!1),c(!1),m(!1))};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[r]);const x=k.useCallback(T=>{h(T),setTimeout(()=>h(null),1500)},[]),w=async()=>{const T=await Wg(e);x(n(T?"markdown.copied":"markdown.failed")),o(!1)},C=async T=>{const S=t.current?.firstElementChild;if(!S)return;const E=L3(),j=_V(E),L=await AV(S,T,e,{fontFamily:j.fontFamily,fontSize:j.fontSize,headingScales:j.headingScales}),I=n(T==="light"?"markdown.themeLight":"markdown.themeDark");x(L.ok?L.method==="html"?n("markdown.htmlCopied",{theme:I}):n("markdown.textCopied"):n("markdown.failed")),o(!1)};return s.jsxs("div",{className:"absolute top-1 right-1 z-10 opacity-0 group-hover/md:opacity-100 transition-opacity",ref:g,children:[f&&s.jsx("div",{className:"absolute right-0 top-full mt-1 z-20 px-2 py-0.5 rounded bg-surface-elevated border border-border-default text-[10px] text-fg-secondary whitespace-nowrap shadow-lg",children:f}),s.jsx("button",{onClick:()=>o(T=>!T),className:"p-1.5 rounded-lg bg-surface-elevated/80 hover:bg-surface-overlay text-fg-secondary hover:text-fg-primary backdrop-blur-sm border border-border-default/50 transition-all",title:n("markdown.copyContent"),children:s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),r&&s.jsx("div",{className:"absolute right-0 top-full mt-1 bg-surface-elevated border border-border-default rounded-lg shadow-xl py-1 min-w-[180px]",children:d?s.jsx(jV,{onClose:()=>m(!1)}):l?s.jsxs("div",{className:"px-3 py-2 text-[11px] text-fg-secondary space-y-2 max-w-[260px]",children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsx("span",{className:"font-medium text-fg-primary text-xs",children:n("markdown.infoTitle")}),s.jsx("button",{onClick:()=>c(!1),className:"text-fg-tertiary hover:text-fg-primary p-0.5",children:s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsxs("div",{children:[s.jsx("span",{className:"font-medium text-fg-primary",children:n("markdown.mdAbbrev")})," — ",n("markdown.infoMdDesc")]}),s.jsxs("div",{children:[s.jsx("span",{className:"font-medium text-fg-primary",children:"☀️"})," — ",n("markdown.infoHtmlLightDesc")]}),s.jsxs("div",{children:[s.jsx("span",{className:"font-medium text-fg-primary",children:"🌙"})," — ",n("markdown.infoHtmlDarkDesc")]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-b border-border-subtle mb-1",children:[s.jsx("span",{className:"text-[10px] text-fg-tertiary font-medium",children:n("markdown.copyContent")}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>m(!0),className:"p-0.5 rounded text-fg-tertiary hover:text-fg-primary transition-colors",title:n("markdown.typographySettings"),children:s.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),s.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),s.jsx("button",{onClick:()=>c(!0),className:"p-0.5 rounded text-fg-tertiary hover:text-fg-primary transition-colors",title:n("markdown.infoTitle"),children:s.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("path",{strokeLinecap:"round",d:"M12 16v-4m0-4h.01"})]})})]})]}),s.jsxs("button",{onClick:w,className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[s.jsx("span",{className:"w-4 text-center text-fg-tertiary shrink-0 font-mono text-[10px]",children:n("markdown.mdAbbrev")}),n(y?"markdown.copyMdSourceShort":"markdown.copyMdSource")]}),s.jsxs("button",{onClick:()=>C("light"),className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[s.jsx("span",{className:"w-4 text-center shrink-0 text-[10px]",children:"☀️"}),n(y?"markdown.copyHtmlLightShort":"markdown.copyHtmlLight")]}),s.jsxs("button",{onClick:()=>C("dark"),className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[s.jsx("span",{className:"w-4 text-center shrink-0 text-[10px]",children:"🌙"}),n(y?"markdown.copyHtmlDarkShort":"markdown.copyHtmlDark")]})]})})]})}const Er=k.memo(function({content:t,className:n="",onMentionClick:r,knownNames:o,basePath:l}){const{thinking:c,rest:d}=CK(t),m=k.useRef(null),[f,h]=k.useState(null),g=Lc(),y=k.useCallback(C=>{let T=Jl(C,uV);return T=Jl(T,NV),T=Jl(T,hV),T=Jl(T,gV),T=Jl(T,S=>dV(S,o)),T},[o]),x=k.useMemo(()=>y(d),[d,y]),w=q3({onMentionClick:r,basePath:l,onImagePreview:h,contentRef:m,hostAvailable:g?.hostAvailable,openRightPanel:g?.openRightPanel});return s.jsxs("div",{className:"relative group/md",children:[s.jsx(AK,{content:t,contentRef:m}),s.jsx("div",{ref:m,children:s.jsx(MV,{resetKeys:[x],fallback:s.jsx("div",{className:`prose prose-sm max-w-none break-words whitespace-pre-wrap pr-8 text-fg-secondary ${n}`,children:d}),children:s.jsxs("div",{className:`prose prose-sm max-w-none break-words pr-8 text-fg-secondary ${n}`,children:[c.length>0&&(()=>{const C=c.join(`
648
+ `,1;if(tl>1e5&&tl>ht.index*3)throw new Error("potential infinite loop, way more iterations than matches");return an+=Dt,Dt.length}const Yn=ir(We);if(!Yn)throw je(vt.replace("{}",We)),new Error('Unknown language: "'+We+'"');const Bc=Z(Yn);let Hi="",Et=rn||Bc;const $c={},In=new at.__emitter(at);el();let an="",ls=0,Ma=0,tl=0,cs=!1;try{if(Yn.__emitTokens)Yn.__emitTokens(wt,In);else{for(Et.matcher.considerAll();;){tl++,cs?cs=!1:Et.matcher.considerAll(),Et.matcher.lastIndex=Ma;const nt=Et.matcher.exec(wt);if(!nt)break;const ht=wt.substring(Ma,nt.index),Dt=$i(ht,nt);Ma=nt.index+Dt}$i(wt.substring(Ma))}return In.finalize(),Hi=In.toHTML(),{language:We,value:Hi,relevance:ls,illegal:!1,_emitter:In,_top:Et}}catch(nt){if(nt.message&&nt.message.includes("Illegal"))return{language:We,value:M(wt),illegal:!0,relevance:0,_illegalBy:{message:nt.message,index:Ma,context:wt.slice(Ma-100,Ma+100),mode:nt.mode,resultSoFar:Hi},_emitter:In};if(rt)return{language:We,value:M(wt),illegal:!1,relevance:0,errorRaised:nt,_emitter:In,_top:Et};throw nt}}function Di(We){const wt={value:M(We),illegal:!1,relevance:0,_top:Fe,_emitter:new at.__emitter(at)};return wt._emitter.addText(We),wt}function Ii(We,wt){wt=wt||at.languages||Object.keys(ce);const Ht=Di(We),rn=wt.filter(ir).filter(is).map(hn=>Ea(hn,We,!1));rn.unshift(Ht);const Rn=rn.sort((hn,Rr)=>{if(hn.relevance!==Rr.relevance)return Rr.relevance-hn.relevance;if(hn.language&&Rr.language){if(ir(hn.language).supersetOf===Rr.language)return 1;if(ir(Rr.language).supersetOf===hn.language)return-1}return 0}),[tr,Mr]=Rn,gr=tr;return gr.secondBest=Mr,gr}function ma(We,wt,Ht){const rn=wt&&Te[wt]||Ht;We.classList.add("hljs"),We.classList.add(`language-${rn}`)}function Mn(We){let wt=null;const Ht=xn(We);if(kt(Ht))return;if(Ys("before:highlightElement",{el:We,language:Ht}),We.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",We);return}if(We.children.length>0&&(at.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(We)),at.throwUnescapedHTML))throw new Ye("One of your code blocks includes unescaped HTML.",We.innerHTML);wt=We;const rn=wt.textContent,Rn=Ht?wn(rn,{language:Ht,ignoreIllegals:!0}):Ii(rn);We.innerHTML=Rn.value,We.dataset.highlighted="yes",ma(We,Ht,Rn.language),We.result={language:Rn.language,re:Rn.relevance,relevance:Rn.relevance},Rn.secondBest&&(We.secondBest={language:Rn.secondBest.language,relevance:Rn.secondBest.relevance}),Ys("after:highlightElement",{el:We,result:Rn,text:rn})}function er(We){at=le(at,We)}const ss=()=>{Pi(),oe("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Qo(){Pi(),oe("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Dc=!1;function Pi(){function We(){Pi()}if(document.readyState==="loading"){Dc||window.addEventListener("DOMContentLoaded",We,!1),Dc=!0;return}document.querySelectorAll(at.cssSelector).forEach(Mn)}function Ic(We,wt){let Ht=null;try{Ht=wt(K)}catch(rn){if(je("Language definition for '{}' could not be registered.".replace("{}",We)),rt)je(rn);else throw rn;Ht=Fe}Ht.name||(Ht.name=We),ce[We]=Ht,Ht.rawDefinition=wt.bind(null,K),Ht.aliases&&_a(Ht.aliases,{languageName:We})}function Ws(We){delete ce[We];for(const wt of Object.keys(Te))Te[wt]===We&&delete Te[wt]}function Zo(){return Object.keys(ce)}function ir(We){return We=(We||"").toLowerCase(),ce[We]||ce[Te[We]]}function _a(We,{languageName:wt}){typeof We=="string"&&(We=[We]),We.forEach(Ht=>{Te[Ht.toLowerCase()]=wt})}function is(We){const wt=ir(We);return wt&&!wt.disableAutodetect}function os(We){We["before:highlightBlock"]&&!We["before:highlightElement"]&&(We["before:highlightElement"]=wt=>{We["before:highlightBlock"](Object.assign({block:wt.el},wt))}),We["after:highlightBlock"]&&!We["after:highlightElement"]&&(We["after:highlightElement"]=wt=>{We["after:highlightBlock"](Object.assign({block:wt.el},wt))})}function Dn(We){os(We),ze.push(We)}function Pc(We){const wt=ze.indexOf(We);wt!==-1&&ze.splice(wt,1)}function Ys(We,wt){const Ht=We;ze.forEach(function(rn){rn[Ht]&&rn[Ht](wt)})}function ja(We){return oe("10.7.0","highlightBlock will be removed entirely in v12.0"),oe("10.7.0","Please use highlightElement now."),Mn(We)}Object.assign(K,{highlight:wn,highlightAuto:Ii,highlightAll:Pi,highlightElement:Mn,highlightBlock:ja,configure:er,initHighlighting:ss,initHighlightingOnLoad:Qo,registerLanguage:Ic,unregisterLanguage:Ws,listLanguages:Zo,getLanguage:ir,registerAliases:_a,autoDetection:is,inherit:le,addPlugin:Dn,removePlugin:Pc}),K.debugMode=function(){rt=!1},K.safeMode=function(){rt=!0},K.versionString=Ie,K.regex={concat:C,lookahead:y,either:S,optional:w,anyNumberOfTimes:x};for(const We in Ct)typeof Ct[We]=="object"&&e(Ct[We]);return Object.assign(K,Ct),K},Qe=Ve({});return Qe.newInstance=()=>Ve({}),Xp=Qe,Qe.HighlightJS=Qe,Qe.default=Qe,Xp}var WG=KG();const YG=Tc(WG),Z2={},XG="hljs-";function QG(e){const t=YG.newInstance();return e&&l(e),{highlight:n,highlightAuto:r,listLanguages:o,register:l,registerAlias:c,registered:d};function n(m,f,h){const g=h||Z2,y=typeof g.prefix=="string"?g.prefix:XG;if(!t.getLanguage(m))throw new Error("Unknown language: `"+m+"` is not registered");t.configure({__emitter:ZG,classPrefix:y});const x=t.highlight(f,{ignoreIllegals:!0,language:m});if(x.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:x.errorRaised});const w=x._emitter.root,C=w.data;return C.language=x.language,C.relevance=x.relevance,w}function r(m,f){const g=(f||Z2).subset||o();let y=-1,x=0,w;for(;++y<g.length;){const C=g[y];if(!t.getLanguage(C))continue;const T=n(C,m,f);T.data&&T.data.relevance!==void 0&&T.data.relevance>x&&(x=T.data.relevance,w=T)}return w||{type:"root",children:[],data:{language:void 0,relevance:x}}}function o(){return t.listLanguages()}function l(m,f){if(typeof m=="string")t.registerLanguage(m,f);else{let h;for(h in m)Object.hasOwn(m,h)&&t.registerLanguage(h,m[h])}}function c(m,f){if(typeof m=="string")t.registerAliases(typeof f=="string"?f:[...f],{languageName:m});else{let h;for(h in m)if(Object.hasOwn(m,h)){const g=m[h];t.registerAliases(typeof g=="string"?g:[...g],{languageName:h})}}}function d(m){return!!t.getLanguage(m)}}class ZG{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const r=this.stack[this.stack.length-1],o=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:o}):r.children.push(...o)}openNode(t){const n=this,r=t.split(".").map(function(c,d){return d?c+"_".repeat(d):n.options.classPrefix+c}),o=this.stack[this.stack.length-1],l={type:"element",tagName:"span",properties:{className:r},children:[]};o.children.push(l),this.stack.push(l)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const JG={};function v3(e){const t=e||JG,n=t.aliases,r=t.detect||!1,o=t.languages||VG,l=t.plainText,c=t.prefix,d=t.subset;let m="hljs";const f=QG(o);if(n&&f.registerAlias(n),c){const h=c.indexOf("-");m=h===-1?c:c.slice(0,h)}return function(h,g){D0(h,"element",function(y,x,w){if(y.tagName!=="code"||!w||w.type!=="element"||w.tagName!=="pre")return;const C=eV(y);if(C===!1||!C&&!r||C&&l&&l.includes(C))return;Array.isArray(y.properties.className)||(y.properties.className=[]),y.properties.className.includes(m)||y.properties.className.unshift(m);const T=Zk(y,{whitespace:"pre"});let S;try{S=C?f.highlight(C,T,{prefix:c}):f.highlightAuto(T,{prefix:c,subset:d})}catch(E){const j=E;if(C&&/Unknown language/.test(j.message)){g.message("Cannot highlight as `"+C+"`, it’s not registered",{ancestors:[w,y],cause:j,place:y.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw j}!C&&S.data&&S.data.language&&y.properties.className.push("language-"+S.data.language),S.children.length>0&&(y.children=S.children)})}}function eV(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let r;for(;++n<t.length;){const o=String(t[n]);if(o==="no-highlight"||o==="nohighlight")return!1;!r&&o.slice(0,5)==="lang-"&&(r=o.slice(5)),!r&&o.slice(0,9)==="language-"&&(r=o.slice(9))}return r}const Vg=new Set;function wi(e){e&&Vg.add(e)}function Vh(e){e&&Vg.delete(e)}const w3="markus_right_panel_v1",tV=10,Kh=new Map;function nV(e,t=3e3){Kh.set(e,Date.now()+t)}function rV(e){const t=Kh.get(e);return t==null?!1:Date.now()>t?(Kh.delete(e),!1):!0}function aV(e){return e.kind==="terminal"}function Zl(e){if(e.kind==="file")return`file:${e.path}`;if(e.kind==="url")return`url:${e.browserId||e.url}`;if(e.kind==="terminal")return`terminal:${e.terminalId}`;const t=e.deliverable;return`deliverable:${t.id||`${t.reference||""}|${t.title||""}|${t.summary?.slice(0,48)||""}`||"unknown"}`}function J2(e){return e.kind==="deliverable"?e.deliverable.title||e.deliverable.reference||"Deliverable":e.kind==="url"?e.title||e.url:e.kind==="terminal"?e.title||"Terminal":e.title||e.path.split(/[/\\]/).pop()||e.path}function Is(){return`tab_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function wd(e){let t=e;for(;t.length>tV;){let n=-1;for(let o=t.length-1;o>=0;o--)if(!t[o].pinned){n=o;break}if(n<0)break;const r=t[n];r&&(Wh(r.payload),Yh(r.payload)),t=t.filter((o,l)=>l!==n)}return t}function Wh(e){e?.kind==="url"&&e.browserId&&(nV(e.browserId),window.markusDesktop?.browser?.destroy(e.browserId))}function Yh(e){e?.kind==="terminal"&&e.terminalId&&(Vh(e.terminalId),window.markusDesktop?.terminal?.destroy(e.terminalId))}function sV(e){const t=e.payload;return t.kind==="terminal"?null:t.kind==="url"?gc(t.url||"")||gc(t.title||"")?null:{id:e.id,title:e.title,pinned:e.pinned,payload:{kind:"url",url:t.url||"about:blank",title:t.title||e.title}}:t.kind==="file"?{id:e.id,title:e.title,pinned:e.pinned,payload:{kind:"file",path:t.path,title:t.title}}:{id:e.id,title:e.title,pinned:e.pinned,payload:{kind:"deliverable",deliverable:t.deliverable}}}function iV(e,t=0){if(e.payload.kind==="url"){const n=`eb_${Date.now().toString(36)}_${t.toString(36)}_${Math.random().toString(36).slice(2,7)}`;return{...e,payload:{kind:"url",url:e.payload.url||"about:blank",title:e.payload.title||e.title,browserId:n}}}return e}function oV(){try{const e=localStorage.getItem(w3);if(!e)return null;const t=JSON.parse(e);return!t||t.mode!=="browser"&&t.mode!=="terminal"||!Array.isArray(t.browserTabs)?null:t}catch{return null}}function lV(){const e={mode:"browser",browserTabs:[],browserActiveId:null,terminalTabs:[],terminalActiveId:null,stashedBrowserTabs:[],stashedBrowserActiveId:null,stashedTerminalTabs:[],stashedTerminalActiveId:null},t=oV();if(!t)return e;const n=t.browserTabs.map((x,w)=>{try{return iV(x,w)}catch{return null}}).filter(x=>!(!x||x.payload.kind==="terminal"||x.payload.kind==="url"&&gc(x.payload.url||""))),r=n.some(x=>x.id===t.browserActiveId)?t.browserActiveId:n[0]?.id??null,o=(t.terminalTabs||[]).map((x,w)=>{const C=`term_${Date.now().toString(36)}_${w.toString(36)}_${Math.random().toString(36).slice(2,7)}`;return wi(C),{id:x.id||Is(),title:x.title||"Terminal",payload:{kind:"terminal",terminalId:C,title:x.title||"Terminal",cwd:x.cwd}}}),l=o.some(x=>x.id===t.terminalActiveId)?t.terminalActiveId:o[0]?.id??null,c=!!t.browserCollapsed&&n.length>0,d=!!t.terminalCollapsed&&o.length>0,m=c?[]:n,f=c?null:r,h=d?[]:o,g=d?null:l;let y=t.mode;return y==="terminal"&&h.length===0&&!d&&(y="browser"),y==="browser"&&m.length===0&&h.length>0&&(y="terminal"),{mode:y,browserTabs:m,browserActiveId:f,terminalTabs:h,terminalActiveId:g,stashedBrowserTabs:n,stashedBrowserActiveId:r,stashedTerminalTabs:o,stashedTerminalActiveId:l}}const k3=k.createContext(null);function cV({children:e}){const[t,n]=k.useState(()=>{try{return localStorage.getItem("markus_sidebar_c")==="1"}catch{return!1}}),r=k.useMemo(()=>lV(),[]),[o,l]=k.useState(r.mode),[c,d]=k.useState(r.browserTabs),[m,f]=k.useState(r.terminalTabs),[h,g]=k.useState(r.browserActiveId),[y,x]=k.useState(r.terminalActiveId),[w,C]=k.useState(!1),[T,S]=k.useState(!1),[E,j]=k.useState("l0"),[L,I]=k.useState(null),O=k.useCallback(ye=>j(ye),[]),F=k.useCallback(ye=>I(ye),[]);k.useEffect(()=>{const ye=Ae=>{if(!(Ae instanceof HTMLElement))return!1;const oe=Ae.tagName;return oe==="INPUT"||oe==="TEXTAREA"||oe==="SELECT"?!0:Ae.isContentEditable},je=Ae=>{if(!(Ae.target instanceof Element))return;const oe=document.activeElement;if(ye(oe)){const Ne=oe===Ae.target||oe.contains(Ae.target),Re=!!Ae.target.closest("[data-keep-edit-focus]"),$e=ye(Ae.target)||!!Ae.target.closest('input, textarea, select, [contenteditable="true"]'),Q=!!Ae.target.closest(".xterm");!Ne&&!Re&&!$e&&!Q&&oe.blur()}const H=Ae.target.closest("[data-keyboard-pane]");if(!H)return;const te=H.getAttribute("data-keyboard-pane");if(!(te!=="l0"&&te!=="l1"&&te!=="l2"&&te!=="content")&&(j(te),te==="l0")){const Re=Ae.target.closest("[data-l0-page-id]")?.getAttribute("data-l0-page-id");Re&&I(Re)}};return document.addEventListener("pointerdown",je,!0),()=>document.removeEventListener("pointerdown",je,!0)},[]);const V=k.useRef(r.stashedBrowserTabs.length>0?r.stashedBrowserTabs:r.browserTabs),X=k.useRef(r.stashedBrowserActiveId??r.browserActiveId),z=k.useRef(r.stashedTerminalTabs.length>0?r.stashedTerminalTabs:r.terminalTabs),G=k.useRef(r.stashedTerminalActiveId??r.terminalActiveId),se=k.useRef(r.browserActiveId),ee=k.useRef(r.terminalActiveId),q=k.useRef(r.browserTabs),re=k.useRef(r.terminalTabs),B=k.useRef(r.mode);se.current=h,ee.current=y,q.current=c,re.current=m,B.current=o,k.useEffect(()=>{(r.mode==="terminal"||r.browserTabs.length===0)&&window.markusDesktop?.browser?.hideAll?.()},[]),k.useEffect(()=>{const ye=c.length===0&&V.current.length>0,je=m.length===0&&z.current.length>0,Ae=ye?V.current:c,oe=je?z.current:m,H=Ae.map(sV).filter(Re=>!!Re),te=oe.filter(Re=>Re.payload.kind==="terminal").map(Re=>({id:Re.id,title:Re.title,cwd:Re.payload.kind==="terminal"?Re.payload.cwd:void 0})),Ne={mode:o,browserTabs:H,browserActiveId:ye?X.current:h,terminalTabs:te,terminalActiveId:je?G.current:y,browserCollapsed:ye,terminalCollapsed:je};try{localStorage.setItem(w3,JSON.stringify(Ne))}catch{}},[o,c,h,m,y]);const J=k.useCallback(ye=>n(ye),[]),fe=k.useCallback(()=>n(ye=>!ye),[]),Se=k.useCallback(()=>{window.markusDesktop?.browser?.hideAll?.()},[]),U=k.useCallback(ye=>{l(je=>je===ye?je:(ye==="terminal"&&Se(),ye))},[Se]),W=k.useCallback(ye=>{if(ye==="terminal"){if(Se(),l("terminal"),n(!0),m.length>0)return;if(z.current.length>0){const Re=z.current,$e=G.current&&Re.some(Q=>Q.id===G.current)?G.current:Re[0].id;f(Re),x($e),G.current=$e;return}const H=Is(),te=`term_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`;wi(te);const Ne={id:H,title:"Terminal",payload:{kind:"terminal",terminalId:te,title:"Terminal"}};z.current=[Ne],f([Ne]),x(Ne.id),G.current=Ne.id;return}if(l("browser"),n(!0),c.length>0)return;if(V.current.length>0){const H=V.current,te=X.current&&H.some(Ne=>Ne.id===X.current)?X.current:H[0].id;d(H),g(te),X.current=te;return}const je=Is(),Ae=`eb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`,oe={id:je,title:"New Tab",payload:{kind:"url",url:"about:blank",title:"New Tab",browserId:Ae}};V.current=[oe],d([oe]),g(oe.id),X.current=oe.id},[c.length,m.length,Se]),pe=k.useCallback(ye=>{const je=Zl(ye),Ae=Is();if(aV(ye)){ye.kind==="terminal"&&wi(ye.terminalId),l("terminal"),Se();const H=re.current,te=H.find($e=>Zl($e.payload)===je)??z.current.find($e=>Zl($e.payload)===je);let Ne,Re;if(te)Re=te.id,Ne=H.some($e=>$e.id===te.id)?H:wd([te,...H]);else{const $e={id:Ae,title:J2(ye),payload:ye};Ne=wd([$e,...H]),Re=Ae}z.current=Ne,re.current=Ne,f(Ne),x(Re),G.current=Re,ee.current=Re}else{l("browser");const H=q.current,te=H.find($e=>Zl($e.payload)===je)??V.current.find($e=>Zl($e.payload)===je);let Ne,Re;if(te)Re=te.id,Ne=H.some($e=>$e.id===te.id)?H:wd([te,...H]);else{const $e={id:Ae,title:J2(ye),payload:ye};Ne=wd([$e,...H]),Re=Ae}V.current=Ne,q.current=Ne,d(Ne),g(Re),X.current=Re,se.current=Re}n(!0)},[Se]),P=k.useCallback(ye=>{const je=q.current,Ae=je.findIndex(Z=>Z.id===ye);if(Ae>=0){const Z=je[Ae]?.payload,be=je.filter(M=>M.id!==ye),Ke=se.current,Ye=(je.some(M=>M.id===Ke)?Ke:je[0]?.id??null)===ye||be.length===0?be[Math.min(Ae,be.length-1)]?.id??null:void 0;V.current=be,q.current=be,d(be),be.length===0&&B.current==="browser"&&C(!1),Ye!==void 0&&(g(Ye),X.current=Ye,se.current=Ye),Wh(Z);return}const oe=re.current,H=oe.findIndex(Z=>Z.id===ye);if(H<0)return;const te=oe[H]?.payload,Ne=oe.filter(Z=>Z.id!==ye),Re=ee.current,Q=(oe.some(Z=>Z.id===Re)?Re:oe[0]?.id??null)===ye||Ne.length===0?Ne[Math.min(H,Ne.length-1)]?.id??null:void 0;z.current=Ne,re.current=Ne,f(Ne),Ne.length===0&&B.current==="terminal"&&C(!1),Q!==void 0&&(x(Q),G.current=Q,ee.current=Q),Yh(te)},[]),_e=k.useCallback(()=>{const ye=q.current.map(Ae=>Ae.payload),je=re.current.map(Ae=>Ae.payload);q.current=[],re.current=[],V.current=[],X.current=null,z.current=[],G.current=null,se.current=null,ee.current=null,d([]),f([]),g(null),x(null),C(!1);for(const Ae of ye)Wh(Ae);for(const Ae of je)Yh(Ae)},[]),He=k.useCallback(ye=>{B.current==="terminal"?(x(ye),G.current=ye):(g(ye),X.current=ye)},[]),Pe=k.useCallback((ye,je)=>{d(Ae=>{let oe=!1;const H=Ae.map(te=>{if(te.payload.kind!=="url"||te.payload.browserId!==ye)return te;const Ne=je.url??te.payload.url,Re=je.title||te.payload.title||Ne,$e=je.pageId??te.payload.pageId;return Ne===te.payload.url&&Re===(te.payload.title||te.title)&&$e===te.payload.pageId&&Re===te.title?te:(oe=!0,{...te,title:Re,payload:{...te.payload,url:Ne,title:Re,...$e!=null?{pageId:$e}:{}}})});return oe&&(V.current=H),oe?H:Ae})},[]),Ge=k.useCallback((ye,je)=>{f(Ae=>{let oe=!1;const H=Ae.map(te=>{if(te.payload.kind!=="terminal"||te.payload.terminalId!==ye)return te;const Ne=je.title||te.payload.title||te.title,Re=je.cwd??te.payload.cwd;return Ne===te.title&&Re===te.payload.cwd&&Ne===(te.payload.title||te.title)?te:(oe=!0,{...te,title:Ne,payload:{...te.payload,title:Ne,...Re!=null?{cwd:Re}:{}}})});return oe&&(z.current=H),oe?H:Ae})},[]),ct=k.useCallback(()=>{B.current==="terminal"?(f(ye=>ye.length===0?ye:(z.current=ye,ee.current&&(G.current=ee.current),[])),x(null)):(d(ye=>ye.length===0?ye:(V.current=ye,se.current&&(X.current=se.current),[])),g(null),Se()),C(!1)},[Se]),mt=k.useCallback(()=>{if(B.current==="terminal"&&m.length>0){if(l("browser"),c.length>0){n(!0);return}if(V.current.length>0){const $e=V.current,Q=X.current&&$e.some(Z=>Z.id===X.current)?X.current:$e[0].id;d($e),g(Q),X.current=Q,n(!0);return}const te=Is(),Ne=`eb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`,Re={id:te,title:"New Tab",payload:{kind:"url",url:"about:blank",title:"New Tab",browserId:Ne}};V.current=[Re],d([Re]),g(Re.id),X.current=Re.id,n(!0);return}const ye=Is(),je=`eb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`;let Ae,oe=!1,H=!1;l("browser"),d(te=>{if(te.length>0)return V.current=te,se.current&&(X.current=se.current),H=!0,Ae=null,[];if(V.current.length>0){oe=!0;const Re=V.current;return Ae=X.current&&Re.some(Q=>Q.id===X.current)?X.current:Re[0].id,Re}oe=!0;const Ne={id:ye,title:"New Tab",payload:{kind:"url",url:"about:blank",title:"New Tab",browserId:je}};return V.current=[Ne],Ae=Ne.id,[Ne]}),oe&&n(!0),H?(g(null),C(!1),Se()):Ae!=null&&(g(Ae),X.current=Ae)},[c.length,m.length,Se]),Ct=k.useCallback(()=>{if(B.current==="browser"&&c.length>0){if(l("terminal"),Se(),m.length>0){n(!0);return}if(z.current.length>0){const $e=z.current,Q=G.current&&$e.some(Z=>Z.id===G.current)?G.current:$e[0].id;f($e),x(Q),G.current=Q,n(!0);return}const te=Is(),Ne=`term_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`;wi(Ne);const Re={id:te,title:"Terminal",payload:{kind:"terminal",terminalId:Ne,title:"Terminal"}};z.current=[Re],f([Re]),x(Re.id),G.current=Re.id,n(!0);return}const ye=Is(),je=`term_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`;wi(je);let Ae,oe=!1,H=!1;l("terminal"),Se(),f(te=>{if(te.length>0)return z.current=te,ee.current&&(G.current=ee.current),H=!0,Ae=null,[];if(z.current.length>0){oe=!0;const Re=z.current;return Ae=G.current&&Re.some(Q=>Q.id===G.current)?G.current:Re[0].id,Re}oe=!0;const Ne={id:ye,title:"Terminal",payload:{kind:"terminal",terminalId:je,title:"Terminal"}};return z.current=[Ne],Ae=Ne.id,[Ne]}),oe&&n(!0),H?(x(null),C(!1)):Ae!=null&&(x(Ae),G.current=Ae)},[c.length,m.length,Se]),Mt=k.useCallback(ye=>{const je=B.current==="terminal"?m:c;if(je.length<2)return;const Ae=B.current==="terminal"?ee.current:se.current,H=(Math.max(0,je.findIndex(Ne=>Ne.id===Ae))+ye+je.length)%je.length,te=je[H].id;B.current==="terminal"?(x(te),G.current=te):(g(te),X.current=te)},[c,m]),Pt=k.useCallback(ye=>{const Ae=(B.current==="terminal"?m:c)[ye];Ae&&(B.current==="terminal"?(x(Ae.id),G.current=Ae.id):(g(Ae.id),X.current=Ae.id))},[c,m]),Kt=k.useCallback(()=>{if(B.current==="terminal"){const je=`term_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`;pe({kind:"terminal",terminalId:je,title:"Terminal"});return}const ye=`eb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`;pe({kind:"url",url:"about:blank",title:"New Tab",browserId:ye})},[pe]),yt=k.useCallback(ye=>{const je=re.current,Ae=je.findIndex($e=>$e.payload.kind==="terminal"&&$e.payload.terminalId===ye);if(Ae<0){Vh(ye),window.markusDesktop?.terminal?.destroy(ye);return}const oe=je[Ae];if(je.length>1){P(oe.id);return}Vh(ye),window.markusDesktop?.terminal?.destroy(ye);const H=`term_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`;wi(H);const te=oe.payload.kind==="terminal"&&(oe.payload.title||oe.title)||"Terminal",Ne=oe.payload.kind==="terminal"?oe.payload.cwd:void 0,Re={id:oe.id,title:te,payload:{kind:"terminal",terminalId:H,title:te,cwd:Ne}};z.current=[Re],f([Re]),x(Re.id),G.current=Re.id,B.current!=="terminal"&&l("terminal")},[P]),Ue=k.useCallback(ye=>C(ye),[]),dt=k.useCallback(()=>C(ye=>!ye),[]),Nt=o==="terminal"?m:c,bt=o==="terminal"?y:h,Lt=Nt.find(ye=>ye.id===bt)??Nt[0]??null,ue=Lt?.payload??null,tt=Nt.length>0,st=k.useMemo(()=>({leftCollapsed:t,setLeftCollapsed:J,toggleLeftCollapsed:fe,keyboardPane:E,setKeyboardPane:O,l0FocusPageId:L,setL0FocusPageId:F,rightPanelMode:o,setRightPanelMode:U,switchRightPanelMode:W,rightPanel:ue,rightPanelOpen:tt,rightPanelTabs:Nt,activeRightPanelTabId:Lt?.id??null,openRightPanel:pe,closeRightPanel:_e,closeRightPanelTab:P,setActiveRightPanelTab:He,updateRightPanelBrowserTab:Pe,updateRightPanelTerminalTab:Ge,toggleRightPanel:mt,toggleTerminalPanel:Ct,collapseRightPanelOnly:ct,cycleRightPanelTab:Mt,activateRightPanelTabAt:Pt,openNewRightPanelTab:Kt,handleTerminalExit:yt,rightPanelFullscreen:w,setRightPanelFullscreen:Ue,toggleRightPanelFullscreen:dt,hostAvailable:T,setHostAvailable:S}),[t,J,fe,E,O,L,F,o,U,W,ue,tt,Nt,Lt,pe,_e,P,He,Pe,Ge,mt,Ct,ct,Mt,Pt,Kt,yt,w,Ue,dt,T]);return s.jsx(k3.Provider,{value:st,children:e})}function Lc(){return k.useContext(k3)}function Jl(e,t){const n=/```[\s\S]*?```|`[^`\n]+`/g;let r=0,o="";for(const l of e.matchAll(n))o+=t(e.slice(r,l.index)),o+=l[0],r=l.index+l[0].length;return o+=t(e.slice(r)),o}function uV(e){let t=e.replace(/\\\[([\s\S]*?)\\\]/g,(n,r)=>`$$${r}$$`);return t=t.replace(/\\\((.+?)\\\)/g,(n,r)=>`$${r}$`),t}const kd="#mention:";function dV(e,t){if(!t||t.length===0)return e.replace(/@\[([^\]]+)\]|@([\w\p{L}\p{N}]+)/gu,(l,c,d)=>{const m=c??d;return`[@${m}](${kd}${encodeURIComponent(m)})`});const n=[...t].sort((l,c)=>c.length-l.length);let r="",o=0;for(;o<e.length;){const l=e.indexOf("@",o);if(l<0){r+=e.slice(o);break}if(r+=e.slice(o,l),e[l+1]==="["){const h=e.indexOf("]",l+2);if(h>l+2){const g=e.slice(l+2,h);r+=`[@${g}](${kd}${encodeURIComponent(g)})`,o=h+1;continue}}const c=e.slice(l+1),d=c.toLowerCase(),m=n.find(h=>d.startsWith(h.toLowerCase()));if(m){const h=c.slice(0,m.length);r+=`[@${h}](${kd}${encodeURIComponent(h)})`,o=l+1+m.length;continue}const f=c.match(/^([\w\p{L}\p{N}]+)/u);if(f){const h=f[1];r+=`[@${h}](${kd}${encodeURIComponent(h)})`,o=l+1+h.length;continue}r+="@",o=l+1}return r}const S3="#entity:",mV=new RegExp("(?<!\\[)(?<!\\()(?<!:)(?<!\\/)(?<!\\\\)\\b(tsk|req|proj|dlv|agt|team)_[a-f0-9]{6,}\\b(?!\\]\\(#entity:)","gi"),fV=/`\[([^\]]+)\]\(#entity:((?:tsk|req|proj|dlv|agt|team)_[a-f0-9]{6,})\)`/gi;function pV(e,t){const n=e.slice(0,t),r=n.lastIndexOf("](");return r===-1?!1:n.indexOf(")",r+2)===-1}function hV(e){return e.replace(fV,(t,n,r)=>`[${n}](${S3}${r})`)}function gV(e){return e.replace(mV,(t,n,r)=>pV(e,r)?t:`[${t}](${S3}${t})`)}function bV(e){const t=e.trim();return t.startsWith("@startuml")&&t.endsWith("@enduml")}const xV=/^(graph\s|flowchart\s|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt|pie|gitGraph|mindmap|timeline|journey)/m;function yV(e){return xV.test(e.trim())}const vV={js:"JavaScript",javascript:"JavaScript",ts:"TypeScript",typescript:"TypeScript",tsx:"TSX",jsx:"JSX",py:"Python",python:"Python",rb:"Ruby",ruby:"Ruby",rs:"Rust",rust:"Rust",go:"Go",java:"Java",kotlin:"Kotlin",swift:"Swift",cpp:"C++",c:"C",cs:"C#",csharp:"C#",php:"PHP",sql:"SQL",sh:"Shell",bash:"Bash",zsh:"Zsh",shell:"Shell",html:"HTML",css:"CSS",scss:"SCSS",less:"LESS",json:"JSON",yaml:"YAML",yml:"YAML",xml:"XML",toml:"TOML",ini:"INI",md:"Markdown",markdown:"Markdown",dockerfile:"Dockerfile",docker:"Dockerfile",graphql:"GraphQL",gql:"GraphQL",lua:"Lua",perl:"Perl",r:"R",scala:"Scala",elixir:"Elixir",erlang:"Erlang",haskell:"Haskell",clojure:"Clojure",dart:"Dart",zig:"Zig",nim:"Nim",powershell:"PowerShell",ps1:"PowerShell",vue:"Vue",svelte:"Svelte",plaintext:"Text",text:"Text",txt:"Text"};function wV(e){return vV[e.toLowerCase()]??e.charAt(0).toUpperCase()+e.slice(1)}function kV(e){const t=e.match(/language-(\S+)/);return t?t[1]:null}const N3=/^(?:\/|~\/|[A-Za-z]:[\\/]|\\\\)/,C3=/^\.{1,2}\//,SV=/\.[a-zA-Z0-9]{1,12}(?:$|[?#])/,T3=/^[A-Za-z]:[\\/]/,A3=/^\\\\[^\\]/;function E3(e){const t=e.trim();return t?!!(/^file:/i.test(t)||T3.test(t)||A3.test(t)||t.startsWith("~/")||t.startsWith("/")||C3.test(t)):!1}function Kg(e){let t=e.trim();if(/^file:/i.test(t)){try{t=decodeURIComponent(t.replace(/^file:\/\//i,""))}catch{t=t.replace(/^file:\/\//i,"")}/^\/[A-Za-z]:\//.test(t)&&(t=t.slice(1))}return t=t.replace(/\\+/g,"/"),t}function NV(e){return e.replace(/(!?\[[^\]]*]\()((?:[A-Za-z]:|\\\\)[^)\n]*)(\))/g,(t,n,r,o)=>`${n}${r.replace(/\\+/g,"/")}${o}`)}function _3(e){return e.trim().toLowerCase().replace(/[^\p{L}\p{N}\p{M}\s\-_]/gu,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function Sd(e,t){if(!e)return e;if(N3.test(e))return e.startsWith("~/")?e:e.replace(/\\/g,"/");if(!t)return e;const r=`${t.replace(/\\/g,"/").replace(/\/+$/,"")}/${e.replace(/^\.\//,"")}`,o=r.split("/"),l=[];for(const d of o)!d||d==="."||(d===".."?l.pop():l.push(d));const c=l.join("/");return r.startsWith("/")?`/${c}`.replace(/^\/+/,"/"):c}function e4(e){const t=e.indexOf("#");return t<0?{path:e}:{path:e.slice(0,t),fragment:decodeURIComponent(e.slice(t+1))}}function t4(e,t){if(!e)return{kind:"passthrough"};const n=e.trim();if(!n||n==="#")return{kind:"passthrough"};if(n.startsWith("#")&&!n.startsWith("#mention:")&&!n.startsWith("#entity:"))return{kind:"fragment",id:decodeURIComponent(n.slice(1))};if(T3.test(n)||A3.test(n)){const{path:l,fragment:c}=e4(n);return{kind:"file",path:Sd(l,t),fragment:c}}if(/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(n))return/^https?:\/\//i.test(n)||/^mailto:/i.test(n)?{kind:"external",url:n}:/^file:\/\//i.test(n)?{kind:"file",path:Kg(n)}:{kind:"passthrough"};const{path:r,fragment:o}=e4(n);return N3.test(r)?{kind:"file",path:Sd(r,t),fragment:o}:C3.test(r)?{kind:"file",path:Sd(r,t),fragment:o}:r&&SV.test(r)&&!r.includes("://")?{kind:"file",path:Sd(r,t),fragment:o}:{kind:"passthrough"}}function CV(e,t){if(!e||!t)return!1;let n=null;try{n=e.querySelector(`#${CSS.escape(t)}`)}catch{n=null}if(n||(n=e.querySelector(`[id="${t.replace(/"/g,'\\"')}"]`)),!n){const r=e.querySelectorAll("h1,h2,h3,h4,h5,h6");for(const o of r)if(_3(o.textContent||"")===t||o.id===t){n=o;break}}return n?(n.scrollIntoView({behavior:"smooth",block:"start"}),!0):!1}function j3(e){return e.type==="text"?e.value??"":(e.children??[]).map(j3).join("")}function M3(){return e=>{const t=new Map,n=r=>{if(r.type==="element"&&r.tagName&&/^h[1-6]$/.test(r.tagName)){const o=j3(r).trim();let l=_3(o);if(l){const c=t.get(l)??0;t.set(l,c+1),c>0&&(l=`${l}-${c}`),r.properties={...r.properties??{},id:l}}}for(const o of r.children??[])n(o)};n(e)}}function TV(e,t,n){const r=e.cloneNode(!0),o=n?.fontFamily??"-apple-system,BlinkMacSystemFont,'Segoe UI','Noto Sans',Helvetica,Arial,sans-serif",l=n?.fontSize??"15px",c=n?.headingScales??{h1:1.6,h2:1.35,h3:1.15,h4:1},d=t==="light"?{bg:"#ffffff",text:"#24292f",heading:"#1f2328",strong:"#1f2328",link:"#0969da",codeBg:"#eff1f3",codeText:"#24292f",preBg:"#f6f8fa",preText:"#24292f",preBorder:"#d0d7de",border:"#d0d7de",blockquoteBorder:"#d0d7de",blockquoteText:"#656d76",tableBorder:"#d0d7de",tableHeaderBg:"#f6f8fa",tableHeaderText:"#24292f",hrColor:"#d8dee4"}:{bg:"#0d1117",text:"#e6edf3",heading:"#f0f6fc",strong:"#f0f6fc",link:"#58a6ff",codeBg:"#161b22",codeText:"#e6edf3",preBg:"#161b22",preText:"#e6edf3",preBorder:"#30363d",border:"#30363d",blockquoteBorder:"#3b82f6",blockquoteText:"#8b949e",tableBorder:"#30363d",tableHeaderBg:"#161b22",tableHeaderText:"#e6edf3",hrColor:"#21262d"},m={p:`margin:0 0 10px;color:${d.text};line-height:1.7;`,h1:`font-size:${c.h1}em;font-weight:700;color:${d.heading};margin:20px 0 10px;line-height:1.3;border-bottom:1px solid ${d.border};padding-bottom:6px;`,h2:`font-size:${c.h2}em;font-weight:700;color:${d.heading};margin:18px 0 8px;line-height:1.3;`,h3:`font-size:${c.h3}em;font-weight:600;color:${d.heading};margin:14px 0 6px;line-height:1.3;`,h4:`font-size:${c.h4}em;font-weight:600;color:${d.heading};margin:12px 0 4px;`,strong:`font-weight:600;color:${d.strong};`,em:"font-style:italic;",a:`color:${d.link};text-decoration:underline;`,ul:"padding-left:1.5em;margin:0 0 10px;",ol:"padding-left:1.5em;margin:0 0 10px;",li:`margin:3px 0;line-height:1.7;color:${d.text};`,blockquote:`border-left:3px solid ${d.blockquoteBorder};padding:2px 0 2px 14px;margin:10px 0;color:${d.blockquoteText};`,hr:`border:none;border-top:1px solid ${d.hrColor};margin:20px 0;`,table:"border-collapse:collapse;width:100%;margin:10px 0;",thead:`background:${d.tableHeaderBg};`,th:`border:1px solid ${d.tableBorder};padding:8px 12px;text-align:left;font-weight:600;color:${d.tableHeaderText};`,td:`border:1px solid ${d.tableBorder};padding:8px 12px;color:${d.text};`,img:"max-width:100%;height:auto;"};function f(h){h.removeAttribute("class");const g=h.tagName.toLowerCase();if(g==="pre"){h.setAttribute("style",`background:${d.preBg};color:${d.preText};padding:14px;border-radius:6px;overflow-x:auto;margin:10px 0;font-size:0.88em;line-height:1.5;border:1px solid ${d.preBorder};`);const y=h.querySelector("code");y&&(y.removeAttribute("class"),y.setAttribute("style","background:transparent;padding:0;border-radius:0;color:inherit;font-family:'SFMono-Regular',Consolas,'Liberation Mono',Menlo,monospace;font-size:inherit;"));return}g==="code"?h.setAttribute("style",`background:${d.codeBg};color:${d.codeText};padding:2px 6px;border-radius:4px;font-size:0.9em;font-family:'SFMono-Regular',Consolas,'Liberation Mono',Menlo,monospace;`):m[g]&&h.setAttribute("style",m[g]),Array.from(h.children).forEach(f)}return r.removeAttribute("class"),Array.from(r.children).forEach(h=>f(h)),`<div style="background:${d.bg};color:${d.text};padding:20px 24px;font-family:${o};font-size:${l};line-height:1.7;max-width:800px;">${r.innerHTML}</div>`}async function Wg(e){try{return await navigator.clipboard.writeText(e),!0}catch{try{const t=document.createElement("textarea");t.value=e,t.style.cssText="position:fixed;left:-9999px;top:-9999px;opacity:0",document.body.appendChild(t),t.select();const n=document.execCommand("copy");return document.body.removeChild(t),n}catch{return!1}}}async function AV(e,t,n,r){const o=TV(e,t,r);try{return await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([o],{type:"text/html"}),"text/plain":new Blob([n],{type:"text/plain"})})]),{ok:!0,method:"html"}}catch{return{ok:await Wg(n),method:"text"}}}const R3="markus-copy-typography",n4={fontFamily:"default",fontSize:15,headingScale:"standard"};function L3(){try{const e=localStorage.getItem(R3);if(e)return{...n4,...JSON.parse(e)}}catch{}return n4}function EV(e){localStorage.setItem(R3,JSON.stringify(e))}function _V(e){const t={default:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif",serif:"Georgia, 'Times New Roman', Times, serif","sans-serif":"-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif",mono:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace"},n={compact:{h1:1.3,h2:1.15,h3:1.05,h4:1},standard:{h1:1.6,h2:1.35,h3:1.15,h4:1},large:{h1:2,h2:1.6,h3:1.3,h4:1.1}};return{fontFamily:t[e.fontFamily]??t.default,fontSize:`${e.fontSize}px`,headingScales:n[e.headingScale]??n.standard}}function jV({onClose:e}){const{t}=ft("common"),[n,r]=k.useState(L3);k.useEffect(()=>{EV(n)},[n]);const o=k.useCallback((l,c)=>{r(d=>({...d,[l]:c}))},[]);return s.jsxs("div",{className:"px-3 py-2 space-y-3 max-w-[260px]",children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsx("span",{className:"font-medium text-fg-primary text-xs",children:t("markdown.typographySettings")}),s.jsx("button",{onClick:e,className:"text-fg-tertiary hover:text-fg-primary p-0.5",children:s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsx("p",{className:"text-[10px] text-fg-tertiary",children:t("markdown.typographyDesc")}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:t("markdown.fontFamily")}),s.jsxs("select",{value:n.fontFamily,onChange:l=>o("fontFamily",l.target.value),className:"w-full px-2 py-1 text-xs rounded bg-surface-primary border border-border-subtle text-fg-secondary focus:outline-none focus:ring-1 focus:ring-brand-500/50",children:[s.jsx("option",{value:"default",children:t("markdown.fontDefault")}),s.jsx("option",{value:"serif",children:t("markdown.fontSerif")}),s.jsx("option",{value:"sans-serif",children:t("markdown.fontSansSerif")}),s.jsx("option",{value:"mono",children:t("markdown.fontMono")})]})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:[t("markdown.fontSize"),": ",n.fontSize,"px"]}),s.jsx("input",{type:"range",min:10,max:24,step:1,value:n.fontSize,onChange:l=>o("fontSize",Number(l.target.value)),className:"w-full h-1 rounded-full appearance-none bg-border-subtle [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-brand-500"}),s.jsxs("div",{className:"flex justify-between text-[9px] text-fg-tertiary mt-0.5",children:[s.jsx("span",{children:"10px"}),s.jsx("span",{children:"24px"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:t("markdown.headingScale")}),s.jsx("div",{className:"flex gap-1",children:["compact","standard","large"].map(l=>s.jsx("button",{onClick:()=>o("headingScale",l),className:`flex-1 px-2 py-1 rounded text-[10px] font-medium transition-colors ${n.headingScale===l?"bg-brand-600/20 text-brand-500":"bg-surface-primary text-fg-tertiary hover:text-fg-secondary border border-border-subtle"}`,children:t(`markdown.scale${l.charAt(0).toUpperCase()+l.slice(1)}`)},l))})]})]})}class MV extends k.Component{state={error:null};static getDerivedStateFromError(t){return{error:t}}componentDidUpdate(t){this.state.error&&this.props.resetKeys&&!RV(t.resetKeys,this.props.resetKeys)&&this.setState({error:null})}componentDidCatch(t,n){this.props.onError?.(t,n),console.error("[ErrorBoundary] caught render error:",t,n.componentStack)}reset=()=>this.setState({error:null});render(){const{error:t}=this.state;if(t){const{fallback:n}=this.props;return typeof n=="function"?n(t,this.reset):n??null}return this.props.children}}function RV(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}const LV=k.lazy(()=>Gr(()=>Promise.resolve().then(()=>G3),void 0).then(e=>({default:e.MarkdownMessage}))),OV={file:{icon:"📄",color:"bg-green-500/10 text-green-600"},directory:{icon:"📁",color:"bg-blue-500/10 text-blue-600"}},r4={active:{color:"text-green-600 bg-green-500/10"},verified:{color:"text-blue-600 bg-blue-500/10"},outdated:{color:"text-fg-tertiary bg-surface-elevated/50"}};function DV({item:e,onClose:t,onOpenInPage:n}){const{t:r}=ft(["agent","common"]),o=OV[e.type]??{icon:"📎",color:"bg-surface-elevated text-fg-secondary"},l=r4[e.status]??r4.active,c=/^https?:\/\//i.test(e.reference??"");k.useEffect(()=>{const m=f=>{f.key==="Escape"&&t()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[t]);const d=s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",onClick:t,children:[s.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm"}),s.jsxs("div",{className:"relative bg-surface-primary rounded-2xl shadow-2xl border border-border-default w-full max-w-lg max-h-[85vh] overflow-y-auto",onClick:m=>m.stopPropagation(),children:[s.jsxs("div",{className:"sticky top-0 bg-surface-primary/95 backdrop-blur-sm border-b border-border-default px-5 py-4 flex items-start gap-3 rounded-t-2xl z-10",children:[s.jsx("span",{className:`inline-flex items-center justify-center w-10 h-10 rounded-xl text-lg shrink-0 ${o.color}`,children:o.icon}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-semibold text-fg-primary",children:e.title}),s.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[s.jsx("span",{className:`px-1.5 py-0.5 text-[10px] rounded font-medium ${l.color}`,children:e.status}),s.jsx("span",{className:"text-[10px] text-fg-tertiary",children:e.type}),e.format&&s.jsx("span",{className:"text-[10px] px-1.5 py-0.5 bg-surface-elevated rounded text-fg-secondary",children:e.format})]})]}),s.jsx("button",{onClick:t,className:"p-1.5 rounded-lg hover:bg-surface-overlay transition-colors shrink-0 text-fg-tertiary hover:text-fg-primary",children:s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),s.jsxs("div",{className:"px-5 py-4 space-y-4",children:[e.summary&&e.summary.trim()!==e.title.trim()&&s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:r("agent:deliverables.summary")}),s.jsx("div",{className:"mt-1.5",children:s.jsx(k.Suspense,{fallback:s.jsx("p",{className:"text-sm text-fg-secondary",children:e.summary}),children:s.jsx(LV,{content:e.summary,className:"text-sm text-fg-secondary"})})})]}),e.reference&&s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider font-medium",children:r("agent:deliverables.reference")}),s.jsxs("div",{className:"mt-1.5 flex items-center gap-2 bg-surface-elevated rounded-lg px-3 py-2",children:[s.jsx("span",{className:"text-xs text-fg-secondary font-mono break-all flex-1 select-all",children:e.reference}),c?s.jsx("button",{onClick:()=>window.open(e.reference,"_blank","noopener,noreferrer"),className:"px-2 py-1 text-[10px] rounded bg-brand-600/20 text-brand-500 hover:bg-brand-600/30 transition-colors shrink-0",children:r("common:open")}):s.jsx("button",{onClick:()=>{Ee.files.reveal(e.reference).catch(()=>{})},className:"px-2 py-1 text-[10px] rounded bg-brand-600/20 text-brand-500 hover:bg-brand-600/30 transition-colors shrink-0",children:r("common:open")})]})]}),e.diffStats&&s.jsxs("div",{className:"flex items-center gap-3 text-xs bg-surface-elevated rounded-lg px-3 py-2",children:[s.jsx("span",{className:"text-fg-tertiary font-medium",children:"Diff:"}),s.jsxs("span",{className:"text-fg-secondary",children:[e.diffStats.filesChanged," file",e.diffStats.filesChanged!==1?"s":""]}),s.jsxs("span",{className:"text-green-500",children:["+",e.diffStats.additions]}),s.jsxs("span",{className:"text-red-500",children:["-",e.diffStats.deletions]})]}),e.testResults&&s.jsxs("div",{className:"flex items-center gap-3 text-xs bg-surface-elevated rounded-lg px-3 py-2",children:[s.jsx("span",{className:"text-fg-tertiary font-medium",children:"Tests:"}),s.jsxs("span",{className:"text-green-500",children:[e.testResults.passed," passed"]}),e.testResults.failed>0&&s.jsxs("span",{className:"text-red-500",children:[e.testResults.failed," failed"]}),e.testResults.skipped>0&&s.jsxs("span",{className:"text-fg-tertiary",children:[e.testResults.skipped," skipped"]})]}),e.tags.length>0&&s.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.tags.map(m=>s.jsx("span",{className:"px-2 py-0.5 text-[11px] bg-surface-elevated rounded-md text-fg-tertiary",children:m},m))}),s.jsxs("div",{className:"flex items-center gap-4 text-[10px] text-fg-tertiary flex-wrap pt-1 border-t border-border-default/50",children:[s.jsxs("span",{children:[r("agent:deliverables.created"),": ",new Date(e.createdAt).toLocaleString()]}),s.jsxs("span",{children:[r("agent:deliverables.updated"),": ",new Date(e.updatedAt).toLocaleString()]}),e.accessCount>0&&s.jsx("span",{children:r("agent:deliverables.accessed",{count:e.accessCount})})]})]}),s.jsxs("div",{className:"sticky bottom-0 bg-surface-primary/95 backdrop-blur-sm border-t border-border-default px-5 py-3 flex items-center justify-end gap-2 rounded-b-2xl",children:[s.jsxs("button",{onClick:()=>n(e.id),className:"px-3 py-1.5 text-xs font-medium text-brand-500 hover:bg-brand-500/10 rounded-lg transition-colors flex items-center gap-1.5",children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),s.jsx("polyline",{points:"15 3 21 3 21 9"}),s.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),r("agent:deliverables.openInPage")]}),s.jsx("button",{onClick:t,className:"px-3 py-1.5 text-xs font-medium text-fg-secondary bg-surface-elevated hover:bg-surface-overlay rounded-lg transition-colors",children:r("common:close")})]})]})]});return typeof document<"u"?Sa.createPortal(d,document.body):d}const IV={tsk:"task",req:"requirement",proj:"project",dlv:"deliverable",agt:"agent",team:"team"};function O3(e){return{task:"task",requirement:"requirement",project:"project",deliverable:"deliverable",agent:"agent",team:"team"}[e]}const D3={task:"📋",requirement:"📝",project:"📁",deliverable:"📦",agent:"🤖",team:"👥"},I3={task:"Task",requirement:"Requirement",project:"Project",deliverable:"Deliverable",agent:"Agent",team:"Team"},PV=/^(tsk|req|proj|dlv|agt|team)_[a-f0-9]{6,}$/i;function b0(e){return PV.test(e.trim())}function zV(e){const t=e.split("_")[0]?.toLowerCase();return t?IV[t]:void 0}function P3(e){e.startsWith("tsk_")?it.navigate(de.WORK,{openTask:e}):e.startsWith("req_")?it.navigate(de.WORK,{openRequirement:e}):e.startsWith("proj_")?it.navigate(de.WORK,{projectId:e}):e.startsWith("dlv_")?it.navigate(de.DELIVERABLES,{openDeliverable:e}):e.startsWith("agt_")?it.navigate(de.TEAM,{agentId:e}):e.startsWith("team_")&&it.navigate(de.TEAM,{selectTeam:e})}const Qp=new Map,Nd=new Map;async function BV(e,t){const n={id:e,type:t,title:e,loading:!1};try{switch(t){case"task":{const r=await Ee.tasks.get(e);return{...n,title:r.task.title,status:r.task.status}}case"requirement":{const r=await Ee.requirements.get(e);return{...n,title:r.requirement.title,status:r.requirement.status}}case"project":{const r=await Ee.projects.get(e);return{...n,title:r.project.name,status:r.project.status,summary:r.project.description}}case"deliverable":{const r=await Ee.deliverables.get(e);return{...n,title:r.deliverable.title,status:r.deliverable.status,summary:r.deliverable.summary,deliverable:r.deliverable}}case"agent":{const r=await Ee.agents.get(e);return{...n,title:r.name,summary:r.role}}case"team":{const o=(await Ee.teams.list()).teams.find(l=>l.id===e);return{...n,title:o?.name??e,notFound:!o}}}}catch{}return{...n,notFound:!0}}function z3(e,t){const n=t??zV(e),[r,o]=k.useState(()=>Qp.get(e)??{id:e,type:n??"task",title:e,loading:!!n});return k.useEffect(()=>{if(!n){o({id:e,type:"task",title:e,loading:!1,notFound:!0});return}const l=Qp.get(e);if(l){o(l);return}o(m=>({...m,type:n,loading:!0}));let c=!0,d=Nd.get(e);return d||(d=BV(e,n),Nd.set(e,d)),d.then(m=>{Qp.set(e,m),Nd.delete(e),c&&o(m)}).catch(()=>{Nd.delete(e),c&&o({id:e,type:n,title:e,loading:!1,notFound:!0})}),()=>{c=!1}},[e,n]),r}function B3(e){const t=(e.split("_")[0]?.length??3)+1;return e.length>t+8?`${e.slice(0,t+8)}…`:e}function lc({id:e,type:t,label:n}){const r=z3(e,t),o=Lc(),l=D3[r.type]??"🔗",c=n??(r.loading||r.notFound?B3(e):r.title),d=m=>{if(m.preventDefault(),m.stopPropagation(),r.type==="deliverable"&&r.deliverable&&o?.hostAvailable){o.openRightPanel({kind:"deliverable",deliverable:r.deliverable});return}P3(e)};return s.jsxs("span",{"data-entity-link":e,className:"inline-flex items-center gap-0.5 px-1 py-0.5 rounded bg-brand-500/10 text-brand-500 text-xs font-medium cursor-pointer hover:bg-brand-500/20 transition-colors align-baseline",onClick:d,title:`${I3[r.type]}: ${r.notFound?e:r.title} (${e})`,children:[s.jsx("span",{className:"text-[10px]",children:l}),s.jsx("span",{className:"truncate max-w-[240px] align-baseline",children:c})]})}function $V({id:e,type:t,label:n}){const r=z3(e,t),[o,l]=k.useState(!1),c=Lc(),d=D3[r.type]??"🔗",m=()=>{if(r.type==="deliverable"&&r.deliverable){if(c?.hostAvailable){c.openRightPanel({kind:"deliverable",deliverable:r.deliverable});return}l(!0);return}P3(e)},f=r.loading?B3(e):n||(r.notFound?e:r.title);return s.jsxs("span",{className:"not-prose block my-2",children:[s.jsxs("button",{type:"button",onClick:m,className:"w-full max-w-md text-left rounded-xl border border-border-default bg-surface-elevated/30 hover:border-brand-500/40 hover:bg-surface-elevated/50 transition-colors px-3 py-2.5 flex items-start gap-2.5",children:[s.jsx("span",{className:"inline-flex items-center justify-center w-8 h-8 rounded-lg text-sm shrink-0 bg-brand-500/10",children:d}),s.jsxs("span",{className:"flex-1 min-w-0 block",children:[s.jsxs("span",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-[10px] uppercase tracking-wide text-fg-tertiary font-medium",children:I3[r.type]}),r.status&&s.jsx("span",{className:"px-1.5 py-0.5 text-[10px] rounded font-medium bg-brand-500/10 text-brand-500",children:r.status})]}),s.jsx("span",{className:`block text-sm font-medium truncate mt-0.5 ${r.notFound?"font-mono text-fg-tertiary":"text-fg-primary"}`,children:f}),r.summary&&r.summary.trim()!==r.title.trim()&&s.jsx("span",{className:"block text-xs text-fg-tertiary mt-0.5 line-clamp-1",children:r.summary})]}),s.jsx("svg",{className:"w-4 h-4 text-fg-tertiary shrink-0 mt-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),o&&r.deliverable&&s.jsx(DV,{item:r.deliverable,onClose:()=>l(!1),onOpenInPage:h=>{l(!1),it.navigate(de.DELIVERABLES,{openDeliverable:h})}})]})}k.lazy(()=>Gr(()=>Promise.resolve().then(()=>G3),void 0).then(e=>({default:e.MarkdownMessage})));const HV=k.lazy(()=>Gr(()=>import("./ContentRenderer-Bb_drUpO.js"),[]).then(e=>({default:e.ContentRenderer})));let No=[],a4=60;function UV(e){const t=k.useRef(e);t.current=e;const[n]=k.useState(()=>++a4);return k.useEffect(()=>{const r=()=>t.current();No.push(r);const o=l=>{l.key==="Escape"&&No[No.length-1]===r&&(l.preventDefault(),r())};return window.addEventListener("keydown",o,!0),()=>{window.removeEventListener("keydown",o,!0),No=No.filter(l=>l!==r),No.length===0&&(a4=60)}},[]),n}const s4=500,$s=new Map,x0=new Set,qd=new Map;let Gd=null;function FV(){if($s.size<=s4)return;const e=$s.size-s4,t=$s.keys();for(let n=0;n<e;n++){const{value:r,done:o}=t.next();if(o)break;$s.delete(r)}}function i4(e,t){$s.delete(e),$s.set(e,t),FV()}function o4(e){const t=qd.get(e);if(t)for(const n of t)n()}function qV(){Gd=null;const e=[...x0];x0.clear(),e.length!==0&&Ee.files.check(e).then(({results:t})=>{for(const[n,r]of Object.entries(t))i4(n,r),o4(n)}).catch(()=>{for(const t of e)i4(t,{exists:!1,isFile:!1,type:"unknown"}),o4(t)})}function GV(e){$s.has(e)||x0.has(e)||(x0.add(e),Gd&&clearTimeout(Gd),Gd=setTimeout(qV,30))}function VV(e,t){let n=qd.get(e);return n||(n=new Set,qd.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&qd.delete(e)}}function KV(e){const t=k.useCallback(o=>VV(e,o),[e]),n=k.useCallback(()=>$s.get(e),[e]),r=k.useSyncExternalStore(t,n,n);return k.useEffect(()=>{GV(e)},[e]),r}const WV=/^(?:\/[\w.\-@+]+(?:\/[\w.\-@+ ]*)*|~\/[\w.\-@+]+(?:\/[\w.\-@+ ]*)*|[A-Za-z]:(?:\\|\/)[\w.\-@+ ]+(?:(?:\\|\/)[\w.\-@+ ]*)*|\.\.?\/[\w.\-@+]+(?:\/[\w.\-@+ ]*)*)$/;function YV(e){return e.length<2||e.length>500?!1:WV.test(e)}function XV({filePath:e,onClose:t}){const n=UV(t),[r,o]=k.useState(!0),[l,c]=k.useState(null),[d,m]=k.useState(""),[f,h]=k.useState(""),[g,y]=k.useState(""),[x,w]=k.useState(""),[C,T]=k.useState("");k.useEffect(()=>{o(!0),c(null),Ee.files.preview(e).then(E=>{m(typeof E.content=="string"?E.content:""),h(E.type),y(E.name),w(E.mimeType||""),T(E.streamUrl||(E.path?Ee.files.streamUrl(E.path):"")||(E.type==="audio"||E.type==="video"?Ee.files.streamUrl(e):""))}).catch(E=>{c(String(E?.message||E))}).finally(()=>{o(!1)})},[e]);const S=g||e.split(/[/\\]/).pop()||e;return Sa.createPortal(s.jsx("div",{className:"fixed inset-0 bg-black/40 flex items-center justify-center",style:{zIndex:n},onClick:t,children:s.jsxs("div",{className:"bg-surface-secondary border border-border-default rounded-xl shadow-2xl w-[90vw] max-w-3xl max-h-[85vh] flex flex-col overflow-hidden",onClick:E=>E.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-default bg-surface-elevated/50 shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("svg",{className:"w-4 h-4 shrink-0 text-fg-secondary",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z",clipRule:"evenodd"})}),s.jsx("span",{className:"text-sm font-medium text-fg-primary truncate",children:S}),s.jsx("span",{className:"text-xs text-fg-tertiary truncate hidden sm:inline",children:e})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx("button",{className:"text-xs text-fg-secondary hover:text-fg-primary px-2 py-1 rounded hover:bg-surface-elevated transition-colors",onClick:()=>Ee.files.reveal(e),title:"Reveal in file explorer",children:s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{d:"M4.5 17a2.5 2.5 0 01-2.5-2.5v-9A2.5 2.5 0 014.5 3h3.672a1.5 1.5 0 011.06.44L10.56 4.77a.5.5 0 00.354.147H15.5A2.5 2.5 0 0118 7.417v7.083A2.5 2.5 0 0115.5 17h-11z"})})}),s.jsx("button",{className:"text-fg-secondary hover:text-fg-primary p-1 rounded hover:bg-surface-elevated transition-colors",onClick:t,children:s.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[r&&s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx("div",{className:"w-5 h-5 border-2 border-brand-500/30 border-t-brand-500 rounded-full animate-spin"})}),l&&s.jsxs("div",{className:"text-center py-12 text-fg-secondary text-sm",children:[s.jsx("p",{className:"text-red-400 mb-1",children:"Failed to load file"}),s.jsx("p",{className:"text-xs text-fg-tertiary",children:l})]}),!r&&!l&&f==="image"&&d&&s.jsx("div",{className:"flex justify-center",children:s.jsx("img",{src:`data:${x||"image/png"};base64,${d}`,alt:S,className:"max-w-full rounded"})}),!r&&!l&&f==="audio"&&C&&s.jsx("audio",{controls:!0,preload:"metadata",src:C,className:"w-full"}),!r&&!l&&f==="video"&&C&&s.jsx("video",{controls:!0,preload:"metadata",src:C,className:"w-full max-h-[60vh] rounded-lg bg-black"}),!r&&!l&&(f==="binary"||!d&&f!=="image"&&f!=="audio"&&f!=="video")&&s.jsxs("div",{className:"text-center py-8 space-y-3",children:[s.jsx("p",{className:"text-sm text-fg-secondary",children:"This file type cannot be previewed."}),s.jsx("button",{className:"px-3 py-2 text-xs rounded-lg bg-brand-600/20 text-brand-500 hover:bg-brand-600/30 transition-colors",onClick:()=>{Ee.files.reveal(e)},children:"Reveal in file explorer"})]}),!r&&!l&&d&&f!=="image"&&f!=="audio"&&f!=="video"&&f!=="binary"&&s.jsx(k.Suspense,{fallback:s.jsx("div",{className:"text-xs text-fg-tertiary",children:"Loading…"}),children:s.jsx(HV,{content:d,format:f==="text"?"text":f,className:"text-sm"})})]})]})}),document.body)}function QV({path:e}){const t=KV(e),[n,r]=k.useState(null),o=Lc(),l=t?.exists??!1,c=t?.type==="markdown"||t?.type==="html"||t?.type==="json"||t?.type==="text"||t?.type==="image"||t?.type==="audio"||t?.type==="video",d=k.useCallback(h=>{if(h.preventDefault(),h.stopPropagation(),!!l)if(c){if(o?.hostAvailable){o.openRightPanel({kind:"file",path:e});return}r(e)}else Ee.files.reveal(e)},[l,c,e,o]),m="inline w-3 h-3 align-[-0.125em]",f=c?s.jsx("svg",{className:m,viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z",clipRule:"evenodd"})}):s.jsx("svg",{className:m,viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z",clipRule:"evenodd"})});return t?l?s.jsxs(s.Fragment,{children:[s.jsxs("code",{className:"bg-brand-500/10 px-1.5 py-0.5 rounded text-xs font-mono text-brand-500 cursor-pointer hover:bg-brand-500/20 transition-colors border border-brand-500/20 hover:border-brand-500/40 break-all",onClick:d,title:c?"Click to preview":"Click to reveal in file explorer",role:"button",tabIndex:0,children:[s.jsxs("span",{className:"whitespace-nowrap",children:[f,e.charAt(0)]}),e.slice(1)]}),n&&s.jsx(XV,{filePath:n,onClose:()=>r(null)})]}):s.jsx("code",{className:"bg-surface-secondary/50 px-1.5 py-0.5 rounded text-xs font-mono text-fg-tertiary border border-border-default/30 line-through decoration-fg-tertiary/30 break-all",title:"File not found",children:e}):s.jsx("code",{className:"bg-surface-secondary px-1.5 py-0.5 rounded text-xs font-mono text-fg-secondary break-all",children:e})}let Zp=null;function ZV(){return Zp||(Zp=Gr(()=>import("./mermaid.core-N5tL3hIv.js").then(e=>e.b9),__vite__mapDeps([0,1])).then(e=>(e.default.initialize({startOnLoad:!1,securityLevel:"loose",fontFamily:"inherit"}),e))),Zp}function JV(){const e=document.documentElement;return e.classList.contains("light")?!1:e.classList.contains("dark")||e.classList.contains("cyberpunk")||e.classList.contains("mono")?!0:!window.matchMedia("(prefers-color-scheme: light)").matches}function eK(e){const t=window.matchMedia("(prefers-color-scheme: dark)");t.addEventListener("change",e);const n=new MutationObserver(e);return n.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>{t.removeEventListener("change",e),n.disconnect()}}function tK(){return JV()}function nK(){return k.useSyncExternalStore(eK,tK)}function $3({code:e}){const t=k.useRef(null),[n,r]=k.useState(null),[o,l]=k.useState(!0),c=k.useId(),d=k.useRef(0),m=k.useRef(null),f=nK();return k.useEffect(()=>{if(!e.trim()||m.current&&m.current.code===e&&m.current.dark===f)return;let h=!1;return l(!0),r(null),d.current+=1,(async()=>{try{const g=await ZV();if(h)return;g.default.initialize({startOnLoad:!1,theme:f?"dark":"default",securityLevel:"loose",fontFamily:"inherit"});const y=`mermaid-${c.replace(/:/g,"")}-${d.current}`,{svg:x}=await g.default.render(y,e.trim());if(h)return;t.current&&(t.current.innerHTML=x,m.current={code:e,dark:f})}catch(g){h||r(g instanceof Error?g.message:String(g))}finally{h||l(!1)}})(),()=>{h=!0}},[e,c,f]),n?s.jsxs("div",{className:"my-2 rounded-lg overflow-hidden border border-red-500/30",children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-500/10 border-b border-red-500/20",children:[s.jsx("svg",{className:"w-3.5 h-3.5 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})}),s.jsx("span",{className:"text-[10px] font-medium text-red-400",children:"Mermaid render error"})]}),s.jsx("pre",{className:"p-3 bg-surface-secondary text-xs text-fg-secondary overflow-x-auto font-mono",children:e})]}):s.jsxs("div",{className:"not-prose my-2 rounded-lg bg-surface-secondary border border-border-subtle p-4 overflow-x-auto",children:[o&&s.jsxs("div",{className:"flex items-center gap-2 text-xs text-fg-tertiary",children:[s.jsx("div",{className:"w-4 h-4 border-2 border-fg-tertiary/30 border-t-fg-tertiary rounded-full animate-spin"}),"Rendering diagram…"]}),s.jsx("div",{ref:t,className:`flex justify-center [&>svg]:max-w-full${o?" hidden":""}`})]})}const rK="/assets/viz-global-C_AyN6D9.js";let Cd=!1,Jp=null;function aK(){return Cd?Promise.resolve():new Promise((e,t)=>{const n=document.querySelector("script[data-plantuml-viz]");if(n){globalThis.Viz?(Cd=!0,e()):(n.addEventListener("load",()=>{Cd=!0,e()}),n.addEventListener("error",()=>t(new Error("Failed to load viz-global.js"))));return}const r=document.createElement("script");r.setAttribute("data-plantuml-viz",""),r.src=rK,r.onload=()=>{Cd=!0,e()},r.onerror=()=>t(new Error("Failed to load viz-global.js")),document.head.appendChild(r)})}function sK(){return Jp||(Jp=aK().then(()=>Gr(()=>import("./plantuml-DezRDxd4.js"),[]))),Jp}let l4=Promise.resolve();function iK(e,t){const n=l4.then(()=>new Promise((r,o)=>{sK().then(({renderToString:l})=>{const c=e.split(/\r\n|\r|\n/);l(c,r,o,{dark:t})}).catch(o)}));return l4=n.then(()=>{},()=>{}),n}function oK(){const e=document.documentElement;return e.classList.contains("light")?!1:e.classList.contains("dark")||e.classList.contains("cyberpunk")||e.classList.contains("mono")?!0:!window.matchMedia("(prefers-color-scheme: light)").matches}function lK(e){const t=window.matchMedia("(prefers-color-scheme: dark)");t.addEventListener("change",e);const n=new MutationObserver(e);return n.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>{t.removeEventListener("change",e),n.disconnect()}}function cK(){return k.useSyncExternalStore(lK,()=>oK())}function H3({code:e}){const[t,n]=k.useState(null),[r,o]=k.useState(null),[l,c]=k.useState(!0),d=k.useRef(null),m=cK();return k.useEffect(()=>{if(!e.trim()||d.current&&d.current.code===e&&d.current.dark===m)return;let f=!1;return c(!0),o(null),iK(e.trim(),m).then(h=>{f||(n(h),d.current={code:e,dark:m})}).catch(h=>{f||o(h instanceof Error?h.message:String(h))}).finally(()=>{f||c(!1)}),()=>{f=!0}},[e,m]),r?s.jsxs("div",{className:"my-2 rounded-lg overflow-hidden border border-red-500/30",children:[s.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-500/10 border-b border-red-500/20",children:[s.jsx("svg",{className:"w-3.5 h-3.5 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})}),s.jsx("span",{className:"text-[10px] font-medium text-red-400",children:"PlantUML render error"})]}),s.jsx("pre",{className:"p-3 bg-surface-secondary text-xs text-fg-secondary overflow-x-auto font-mono",children:e})]}):s.jsxs("div",{className:"not-prose my-2 rounded-lg bg-surface-secondary border border-border-subtle p-4 overflow-x-auto",children:[l&&s.jsxs("div",{className:"flex items-center gap-2 text-xs text-fg-tertiary",children:[s.jsx("div",{className:"w-4 h-4 border-2 border-fg-tertiary/30 border-t-fg-tertiary rounded-full animate-spin"}),"Rendering diagram…"]}),t&&s.jsx("div",{className:`flex justify-center [&>svg]:max-w-full${l?" hidden":""}`,dangerouslySetInnerHTML:{__html:t}})]})}function Xh({code:e,language:t,children:n}){const{t:r}=ft("common"),[o,l]=k.useState("rendered"),[c,d]=k.useState(!1),m=k.useCallback(async()=>{await Wg(e)&&(d(!0),setTimeout(()=>d(!1),1800))},[e]);return s.jsxs("div",{className:"not-prose my-2 rounded-lg overflow-hidden border border-border-subtle",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border-subtle bg-surface-secondary",children:[s.jsx("span",{className:"text-[10px] font-medium text-fg-tertiary uppercase tracking-wider select-none",children:t}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>l("rendered"),className:`px-2 py-0.5 rounded text-[10px] font-medium transition-colors ${o==="rendered"?"bg-brand-600/20 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsxs("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),r("markdown.viewRendered")]})}),s.jsx("button",{onClick:()=>l("source"),className:`px-2 py-0.5 rounded text-[10px] font-medium transition-colors ${o==="source"?"bg-brand-600/20 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"})}),r("markdown.viewSource")]})})]})]}),o==="rendered"?s.jsx("div",{children:n}):s.jsxs("div",{className:"relative group/source",children:[s.jsx("pre",{className:"p-3 overflow-x-auto text-xs font-mono text-fg-secondary bg-surface-secondary leading-relaxed whitespace-pre-wrap break-words",children:e}),s.jsx("button",{onClick:m,className:"absolute top-2 right-2 p-1.5 rounded-md bg-surface-elevated/80 hover:bg-surface-overlay text-fg-tertiary hover:text-fg-primary backdrop-blur-sm border border-border-default/50 transition-all opacity-0 group-hover/source:opacity-100",title:r("markdown.copyContent"),children:c?s.jsx("svg",{className:"w-3.5 h-3.5 text-green-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]})]})}const uK=[$3,H3];function dK(e){for(const t of k.Children.toArray(e))if(k.isValidElement(t)&&typeof t.props?.className=="string"){const n=t.props.className;return kV(n)}return null}function cc(e){if(typeof e=="string")return e;if(typeof e=="number")return String(e);if(!e)return"";if(Array.isArray(e))return e.map(cc).join("");if(k.isValidElement(e)){const t=e.props;return cc(t.children)}return""}function mK({children:e}){const{t}=ft("common"),n=dK(e),r=k.useRef(null),[o,l]=k.useState(!1),[c,d]=k.useState("rendered"),m=k.useCallback(async()=>{let h;c==="source"?h=cc(e):h=r.current?.querySelector("code")?.textContent??"";try{await navigator.clipboard.writeText(h),l(!0),setTimeout(()=>l(!1),1800)}catch{}},[c,e]);if(k.Children.toArray(e).some(h=>k.isValidElement(h)&&uK.includes(h.type))){const h=cc(e),g=n==="mermaid"||n==="plantuml"?n:"diagram";return s.jsx(Xh,{code:h,language:g,children:e})}return n==="mermaid"||n==="plantuml"?s.jsx(s.Fragment,{children:e}):s.jsxs("div",{className:"not-prose relative group/code my-2 rounded-lg overflow-hidden bg-surface-secondary border border-border-subtle",children:[n&&s.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border-subtle",children:[s.jsx("span",{className:"text-[10px] font-medium text-fg-tertiary uppercase tracking-wider select-none",children:wV(n)}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>d("rendered"),className:`px-1.5 py-0.5 rounded text-[10px] font-medium transition-colors ${c==="rendered"?"bg-brand-600/20 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:t("markdown.viewRendered")}),s.jsx("button",{onClick:()=>d("source"),className:`px-1.5 py-0.5 rounded text-[10px] font-medium transition-colors ${c==="source"?"bg-brand-600/20 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:t("markdown.viewSource")})]})]}),s.jsxs("div",{className:"relative",children:[c==="rendered"?s.jsx("pre",{ref:r,className:"p-3 overflow-x-auto text-xs [&>code]:p-0 [&>code]:rounded-none [&>code]:text-fg-secondary",children:k.Children.map(e,h=>k.isValidElement(h)?k.cloneElement(h,{style:{background:"transparent",padding:0}}):h)}):s.jsx("pre",{className:"p-3 overflow-x-auto text-xs font-mono text-fg-secondary whitespace-pre-wrap break-words",children:cc(e)}),s.jsx("button",{onClick:m,className:"absolute top-2 right-2 p-1.5 rounded-md bg-surface-elevated/80 hover:bg-surface-overlay text-fg-tertiary hover:text-fg-primary backdrop-blur-sm border border-border-default/50 transition-all opacity-0 group-hover/code:opacity-100",title:t("markdown.copyContent"),children:o?s.jsx("svg",{className:"w-3.5 h-3.5 text-green-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]})]})}const c4="#mention:",y0="#entity:",fK=/^\[([^\]]+)\]\(#entity:((tsk|req|proj|dlv|agt|team)_[a-f0-9]{6,})\)$/i,U3=/^(workflow|task|requirement|project|deliverable|agent|team):(.+)$/,Qh="text-brand-500 hover:text-brand-500 underline break-all cursor-pointer";function Zh(e){return e.type==="text"?e.value??"":(e.children??[]).map(Zh).join("")}function pK(e){return e.type==="text"&&(e.value??"").trim()===""}function hK(e){if(!e?.children)return null;const t=e.children.filter(r=>!pK(r));if(t.length!==1)return null;const n=t[0];if(n.type==="element"&&n.tagName==="a"){const r=n.properties?.href;if(!r)return null;const o=Zh(n);if(r.startsWith(y0))return{id:r.slice(y0.length)};const l=r.match(U3);return l&&l[1]!=="workflow"?{id:l[2],type:O3(l[1]),label:o}:null}if(n.type==="element"&&n.tagName==="code"){const r=Zh(n).trim();if(b0(r))return{id:r}}if(n.type==="text"){const r=(n.value??"").trim();if(b0(r))return{id:r}}return null}const gK={p:({children:e})=>s.jsx("p",{className:"mb-2 last:mb-0 leading-relaxed text-fg-secondary",children:e}),h1:({children:e})=>s.jsx("h1",{className:"text-base font-bold mb-2 mt-3 first:mt-0 text-fg-primary",children:e}),h2:({children:e})=>s.jsx("h2",{className:"text-sm font-bold mb-2 mt-3 first:mt-0 text-fg-primary",children:e}),h3:({children:e})=>s.jsx("h3",{className:"text-sm font-semibold mb-1 mt-2 first:mt-0 text-fg-primary",children:e}),h4:({children:e})=>s.jsx("h4",{className:"text-sm font-semibold mb-1 mt-2 first:mt-0 text-fg-primary",children:e}),h5:({children:e})=>s.jsx("h5",{className:"text-xs font-semibold mb-1 mt-2 first:mt-0 text-fg-primary",children:e}),h6:({children:e})=>s.jsx("h6",{className:"text-xs font-medium mb-1 mt-2 first:mt-0 text-fg-primary",children:e}),ul:({children:e})=>s.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:e}),ol:({children:e,start:t})=>s.jsx("ol",{start:t,className:"list-decimal pl-7 mb-2 space-y-0.5",children:e}),li:({children:e,value:t})=>s.jsx("li",{value:t,className:"leading-relaxed text-fg-secondary marker:text-fg-secondary",children:e}),code:({children:e,className:t})=>{const n=typeof e=="string"?e:String(e??""),r=n.trim();if(t?.includes("language-plantuml")||bV(r))return s.jsx(Xh,{code:r,language:"plantuml",children:s.jsx(H3,{code:r})});if(t?.includes("language-mermaid")||!t&&yV(r))return s.jsx(Xh,{code:r,language:"mermaid",children:s.jsx($3,{code:r})});if(t?.includes("language-"))return s.jsx("code",{className:`${t} text-fg-secondary font-mono text-xs`,children:e});if(b0(n))return s.jsx(lc,{id:n.trim()});const o=n.match(fK);return o?s.jsx(lc,{id:o[2],label:o[1]}):YV(n)?s.jsx(QV,{path:n}):s.jsx("code",{className:"bg-surface-secondary px-1.5 py-0.5 rounded text-xs font-mono text-brand-500 break-all",children:e})},pre:({children:e})=>s.jsx(mK,{children:e}),strong:({children:e})=>s.jsx("strong",{className:"font-bold text-fg-primary",children:e}),em:({children:e})=>s.jsx("em",{className:"italic text-fg-secondary",children:e}),del:({children:e})=>s.jsx("del",{className:"line-through text-fg-tertiary",children:e}),blockquote:({children:e})=>s.jsx("blockquote",{className:"border-l-2 border-brand-500 pl-3 my-2 text-fg-secondary italic",children:e}),a:({href:e,children:t})=>s.jsx("a",{href:e,className:Qh,children:t}),hr:()=>s.jsx("hr",{className:"border-border-default my-3"}),table:({children:e})=>s.jsx("div",{className:"overflow-x-auto my-2",children:s.jsx("table",{className:"min-w-full text-sm border-collapse border border-border-default",children:e})}),thead:({children:e})=>s.jsx("thead",{className:"bg-surface-secondary",children:e}),tbody:({children:e})=>s.jsx("tbody",{className:"divide-y divide-border-default",children:e}),tr:({children:e})=>s.jsx("tr",{className:"hover:bg-surface-elevated/50 transition-colors",children:e}),th:({children:e})=>s.jsx("th",{className:"px-3 py-2 text-left text-sm font-semibold text-fg-primary border border-border-default",children:e}),td:({children:e})=>s.jsx("td",{className:"px-3 py-2 text-sm text-fg-primary border border-border-default",children:e})},bK=/\.(png|jpe?g|gif|webp|svg|bmp|ico)$/i;function xK(e){const t=Kg(e);return E3(e)&&bK.test(t.split("?")[0]??t)}function yK(e,t){const n=Kg(e);if(n.startsWith("/")||n.startsWith("~/")||/^[A-Za-z]:\//.test(n)||n.startsWith("//"))return n;if((n.startsWith("./")||n.startsWith("../"))&&t){const o=((t.replace(/\\/g,"/").endsWith("/")?t.replace(/\\/g,"/"):`${t.replace(/\\/g,"/")}/`)+n).split("/"),l=[];for(const c of o)c===".."?l.pop():c!=="."&&c!==""&&l.push(c);return"/"+l.join("/")}return n}function vK(e){return`/api/files/image?path=${encodeURIComponent(e)}`}const Co=new Map;function wK({src:e,alt:t,onPreview:n,basePath:r}){const o=k.useMemo(()=>xK(e)?vK(yK(e,r)):e,[e,r]),l=o.startsWith("/api/files/image?"),c=Co.get(o),[d,m]=k.useState(c??(l?null:o)),[f,h]=k.useState(!!c),[g,y]=k.useState(!1),[x,w]=k.useState(null),[C,T]=k.useState(0),S=k.useRef(0),E=k.useCallback(()=>{Co.delete(o),y(!1),w(null),h(!1),m(l?null:`${o}${o.includes("?")?"&":"?"}retry=${Date.now()}`),T(j=>j+1)},[o,l]);return k.useEffect(()=>{if(!l)return;const j=Co.get(o);if(j){m(j),h(!0),y(!1),w(null);return}const L=++S.current;y(!1),w(null),h(!1),m(null),(async()=>{try{const I=await fetch(o,{credentials:"same-origin"});if(L!==S.current)return;if(!I.ok){let V=`HTTP ${I.status}`;try{const X=await I.json();X.error&&(V=X.error)}catch{}throw new Error(V)}const O=await I.blob();if(L!==S.current)return;if(O.size===0)throw new Error("Empty image response");if(O.type&&!O.type.startsWith("image/")&&!O.type.includes("octet-stream"))throw new Error(`Unexpected content-type: ${O.type}`);const F=URL.createObjectURL(O);Co.set(o,F),m(F),h(!0),y(!1),w(null)}catch(I){if(L!==S.current)return;const O=I instanceof Error?I.message:String(I);console.warn("[MarkdownImage] failed to load local image",o,I),w(O),y(!0),h(!1)}})()},[l,o,C]),k.useEffect(()=>{l||(m(o),h(!!Co.get(o)),y(!1),w(null))},[o,l,C]),g?s.jsxs("button",{type:"button",onClick:E,title:x??"Click to retry",className:"inline-flex items-center gap-1.5 px-3 py-2 text-xs text-fg-tertiary bg-surface-elevated rounded-lg border border-border-default hover:bg-surface-overlay hover:text-fg-secondary cursor-pointer transition-colors max-w-full",children:[s.jsxs("svg",{className:"w-4 h-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:[s.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),s.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),s.jsx("polyline",{points:"21 15 16 10 5 21"})]}),s.jsxs("span",{className:"truncate",children:["Failed to load image — click to retry",x?` (${x})`:""]})]}):s.jsxs("span",{className:"inline-block align-middle max-w-full",children:[!f&&s.jsx("span",{className:"block w-full min-h-[80px] max-w-[400px] bg-surface-elevated rounded-lg animate-pulse"}),d?s.jsx("img",{src:d,alt:t??"",onLoad:()=>{l||Co.set(o,o),h(!0)},onError:()=>{w("Image decode failed"),y(!0)},onClick:()=>n?.(d),className:`max-w-full h-auto rounded-lg cursor-pointer hover:opacity-90 transition-opacity my-1${f?"":" absolute opacity-0 pointer-events-none"}`,style:{maxHeight:"400px",objectFit:"contain"}}):null]})}async function u4(e){const t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch image (${t.status})`);return t.blob()}async function kK(e){if(e.type==="image/png")return e;const t=await createImageBitmap(e),n=document.createElement("canvas");n.width=t.width,n.height=t.height;const r=n.getContext("2d");if(!r)throw new Error("Canvas unavailable");return r.drawImage(t,0,0),t.close(),new Promise((o,l)=>{n.toBlob(c=>c?o(c):l(new Error("PNG encode failed")),"image/png")})}function SK(e,t){try{const o=(e.startsWith("data:")?"":new URL(e,window.location.href).pathname).split("/").pop()||"";if(o&&/\.(png|jpe?g|gif|webp|svg|bmp)$/i.test(o))return decodeURIComponent(o)}catch{}return`image.${(t.type.split("/")[1]||"png").replace("jpeg","jpg")}`}function F3({src:e,onClose:t}){const{t:n}=ft("common"),[r,o]=k.useState(null),[l,c]=k.useState(null);Ho(!0),k.useEffect(()=>{const g=y=>{y.key==="Escape"&&t()};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[t]);const d=k.useCallback(g=>{o(g),window.setTimeout(()=>o(null),1600)},[]),m=k.useCallback(async g=>{if(g.stopPropagation(),!l){c("copy");try{const y=await u4(e),x=await kK(y);await navigator.clipboard.write([new ClipboardItem({"image/png":x})]),d(n("imageCopied"))}catch{d(n("imageCopyFailed"))}finally{c(null)}}},[l,d,e,n]),f=k.useCallback(async g=>{if(g.stopPropagation(),!l){c("download");try{const y=await u4(e),x=URL.createObjectURL(y),w=document.createElement("a");w.href=x,w.download=SK(e,y),document.body.appendChild(w),w.click(),w.remove(),URL.revokeObjectURL(x),d(n("imageDownloaded"))}catch{d(n("imageDownloadFailed"))}finally{c(null)}}},[l,d,e,n]),h="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-white/10 hover:bg-white/20 text-white text-sm transition-colors disabled:opacity-50";return Sa.createPortal(s.jsxs("div",{className:"fixed inset-0 z-[9999] bg-black/80 flex items-center justify-center p-4",onClick:t,children:[s.jsxs("div",{className:"absolute top-4 right-4 z-10 flex items-center gap-2",onClick:g=>g.stopPropagation(),children:[s.jsxs("button",{type:"button",className:h,onClick:m,disabled:!!l,title:n("copyImage"),children:[s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),s.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),n("copy")]}),s.jsxs("button",{type:"button",className:h,onClick:f,disabled:!!l,title:n("downloadImage"),children:[s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"}),s.jsx("polyline",{points:"7 10 12 15 17 10"}),s.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),n("downloadImage")]}),s.jsx("button",{type:"button",onClick:t,className:"w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center transition-colors",title:n("close"),children:s.jsxs("svg",{className:"w-6 h-6 text-white",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),r&&s.jsx("div",{className:"absolute top-16 left-1/2 -translate-x-1/2 z-10 px-3 py-1.5 rounded-lg bg-black/70 text-white text-xs",children:r}),s.jsx("img",{src:e,alt:"Preview",className:"max-w-full max-h-[90vh] object-contain rounded-lg",onClick:g=>g.stopPropagation()})]}),document.body)}function q3(e={}){const{onMentionClick:t,basePath:n,onImagePreview:r,contentRef:o,hostAvailable:l,openRightPanel:c}=e,d=k.useCallback((m,f)=>{const h=t4(f,n);if(h.kind!=="passthrough"){if(m.preventDefault(),m.stopPropagation(),h.kind==="fragment"){CV(o?.current??null,h.id);return}if(h.kind==="file"){l&&c?c({kind:"file",path:h.path,title:h.path.split(/[/\\]/).pop()}):Ee.files.reveal(h.path).catch(()=>{});return}if(h.kind==="external"){if(l&&c&&/^https?:\/\//i.test(h.url)){c({kind:"url",url:h.url,title:h.url});return}_i(h.url)}}},[n,o,l,c]);return k.useMemo(()=>({...gK,img:({src:m,alt:f})=>s.jsx(wK,{src:m??"",alt:f,onPreview:r,basePath:n},m??""),p:({children:m,node:f})=>{const h=hK(f);return h?s.jsx($V,{id:h.id,type:h.type,label:h.label}):s.jsx("p",{className:"mb-2 last:mb-0 leading-relaxed text-fg-secondary",children:m})},a:({href:m,children:f})=>{if(m?.startsWith(c4)){const g=decodeURIComponent(m.slice(c4.length));return s.jsx("span",{className:`text-brand-500 font-medium${t?" cursor-pointer hover:underline":""}`,onClick:t?y=>{y.preventDefault(),y.stopPropagation(),t(g,y)}:void 0,title:g,children:f})}if(m?.startsWith(y0))return s.jsx(lc,{id:m.slice(y0.length)});{const g=m?.match(U3);if(g){const[,y,x]=g;if(y==="workflow")return s.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1 py-0.5 rounded bg-brand-500/10 text-brand-500 text-xs font-medium cursor-pointer hover:bg-brand-500/20 transition-colors",onClick:C=>{C.preventDefault(),C.stopPropagation(),it.navigate(de.WORK,{boardType:"workflows"})},title:`workflow: ${x}`,children:[s.jsx("span",{className:"text-[10px]",children:"⚙️"}),s.jsx("span",{children:f})]});const w=O3(y);if(w)return s.jsx(lc,{id:x,type:w,label:f})}}if(m&&b0(m))return s.jsx(lc,{id:m.trim(),label:f});const h=t4(m,n);return h.kind==="fragment"||h.kind==="file"||h.kind==="external"?s.jsx("a",{href:m,className:Qh,onClick:g=>d(g,m),title:h.kind==="fragment"?`#${h.id}`:h.kind==="file"?h.path:h.url,children:f}):s.jsx("a",{href:m,className:Qh,onClick:g=>{yc()&&m&&!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(m)&&g.preventDefault()},children:f})}}),[t,n,r,d])}const d4=[q5,Vk,Kk],m4=[M3,[n3,{strict:"ignore"}],[v3,{detect:!0,ignoreMissing:!0}]];function f4(e){return/^(deliverable|task|requirement|project|agent|team|workflow):/i.test(e)||E3(e)?e:x5(e)}const NK=/ thinking([\s\S]*?)(<\/think>|$)/g;function CK(e){const t=[];let n=e.replace(NK,(r,o)=>{const l=o.trim();return l&&t.push(l),""});return n=n.replace(/<\/think>/g,"").replace(/ thinking/g,""),{thinking:t,rest:n.trim()}}function TK(e=640){const[t,n]=k.useState(()=>window.innerWidth<e);return k.useEffect(()=>{const r=window.matchMedia(`(max-width: ${e-1}px)`),o=l=>n(l.matches);return r.addEventListener("change",o),n(r.matches),()=>r.removeEventListener("change",o)},[e]),t}function AK({content:e,contentRef:t}){const{t:n}=ft("common"),[r,o]=k.useState(!1),[l,c]=k.useState(!1),[d,m]=k.useState(!1),[f,h]=k.useState(null),g=k.useRef(null),y=TK();k.useEffect(()=>{if(!r)return;const T=S=>{g.current&&!g.current.contains(S.target)&&(o(!1),c(!1),m(!1))};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[r]);const x=k.useCallback(T=>{h(T),setTimeout(()=>h(null),1500)},[]),w=async()=>{const T=await Wg(e);x(n(T?"markdown.copied":"markdown.failed")),o(!1)},C=async T=>{const S=t.current?.firstElementChild;if(!S)return;const E=L3(),j=_V(E),L=await AV(S,T,e,{fontFamily:j.fontFamily,fontSize:j.fontSize,headingScales:j.headingScales}),I=n(T==="light"?"markdown.themeLight":"markdown.themeDark");x(L.ok?L.method==="html"?n("markdown.htmlCopied",{theme:I}):n("markdown.textCopied"):n("markdown.failed")),o(!1)};return s.jsxs("div",{className:"absolute top-1 right-1 z-10 opacity-0 group-hover/md:opacity-100 transition-opacity",ref:g,children:[f&&s.jsx("div",{className:"absolute right-0 top-full mt-1 z-20 px-2 py-0.5 rounded bg-surface-elevated border border-border-default text-[10px] text-fg-secondary whitespace-nowrap shadow-lg",children:f}),s.jsx("button",{onClick:()=>o(T=>!T),className:"p-1.5 rounded-lg bg-surface-elevated/80 hover:bg-surface-overlay text-fg-secondary hover:text-fg-primary backdrop-blur-sm border border-border-default/50 transition-all",title:n("markdown.copyContent"),children:s.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),r&&s.jsx("div",{className:"absolute right-0 top-full mt-1 bg-surface-elevated border border-border-default rounded-lg shadow-xl py-1 min-w-[180px]",children:d?s.jsx(jV,{onClose:()=>m(!1)}):l?s.jsxs("div",{className:"px-3 py-2 text-[11px] text-fg-secondary space-y-2 max-w-[260px]",children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsx("span",{className:"font-medium text-fg-primary text-xs",children:n("markdown.infoTitle")}),s.jsx("button",{onClick:()=>c(!1),className:"text-fg-tertiary hover:text-fg-primary p-0.5",children:s.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsxs("div",{children:[s.jsx("span",{className:"font-medium text-fg-primary",children:n("markdown.mdAbbrev")})," — ",n("markdown.infoMdDesc")]}),s.jsxs("div",{children:[s.jsx("span",{className:"font-medium text-fg-primary",children:"☀️"})," — ",n("markdown.infoHtmlLightDesc")]}),s.jsxs("div",{children:[s.jsx("span",{className:"font-medium text-fg-primary",children:"🌙"})," — ",n("markdown.infoHtmlDarkDesc")]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-b border-border-subtle mb-1",children:[s.jsx("span",{className:"text-[10px] text-fg-tertiary font-medium",children:n("markdown.copyContent")}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>m(!0),className:"p-0.5 rounded text-fg-tertiary hover:text-fg-primary transition-colors",title:n("markdown.typographySettings"),children:s.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),s.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),s.jsx("button",{onClick:()=>c(!0),className:"p-0.5 rounded text-fg-tertiary hover:text-fg-primary transition-colors",title:n("markdown.infoTitle"),children:s.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("path",{strokeLinecap:"round",d:"M12 16v-4m0-4h.01"})]})})]})]}),s.jsxs("button",{onClick:w,className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[s.jsx("span",{className:"w-4 text-center text-fg-tertiary shrink-0 font-mono text-[10px]",children:n("markdown.mdAbbrev")}),n(y?"markdown.copyMdSourceShort":"markdown.copyMdSource")]}),s.jsxs("button",{onClick:()=>C("light"),className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[s.jsx("span",{className:"w-4 text-center shrink-0 text-[10px]",children:"☀️"}),n(y?"markdown.copyHtmlLightShort":"markdown.copyHtmlLight")]}),s.jsxs("button",{onClick:()=>C("dark"),className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[s.jsx("span",{className:"w-4 text-center shrink-0 text-[10px]",children:"🌙"}),n(y?"markdown.copyHtmlDarkShort":"markdown.copyHtmlDark")]})]})})]})}const Er=k.memo(function({content:t,className:n="",onMentionClick:r,knownNames:o,basePath:l}){const{thinking:c,rest:d}=CK(t),m=k.useRef(null),[f,h]=k.useState(null),g=Lc(),y=k.useCallback(C=>{let T=Jl(C,uV);return T=Jl(T,NV),T=Jl(T,hV),T=Jl(T,gV),T=Jl(T,S=>dV(S,o)),T},[o]),x=k.useMemo(()=>y(d),[d,y]),w=q3({onMentionClick:r,basePath:l,onImagePreview:h,contentRef:m,hostAvailable:g?.hostAvailable,openRightPanel:g?.openRightPanel});return s.jsxs("div",{className:"relative group/md",children:[s.jsx(AK,{content:t,contentRef:m}),s.jsx("div",{ref:m,children:s.jsx(MV,{resetKeys:[x],fallback:s.jsx("div",{className:`prose prose-sm max-w-none break-words whitespace-pre-wrap pr-8 text-fg-secondary ${n}`,children:d}),children:s.jsxs("div",{className:`prose prose-sm max-w-none break-words pr-8 text-fg-secondary ${n}`,children:[c.length>0&&(()=>{const C=c.join(`
649
649
 
650
650
  `),T=C.split(`
651
651
  `)[0]??"",S=T.length>80?T.slice(0,80)+"…":T;return s.jsxs("details",{className:"mb-3 rounded-lg bg-surface-elevated/60 border border-border-default/50 overflow-hidden group/think",children:[s.jsxs("summary",{className:"cursor-pointer select-none px-3 py-2 text-xs text-fg-secondary hover:text-fg-secondary transition-colors flex items-center gap-1.5 min-w-0",children:[s.jsx("svg",{className:"w-3 h-3 shrink-0 transition-transform group-open/think:rotate-90",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z",clipRule:"evenodd"})}),s.jsx("span",{className:"shrink-0",children:"Thinking"}),s.jsx("span",{className:"truncate text-fg-tertiary ml-1 group-open/think:hidden",children:S})]}),s.jsx("div",{className:"px-3 pb-3 border-t border-border-default/50",children:s.jsx("div",{className:"mt-2 pl-3 border-l-2 border-brand-500/40 text-xs text-fg-secondary leading-relaxed",children:s.jsx(Eh,{remarkPlugins:d4,rehypePlugins:m4,components:w,urlTransform:f4,children:y(C)})})})]})})(),s.jsx(Eh,{remarkPlugins:d4,rehypePlugins:m4,components:w,urlTransform:f4,children:x})]})})}),f&&s.jsx(F3,{src:f,onClose:()=>h(null)})]})},(e,t)=>e.content===t.content&&e.className===t.className&&e.basePath===t.basePath&&e.onMentionClick===t.onMentionClick&&EK(e.knownNames,t.knownNames));function EK(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}const G3=Object.freeze(Object.defineProperty({__proto__:null,ImagePreviewModal:F3,MarkdownMessage:Er},Symbol.toStringTag,{value:"Module"})),Jh={suppressAdjustUntil:0};function Cc(e=2500){const t=typeof performance<"u"?performance.now():Date.now();Jh.suppressAdjustUntil=Math.max(Jh.suppressAdjustUntil,t+e)}function GY(){return(typeof performance<"u"?performance.now():Date.now())<Jh.suppressAdjustUntil}const p4={shell_execute:{label:"Running command",icon:"⌨"},list_terminals:{label:"Listing terminals",icon:"⌨"},new_terminal:{label:"Opening terminal",icon:"⌨"},select_terminal:{label:"Selecting terminal",icon:"⌨"},close_terminal:{label:"Closing terminal",icon:"⌨"},read_terminal:{label:"Reading terminal",icon:"⌨"},write_terminal:{label:"Writing terminal",icon:"⌨"},exec_terminal:{label:"Running in terminal",icon:"⌨"},file_read:{label:"Reading file",icon:"📄"},file_write:{label:"Writing file",icon:"✏"},file_edit:{label:"Editing file",icon:"✏"},apply_patch:{label:"Applying patch",icon:"🔀"},list_directory:{label:"Listing directory",icon:"📂"},glob_find:{label:"Finding files",icon:"🔍"},grep_search:{label:"Searching code",icon:"🔍"},web_fetch:{label:"Fetching page",icon:"🌐"},web_search:{label:"Searching web",icon:"🔍"},web_extract:{label:"Extracting content",icon:"📑"},create_task:{label:"Creating task",icon:"📌"},task_create:{label:"Creating task",icon:"📌"},create_subtask:{label:"Adding subtask",icon:"📌"},update_task:{label:"Updating task",icon:"✅"},task_update:{label:"Updating task",icon:"✅"},add_task_note:{label:"Adding note",icon:"📝"},task_add_note:{label:"Adding note",icon:"📝"},task_list:{label:"Listing tasks",icon:"📋"},task_get:{label:"Getting task",icon:"📋"},task_note:{label:"Adding note",icon:"📝"},task_assign:{label:"Assigning task",icon:"👥"},task_submit_review:{label:"Submitting for review",icon:"✅"},task_comment:{label:"Commenting task",icon:"💬"},subtask_create:{label:"Adding subtask",icon:"📌"},subtask_complete:{label:"Completing subtask",icon:"✅"},subtask_cancel:{label:"Cancelling subtask",icon:"🚫"},subtask_list:{label:"Listing subtasks",icon:"📋"},requirement_propose:{label:"Proposing requirement",icon:"📋"},requirement_list:{label:"Listing requirements",icon:"📋"},requirement_get:{label:"Getting requirement",icon:"📋"},requirement_update:{label:"Updating requirement",icon:"📋"},requirement_update_status:{label:"Updating req status",icon:"✅"},requirement_resubmit:{label:"Resubmitting requirement",icon:"📋"},requirement_comment:{label:"Commenting requirement",icon:"💬"},list_projects:{label:"Listing projects",icon:"🗂"},get_project:{label:"Getting project",icon:"🗂"},create_project:{label:"Creating project",icon:"🗂"},update_project:{label:"Updating project",icon:"🗂"},deliverable_create:{label:"Creating deliverable",icon:"📦"},deliverable_search:{label:"Searching deliverables",icon:"🔍"},deliverable_list:{label:"Listing deliverables",icon:"📦"},deliverable_update:{label:"Updating deliverable",icon:"📦"},git_status:{label:"Git status",icon:"🔀"},git_diff:{label:"Git diff",icon:"🔀"},git_log:{label:"Git log",icon:"📜"},git_branch:{label:"Git branch",icon:"🌿"},git_add:{label:"Git add",icon:"➕"},git_commit:{label:"Git commit",icon:"💾"},project_structure:{label:"Project structure",icon:"🗂"},code_stats:{label:"Code stats",icon:"📊"},navigate_page:{label:"Opening page",icon:"🌐"},new_page:{label:"Opening new tab",icon:"🌐"},close_page:{label:"Closing tab",icon:"🌐"},select_page:{label:"Switching tab",icon:"🌐"},list_pages:{label:"Listing tabs",icon:"🌐"},click:{label:"Clicking element",icon:"👆"},hover:{label:"Hovering element",icon:"👆"},fill:{label:"Filling field",icon:"⌨"},fill_form:{label:"Filling form",icon:"⌨"},type_text:{label:"Typing text",icon:"⌨"},press_key:{label:"Pressing key",icon:"⌨"},take_screenshot:{label:"Screenshot",icon:"📸"},take_snapshot:{label:"Page snapshot",icon:"📋"},evaluate_script:{label:"Running script",icon:"⚙"},wait_for:{label:"Waiting",icon:"⏳"},list_console_messages:{label:"Console logs",icon:"🔍"},list_network_requests:{label:"Network requests",icon:"🔍"},lighthouse_audit:{label:"Running audit",icon:"📊"},agent_send_message:{label:"Messaging colleague",icon:"💬"},agent_list_colleagues:{label:"Checking team",icon:"👥"},memory_save:{label:"Saving memory",icon:"💾"},memory_search:{label:"Searching memory",icon:"🔍"},memory_list:{label:"Listing memory",icon:"💾"},memory_update:{label:"Updating memory",icon:"💾"},recall_activity:{label:"Recalling activity",icon:"📜"},update_working_memory:{label:"Updating notes",icon:"📝"},notify_user:{label:"Notifying user",icon:"🔔"},request_user_input:{label:"Requesting input",icon:"❓"},request_user_approval:{label:"Requesting approval",icon:"❓"},schedule_wakeup:{label:"Scheduling wakeup",icon:"⏰"},cancel_wakeup:{label:"Cancelling wakeup",icon:"⏰"},set_heartbeat_interval:{label:"Setting heartbeat",icon:"⏱"},discover_tools:{label:"Discovering tools",icon:"🧰"},check_mailbox:{label:"Checking mailbox",icon:"📥"},goal_create:{label:"Creating goal",icon:"🎯"},goal_update:{label:"Updating goal",icon:"🎯"},goal_status:{label:"Goal status",icon:"🎯"},background_exec:{label:"Background command",icon:"⌨"},process:{label:"Managing process",icon:"⚙"},feishu_send_message:{label:"Sending Feishu msg",icon:"✉"},feishu_search_docs:{label:"Searching Feishu",icon:"🔍"},spawn_subagent:{label:"Spawn Subagent",icon:"◎"},spawn_subagents:{label:"Spawn Subagents",icon:"◎"},invoke_coding_tool:{label:"Invoke Coding Tool",icon:"🛠"},coding_tool_apply:{label:"Apply Coding Result",icon:"🔀"},generate_image:{label:"Generating image",icon:"🖼"},text_to_speech:{label:"Generating speech",icon:"🔊"},speech_to_text:{label:"Transcribing audio",icon:"🎙"},generate_video:{label:"Generating video",icon:"🎬"},llm_list_providers:{label:"Listing providers",icon:"⚙"},llm_switch_model:{label:"Switching model",icon:"⚙"},llm_switch_default_provider:{label:"Switching provider",icon:"⚙"},llm_add_provider:{label:"Adding provider",icon:"⚙"},llm_edit_provider:{label:"Editing provider",icon:"⚙"},llm_add_model:{label:"Adding model",icon:"⚙"},llm_get_capability_routing:{label:"Checking capability routing",icon:"⚙"},llm_set_capability_routing:{label:"Setting capability routing",icon:"⚙"},team_list:{label:"Listing teams",icon:"👥"},team_status:{label:"Team status",icon:"👥"},team_start:{label:"Starting team",icon:"👥"},team_stop:{label:"Stopping team",icon:"👥"},team_update:{label:"Updating team",icon:"👥"},agent_start:{label:"Starting agent",icon:"◎"},agent_stop:{label:"Stopping agent",icon:"◎"},agent_update:{label:"Updating agent",icon:"◎"},agent_delegate_task:{label:"Delegating task",icon:"📌"},agent_broadcast_status:{label:"Broadcasting status",icon:"📣"},agent_create_group_chat:{label:"Creating group chat",icon:"💬"},agent_list_group_chats:{label:"Listing group chats",icon:"💬"},agent_send_group_message:{label:"Sending group message",icon:"💬"},delete_project:{label:"Deleting project",icon:"🗂"},project_stats:{label:"Project stats",icon:"📊"},hub_search:{label:"Searching Hub",icon:"🔍"},hub_install:{label:"Installing from Hub",icon:"📦"},package_list:{label:"Listing packages",icon:"📦"},package_install:{label:"Installing package",icon:"📦"},memory_delete:{label:"Deleting memory",icon:"💾"},memory_update_longterm:{label:"Updating long-term memory",icon:"💾"},clear_working_memory:{label:"Clearing notes",icon:"📝"},clear_notebook:{label:"Clearing notebook",icon:"📝"},update_notebook:{label:"Updating notebook",icon:"📝"},recall_context:{label:"Recalling context",icon:"📜"},defer_mailbox_item:{label:"Deferring mailbox item",icon:"📥"},drop_mailbox_item:{label:"Dropping mailbox item",icon:"📥"},prioritize_mailbox_item:{label:"Prioritizing mailbox",icon:"📥"},delegate_message:{label:"Delegating message",icon:"💬"},task_board_health:{label:"Checking task board",icon:"📋"},task_check_duplicates:{label:"Checking duplicates",icon:"📋"},task_cleanup_duplicates:{label:"Cleaning duplicates",icon:"📋"},workflow_list:{label:"Listing workflows",icon:"🔄"},workflow_create:{label:"Creating workflow",icon:"🔄"},workflow_update:{label:"Updating workflow",icon:"🔄"},workflow_delete:{label:"Deleting workflow",icon:"🔄"},workflow_run:{label:"Running workflow",icon:"🔄"},workflow_status:{label:"Workflow status",icon:"🔄"},workflow_cancel:{label:"Cancelling workflow",icon:"🔄"},open_page:{label:"Opening page",icon:"🌐"},resize_page:{label:"Resizing page",icon:"🌐"},drag:{label:"Dragging element",icon:"👆"},upload_file:{label:"Uploading file",icon:"📎"},emulate:{label:"Emulating device",icon:"📱"},handle_dialog:{label:"Handling dialog",icon:"💬"},get_console_message:{label:"Console message",icon:"🔍"},get_network_request:{label:"Network request",icon:"🔍"}},h4={shell_execute:"square-terminal",background_exec:"square-terminal",process:"settings",list_terminals:"square-terminal",new_terminal:"square-terminal",select_terminal:"square-terminal",close_terminal:"square-terminal",read_terminal:"square-terminal",write_terminal:"square-terminal",exec_terminal:"square-terminal",file_read:"file-text",file_write:"edit",file_edit:"edit",apply_patch:"git-branch",list_directory:"folder",glob_find:"search",grep_search:"search",web_fetch:"globe",web_search:"search",web_extract:"file-text",create_task:"clipboard",task_create:"clipboard",create_subtask:"clipboard",update_task:"check-circle",task_update:"check-circle",add_task_note:"edit",task_add_note:"edit",task_note:"edit",task_list:"clipboard",task_get:"clipboard",task_assign:"users",task_submit_review:"check-circle",task_comment:"message-square",subtask_create:"clipboard",subtask_complete:"check-circle",subtask_cancel:"alert-circle",subtask_list:"clipboard",requirement_propose:"clipboard",requirement_list:"clipboard",requirement_get:"clipboard",requirement_update:"clipboard",requirement_update_status:"check-circle",requirement_resubmit:"clipboard",requirement_comment:"message-square",list_projects:"layers",get_project:"layers",create_project:"layers",update_project:"layers",deliverable_create:"package",deliverable_search:"search",deliverable_list:"package",deliverable_update:"edit",git_status:"git-branch",git_diff:"git-branch",git_log:"book-open",git_branch:"git-branch",git_add:"git-branch",git_commit:"save",project_structure:"layers",code_stats:"bar-chart",navigate_page:"globe",new_page:"globe",close_page:"globe",select_page:"globe",list_pages:"globe",click:"target",hover:"target",fill:"terminal",fill_form:"terminal",type_text:"terminal",press_key:"terminal",take_screenshot:"camera",take_snapshot:"camera",evaluate_script:"code",wait_for:"clock",list_console_messages:"terminal",list_network_requests:"globe",lighthouse_audit:"bar-chart",agent_send_message:"message-square",agent_list_colleagues:"users",memory_save:"database",memory_search:"search",memory_list:"database",memory_update:"database",recall_activity:"book-open",update_working_memory:"edit",notify_user:"megaphone",request_user_input:"message-square",request_user_approval:"check-circle",schedule_wakeup:"clock",cancel_wakeup:"clock",set_heartbeat_interval:"clock",discover_tools:"wrench",check_mailbox:"message-square",goal_create:"target",goal_update:"target",goal_status:"target",feishu_send_message:"message-square",feishu_search_docs:"search",spawn_subagent:"bot",spawn_subagents:"bot",invoke_coding_tool:"wrench",coding_tool_apply:"git-branch",generate_image:"camera",text_to_speech:"headphones",speech_to_text:"headphones",generate_video:"camera",llm_list_providers:"settings",llm_switch_model:"settings",llm_switch_default_provider:"settings",llm_add_provider:"settings",llm_edit_provider:"settings",llm_add_model:"settings",llm_get_capability_routing:"settings",llm_set_capability_routing:"settings",team_list:"users",team_status:"users",team_start:"users",team_stop:"users",team_update:"users",agent_start:"bot",agent_stop:"bot",agent_update:"bot",agent_delegate_task:"clipboard",agent_broadcast_status:"megaphone",agent_create_group_chat:"message-square",agent_list_group_chats:"message-square",agent_send_group_message:"message-square",delete_project:"layers",project_stats:"bar-chart",hub_search:"search",hub_install:"package",package_list:"package",package_install:"package",memory_delete:"database",memory_update_longterm:"database",clear_working_memory:"edit",clear_notebook:"edit",update_notebook:"edit",recall_context:"book-open",defer_mailbox_item:"message-square",drop_mailbox_item:"message-square",prioritize_mailbox_item:"message-square",delegate_message:"message-square",task_board_health:"clipboard",task_check_duplicates:"clipboard",task_cleanup_duplicates:"clipboard",workflow_list:"git-branch",workflow_create:"git-branch",workflow_update:"git-branch",workflow_delete:"git-branch",workflow_run:"git-branch",workflow_status:"git-branch",workflow_cancel:"git-branch",open_page:"globe",resize_page:"globe",drag:"target",upload_file:"file-text",emulate:"settings",handle_dialog:"message-square",get_console_message:"terminal",get_network_request:"globe"};function Ai(e){const t=e.includes("__")?e.split("__").pop():e,n=p4[t]??p4[e],r=h4[t]??h4[e]??"settings";return n?{...n,iconName:r,key:t}:{label:t.replace(/_/g," ").replace(/\b\w/g,o=>o.toUpperCase()),icon:"⚙",iconName:r,key:t}}function $o(e){return e==null?"":e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function _K(e){const t=new Date(e);if(isNaN(t.getTime()))return e;const n=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),o=String(t.getHours()).padStart(2,"0"),l=String(t.getMinutes()).padStart(2,"0"),c=String(t.getSeconds()).padStart(2,"0");return`${n}-${r} ${o}:${l}:${c}`}function eg(e,t){return e.length<=t?e:e.slice(0,t)+"…"}function g4(e){try{const t=JSON.parse(e);return JSON.stringify(t,null,2)}catch{return e}}function V3(e){return!e||typeof e!="object"?[]:Object.entries(e).filter(([,n])=>n!=null).map(([n,r])=>({key:n,value:typeof r=="string"?r:JSON.stringify(r,null,2)}))}function jK(e){if(e.tool!=="shell_execute"||!e.args||typeof e.args!="object")return null;const t=e.args.command;return typeof t=="string"?t:null}function VY(e,t){const n=new Map;let r=null;for(const o of e)if(o.type==="tool_start"&&(o.content==="spawn_subagent"||o.content==="spawn_subagents"))r=o.seq,n.set(o.seq,[]);else if(o.type==="tool_end"&&(o.content==="spawn_subagent"||o.content==="spawn_subagents")){if(r!==null){const l=n.get(r);l&&n.set(o.seq,l)}r=null}else if(r!==null&&o.type.startsWith("subagent_")){const l=o.type.replace("subagent_",""),c=o.metadata;n.get(r)?.push({eventType:l,content:o.content,metadata:c})}return t.map(o=>{if(o.type!=="tool")return o;const l=o.key;if(!l)return o;const c=l.replace(/^(?:t[se]_|e[se]_)/,""),d=parseInt(c,10);if(isNaN(d))return o;const m=n.get(d);return!m||m.length===0?o:{...o,info:{...o.info,subagentLogs:m}}})}function b4(e){const t=new Set;for(let n=0;n<e.length;n++){const r=e[n];if(r.type==="tool"&&(r.info.status==="done"||r.info.status==="error"))for(let o=n-1;o>=0;o--){const l=e[o];if(l.type==="tool"&&l.info.status==="running"&&l.info.tool===r.info.tool&&!t.has(o)){t.add(o);break}}}return e.filter((n,r)=>!t.has(r))}function K3(e){const t=_K(e.createdAt),n=e.createdAt,r=e.metadata;switch(e.type){case"text":return r?.isThinking?{type:"thinking",content:e.content,time:t,timestamp:n}:{type:"text",content:e.content,time:t,timestamp:n};case"status":{const o=r?.action;return o&&["chat","chat_stream","task_execution","respond_in_session"].includes(o)?null:{type:"status",content:e.content,time:t,timestamp:n}}case"error":return{type:"error",content:e.content,time:t,timestamp:n};case"tool_start":return{type:"tool",time:t,timestamp:n,key:`es_${e.seq}`,info:{tool:e.content,status:"running",args:r?.arguments,subagentLogs:r?.subagentLogs}};case"tool_end":return{type:"tool",time:t,timestamp:n,key:`ee_${e.seq}`,info:{tool:e.content,status:r?.success===!1?"error":"done",args:r?.arguments,result:r?.result,error:r?.error,durationMs:r?.durationMs,subagentLogs:r?.subagentLogs}};default:return null}}function W3(e,t){if(e!=="task_create"&&e!=="create_task"||!t)return null;try{const n=JSON.parse(t);if(!n.task)return null;const r=n.task;return{taskId:r.id,title:r.title,description:r.description,assignedAgentId:r.assignedAgentId,priority:r.priority}}catch{return null}}function Y3(e,t){if(e!=="requirement_propose"||!t)return null;try{const n=JSON.parse(t);if(n.status!=="success"||!n.requirement)return null;const r=n.requirement;return r.status!=="pending"?null:{requirementId:r.id,title:r.title,description:r.description,priority:r.priority}}catch{return null}}const X3={code:s.jsxs(s.Fragment,{children:[s.jsx("polyline",{points:"16 18 22 12 16 6"}),s.jsx("polyline",{points:"8 6 2 12 8 18"})]}),search:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"11",cy:"11",r:"8"}),s.jsx("path",{d:"m21 21-4.3-4.3"})]}),clipboard:s.jsxs(s.Fragment,{children:[s.jsx("rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}),s.jsx("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"})]}),"check-circle":s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("path",{d:"m9 12 2 2 4-4"})]}),server:s.jsxs(s.Fragment,{children:[s.jsx("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),s.jsx("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),s.jsx("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),s.jsx("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]}),"file-text":s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),s.jsx("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),s.jsx("path",{d:"M10 9H8"}),s.jsx("path",{d:"M16 13H8"}),s.jsx("path",{d:"M16 17H8"})]}),"book-open":s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M12 7v14"}),s.jsx("path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"})]}),users:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),s.jsx("circle",{cx:"9",cy:"7",r:"4"}),s.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),s.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}),"dollar-sign":s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"12",x2:"12",y1:"2",y2:"22"}),s.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})]}),megaphone:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"m3 11 18-5v12L3 14v-3z"}),s.jsx("path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6"})]}),edit:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M12 20h9"}),s.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),headphones:s.jsx(s.Fragment,{children:s.jsx("path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5a9 9 0 0 1 18 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3"})}),settings:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),s.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),target:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("circle",{cx:"12",cy:"12",r:"6"}),s.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),zap:s.jsx(s.Fragment,{children:s.jsx("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})}),terminal:s.jsxs(s.Fragment,{children:[s.jsx("polyline",{points:"4 17 10 11 4 5"}),s.jsx("line",{x1:"12",x2:"20",y1:"19",y2:"19"})]}),sparkles:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .962 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.962 0z"}),s.jsx("path",{d:"M20 3v4"}),s.jsx("path",{d:"M22 5h-4"})]}),wrench:s.jsx(s.Fragment,{children:s.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),globe:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),s.jsx("path",{d:"M2 12h20"})]}),link:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),s.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),bot:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M12 8V4H8"}),s.jsx("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),s.jsx("path",{d:"M2 14h2"}),s.jsx("path",{d:"M20 14h2"}),s.jsx("path",{d:"M15 13v2"}),s.jsx("path",{d:"M9 13v2"})]}),"message-square":s.jsx(s.Fragment,{children:s.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),newspaper:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2"}),s.jsx("path",{d:"M18 14h-8"}),s.jsx("path",{d:"M15 18h-5"}),s.jsx("path",{d:"M10 6h8v4h-8V6Z"})]}),layers:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"}),s.jsx("path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"}),s.jsx("path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"})]}),"bar-chart":s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"12",x2:"12",y1:"20",y2:"10"}),s.jsx("line",{x1:"18",x2:"18",y1:"20",y2:"4"}),s.jsx("line",{x1:"6",x2:"6",y1:"20",y2:"16"})]}),folder:s.jsx(s.Fragment,{children:s.jsx("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"})}),"git-branch":s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"6",x2:"6",y1:"3",y2:"15"}),s.jsx("circle",{cx:"18",cy:"6",r:"3"}),s.jsx("circle",{cx:"6",cy:"18",r:"3"}),s.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),save:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"}),s.jsx("path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"}),s.jsx("path",{d:"M7 3v4a1 1 0 0 0 1 1h7"})]}),camera:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"}),s.jsx("circle",{cx:"12",cy:"13",r:"3"})]}),clock:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"12 6 12 12 16 14"})]}),database:s.jsxs(s.Fragment,{children:[s.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),s.jsx("path",{d:"M3 5v14a9 3 0 0 0 18 0V5"}),s.jsx("path",{d:"M3 12a9 3 0 0 0 18 0"})]}),lightbulb:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"}),s.jsx("path",{d:"M9 18h6"}),s.jsx("path",{d:"M10 22h4"})]}),"alert-circle":s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),s.jsx("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),"square-terminal":s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"m7 11 2-2-2-2"}),s.jsx("path",{d:"M11 13h4"}),s.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"})]}),package:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"m7.5 4.27 9 5.15"}),s.jsx("path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}),s.jsx("path",{d:"m3.3 7 8.7 5 8.7-5"}),s.jsx("path",{d:"M12 22V12"})]})};function MK(e){return!!e&&e in X3}function Yo({name:e,size:t=24,className:n=""}){const r=X3[e];return r?s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:n,"aria-hidden":!0,children:r}):null}const x4={"coding-tools":"terminal",markitdown:"file-text","markus-admin-cli":"terminal",codex:"code","team-building":"users","claude-code":"code","skill-building":"wrench","workflow-building":"layers","chrome-devtools":"globe","markus-hub-connector":"link","cursor-agent":"bot","agent-building":"bot","feishu-interaction":"message-square","content-publishing":"edit","research-report":"book-open","daily-digest":"newspaper"},y4={development:"code",开发工具:"code",devops:"server",data:"bar-chart",数据分析:"bar-chart",productivity:"zap",效率提升:"zap",communication:"message-square",通讯协作:"message-square",browser:"globe",内容创作:"edit","AI 智能":"sparkles"};function Vd(e,t){const n=(e||"").toLowerCase();return x4[n]?x4[n]:t&&y4[t]?y4[t]:"layers"}function RK(e){const t=[];for(const n of e)if(n.phase!=="output"){if(n.phase==="start"){const r=`${n.tool}_${n.ts}`;t.push({key:r,tool:n.tool,status:"running"})}else for(let r=t.length-1;r>=0;r--)if(t[r].tool===n.tool&&t[r].status==="running"){t[r]={...t[r],status:n.success===!1?"error":"done"};break}}return t}function Q3(){return s.jsxs("svg",{className:"w-3 h-3 animate-spin text-brand-500 shrink-0",viewBox:"0 0 24 24",fill:"none",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}function LK(){return s.jsx("span",{className:"flex items-center gap-0.5",children:[0,150,300].map(e=>s.jsx("span",{className:"w-1 h-1 rounded-full bg-brand-400 animate-bounce",style:{animationDelay:`${e}ms`,animationDuration:"1s"}},e))})}function v4({item:e}){const{t}=ft("common"),n=Ai(e.tool);return s.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[s.jsx(Yo,{name:n.iconName,size:15,className:`shrink-0 ${e.status==="running"?"text-brand-500":e.status==="error"?"text-red-500":"text-green-500"}`}),s.jsxs("span",{className:`text-xs ${e.status==="running"?"activity-text-shimmer":e.status==="error"?"text-fg-tertiary":"text-fg-secondary"}`,children:[t(`execution.tools.${n.key}`,{defaultValue:n.label}),e.status==="running"?"…":""]}),e.status==="running"&&s.jsx(Q3,{})]})}function OK({activities:e,isActive:t,persistent:n}){const{t:r}=ft("common"),o=RK(e),[l,c]=k.useState(!1),d=o.length>0,m=d&&o.every(w=>w.status!=="running");if(n&&m){const w=o.filter(T=>T.status==="error").length,C=o.filter(T=>T.status==="done").length;return s.jsxs("div",{className:"mb-3 border-b border-border-default/50 pb-2",children:[s.jsxs("button",{onClick:()=>c(T=>!T),className:"flex items-center gap-1.5 text-xs text-fg-tertiary hover:text-fg-secondary transition-colors select-none",children:[s.jsx("span",{className:`transition-transform duration-150 ${l?"rotate-90":""}`,children:"▶"}),s.jsx("span",{className:"font-medium",children:r("activity.step",{count:C})}),w>0&&s.jsxs("span",{className:"text-red-500 ml-0.5",children:["· ",r("activity.failed",{count:w})]}),!l&&s.jsxs("span",{className:"ml-1 flex items-center gap-1",children:[o.slice(0,5).map(T=>{const S=Ai(T.tool);return s.jsx(Yo,{name:S.iconName,size:13,className:`shrink-0 ${T.status==="error"?"text-red-500":"text-green-500"}`},T.key)}),o.length>5&&s.jsxs("span",{className:"text-[10px] text-fg-tertiary",children:["+",o.length-5]})]})]}),l&&s.jsx("div",{className:"mt-2 space-y-0.5",children:o.map((T,S)=>s.jsx(v4,{item:T,idx:S,total:o.length},T.key))})]})}if(!d)return s.jsxs("div",{className:"flex items-center gap-1.5 text-xs py-0.5",children:[s.jsx("span",{className:"mr-0.5 activity-text-shimmer",children:r("activity.thinking")}),s.jsx(LK,{})]});const f=o.filter(w=>w.status==="error").length;let h=null;for(let w=o.length-1;w>=0;w--)if(o[w].status==="running"){h=o[w];break}const g=o[o.length-1];let y;if(h){const w=Ai(h.tool);y=`${r(`execution.tools.${w.key}`,{defaultValue:w.label})}…`}else if(t&&m)y=r("activity.writingResponse");else{const w=Ai(g.tool);y=r(`execution.tools.${w.key}`,{defaultValue:w.label})}const x=!!h||t&&m;return s.jsxs("div",{className:"mb-1",children:[s.jsxs("button",{onClick:w=>{w.stopPropagation(),c(C=>!C)},className:"flex items-center gap-1.5 text-xs w-full min-w-0 select-none text-fg-tertiary hover:text-fg-secondary transition-colors",children:[s.jsx("span",{className:`shrink-0 transition-transform duration-150 ${l?"rotate-90":""}`,children:"▶"}),s.jsx("span",{className:`truncate font-medium ${x?"activity-text-shimmer":"text-fg-secondary"}`,children:y}),s.jsxs("span",{className:"shrink-0",children:["· ",r("activity.step",{count:o.length})]}),f>0&&s.jsxs("span",{className:"text-red-500 shrink-0",children:["· ",r("activity.failed",{count:f})]}),x&&s.jsx(Q3,{})]}),l&&s.jsx("div",{className:"mt-1 space-y-0.5",children:o.map((w,C)=>s.jsx(v4,{item:w,idx:C,total:o.length},w.key))})]})}const DK={"claude-code":{label:"Claude Code",icon:"🤖",badgeClass:"bg-orange-500/15 text-orange-500"},codex:{label:"Codex",icon:"⬡",badgeClass:"bg-emerald-500/15 text-emerald-500"},"cursor-agent":{label:"Cursor",icon:"▶",badgeClass:"bg-blue-500/15 text-blue-500"}},Do=["created","context_injected","running"],IK=new Set(["completed","failed","cancelled","timeout"]),w4={created:"Created",context_injected:"Context injected",running:"Running",completed:"Completed",failed:"Failed",cancelled:"Cancelled",timeout:"Timed out"};function PK(e){return DK[e]??{label:e.replace(/-/g," ").replace(/\b\w/g,t=>t.toUpperCase()),icon:"⚙",badgeClass:"bg-surface-elevated text-fg-tertiary"}}function zK(e,t){if(e.cost?.durationMs!=null)return e.cost.durationMs;const n=e.startedAt??e.createdAt,r=new Date(n).getTime();if(!Number.isNaN(r)){if(e.completedAt){const o=new Date(e.completedAt).getTime();return Number.isNaN(o)?void 0:Math.max(0,o-r)}if(e.status==="running"||e.status==="context_injected")return Math.max(0,t-r)}}function BK(e){if(e==="completed"||IK.has(e))return Do.length;const t=Do.indexOf(e);return t>=0?t:0}function $K({session:e,className:t}){const n=PK(e.tool),[r,o]=k.useState(!1),[l,c]=k.useState(()=>Date.now()),d=e.status==="running"||e.status==="context_injected"||e.status==="created",m=e.status==="failed"||e.status==="timeout"||e.result?.success===!1,f=e.status==="completed"||e.result?.success===!0;k.useEffect(()=>{if(!d)return;const w=setInterval(()=>c(Date.now()),1e3);return()=>clearInterval(w)},[d]);const h=k.useMemo(()=>zK(e,l),[e,l]),g=BK(e.status),y=e.result?.rawOutput??(f||m?e.result?.summary:void 0),x=d?"border-brand-500/40 bg-brand-500/5":m?"border-red-500/30 bg-red-500/5":f?"border-green-500/30 bg-green-500/5":"border-border-default bg-surface-secondary/30";return s.jsxs("div",{className:`my-2 rounded-lg border ${x} p-3 max-w-2xl transition-colors ${t??""}`,children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:"text-sm mt-0.5",children:n.icon}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${n.badgeClass}`,children:n.label}),s.jsx("span",{className:`text-[10px] font-medium ${d?"text-brand-500":m?"text-red-500":f?"text-green-500":"text-fg-tertiary"}`,children:w4[e.status]??e.status}),h!=null&&s.jsx("span",{className:"text-[10px] text-fg-tertiary tabular-nums",children:$o(h)}),e.cost?.estimatedCostUsd!=null&&s.jsxs("span",{className:"text-[10px] text-fg-tertiary tabular-nums",children:["$",e.cost.estimatedCostUsd.toFixed(4)]})]}),s.jsx("div",{className:"text-xs text-fg-secondary mt-1 line-clamp-2",children:e.prompt})]}),d&&s.jsxs("svg",{className:"w-3.5 h-3.5 animate-spin text-brand-500 shrink-0 mt-0.5",viewBox:"0 0 24 24",fill:"none",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})]}),s.jsxs("div",{className:"flex items-center gap-1 mt-3 ml-6",children:[Do.map((w,C)=>{const T=g>C||g===C&&!d&&f,S=g===C&&d,E=m&&C===Do.length-1&&e.status!=="completed";return s.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-0",children:[s.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${E?"bg-red-500":T?"bg-green-500":S?"bg-brand-500 animate-pulse":"bg-gray-600"}`,title:w4[w]}),C<Do.length-1&&s.jsx("div",{className:`h-px flex-1 ${T?"bg-green-500/50":"bg-border-default/60"}`})]},w)}),s.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${m?"bg-red-500":f?"bg-green-500":"bg-gray-600"}`,title:m?"Failed":"Done"})]}),(e.progressMessage||e.progressPercent!=null)&&d&&s.jsxs("div",{className:"mt-2 ml-6 space-y-1",children:[e.progressPercent!=null&&s.jsx("div",{className:"h-1 bg-surface-elevated rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-brand-500 transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progressPercent))}%`}})}),e.progressMessage&&s.jsx("div",{className:"text-[11px] text-fg-tertiary font-mono truncate",children:e.progressMessage})]}),e.result&&!d&&s.jsxs("div",{className:"mt-2 ml-6 space-y-1.5",children:[e.result.summary&&s.jsx("div",{className:"text-xs text-fg-secondary",children:e.result.summary}),e.result.diffStats&&s.jsxs("div",{className:"flex items-center gap-3 text-[10px] font-mono",children:[s.jsxs("span",{className:"text-fg-tertiary",children:[e.result.diffStats.filesChanged," files"]}),s.jsxs("span",{className:"text-green-500",children:["+",e.result.diffStats.additions]}),s.jsxs("span",{className:"text-red-500",children:["−",e.result.diffStats.deletions]})]}),e.cost&&(e.cost.inputTokens!=null||e.cost.outputTokens!=null)&&s.jsxs("div",{className:"text-[10px] text-fg-tertiary",children:[e.cost.inputTokens!=null&&s.jsxs("span",{children:[e.cost.inputTokens.toLocaleString()," in"]}),e.cost.inputTokens!=null&&e.cost.outputTokens!=null&&s.jsx("span",{className:"mx-1",children:"·"}),e.cost.outputTokens!=null&&s.jsxs("span",{children:[e.cost.outputTokens.toLocaleString()," out"]})]})]}),y&&s.jsxs("div",{className:"mt-2 ml-6 border-t border-border-default/30 pt-2",children:[s.jsxs("button",{type:"button",onClick:()=>o(!r),className:"flex items-center gap-1.5 text-[10px] text-fg-tertiary hover:text-fg-secondary transition-colors",children:[s.jsx("svg",{className:`w-3 h-3 transition-transform ${r?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),s.jsx("span",{className:"font-medium uppercase tracking-wider",children:"Raw output"})]}),r&&s.jsx("pre",{className:"mt-2 text-[11px] text-fg-tertiary bg-surface-elevated/70 rounded-lg px-3 py-2 overflow-x-auto max-h-48 overflow-y-auto whitespace-pre-wrap break-all font-mono",children:y})]})]})}function HK({label:e}){const{t}=ft("common");return s.jsxs("div",{className:"flex items-center gap-1.5 text-xs py-0.5",children:[s.jsx("span",{className:"activity-text-shimmer",children:e??t("execution.thinking")}),s.jsx("span",{className:"flex gap-0.5",children:[0,150,300].map(n=>s.jsx("span",{className:"w-1 h-1 rounded-full bg-brand-400 animate-bounce",style:{animationDelay:`${n}ms`,animationDuration:"1s"}},n))})]})}const k4=150;function UK({content:e,className:t}){const[n,r]=k.useState(e),o=k.useRef(0),l=k.useRef(null);k.useEffect(()=>{const d=Date.now(),m=d-o.current;return m>=k4?(o.current=d,r(e)):l.current||(l.current=setTimeout(()=>{o.current=Date.now(),l.current=null,r(e)},k4-m)),()=>{l.current&&(clearTimeout(l.current),l.current=null)}},[e]);const c=k.useMemo(()=>n,[n]);return s.jsxs("div",{className:"bg-surface-elevated/50 rounded-lg px-3 py-2.5 my-1 min-w-0 overflow-hidden",children:[s.jsx(Er,{content:c,className:t??"text-sm text-fg-secondary break-words"}),s.jsx("span",{className:"inline-block w-0.5 h-4 bg-brand-400 animate-pulse ml-0.5 align-middle"})]})}const v0=8e3,Td=120;function eh({text:e,className:t}){const{t:n}=ft("common"),[r,o]=k.useState(!1),l=e.length>v0,c=!l||r?e:`${e.slice(0,v0)}
@@ -660,7 +660,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Rn=We,rn=wt),Ht===void
660
660
  `)}),c.toolCalls?.length)for(let m=0;m<c.toolCalls.length;m++){const f=c.toolCalls[m];d.push({type:"tool",key:`${f.tool}_${m}`,tool:f.tool,status:f.status==="error"?"error":"done",args:f.arguments,result:f.result,durationMs:f.durationMs})}d.length>0&&(d.push({type:"text",content:e.text}),l.segments=d)}return l}function eX(e,t,n){const r=t?new Date(t):new Date;if(isNaN(r.getTime()))return e;const o=new Date,l=new Date(o.getFullYear(),o.getMonth(),o.getDate()).getTime(),c=r.getTime(),d=r.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});return c>=l?d:c>=l-864e5?`${n?.yesterday??"Yesterday"} ${d}`:r.toLocaleDateString(void 0,{month:"short",day:"numeric"})+" "+d}function tX(e){if(!e)return"";const t=new Date(e);return isNaN(t.getTime())?"":`${t.getFullYear()}-${t.getMonth()+1}-${t.getDate()}`}function nX(e,t){const n=new Date(e);if(isNaN(n.getTime()))return"";const r=new Date,o=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),l=n.getTime();return l>=o?t?.today??"Today":l>=o-864e5?t?.yesterday??"Yesterday":n.toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"})}function rX(e,t){let n=0,r=null;return((...o)=>{const l=Date.now(),c=t-(l-n);if(c<=0)return r&&(clearTimeout(r),r=null),n=l,e(...o);r||(r=setTimeout(()=>{n=Date.now(),r=null,e(...o)},c))})}function aX({priority:e}){const t=e==="high"||e==="critical";return s.jsxs("div",{className:`inline-flex items-center gap-1 mt-1.5 px-2 py-0.5 rounded-full text-[10px] font-medium ${t?"bg-amber-500/10 text-amber-500 border border-amber-500/20":"bg-brand-500/10 text-brand-400 border border-brand-500/20"}`,children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),s.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]}),s.jsxs("span",{children:["Notification",e&&e!=="normal"?` · ${e}`:""]})]})}function sX({name:e,agentId:t,agents:n,onViewProfile:r}){const{t:o}=ft(["team","common"]),[l,c]=k.useState(!1),d=k.useRef(null),m=t?n.find(f=>f.id===t):n.find(f=>f.name===e);return k.useEffect(()=>{if(!l)return;const f=h=>{d.current&&!d.current.contains(h.target)&&c(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[l]),m?s.jsxs("span",{ref:d,className:"relative inline-block",children:[s.jsx("button",{onClick:()=>c(!l),className:"text-fg-tertiary hover:text-brand-500 cursor-pointer transition-colors",children:e}),l&&s.jsxs("div",{className:"absolute left-0 top-full mt-1.5 bg-surface-secondary border border-border-default rounded-xl shadow-2xl z-40 w-56 p-3 space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Hs,{name:m.name,avatarUrl:m.avatarUrl,size:28,bgClass:"bg-brand-500/15 text-brand-600"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-xs text-fg-primary font-medium truncate",children:m.name}),s.jsxs("div",{className:"text-[10px] text-fg-tertiary",children:[m.role," · ",m.agentRole??o("page.workerRole")]})]}),s.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${m.status==="working"?"bg-blue-400 animate-pulse":m.status==="error"?"bg-red-400":"bg-green-400"}`})]}),s.jsx("button",{onClick:()=>{c(!1),r?.(m.id)},className:"w-full text-center text-[10px] text-brand-500 hover:text-brand-500 border border-border-default hover:border-gray-600 rounded-lg py-1 transition-colors",children:o("page.viewProfileArrow")})]})]}):s.jsx("span",{children:e})}function iX({agent:e,anchorRect:t,onClose:n,onViewProfile:r}){const{t:o}=ft(["common","team"]),l=k.useRef(null);k.useEffect(()=>{const f=h=>{l.current&&!l.current.contains(h.target)&&n()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[n]);const c=e.status==="idle"?"bg-green-400":e.status==="working"?"bg-blue-400 animate-pulse":e.status==="error"?"bg-red-400":"bg-gray-500",d=e.status==="idle"?o("common:status.online"):e.status==="working"?o("common:status.working"):e.status==="error"?o("common:status.error"):o("common:status.offline"),m=k.useCallback(f=>{if(!f)return;l.current=f;const h=f.getBoundingClientRect(),g=window.innerWidth,y=window.innerHeight,x=8;h.right>g-x&&(f.style.left=`${Math.max(x,g-h.width-x)}px`),h.left<x&&(f.style.left=`${x}px`),h.bottom>y-x&&(f.style.top=`${Math.max(x,y-h.height-x)}px`)},[]);return s.jsxs("div",{ref:m,className:"fixed z-50 w-64 max-w-[calc(100vw-1rem)] bg-surface-secondary border border-border-default rounded-xl shadow-2xl p-4 space-y-3",style:{top:t.top+40,left:t.left},children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Hs,{name:e.name,avatarUrl:e.avatarUrl,size:40,bgClass:"bg-brand-500/15 text-brand-600"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-sm text-fg-primary font-medium truncate",children:e.name}),s.jsx("div",{className:"text-[11px] text-fg-tertiary",children:e.role}),s.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[s.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${c}`}),s.jsx("span",{className:"text-[10px] text-fg-secondary",children:d}),e.agentRole&&s.jsxs("span",{className:"text-[10px] text-fg-tertiary",children:["· ",e.agentRole]})]})]})]}),s.jsx("button",{onClick:()=>{n(),r(e.id)},className:"w-full py-1.5 text-xs text-brand-500 hover:text-brand-500 border border-border-default hover:border-gray-600 rounded-lg transition-colors text-center",children:o("team:page.viewProfileArrow")})]})}function sW(e){const t=String(e);return t.includes("MARKUS_UPSTREAM_ERROR")?!1:t.includes("CU_EXCEEDED")||t.includes("CU_MONTHLY_EXCEEDED")}const n6="markus:credit-notif-muted";let E4=0;function oX(){try{if(localStorage.getItem(n6))return}catch{}const e=Date.now();e-E4<5*6e4||(E4=e,window.dispatchEvent(new CustomEvent("markus:credit-exhausted")))}function iW(){try{localStorage.setItem(n6,"1")}catch{}}function lX(e,t){const n=String(e);if(n.includes("AbortError")||n.includes("abort"))return"";let r="";const o=n.match(/\{[\s\S]*\}/);if(o)try{const d=JSON.parse(o[0]);r=d.error?.message??d.message??""}catch{}if(!r){const d=n.lastIndexOf(": ");d>=0&&(r=n.slice(d+2).trim())}const l=(d,m)=>t(`team:errors.${d}`,m);if(n.includes("MARKUS_UPSTREAM_ERROR"))return l("aiUpstreamBillingMismatch",{detail:r||l("defaultUpstreamBillingMismatch")});if(sW(n)||n.includes("CU_EXCEEDED"))return l("markusCuExceeded");if(n.includes("CU_WINDOW_EXCEEDED"))return l("markusWindowExceeded");if(n.includes("MARKUS_RATE_LIMITED"))return l("markusRateLimited");if(/not available in your region/i.test(n))return l("aiRegionBlocked",{model:(n.match(/\[(?:markus|openrouter):([^\]]+)\]/i)?.[1]||"").trim()||"—"});if(n.includes("401")||/unauthorized|invalid.?api.?key/i.test(n))return l("ai401",{detail:r||l("defaultInvalidApiKey")});if(n.includes("429")||/rate.?limit/i.test(n))return l("ai429",{detail:r||l("defaultTooManyRequests")});if(/\b409\b/.test(n)||/conflict/i.test(n))return l("ai409",{detail:r||l("defaultConflict")});if(n.includes("502")||/bad.?gateway/i.test(n))return l("ai502",{detail:r||l("defaultUpstreamDown")});if(n.includes("503")||/service.?unavailable/i.test(n))return l("ai503",{detail:r||l("defaultServiceDown")});const c=(r||n).replace(/https?:\/\/[^\s]*openrouter\.ai[^\s]*/gi,"").trim();return l("aiGeneric",{detail:(c||n).slice(0,120)})}function cX({msg:e,onCopy:t,onRetry:n,onResume:r,onReply:o,onRemember:l,isCopied:c,isLastAgentMsg:d,showRemember:m}){const{t:f}=ft(["team","common"]),h=e.isError||e.sender==="agent"&&e.text.startsWith("⚠"),g=e.isStopped,y=!!e.emptyReply||e.sender==="agent"&&!e.text?.trim()&&!e.segments?.some(C=>C.type==="text"&&(C.content||C.thinking)||C.type==="tool"),x=d!==!1,w=JK(m,e.sender)&&!!l;return s.jsxs("div",{className:"flex items-center flex-wrap gap-0.5 mt-1",children:[s.jsxs("button",{onClick:()=>t(e),className:"flex items-center gap-1 px-2 py-0.5 rounded text-[11px] text-fg-tertiary hover:text-fg-primary hover:bg-surface-overlay/60 transition-colors",title:f("common:copy"),children:[c?s.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}):s.jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),s.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),f(c?"common:copied":"common:copy")]}),x&&r&&s.jsxs("button",{onClick:()=>r(e),className:"flex items-center gap-1 px-2 py-0.5 rounded text-[11px] text-green-500 hover:text-green-400 hover:bg-green-500/10 transition-colors",title:f("page.messageActions.resumeTitle"),children:[s.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),f("page.messageActions.resumeTitle")]}),x&&g&&n&&s.jsxs("button",{onClick:()=>n(e),className:"flex items-center gap-1 px-2 py-0.5 rounded text-[11px] text-brand-500 hover:text-brand-500 hover:bg-brand-500/10 transition-colors",title:f("page.messageActions.reaskTitle"),children:[s.jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("polyline",{points:"23 4 23 10 17 10"}),s.jsx("path",{d:"M20.49 15a9 9 0 11-2.12-9.36L23 10"})]}),f("page.messageActions.reaskTitle")]}),x&&(h||y)&&!g&&n&&s.jsxs("button",{onClick:()=>n(e),className:"flex items-center gap-1 px-2 py-0.5 rounded text-[11px] text-amber-600 hover:text-amber-600 hover:bg-amber-500/10 transition-colors",title:f("page.messageActions.retryTitle"),children:[s.jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("polyline",{points:"23 4 23 10 17 10"}),s.jsx("path",{d:"M20.49 15a9 9 0 11-2.12-9.36L23 10"})]}),f("page.messageActions.retryTitle")]}),x&&!h&&!y&&!g&&e.sender==="agent"&&n&&s.jsxs("button",{onClick:()=>n(e),className:"flex items-center gap-1 px-2 py-0.5 rounded text-[11px] text-fg-tertiary hover:text-fg-primary hover:bg-surface-overlay/60 transition-colors",title:f("page.messageActions.retryTitle"),children:[s.jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("polyline",{points:"23 4 23 10 17 10"}),s.jsx("path",{d:"M20.49 15a9 9 0 11-2.12-9.36L23 10"})]}),f("page.messageActions.retryTitle")]}),o&&s.jsxs("button",{onClick:()=>o(e),className:"flex items-center gap-1 px-2 py-0.5 rounded text-[11px] text-fg-tertiary hover:text-fg-primary hover:bg-surface-overlay/60 transition-colors",title:f("page.messageActions.replyTitle"),children:[s.jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("polyline",{points:"9 17 4 12 9 7"}),s.jsx("path",{d:"M20 18v-2a4 4 0 00-4-4H4"})]}),f("page.messageActions.replyTitle")]}),w&&s.jsxs("button",{type:"button",onClick:()=>l(e),className:"flex items-center gap-1 px-2 py-0.5 rounded text-[11px] text-fg-tertiary hover:text-fg-primary hover:bg-surface-overlay/60 transition-colors",title:f("page.messageActions.rememberTitle"),children:[s.jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M12 2a7 7 0 00-4 12.7V19a1 1 0 001 1h6a1 1 0 001-1v-4.3A7 7 0 0012 2z"}),s.jsx("path",{d:"M9 22h6"})]}),f("page.messageActions.rememberTitle")]}),e.sender==="agent"&&s.jsx("span",{className:"ml-1 px-1 text-[10px] leading-none text-fg-tertiary/70 select-none whitespace-nowrap",children:f("page.messageActions.aiGeneratedDisclaimer")})]})}function uX({busy:e,onConfirm:t,onCancel:n}){const{t:r}=ft(["team","common"]),[o,l]=k.useState("");return Sa.createPortal(s.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-[10050] p-4",onClick:n,children:s.jsxs("div",{className:"bg-surface-secondary border border-border-default rounded-xl p-6 w-[400px] max-w-[calc(100vw-2rem)] shadow-2xl",onClick:c=>c.stopPropagation(),children:[s.jsx("h3",{className:"font-semibold text-base text-fg-primary",children:r("page.messageActions.rememberModalTitle")}),s.jsx("p",{className:"text-sm text-fg-secondary mt-1.5 leading-relaxed",children:r("page.messageActions.rememberModalHint")}),s.jsx("textarea",{value:o,onChange:c=>l(c.target.value),placeholder:r("page.messageActions.rememberModalPlaceholder"),rows:3,disabled:e,className:"mt-3 w-full px-3 py-2 text-sm bg-surface-primary border border-border-default rounded-lg outline-none focus:border-brand-500/50 resize-y min-h-[72px]"}),s.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[s.jsx("button",{type:"button",onClick:n,disabled:e,className:"px-4 py-1.5 text-sm text-fg-secondary hover:text-fg-primary rounded-lg transition-colors",children:r("page.messageActions.rememberCancel")}),s.jsx("button",{type:"button",onClick:()=>t(o),disabled:e,className:"px-4 py-1.5 text-sm bg-brand-600 hover:bg-brand-500 disabled:opacity-60 text-white rounded-lg transition-colors",children:e?r("common:loading",{defaultValue:"…"}):r("page.messageActions.rememberConfirm")})]})]})}),document.body)}function _4(e,t,n){if(!e)return[];const r=[];let o=0;const l=t??"";let d=n?new Date(n).getTime():Date.now();const m=e.some(E=>E.createdAt),f=E=>{if(E.createdAt)return E.createdAt;if(m)return new Date(d).toISOString();const j=new Date(d).toISOString();return E.type==="tool"&&E.durationMs?d+=E.durationMs:d+=1e3,j};let h="",g="",y="";const x=()=>{const E=h.trim();if(E){const j=r[r.length-1];j&&j.type==="text"&&j.metadata?.isThinking?j.content+=(j.content?`
661
661
 
662
662
  `:"")+E:r.push({id:`cseg_${o}`,sourceType:"chat",sourceId:"",agentId:l,seq:o++,type:"text",content:E,createdAt:y,metadata:{isThinking:!0}})}h=""},w=()=>{const E=g.trim();E&&r.push({id:`cseg_${o}`,sourceType:"chat",sourceId:"",agentId:l,seq:o++,type:"text",content:E,createdAt:y}),g=""},C="<think>",T="</think>",S=E=>{let j=0,L=!1;for(;j<E.length;)if(L){const I=E.indexOf(T,j);I===-1?j=E.length:(L=!1,j=I+T.length)}else{const I=E.indexOf(C,j);I===-1?(g+=E.slice(j),j=E.length):(g+=E.slice(j,I),L=!0,j=I+C.length)}};for(const E of e)if(y=f(E),E.type==="tool"){w();const j=E.createdAt&&E.durationMs?new Date(new Date(E.createdAt).getTime()-E.durationMs).toISOString():y;r.push({id:`cseg_${o}`,sourceType:"chat",sourceId:"",agentId:l,seq:o++,type:"tool_start",content:E.tool,metadata:{arguments:E.args,...E.status==="running"&&E.subagentLogs?.length?{subagentLogs:E.subagentLogs}:{}},createdAt:j}),E.status!=="running"&&r.push({id:`cseg_${o}`,sourceType:"chat",sourceId:"",agentId:l,seq:o++,type:"tool_end",content:E.tool,metadata:{arguments:E.args,result:E.result,error:E.error,durationMs:E.durationMs,success:E.status!=="error",...E.subagentLogs?.length?{subagentLogs:E.subagentLogs}:{}},createdAt:y})}else E.thinking&&(w(),h+=E.thinking,x()),S(Yg(E.content).cleaned);return w(),r}const dX=k.memo(function({msg:t,isStreaming:n,liveActivities:r,onMentionClick:o,knownNames:l}){const{t:c}=ft(["team","common"]),d=t.segments,m=t.isStopped,f=j=>j.type==="text"?j.content.length+(j.thinking?.length??0):(j.result?.length??0)+(j.subagentLogs?.length??0)*1e3+(j.liveOutput?.length??0),h=d?d.length+":"+(d.length>0?f(d[d.length-1]):0):"",g=d?d.reduce((j,L)=>j+(L.type==="tool"?L.subagentLogs?.length??0:0),0):0,y=k.useMemo(()=>d&&d.length>0?_4(d,t.agentId,t.rawCreatedAt):[],[h,g,t.agentId,t.rawCreatedAt]),x=t.committedSegments,w=x?x.length+":"+(x.length>0?f(x[x.length-1]):0):"",C=x?x.reduce((j,L)=>j+(L.type==="tool"?L.subagentLogs?.length??0:0),0):0,T=k.useMemo(()=>n?y:x&&x.length>0?_4(x,t.agentId,t.rawCreatedAt):y,[n,w,C,t.agentId,t.rawCreatedAt,y]);if(d!==void 0&&d.length>0){const j=d.some(z=>z.type==="tool"),L=d.filter(z=>z.type==="text"),I=n?null:L.map(z=>z.content).join(""),O=z=>z.replace(/\n*<!--\s*notify_context:\s*[\s\S]*?-->/g,"").replace(/<think>[\s\S]*?(<\/think>|$)/g,"").replace(/<(invoke|function_calls|antml:\w+)\b[\s\S]*?(<\/\1>|$)/g,"").replace(/<\/?(invoke|function_calls|antml:\w+)[^>]*>/g,"").trim()||null,V=(I?O(I):null)||(!n&&t.text?O(t.text):null),X=[];for(const z of d){if(z.type!=="tool")continue;const G=W3(z.tool,z.result);if(G){X.push({key:`task-${G.taskId}`,kind:"task",info:G});continue}const se=Y3(z.tool,z.result);se&&X.push({key:`req-${se.requirementId}`,kind:"req",info:se})}return s.jsxs("div",{className:"space-y-2 min-h-[1em] min-w-0 overflow-x-hidden",children:[j||n?s.jsx(ZK,{entries:T,isActive:n,embedded:!0,hideApprovalCards:!0}):V&&s.jsx(Er,{content:V,onMentionClick:o,knownNames:l}),X.map(z=>z.kind==="task"?s.jsx(J3,{info:z.info},z.key):s.jsx(e6,{info:z.info},z.key)),!n&&!V&&!j&&X.length===0&&!m&&(t.emptyReply||!t.isError)&&s.jsx("div",{className:"flex items-start gap-1.5 text-[13px] text-fg-tertiary leading-relaxed",children:s.jsx("span",{children:c("page.emptyReply")})}),!n&&(t.isError||t.text.startsWith("⚠"))&&t.text&&!d?.some(z=>z.type==="text"&&z.content&&(z.content===t.text||z.content.startsWith("⚠")))&&s.jsx("p",{className:"mt-1.5 text-[13px] text-fg-tertiary leading-relaxed whitespace-pre-wrap",children:t.text.replace(/^⚠\s*/,"")}),m&&s.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5 text-[11px] text-fg-tertiary",children:[s.jsx("svg",{className:"w-3 h-3 shrink-0",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})}),s.jsx("span",{children:c("page.stopped")})]})]})}const S=(t.activities?.length??0)>0,E=t.text?t.text.replace(/<think>[\s\S]*?(<\/think>|$)/g,"").replace(/<(invoke|function_calls|antml:\w+)\b[\s\S]*?(<\/\1>|$)/g,"").replace(/<\/?(invoke|function_calls|antml:\w+)[^>]*>/g,"").trim():"";return s.jsxs(s.Fragment,{children:[(n||S)&&s.jsx(OK,{activities:n?r:t.activities??[],isActive:n,persistent:!n&&S}),E?t.isError||E.startsWith("⚠")?s.jsx("p",{className:"text-[13px] text-fg-tertiary leading-relaxed whitespace-pre-wrap",children:E.replace(/^⚠\s*/,"")}):s.jsx(Er,{content:E,onMentionClick:o,knownNames:l}):null,!n&&!E&&!S&&!m&&t.sender==="agent"&&(t.emptyReply||!t.isError)&&s.jsx("div",{className:"flex items-start gap-1.5 text-[13px] text-fg-tertiary leading-relaxed",children:s.jsx("span",{children:c("page.emptyReply")})}),m&&s.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5 text-[11px] text-fg-tertiary",children:[s.jsx("svg",{className:"w-3 h-3 shrink-0",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})}),s.jsx("span",{children:c("page.stopped")})]})]})});function oW(e){return e.questions&&e.questions.length>0?e.questions:e.options&&e.options.length>0?[{id:"q1",prompt:e.description||e.title,inputType:"choice",options:e.options,allowMultiple:!1,allowFreeform:e.allowFreeform}]:[{id:"q1",prompt:e.description||e.title,inputType:"text",allowFreeform:!0}]}function lW({approval:e,submitting:t,readOnly:n,onClose:r,onSubmit:o}){const{t:l}=ft(["team","common"]);Ho(!0);const c=k.useMemo(()=>oW(e),[e]),[d,m]=k.useState(0),[f,h]=k.useState(()=>{if(n&&e.answers&&e.answers.length>0){const I={};for(const O of e.answers)I[O.questionId]={selectedOptionIds:O.selectedOptionIds??[],text:O.text??""};return I}return{}}),g=c[d],y=d===c.length-1,x=c.length>1,w=I=>f[I]??{selectedOptionIds:[],text:""},C=(I,O)=>{h(F=>({...F,[I]:{...w(I),...O}}))},T=(I,O)=>{const F=w(I.id);if(I.allowMultiple){const V=F.selectedOptionIds.includes(O);C(I.id,{selectedOptionIds:V?F.selectedOptionIds.filter(X=>X!==O):[...F.selectedOptionIds,O],text:V?F.text:""})}else{const V=F.selectedOptionIds.includes(O);C(I.id,{selectedOptionIds:V?[]:[O],text:V?F.text:""})}},S=I=>{const O=w(I.id);return I.inputType==="choice"?O.selectedOptionIds.length>0?!0:!!(I.allowFreeform&&O.text.trim()):O.text.trim().length>0},E=c.every(S),j=()=>c.map(I=>{const O=w(I.id),F={questionId:I.id};return O.selectedOptionIds.length>0&&(F.selectedOptionIds=O.selectedOptionIds),O.text.trim()&&(F.text=O.text.trim()),F}),L=()=>{const I=j();let O=!0,F;if(!e.questions?.length&&e.options?.length){const X=I[0];F=X?.selectedOptionIds?.[0]??(X?.text?"custom":void 0),O=F!=="reject"&&F!=="request_changes"}const V=I.map(X=>X.text).filter(Boolean).join(`
663
- `)||void 0;o({approved:O,comment:V,selectedOption:F,answers:I})};return Sa.createPortal(s.jsx("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onMouseDown:I=>{I.target===I.currentTarget&&r()},children:s.jsxs("div",{className:"w-full max-w-2xl max-h-[85vh] flex flex-col bg-surface-secondary border border-border-default rounded-2xl shadow-2xl overflow-hidden",children:[s.jsxs("div",{className:"flex items-start gap-3 px-6 py-4 border-b border-border-default shrink-0",children:[s.jsx("div",{className:"w-9 h-9 rounded-lg bg-amber-500/15 text-amber-500 flex items-center justify-center shrink-0",children:s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20z"}),s.jsx("path",{d:"M12 8v4"}),s.jsx("path",{d:"M12 16h.01"})]})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h2",{className:"text-base font-semibold text-fg-primary leading-snug",children:e.title}),s.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[s.jsx("p",{className:"text-xs text-fg-tertiary",children:e.agentName}),n&&s.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-green-500/15 text-green-600",children:[s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M20 6L9 17l-5-5"})}),l("team:userInput.submitted",{defaultValue:"Submitted"})]})]})]}),s.jsx("button",{onClick:r,className:"p-1.5 text-fg-tertiary hover:text-fg-primary rounded-md hover:bg-surface-overlay transition-colors shrink-0",title:l("common:close"),children:s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M18 6L6 18"}),s.jsx("path",{d:"M6 6l12 12"})]})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[x&&s.jsx("div",{className:"flex items-center gap-2",children:c.map((I,O)=>s.jsx("button",{onClick:()=>m(O),className:`h-1.5 flex-1 rounded-full transition-colors ${O===d?"bg-brand-500":S(I)?"bg-green-500/60":"bg-border-default"}`,title:`${O+1}. ${I.prompt.slice(0,40)}`},I.id))}),x&&s.jsx("div",{className:"text-[11px] font-medium text-fg-tertiary",children:l("team:userInput.questionProgress",{current:d+1,total:c.length,defaultValue:`Question ${d+1} of ${c.length}`})}),s.jsx("div",{className:"text-sm text-fg-primary leading-relaxed",children:s.jsx(Er,{content:g.prompt})}),g.inputType==="choice"&&g.options&&s.jsx("div",{className:"space-y-2",children:g.options.map((I,O)=>{const F=w(g.id).selectedOptionIds.includes(I.id);return s.jsxs("button",{onClick:n?void 0:()=>T(g,I.id),disabled:n,className:`w-full px-4 py-3 text-left rounded-xl border transition-colors flex items-start gap-3 ${F?"border-brand-500 bg-brand-500/10":`border-border-default ${n?"":"hover:bg-surface-overlay"}`} ${n?"cursor-default":""} ${n&&!F?"opacity-50":""}`,children:[s.jsx("span",{className:`w-6 h-6 rounded-full flex items-center justify-center text-[11px] font-bold shrink-0 mt-0.5 ${F?"bg-brand-600 text-white":"bg-surface-overlay text-fg-tertiary"}`,children:F?s.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M20 6L9 17l-5-5"})}):String.fromCharCode(65+O)}),s.jsxs("span",{className:"flex-1 min-w-0 text-sm text-fg-primary [&_p]:my-0 [&_p]:text-sm",children:[s.jsx(Er,{content:I.label}),I.description&&s.jsx("span",{className:"block text-xs text-fg-tertiary mt-1 [&_p]:my-0 [&_p]:text-xs",children:s.jsx(Er,{content:I.description})})]})]},I.id)})}),(g.inputType==="text"||g.allowFreeform)&&(!n||w(g.id).text)&&s.jsx("textarea",{rows:g.inputType==="text"?4:2,readOnly:n,placeholder:g.inputType==="text"?l("team:userInput.textPlaceholder",{defaultValue:"Type your answer…"}):l("team:userInput.freeformPlaceholder",{defaultValue:"Or write your own answer…"}),value:w(g.id).text,onChange:I=>{const O=I.target.value;C(g.id,{text:O,selectedOptionIds:O.trim()&&g.inputType==="choice"?[]:w(g.id).selectedOptionIds})},className:`w-full px-3.5 py-2.5 text-sm bg-surface-overlay border border-border-default rounded-xl text-fg-primary placeholder:text-fg-tertiary focus:outline-none resize-y ${n?"cursor-default opacity-80":"focus:ring-1 focus:ring-brand-500/50"}`})]}),s.jsxs("div",{className:"flex items-center justify-between gap-2 px-6 py-4 border-t border-border-default shrink-0",children:[s.jsx("div",{children:x&&d>0&&s.jsx("button",{onClick:()=>m(I=>Math.max(0,I-1)),className:"px-4 py-2 text-sm font-medium text-fg-secondary border border-border-default rounded-lg hover:bg-surface-overlay transition-colors",children:l("team:userInput.previous",{defaultValue:"Previous"})})}),s.jsx("div",{className:"flex items-center gap-2",children:x&&!y?s.jsx("button",{disabled:!n&&!S(g),onClick:()=>m(I=>Math.min(c.length-1,I+1)),className:"px-5 py-2 text-sm font-medium bg-brand-600 text-white rounded-lg hover:bg-brand-700 disabled:opacity-50 transition-colors",children:l("team:userInput.next",{defaultValue:"Next"})}):n?s.jsx("button",{onClick:r,className:"px-5 py-2 text-sm font-medium text-fg-secondary border border-border-default rounded-lg hover:bg-surface-overlay transition-colors",children:l("common:close",{defaultValue:"Close"})}):s.jsxs("button",{disabled:t||!E,onClick:L,className:"px-5 py-2 text-sm font-medium bg-brand-600 text-white rounded-lg hover:bg-brand-700 disabled:opacity-50 transition-colors inline-flex items-center gap-2",children:[t&&s.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),l("team:userInput.submit",{defaultValue:"Submit"})]})})]})]})}),document.body)}function Ad(e){return Array.isArray(e.questions)&&e.questions.length>0}const Ed={urgent:"bg-red-500",high:"bg-amber-500",normal:"bg-blue-500",low:"bg-gray-400"},To={approval_request:"M9 12l2 2 4-4 M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z",task_completed:"M22 11.08V12a10 10 0 1 1-5.93-9.14 M22 4L12 14.01l-3-3",task_created:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z M14 2v6h6 M16 13H8 M16 17H8 M10 9H8",task_review:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z M14 2v6h6 M16 13H8 M16 17H8 M10 9H8",task_failed:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z M14 2v6h6 M16 13H8 M16 17H8 M10 9H8",requirement_created:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7 M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z",requirement_decision:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",agent_report:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z M14 2v6h6 M16 13H8 M16 17H8",direct_message:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",group_message:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2 M9 7a4 4 0 1 0 0-8 4 4 0 0 0 0 8z M23 21v-2a4 4 0 0 0-3-3.87 M16 3.13a4 4 0 0 1 0 7.75",system:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"},j4={approval_request:"text-amber-500",task_completed:"text-green-500",task_failed:"text-red-500",task_created:"text-blue-500",task_review:"text-purple-500",requirement_created:"text-amber-500",requirement_decision:"text-green-500",agent_report:"text-blue-500",direct_message:"text-green-500",group_message:"text-brand-500",system:"text-fg-tertiary"};function Ao(e,t){const n=Date.now()-new Date(e).getTime(),r=Math.floor(n/6e4);if(r<1)return t("common:time.now");if(r<60)return t("common:time.minutesAgo",{count:r});const o=Math.floor(r/60);return o<24?t("common:time.hoursAgo",{count:o}):t("common:time.daysAgo",{count:Math.floor(o/24)})}const M4="markus:template-updates-ack";let th=!1,_d=null;function cW(e){return e.map(t=>`${t.name}@${t.availableVersion}`).sort().join(",")}function R4(e,t){if(e.type!=="system"||!e.metadata?.templateUpdates)return!1;if(!t)return!0;const n=e.metadata.templateUpdatesFingerprint;return!n||n===t}function jd(e,t){const n=e.actionType;if(n==="open_chat")return t("team:notifications.actionHints.openChat");if(n==="navigate")return t("team:notifications.actionHints.viewDetails");const r=e.metadata??{};switch(e.type){case"task_completed":case"task_created":case"task_review":case"task_failed":return r.taskId?t("team:notifications.actionHints.viewTask"):null;case"requirement_created":case"requirement_decision":return r.requirementId?t("team:notifications.actionHints.viewRequirement"):null;case"agent_report":return r.agentId?t("team:notifications.actionHints.viewAgent"):null;case"direct_message":return t("team:notifications.actionHints.openChat");case"group_message":return t("team:notifications.actionHints.openChat");case"approval_request":return t("team:notifications.actionHints.viewApproval");case"system":return r.templateUpdates?t("common:templateUpdates.actionHint"):null;default:return r.taskId?t("team:notifications.actionHints.viewTask"):r.requirementId?t("team:notifications.actionHints.viewRequirement"):r.agentId?t("team:notifications.actionHints.viewAgent"):null}}function nh(){try{const e=new AudioContext,t=e.currentTime,n=e.createGain();n.connect(e.destination),n.gain.setValueAtTime(.15,t),n.gain.exponentialRampToValueAtTime(.01,t+.6);const r=e.createOscillator();r.type="sine",r.frequency.setValueAtTime(880,t),r.frequency.setValueAtTime(1174.66,t+.15),r.connect(n),r.start(t),r.stop(t+.6),r.onended=()=>e.close()}catch{}}function uW({collapsed:e,userId:t,embeddedMode:n,onClose:r,sidebarMode:o,isActive:l,label:c,iconPath:d}){const{t:m}=ft(["team","common"]),[f,h]=k.useState(!1),[g,y]=k.useState("approvals"),[x,w]=k.useState([]),[C,T]=k.useState([]),[S,E]=k.useState(null),[j,L]=k.useState(null),[I,O]=k.useState(null),[F,V]=k.useState({}),[X,z]=k.useState(0),G=k.useRef(null),se=k.useRef(null),[ee,q]=k.useState({top:0,left:0,width:448,maxHeight:576}),re=k.useRef(null),B=k.useRef(!1),[J,fe]=k.useState(!0),[Se,U]=k.useState(!1),W=k.useRef(null),pe=k.useRef("approvals"),[P,_e]=k.useState(!1),He=30,Pe=k.useCallback(async()=>{try{Ya("/approvals"),Ya("/notifications");const[M,le]=await Promise.all([Ee.notifications.list(t,!1,{limit:He,offset:0}),Ee.approvals.list()]);w(M.notifications);const Oe=M.unreadCount??M.notifications.filter(ge=>!ge.read).length;if(z(Oe),fe(M.totalCount!=null?M.notifications.length<M.totalCount:M.notifications.length>=He),T(le.approvals),!B.current){const ge=le.approvals.filter(Ve=>Ve.status==="pending").length;re.current=ge,B.current=!0}}catch{}},[t]),Ge=k.useCallback(async()=>{if(!(Se||!J)){U(!0);try{const M=await Ee.notifications.list(t,!1,{limit:He,offset:x.length});M.notifications.length>0&&w(le=>[...le,...M.notifications.filter(Oe=>!le.some(ge=>ge.id===Oe.id))]),fe(M.totalCount!=null?x.length+M.notifications.length<M.totalCount:M.notifications.length>=He)}catch{}U(!1)}},[t,x.length,Se,J]),ct=k.useCallback(M=>{const le=M.detail;if(!le)return;const{taskId:Oe,requirementId:ge}=le;!Oe&&!ge||w(Ve=>{const Qe=Ve.filter(K=>!K.read&&(Oe&&K.metadata?.taskId===Oe||ge&&K.metadata?.requirementId===ge));if(Qe.length===0)return Ve;for(const K of Qe)Ee.notifications.markRead(K.id).catch(()=>{});return z(K=>Math.max(0,K-Qe.length)),Ve.map(K=>Qe.some(ce=>ce.id===K.id)?{...K,read:!0}:K)})},[]),mt=k.useRef(x);mt.current=x;const Ct=k.useCallback(async()=>{if(!mt.current.some(le=>!le.read&&le.type==="system"&&le.metadata?.creditExhausted))try{await Ee.notifications.create({title:m("credits.notificationTitle",{ns:"common"}),body:m("credits.notificationBody",{ns:"common"}),type:"system",priority:"urgent",metadata:{creditExhausted:!0}}),Pe(),nh()}catch{}},[Pe,m]),Mt=k.useCallback(async()=>{if(!th){th=!0;try{const{updates:M}=await Ee.skills.updates();if(!M.length)return;const le=cW(M);try{if(localStorage.getItem(M4)===le)return}catch{}if(_d===le||mt.current.some(ge=>!ge.read&&R4(ge,le)))return;try{const Ve=(await Ee.notifications.list(t,!0,{limit:50,type:"system"})).notifications.filter(Qe=>R4(Qe,le)).sort((Qe,K)=>new Date(K.createdAt).getTime()-new Date(Qe.createdAt).getTime());if(Ve.length>0){for(const Qe of Ve.slice(1))Ee.notifications.markRead(Qe.id).catch(()=>{});Ve.length>1&&Pe(),_d=le;return}}catch{}_d=le,await Ee.notifications.create({title:m("templateUpdates.notificationTitle",{ns:"common"}),body:m("templateUpdates.notificationBody",{ns:"common",count:M.length}),type:"system",priority:"high",metadata:{templateUpdates:!0,templateUpdatesFingerprint:le,count:M.length,skills:M.map(ge=>ge.name)}}),Pe(),nh()}catch{_d=null}finally{th=!1}}},[Pe,m,t]);k.useEffect(()=>{Pe();const M=setInterval(Pe,6e4);let le=null;const Oe=()=>{le||(le=setTimeout(()=>{le=null,Pe()},400))},ge=()=>Oe(),Ve=()=>{h(!0),Pe()};window.addEventListener("markus:notifications-changed",ge),window.addEventListener("markus:mark-read-by-ref",ct),window.addEventListener("markus:open-notifications",Ve),window.addEventListener("markus:credit-exhausted",Ct);const Qe=va.on("notification",Oe),K=va.on("approval:requested",Oe);return()=>{clearInterval(M),le&&clearTimeout(le),window.removeEventListener("markus:notifications-changed",ge),window.removeEventListener("markus:mark-read-by-ref",ct),window.removeEventListener("markus:open-notifications",Ve),window.removeEventListener("markus:credit-exhausted",Ct),Qe(),K()}},[Pe,ct,Ct]),k.useEffect(()=>{Mt();const M=setInterval(()=>{Mt()},5*6e4),le=()=>{Mt()};return window.addEventListener("markus:data-changed",le),()=>{clearInterval(M),window.removeEventListener("markus:data-changed",le)}},[t]);const Pt=k.useCallback(()=>{if(!G.current)return;const M=G.current.getBoundingClientRect(),le=window.innerWidth,Oe=window.innerHeight,ge=Math.min(448,le-16),Ve=Math.min(576,Oe-16);let Qe=M.right+8,K=M.top;Qe+ge>le-8&&(Qe=Math.max(8,le-ge-8)),K+Ve>Oe-8&&(K=Math.max(8,Oe-Ve-8)),q({top:K,left:Qe,width:ge,maxHeight:Ve})},[]);k.useLayoutEffect(()=>{f&&Pt()},[f,Pt]),k.useEffect(()=>{if(f)return window.addEventListener("resize",Pt),()=>window.removeEventListener("resize",Pt)},[f,Pt]),k.useEffect(()=>{if(!f)return;const M=le=>{G.current?.contains(le.target)||se.current?.contains(le.target)||h(!1)};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[f]),k.useEffect(()=>{if(!f)return;const M=C.some(Oe=>Oe.status==="pending"),le=x.some(Oe=>!Oe.read);y(M&&!le?"approvals":!M&&le?"notifications":pe.current)},[f]);const Kt=new Set(C.filter(M=>M.status==="pending").map(M=>M.id)),yt=new Set(C.map(M=>M.id)),Ue=x.filter(M=>!(M.type==="approval_request"&&M.metadata?.approvalId&&yt.has(M.metadata.approvalId))),dt=x.filter(M=>M.type==="approval_request"&&!M.read&&M.metadata?.approvalId&&Kt.has(M.metadata.approvalId)).length,Nt=Math.max(0,X-dt),bt=Kt.size,Lt=Nt+bt;k.useEffect(()=>{re.current!==null&&bt>re.current&&nh(),re.current=bt},[bt]);const ue=async M=>{await Ee.notifications.markRead(M),w(le=>le.map(Oe=>Oe.id===M?{...Oe,read:!0}:Oe)),z(le=>Math.max(0,le-1)),window.dispatchEvent(new CustomEvent("markus:notifications-changed"))},tt=M=>{const le=M.metadata??{},Oe=M.actionType,ge=M.actionTarget;if(Oe==="open_chat"&&ge)try{const Ve=typeof ge=="string"?JSON.parse(ge):ge;if(Ve.agentId){const Qe={agentId:Ve.agentId};Ve.sessionId&&(Qe.sessionId=Ve.sessionId),it.navigate(de.TEAM,Qe);return}}catch{}if(Oe==="navigate"&&ge)try{const Ve=typeof ge=="string"?JSON.parse(ge):ge;if(Ve.path){if(Ve.path.startsWith("/team")){const Qe={},K=new URLSearchParams(Ve.path.split("?")[1]||"");for(const[ce,Te]of K.entries())Qe[ce]=Te;it.navigate(de.TEAM,Qe);return}if(Ve.path.startsWith("/work")){const Qe={},K=new URLSearchParams(Ve.path.split("?")[1]||"");for(const[ce,Te]of K.entries())Qe[ce]=Te;it.navigate(de.WORK,Qe);return}}}catch{}switch(M.type){case"approval_request":{const Ve=le.approvalId,Qe=Ve?C.find(ze=>ze.id===Ve):void 0;if(Qe&&Ad(Qe)){L(Qe);break}const K=Qe?.details?.taskId??le.taskId,ce=Qe?.details?.requirementId??le.requirementId,Te=Qe?.details?.agentId??Qe?.agentId;K?it.navigate(de.WORK,{openTask:K}):ce?it.navigate(de.WORK,{openRequirement:ce}):Te?it.navigate(de.TEAM,{agentId:Te}):it.navigate(de.WORK);break}case"task_completed":case"task_created":case"task_review":case"task_failed":le.taskId?it.navigate(de.WORK,{openTask:le.taskId}):it.navigate(de.WORK);break;case"requirement_created":case"requirement_decision":le.requirementId?it.navigate(de.WORK,{openRequirement:le.requirementId}):it.navigate(de.WORK);break;case"agent_report":case"system":{if(le.creditExhausted){_e(!0);return}if(le.templateUpdates){const Ve=le.templateUpdatesFingerprint;if(Ve)try{localStorage.setItem(M4,Ve)}catch{}localStorage.setItem("markus_nav_storeTab","installed"),it.navigate(de.STORE);return}if(le.agentId){const Ve={agentId:le.agentId};le.sessionId&&(Ve.sessionId=le.sessionId),it.navigate(de.TEAM,Ve)}else it.navigate(de.TEAM);break}case"direct_message":{const Ve=le.senderId;Ve?it.navigate(de.TEAM,{dm:Ve}):it.navigate(de.TEAM);break}case"group_message":{const Ve=le.channel;Ve?it.navigate(de.TEAM,{channel:Ve}):it.navigate(de.TEAM);break}default:le.taskId?it.navigate(de.WORK,{openTask:le.taskId}):le.requirementId?it.navigate(de.WORK,{openRequirement:le.requirementId}):le.projectId?it.navigate(de.WORK,{projectId:le.projectId}):le.agentId&&it.navigate(de.TEAM,{agentId:le.agentId});break}},st=async M=>{const le=M.metadata??{},Oe=M.actionType,ge=M.type==="agent_report"&&!le.creditExhausted&&!le.templateUpdates&&(Oe==="open_chat"||!!le.agentId&&Oe!=="navigate");!M.read&&!ge&&ue(M.id);const Ve=le.taskId,Qe=le.requirementId;if(!ge&&(Ve||Qe)){const K=x.filter(ce=>ce.id!==M.id&&!ce.read&&(Ve&&ce.metadata?.taskId===Ve||Qe&&ce.metadata?.requirementId===Qe));for(const ce of K)ue(ce.id)}tt(M)},ye=async(M,le,Oe,ge,Ve)=>{E(M);try{const{approval:Qe}=await Ee.approvals.respond(M,le,t,Oe,ge,Ve);T(ze=>ze.map(rt=>rt.id===M?Qe:rt)),L(null),O(null),V(ze=>{const rt={...ze};return delete rt[M],rt});const K=Qe.details?.taskId,ce=Qe.details?.requirementId,Te=x.filter(ze=>!ze.read&&(ze.type==="approval_request"&&ze.metadata?.approvalId===M||K&&ze.metadata?.taskId===K||ce&&ze.metadata?.requirementId===ce));if(Te.length>0){for(const rt of Te)Ee.notifications.markRead(rt.id).catch(()=>{});const ze=new Set(Te.map(rt=>rt.id));w(rt=>rt.map(vt=>ze.has(vt.id)?{...vt,read:!0}:vt)),z(rt=>Math.max(0,rt-Te.length))}Ya("/approvals"),Ya("/notifications"),Ya("/tasks"),Ya("/taskboard"),Ya("/requirements"),window.dispatchEvent(new CustomEvent("markus:data-changed")),window.dispatchEvent(new CustomEvent("markus:notifications-changed")),setTimeout(()=>Pe(),800)}catch{}E(null)},je=async()=>{try{if(!t)return;await Ee.notifications.markAllRead(t),w(M=>M.map(le=>({...le,read:!0}))),z(0),Ya("/notifications"),window.dispatchEvent(new CustomEvent("markus:notifications-changed"))}catch{const M=Ue.filter(le=>!le.read);await Promise.all(M.map(le=>Ee.notifications.markRead(le.id))),w(le=>le.map(Oe=>({...Oe,read:!0}))),z(0),Ya("/notifications"),window.dispatchEvent(new CustomEvent("markus:notifications-changed"))}},Ae=M=>{const le=M.details?.subType;return le==="requirement_resubmit"?m("team:notifications.approvalType.requirementResubmit"):le==="requirement"||M.details?.requirementId?m("team:notifications.approvalType.requirement"):le==="task_review"?m("team:notifications.approvalType.taskReview"):le==="task"||M.details?.taskId?m("team:notifications.approvalType.task"):M.details?.toolName?m("team:notifications.approvalType.toolExecution"):null},oe=M=>{const le=[];le.push(M.agentName);const Oe=M.details?.taskTitle,ge=M.details?.taskId;Oe?le.push(Oe):ge&&le.push(`Task ${ge.slice(0,8)}`);const Ve=M.details?.requirementId;return Ve&&!ge&&le.push(`Req ${Ve.slice(0,8)}`),le.join(" · ")},H=[...C].sort((M,le)=>new Date(le.requestedAt).getTime()-new Date(M.requestedAt).getTime()),te=H.filter(M=>M.status==="pending"),Ne=H.filter(M=>M.status!=="pending"),Re=M=>{const le=M.details?.taskId,Oe=M.details?.requirementId,ge=M.details?.agentId??M.agentId;le?it.navigate(de.WORK,{openTask:le}):Oe?it.navigate(de.WORK,{openRequirement:Oe}):ge?it.navigate(de.TEAM,{agentId:ge}):it.navigate(de.WORK)},$e=()=>{h(!1),r?.()},Q=M=>s.jsxs("button",{disabled:S===M.id,onClick:()=>L(M),className:"w-full px-3 py-2 text-[11px] font-medium bg-brand-600 text-white rounded-md hover:bg-brand-700 disabled:opacity-50 transition-colors inline-flex items-center justify-center gap-1.5",children:[s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),m("team:userInput.respond",{defaultValue:"Respond"}),M.questions&&M.questions.length>1?` (${M.questions.length})`:""]}),Z=j?s.jsx(lW,{approval:j,submitting:S===j.id,readOnly:j.status!=="pending",onClose:()=>L(null),onSubmit:M=>ye(j.id,M.approved,M.comment,M.selectedOption,M.answers)}):null,be=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex border-b border-border-default shrink-0",children:[s.jsxs("button",{onClick:()=>{y("approvals"),pe.current="approvals"},className:`flex-1 px-3 py-2.5 text-xs font-medium transition-colors ${g==="approvals"?"text-fg-primary border-b-2 border-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:[m("team:notifications.approvals"),bt>0?` (${bt})`:""]}),s.jsxs("button",{onClick:()=>{y("notifications"),pe.current="notifications"},className:`flex-1 px-3 py-2.5 text-xs font-medium transition-colors ${g==="notifications"?"text-fg-primary border-b-2 border-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:[m("team:notifications.notifications"),Nt>0?` (${Nt})`:""]}),s.jsx("button",{onClick:$e,className:"px-2 py-2 text-fg-tertiary hover:text-fg-primary transition-colors shrink-0",title:m("common:close"),children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M18 6L6 18"}),s.jsx("path",{d:"M6 6l12 12"})]})})]}),g==="notifications"&&X>0&&s.jsx("div",{className:"flex justify-end px-3 py-1.5 border-b border-border-default/50 shrink-0",children:s.jsx("button",{onClick:je,className:"text-[10px] text-brand-500 hover:text-brand-400 transition-colors",children:m("team:notifications.markAllRead")})}),s.jsxs("div",{ref:W,className:"flex-1 overflow-y-auto",onScroll:M=>{if(g!=="notifications"||!J||Se)return;const le=M.currentTarget;le.scrollTop+le.clientHeight>=le.scrollHeight-80&&Ge()},children:[g==="approvals"&&(C.length===0?s.jsx("div",{className:"p-6 text-center text-xs text-fg-tertiary",children:m("team:notifications.noApprovals")}):s.jsxs("div",{className:"divide-y divide-border-default/50",children:[te.map(M=>{const le=M.details?.command,Oe=le?M.description.replace(/\s*Command:.*$/,""):M.description;return s.jsxs("div",{className:"px-3 py-3 space-y-2.5",children:[s.jsxs("div",{className:"cursor-pointer hover:bg-surface-overlay/50 -mx-3 -mt-3 px-3 pt-3 pb-1 rounded-t-md transition-colors",onClick:()=>Re(M),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-amber-500 mt-0.5 shrink-0",children:s.jsx("path",{d:To.approval_request})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[Ae(M)&&s.jsx("span",{className:"text-[10px] text-amber-500 font-medium shrink-0",children:Ae(M)}),s.jsx("span",{className:"text-xs text-fg-primary font-medium truncate",children:M.title}),s.jsx("span",{className:"text-[10px] text-fg-tertiary shrink-0",children:Ao(M.requestedAt,m)})]}),s.jsx("div",{className:"text-[11px] text-fg-tertiary mt-0.5",children:M.agentName})]})]}),s.jsx("div",{className:"mt-2.5 text-[11px] text-fg-secondary leading-relaxed",children:s.jsx(Er,{content:Oe,className:"text-[11px] [&_h1]:text-xs [&_h2]:text-[11px] [&_h3]:text-[11px] [&_p]:text-[11px] [&_li]:text-[11px]"})}),le&&s.jsx("pre",{className:"text-[11px] text-fg-primary bg-surface-overlay border border-border-default rounded-md px-2.5 py-2 overflow-x-auto whitespace-pre-wrap break-all font-mono leading-relaxed mt-2",children:le})]}),(()=>{if(Ad(M))return Q(M);const ge=M.details?.subType,Ve=ge==="task"||ge==="requirement"||ge==="requirement_resubmit",Qe=M.options&&M.options.length>0,K=(F[M.id]??"").trim();return Qe?s.jsxs("div",{className:"space-y-1.5",children:[M.options.map((ce,Te)=>s.jsxs("button",{disabled:S===M.id,onClick:()=>ye(M.id,ce.id!=="reject",K||void 0,ce.id),className:`w-full px-3 py-2 text-left text-[11px] font-medium rounded-md disabled:opacity-50 transition-colors flex items-center gap-2 ${ce.id==="reject"||ce.id==="request_changes"?"border border-border-default text-fg-secondary hover:bg-surface-overlay":"bg-brand-600 text-white hover:bg-brand-700"}`,title:ce.description,children:[s.jsx("span",{className:"w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px] font-bold shrink-0",children:String.fromCharCode(65+Te)}),ce.label]},ce.id)),s.jsxs("div",{className:"flex gap-1.5 mt-1",children:[s.jsx("input",{type:"text",placeholder:m("team:notifications.freeformPlaceholder"),value:F[M.id]??"",onChange:ce=>V(Te=>({...Te,[M.id]:ce.target.value})),onKeyDown:ce=>{ce.key==="Enter"&&(F[M.id]??"").trim()&&ye(M.id,!0,(F[M.id]??"").trim(),"custom")},className:"flex-1 px-2.5 py-1.5 text-[11px] bg-surface-overlay border border-border-default rounded-md text-fg-primary placeholder:text-fg-tertiary focus:outline-none focus:ring-1 focus:ring-brand-500/50"}),s.jsx("button",{disabled:S===M.id||!(F[M.id]??"").trim(),onClick:()=>ye(M.id,!0,(F[M.id]??"").trim(),"custom"),className:"px-2.5 py-1.5 text-[11px] font-medium bg-brand-600 text-white rounded-md hover:bg-brand-700 disabled:opacity-50 transition-colors",children:m("common:send")})]})]}):Ve?s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{disabled:S===M.id,onClick:()=>ye(M.id,!0,void 0,"approve"),className:"px-3 py-1.5 text-[11px] font-medium bg-green-600 text-white rounded-md hover:bg-green-700 disabled:opacity-50 transition-colors inline-flex items-center gap-1.5",children:[s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M20 6L9 17l-5-5"})}),m("common:approve")]}),s.jsxs("button",{disabled:S===M.id,onClick:()=>ye(M.id,!1,void 0,"reject"),className:"px-3 py-1.5 text-[11px] font-medium bg-red-600/80 text-white rounded-md hover:bg-red-700 disabled:opacity-50 transition-colors inline-flex items-center gap-1.5",children:[s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M18 6L6 18"}),s.jsx("path",{d:"M6 6l12 12"})]}),m("common:reject")]}),I!==M.id&&s.jsxs("button",{disabled:S===M.id,onClick:()=>O(M.id),className:"px-3 py-1.5 text-[11px] font-medium border border-amber-500/50 text-amber-500 rounded-md hover:bg-amber-500/10 disabled:opacity-50 transition-colors inline-flex items-center gap-1.5",children:[s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),s.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),m("team:notifications.needsAdjustment")]})]}),I===M.id&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("input",{type:"text",autoFocus:!0,placeholder:m("team:notifications.adjustmentPlaceholder"),value:F[M.id]??"",onChange:ce=>V(Te=>({...Te,[M.id]:ce.target.value})),onKeyDown:ce=>{ce.key==="Enter"&&(F[M.id]??"").trim()&&ye(M.id,!1,(F[M.id]??"").trim(),"needs_adjustment"),ce.key==="Escape"&&O(null)},className:"w-full px-2.5 py-1.5 text-[11px] bg-surface-overlay border border-border-default rounded-md text-fg-primary placeholder:text-fg-tertiary focus:outline-none focus:ring-1 focus:ring-amber-500/50"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{disabled:S===M.id||!(F[M.id]??"").trim(),onClick:()=>ye(M.id,!1,(F[M.id]??"").trim(),"needs_adjustment"),className:"px-2.5 py-1.5 text-[11px] font-medium bg-amber-600 text-white rounded-md hover:bg-amber-700 disabled:opacity-50 transition-colors",children:m("team:notifications.confirmAdjustment")}),s.jsx("button",{onClick:()=>O(null),className:"px-2.5 py-1.5 text-[11px] font-medium border border-border-default text-fg-secondary rounded-md hover:bg-surface-overlay transition-colors",children:m("common:cancel")})]})]})]}):s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("input",{type:"text",placeholder:m("team:notifications.commentPlaceholder"),value:F[M.id]??"",onChange:ce=>V(Te=>({...Te,[M.id]:ce.target.value})),onKeyDown:ce=>{ce.key==="Enter"&&ye(M.id,!0,K||void 0,"approve")},className:"w-full px-2.5 py-1.5 text-[11px] bg-surface-overlay border border-border-default rounded-md text-fg-primary placeholder:text-fg-tertiary focus:outline-none focus:ring-1 focus:ring-brand-500/50"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{disabled:S===M.id,onClick:()=>ye(M.id,!0,K||void 0,"approve"),className:"flex-1 px-2.5 py-1.5 text-[11px] font-medium bg-green-600 text-white rounded-md hover:bg-green-700 disabled:opacity-50 transition-colors",children:m("common:approve")}),s.jsx("button",{disabled:S===M.id,onClick:()=>ye(M.id,!1,K||void 0,"reject"),className:"flex-1 px-2.5 py-1.5 text-[11px] font-medium border border-border-default text-fg-secondary rounded-md hover:bg-surface-overlay disabled:opacity-50 transition-colors",children:m("common:reject")})]})]})})()]},M.id)}),Ne.length>0&&s.jsxs(s.Fragment,{children:[te.length>0&&s.jsx("div",{className:"px-3 py-1.5 text-[10px] font-medium text-fg-tertiary uppercase tracking-wider bg-surface-overlay/30",children:m("team:notifications.approvalHistory")}),Ne.slice(0,50).map(M=>s.jsxs("button",{onClick:()=>Ad(M)?L(M):Re(M),className:"w-full text-left px-3 py-2.5 hover:bg-surface-overlay/50 transition-colors group",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${M.status==="approved"?"bg-green-500":M.status==="cancelled"||M.status==="expired"?"bg-gray-400":"bg-red-500"}`}),Ae(M)&&s.jsx("span",{className:"text-[10px] text-fg-tertiary font-medium shrink-0",children:Ae(M)}),s.jsx("span",{className:"text-xs text-fg-secondary truncate flex-1 group-hover:text-fg-primary",children:M.title}),s.jsx("span",{className:`text-[10px] font-medium shrink-0 ${M.status==="approved"?"text-green-500":M.status==="cancelled"||M.status==="expired"?"text-fg-muted":"text-red-500"}`,children:m(`common:status.${M.status}`,{defaultValue:M.status})})]}),s.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5 pl-3.5",children:[s.jsx("span",{className:"text-[10px] text-fg-muted truncate",children:oe(M)}),s.jsx("span",{className:"text-[10px] text-fg-muted shrink-0",children:"·"}),s.jsx("span",{className:"text-[10px] text-fg-muted shrink-0",children:Ao(M.respondedAt??M.requestedAt,m)})]}),M.responseComment&&s.jsxs("p",{className:"text-[10px] text-fg-muted mt-0.5 pl-3.5 truncate",children:["“",M.responseComment,"”"]})]},M.id))]})]})),g==="notifications"&&(Ue.length===0?s.jsx("div",{className:"p-6 text-center text-xs text-fg-tertiary",children:m("team:notifications.noNotifications")}):s.jsxs("div",{className:"divide-y divide-border-default/50",children:[Ue.map(M=>{const le=j4[M.type]??"text-fg-tertiary";return s.jsxs("div",{role:"button",tabIndex:0,onClick:()=>st(M),onKeyDown:Oe=>{(Oe.key==="Enter"||Oe.key===" ")&&(Oe.preventDefault(),st(M))},className:`w-full text-left px-3 py-2.5 flex gap-2.5 transition-colors cursor-pointer ${M.read?"opacity-50 hover:opacity-70":"hover:bg-surface-overlay"}`,children:[s.jsx("div",{className:"shrink-0 mt-0.5",children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:le,children:s.jsx("path",{d:To[M.type]??To.system})})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[!M.read&&s.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${Ed[M.priority]??Ed.normal}`}),s.jsx("span",{className:"text-xs text-fg-primary font-medium truncate",children:M.title})]}),s.jsx("div",{className:"text-[11px] text-fg-tertiary mt-0.5 ",children:s.jsx(Er,{content:M.body,className:"text-[11px] [&_h1]:text-xs [&_h2]:text-[11px] [&_h3]:text-[11px] [&_p]:text-[11px] [&_li]:text-[11px] [&_p]:text-fg-tertiary"})}),s.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[s.jsx("span",{className:"text-[10px] text-fg-muted",children:Ao(M.createdAt,m)}),jd(M,m)&&s.jsx("span",{className:`text-[10px] font-medium ${le}`,children:jd(M,m)})]})]})]},M.id)}),Se&&s.jsx("div",{className:"py-3 text-center",children:s.jsxs("svg",{className:"animate-spin h-4 w-4 text-fg-tertiary mx-auto",viewBox:"0 0 24 24",fill:"none",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})})]}))]})]}),Ke=k.useCallback(M=>{M?.mute&&iW()},[]),Ie=k.useCallback(M=>{Ke(M),_e(!1)},[Ke]),Ye=P?s.jsx(dr,{title:m("credits.dialogTitle",{ns:"common"}),message:m("credits.dialogDesc",{ns:"common"}),variant:"primary",cancelLabel:m("credits.configureModels",{ns:"common"}),confirmLabel:m("credits.topUp",{ns:"common"}),checkboxes:[{id:"mute",label:m("credits.dontRemind",{ns:"common"})}],onCancel:()=>_e(!1),onCancelClick:M=>{Ie(M),it.navigate(de.SETTINGS),setTimeout(()=>{window.location.hash="settings/providers"},50)},onConfirm:M=>{const le=`${lt.getUrl().replace(/\/$/,"")}/settings?tab=billing`;Ie(M),_i(le)}}):null;if(n){const M=["approvals","notifications"],le=M.indexOf(g),Oe=(()=>{let ge=0,Ve=0;return{onTouchStart:Qe=>{ge=Qe.touches[0].clientX,Ve=Qe.touches[0].clientY},onTouchEnd:Qe=>{const K=Qe.changedTouches[0].clientX-ge,ce=Qe.changedTouches[0].clientY-Ve;Math.abs(K)>60&&Math.abs(K)>Math.abs(ce)*1.5&&(K<0&&le<M.length-1&&y(M[le+1]),K>0&&le>0&&y(M[le-1]))}}})();return s.jsxs(s.Fragment,{children:[Ye,s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[Z,s.jsx("div",{className:"flex border-b border-border-default shrink-0",children:M.map(ge=>s.jsx("button",{onClick:()=>y(ge),className:`flex-1 px-3 py-3 text-sm font-medium transition-colors ${g===ge?"text-fg-primary border-b-2 border-brand-500":"text-fg-tertiary"}`,children:ge==="approvals"?s.jsxs(s.Fragment,{children:[m("team:notifications.approvals"),bt>0?` (${bt})`:""]}):s.jsxs(s.Fragment,{children:[m("team:notifications.notifications"),Nt>0?` (${Nt})`:""]})},ge))}),g==="notifications"&&X>0&&s.jsx("div",{className:"flex justify-end px-3 py-1.5 border-b border-border-default/50 shrink-0",children:s.jsx("button",{onClick:je,className:"text-[10px] text-brand-500 hover:text-brand-400 transition-colors",children:m("team:notifications.markAllRead")})}),s.jsx("div",{className:"flex-1 overflow-hidden relative",...Oe,children:s.jsxs("div",{className:"flex h-full transition-transform duration-300 ease-out",style:{transform:`translateX(-${le*100}%)`},children:[s.jsx("div",{className:"w-full shrink-0 h-full overflow-y-auto scrollbar-thin",children:C.length===0?s.jsx("div",{className:"p-6 text-center text-xs text-fg-tertiary",children:m("team:notifications.noApprovals")}):s.jsxs("div",{className:"divide-y divide-border-default/50",children:[te.map(ge=>{const Ve=ge.details?.command,Qe=Ve?ge.description.replace(/\s*Command:.*$/,""):ge.description;return s.jsxs("div",{className:"px-3 py-3 space-y-2.5",children:[s.jsxs("div",{className:"cursor-pointer hover:bg-surface-overlay/50 -mx-3 -mt-3 px-3 pt-3 pb-1 rounded-t-md transition-colors",onClick:()=>Re(ge),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-amber-500 mt-0.5 shrink-0",children:s.jsx("path",{d:To.approval_request})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[Ae(ge)&&s.jsx("span",{className:"text-[10px] text-amber-500 font-medium shrink-0",children:Ae(ge)}),s.jsx("span",{className:"text-xs text-fg-primary font-medium truncate",children:ge.title}),s.jsx("span",{className:"text-[10px] text-fg-tertiary shrink-0",children:Ao(ge.requestedAt,m)})]}),s.jsx("div",{className:"text-[11px] text-fg-tertiary mt-0.5",children:ge.agentName})]})]}),s.jsx("div",{className:"mt-2.5 text-[11px] text-fg-secondary leading-relaxed",children:s.jsx(Er,{content:Qe,className:"text-[11px] [&_h1]:text-xs [&_h2]:text-[11px] [&_h3]:text-[11px] [&_p]:text-[11px] [&_li]:text-[11px]"})}),Ve&&s.jsx("pre",{className:"text-[11px] text-fg-primary bg-surface-overlay border border-border-default rounded-md px-2.5 py-2 overflow-x-auto whitespace-pre-wrap break-all font-mono leading-relaxed mt-2",children:Ve})]}),(()=>{if(Ad(ge))return Q(ge);const K=ge.details?.subType,ce=K==="task"||K==="requirement"||K==="requirement_resubmit",Te=ge.options&&ge.options.length>0,ze=(F[ge.id]??"").trim();return Te?s.jsxs("div",{className:"space-y-1.5",children:[ge.options.map((rt,vt)=>s.jsxs("button",{disabled:S===ge.id,onClick:()=>ye(ge.id,rt.id!=="reject",ze||void 0,rt.id),className:`w-full px-3 py-2 text-left text-[11px] font-medium rounded-md disabled:opacity-50 transition-colors flex items-center gap-2 ${rt.id==="reject"||rt.id==="request_changes"?"border border-border-default text-fg-secondary hover:bg-surface-overlay":"bg-brand-600 text-white hover:bg-brand-700"}`,title:rt.description,children:[s.jsx("span",{className:"w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px] font-bold shrink-0",children:String.fromCharCode(65+vt)}),rt.label]},rt.id)),s.jsxs("div",{className:"flex gap-1.5 mt-1",children:[s.jsx("input",{type:"text",placeholder:m("team:notifications.freeformPlaceholder"),value:F[ge.id]??"",onChange:rt=>V(vt=>({...vt,[ge.id]:rt.target.value})),onKeyDown:rt=>{rt.key==="Enter"&&(F[ge.id]??"").trim()&&ye(ge.id,!0,(F[ge.id]??"").trim(),"custom")},className:"flex-1 px-2.5 py-1.5 text-[11px] bg-surface-overlay border border-border-default rounded-md text-fg-primary placeholder:text-fg-tertiary focus:outline-none focus:ring-1 focus:ring-brand-500/50"}),s.jsx("button",{disabled:S===ge.id||!(F[ge.id]??"").trim(),onClick:()=>ye(ge.id,!0,(F[ge.id]??"").trim(),"custom"),className:"px-2.5 py-1.5 text-[11px] font-medium bg-brand-600 text-white rounded-md hover:bg-brand-700 disabled:opacity-50 transition-colors",children:m("common:send")})]})]}):ce?s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{disabled:S===ge.id,onClick:()=>ye(ge.id,!0,void 0,"approve"),className:"px-3 py-1.5 text-[11px] font-medium bg-green-600 text-white rounded-md hover:bg-green-700 disabled:opacity-50 transition-colors inline-flex items-center gap-1.5",children:[s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M20 6L9 17l-5-5"})}),m("common:approve")]}),s.jsxs("button",{disabled:S===ge.id,onClick:()=>ye(ge.id,!1,void 0,"reject"),className:"px-3 py-1.5 text-[11px] font-medium bg-red-600/80 text-white rounded-md hover:bg-red-700 disabled:opacity-50 transition-colors inline-flex items-center gap-1.5",children:[s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M18 6L6 18"}),s.jsx("path",{d:"M6 6l12 12"})]}),m("common:reject")]}),I!==ge.id&&s.jsxs("button",{disabled:S===ge.id,onClick:()=>O(ge.id),className:"px-3 py-1.5 text-[11px] font-medium border border-amber-500/50 text-amber-500 rounded-md hover:bg-amber-500/10 disabled:opacity-50 transition-colors inline-flex items-center gap-1.5",children:[s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),s.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),m("team:notifications.needsAdjustment")]})]}),I===ge.id&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("input",{type:"text",autoFocus:!0,placeholder:m("team:notifications.adjustmentPlaceholder"),value:F[ge.id]??"",onChange:rt=>V(vt=>({...vt,[ge.id]:rt.target.value})),onKeyDown:rt=>{rt.key==="Enter"&&(F[ge.id]??"").trim()&&ye(ge.id,!1,(F[ge.id]??"").trim(),"needs_adjustment"),rt.key==="Escape"&&O(null)},className:"w-full px-2.5 py-1.5 text-[11px] bg-surface-overlay border border-border-default rounded-md text-fg-primary placeholder:text-fg-tertiary focus:outline-none focus:ring-1 focus:ring-amber-500/50"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{disabled:S===ge.id||!(F[ge.id]??"").trim(),onClick:()=>ye(ge.id,!1,(F[ge.id]??"").trim(),"needs_adjustment"),className:"px-2.5 py-1.5 text-[11px] font-medium bg-amber-600 text-white rounded-md hover:bg-amber-700 disabled:opacity-50 transition-colors",children:m("team:notifications.confirmAdjustment")}),s.jsx("button",{onClick:()=>O(null),className:"px-2.5 py-1.5 text-[11px] font-medium border border-border-default text-fg-secondary rounded-md hover:bg-surface-overlay transition-colors",children:m("common:cancel")})]})]})]}):s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("input",{type:"text",placeholder:m("team:notifications.commentPlaceholder"),value:F[ge.id]??"",onChange:rt=>V(vt=>({...vt,[ge.id]:rt.target.value})),onKeyDown:rt=>{rt.key==="Enter"&&ye(ge.id,!0,ze||void 0,"approve")},className:"w-full px-2.5 py-1.5 text-[11px] bg-surface-overlay border border-border-default rounded-md text-fg-primary placeholder:text-fg-tertiary focus:outline-none focus:ring-1 focus:ring-brand-500/50"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{disabled:S===ge.id,onClick:()=>ye(ge.id,!0,ze||void 0,"approve"),className:"flex-1 px-2.5 py-1.5 text-[11px] font-medium bg-green-600 text-white rounded-md hover:bg-green-700 disabled:opacity-50 transition-colors",children:m("common:approve")}),s.jsx("button",{disabled:S===ge.id,onClick:()=>ye(ge.id,!1,ze||void 0,"reject"),className:"flex-1 px-2.5 py-1.5 text-[11px] font-medium border border-border-default text-fg-secondary rounded-md hover:bg-surface-overlay disabled:opacity-50 transition-colors",children:m("common:reject")})]})]})})()]},ge.id)}),Ne.length>0&&s.jsxs(s.Fragment,{children:[te.length>0&&s.jsx("div",{className:"px-3 py-1.5 text-[10px] font-medium text-fg-tertiary uppercase tracking-wider bg-surface-overlay/30",children:m("team:notifications.approvalHistory")}),Ne.slice(0,50).map(ge=>s.jsxs("button",{onClick:()=>Re(ge),className:"w-full text-left px-3 py-2.5 hover:bg-surface-overlay/50 transition-colors",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${ge.status==="approved"?"bg-green-500":ge.status==="cancelled"||ge.status==="expired"?"bg-gray-400":"bg-red-500"}`}),s.jsx("span",{className:"text-xs text-fg-secondary truncate flex-1",children:ge.title}),s.jsx("span",{className:`text-[10px] font-medium shrink-0 ${ge.status==="approved"?"text-green-500":ge.status==="cancelled"||ge.status==="expired"?"text-fg-muted":"text-red-500"}`,children:m(`common:status.${ge.status}`,{defaultValue:ge.status})})]}),s.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5 pl-3.5",children:[s.jsx("span",{className:"text-[10px] text-fg-muted truncate",children:oe(ge)}),s.jsx("span",{className:"text-[10px] text-fg-muted shrink-0",children:"·"}),s.jsx("span",{className:"text-[10px] text-fg-muted shrink-0",children:Ao(ge.respondedAt??ge.requestedAt,m)})]})]},ge.id))]})]})}),s.jsx("div",{className:"w-full shrink-0 h-full overflow-y-auto scrollbar-thin",children:Ue.length===0?s.jsx("div",{className:"p-6 text-center text-xs text-fg-tertiary",children:m("team:notifications.noNotifications")}):s.jsx("div",{className:"divide-y divide-border-default/50",children:Ue.slice(0,50).map(ge=>{const Ve=j4[ge.type]??"text-fg-tertiary";return s.jsxs("button",{onClick:()=>st(ge),className:`w-full text-left px-3 py-2.5 flex gap-2.5 transition-colors ${ge.read?"opacity-50 hover:opacity-70":"hover:bg-surface-overlay"}`,children:[s.jsx("div",{className:"shrink-0 mt-0.5",children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:Ve,children:s.jsx("path",{d:To[ge.type]??To.system})})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[!ge.read&&s.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${Ed[ge.priority]??Ed.normal}`}),s.jsx("span",{className:"text-xs text-fg-primary font-medium truncate",children:ge.title})]}),s.jsx("div",{className:"text-[11px] text-fg-tertiary mt-0.5 ",children:s.jsx(Er,{content:ge.body,className:"text-[11px] [&_h1]:text-xs [&_h2]:text-[11px] [&_h3]:text-[11px] [&_p]:text-[11px] [&_li]:text-[11px] [&_p]:text-fg-tertiary"})}),s.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[s.jsx("span",{className:"text-[10px] text-fg-muted",children:Ao(ge.createdAt,m)}),jd(ge,m)&&s.jsx("span",{className:`text-[10px] font-medium ${Ve}`,children:jd(ge,m)})]})]})]},ge.id)})})})]})})]})]})}if(o){const M=d||"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9 M13.73 21a2 2 0 0 1-3.46 0";return s.jsxs(s.Fragment,{children:[Z,s.jsxs("button",{ref:G,onClick:()=>{h(!f),f||Pe()},title:e?c||m("team:notifications.bellTitle"):void 0,className:`w-full flex items-center ${e?"flex-col justify-center px-1 py-1.5 gap-0.5":"gap-3 px-3 py-[7px]"} rounded-lg text-[13px] font-medium mb-0.5 transition-colors relative text-fg-primary ${f||l?"bg-surface-overlay":"hover:bg-surface-overlay/60"}`,children:[s.jsx("svg",{width:e?16:18,height:e?16:18,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:s.jsx("path",{d:M})}),e?s.jsx("span",{className:"text-[9px] leading-tight truncate w-full text-center",children:c}):s.jsx("span",{className:"truncate",children:c}),Lt>0&&s.jsx("span",{className:`absolute ${e?"top-0.5 right-1":"top-1 left-[22px]"} min-w-[16px] h-4 px-1 rounded-full bg-red-500 text-white text-[10px] font-bold flex items-center justify-center leading-none`,children:Lt>99?m("common:badgeOverLimit"):Lt})]}),f&&Sa.createPortal(s.jsx("div",{ref:se,className:"fixed bg-surface-secondary border border-border-default rounded-xl shadow-2xl z-[9999] flex flex-col overflow-hidden",style:{top:ee.top,left:ee.left,width:ee.width,maxHeight:ee.maxHeight},children:be}),document.body),Ye]})}return s.jsxs(s.Fragment,{children:[Z,s.jsxs("button",{ref:G,onClick:()=>{h(!f),f||Pe()},className:`relative flex items-center justify-center rounded-md transition-colors ${e?"w-8 h-8":"w-7 h-7"} ${f?"bg-surface-overlay text-fg-primary":"text-fg-tertiary hover:text-fg-secondary hover:bg-surface-overlay"}`,title:m("team:notifications.bellTitle"),children:[s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),s.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]}),Lt>0&&s.jsx("span",{className:"absolute -top-0.5 -right-0.5 min-w-[16px] h-4 px-1 rounded-full bg-red-500 text-white text-[10px] font-bold flex items-center justify-center leading-none",children:Lt>99?m("common:badgeOverLimit"):Lt})]}),f&&Sa.createPortal(s.jsx("div",{ref:se,className:"fixed bg-surface-secondary border border-border-default rounded-xl shadow-2xl z-[9999] flex flex-col overflow-hidden",style:{top:ee.top,left:ee.left,width:ee.width,maxHeight:ee.maxHeight},children:be}),document.body),Ye]})}function Md({d:e,size:t=14}){return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:s.jsx("path",{d:e})})}const rh=200;function dW({authUser:e,onLogout:t,onEditProfile:n,showSettingsLink:r=!1,collapsed:o=!1,showVersion:l=!1}){const{t:c}=ft(["nav","common"]),[d,m]=k.useState(!1),[f,h]=k.useState(!1),[g,y]=k.useState(()=>lt.isAuthenticated()),[x,w]=k.useState(()=>sa()),[C,T]=k.useState({top:0,left:0}),S=k.useRef(null),E=k.useRef(null),j=k.useCallback(ee=>{if(w(sa()),!lt.isAuthenticated()){y(!1);return}if(!ee?.validate){y(!0);return}Cw().then(q=>{y(q),w(sa())})},[]);k.useEffect(()=>{j({validate:!0});const ee=()=>j(),q=()=>j({validate:!0});return window.addEventListener("markus:hub-auth",ee),window.addEventListener("focus",q),()=>{window.removeEventListener("markus:hub-auth",ee),window.removeEventListener("focus",q)}},[j]);const L=k.useCallback(()=>{if(!S.current)return;const ee=S.current.getBoundingClientRect(),q=window.innerWidth,re=window.innerHeight,B=E.current?.offsetHeight??220;let J=ee.right+8;J+rh>q-8&&(J=Math.max(8,ee.left-rh-8));let fe=ee.top-B-8;fe<8&&(fe=Math.min(ee.bottom+8,re-B-8)),T({top:Math.max(8,fe),left:J})},[]);k.useLayoutEffect(()=>{if(!d)return;L();const ee=requestAnimationFrame(()=>L());return()=>cancelAnimationFrame(ee)},[d,L,o]),k.useEffect(()=>{if(!d)return;const ee=re=>{const B=re.target;S.current?.contains(B)||E.current?.contains(B)||m(!1)},q=()=>L();return document.addEventListener("mousedown",ee),window.addEventListener("resize",q),window.addEventListener("scroll",q,!0),()=>{document.removeEventListener("mousedown",ee),window.removeEventListener("resize",q),window.removeEventListener("scroll",q,!0)}},[d,L]);const I=e?.name||x?.displayName||x?.username||c("common:userPlaceholder"),O=e?.email||x?.email||"",F=Ew(e?.avatarUrl,x?.avatarUrl),V=g?"bg-emerald-500":"bg-fg-muted",X=g?x?.username?c("sidebar.hubConnectedAs",{username:x.username}):c("sidebar.hubConnected"):c("sidebar.hubDisconnected"),z=!!(g&&x?.username&&e?.name&&x.username.toLowerCase()!==e.name.toLowerCase()&&x.email?.toLowerCase()!==e.email?.toLowerCase()),G=()=>{m(!1),j({validate:!0}),it.navigate(de.SETTINGS,{tab:"account"})},se=d&&Sa.createPortal(s.jsxs("div",{ref:E,className:"fixed bg-surface-elevated border border-border-default rounded-xl shadow-xl z-[9999] overflow-hidden",style:{top:C.top,left:C.left,width:rh},children:[s.jsxs("div",{className:"px-3.5 py-3 border-b border-border-default flex items-start gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"text-sm font-medium text-fg-primary truncate",children:I}),O&&s.jsx("div",{className:"text-xs text-fg-tertiary mt-0.5 truncate",children:O})]}),n&&s.jsx("button",{type:"button",onClick:()=>{m(!1),n()},title:c("common:profile.editProfile"),className:"shrink-0 mt-0.5 p-1.5 rounded-md text-fg-tertiary hover:text-fg-secondary hover:bg-surface-overlay transition-colors",children:s.jsx(Md,{d:"M12 20h9M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",size:14})})]}),s.jsxs("button",{type:"button",onClick:G,className:"w-full px-3.5 py-2.5 border-b border-border-default flex items-center gap-2 hover:bg-surface-overlay transition-colors text-left",children:[s.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${V}`}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"text-xs text-fg-secondary block truncate",children:X}),z&&x?.username&&s.jsx("span",{className:"text-[10px] text-amber-500/90 block truncate mt-0.5",children:c("sidebar.hubAccountMismatch",{username:x.username})})]}),s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-fg-muted shrink-0",children:s.jsx("path",{d:"m9 18 6-6-6-6"})})]}),s.jsxs("div",{className:"py-1",children:[r&&s.jsxs("button",{type:"button",onClick:()=>{m(!1),it.navigate(de.SETTINGS)},className:"w-full flex items-center gap-2.5 px-3.5 py-2 text-sm text-fg-secondary hover:bg-surface-overlay transition-colors",children:[s.jsx(Md,{d:hc[de.SETTINGS]}),c("settings")]}),window.markusDesktop&&s.jsxs("button",{type:"button",onClick:()=>{m(!1),window.markusDesktop?.openInBrowser()},className:"w-full flex items-center gap-2.5 px-3.5 py-2 text-sm text-fg-secondary hover:bg-surface-overlay transition-colors",children:[s.jsx(Md,{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14 21 3"}),c("common:openInBrowser")]}),t&&s.jsxs("button",{type:"button",onClick:()=>{m(!1),h(!0)},className:"w-full flex items-center gap-2.5 px-3.5 py-2 text-sm text-fg-secondary hover:bg-surface-overlay transition-colors",children:[s.jsx(Md,{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9"}),c("common:signOut")]})]})]}),document.body);return s.jsxs("div",{className:`relative ${o?"flex justify-center":"flex items-center justify-between gap-2 w-full"}`,children:[s.jsxs("button",{ref:S,type:"button",onClick:()=>m(ee=>!ee),title:I,className:`relative inline-flex items-center justify-center rounded-full transition-opacity hover:opacity-90 ${o?"p-0.5":""}`,children:[s.jsx(Hs,{name:I,avatarUrl:F,size:o?28:32,fallback:"icon"}),s.jsx("span",{className:`absolute bottom-0 right-0 w-2.5 h-2.5 rounded-full border-2 border-surface-secondary ${V}`,title:X})]}),l&&!o&&s.jsxs("span",{className:"text-[10px] text-fg-muted select-none shrink-0",children:["v","0.9.7-rc.0"]}),se,f&&t&&s.jsx(dr,{title:c("common:signOutConfirmTitle"),message:c("common:signOutConfirmMessage"),confirmLabel:c("common:signOut"),variant:"primary",onConfirm:()=>{h(!1),t()},onCancel:()=>h(!1)})]})}function mW({d:e,size:t=18}){return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:s.jsx("path",{d:e})})}function fW({currentPage:e,onNavigate:t,authUser:n,collapsed:r,onToggleCollapse:o,onLogout:l,keyboardFocusPageId:c,keyboardPaneActive:d}){const{t:m}=ft(["nav","common"]);return s.jsxs("aside",{"data-keyboard-pane":"l0",className:"markus-app-sidebar h-dvh bg-surface-secondary flex flex-col shrink-0 overflow-hidden",children:[s.jsx("div",{"data-electron-drag":!0,className:`electron-mac-sidebar-header flex items-center ${r?"px-2 py-3.5 justify-center":"px-4 h-14 justify-between"}`,children:s.jsxs("button",{"data-no-drag":!0,onClick:o,title:m(r?"sidebar.expandSidebar":"sidebar.collapseSidebar"),className:"flex items-center gap-2.5 min-w-0 group",children:[s.jsx("img",{src:"/logo.png",alt:"Markus",className:"w-8 h-8 rounded-lg shrink-0"}),!r&&s.jsx("span",{className:"text-[15px] font-bold tracking-tight text-fg-primary whitespace-nowrap",children:"Markus"})]})}),s.jsx("nav",{className:`${r?"p-1":"px-3 py-2"} flex-1 overflow-y-auto scrollbar-thin`,children:YO.map((f,h)=>{const g=vw.filter(x=>x.section===f.key);if(g.length===0)return null;const y=m(`sections.${f.key}`);return s.jsx("div",{children:s.jsxs("div",{className:h>0?"mt-3":"",children:[!r&&y&&s.jsx("div",{className:"px-3 py-1.5 mb-1 text-[10px] font-semibold text-fg-muted uppercase tracking-[0.1em]",children:y}),r&&h>0&&s.jsx("div",{className:"my-3"}),g.map(x=>{if(x.id===de.NOTIFICATIONS)return s.jsx(uW,{sidebarMode:!0,collapsed:r,userId:n?.id,label:m(x.id),iconPath:hc[x.id],isActive:e===x.id},x.id);const w=e===x.id,C=d&&c===x.id;return s.jsxs("button",{"data-l0-page-id":x.id,onClick:()=>t(x.id),title:r?m(x.id):void 0,className:`w-full flex items-center ${r?"flex-col justify-center px-1 py-1.5 gap-0.5":"gap-3 px-3 py-[7px]"} rounded-lg text-[13px] font-medium mb-0.5 transition-colors text-fg-primary ${C?"bg-brand-500/25 ring-1 ring-inset ring-brand-500/40":w?"bg-surface-overlay":"hover:bg-surface-overlay/60"}`,children:[s.jsx(mW,{d:hc[x.id]??"",size:r?16:18}),r?s.jsx("span",{className:"text-[9px] leading-tight truncate w-full text-center",children:m(x.id)}):s.jsx("span",{className:"truncate",children:m(x.id)})]},x.id)})]})},f.key)})}),s.jsx("div",{className:`shrink-0 border-t border-border-subtle ${r?"p-1.5 flex justify-center":"px-3 py-2.5"}`,children:s.jsx(dW,{authUser:n,onLogout:l,onEditProfile:()=>{window.dispatchEvent(new Event("markus:open-edit-profile"))},showSettingsLink:!1,collapsed:r,showVersion:!r})})]})}const pW=6e4;let zs={},xi={};const tg=new Set,ng=new Set;let r6=0,uc=null,Rd=0,Kd=null;function w0(){for(const e of tg)e()}async function rg(){try{const e=await Ee.unread.getCounts();zs=e.counts??{},xi=e.sessionAgentMap??{},w0()}catch{}}function hW(){uc||(rg(),uc=setInterval(rg,pW),Kd=va.on("chat:unread_update",e=>{const t=e.payload?.conversationKey;t&&!ng.has(t)&&Date.now()>r6&&(zs[t]=(zs[t]??0)+1,w0())}))}function gW(){uc&&(clearInterval(uc),uc=null),Kd&&(Kd(),Kd=null)}function bW(e){const t=e?.enabled??!0,[n,r]=k.useState(zs),[o,l]=k.useState(xi),c=k.useCallback(async()=>{await rg()},[]),d=k.useCallback(async w=>{const C=new Date().toISOString();delete zs[w],w0();try{await Ee.unread.markRead(w,C)}catch{}},[]),m=k.useCallback(async()=>{zs={},w0();try{await Ee.unread.markAllRead()}catch{}},[]),f=k.useCallback(w=>{ng.add(w)},[]),h=k.useCallback(w=>{ng.delete(w),r6=Date.now()+150},[]);k.useEffect(()=>{if(!t)return;Rd++,hW();let w=xi;const C=()=>{r({...zs}),w!==xi&&(w=xi,l({...xi}))};return tg.add(C),r({...zs}),l({...xi}),()=>{tg.delete(C),Rd--,Rd<=0&&(Rd=0,gW())}},[t]);const g=k.useMemo(()=>Object.values(n).reduce((w,C)=>w+C,0),[n]),y=k.useCallback(w=>n[`session:${w}`]??0,[n]),x=k.useCallback(w=>n[`channel:${w}`]??0,[n]);return{counts:n,totalUnread:g,sessionAgentMap:o,getSessionUnread:y,getChannelUnread:x,markRead:d,markAllRead:m,refresh:c,setActiveKey:f,clearActiveKey:h}}function mX(e,t){return k.useMemo(()=>{const n=new Map;for(const[r,o]of Object.entries(t))if(r.startsWith("session:")){const l=r.slice(8),c=e[l];c&&n.set(c,(n.get(c)??0)+o)}return n},[e,t])}function xW({currentPage:e,onNavigate:t,userId:n}){const{t:r}=ft("nav"),[o,l]=k.useState(0),{counts:c}=bW({enabled:!0}),d=k.useMemo(()=>{let f=0;for(const h of Object.values(c))f+=h;return f},[c]),m=k.useCallback(async()=>{try{const f=await Ee.notifications.list(n,!1);l(f.unreadCount??f.notifications.filter(h=>!h.read).length)}catch{}},[n]);return k.useEffect(()=>{m();const f=setInterval(()=>{document.visibilityState==="visible"&&m()},3e4),h=()=>m();return window.addEventListener("markus:notifications-changed",h),()=>{clearInterval(f),window.removeEventListener("markus:notifications-changed",h)}},[m]),s.jsx("nav",{className:"fixed bottom-0 left-0 right-0 z-50 bg-surface-secondary flex items-stretch h-14 safe-area-bottom",children:QO.map(f=>{const h=f.group.includes(e),g=f.id===de.NOTIFICATIONS,y=f.id===de.TEAM;return s.jsxs("button",{onClick:()=>t(f.id),className:`flex-1 flex flex-col items-center justify-center gap-0.5 transition-colors ${h?"text-fg-primary":"text-fg-tertiary active:text-fg-secondary"}`,children:[s.jsxs("div",{className:"relative",children:[s.jsx("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:h?2:1.75,strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:s.jsx("path",{d:hc[f.id]})}),g&&o>0&&s.jsx("span",{className:"absolute -top-1.5 -right-2 min-w-[16px] h-4 px-1 flex items-center justify-center bg-red-500 text-white text-[9px] font-bold rounded-full leading-none",children:o>99?"99+":o}),y&&d>0&&s.jsx("span",{className:"absolute -top-1.5 -right-2 min-w-[16px] h-4 px-1 flex items-center justify-center bg-red-500 text-white text-[9px] font-bold rounded-full leading-none",children:d>99?"99+":d})]}),s.jsx("span",{className:`text-[10px] leading-tight ${h?"font-semibold":""}`,children:r(f.id)})]},f.id)})})}const k0=new Map;function gi(e,t){k0.has(e)||k0.set(e,t().catch(()=>{}))}function Si(e){const t=k0.get(e);return k0.delete(e),t}const Tr={builderArtifacts:"builder.artifacts",builderAgents:"builder.agents",builderHubMyItems:"builder.hubMyItems",builderInstalled:"builder.installed",hubAgents:"hub.agents",hubTeams:"hub.teams",hubSkills:"hub.skills"},Ei={agent:{label:"Agent",labelZh:"智能体",gradient:"from-violet-500 to-indigo-600",accent:"#8b5cf6",covers:[["#7c3aed","#4f46e5"],["#8b5cf6","#6366f1"],["#a855f7","#4338ca"],["#6d28d9","#2563eb"]]},team:{label:"Team",labelZh:"AI 小队",gradient:"from-cyan-500 to-blue-600",accent:"#06b6d4",covers:[["#0891b2","#2563eb"],["#06b6d4","#3b82f6"],["#0e7490","#1d4ed8"],["#22d3ee","#4f46e5"]]},skill:{label:"Skill",labelZh:"技能",gradient:"from-amber-500 to-orange-600",accent:"#f59e0b",covers:[["#f59e0b","#ea580c"],["#d97706","#dc2626"],["#fbbf24","#f97316"],["#f59e0b","#b45309"]]},connector:{label:"Connector",labelZh:"连接器",gradient:"from-emerald-500 to-teal-600",accent:"#10b981",covers:[["#10b981","#0d9488"],["#059669","#0891b2"],["#34d399","#14b8a6"],["#16a34a","#0f766e"]]}};function Xo(e){const t=(e||"").toLowerCase();return t==="team"?"team":t==="skill"?"skill":t==="connector"||t==="mcp"?"connector":"agent"}function a6(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}const yW={agent:258,team:205,skill:32,connector:162};function Xg(e,t){const n=yW[e],r=a6(t),o=((n+(r%68-34))%360+360)%360,l=(o+22+(r>>>8)%24)%360;return`linear-gradient(${120+r%44}deg, hsl(${o} 72% 56%), hsl(${l} 66% 43%))`}const L4=["M12 2l2.4 6.9L21 9l-5.4 4 2 7-5.6-4.1L6.4 20l2-7L3 9l6.6-.1z","M12 2a10 10 0 100 20 10 10 0 000-20zm0 4a6 6 0 110 12 6 6 0 010-12z","M4 4h7v7H4zM13 4h7v7h-7zM4 13h7v7H4zM13 13h7v7h-7z","M12 2l9 5v10l-9 5-9-5V7z","M3 12a9 9 0 019-9v9h9a9 9 0 11-18 0z","M6 3h12l3 6-9 12L3 9z","M12 3l3 6 6 .9-4.5 4.3 1 6.3L12 18l-5.5 2.5 1-6.3L3 9.9 9 9z","M4 12a8 8 0 018-8v4a4 4 0 00-4 4zm8 8a8 8 0 01-8-8h4a4 4 0 004 4z","M12 2l7 4v12l-7 4-7-4V6z M12 6l-3 1.7v3.4L12 13l3-1.9V7.7z","M3 6h18M3 12h18M3 18h18","M12 2a10 10 0 100 20A6 6 0 0112 8a6 6 0 010 12","M12 2l4 8h-8zM4 12h16l-8 10z"];function s6(e){return L4[a6(e+"g")%L4.length]}function i6(e){return e?e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")||e.startsWith("data:")||/\.(png|jpe?g|gif|webp|svg)$/i.test(e):!1}function vW(e){return!e||i6(e)?!1:[...e].length<=4&&new RegExp("\\p{Extended_Pictographic}","u").test(e)}function wW(e,t="user"){const n=t==="org"?"shapes":"thumbs",r=encodeURIComponent(e);return`https://api.dicebear.com/9.x/${n}/svg?seed=${r}&radius=50&backgroundType=gradientLinear`}function Mo(e){const t=e??0;return t<1e3?String(t):t<1e6?`${(t/1e3).toFixed(t<1e4?1:0)}k`.replace(".0k","k"):`${(t/1e6).toFixed(1)}M`.replace(".0M","M")}function O4(e,t="usd"){return!e||e<=0?"Free":`${t.toLowerCase()==="usd"?"$":""}${(e/100).toFixed(e%100===0?0:2)}`}const D4={agent:{icon:"✦",label:"Agent",color:"text-brand-500",gradient:"from-brand-500 to-purple-600",bg:"bg-brand-500/10",ring:"ring-brand-500/30"},team:{icon:"◈",label:"Team",color:"text-blue-600",gradient:"from-blue-500 to-blue-600",bg:"bg-blue-500/10",ring:"ring-blue-500/30"},skill:{icon:"⬡",label:"Skill",color:"text-green-600",gradient:"from-green-500 to-green-600",bg:"bg-green-500/10",ring:"ring-green-500/30"}},kW=["development","devops","management","productivity","browser","custom","general"],SW=[{label:"Tech",emojis:["✦","◈","⬡","⚡","🤖","🧠","💡","🎯","🔧","📦","🚀","💻","🛠️","⭐","🔥","💎","⚙️","🧩","🔌","💾","🖥️","📡","🔬","🧪","🏗️","📱","🎮","🕹️","📟","💽","🖨️","⌨️"]},{label:"People",emojis:["👤","👥","🧑‍💻","👨‍💼","👩‍🔬","🧙","🦸","🤝","💪","🎓","👷","🕵️","🧑‍🎨","🧑‍🏫","👨‍🚀","🥷","🧑‍🏭","🧑‍⚕️","🧑‍🔧","🧑‍🍳","👨‍🎤","🦹","🧝","🧞","🧑‍✈️","💂","🤴","👸","🧛","🧟","🧜","🧚"]},{label:"Objects",emojis:["📝","📊","🗂️","📁","🔍","🔑","🌐","💬","🔒","🎨","📐","🗃️","📋","✏️","🖊️","📌","📎","🧲","🪝","🧰","🪜","🧬","🔭","💊","🩺","📕","📗","📘","📙","📓","🗒️","📰"]},{label:"Symbols",emojis:["❤️","🧡","💛","💚","💙","💜","🖤","🤍","♠️","♥️","♦️","♣️","🎵","🎶","💯","✅","❌","⭕","🔴","🟠","🟡","🟢","🔵","🟣","⚫","⚪","🟤","🔶","🔷","▶️","⏸️","⏹️"]},{label:"Nature",emojis:["🌟","🌈","🌊","🌿","🍀","🔮","💫","✨","🌙","☀️","🦋","🐉","🦊","🐺","🦅","🐙","🦁","🐯","🦄","🐲","🌸","🌺","🍄","🌵","🎄","🌴","🍁","🌻","🐝","🦎","🐍","🦈"]},{label:"Activity",emojis:["🎯","🏆","🥇","🎖️","🏅","🎪","🎭","🎬","🎤","🎧","🎼","🎹","🥁","🎸","🎺","🎻","⚽","🏀","🎾","🏐","🎲","🧸","🪁","🎰","🎳","🏹","🥊","🤺","⛷️","🏄","🚴","🧗"]}],NW={shell:{icon:">",color:"bg-amber-500/15 text-amber-400 border-amber-500/30"},file:{icon:"◫",color:"bg-blue-500/15 text-blue-400 border-blue-500/30"},network:{icon:"◎",color:"bg-purple-500/15 text-purple-400 border-purple-500/30"},browser:{icon:"◉",color:"bg-brand-500/15 text-brand-400 border-brand-500/30"}};function ah({value:e,onChange:t,renderAs:n="span",className:r,editClassName:o,placeholder:l,multiline:c,readOnly:d}){if(d){const j=e||l,I=`${r??""} ${!e?"text-fg-muted italic":""}`;return n==="h1"?s.jsx("h1",{className:I,children:j}):n==="p"?s.jsx("p",{className:I,children:j}):s.jsx("span",{className:I,children:j})}const[m,f]=k.useState(!1),[h,g]=k.useState(e),y=k.useRef(null);k.useEffect(()=>{g(e)},[e]),k.useEffect(()=>{m&&y.current?.focus()},[m]);const x=()=>{f(!1),h!==e&&t(h)},w=()=>{g(e),f(!1)},C=j=>{j.key==="Escape"&&w(),j.key==="Enter"&&!c&&x()};if(m){const j=`bg-transparent outline-none w-full ${o??r??""} ring-1 ring-brand-500/50 rounded px-1 -mx-1`;return c?s.jsx("textarea",{ref:y,value:h,onChange:L=>g(L.target.value),onBlur:x,onKeyDown:C,className:`${j} resize-y min-h-[60px]`,placeholder:l}):s.jsx("input",{ref:y,value:h,onChange:L=>g(L.target.value),onBlur:x,onKeyDown:C,className:j,placeholder:l})}const T=e||l,S=!e,E="cursor-text hover:ring-1 hover:ring-border-default rounded px-1 -mx-1 transition-all";return n==="h1"?s.jsx("h1",{onClick:()=>f(!0),className:`${r??""} ${E} ${S?"text-fg-muted italic":""}`,children:T}):n==="p"?s.jsx("p",{onClick:()=>f(!0),className:`${r??""} ${E} ${S?"text-fg-muted italic":""}`,children:T}):n==="badge"?s.jsx("span",{onClick:()=>f(!0),className:`${r??""} ${E} ${S?"text-fg-muted italic":""}`,children:T}):s.jsx("span",{onClick:()=>f(!0),className:`${r??""} ${E} ${S?"text-fg-muted italic":""}`,children:T})}function CW({value:e,options:t,onChange:n,className:r,readOnly:o}){if(o)return s.jsx("span",{className:r,children:e});const[l,c]=k.useState(!1),[d,m]=k.useState(e),f=k.useRef(null),h=k.useRef(null);k.useEffect(()=>{l&&(m(e),setTimeout(()=>f.current?.focus(),0))},[l,e]);const g=t.filter(x=>x.toLowerCase().includes(d.toLowerCase())),y=x=>{const w=x.trim();w&&w!==e&&n(w),c(!1)};return l?s.jsxs("div",{ref:h,className:"relative inline-block",children:[s.jsx("input",{ref:f,value:d,onChange:x=>m(x.target.value),onKeyDown:x=>{x.key==="Enter"?(x.preventDefault(),y(d)):x.key==="Escape"&&c(!1)},onBlur:x=>{h.current?.contains(x.relatedTarget)||y(d)},className:`${r??""} bg-transparent outline-none ring-1 ring-brand-500/50 rounded w-28`}),g.length>0&&s.jsx("div",{className:"absolute top-full left-0 mt-1 z-50 bg-surface-elevated border border-border-default rounded-lg shadow-xl py-1 min-w-[120px] max-h-40 overflow-y-auto",children:g.map(x=>s.jsx("button",{onMouseDown:w=>{w.preventDefault(),y(x)},className:`block w-full text-left px-3 py-1.5 text-xs hover:bg-surface-secondary/80 transition-colors ${x===e?"text-brand-400 font-medium":"text-fg-secondary"}`,children:x},x))})]}):s.jsx("span",{onClick:()=>c(!0),className:`${r??""} cursor-pointer hover:ring-1 hover:ring-border-default rounded px-1 -mx-1 transition-all`,children:e})}function TW({tags:e,onChange:t,readOnly:n}){if(n)return s.jsx("div",{className:"flex flex-wrap items-center gap-1.5 min-h-[24px]",children:e.map(h=>s.jsx("span",{className:"text-[10px] px-2 py-0.5 bg-surface-elevated text-fg-muted rounded-full border border-border-default",children:h},h))});const{t:r}=ft(["builder"]),[o,l]=k.useState(!1),[c,d]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{o&&m.current?.focus()},[o]);const f=h=>{if((h.key==="Enter"||h.key===",")&&c.trim()){h.preventDefault();const g=c.trim().toLowerCase();e.includes(g)||t([...e,g]),d("")}else h.key==="Backspace"&&!c&&e.length>0?t(e.slice(0,-1)):h.key==="Escape"&&(l(!1),d(""))};return o?s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 ring-1 ring-brand-500/50 rounded px-2 py-1 -mx-1 min-h-[32px]",children:[e.map(h=>s.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] bg-surface-elevated text-fg-secondary rounded-full px-2 py-0.5 border border-border-default",children:[h,s.jsx("button",{onClick:()=>t(e.filter(g=>g!==h)),className:"text-fg-muted hover:text-red-500",children:"×"})]},h)),s.jsx("input",{ref:m,value:c,onChange:h=>d(h.target.value),onKeyDown:f,onBlur:()=>{c||l(!1)},className:"flex-1 min-w-[80px] bg-transparent text-xs text-fg-primary placeholder:text-fg-muted focus:outline-none",placeholder:r("detail.typeTagAndEnter")})]}):s.jsx("div",{onClick:()=>l(!0),className:"flex flex-wrap items-center gap-1.5 cursor-text hover:ring-1 hover:ring-border-default rounded px-1 -mx-1 py-0.5 transition-all min-h-[24px]",children:e.length>0?e.map(h=>s.jsx("span",{className:"text-[10px] px-2 py-0.5 bg-surface-elevated text-fg-muted rounded-full border border-border-default",children:h},h)):s.jsx("span",{className:"text-[10px] text-fg-muted italic",children:r("detail.typeTagAndEnter")})})}function ag({content:e}){const t=[q5,Vk,Kk],n=[M3,[n3,{strict:"ignore"}],[v3,{detect:!0,ignoreMissing:!0}]],r=q3({});return s.jsx("div",{className:`prose prose-invert prose-sm max-w-none
663
+ `)||void 0;o({approved:O,comment:V,selectedOption:F,answers:I})};return Sa.createPortal(s.jsx("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onMouseDown:I=>{I.target===I.currentTarget&&r()},children:s.jsxs("div",{className:"w-full max-w-2xl max-h-[85vh] flex flex-col bg-surface-secondary border border-border-default rounded-2xl shadow-2xl overflow-hidden",children:[s.jsxs("div",{className:"flex items-start gap-3 px-6 py-4 border-b border-border-default shrink-0",children:[s.jsx("div",{className:"w-9 h-9 rounded-lg bg-amber-500/15 text-amber-500 flex items-center justify-center shrink-0",children:s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20z"}),s.jsx("path",{d:"M12 8v4"}),s.jsx("path",{d:"M12 16h.01"})]})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h2",{className:"text-base font-semibold text-fg-primary leading-snug",children:e.title}),s.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[s.jsx("p",{className:"text-xs text-fg-tertiary",children:e.agentName}),n&&s.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-green-500/15 text-green-600",children:[s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M20 6L9 17l-5-5"})}),l("team:userInput.submitted",{defaultValue:"Submitted"})]})]})]}),s.jsx("button",{onClick:r,className:"p-1.5 text-fg-tertiary hover:text-fg-primary rounded-md hover:bg-surface-overlay transition-colors shrink-0",title:l("common:close"),children:s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M18 6L6 18"}),s.jsx("path",{d:"M6 6l12 12"})]})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-4",children:[x&&s.jsx("div",{className:"flex items-center gap-2",children:c.map((I,O)=>s.jsx("button",{onClick:()=>m(O),className:`h-1.5 flex-1 rounded-full transition-colors ${O===d?"bg-brand-500":S(I)?"bg-green-500/60":"bg-border-default"}`,title:`${O+1}. ${I.prompt.slice(0,40)}`},I.id))}),x&&s.jsx("div",{className:"text-[11px] font-medium text-fg-tertiary",children:l("team:userInput.questionProgress",{current:d+1,total:c.length,defaultValue:`Question ${d+1} of ${c.length}`})}),s.jsx("div",{className:"text-sm text-fg-primary leading-relaxed",children:s.jsx(Er,{content:g.prompt})}),g.inputType==="choice"&&g.options&&s.jsx("div",{className:"space-y-2",children:g.options.map((I,O)=>{const F=w(g.id).selectedOptionIds.includes(I.id);return s.jsxs("button",{onClick:n?void 0:()=>T(g,I.id),disabled:n,className:`w-full px-4 py-3 text-left rounded-xl border transition-colors flex items-start gap-3 ${F?"border-brand-500 bg-brand-500/10":`border-border-default ${n?"":"hover:bg-surface-overlay"}`} ${n?"cursor-default":""} ${n&&!F?"opacity-50":""}`,children:[s.jsx("span",{className:`w-6 h-6 rounded-full flex items-center justify-center text-[11px] font-bold shrink-0 mt-0.5 ${F?"bg-brand-600 text-white":"bg-surface-overlay text-fg-tertiary"}`,children:F?s.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M20 6L9 17l-5-5"})}):String.fromCharCode(65+O)}),s.jsxs("span",{className:"flex-1 min-w-0 text-sm text-fg-primary [&_p]:my-0 [&_p]:text-sm",children:[s.jsx(Er,{content:I.label}),I.description&&s.jsx("span",{className:"block text-xs text-fg-tertiary mt-1 [&_p]:my-0 [&_p]:text-xs",children:s.jsx(Er,{content:I.description})})]})]},I.id)})}),(g.inputType==="text"||g.allowFreeform)&&(!n||w(g.id).text)&&s.jsx("textarea",{rows:g.inputType==="text"?4:2,readOnly:n,placeholder:g.inputType==="text"?l("team:userInput.textPlaceholder",{defaultValue:"Type your answer…"}):l("team:userInput.freeformPlaceholder",{defaultValue:"Or write your own answer…"}),value:w(g.id).text,onChange:I=>{const O=I.target.value;C(g.id,{text:O,selectedOptionIds:O.trim()&&g.inputType==="choice"?[]:w(g.id).selectedOptionIds})},className:`w-full px-3.5 py-2.5 text-sm bg-surface-overlay border border-border-default rounded-xl text-fg-primary placeholder:text-fg-tertiary focus:outline-none resize-y ${n?"cursor-default opacity-80":"focus:ring-1 focus:ring-brand-500/50"}`})]}),s.jsxs("div",{className:"flex items-center justify-between gap-2 px-6 py-4 border-t border-border-default shrink-0",children:[s.jsx("div",{children:x&&d>0&&s.jsx("button",{onClick:()=>m(I=>Math.max(0,I-1)),className:"px-4 py-2 text-sm font-medium text-fg-secondary border border-border-default rounded-lg hover:bg-surface-overlay transition-colors",children:l("team:userInput.previous",{defaultValue:"Previous"})})}),s.jsx("div",{className:"flex items-center gap-2",children:x&&!y?s.jsx("button",{disabled:!n&&!S(g),onClick:()=>m(I=>Math.min(c.length-1,I+1)),className:"px-5 py-2 text-sm font-medium bg-brand-600 text-white rounded-lg hover:bg-brand-700 disabled:opacity-50 transition-colors",children:l("team:userInput.next",{defaultValue:"Next"})}):n?s.jsx("button",{onClick:r,className:"px-5 py-2 text-sm font-medium text-fg-secondary border border-border-default rounded-lg hover:bg-surface-overlay transition-colors",children:l("common:close",{defaultValue:"Close"})}):s.jsxs("button",{disabled:t||!E,onClick:L,className:"px-5 py-2 text-sm font-medium bg-brand-600 text-white rounded-lg hover:bg-brand-700 disabled:opacity-50 transition-colors inline-flex items-center gap-2",children:[t&&s.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),l("team:userInput.submit",{defaultValue:"Submit"})]})})]})]})}),document.body)}function Ad(e){return Array.isArray(e.questions)&&e.questions.length>0}const Ed={urgent:"bg-red-500",high:"bg-amber-500",normal:"bg-blue-500",low:"bg-gray-400"},To={approval_request:"M9 12l2 2 4-4 M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z",task_completed:"M22 11.08V12a10 10 0 1 1-5.93-9.14 M22 4L12 14.01l-3-3",task_created:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z M14 2v6h6 M16 13H8 M16 17H8 M10 9H8",task_review:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z M14 2v6h6 M16 13H8 M16 17H8 M10 9H8",task_failed:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z M14 2v6h6 M16 13H8 M16 17H8 M10 9H8",requirement_created:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7 M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z",requirement_decision:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",agent_report:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z M14 2v6h6 M16 13H8 M16 17H8",direct_message:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",group_message:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2 M9 7a4 4 0 1 0 0-8 4 4 0 0 0 0 8z M23 21v-2a4 4 0 0 0-3-3.87 M16 3.13a4 4 0 0 1 0 7.75",system:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"},j4={approval_request:"text-amber-500",task_completed:"text-green-500",task_failed:"text-red-500",task_created:"text-blue-500",task_review:"text-purple-500",requirement_created:"text-amber-500",requirement_decision:"text-green-500",agent_report:"text-blue-500",direct_message:"text-green-500",group_message:"text-brand-500",system:"text-fg-tertiary"};function Ao(e,t){const n=Date.now()-new Date(e).getTime(),r=Math.floor(n/6e4);if(r<1)return t("common:time.now");if(r<60)return t("common:time.minutesAgo",{count:r});const o=Math.floor(r/60);return o<24?t("common:time.hoursAgo",{count:o}):t("common:time.daysAgo",{count:Math.floor(o/24)})}const M4="markus:template-updates-ack";let th=!1,_d=null;function cW(e){return e.map(t=>`${t.name}@${t.availableVersion}`).sort().join(",")}function R4(e,t){if(e.type!=="system"||!e.metadata?.templateUpdates)return!1;if(!t)return!0;const n=e.metadata.templateUpdatesFingerprint;return!n||n===t}function jd(e,t){const n=e.actionType;if(n==="open_chat")return t("team:notifications.actionHints.openChat");if(n==="navigate")return t("team:notifications.actionHints.viewDetails");const r=e.metadata??{};switch(e.type){case"task_completed":case"task_created":case"task_review":case"task_failed":return r.taskId?t("team:notifications.actionHints.viewTask"):null;case"requirement_created":case"requirement_decision":return r.requirementId?t("team:notifications.actionHints.viewRequirement"):null;case"agent_report":return r.agentId?t("team:notifications.actionHints.viewAgent"):null;case"direct_message":return t("team:notifications.actionHints.openChat");case"group_message":return t("team:notifications.actionHints.openChat");case"approval_request":return t("team:notifications.actionHints.viewApproval");case"system":return r.templateUpdates?t("common:templateUpdates.actionHint"):null;default:return r.taskId?t("team:notifications.actionHints.viewTask"):r.requirementId?t("team:notifications.actionHints.viewRequirement"):r.agentId?t("team:notifications.actionHints.viewAgent"):null}}function nh(){try{const e=new AudioContext,t=e.currentTime,n=e.createGain();n.connect(e.destination),n.gain.setValueAtTime(.15,t),n.gain.exponentialRampToValueAtTime(.01,t+.6);const r=e.createOscillator();r.type="sine",r.frequency.setValueAtTime(880,t),r.frequency.setValueAtTime(1174.66,t+.15),r.connect(n),r.start(t),r.stop(t+.6),r.onended=()=>e.close()}catch{}}function uW({collapsed:e,userId:t,embeddedMode:n,onClose:r,sidebarMode:o,isActive:l,label:c,iconPath:d}){const{t:m}=ft(["team","common"]),[f,h]=k.useState(!1),[g,y]=k.useState("approvals"),[x,w]=k.useState([]),[C,T]=k.useState([]),[S,E]=k.useState(null),[j,L]=k.useState(null),[I,O]=k.useState(null),[F,V]=k.useState({}),[X,z]=k.useState(0),G=k.useRef(null),se=k.useRef(null),[ee,q]=k.useState({top:0,left:0,width:448,maxHeight:576}),re=k.useRef(null),B=k.useRef(!1),[J,fe]=k.useState(!0),[Se,U]=k.useState(!1),W=k.useRef(null),pe=k.useRef("approvals"),[P,_e]=k.useState(!1),He=30,Pe=k.useCallback(async()=>{try{Ya("/approvals"),Ya("/notifications");const[M,le]=await Promise.all([Ee.notifications.list(t,!1,{limit:He,offset:0}),Ee.approvals.list()]);w(M.notifications);const Oe=M.unreadCount??M.notifications.filter(ge=>!ge.read).length;if(z(Oe),fe(M.totalCount!=null?M.notifications.length<M.totalCount:M.notifications.length>=He),T(le.approvals),!B.current){const ge=le.approvals.filter(Ve=>Ve.status==="pending").length;re.current=ge,B.current=!0}}catch{}},[t]),Ge=k.useCallback(async()=>{if(!(Se||!J)){U(!0);try{const M=await Ee.notifications.list(t,!1,{limit:He,offset:x.length});M.notifications.length>0&&w(le=>[...le,...M.notifications.filter(Oe=>!le.some(ge=>ge.id===Oe.id))]),fe(M.totalCount!=null?x.length+M.notifications.length<M.totalCount:M.notifications.length>=He)}catch{}U(!1)}},[t,x.length,Se,J]),ct=k.useCallback(M=>{const le=M.detail;if(!le)return;const{taskId:Oe,requirementId:ge}=le;!Oe&&!ge||w(Ve=>{const Qe=Ve.filter(K=>!K.read&&(Oe&&K.metadata?.taskId===Oe||ge&&K.metadata?.requirementId===ge));if(Qe.length===0)return Ve;for(const K of Qe)Ee.notifications.markRead(K.id).catch(()=>{});return z(K=>Math.max(0,K-Qe.length)),Ve.map(K=>Qe.some(ce=>ce.id===K.id)?{...K,read:!0}:K)})},[]),mt=k.useRef(x);mt.current=x;const Ct=k.useCallback(async()=>{if(!mt.current.some(le=>!le.read&&le.type==="system"&&le.metadata?.creditExhausted))try{await Ee.notifications.create({title:m("credits.notificationTitle",{ns:"common"}),body:m("credits.notificationBody",{ns:"common"}),type:"system",priority:"urgent",metadata:{creditExhausted:!0}}),Pe(),nh()}catch{}},[Pe,m]),Mt=k.useCallback(async()=>{if(!th){th=!0;try{const{updates:M}=await Ee.skills.updates();if(!M.length)return;const le=cW(M);try{if(localStorage.getItem(M4)===le)return}catch{}if(_d===le||mt.current.some(ge=>!ge.read&&R4(ge,le)))return;try{const Ve=(await Ee.notifications.list(t,!0,{limit:50,type:"system"})).notifications.filter(Qe=>R4(Qe,le)).sort((Qe,K)=>new Date(K.createdAt).getTime()-new Date(Qe.createdAt).getTime());if(Ve.length>0){for(const Qe of Ve.slice(1))Ee.notifications.markRead(Qe.id).catch(()=>{});Ve.length>1&&Pe(),_d=le;return}}catch{}_d=le,await Ee.notifications.create({title:m("templateUpdates.notificationTitle",{ns:"common"}),body:m("templateUpdates.notificationBody",{ns:"common",count:M.length}),type:"system",priority:"high",metadata:{templateUpdates:!0,templateUpdatesFingerprint:le,count:M.length,skills:M.map(ge=>ge.name)}}),Pe(),nh()}catch{_d=null}finally{th=!1}}},[Pe,m,t]);k.useEffect(()=>{Pe();const M=setInterval(Pe,6e4);let le=null;const Oe=()=>{le||(le=setTimeout(()=>{le=null,Pe()},400))},ge=()=>Oe(),Ve=()=>{h(!0),Pe()};window.addEventListener("markus:notifications-changed",ge),window.addEventListener("markus:mark-read-by-ref",ct),window.addEventListener("markus:open-notifications",Ve),window.addEventListener("markus:credit-exhausted",Ct);const Qe=va.on("notification",Oe),K=va.on("approval:requested",Oe);return()=>{clearInterval(M),le&&clearTimeout(le),window.removeEventListener("markus:notifications-changed",ge),window.removeEventListener("markus:mark-read-by-ref",ct),window.removeEventListener("markus:open-notifications",Ve),window.removeEventListener("markus:credit-exhausted",Ct),Qe(),K()}},[Pe,ct,Ct]),k.useEffect(()=>{Mt();const M=setInterval(()=>{Mt()},5*6e4),le=()=>{Mt()};return window.addEventListener("markus:data-changed",le),()=>{clearInterval(M),window.removeEventListener("markus:data-changed",le)}},[t]);const Pt=k.useCallback(()=>{if(!G.current)return;const M=G.current.getBoundingClientRect(),le=window.innerWidth,Oe=window.innerHeight,ge=Math.min(448,le-16),Ve=Math.min(576,Oe-16);let Qe=M.right+8,K=M.top;Qe+ge>le-8&&(Qe=Math.max(8,le-ge-8)),K+Ve>Oe-8&&(K=Math.max(8,Oe-Ve-8)),q({top:K,left:Qe,width:ge,maxHeight:Ve})},[]);k.useLayoutEffect(()=>{f&&Pt()},[f,Pt]),k.useEffect(()=>{if(f)return window.addEventListener("resize",Pt),()=>window.removeEventListener("resize",Pt)},[f,Pt]),k.useEffect(()=>{if(!f)return;const M=le=>{G.current?.contains(le.target)||se.current?.contains(le.target)||h(!1)};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[f]),k.useEffect(()=>{if(!f)return;const M=C.some(Oe=>Oe.status==="pending"),le=x.some(Oe=>!Oe.read);y(M&&!le?"approvals":!M&&le?"notifications":pe.current)},[f]);const Kt=new Set(C.filter(M=>M.status==="pending").map(M=>M.id)),yt=new Set(C.map(M=>M.id)),Ue=x.filter(M=>!(M.type==="approval_request"&&M.metadata?.approvalId&&yt.has(M.metadata.approvalId))),dt=x.filter(M=>M.type==="approval_request"&&!M.read&&M.metadata?.approvalId&&Kt.has(M.metadata.approvalId)).length,Nt=Math.max(0,X-dt),bt=Kt.size,Lt=Nt+bt;k.useEffect(()=>{re.current!==null&&bt>re.current&&nh(),re.current=bt},[bt]);const ue=async M=>{await Ee.notifications.markRead(M),w(le=>le.map(Oe=>Oe.id===M?{...Oe,read:!0}:Oe)),z(le=>Math.max(0,le-1)),window.dispatchEvent(new CustomEvent("markus:notifications-changed"))},tt=M=>{const le=M.metadata??{},Oe=M.actionType,ge=M.actionTarget;if(Oe==="open_chat"&&ge)try{const Ve=typeof ge=="string"?JSON.parse(ge):ge;if(Ve.agentId){const Qe={agentId:Ve.agentId};Ve.sessionId&&(Qe.sessionId=Ve.sessionId),it.navigate(de.TEAM,Qe);return}}catch{}if(Oe==="navigate"&&ge)try{const Ve=typeof ge=="string"?JSON.parse(ge):ge;if(Ve.path){if(Ve.path.startsWith("/team")){const Qe={},K=new URLSearchParams(Ve.path.split("?")[1]||"");for(const[ce,Te]of K.entries())Qe[ce]=Te;it.navigate(de.TEAM,Qe);return}if(Ve.path.startsWith("/work")){const Qe={},K=new URLSearchParams(Ve.path.split("?")[1]||"");for(const[ce,Te]of K.entries())Qe[ce]=Te;it.navigate(de.WORK,Qe);return}}}catch{}switch(M.type){case"approval_request":{const Ve=le.approvalId,Qe=Ve?C.find(ze=>ze.id===Ve):void 0;if(Qe&&Ad(Qe)){L(Qe);break}const K=Qe?.details?.taskId??le.taskId,ce=Qe?.details?.requirementId??le.requirementId,Te=Qe?.details?.agentId??Qe?.agentId;K?it.navigate(de.WORK,{openTask:K}):ce?it.navigate(de.WORK,{openRequirement:ce}):Te?it.navigate(de.TEAM,{agentId:Te}):it.navigate(de.WORK);break}case"task_completed":case"task_created":case"task_review":case"task_failed":le.taskId?it.navigate(de.WORK,{openTask:le.taskId}):it.navigate(de.WORK);break;case"requirement_created":case"requirement_decision":le.requirementId?it.navigate(de.WORK,{openRequirement:le.requirementId}):it.navigate(de.WORK);break;case"agent_report":case"system":{if(le.creditExhausted){_e(!0);return}if(le.templateUpdates){const Ve=le.templateUpdatesFingerprint;if(Ve)try{localStorage.setItem(M4,Ve)}catch{}localStorage.setItem("markus_nav_storeTab","installed"),it.navigate(de.STORE);return}if(le.agentId){const Ve={agentId:le.agentId};le.sessionId&&(Ve.sessionId=le.sessionId),it.navigate(de.TEAM,Ve)}else it.navigate(de.TEAM);break}case"direct_message":{const Ve=le.senderId;Ve?it.navigate(de.TEAM,{dm:Ve}):it.navigate(de.TEAM);break}case"group_message":{const Ve=le.channel;Ve?it.navigate(de.TEAM,{channel:Ve}):it.navigate(de.TEAM);break}default:le.taskId?it.navigate(de.WORK,{openTask:le.taskId}):le.requirementId?it.navigate(de.WORK,{openRequirement:le.requirementId}):le.projectId?it.navigate(de.WORK,{projectId:le.projectId}):le.agentId&&it.navigate(de.TEAM,{agentId:le.agentId});break}},st=async M=>{const le=M.metadata??{},Oe=M.actionType,ge=M.type==="agent_report"&&!le.creditExhausted&&!le.templateUpdates&&(Oe==="open_chat"||!!le.agentId&&Oe!=="navigate");!M.read&&!ge&&ue(M.id);const Ve=le.taskId,Qe=le.requirementId;if(!ge&&(Ve||Qe)){const K=x.filter(ce=>ce.id!==M.id&&!ce.read&&(Ve&&ce.metadata?.taskId===Ve||Qe&&ce.metadata?.requirementId===Qe));for(const ce of K)ue(ce.id)}tt(M)},ye=async(M,le,Oe,ge,Ve)=>{E(M);try{const{approval:Qe}=await Ee.approvals.respond(M,le,t,Oe,ge,Ve);T(ze=>ze.map(rt=>rt.id===M?Qe:rt)),L(null),O(null),V(ze=>{const rt={...ze};return delete rt[M],rt});const K=Qe.details?.taskId,ce=Qe.details?.requirementId,Te=x.filter(ze=>!ze.read&&(ze.type==="approval_request"&&ze.metadata?.approvalId===M||K&&ze.metadata?.taskId===K||ce&&ze.metadata?.requirementId===ce));if(Te.length>0){for(const rt of Te)Ee.notifications.markRead(rt.id).catch(()=>{});const ze=new Set(Te.map(rt=>rt.id));w(rt=>rt.map(vt=>ze.has(vt.id)?{...vt,read:!0}:vt)),z(rt=>Math.max(0,rt-Te.length))}Ya("/approvals"),Ya("/notifications"),Ya("/tasks"),Ya("/taskboard"),Ya("/requirements"),window.dispatchEvent(new CustomEvent("markus:data-changed")),window.dispatchEvent(new CustomEvent("markus:notifications-changed")),setTimeout(()=>Pe(),800)}catch{}E(null)},je=async()=>{try{if(!t)return;await Ee.notifications.markAllRead(t),w(M=>M.map(le=>({...le,read:!0}))),z(0),Ya("/notifications"),window.dispatchEvent(new CustomEvent("markus:notifications-changed"))}catch{const M=Ue.filter(le=>!le.read);await Promise.all(M.map(le=>Ee.notifications.markRead(le.id))),w(le=>le.map(Oe=>({...Oe,read:!0}))),z(0),Ya("/notifications"),window.dispatchEvent(new CustomEvent("markus:notifications-changed"))}},Ae=M=>{const le=M.details?.subType;return le==="requirement_resubmit"?m("team:notifications.approvalType.requirementResubmit"):le==="requirement"||M.details?.requirementId?m("team:notifications.approvalType.requirement"):le==="task_review"?m("team:notifications.approvalType.taskReview"):le==="task"||M.details?.taskId?m("team:notifications.approvalType.task"):M.details?.toolName?m("team:notifications.approvalType.toolExecution"):null},oe=M=>{const le=[];le.push(M.agentName);const Oe=M.details?.taskTitle,ge=M.details?.taskId;Oe?le.push(Oe):ge&&le.push(`Task ${ge.slice(0,8)}`);const Ve=M.details?.requirementId;return Ve&&!ge&&le.push(`Req ${Ve.slice(0,8)}`),le.join(" · ")},H=[...C].sort((M,le)=>new Date(le.requestedAt).getTime()-new Date(M.requestedAt).getTime()),te=H.filter(M=>M.status==="pending"),Ne=H.filter(M=>M.status!=="pending"),Re=M=>{const le=M.details?.taskId,Oe=M.details?.requirementId,ge=M.details?.agentId??M.agentId;le?it.navigate(de.WORK,{openTask:le}):Oe?it.navigate(de.WORK,{openRequirement:Oe}):ge?it.navigate(de.TEAM,{agentId:ge}):it.navigate(de.WORK)},$e=()=>{h(!1),r?.()},Q=M=>s.jsxs("button",{disabled:S===M.id,onClick:()=>L(M),className:"w-full px-3 py-2 text-[11px] font-medium bg-brand-600 text-white rounded-md hover:bg-brand-700 disabled:opacity-50 transition-colors inline-flex items-center justify-center gap-1.5",children:[s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),m("team:userInput.respond",{defaultValue:"Respond"}),M.questions&&M.questions.length>1?` (${M.questions.length})`:""]}),Z=j?s.jsx(lW,{approval:j,submitting:S===j.id,readOnly:j.status!=="pending",onClose:()=>L(null),onSubmit:M=>ye(j.id,M.approved,M.comment,M.selectedOption,M.answers)}):null,be=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex border-b border-border-default shrink-0",children:[s.jsxs("button",{onClick:()=>{y("approvals"),pe.current="approvals"},className:`flex-1 px-3 py-2.5 text-xs font-medium transition-colors ${g==="approvals"?"text-fg-primary border-b-2 border-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:[m("team:notifications.approvals"),bt>0?` (${bt})`:""]}),s.jsxs("button",{onClick:()=>{y("notifications"),pe.current="notifications"},className:`flex-1 px-3 py-2.5 text-xs font-medium transition-colors ${g==="notifications"?"text-fg-primary border-b-2 border-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:[m("team:notifications.notifications"),Nt>0?` (${Nt})`:""]}),s.jsx("button",{onClick:$e,className:"px-2 py-2 text-fg-tertiary hover:text-fg-primary transition-colors shrink-0",title:m("common:close"),children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M18 6L6 18"}),s.jsx("path",{d:"M6 6l12 12"})]})})]}),g==="notifications"&&X>0&&s.jsx("div",{className:"flex justify-end px-3 py-1.5 border-b border-border-default/50 shrink-0",children:s.jsx("button",{onClick:je,className:"text-[10px] text-brand-500 hover:text-brand-400 transition-colors",children:m("team:notifications.markAllRead")})}),s.jsxs("div",{ref:W,className:"flex-1 overflow-y-auto",onScroll:M=>{if(g!=="notifications"||!J||Se)return;const le=M.currentTarget;le.scrollTop+le.clientHeight>=le.scrollHeight-80&&Ge()},children:[g==="approvals"&&(C.length===0?s.jsx("div",{className:"p-6 text-center text-xs text-fg-tertiary",children:m("team:notifications.noApprovals")}):s.jsxs("div",{className:"divide-y divide-border-default/50",children:[te.map(M=>{const le=M.details?.command,Oe=le?M.description.replace(/\s*Command:.*$/,""):M.description;return s.jsxs("div",{className:"px-3 py-3 space-y-2.5",children:[s.jsxs("div",{className:"cursor-pointer hover:bg-surface-overlay/50 -mx-3 -mt-3 px-3 pt-3 pb-1 rounded-t-md transition-colors",onClick:()=>Re(M),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-amber-500 mt-0.5 shrink-0",children:s.jsx("path",{d:To.approval_request})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[Ae(M)&&s.jsx("span",{className:"text-[10px] text-amber-500 font-medium shrink-0",children:Ae(M)}),s.jsx("span",{className:"text-xs text-fg-primary font-medium truncate",children:M.title}),s.jsx("span",{className:"text-[10px] text-fg-tertiary shrink-0",children:Ao(M.requestedAt,m)})]}),s.jsx("div",{className:"text-[11px] text-fg-tertiary mt-0.5",children:M.agentName})]})]}),s.jsx("div",{className:"mt-2.5 text-[11px] text-fg-secondary leading-relaxed",children:s.jsx(Er,{content:Oe,className:"text-[11px] [&_h1]:text-xs [&_h2]:text-[11px] [&_h3]:text-[11px] [&_p]:text-[11px] [&_li]:text-[11px]"})}),le&&s.jsx("pre",{className:"text-[11px] text-fg-primary bg-surface-overlay border border-border-default rounded-md px-2.5 py-2 overflow-x-auto whitespace-pre-wrap break-all font-mono leading-relaxed mt-2",children:le})]}),(()=>{if(Ad(M))return Q(M);const ge=M.details?.subType,Ve=ge==="task"||ge==="requirement"||ge==="requirement_resubmit",Qe=M.options&&M.options.length>0,K=(F[M.id]??"").trim();return Qe?s.jsxs("div",{className:"space-y-1.5",children:[M.options.map((ce,Te)=>s.jsxs("button",{disabled:S===M.id,onClick:()=>ye(M.id,ce.id!=="reject",K||void 0,ce.id),className:`w-full px-3 py-2 text-left text-[11px] font-medium rounded-md disabled:opacity-50 transition-colors flex items-center gap-2 ${ce.id==="reject"||ce.id==="request_changes"?"border border-border-default text-fg-secondary hover:bg-surface-overlay":"bg-brand-600 text-white hover:bg-brand-700"}`,title:ce.description,children:[s.jsx("span",{className:"w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px] font-bold shrink-0",children:String.fromCharCode(65+Te)}),ce.label]},ce.id)),s.jsxs("div",{className:"flex gap-1.5 mt-1",children:[s.jsx("input",{type:"text",placeholder:m("team:notifications.freeformPlaceholder"),value:F[M.id]??"",onChange:ce=>V(Te=>({...Te,[M.id]:ce.target.value})),onKeyDown:ce=>{ce.key==="Enter"&&(F[M.id]??"").trim()&&ye(M.id,!0,(F[M.id]??"").trim(),"custom")},className:"flex-1 px-2.5 py-1.5 text-[11px] bg-surface-overlay border border-border-default rounded-md text-fg-primary placeholder:text-fg-tertiary focus:outline-none focus:ring-1 focus:ring-brand-500/50"}),s.jsx("button",{disabled:S===M.id||!(F[M.id]??"").trim(),onClick:()=>ye(M.id,!0,(F[M.id]??"").trim(),"custom"),className:"px-2.5 py-1.5 text-[11px] font-medium bg-brand-600 text-white rounded-md hover:bg-brand-700 disabled:opacity-50 transition-colors",children:m("common:send")})]})]}):Ve?s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{disabled:S===M.id,onClick:()=>ye(M.id,!0,void 0,"approve"),className:"px-3 py-1.5 text-[11px] font-medium bg-green-600 text-white rounded-md hover:bg-green-700 disabled:opacity-50 transition-colors inline-flex items-center gap-1.5",children:[s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M20 6L9 17l-5-5"})}),m("common:approve")]}),s.jsxs("button",{disabled:S===M.id,onClick:()=>ye(M.id,!1,void 0,"reject"),className:"px-3 py-1.5 text-[11px] font-medium bg-red-600/80 text-white rounded-md hover:bg-red-700 disabled:opacity-50 transition-colors inline-flex items-center gap-1.5",children:[s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M18 6L6 18"}),s.jsx("path",{d:"M6 6l12 12"})]}),m("common:reject")]}),I!==M.id&&s.jsxs("button",{disabled:S===M.id,onClick:()=>O(M.id),className:"px-3 py-1.5 text-[11px] font-medium border border-amber-500/50 text-amber-500 rounded-md hover:bg-amber-500/10 disabled:opacity-50 transition-colors inline-flex items-center gap-1.5",children:[s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),s.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),m("team:notifications.needsAdjustment")]})]}),I===M.id&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("input",{type:"text",autoFocus:!0,placeholder:m("team:notifications.adjustmentPlaceholder"),value:F[M.id]??"",onChange:ce=>V(Te=>({...Te,[M.id]:ce.target.value})),onKeyDown:ce=>{ce.key==="Enter"&&(F[M.id]??"").trim()&&ye(M.id,!1,(F[M.id]??"").trim(),"needs_adjustment"),ce.key==="Escape"&&O(null)},className:"w-full px-2.5 py-1.5 text-[11px] bg-surface-overlay border border-border-default rounded-md text-fg-primary placeholder:text-fg-tertiary focus:outline-none focus:ring-1 focus:ring-amber-500/50"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{disabled:S===M.id||!(F[M.id]??"").trim(),onClick:()=>ye(M.id,!1,(F[M.id]??"").trim(),"needs_adjustment"),className:"px-2.5 py-1.5 text-[11px] font-medium bg-amber-600 text-white rounded-md hover:bg-amber-700 disabled:opacity-50 transition-colors",children:m("team:notifications.confirmAdjustment")}),s.jsx("button",{onClick:()=>O(null),className:"px-2.5 py-1.5 text-[11px] font-medium border border-border-default text-fg-secondary rounded-md hover:bg-surface-overlay transition-colors",children:m("common:cancel")})]})]})]}):s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("input",{type:"text",placeholder:m("team:notifications.commentPlaceholder"),value:F[M.id]??"",onChange:ce=>V(Te=>({...Te,[M.id]:ce.target.value})),onKeyDown:ce=>{ce.key==="Enter"&&ye(M.id,!0,K||void 0,"approve")},className:"w-full px-2.5 py-1.5 text-[11px] bg-surface-overlay border border-border-default rounded-md text-fg-primary placeholder:text-fg-tertiary focus:outline-none focus:ring-1 focus:ring-brand-500/50"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{disabled:S===M.id,onClick:()=>ye(M.id,!0,K||void 0,"approve"),className:"flex-1 px-2.5 py-1.5 text-[11px] font-medium bg-green-600 text-white rounded-md hover:bg-green-700 disabled:opacity-50 transition-colors",children:m("common:approve")}),s.jsx("button",{disabled:S===M.id,onClick:()=>ye(M.id,!1,K||void 0,"reject"),className:"flex-1 px-2.5 py-1.5 text-[11px] font-medium border border-border-default text-fg-secondary rounded-md hover:bg-surface-overlay disabled:opacity-50 transition-colors",children:m("common:reject")})]})]})})()]},M.id)}),Ne.length>0&&s.jsxs(s.Fragment,{children:[te.length>0&&s.jsx("div",{className:"px-3 py-1.5 text-[10px] font-medium text-fg-tertiary uppercase tracking-wider bg-surface-overlay/30",children:m("team:notifications.approvalHistory")}),Ne.slice(0,50).map(M=>s.jsxs("button",{onClick:()=>Ad(M)?L(M):Re(M),className:"w-full text-left px-3 py-2.5 hover:bg-surface-overlay/50 transition-colors group",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${M.status==="approved"?"bg-green-500":M.status==="cancelled"||M.status==="expired"?"bg-gray-400":"bg-red-500"}`}),Ae(M)&&s.jsx("span",{className:"text-[10px] text-fg-tertiary font-medium shrink-0",children:Ae(M)}),s.jsx("span",{className:"text-xs text-fg-secondary truncate flex-1 group-hover:text-fg-primary",children:M.title}),s.jsx("span",{className:`text-[10px] font-medium shrink-0 ${M.status==="approved"?"text-green-500":M.status==="cancelled"||M.status==="expired"?"text-fg-muted":"text-red-500"}`,children:m(`common:status.${M.status}`,{defaultValue:M.status})})]}),s.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5 pl-3.5",children:[s.jsx("span",{className:"text-[10px] text-fg-muted truncate",children:oe(M)}),s.jsx("span",{className:"text-[10px] text-fg-muted shrink-0",children:"·"}),s.jsx("span",{className:"text-[10px] text-fg-muted shrink-0",children:Ao(M.respondedAt??M.requestedAt,m)})]}),M.responseComment&&s.jsxs("p",{className:"text-[10px] text-fg-muted mt-0.5 pl-3.5 truncate",children:["“",M.responseComment,"”"]})]},M.id))]})]})),g==="notifications"&&(Ue.length===0?s.jsx("div",{className:"p-6 text-center text-xs text-fg-tertiary",children:m("team:notifications.noNotifications")}):s.jsxs("div",{className:"divide-y divide-border-default/50",children:[Ue.map(M=>{const le=j4[M.type]??"text-fg-tertiary";return s.jsxs("div",{role:"button",tabIndex:0,onClick:()=>st(M),onKeyDown:Oe=>{(Oe.key==="Enter"||Oe.key===" ")&&(Oe.preventDefault(),st(M))},className:`w-full text-left px-3 py-2.5 flex gap-2.5 transition-colors cursor-pointer ${M.read?"opacity-50 hover:opacity-70":"hover:bg-surface-overlay"}`,children:[s.jsx("div",{className:"shrink-0 mt-0.5",children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:le,children:s.jsx("path",{d:To[M.type]??To.system})})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[!M.read&&s.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${Ed[M.priority]??Ed.normal}`}),s.jsx("span",{className:"text-xs text-fg-primary font-medium truncate",children:M.title})]}),s.jsx("div",{className:"text-[11px] text-fg-tertiary mt-0.5 ",children:s.jsx(Er,{content:M.body,className:"text-[11px] [&_h1]:text-xs [&_h2]:text-[11px] [&_h3]:text-[11px] [&_p]:text-[11px] [&_li]:text-[11px] [&_p]:text-fg-tertiary"})}),s.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[s.jsx("span",{className:"text-[10px] text-fg-muted",children:Ao(M.createdAt,m)}),jd(M,m)&&s.jsx("span",{className:`text-[10px] font-medium ${le}`,children:jd(M,m)})]})]})]},M.id)}),Se&&s.jsx("div",{className:"py-3 text-center",children:s.jsxs("svg",{className:"animate-spin h-4 w-4 text-fg-tertiary mx-auto",viewBox:"0 0 24 24",fill:"none",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})})]}))]})]}),Ke=k.useCallback(M=>{M?.mute&&iW()},[]),Ie=k.useCallback(M=>{Ke(M),_e(!1)},[Ke]),Ye=P?s.jsx(dr,{title:m("credits.dialogTitle",{ns:"common"}),message:m("credits.dialogDesc",{ns:"common"}),variant:"primary",cancelLabel:m("credits.configureModels",{ns:"common"}),confirmLabel:m("credits.topUp",{ns:"common"}),checkboxes:[{id:"mute",label:m("credits.dontRemind",{ns:"common"})}],onCancel:()=>_e(!1),onCancelClick:M=>{Ie(M),it.navigate(de.SETTINGS),setTimeout(()=>{window.location.hash="settings/providers"},50)},onConfirm:M=>{const le=`${lt.getUrl().replace(/\/$/,"")}/settings?tab=billing`;Ie(M),_i(le)}}):null;if(n){const M=["approvals","notifications"],le=M.indexOf(g),Oe=(()=>{let ge=0,Ve=0;return{onTouchStart:Qe=>{ge=Qe.touches[0].clientX,Ve=Qe.touches[0].clientY},onTouchEnd:Qe=>{const K=Qe.changedTouches[0].clientX-ge,ce=Qe.changedTouches[0].clientY-Ve;Math.abs(K)>60&&Math.abs(K)>Math.abs(ce)*1.5&&(K<0&&le<M.length-1&&y(M[le+1]),K>0&&le>0&&y(M[le-1]))}}})();return s.jsxs(s.Fragment,{children:[Ye,s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[Z,s.jsx("div",{className:"flex border-b border-border-default shrink-0",children:M.map(ge=>s.jsx("button",{onClick:()=>y(ge),className:`flex-1 px-3 py-3 text-sm font-medium transition-colors ${g===ge?"text-fg-primary border-b-2 border-brand-500":"text-fg-tertiary"}`,children:ge==="approvals"?s.jsxs(s.Fragment,{children:[m("team:notifications.approvals"),bt>0?` (${bt})`:""]}):s.jsxs(s.Fragment,{children:[m("team:notifications.notifications"),Nt>0?` (${Nt})`:""]})},ge))}),g==="notifications"&&X>0&&s.jsx("div",{className:"flex justify-end px-3 py-1.5 border-b border-border-default/50 shrink-0",children:s.jsx("button",{onClick:je,className:"text-[10px] text-brand-500 hover:text-brand-400 transition-colors",children:m("team:notifications.markAllRead")})}),s.jsx("div",{className:"flex-1 overflow-hidden relative",...Oe,children:s.jsxs("div",{className:"flex h-full transition-transform duration-300 ease-out",style:{transform:`translateX(-${le*100}%)`},children:[s.jsx("div",{className:"w-full shrink-0 h-full overflow-y-auto scrollbar-thin",children:C.length===0?s.jsx("div",{className:"p-6 text-center text-xs text-fg-tertiary",children:m("team:notifications.noApprovals")}):s.jsxs("div",{className:"divide-y divide-border-default/50",children:[te.map(ge=>{const Ve=ge.details?.command,Qe=Ve?ge.description.replace(/\s*Command:.*$/,""):ge.description;return s.jsxs("div",{className:"px-3 py-3 space-y-2.5",children:[s.jsxs("div",{className:"cursor-pointer hover:bg-surface-overlay/50 -mx-3 -mt-3 px-3 pt-3 pb-1 rounded-t-md transition-colors",onClick:()=>Re(ge),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-amber-500 mt-0.5 shrink-0",children:s.jsx("path",{d:To.approval_request})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[Ae(ge)&&s.jsx("span",{className:"text-[10px] text-amber-500 font-medium shrink-0",children:Ae(ge)}),s.jsx("span",{className:"text-xs text-fg-primary font-medium truncate",children:ge.title}),s.jsx("span",{className:"text-[10px] text-fg-tertiary shrink-0",children:Ao(ge.requestedAt,m)})]}),s.jsx("div",{className:"text-[11px] text-fg-tertiary mt-0.5",children:ge.agentName})]})]}),s.jsx("div",{className:"mt-2.5 text-[11px] text-fg-secondary leading-relaxed",children:s.jsx(Er,{content:Qe,className:"text-[11px] [&_h1]:text-xs [&_h2]:text-[11px] [&_h3]:text-[11px] [&_p]:text-[11px] [&_li]:text-[11px]"})}),Ve&&s.jsx("pre",{className:"text-[11px] text-fg-primary bg-surface-overlay border border-border-default rounded-md px-2.5 py-2 overflow-x-auto whitespace-pre-wrap break-all font-mono leading-relaxed mt-2",children:Ve})]}),(()=>{if(Ad(ge))return Q(ge);const K=ge.details?.subType,ce=K==="task"||K==="requirement"||K==="requirement_resubmit",Te=ge.options&&ge.options.length>0,ze=(F[ge.id]??"").trim();return Te?s.jsxs("div",{className:"space-y-1.5",children:[ge.options.map((rt,vt)=>s.jsxs("button",{disabled:S===ge.id,onClick:()=>ye(ge.id,rt.id!=="reject",ze||void 0,rt.id),className:`w-full px-3 py-2 text-left text-[11px] font-medium rounded-md disabled:opacity-50 transition-colors flex items-center gap-2 ${rt.id==="reject"||rt.id==="request_changes"?"border border-border-default text-fg-secondary hover:bg-surface-overlay":"bg-brand-600 text-white hover:bg-brand-700"}`,title:rt.description,children:[s.jsx("span",{className:"w-5 h-5 rounded-full bg-white/20 flex items-center justify-center text-[10px] font-bold shrink-0",children:String.fromCharCode(65+vt)}),rt.label]},rt.id)),s.jsxs("div",{className:"flex gap-1.5 mt-1",children:[s.jsx("input",{type:"text",placeholder:m("team:notifications.freeformPlaceholder"),value:F[ge.id]??"",onChange:rt=>V(vt=>({...vt,[ge.id]:rt.target.value})),onKeyDown:rt=>{rt.key==="Enter"&&(F[ge.id]??"").trim()&&ye(ge.id,!0,(F[ge.id]??"").trim(),"custom")},className:"flex-1 px-2.5 py-1.5 text-[11px] bg-surface-overlay border border-border-default rounded-md text-fg-primary placeholder:text-fg-tertiary focus:outline-none focus:ring-1 focus:ring-brand-500/50"}),s.jsx("button",{disabled:S===ge.id||!(F[ge.id]??"").trim(),onClick:()=>ye(ge.id,!0,(F[ge.id]??"").trim(),"custom"),className:"px-2.5 py-1.5 text-[11px] font-medium bg-brand-600 text-white rounded-md hover:bg-brand-700 disabled:opacity-50 transition-colors",children:m("common:send")})]})]}):ce?s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{disabled:S===ge.id,onClick:()=>ye(ge.id,!0,void 0,"approve"),className:"px-3 py-1.5 text-[11px] font-medium bg-green-600 text-white rounded-md hover:bg-green-700 disabled:opacity-50 transition-colors inline-flex items-center gap-1.5",children:[s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M20 6L9 17l-5-5"})}),m("common:approve")]}),s.jsxs("button",{disabled:S===ge.id,onClick:()=>ye(ge.id,!1,void 0,"reject"),className:"px-3 py-1.5 text-[11px] font-medium bg-red-600/80 text-white rounded-md hover:bg-red-700 disabled:opacity-50 transition-colors inline-flex items-center gap-1.5",children:[s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M18 6L6 18"}),s.jsx("path",{d:"M6 6l12 12"})]}),m("common:reject")]}),I!==ge.id&&s.jsxs("button",{disabled:S===ge.id,onClick:()=>O(ge.id),className:"px-3 py-1.5 text-[11px] font-medium border border-amber-500/50 text-amber-500 rounded-md hover:bg-amber-500/10 disabled:opacity-50 transition-colors inline-flex items-center gap-1.5",children:[s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),s.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),m("team:notifications.needsAdjustment")]})]}),I===ge.id&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("input",{type:"text",autoFocus:!0,placeholder:m("team:notifications.adjustmentPlaceholder"),value:F[ge.id]??"",onChange:rt=>V(vt=>({...vt,[ge.id]:rt.target.value})),onKeyDown:rt=>{rt.key==="Enter"&&(F[ge.id]??"").trim()&&ye(ge.id,!1,(F[ge.id]??"").trim(),"needs_adjustment"),rt.key==="Escape"&&O(null)},className:"w-full px-2.5 py-1.5 text-[11px] bg-surface-overlay border border-border-default rounded-md text-fg-primary placeholder:text-fg-tertiary focus:outline-none focus:ring-1 focus:ring-amber-500/50"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{disabled:S===ge.id||!(F[ge.id]??"").trim(),onClick:()=>ye(ge.id,!1,(F[ge.id]??"").trim(),"needs_adjustment"),className:"px-2.5 py-1.5 text-[11px] font-medium bg-amber-600 text-white rounded-md hover:bg-amber-700 disabled:opacity-50 transition-colors",children:m("team:notifications.confirmAdjustment")}),s.jsx("button",{onClick:()=>O(null),className:"px-2.5 py-1.5 text-[11px] font-medium border border-border-default text-fg-secondary rounded-md hover:bg-surface-overlay transition-colors",children:m("common:cancel")})]})]})]}):s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("input",{type:"text",placeholder:m("team:notifications.commentPlaceholder"),value:F[ge.id]??"",onChange:rt=>V(vt=>({...vt,[ge.id]:rt.target.value})),onKeyDown:rt=>{rt.key==="Enter"&&ye(ge.id,!0,ze||void 0,"approve")},className:"w-full px-2.5 py-1.5 text-[11px] bg-surface-overlay border border-border-default rounded-md text-fg-primary placeholder:text-fg-tertiary focus:outline-none focus:ring-1 focus:ring-brand-500/50"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{disabled:S===ge.id,onClick:()=>ye(ge.id,!0,ze||void 0,"approve"),className:"flex-1 px-2.5 py-1.5 text-[11px] font-medium bg-green-600 text-white rounded-md hover:bg-green-700 disabled:opacity-50 transition-colors",children:m("common:approve")}),s.jsx("button",{disabled:S===ge.id,onClick:()=>ye(ge.id,!1,ze||void 0,"reject"),className:"flex-1 px-2.5 py-1.5 text-[11px] font-medium border border-border-default text-fg-secondary rounded-md hover:bg-surface-overlay disabled:opacity-50 transition-colors",children:m("common:reject")})]})]})})()]},ge.id)}),Ne.length>0&&s.jsxs(s.Fragment,{children:[te.length>0&&s.jsx("div",{className:"px-3 py-1.5 text-[10px] font-medium text-fg-tertiary uppercase tracking-wider bg-surface-overlay/30",children:m("team:notifications.approvalHistory")}),Ne.slice(0,50).map(ge=>s.jsxs("button",{onClick:()=>Re(ge),className:"w-full text-left px-3 py-2.5 hover:bg-surface-overlay/50 transition-colors",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${ge.status==="approved"?"bg-green-500":ge.status==="cancelled"||ge.status==="expired"?"bg-gray-400":"bg-red-500"}`}),s.jsx("span",{className:"text-xs text-fg-secondary truncate flex-1",children:ge.title}),s.jsx("span",{className:`text-[10px] font-medium shrink-0 ${ge.status==="approved"?"text-green-500":ge.status==="cancelled"||ge.status==="expired"?"text-fg-muted":"text-red-500"}`,children:m(`common:status.${ge.status}`,{defaultValue:ge.status})})]}),s.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5 pl-3.5",children:[s.jsx("span",{className:"text-[10px] text-fg-muted truncate",children:oe(ge)}),s.jsx("span",{className:"text-[10px] text-fg-muted shrink-0",children:"·"}),s.jsx("span",{className:"text-[10px] text-fg-muted shrink-0",children:Ao(ge.respondedAt??ge.requestedAt,m)})]})]},ge.id))]})]})}),s.jsx("div",{className:"w-full shrink-0 h-full overflow-y-auto scrollbar-thin",children:Ue.length===0?s.jsx("div",{className:"p-6 text-center text-xs text-fg-tertiary",children:m("team:notifications.noNotifications")}):s.jsx("div",{className:"divide-y divide-border-default/50",children:Ue.slice(0,50).map(ge=>{const Ve=j4[ge.type]??"text-fg-tertiary";return s.jsxs("button",{onClick:()=>st(ge),className:`w-full text-left px-3 py-2.5 flex gap-2.5 transition-colors ${ge.read?"opacity-50 hover:opacity-70":"hover:bg-surface-overlay"}`,children:[s.jsx("div",{className:"shrink-0 mt-0.5",children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:Ve,children:s.jsx("path",{d:To[ge.type]??To.system})})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[!ge.read&&s.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${Ed[ge.priority]??Ed.normal}`}),s.jsx("span",{className:"text-xs text-fg-primary font-medium truncate",children:ge.title})]}),s.jsx("div",{className:"text-[11px] text-fg-tertiary mt-0.5 ",children:s.jsx(Er,{content:ge.body,className:"text-[11px] [&_h1]:text-xs [&_h2]:text-[11px] [&_h3]:text-[11px] [&_p]:text-[11px] [&_li]:text-[11px] [&_p]:text-fg-tertiary"})}),s.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[s.jsx("span",{className:"text-[10px] text-fg-muted",children:Ao(ge.createdAt,m)}),jd(ge,m)&&s.jsx("span",{className:`text-[10px] font-medium ${Ve}`,children:jd(ge,m)})]})]})]},ge.id)})})})]})})]})]})}if(o){const M=d||"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9 M13.73 21a2 2 0 0 1-3.46 0";return s.jsxs(s.Fragment,{children:[Z,s.jsxs("button",{ref:G,onClick:()=>{h(!f),f||Pe()},title:e?c||m("team:notifications.bellTitle"):void 0,className:`w-full flex items-center ${e?"flex-col justify-center px-1 py-1.5 gap-0.5":"gap-3 px-3 py-[7px]"} rounded-lg text-[13px] font-medium mb-0.5 transition-colors relative text-fg-primary ${f||l?"bg-surface-overlay":"hover:bg-surface-overlay/60"}`,children:[s.jsx("svg",{width:e?16:18,height:e?16:18,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:s.jsx("path",{d:M})}),e?s.jsx("span",{className:"text-[9px] leading-tight truncate w-full text-center",children:c}):s.jsx("span",{className:"truncate",children:c}),Lt>0&&s.jsx("span",{className:`absolute ${e?"top-0.5 right-1":"top-1 left-[22px]"} min-w-[16px] h-4 px-1 rounded-full bg-red-500 text-white text-[10px] font-bold flex items-center justify-center leading-none`,children:Lt>99?m("common:badgeOverLimit"):Lt})]}),f&&Sa.createPortal(s.jsx("div",{ref:se,className:"fixed bg-surface-secondary border border-border-default rounded-xl shadow-2xl z-[9999] flex flex-col overflow-hidden",style:{top:ee.top,left:ee.left,width:ee.width,maxHeight:ee.maxHeight},children:be}),document.body),Ye]})}return s.jsxs(s.Fragment,{children:[Z,s.jsxs("button",{ref:G,onClick:()=>{h(!f),f||Pe()},className:`relative flex items-center justify-center rounded-md transition-colors ${e?"w-8 h-8":"w-7 h-7"} ${f?"bg-surface-overlay text-fg-primary":"text-fg-tertiary hover:text-fg-secondary hover:bg-surface-overlay"}`,title:m("team:notifications.bellTitle"),children:[s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),s.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]}),Lt>0&&s.jsx("span",{className:"absolute -top-0.5 -right-0.5 min-w-[16px] h-4 px-1 rounded-full bg-red-500 text-white text-[10px] font-bold flex items-center justify-center leading-none",children:Lt>99?m("common:badgeOverLimit"):Lt})]}),f&&Sa.createPortal(s.jsx("div",{ref:se,className:"fixed bg-surface-secondary border border-border-default rounded-xl shadow-2xl z-[9999] flex flex-col overflow-hidden",style:{top:ee.top,left:ee.left,width:ee.width,maxHeight:ee.maxHeight},children:be}),document.body),Ye]})}function Md({d:e,size:t=14}){return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:s.jsx("path",{d:e})})}const rh=200;function dW({authUser:e,onLogout:t,onEditProfile:n,showSettingsLink:r=!1,collapsed:o=!1,showVersion:l=!1}){const{t:c}=ft(["nav","common"]),[d,m]=k.useState(!1),[f,h]=k.useState(!1),[g,y]=k.useState(()=>lt.isAuthenticated()),[x,w]=k.useState(()=>sa()),[C,T]=k.useState({top:0,left:0}),S=k.useRef(null),E=k.useRef(null),j=k.useCallback(ee=>{if(w(sa()),!lt.isAuthenticated()){y(!1);return}if(!ee?.validate){y(!0);return}Cw().then(q=>{y(q),w(sa())})},[]);k.useEffect(()=>{j({validate:!0});const ee=()=>j(),q=()=>j({validate:!0});return window.addEventListener("markus:hub-auth",ee),window.addEventListener("focus",q),()=>{window.removeEventListener("markus:hub-auth",ee),window.removeEventListener("focus",q)}},[j]);const L=k.useCallback(()=>{if(!S.current)return;const ee=S.current.getBoundingClientRect(),q=window.innerWidth,re=window.innerHeight,B=E.current?.offsetHeight??220;let J=ee.right+8;J+rh>q-8&&(J=Math.max(8,ee.left-rh-8));let fe=ee.top-B-8;fe<8&&(fe=Math.min(ee.bottom+8,re-B-8)),T({top:Math.max(8,fe),left:J})},[]);k.useLayoutEffect(()=>{if(!d)return;L();const ee=requestAnimationFrame(()=>L());return()=>cancelAnimationFrame(ee)},[d,L,o]),k.useEffect(()=>{if(!d)return;const ee=re=>{const B=re.target;S.current?.contains(B)||E.current?.contains(B)||m(!1)},q=()=>L();return document.addEventListener("mousedown",ee),window.addEventListener("resize",q),window.addEventListener("scroll",q,!0),()=>{document.removeEventListener("mousedown",ee),window.removeEventListener("resize",q),window.removeEventListener("scroll",q,!0)}},[d,L]);const I=e?.name||x?.displayName||x?.username||c("common:userPlaceholder"),O=e?.email||x?.email||"",F=Ew(e?.avatarUrl,x?.avatarUrl),V=g?"bg-emerald-500":"bg-fg-muted",X=g?x?.username?c("sidebar.hubConnectedAs",{username:x.username}):c("sidebar.hubConnected"):c("sidebar.hubDisconnected"),z=!!(g&&x?.username&&e?.name&&x.username.toLowerCase()!==e.name.toLowerCase()&&x.email?.toLowerCase()!==e.email?.toLowerCase()),G=()=>{m(!1),j({validate:!0}),it.navigate(de.SETTINGS,{tab:"account"})},se=d&&Sa.createPortal(s.jsxs("div",{ref:E,className:"fixed bg-surface-elevated border border-border-default rounded-xl shadow-xl z-[9999] overflow-hidden",style:{top:C.top,left:C.left,width:rh},children:[s.jsxs("div",{className:"px-3.5 py-3 border-b border-border-default flex items-start gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"text-sm font-medium text-fg-primary truncate",children:I}),O&&s.jsx("div",{className:"text-xs text-fg-tertiary mt-0.5 truncate",children:O})]}),n&&s.jsx("button",{type:"button",onClick:()=>{m(!1),n()},title:c("common:profile.editProfile"),className:"shrink-0 mt-0.5 p-1.5 rounded-md text-fg-tertiary hover:text-fg-secondary hover:bg-surface-overlay transition-colors",children:s.jsx(Md,{d:"M12 20h9M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",size:14})})]}),s.jsxs("button",{type:"button",onClick:G,className:"w-full px-3.5 py-2.5 border-b border-border-default flex items-center gap-2 hover:bg-surface-overlay transition-colors text-left",children:[s.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${V}`}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"text-xs text-fg-secondary block truncate",children:X}),z&&x?.username&&s.jsx("span",{className:"text-[10px] text-amber-500/90 block truncate mt-0.5",children:c("sidebar.hubAccountMismatch",{username:x.username})})]}),s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-fg-muted shrink-0",children:s.jsx("path",{d:"m9 18 6-6-6-6"})})]}),s.jsxs("div",{className:"py-1",children:[r&&s.jsxs("button",{type:"button",onClick:()=>{m(!1),it.navigate(de.SETTINGS)},className:"w-full flex items-center gap-2.5 px-3.5 py-2 text-sm text-fg-secondary hover:bg-surface-overlay transition-colors",children:[s.jsx(Md,{d:hc[de.SETTINGS]}),c("settings")]}),window.markusDesktop&&s.jsxs("button",{type:"button",onClick:()=>{m(!1),window.markusDesktop?.openInBrowser()},className:"w-full flex items-center gap-2.5 px-3.5 py-2 text-sm text-fg-secondary hover:bg-surface-overlay transition-colors",children:[s.jsx(Md,{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14 21 3"}),c("common:openInBrowser")]}),t&&s.jsxs("button",{type:"button",onClick:()=>{m(!1),h(!0)},className:"w-full flex items-center gap-2.5 px-3.5 py-2 text-sm text-fg-secondary hover:bg-surface-overlay transition-colors",children:[s.jsx(Md,{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9"}),c("common:signOut")]})]})]}),document.body);return s.jsxs("div",{className:`relative ${o?"flex justify-center":"flex items-center justify-between gap-2 w-full"}`,children:[s.jsxs("button",{ref:S,type:"button",onClick:()=>m(ee=>!ee),title:I,className:`relative inline-flex items-center justify-center rounded-full transition-opacity hover:opacity-90 ${o?"p-0.5":""}`,children:[s.jsx(Hs,{name:I,avatarUrl:F,size:o?28:32,fallback:"icon"}),s.jsx("span",{className:`absolute bottom-0 right-0 w-2.5 h-2.5 rounded-full border-2 border-surface-secondary ${V}`,title:X})]}),l&&!o&&s.jsxs("span",{className:"text-[10px] text-fg-muted select-none shrink-0",children:["v","0.9.7-rc.1"]}),se,f&&t&&s.jsx(dr,{title:c("common:signOutConfirmTitle"),message:c("common:signOutConfirmMessage"),confirmLabel:c("common:signOut"),variant:"primary",onConfirm:()=>{h(!1),t()},onCancel:()=>h(!1)})]})}function mW({d:e,size:t=18}){return s.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:s.jsx("path",{d:e})})}function fW({currentPage:e,onNavigate:t,authUser:n,collapsed:r,onToggleCollapse:o,onLogout:l,keyboardFocusPageId:c,keyboardPaneActive:d}){const{t:m}=ft(["nav","common"]);return s.jsxs("aside",{"data-keyboard-pane":"l0",className:"markus-app-sidebar h-dvh bg-surface-secondary flex flex-col shrink-0 overflow-hidden",children:[s.jsx("div",{"data-electron-drag":!0,className:`electron-mac-sidebar-header flex items-center ${r?"px-2 py-3.5 justify-center":"px-4 h-14 justify-between"}`,children:s.jsxs("button",{"data-no-drag":!0,onClick:o,title:m(r?"sidebar.expandSidebar":"sidebar.collapseSidebar"),className:"flex items-center gap-2.5 min-w-0 group",children:[s.jsx("img",{src:"/logo.png",alt:"Markus",className:"w-8 h-8 rounded-lg shrink-0"}),!r&&s.jsx("span",{className:"text-[15px] font-bold tracking-tight text-fg-primary whitespace-nowrap",children:"Markus"})]})}),s.jsx("nav",{className:`${r?"p-1":"px-3 py-2"} flex-1 overflow-y-auto scrollbar-thin`,children:YO.map((f,h)=>{const g=vw.filter(x=>x.section===f.key);if(g.length===0)return null;const y=m(`sections.${f.key}`);return s.jsx("div",{children:s.jsxs("div",{className:h>0?"mt-3":"",children:[!r&&y&&s.jsx("div",{className:"px-3 py-1.5 mb-1 text-[10px] font-semibold text-fg-muted uppercase tracking-[0.1em]",children:y}),r&&h>0&&s.jsx("div",{className:"my-3"}),g.map(x=>{if(x.id===de.NOTIFICATIONS)return s.jsx(uW,{sidebarMode:!0,collapsed:r,userId:n?.id,label:m(x.id),iconPath:hc[x.id],isActive:e===x.id},x.id);const w=e===x.id,C=d&&c===x.id;return s.jsxs("button",{"data-l0-page-id":x.id,onClick:()=>t(x.id),title:r?m(x.id):void 0,className:`w-full flex items-center ${r?"flex-col justify-center px-1 py-1.5 gap-0.5":"gap-3 px-3 py-[7px]"} rounded-lg text-[13px] font-medium mb-0.5 transition-colors text-fg-primary ${C?"bg-brand-500/25 ring-1 ring-inset ring-brand-500/40":w?"bg-surface-overlay":"hover:bg-surface-overlay/60"}`,children:[s.jsx(mW,{d:hc[x.id]??"",size:r?16:18}),r?s.jsx("span",{className:"text-[9px] leading-tight truncate w-full text-center",children:m(x.id)}):s.jsx("span",{className:"truncate",children:m(x.id)})]},x.id)})]})},f.key)})}),s.jsx("div",{className:`shrink-0 border-t border-border-subtle ${r?"p-1.5 flex justify-center":"px-3 py-2.5"}`,children:s.jsx(dW,{authUser:n,onLogout:l,onEditProfile:()=>{window.dispatchEvent(new Event("markus:open-edit-profile"))},showSettingsLink:!1,collapsed:r,showVersion:!r})})]})}const pW=6e4;let zs={},xi={};const tg=new Set,ng=new Set;let r6=0,uc=null,Rd=0,Kd=null;function w0(){for(const e of tg)e()}async function rg(){try{const e=await Ee.unread.getCounts();zs=e.counts??{},xi=e.sessionAgentMap??{},w0()}catch{}}function hW(){uc||(rg(),uc=setInterval(rg,pW),Kd=va.on("chat:unread_update",e=>{const t=e.payload?.conversationKey;t&&!ng.has(t)&&Date.now()>r6&&(zs[t]=(zs[t]??0)+1,w0())}))}function gW(){uc&&(clearInterval(uc),uc=null),Kd&&(Kd(),Kd=null)}function bW(e){const t=e?.enabled??!0,[n,r]=k.useState(zs),[o,l]=k.useState(xi),c=k.useCallback(async()=>{await rg()},[]),d=k.useCallback(async w=>{const C=new Date().toISOString();delete zs[w],w0();try{await Ee.unread.markRead(w,C)}catch{}},[]),m=k.useCallback(async()=>{zs={},w0();try{await Ee.unread.markAllRead()}catch{}},[]),f=k.useCallback(w=>{ng.add(w)},[]),h=k.useCallback(w=>{ng.delete(w),r6=Date.now()+150},[]);k.useEffect(()=>{if(!t)return;Rd++,hW();let w=xi;const C=()=>{r({...zs}),w!==xi&&(w=xi,l({...xi}))};return tg.add(C),r({...zs}),l({...xi}),()=>{tg.delete(C),Rd--,Rd<=0&&(Rd=0,gW())}},[t]);const g=k.useMemo(()=>Object.values(n).reduce((w,C)=>w+C,0),[n]),y=k.useCallback(w=>n[`session:${w}`]??0,[n]),x=k.useCallback(w=>n[`channel:${w}`]??0,[n]);return{counts:n,totalUnread:g,sessionAgentMap:o,getSessionUnread:y,getChannelUnread:x,markRead:d,markAllRead:m,refresh:c,setActiveKey:f,clearActiveKey:h}}function mX(e,t){return k.useMemo(()=>{const n=new Map;for(const[r,o]of Object.entries(t))if(r.startsWith("session:")){const l=r.slice(8),c=e[l];c&&n.set(c,(n.get(c)??0)+o)}return n},[e,t])}function xW({currentPage:e,onNavigate:t,userId:n}){const{t:r}=ft("nav"),[o,l]=k.useState(0),{counts:c}=bW({enabled:!0}),d=k.useMemo(()=>{let f=0;for(const h of Object.values(c))f+=h;return f},[c]),m=k.useCallback(async()=>{try{const f=await Ee.notifications.list(n,!1);l(f.unreadCount??f.notifications.filter(h=>!h.read).length)}catch{}},[n]);return k.useEffect(()=>{m();const f=setInterval(()=>{document.visibilityState==="visible"&&m()},3e4),h=()=>m();return window.addEventListener("markus:notifications-changed",h),()=>{clearInterval(f),window.removeEventListener("markus:notifications-changed",h)}},[m]),s.jsx("nav",{className:"fixed bottom-0 left-0 right-0 z-50 bg-surface-secondary flex items-stretch h-14 safe-area-bottom",children:QO.map(f=>{const h=f.group.includes(e),g=f.id===de.NOTIFICATIONS,y=f.id===de.TEAM;return s.jsxs("button",{onClick:()=>t(f.id),className:`flex-1 flex flex-col items-center justify-center gap-0.5 transition-colors ${h?"text-fg-primary":"text-fg-tertiary active:text-fg-secondary"}`,children:[s.jsxs("div",{className:"relative",children:[s.jsx("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:h?2:1.75,strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:s.jsx("path",{d:hc[f.id]})}),g&&o>0&&s.jsx("span",{className:"absolute -top-1.5 -right-2 min-w-[16px] h-4 px-1 flex items-center justify-center bg-red-500 text-white text-[9px] font-bold rounded-full leading-none",children:o>99?"99+":o}),y&&d>0&&s.jsx("span",{className:"absolute -top-1.5 -right-2 min-w-[16px] h-4 px-1 flex items-center justify-center bg-red-500 text-white text-[9px] font-bold rounded-full leading-none",children:d>99?"99+":d})]}),s.jsx("span",{className:`text-[10px] leading-tight ${h?"font-semibold":""}`,children:r(f.id)})]},f.id)})})}const k0=new Map;function gi(e,t){k0.has(e)||k0.set(e,t().catch(()=>{}))}function Si(e){const t=k0.get(e);return k0.delete(e),t}const Tr={builderArtifacts:"builder.artifacts",builderAgents:"builder.agents",builderHubMyItems:"builder.hubMyItems",builderInstalled:"builder.installed",hubAgents:"hub.agents",hubTeams:"hub.teams",hubSkills:"hub.skills"},Ei={agent:{label:"Agent",labelZh:"智能体",gradient:"from-violet-500 to-indigo-600",accent:"#8b5cf6",covers:[["#7c3aed","#4f46e5"],["#8b5cf6","#6366f1"],["#a855f7","#4338ca"],["#6d28d9","#2563eb"]]},team:{label:"Team",labelZh:"AI 小队",gradient:"from-cyan-500 to-blue-600",accent:"#06b6d4",covers:[["#0891b2","#2563eb"],["#06b6d4","#3b82f6"],["#0e7490","#1d4ed8"],["#22d3ee","#4f46e5"]]},skill:{label:"Skill",labelZh:"技能",gradient:"from-amber-500 to-orange-600",accent:"#f59e0b",covers:[["#f59e0b","#ea580c"],["#d97706","#dc2626"],["#fbbf24","#f97316"],["#f59e0b","#b45309"]]},connector:{label:"Connector",labelZh:"连接器",gradient:"from-emerald-500 to-teal-600",accent:"#10b981",covers:[["#10b981","#0d9488"],["#059669","#0891b2"],["#34d399","#14b8a6"],["#16a34a","#0f766e"]]}};function Xo(e){const t=(e||"").toLowerCase();return t==="team"?"team":t==="skill"?"skill":t==="connector"||t==="mcp"?"connector":"agent"}function a6(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}const yW={agent:258,team:205,skill:32,connector:162};function Xg(e,t){const n=yW[e],r=a6(t),o=((n+(r%68-34))%360+360)%360,l=(o+22+(r>>>8)%24)%360;return`linear-gradient(${120+r%44}deg, hsl(${o} 72% 56%), hsl(${l} 66% 43%))`}const L4=["M12 2l2.4 6.9L21 9l-5.4 4 2 7-5.6-4.1L6.4 20l2-7L3 9l6.6-.1z","M12 2a10 10 0 100 20 10 10 0 000-20zm0 4a6 6 0 110 12 6 6 0 010-12z","M4 4h7v7H4zM13 4h7v7h-7zM4 13h7v7H4zM13 13h7v7h-7z","M12 2l9 5v10l-9 5-9-5V7z","M3 12a9 9 0 019-9v9h9a9 9 0 11-18 0z","M6 3h12l3 6-9 12L3 9z","M12 3l3 6 6 .9-4.5 4.3 1 6.3L12 18l-5.5 2.5 1-6.3L3 9.9 9 9z","M4 12a8 8 0 018-8v4a4 4 0 00-4 4zm8 8a8 8 0 01-8-8h4a4 4 0 004 4z","M12 2l7 4v12l-7 4-7-4V6z M12 6l-3 1.7v3.4L12 13l3-1.9V7.7z","M3 6h18M3 12h18M3 18h18","M12 2a10 10 0 100 20A6 6 0 0112 8a6 6 0 010 12","M12 2l4 8h-8zM4 12h16l-8 10z"];function s6(e){return L4[a6(e+"g")%L4.length]}function i6(e){return e?e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")||e.startsWith("data:")||/\.(png|jpe?g|gif|webp|svg)$/i.test(e):!1}function vW(e){return!e||i6(e)?!1:[...e].length<=4&&new RegExp("\\p{Extended_Pictographic}","u").test(e)}function wW(e,t="user"){const n=t==="org"?"shapes":"thumbs",r=encodeURIComponent(e);return`https://api.dicebear.com/9.x/${n}/svg?seed=${r}&radius=50&backgroundType=gradientLinear`}function Mo(e){const t=e??0;return t<1e3?String(t):t<1e6?`${(t/1e3).toFixed(t<1e4?1:0)}k`.replace(".0k","k"):`${(t/1e6).toFixed(1)}M`.replace(".0M","M")}function O4(e,t="usd"){return!e||e<=0?"Free":`${t.toLowerCase()==="usd"?"$":""}${(e/100).toFixed(e%100===0?0:2)}`}const D4={agent:{icon:"✦",label:"Agent",color:"text-brand-500",gradient:"from-brand-500 to-purple-600",bg:"bg-brand-500/10",ring:"ring-brand-500/30"},team:{icon:"◈",label:"Team",color:"text-blue-600",gradient:"from-blue-500 to-blue-600",bg:"bg-blue-500/10",ring:"ring-blue-500/30"},skill:{icon:"⬡",label:"Skill",color:"text-green-600",gradient:"from-green-500 to-green-600",bg:"bg-green-500/10",ring:"ring-green-500/30"}},kW=["development","devops","management","productivity","browser","custom","general"],SW=[{label:"Tech",emojis:["✦","◈","⬡","⚡","🤖","🧠","💡","🎯","🔧","📦","🚀","💻","🛠️","⭐","🔥","💎","⚙️","🧩","🔌","💾","🖥️","📡","🔬","🧪","🏗️","📱","🎮","🕹️","📟","💽","🖨️","⌨️"]},{label:"People",emojis:["👤","👥","🧑‍💻","👨‍💼","👩‍🔬","🧙","🦸","🤝","💪","🎓","👷","🕵️","🧑‍🎨","🧑‍🏫","👨‍🚀","🥷","🧑‍🏭","🧑‍⚕️","🧑‍🔧","🧑‍🍳","👨‍🎤","🦹","🧝","🧞","🧑‍✈️","💂","🤴","👸","🧛","🧟","🧜","🧚"]},{label:"Objects",emojis:["📝","📊","🗂️","📁","🔍","🔑","🌐","💬","🔒","🎨","📐","🗃️","📋","✏️","🖊️","📌","📎","🧲","🪝","🧰","🪜","🧬","🔭","💊","🩺","📕","📗","📘","📙","📓","🗒️","📰"]},{label:"Symbols",emojis:["❤️","🧡","💛","💚","💙","💜","🖤","🤍","♠️","♥️","♦️","♣️","🎵","🎶","💯","✅","❌","⭕","🔴","🟠","🟡","🟢","🔵","🟣","⚫","⚪","🟤","🔶","🔷","▶️","⏸️","⏹️"]},{label:"Nature",emojis:["🌟","🌈","🌊","🌿","🍀","🔮","💫","✨","🌙","☀️","🦋","🐉","🦊","🐺","🦅","🐙","🦁","🐯","🦄","🐲","🌸","🌺","🍄","🌵","🎄","🌴","🍁","🌻","🐝","🦎","🐍","🦈"]},{label:"Activity",emojis:["🎯","🏆","🥇","🎖️","🏅","🎪","🎭","🎬","🎤","🎧","🎼","🎹","🥁","🎸","🎺","🎻","⚽","🏀","🎾","🏐","🎲","🧸","🪁","🎰","🎳","🏹","🥊","🤺","⛷️","🏄","🚴","🧗"]}],NW={shell:{icon:">",color:"bg-amber-500/15 text-amber-400 border-amber-500/30"},file:{icon:"◫",color:"bg-blue-500/15 text-blue-400 border-blue-500/30"},network:{icon:"◎",color:"bg-purple-500/15 text-purple-400 border-purple-500/30"},browser:{icon:"◉",color:"bg-brand-500/15 text-brand-400 border-brand-500/30"}};function ah({value:e,onChange:t,renderAs:n="span",className:r,editClassName:o,placeholder:l,multiline:c,readOnly:d}){if(d){const j=e||l,I=`${r??""} ${!e?"text-fg-muted italic":""}`;return n==="h1"?s.jsx("h1",{className:I,children:j}):n==="p"?s.jsx("p",{className:I,children:j}):s.jsx("span",{className:I,children:j})}const[m,f]=k.useState(!1),[h,g]=k.useState(e),y=k.useRef(null);k.useEffect(()=>{g(e)},[e]),k.useEffect(()=>{m&&y.current?.focus()},[m]);const x=()=>{f(!1),h!==e&&t(h)},w=()=>{g(e),f(!1)},C=j=>{j.key==="Escape"&&w(),j.key==="Enter"&&!c&&x()};if(m){const j=`bg-transparent outline-none w-full ${o??r??""} ring-1 ring-brand-500/50 rounded px-1 -mx-1`;return c?s.jsx("textarea",{ref:y,value:h,onChange:L=>g(L.target.value),onBlur:x,onKeyDown:C,className:`${j} resize-y min-h-[60px]`,placeholder:l}):s.jsx("input",{ref:y,value:h,onChange:L=>g(L.target.value),onBlur:x,onKeyDown:C,className:j,placeholder:l})}const T=e||l,S=!e,E="cursor-text hover:ring-1 hover:ring-border-default rounded px-1 -mx-1 transition-all";return n==="h1"?s.jsx("h1",{onClick:()=>f(!0),className:`${r??""} ${E} ${S?"text-fg-muted italic":""}`,children:T}):n==="p"?s.jsx("p",{onClick:()=>f(!0),className:`${r??""} ${E} ${S?"text-fg-muted italic":""}`,children:T}):n==="badge"?s.jsx("span",{onClick:()=>f(!0),className:`${r??""} ${E} ${S?"text-fg-muted italic":""}`,children:T}):s.jsx("span",{onClick:()=>f(!0),className:`${r??""} ${E} ${S?"text-fg-muted italic":""}`,children:T})}function CW({value:e,options:t,onChange:n,className:r,readOnly:o}){if(o)return s.jsx("span",{className:r,children:e});const[l,c]=k.useState(!1),[d,m]=k.useState(e),f=k.useRef(null),h=k.useRef(null);k.useEffect(()=>{l&&(m(e),setTimeout(()=>f.current?.focus(),0))},[l,e]);const g=t.filter(x=>x.toLowerCase().includes(d.toLowerCase())),y=x=>{const w=x.trim();w&&w!==e&&n(w),c(!1)};return l?s.jsxs("div",{ref:h,className:"relative inline-block",children:[s.jsx("input",{ref:f,value:d,onChange:x=>m(x.target.value),onKeyDown:x=>{x.key==="Enter"?(x.preventDefault(),y(d)):x.key==="Escape"&&c(!1)},onBlur:x=>{h.current?.contains(x.relatedTarget)||y(d)},className:`${r??""} bg-transparent outline-none ring-1 ring-brand-500/50 rounded w-28`}),g.length>0&&s.jsx("div",{className:"absolute top-full left-0 mt-1 z-50 bg-surface-elevated border border-border-default rounded-lg shadow-xl py-1 min-w-[120px] max-h-40 overflow-y-auto",children:g.map(x=>s.jsx("button",{onMouseDown:w=>{w.preventDefault(),y(x)},className:`block w-full text-left px-3 py-1.5 text-xs hover:bg-surface-secondary/80 transition-colors ${x===e?"text-brand-400 font-medium":"text-fg-secondary"}`,children:x},x))})]}):s.jsx("span",{onClick:()=>c(!0),className:`${r??""} cursor-pointer hover:ring-1 hover:ring-border-default rounded px-1 -mx-1 transition-all`,children:e})}function TW({tags:e,onChange:t,readOnly:n}){if(n)return s.jsx("div",{className:"flex flex-wrap items-center gap-1.5 min-h-[24px]",children:e.map(h=>s.jsx("span",{className:"text-[10px] px-2 py-0.5 bg-surface-elevated text-fg-muted rounded-full border border-border-default",children:h},h))});const{t:r}=ft(["builder"]),[o,l]=k.useState(!1),[c,d]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{o&&m.current?.focus()},[o]);const f=h=>{if((h.key==="Enter"||h.key===",")&&c.trim()){h.preventDefault();const g=c.trim().toLowerCase();e.includes(g)||t([...e,g]),d("")}else h.key==="Backspace"&&!c&&e.length>0?t(e.slice(0,-1)):h.key==="Escape"&&(l(!1),d(""))};return o?s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 ring-1 ring-brand-500/50 rounded px-2 py-1 -mx-1 min-h-[32px]",children:[e.map(h=>s.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] bg-surface-elevated text-fg-secondary rounded-full px-2 py-0.5 border border-border-default",children:[h,s.jsx("button",{onClick:()=>t(e.filter(g=>g!==h)),className:"text-fg-muted hover:text-red-500",children:"×"})]},h)),s.jsx("input",{ref:m,value:c,onChange:h=>d(h.target.value),onKeyDown:f,onBlur:()=>{c||l(!1)},className:"flex-1 min-w-[80px] bg-transparent text-xs text-fg-primary placeholder:text-fg-muted focus:outline-none",placeholder:r("detail.typeTagAndEnter")})]}):s.jsx("div",{onClick:()=>l(!0),className:"flex flex-wrap items-center gap-1.5 cursor-text hover:ring-1 hover:ring-border-default rounded px-1 -mx-1 py-0.5 transition-all min-h-[24px]",children:e.length>0?e.map(h=>s.jsx("span",{className:"text-[10px] px-2 py-0.5 bg-surface-elevated text-fg-muted rounded-full border border-border-default",children:h},h)):s.jsx("span",{className:"text-[10px] text-fg-muted italic",children:r("detail.typeTagAndEnter")})})}function ag({content:e}){const t=[q5,Vk,Kk],n=[M3,[n3,{strict:"ignore"}],[v3,{detect:!0,ignoreMissing:!0}]],r=q3({});return s.jsx("div",{className:`prose prose-invert prose-sm max-w-none
664
664
  prose-headings:text-fg-primary prose-headings:font-semibold
665
665
  prose-p:text-fg-secondary prose-p:leading-relaxed
666
666
  prose-a:text-brand-400 prose-a:no-underline hover:prose-a:underline
@@ -669,4 +669,4 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Rn=We,rn=wt),Ht===void
669
669
  prose-strong:text-fg-primary
670
670
  prose-li:text-fg-secondary
671
671
  prose-hr:border-border-default
672
- prose-blockquote:border-brand-500/40 prose-blockquote:text-fg-secondary`,children:s.jsx(Eh,{remarkPlugins:t,rehypePlugins:n,components:r,children:e})})}function sh({filename:e,content:t,onSave:n,embedded:r,readOnly:o}){const{t:l}=ft(["builder","common"]),[c,d]=k.useState(!1),[m,f]=k.useState(t),[h,g]=k.useState(!1),y=/\.(md|mdx|markdown)$/i.test(e),x=k.useRef(null);k.useEffect(()=>{f(t)},[t]),k.useEffect(()=>{if(c&&x.current){const T=x.current;T.style.height="auto",T.style.height=Math.max(200,T.scrollHeight)+"px"}},[c,m]);const w=async()=>{g(!0),await n(m),g(!1),d(!1)},C=o?null:s.jsx("div",{className:"flex items-center gap-2",children:c?s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>{f(t),d(!1)},className:"text-[10px] px-2.5 py-1 rounded-md text-fg-tertiary hover:text-fg-secondary border border-border-default transition-colors",children:l("common:cancel")}),s.jsx("button",{onClick:w,disabled:h,className:"text-[10px] px-2.5 py-1 rounded-md bg-brand-600 hover:bg-brand-500 text-white transition-colors disabled:opacity-50",children:l(h?"common:saving":"common:save")})]}):s.jsxs("button",{onClick:()=>d(!0),className:"text-[10px] px-2.5 py-1 rounded-md text-fg-tertiary hover:text-fg-secondary border border-border-default transition-colors inline-flex items-center gap-1",children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),s.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),l("detail.edit")]})});return r?s.jsxs("div",{children:[s.jsx("div",{className:"flex items-center justify-end px-4 py-2 border-b border-border-default bg-surface-elevated/20",children:C}),c?s.jsx("textarea",{ref:x,value:m,onChange:T=>f(T.target.value),className:"w-full bg-surface-elevated/20 text-sm text-fg-primary font-mono p-4 focus:outline-none resize-y min-h-[200px] leading-relaxed",spellCheck:!1}):s.jsx("div",{className:"p-4",children:y?s.jsx(ag,{content:t}):s.jsx("pre",{className:"text-xs leading-relaxed text-fg-secondary whitespace-pre-wrap font-mono",children:t})})]}):s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-border-default bg-surface-elevated/30",children:[s.jsx("span",{className:"text-xs font-medium text-fg-secondary font-mono",children:e}),C]}),c?s.jsx("textarea",{ref:x,value:m,onChange:T=>f(T.target.value),className:"w-full bg-surface-elevated/20 text-sm text-fg-primary font-mono p-4 focus:outline-none resize-y min-h-[200px] leading-relaxed",spellCheck:!1}):s.jsx("div",{className:"p-4",children:y?s.jsx(ag,{content:t}):s.jsx("pre",{className:"text-xs leading-relaxed text-fg-secondary whitespace-pre-wrap font-mono",children:t})})]})}const I4={"README.md":0,"ROLE.md":1,"HEARTBEAT.md":2,"POLICIES.md":3,"CONTEXT.md":4,"ANNOUNCEMENT.md":0,"NORMS.md":1};function AW(e){return[...e].sort(([t],[n])=>{const r=I4[t]??99,o=I4[n]??99;return r!==o?r-o:t.localeCompare(n)})}function S0({files:e,onSave:t,noHeader:n,readOnly:r}){const o=k.useMemo(()=>AW(e),[e]),[l,c]=k.useState(0);if(o.length===1)return n?s.jsx(sh,{filename:o[0][0],content:o[0][1],onSave:h=>t(o[0][0],h),readOnly:r}):s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-sm font-semibold text-fg-primary mb-4 uppercase tracking-wider",children:"Files"}),s.jsx(sh,{filename:o[0][0],content:o[0][1],onSave:h=>t(o[0][0],h),readOnly:r})]});const[d,m]=o[l]??o[0],f=s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 overflow-hidden",children:[s.jsx("div",{className:"flex items-center gap-0 overflow-x-auto bg-surface-elevated/30",children:o.map(([h],g)=>s.jsx("button",{onClick:()=>c(g),className:`px-4 py-2.5 text-xs font-medium whitespace-nowrap border-b-2 transition-colors ${g===l?"border-brand-500 text-brand-400 bg-surface-secondary/50":"border-transparent text-fg-tertiary hover:text-fg-secondary hover:bg-surface-elevated/50"}`,children:h},h))}),s.jsx(sh,{filename:d,content:m,onSave:h=>t(d,h),embedded:!0,readOnly:r},d)]});return n?f:s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-sm font-semibold text-fg-primary mb-4 uppercase tracking-wider",children:"Files"}),f]})}function EW({images:e,artifactType:t,artifactName:n,onUpload:r,onRemove:o,readOnly:l,cacheBust:c}){const{t:d}=ft(["builder"]),m=k.useRef(null);return e.length===0?l?null:s.jsxs("div",{className:"border-2 border-dashed border-border-default rounded-xl p-6 text-center text-fg-muted text-sm cursor-pointer hover:border-brand-500/30 transition-colors",onClick:()=>m.current?.click(),onDragOver:f=>f.preventDefault(),onDrop:f=>{f.preventDefault();const h=f.dataTransfer.files[0];h?.type.startsWith("image/")&&r(h)},children:[s.jsxs("svg",{className:"w-8 h-8 mx-auto mb-2 text-fg-muted/50",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),s.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),s.jsx("polyline",{points:"21 15 16 10 5 21"})]}),s.jsx("span",{className:"block",children:d("images.dropOrClick")}),s.jsx("span",{className:"block text-xs text-fg-muted/60 mt-1",children:d("images.hint")}),s.jsx("input",{ref:m,type:"file",accept:"image/*",className:"hidden",onChange:f=>{const h=f.target.files?.[0];h&&r(h),f.target.value=""}})]}):s.jsxs("div",{children:[s.jsxs("div",{className:"flex gap-3 overflow-x-auto pb-2",children:[e.map(f=>{const h=f.split("/").pop()??f;return s.jsxs("div",{className:"relative group shrink-0 rounded-lg border border-border-default overflow-hidden bg-surface-elevated",children:[s.jsx("img",{src:`/api/builder/artifacts/${t}s/${encodeURIComponent(n)}/images/${encodeURIComponent(h)}${c!=null?`?v=${c}`:""}`,alt:h,className:"h-32 w-auto object-cover"}),!l&&s.jsx("button",{onClick:()=>o(h),className:"absolute top-1.5 right-1.5 w-5 h-5 rounded-full bg-red-600/80 text-white flex items-center justify-center text-[10px] opacity-0 group-hover:opacity-100 transition-opacity",children:"×"})]},f)}),!l&&s.jsx("button",{onClick:()=>m.current?.click(),className:"shrink-0 h-32 w-24 rounded-lg border-2 border-dashed border-border-default flex items-center justify-center text-fg-muted hover:border-brand-500/30 hover:text-brand-400 transition-colors",children:s.jsxs("svg",{className:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),s.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})})]}),!l&&s.jsx("input",{ref:m,type:"file",accept:"image/*",className:"hidden",onChange:f=>{const h=f.target.files?.[0];h&&r(h),f.target.value=""}})]})}function _W({members:e,teamTopFiles:t,files:n,artifactName:r,onFileSave:o,readOnly:l}){const{t:c}=ft(["builder"]),[d,m]=k.useState(0),f=k.useMemo(()=>{const T=new Set;for(const S of Object.keys(n)){const E=S.match(/^members\/([^/]+)\//);E&&T.add(E[1])}return[...T]},[n]),h=k.useMemo(()=>{const T=new Map,S=new Set;for(let L=0;L<e.length;L++){const O=e[L].slug;O&&f.includes(O)&&!S.has(O)&&(T.set(L,O),S.add(O))}for(let L=0;L<e.length;L++){if(T.has(L))continue;const I=r0(e[L].name);I&&f.includes(I)&&!S.has(I)&&(T.set(L,I),S.add(I))}for(let L=0;L<e.length;L++){if(T.has(L))continue;const I=e[L].roleName;if(I){const O=r0(I);f.includes(O)&&!S.has(O)&&(T.set(L,O),S.add(O))}}for(let L=0;L<e.length;L++){if(T.has(L))continue;const I=e[L].name;for(const O of f){if(S.has(O))continue;const F=n[`members/${O}/ROLE.md`];if(!F)continue;const V=F.match(/^#\s+(.+)$/m)?.[1]?.trim();if(V&&(V.toLowerCase().includes(I.toLowerCase())||I.toLowerCase().includes(V.toLowerCase()))){T.set(L,O),S.add(O);break}}}const E=f.filter(L=>!S.has(L));let j=0;for(let L=0;L<e.length;L++)T.has(L)||j<E.length&&(T.set(L,E[j]),j++);return T},[e,f,n]),g=k.useCallback((T,S)=>{const E=h.get(S);return E?Object.entries(n).filter(([j])=>j.startsWith(`members/${E}/`)):[]},[n,h]),y=k.useMemo(()=>{const T=[{label:c("detail.overview")}];for(const S of e)T.push({label:S.name,role:S.role});return T},[e,c]),x=d>0?e[d-1]:null,w=d-1;return s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 overflow-hidden",children:[s.jsx("div",{className:"flex items-center gap-0 overflow-x-auto bg-surface-elevated/30 border-b border-border-default",children:y.map((T,S)=>{const E=S===d,j=T.role==="manager",L=S===0?E?"border-brand-500 text-brand-400":"border-transparent text-fg-tertiary hover:text-fg-secondary":j?E?"border-amber-500 text-amber-400":"border-transparent text-fg-tertiary hover:text-fg-secondary":E?"border-blue-500 text-blue-400":"border-transparent text-fg-tertiary hover:text-fg-secondary";return s.jsxs("button",{onClick:()=>m(S),className:`px-4 py-2.5 text-xs font-medium whitespace-nowrap border-b-2 transition-colors flex items-center gap-1.5 ${L} ${E?"bg-surface-secondary/50":"hover:bg-surface-elevated/50"}`,children:[S===0&&s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),s.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),S>0&&((()=>{const I=S-1,O=h.get(I),F=O?`/api/builder/artifacts/teams/${encodeURIComponent(r)}/members/${encodeURIComponent(O)}/images/avatar.jpg`:null;return F?s.jsx("img",{src:F,alt:T.label,className:`w-5 h-5 rounded-full object-cover shrink-0 ring-1 ${j?"ring-amber-500/40":"ring-blue-500/40"}`,onError:V=>{V.target.style.display="none",V.target.nextElementSibling?.classList.remove("hidden")}}):null})(),s.jsx("span",{className:`w-5 h-5 rounded-full text-[9px] font-bold flex items-center justify-center shrink-0 ${j?"bg-amber-500/20 text-amber-400":"bg-blue-500/20 text-blue-400"} ${(()=>{const I=S-1;return h.get(I)?"hidden":""})()}`,children:(T.label[0]??"?").toUpperCase()})),T.label]},S)})}),s.jsx("div",{className:"p-5",children:d===0?s.jsxs("div",{className:"space-y-6",children:[t.length>0&&s.jsx(S0,{noHeader:!0,files:t,onSave:C,readOnly:l}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider mb-3",children:c("sidebar.composition")}),s.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:e.map((T,S)=>{const E=T.role==="manager";return s.jsxs("button",{onClick:()=>m(S+1),className:"text-left rounded-lg border border-border-default bg-surface-elevated/30 px-4 py-3 flex gap-3 items-center hover:border-gray-600 transition-colors cursor-pointer",children:[(()=>{const j=h.get(S),L=j?`/api/builder/artifacts/teams/${encodeURIComponent(r)}/members/${encodeURIComponent(j)}/images/avatar.jpg`:null;return L?s.jsx("img",{src:L,alt:T.name,className:`w-8 h-8 rounded-full object-cover shrink-0 ring-1 ${E?"ring-amber-500/30":"ring-blue-500/30"}`,onError:I=>{I.target.style.display="none",I.target.nextElementSibling?.classList.remove("hidden")}}):null})(),s.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold shrink-0 ${E?"bg-amber-500/15 text-amber-400 ring-1 ring-amber-500/30":"bg-blue-500/15 text-blue-400 ring-1 ring-blue-500/30"} ${h.get(S)?"hidden":""}`,children:(T.name[0]??"?").toUpperCase()}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-xs font-medium text-fg-primary truncate",children:T.name}),s.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded-full font-medium ${E?"bg-amber-500/15 text-amber-400":"bg-blue-500/15 text-blue-400"}`,children:T.role}),T.count>1&&s.jsxs("span",{className:"text-[9px] text-fg-muted",children:["×",T.count]})]}),T.skills&&T.skills.length>0&&s.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[T.skills.slice(0,3).map(j=>s.jsx("span",{className:"text-[9px] px-1.5 py-0.5 bg-surface-elevated text-fg-muted rounded border border-border-default",children:j},j)),T.skills.length>3&&s.jsxs("span",{className:"text-[9px] text-fg-muted",children:["+",T.skills.length-3]})]})]}),s.jsx("svg",{className:"w-3.5 h-3.5 text-fg-muted shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"9 18 15 12 9 6"})})]},S)})})]})]}):x?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[(()=>{const T=h.get(w),S=T?`/api/builder/artifacts/teams/${encodeURIComponent(r)}/members/${encodeURIComponent(T)}/images/avatar.jpg`:null;return S?s.jsx("img",{src:S,alt:x.name,className:`w-12 h-12 rounded-full object-cover shrink-0 ring-2 ${x.role==="manager"?"ring-amber-500/30":"ring-blue-500/30"}`,onError:E=>{E.target.style.display="none",E.target.nextElementSibling?.classList.remove("hidden")}}):null})(),s.jsx("div",{className:`w-12 h-12 rounded-full flex items-center justify-center text-lg font-bold shrink-0 ${x.role==="manager"?"bg-amber-500/15 text-amber-400 ring-2 ring-amber-500/30":"bg-blue-500/15 text-blue-400 ring-2 ring-blue-500/30"} ${h.get(w)?"hidden":""}`,children:(x.name[0]??"?").toUpperCase()}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-sm font-semibold text-fg-primary",children:x.name}),s.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full font-medium ${x.role==="manager"?"bg-amber-500/15 text-amber-400":"bg-blue-500/15 text-blue-400"}`,children:x.role}),x.count>1&&s.jsxs("span",{className:"text-[10px] text-fg-muted",children:["×",x.count]})]}),x.roleName&&s.jsx("div",{className:"text-xs text-fg-tertiary mt-0.5 italic",children:x.roleName})]})]}),x.skills&&x.skills.length>0&&s.jsx("div",{className:"flex flex-wrap gap-1.5",children:x.skills.map(T=>s.jsx("span",{className:"text-[10px] px-2.5 py-1 bg-surface-elevated text-fg-muted rounded-full border border-border-default",children:T},T))}),(()=>{const T=g(x.name,w);return T.length===0?s.jsx("p",{className:"text-xs text-fg-muted italic",children:"No files for this member yet."}):s.jsx(S0,{noHeader:!0,readOnly:l,files:T.map(([S,E])=>[S.replace(/^members\/[^/]+\//,""),E]),onSave:(S,E)=>{const j=T.find(([L])=>L.endsWith(`/${S}`));j&&o(j[0],E)}})})()]}):null})]});function C(T,S){o(T,S)}}function Mi({type:e,name:t,onBack:n,authUser:r,readOnly:o,initialManifest:l,actionSlot:c,contentSlot:d}){const{t:m}=ft(["builder","common"]),f=Uo(),[h,g]=k.useState(!0),[y,x]=k.useState(t),[w,C]=k.useState({}),[T,S]=k.useState(null),[E,j]=k.useState(""),[L,I]=k.useState("idle"),[O,F]=k.useState({shared:!1}),[V,X]=k.useState(!1),[z,G]=k.useState(!1),[se,ee]=k.useState(!1),[q,re]=k.useState(!1),[B,J]=k.useState(!1),[fe,Se]=k.useState(!1),[U,W]=k.useState(null),[pe,P]=k.useState(0),[_e,He]=k.useState(""),[Pe,Ge]=k.useState(""),[ct,mt]=k.useState(""),[Ct,Mt]=k.useState(""),[Pt,Kt]=k.useState([]),[yt,Ue]=k.useState(""),dt=k.useRef(null),Nt=k.useRef(l);Nt.current=l,k.useEffect(()=>{x(t)},[t]);const bt=k.useCallback(async()=>{const Q=Nt.current;if(Q){S(Q),He(Q.displayName||Q.name||t),Ge(Q.description||""),mt(Q.version||"1.0.0"),Mt(Q.category||"general"),Kt(Q.tags||[]),Ue(Q.icon||""),C(Q.files??{}),g(!1);return}g(!0);try{let Z=t;try{const Ie=await Ee.builder.artifacts.ensureSlugSafe(e,t);Z=Ie.name,x(Z),Ie.converted&&(history.replaceState(null,"",Ti(de.BUILDER,`${e}/${encodeURIComponent(Z)}`)),window.dispatchEvent(new CustomEvent("markus:data-changed")))}catch{x(t)}const be=await Ee.builder.artifacts.get(e,Z);C(be.files??{}),j(be.path??"");const Ke=be.files[`${e}.json`]??be.files["agent.json"]??be.files["team.json"]??be.files["skill.json"];if(Ke){const Ie=JSON.parse(Ke);S(Ie),He(Ie.displayName||Ie.name||t),Ge(Ie.description||""),mt(Ie.version||"1.0.0"),Mt(Ie.category||"general"),Kt(Ie.tags||[]),Ue(Ie.icon||"")}}catch(Z){console.error("Failed to load artifact:",Z)}finally{g(!1)}},[e,t]);k.useEffect(()=>{bt()},[bt]),k.useEffect(()=>{l?.files&&C(l.files)},[l?.files]),k.useEffect(()=>{if(!o){try{const Q=localStorage.getItem("markus_builder_shared_map");if(Q){const Z=JSON.parse(Q),be=`${e}/${t}`;Z[be]&&F({shared:!0,id:Z[be].id,slug:Z[be].slug,version:Z[be].version,visibility:Z[be].visibility??"public"})}}catch{}lt.myItems().then(Q=>{const Z=Q?.items??[],be=e==="agent"?"agent":e==="team"?"team":"skill";for(const Ke of Z)if(Ke.itemType===be&&(Ke.slug===t||Ke.name===t)){F({shared:!0,id:Ke.id,slug:Ke.slug,version:Ke.version,visibility:Ke.visibility??"public",moderationStatus:Ke.moderationStatus,pendingReview:Ke.pendingReview});return}}).catch(()=>{})}},[e,t,o]);const Lt=k.useCallback(async Q=>{if(!(!T||o)){I("saving");try{const Z={...T,...Q};await Ee.builder.artifacts.save(e,Z),S(Z),I("saved"),setTimeout(()=>I(be=>be==="saved"?"idle":be),2e3)}catch{I("error"),setTimeout(()=>I("idle"),3e3)}}},[T,e]),ue=k.useCallback(Q=>{dt.current&&clearTimeout(dt.current),dt.current=setTimeout(()=>Lt(Q),800)},[Lt]),tt=k.useCallback((Q,Z)=>{const be={};Q==="displayName"?(He(Z),be.displayName=Z,G(!0)):Q==="description"?(Ge(Z),be.description=Z,G(!0)):Q==="version"?(mt(Z),be.version=Z,G(!1),ee(!1)):Q==="category"?(Mt(Z),be.category=Z,G(!0)):Q==="tags"?(Kt(Z),be.tags=Z,G(!0)):Q==="icon"&&(Ue(Z),be.icon=Z||void 0,G(!0)),ue({...T,...be})},[T,ue]),st=k.useCallback(async(Q,Z)=>{try{const be={...w,[Q]:Z};C(be);const Ke={...T,files:be};await Ee.builder.artifacts.save(e,Ke),I("saved"),G(!0),setTimeout(()=>I(Ie=>Ie==="saved"?"idle":Ie),2e3)}catch{I("error")}},[w,e,T]),ye=k.useCallback(async Q=>{if(T){X(!0);try{await lt.ensureAuth();const Z=await Ee.builder.artifacts.ensureSlugSafe(e,y,T.displayName||T.name||y),be=Z.name,Ke=Z.slug||xc(be);if(!Ke)throw new Error("Invalid package slug: use English kebab-case for the artifact name (e.g. qwen-multimodal). Chinese-only names cannot be shared — rename the package slug and put the Chinese title in displayName.");const Ie=Z.displayName||T.displayName||T.name||y;Z.converted&&(x(be),S(ze=>ze&&{...ze,name:Ke,displayName:Ie}),history.replaceState(null,"",Ti(de.BUILDER,`${e}/${encodeURIComponent(be)}`)),window.dispatchEvent(new CustomEvent("markus:data-changed")));const Ye={...T,name:Ke,displayName:Ie},M=Ye.description||"",le=Ye.category||"general",Oe=Ye.tags??[];let ge=Ye.icon||void 0;const Ve=Ye.version||"1.0.0";if(ge&&!ge.startsWith("http")&&/\.(png|jpe?g|gif|webp|svg)$/i.test(ge)){const ze=ge.split("/").pop()??ge;try{const rt=await fetch(`/api/builder/artifacts/${e}s/${encodeURIComponent(be)}/images/${encodeURIComponent(ze)}`,{cache:"no-store"});if(rt.ok){const vt=await rt.blob(),Fe=new File([vt],ze,{type:vt.type}),at=await lt.uploadImage(Fe);at?.url&&(ge=at.url)}}catch{}}let Qe;const K=[],ce=Ye.screenshots??[];for(let ze=0;ze<ce.length;ze++){const rt=ce[ze],vt=rt.split("/").pop()??rt;try{const Fe=await fetch(`/api/builder/artifacts/${e}s/${encodeURIComponent(be)}/images/${encodeURIComponent(vt)}`,{cache:"no-store"});if(Fe.ok){const at=await Fe.blob(),kt=new File([at],vt,{type:at.type}),xn=await lt.uploadImage(kt);xn?.url&&(K.push({url:xn.url,alt:vt,order:ze}),ze===0&&(Qe=xn.url))}}catch{}}const Te=await lt.publishViaProxy({itemType:e==="team"?"team":e==="skill"?"skill":"agent",name:Ie,slug:Ke,description:M,category:le,tags:Oe,icon:ge,version:Ve,config:Ye,files:Object.keys(w).length>0?w:void 0,thumbnailUrl:Qe,images:K.length>0?K:void 0,priceCents:Q?.priceCents,donationsEnabled:Q?.donationsEnabled,visibility:Q?.visibility,orgId:Q?.orgId});Te.id&&(F({shared:!0,id:Te.id,slug:Te.slug??Ke,version:Ve,visibility:Te.visibility??Q?.visibility??"public",moderationStatus:Te.moderationStatus,pendingReview:Te.pendingReview}),G(!1),(Te.visibility??Q?.visibility??"public")!=="org"&&(Te.moderationStatus==="pending"||Te.pendingReview)?W({title:m("common:share"),message:Z.converted?m("share.convertedAndSubmitted",{previous:t,slug:Ke}):Te.updated?m("share.updateSubmitted"):m("share.submittedForReview"),variant:"primary"}):Z.converted&&W({title:m("common:share"),message:m("share.convertedSlug",{previous:t,slug:Ke}),variant:"primary"}))}catch(Z){console.error("Share to Hub failed:",Z),W({title:m("common:share"),message:Z instanceof Error?Z.message:String(Z),variant:"danger"})}finally{X(!1)}}},[T,w,e,t,y,m]),je=async Q=>{const Z=new FormData;Z.append("image",Q);try{await fetch(`/api/builder/artifacts/${e}s/${encodeURIComponent(y)}/images`,{method:"POST",body:Z,credentials:"include"}),await bt(),G(!0),P(be=>be+1)}catch(be){console.error("Image upload failed:",be)}},Ae=async Q=>{try{await fetch(`/api/builder/artifacts/${e}s/${encodeURIComponent(y)}/images/${encodeURIComponent(Q)}`,{method:"DELETE",credentials:"include"}),await bt(),G(!0),P(Z=>Z+1)}catch(Z){console.error("Image remove failed:",Z)}},oe=D4[e]??D4.agent,H=T?.screenshots??[],te=T?.skill?.skillFile?w[T.skill.skillFile]:w["SKILL.md"]??w["README.md"],Ne=k.useMemo(()=>e!=="agent"?[]:Object.entries(w).filter(([Q])=>!Q.endsWith(".json")&&!Q.startsWith("images/")&&!Q.startsWith("members/")),[w,e]),Re=k.useMemo(()=>e!=="team"?[]:Object.entries(w).filter(([Q])=>!Q.endsWith(".json")&&!Q.startsWith("images/")&&!Q.startsWith("members/")),[w,e]),$e=k.useMemo(()=>{if(e==="agent"||e==="team")return[];const Q=new Set;if(e==="skill"){const Z=T?.skill?.skillFile;Z&&w[Z]&&Q.add(Z),!Z&&w["SKILL.md"]&&Q.add("SKILL.md"),!Z&&!w["SKILL.md"]&&w["README.md"]&&Q.add("README.md")}return Object.entries(w).filter(([Z])=>!Z.endsWith(".json")&&!Z.startsWith("images/")&&!Z.startsWith("members/")&&!Q.has(Z))},[w,e,T?.skill?.skillFile]);return h?s.jsx("div",{className:"flex-1 overflow-y-auto",children:s.jsxs("div",{className:"px-6 py-8",children:[s.jsxs("button",{onClick:n,className:"text-xs text-brand-400 hover:text-brand-300 mb-4 inline-flex items-center gap-1",children:[s.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"15 18 9 12 15 6"})}),m("detail.backToBuilder")]}),s.jsx("div",{className:"text-fg-tertiary text-sm animate-pulse py-20 text-center",children:m("common:loading")})]})}):T?s.jsxs("div",{className:"flex-1 overflow-y-auto",children:[s.jsxs("div",{className:`${f?"px-4 py-5":"px-6 py-8"}`,children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("button",{onClick:n,className:"text-xs text-brand-400 hover:text-brand-300 inline-flex items-center gap-1",children:[s.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"15 18 9 12 15 6"})}),m(o?"common:back":"detail.backToBuilder")]}),s.jsxs("div",{className:"flex items-center gap-2",children:[!o&&L==="saving"&&s.jsx("span",{className:"text-[10px] text-fg-muted animate-pulse",children:m("detail.saving")}),!o&&L==="saved"&&s.jsxs("span",{className:"text-[10px] text-green-500 inline-flex items-center gap-1",children:[s.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}),m("detail.saved")]}),!o&&L==="error"&&s.jsx("span",{className:"text-[10px] text-red-500",children:m("detail.saveFailed")}),c,!o&&O.shared&&(()=>{const Q=lt.getUser(),Z=Q&&O.slug?`${lt.getUrl()}/@${encodeURIComponent(Q.username)}/${encodeURIComponent(O.slug)}`:null,be=ct||T?.version||"1.0.0",Ke=O.version!==be;return s.jsxs(s.Fragment,{children:[O.moderationStatus==="pending"?s.jsxs("span",{className:"text-xs px-2 py-1.5 rounded-lg border border-amber-500/30 text-amber-400 inline-flex items-center gap-1",title:m("share.underReviewTip"),children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"12 6 12 12 16 14"})]}),m("share.underReview")]}):O.moderationStatus==="rejected"?s.jsxs("span",{className:"text-xs px-2 py-1.5 rounded-lg border border-red-500/30 text-red-400 inline-flex items-center gap-1",title:m("share.rejectedTip"),children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),s.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),m("share.rejected")]}):O.pendingReview?s.jsxs("span",{className:"text-xs px-2 py-1.5 rounded-lg border border-amber-500/30 text-amber-400 inline-flex items-center gap-1",title:m("share.updateUnderReviewTip"),children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"12 6 12 12 16 14"})]}),m("share.updateUnderReview")]}):null,Z&&s.jsxs("a",{href:Z,target:"_blank",rel:"noopener noreferrer",onClick:Ie=>{yc()&&(Ie.preventDefault(),_i(Z))},className:`text-xs px-3 py-1.5 rounded-lg border transition-colors inline-flex items-center gap-1.5 ${O.visibility==="org"?"border-blue-500/30 text-blue-500 hover:text-blue-400 hover:border-blue-400/50":O.visibility==="unlisted"?"border-gray-500/30 text-fg-tertiary hover:text-fg-secondary hover:border-gray-400/50":"border-green-600/30 text-green-600 hover:text-green-500 hover:border-green-500/50"}`,children:[O.visibility==="org"?s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M3 21h18"}),s.jsx("path",{d:"M9 8h1"}),s.jsx("path",{d:"M9 12h1"}),s.jsx("path",{d:"M9 16h1"}),s.jsx("path",{d:"M14 8h1"}),s.jsx("path",{d:"M14 12h1"}),s.jsx("path",{d:"M14 16h1"}),s.jsx("path",{d:"M5 21V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16"})]}):O.visibility==="unlisted"?s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),s.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}):s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),s.jsx("polyline",{points:"15 3 21 3 21 9"}),s.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),O.visibility==="org"?m("visibility.sharedOrg"):O.visibility==="unlisted"?m("visibility.sharedUnlisted"):m("share.viewOnHub")]}),Ke&&s.jsx("button",{onClick:()=>{ye({visibility:O.visibility})},disabled:V,className:"text-xs px-3 py-1.5 rounded-lg border border-amber-500/30 text-amber-400 hover:bg-amber-500/10 hover:border-amber-500/50 transition-colors disabled:opacity-50",children:V?m("share.updating"):m("share.updateVersion",{version:be})})]})})(),!o&&!O.shared&&s.jsx("button",{onClick:()=>J(!0),disabled:V,className:"text-xs px-3 py-1.5 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors disabled:opacity-50",children:m(V?"share.sharing":"share.toHub")})]})]}),!o&&z&&!se&&s.jsxs("div",{className:"mb-4 px-4 py-2.5 rounded-lg bg-amber-50 dark:bg-amber-500/10 border border-amber-300 dark:border-amber-500/20 flex items-center justify-between",children:[s.jsx("span",{className:"text-xs text-amber-800 dark:text-amber-300",children:m("versionBump.contentModified")}),s.jsx("button",{onClick:()=>ee(!0),className:"text-xs px-3 py-1 rounded bg-amber-200 dark:bg-amber-500/20 text-amber-800 dark:text-amber-300 hover:bg-amber-300 dark:hover:bg-amber-500/30 transition-colors",children:m("versionBump.bumpVersion")})]}),!o&&se&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-amber-50 dark:bg-amber-500/10 border border-amber-300 dark:border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs text-amber-800 dark:text-amber-300",children:m("versionBump.newVersion")}),s.jsx("input",{type:"text",defaultValue:(()=>{const Q=(ct||"1.0.0").split(".");return Q[2]=String(Number(Q[2]??0)+1),Q.join(".")})(),className:"text-xs px-2 py-1 rounded bg-surface-elevated border border-border-default text-fg-primary w-24 font-mono",onKeyDown:Q=>{Q.key==="Enter"&&tt("version",Q.target.value)}}),s.jsx("button",{onClick:Q=>{const Z=Q.target.parentElement?.querySelector("input");Z&&tt("version",Z.value)},className:"text-xs px-3 py-1 rounded bg-amber-200 dark:bg-amber-500/20 text-amber-800 dark:text-amber-300 hover:bg-amber-300 dark:hover:bg-amber-500/30 transition-colors",children:m("common:confirm")}),s.jsx("button",{onClick:()=>ee(!1),className:"text-xs text-fg-tertiary hover:text-fg-secondary",children:m("common:cancel")})]}),O.shared&&s.jsx("p",{className:"text-[10px] text-fg-tertiary mt-2",children:"After bumping the version, you can share the new version to Hub."})]}),s.jsxs("div",{className:`flex gap-8 ${f?"flex-col":""}`,children:[s.jsxs("div",{className:`${f?"w-full":"flex-1 min-w-0"}`,children:[s.jsxs("div",{className:"flex items-start gap-4 mb-6",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{onClick:()=>!o&&Se(!fe),className:`w-16 h-16 rounded-xl ${oe.bg} flex items-center justify-center text-3xl shrink-0 ${o?"":"cursor-pointer hover:ring-2"} ${oe.ring} transition-all overflow-hidden`,children:yt&&yt.startsWith("images/")?s.jsx("img",{src:`/api/builder/artifacts/${e}s/${encodeURIComponent(y)}/images/${encodeURIComponent(yt.replace("images/",""))}?v=${pe}`,alt:"",className:"w-full h-full object-cover"}):yt&&(yt.startsWith("http")||yt.startsWith("/"))?s.jsx("img",{src:yt,alt:"",className:"w-full h-full object-cover"}):(()=>{const Q=yt||"";if(Q&&[...Q].length<=2&&new RegExp("\\p{Emoji}","u").test(Q))return Q;const be=Ei[Xo(e)].accent;return s.jsx("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:s.jsx("path",{d:s6(_e||t||e),fill:be})})})()}),!o&&fe&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Se(!1)}),s.jsxs("div",{className:"absolute top-full left-0 mt-2 z-50 bg-surface-secondary border border-border-default rounded-xl p-3 shadow-xl w-80",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx("input",{type:"text",placeholder:m("detail.pasteEmojiOrUrl"),className:"flex-1 text-sm px-2 py-1.5 rounded-lg bg-surface-elevated border border-border-default text-fg-primary placeholder:text-fg-muted",defaultValue:yt,onKeyDown:Q=>{Q.key==="Enter"&&(tt("icon",Q.target.value),Se(!1))}}),s.jsxs("label",{className:"text-[10px] text-brand-400 hover:text-brand-300 cursor-pointer px-1.5 py-1 border border-brand-500/30 rounded-lg",children:[m("detail.upload"),s.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:async Q=>{const Z=Q.target.files?.[0];if(!Z)return;const be=new FormData;be.append("image",Z);try{const Ke=await fetch(`/api/builder/artifacts/${e}s/${encodeURIComponent(y)}/images`,{method:"POST",body:be,credentials:"include"});if(Ke.ok){const Ye=(await Ke.json()).path;if(Ue(Ye),Se(!1),T){const M={...T,icon:Ye};S(M),await Ee.builder.artifacts.save(e,M)}G(!0)}}catch{}}})]}),yt&&s.jsx("button",{onClick:()=>{tt("icon",""),Se(!1)},className:"text-[10px] text-fg-tertiary hover:text-red-400 px-1",children:"✕"})]}),s.jsx("div",{className:"max-h-64 overflow-y-auto",children:SW.map(Q=>s.jsxs("div",{className:"mb-2.5",children:[s.jsx("div",{className:"text-[10px] text-fg-tertiary mb-1 sticky top-0 bg-surface-secondary py-0.5",children:Q.label}),s.jsx("div",{className:"flex flex-wrap gap-0.5",children:Q.emojis.map(Z=>s.jsx("button",{onClick:()=>{tt("icon",Z),Se(!1)},className:`w-7 h-7 rounded flex items-center justify-center text-base hover:bg-surface-elevated transition-colors ${yt===Z?"ring-1.5 ring-brand-500 bg-brand-500/10":""}`,children:Z},Z))})]},Q.label))})]})]})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx(ah,{value:_e,onChange:Q=>tt("displayName",Q),renderAs:"h1",className:"text-xl font-bold text-fg-primary",placeholder:m("detail.untitled"),readOnly:o}),s.jsx("span",{className:`text-[10px] font-medium uppercase tracking-wider px-2 py-0.5 rounded-full ${oe.bg} ${oe.color}`,children:oe.label}),s.jsx(ah,{value:ct,onChange:Q=>tt("version",Q),renderAs:"badge",className:"text-[10px] px-2 py-0.5 rounded-full bg-surface-elevated text-fg-tertiary border border-border-default font-mono",placeholder:"1.0.0",readOnly:o})]}),s.jsx(ah,{value:Pe,onChange:Q=>tt("description",Q),renderAs:"p",className:"text-sm text-fg-secondary mt-1.5 leading-relaxed",placeholder:m("detail.addDescription"),multiline:!0,readOnly:o}),s.jsxs("div",{className:"flex items-center gap-2 mt-2 flex-wrap",children:[s.jsx(CW,{value:Ct,options:kW,onChange:Q=>tt("category",Q),className:"text-xs px-2 py-0.5 rounded bg-surface-elevated text-fg-tertiary",readOnly:o}),s.jsx(TW,{tags:Pt,onChange:Q=>tt("tags",Q),readOnly:o})]})]})]}),s.jsx("div",{className:"mb-8",children:s.jsx(EW,{images:H,artifactType:e,artifactName:t,onUpload:je,onRemove:Ae,readOnly:o,cacheBust:pe})}),d&&s.jsx("div",{className:"mb-8",children:d}),e==="team"&&T.team&&s.jsx("div",{className:"mb-8",children:s.jsx(_W,{members:T.team.members,teamTopFiles:Re,files:w,artifactName:y,onFileSave:st,readOnly:o})}),e==="agent"&&Ne.length>0&&s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-sm font-semibold text-fg-primary mb-4 uppercase tracking-wider",children:"About This Agent"}),s.jsx(S0,{noHeader:!0,files:Ne,onSave:st,readOnly:o})]}),e==="skill"&&s.jsxs("div",{className:"mb-8",children:[T.skill?.requiredPermissions&&T.skill.requiredPermissions.length>0&&s.jsxs("div",{className:"mb-6",children:[s.jsx("h2",{className:"text-sm font-semibold text-fg-primary mb-3 uppercase tracking-wider",children:m("sidebar.permissions")}),s.jsx("div",{className:"flex flex-wrap gap-2",children:T.skill.requiredPermissions.map(Q=>{const Z=NW[Q];return s.jsxs("span",{className:`inline-flex items-center gap-1.5 text-xs px-3 py-1.5 rounded-lg border font-medium ${Z?.color??"bg-surface-elevated text-fg-secondary border-border-default"}`,children:[s.jsx("span",{className:"font-mono text-[10px]",children:Z?.icon??"?"})," ",Q]},Q)})})]}),T.skill?.mcpServers&&Object.keys(T.skill.mcpServers).length>0&&s.jsxs("div",{className:"mb-6",children:[s.jsx("h2",{className:"text-sm font-semibold text-fg-primary mb-3 uppercase tracking-wider",children:"Integrations"}),s.jsx("div",{className:"grid gap-2",children:Object.entries(T.skill.mcpServers).map(([Q,Z])=>s.jsxs("div",{className:"rounded-lg border border-border-default bg-surface-secondary/40 px-4 py-3 flex items-center gap-3",children:[s.jsx("span",{className:"w-8 h-8 rounded-lg bg-purple-500/15 flex items-center justify-center text-purple-400 text-sm shrink-0",children:"◎"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-xs font-medium text-fg-primary",children:Q}),s.jsx("div",{className:"text-[10px] text-fg-muted font-mono truncate",children:typeof Z=="object"?JSON.stringify(Z).slice(0,80):String(Z)})]})]},Q))})]}),te&&s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-semibold text-fg-primary mb-3 uppercase tracking-wider",children:"Instructions"}),s.jsx("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 p-5",children:s.jsx(ag,{content:te})})]})]}),$e.length>0&&s.jsx(S0,{files:$e,onSave:st,readOnly:o})]}),s.jsx("div",{className:`${f?"w-full":"w-72 shrink-0"}`,children:s.jsxs("div",{className:`${f?"":"sticky top-6"} space-y-4`,children:[s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/60 p-4 space-y-3",children:[s.jsx("div",{className:"text-xs font-medium text-fg-tertiary uppercase tracking-wider",children:m("sidebar.info")}),s.jsxs("div",{className:"space-y-2 text-xs",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.type")}),s.jsx("span",{className:`font-medium ${oe.color}`,children:oe.label})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.category")}),s.jsx("span",{className:"text-fg-secondary",children:Ct})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.version")}),s.jsx("span",{className:"text-fg-secondary font-mono",children:ct})]}),T.author&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.author")}),s.jsx("span",{className:"text-fg-secondary",children:typeof T.author=="string"?T.author:T.author?.name??""})]})]})]}),e==="agent"&&T.agent&&s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/60 p-4 space-y-3",children:[s.jsx("div",{className:"text-xs font-medium text-fg-tertiary uppercase tracking-wider",children:m("sidebar.agentSpecs")}),s.jsxs("div",{className:"space-y-2 text-xs",children:[T.agent.roleName&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.role")}),s.jsx("span",{className:"text-fg-secondary",children:T.agent.roleName})]}),T.agent.llmProvider&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.provider")}),s.jsx("span",{className:"text-fg-secondary",children:T.agent.llmProvider})]}),T.agent.llmModel&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.model")}),s.jsx("span",{className:"text-fg-secondary font-mono",children:T.agent.llmModel})]}),T.agent.temperature!==void 0&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.temperature")}),s.jsx("span",{className:"text-fg-secondary",children:T.agent.temperature})]})]})]}),e==="team"&&T.team&&s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/60 p-4 space-y-3",children:[s.jsx("div",{className:"text-xs font-medium text-fg-tertiary uppercase tracking-wider",children:m("sidebar.composition")}),s.jsxs("div",{className:"space-y-2 text-xs",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.totalMembers")}),s.jsx("span",{className:"text-fg-secondary",children:T.team.members.reduce((Q,Z)=>Q+Z.count,0)})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.managers")}),s.jsx("span",{className:"text-amber-400",children:T.team.members.filter(Q=>Q.role==="manager").reduce((Q,Z)=>Q+Z.count,0)})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.workers")}),s.jsx("span",{className:"text-blue-400",children:T.team.members.filter(Q=>Q.role!=="manager").reduce((Q,Z)=>Q+Z.count,0)})]})]})]}),e==="skill"&&T.skill&&s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/60 p-4 space-y-3",children:[s.jsx("div",{className:"text-xs font-medium text-fg-tertiary uppercase tracking-wider",children:m("sidebar.skillInfo")}),s.jsxs("div",{className:"space-y-2 text-xs",children:[T.skill.alwaysOn!==void 0&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.alwaysOn")}),s.jsx("span",{className:T.skill.alwaysOn?"text-green-400":"text-fg-secondary",children:T.skill.alwaysOn?m("sidebar.yes"):m("sidebar.no")})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.skillFile")}),s.jsx("span",{className:"text-fg-secondary font-mono truncate ml-2",children:T.skill.skillFile})]}),T.skill.requiredPermissions&&T.skill.requiredPermissions.length>0&&s.jsxs("div",{children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.permissions")}),s.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:T.skill.requiredPermissions.map(Q=>s.jsx("span",{className:"text-[10px] px-1.5 py-0.5 bg-surface-elevated text-fg-muted rounded border border-border-default",children:Q},Q))})]})]})]}),T.dependencies&&(T.dependencies.skills?.length||T.dependencies.env?.length)?s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/60 p-4 space-y-3",children:[s.jsx("div",{className:"text-xs font-medium text-fg-tertiary uppercase tracking-wider",children:m("sidebar.dependencies")}),T.dependencies.skills?.length?s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] text-fg-muted mb-1",children:m("sidebar.skills")}),s.jsx("div",{className:"flex flex-wrap gap-1",children:T.dependencies.skills.map(Q=>s.jsx("span",{className:"text-[10px] px-2 py-0.5 bg-surface-elevated text-fg-secondary rounded border border-border-default",children:Q},Q))})]}):null,T.dependencies.env?.length?s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] text-fg-muted mb-1",children:m("sidebar.environment")}),s.jsx("div",{className:"flex flex-wrap gap-1",children:T.dependencies.env.map(Q=>s.jsx("span",{className:"text-[10px] px-2 py-0.5 bg-surface-elevated text-fg-secondary rounded font-mono border border-border-default",children:Q},Q))})]}):null]}):null,!o&&E&&s.jsxs("button",{onClick:()=>Ee.system.openPath(E).catch(()=>{}),className:"w-full text-left rounded-xl border border-border-default bg-surface-secondary/60 px-4 py-3 text-[10px] text-fg-muted hover:text-fg-secondary hover:border-gray-600 transition-colors truncate",title:E,children:[s.jsx("span",{className:"text-fg-tertiary block mb-0.5",children:m("sidebar.openInFinder")}),E.replace(/.*\.markus\//,"~/.markus/")]})]})})]})]}),!o&&q&&s.jsx(MW,{onClose:()=>re(!1),onConfirm:(Q,Z)=>{re(!1),ye({donationsEnabled:!1,priceCents:Q==="paid"?Z:void 0})},isUpdate:O.shared}),!o&&B&&s.jsx(jW,{onClose:()=>J(!1),onConfirm:(Q,Z,be,Ke)=>{J(!1),ye({visibility:Q,orgId:Z,priceCents:be,donationsEnabled:Ke})}}),U&&s.jsx(dr,{alertOnly:!0,variant:U.variant??"primary",title:U.title,message:U.message,onConfirm:()=>W(null),onCancel:()=>W(null)})]}):s.jsx("div",{className:"flex-1 overflow-y-auto",children:s.jsxs("div",{className:"px-6 py-8",children:[s.jsxs("button",{onClick:n,className:"text-xs text-brand-400 hover:text-brand-300 mb-4 inline-flex items-center gap-1",children:[s.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"15 18 9 12 15 6"})}),m("detail.backToBuilder")]}),s.jsx("div",{className:"text-fg-tertiary text-sm py-20 text-center",children:m("detail.notFound")})]})})}function jW({onClose:e,onConfirm:t}){const{t:n}=ft(["builder","common"]),[r,o]=k.useState("public"),[l,c]=k.useState([]),[d,m]=k.useState(""),[f,h]=k.useState(!1),[g,y]=k.useState(0),[x,w]=k.useState(!1);k.useEffect(()=>{r==="org"&&l.length===0&&(h(!0),lt.myOrgs().then(S=>{c(S.memberships),S.memberships.length>0&&m(S.memberships[0].id)}).catch(()=>{}).finally(()=>h(!1)))},[r,l.length]);const C=r==="public"||r==="unlisted",T=[{value:"public",icon:s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),s.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]}),label:n("visibility.public"),desc:n("visibility.publicDesc")},{value:"org",icon:s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M3 21h18"}),s.jsx("path",{d:"M9 8h1"}),s.jsx("path",{d:"M9 12h1"}),s.jsx("path",{d:"M9 16h1"}),s.jsx("path",{d:"M14 8h1"}),s.jsx("path",{d:"M14 12h1"}),s.jsx("path",{d:"M14 16h1"}),s.jsx("path",{d:"M5 21V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16"})]}),label:n("visibility.org"),desc:n("visibility.orgDesc")},{value:"unlisted",icon:s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),s.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),label:n("visibility.unlisted"),desc:n("visibility.unlistedDesc")}];return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:e,children:s.jsxs("div",{className:"bg-surface-secondary border border-border-default rounded-xl max-w-sm w-full mx-4 p-6 shadow-2xl",onClick:S=>S.stopPropagation(),children:[s.jsx("h3",{className:"text-base font-semibold text-fg-primary mb-1",children:n("visibility.label")}),s.jsx("p",{className:"text-[11px] text-fg-tertiary mb-4 leading-relaxed",children:n("visibility.subtitle")}),s.jsxs("div",{className:"text-[10px] uppercase tracking-wider text-fg-tertiary font-semibold mb-2",children:["1 · ",n("visibility.public")," / ",n("visibility.org")]}),s.jsx("div",{className:"space-y-2 mb-5",children:T.map(S=>s.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${r===S.value?"border-brand-500 bg-brand-500/10":"border-border-default hover:border-gray-600"}`,children:[s.jsx("input",{type:"radio",name:"visibility",checked:r===S.value,onChange:()=>o(S.value),className:"accent-brand-500"}),s.jsx("div",{className:"flex items-center gap-2 text-fg-secondary",children:S.icon}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium text-fg-primary",children:S.label}),s.jsx("div",{className:"text-[11px] text-fg-tertiary",children:S.desc})]})]},S.value))}),r==="org"&&s.jsxs("div",{className:"mb-5",children:[s.jsx("label",{className:"text-xs text-fg-secondary block mb-1.5",children:n("visibility.orgSelect")}),f?s.jsx("div",{className:"text-xs text-fg-tertiary py-2",children:"Loading..."}):l.length===0?s.jsx("div",{className:"text-xs text-fg-tertiary py-2",children:n("visibility.orgNone")}):s.jsx("select",{value:d,onChange:S=>m(S.target.value),className:"w-full text-sm px-3 py-2 rounded-lg bg-surface-elevated border border-border-default text-fg-primary",children:l.map(S=>s.jsx("option",{value:S.id,children:S.name},S.id))})]}),C&&s.jsxs("div",{className:"mb-5",children:[s.jsxs("div",{className:"text-[10px] uppercase tracking-wider text-fg-tertiary font-semibold mb-2",children:["2 · ",n("pricing.label")]}),s.jsx("label",{className:"text-xs text-fg-secondary block mb-1.5",children:n("pricing.label")}),s.jsx("div",{className:"grid grid-cols-4 gap-2 mb-3",children:o6.map(S=>s.jsx("button",{type:"button",onClick:()=>y(S.cents),className:`text-sm px-2 py-2 rounded-lg border transition-colors ${g===S.cents?"border-brand-500 bg-brand-500/10 text-fg-primary":"border-border-default text-fg-secondary hover:border-gray-600"}`,children:S.label},S.cents))}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:x,onChange:S=>w(S.target.checked),className:"accent-brand-500"}),s.jsx("span",{className:"text-xs text-fg-secondary",children:n("pricing.enableTips")})]})]}),C&&s.jsx("div",{className:"mb-4 text-[11px] text-fg-tertiary rounded-lg border border-border-default px-3 py-2",children:n("pricing.reviewNote")}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{onClick:e,className:"flex-1 text-sm px-4 py-2 rounded-lg border border-border-default text-fg-secondary hover:text-fg-primary hover:border-gray-600 transition-colors",children:n("common:cancel")}),s.jsx("button",{onClick:()=>t(r,r==="org"?d:void 0,C&&g>0?g:void 0,C?x:void 0),disabled:r==="org"&&!d,className:"flex-1 text-sm px-4 py-2 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:n("shareMode.share")})]})]})})}const o6=[{cents:0,label:"Free"},{cents:100,label:"$1"},{cents:500,label:"$5"},{cents:1e3,label:"$10"}];function MW({onClose:e,onConfirm:t,isUpdate:n}){const{t:r}=ft(["builder","common"]),[o,l]=k.useState(0);return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:e,children:s.jsxs("div",{className:"bg-surface-secondary border border-border-default rounded-xl max-w-sm w-full mx-4 p-6 shadow-2xl",onClick:c=>c.stopPropagation(),children:[s.jsx("h3",{className:"text-base font-semibold text-fg-primary mb-4",children:r(n?"shareMode.titleUpdate":"share.toHub")}),s.jsx("div",{className:"space-y-2 mb-5",children:o6.map(c=>s.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${o===c.cents?"border-brand-500 bg-brand-500/10":"border-border-default hover:border-gray-600"}`,children:[s.jsx("input",{type:"radio",name:"sharePrice",checked:o===c.cents,onChange:()=>l(c.cents),className:"accent-brand-500"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium text-fg-primary",children:c.label}),s.jsx("div",{className:"text-[11px] text-fg-tertiary",children:c.cents===0?r("shareMode.freeDesc"):r("shareMode.paidDesc")})]})]},c.cents))}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{onClick:e,className:"flex-1 text-sm px-4 py-2 rounded-lg border border-border-default text-fg-secondary hover:text-fg-primary hover:border-gray-600 transition-colors",children:r("common:cancel")}),s.jsx("button",{onClick:()=>t(o>0?"paid":"free",o),className:"flex-1 text-sm px-4 py-2 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors",children:r(n?"shareMode.update":"shareMode.share")})]})]})})}function N0(e,t){return!e||!i6(e)?null:e.startsWith("http")||e.startsWith("data:")?e:e.startsWith("/")&&t?`${t}${e}`:e}function RW({type:e,seed:t,icon:n,hubBase:r,size:o=44,className:l="",rounded:c="rounded-xl"}){const d=Xo(e),m=N0(n,r),f=k.useMemo(()=>Xg(d,t),[d,t]),h=k.useMemo(()=>s6(t),[t]),[g,y]=k.useState(!1);return m&&!g?s.jsx("img",{src:m,alt:"",onError:()=>y(!0),style:{width:o,height:o},className:`${c} object-cover shrink-0 ${l}`}):vW(n)?s.jsx("div",{style:{width:o,height:o,background:f,fontSize:o*.5},className:`${c} shrink-0 flex items-center justify-center shadow-inner ${l}`,children:s.jsx("span",{className:"drop-shadow-sm",children:n})}):n&&MK(n)?s.jsx("div",{style:{width:o,height:o,background:f},className:`${c} shrink-0 flex items-center justify-center text-white shadow-inner ${l}`,children:s.jsx(Yo,{name:n,size:o*.52,className:"drop-shadow-sm"})}):s.jsx("div",{style:{width:o,height:o,background:f},className:`${c} shrink-0 flex items-center justify-center shadow-inner ${l}`,children:s.jsx("svg",{width:o*.55,height:o*.55,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:s.jsx("path",{d:h,fill:"rgba(255,255,255,0.92)"})})})}function C0({name:e,username:t,avatarUrl:n,hubBase:r,size:o=24,className:l="",verified:c}){const d=t||e||"markus",m=N0(n,r),[f,h]=k.useState(!1),g=m&&!f?m:wW(d);return s.jsxs("span",{className:`relative inline-flex shrink-0 ${l}`,style:{width:o,height:o},children:[s.jsx("img",{src:g,alt:e||t||"",onError:()=>h(!0),className:"w-full h-full rounded-full object-cover ring-1 ring-white/10 bg-surface-elevated"}),c&&s.jsx("span",{className:"absolute -right-0.5 -bottom-0.5 flex items-center justify-center rounded-full bg-brand-500 ring-2 ring-surface-primary",style:{width:o*.42,height:o*.42},children:s.jsx("svg",{viewBox:"0 0 24 24",width:"60%",height:"60%",fill:"white","aria-hidden":!0,children:s.jsx("path",{d:"M9 16.2l-3.5-3.5 1.4-1.4L9 13.4l7.1-7.1 1.4 1.4z"})})})]})}function LW({type:e,className:t=""}){const n=Xo(e),r=Ei[n];return s.jsx("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold tracking-wide text-white bg-gradient-to-r ${r.gradient} ${t}`,children:r.label})}function P4({rating:e=0}){const t=Math.round(e);return s.jsx("span",{className:"inline-flex items-center","aria-label":`${e} out of 5`,children:[0,1,2,3,4].map(n=>s.jsx("svg",{viewBox:"0 0 24 24",width:"12",height:"12",className:n<t?"text-amber-400":"text-fg-muted/40",fill:"currentColor","aria-hidden":!0,children:s.jsx("path",{d:"M12 2l2.4 6.9L21 9l-5.4 4 2 7-5.6-4.1L6.4 20l2-7L3 9l6.6-.1z"})},n))})}function ia(e){const{type:t,name:n,description:r,seed:o,icon:l,cover:c,hubBase:d,author:m,authorLabel:f,version:h,category:g,tags:y,rating:x=0,ratingCount:w=0,downloadCount:C=0,priceCents:T,currency:S="usd",installed:E,glowing:j,selected:L,showTypeBadge:I=!0,hideStats:O=!1,cornerLabel:F,actions:V,footerLeft:X,headerAction:z,onClick:G,className:se=""}=e,ee=Xo(t),q=Ei[ee],re=o||n,B=(T??0)>0,J=!!N0(c||void 0,d),fe=Xg(ee,re),Se=f??m?.displayName??m?.username??"",[U,W]=k.useState(null),pe=E?s.jsx("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-500/12 text-emerald-400 border border-emerald-500/25 px-2 py-0.5 text-[10px] font-semibold",children:s.jsx("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.5",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})})}):F?s.jsx("span",{className:"chip",children:F}):B?s.jsx("span",{className:"badge-paid",children:O4(T,S)}):null;if(J){const P=N0(c||void 0,d);return s.jsxs("div",{onClick:G,style:{aspectRatio:U??void 0},className:`group asset-card card-shine relative flex flex-col overflow-hidden min-h-[180px] ${G?"cursor-pointer":""} ${L?"ring-1 ring-brand-500/60":""} ${j?"ring-2 ring-brand-500 shadow-lg shadow-brand-500/20":""} ${se}`,children:[s.jsx("img",{src:P,alt:"",onLoad:_e=>{const He=_e.currentTarget;He.naturalWidth&&He.naturalHeight&&W(Math.min(1.9,Math.max(1,He.naturalWidth/He.naturalHeight)))},className:"absolute inset-0 w-full h-full object-cover transition-transform duration-[600ms] group-hover:scale-[1.05]"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/90 via-black/50 to-black/5"}),s.jsx("div",{className:"absolute inset-x-0 top-0 h-20 bg-gradient-to-b from-black/50 to-transparent"}),s.jsxs("div",{className:"relative flex items-start justify-between gap-2 p-3",children:[s.jsx("span",{children:I&&s.jsx(LW,{type:ee})}),s.jsxs("span",{className:"flex items-center gap-1.5",onClick:_e=>_e.stopPropagation(),children:[E?s.jsx("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-500/25 text-emerald-50 border border-emerald-300/40 px-2 py-0.5 text-[10px] font-semibold backdrop-blur-md",children:s.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})})}):F?s.jsx("span",{className:"inline-flex items-center rounded-full bg-white/15 text-white border border-white/25 px-2 py-0.5 text-[10px] font-medium backdrop-blur-md",children:F}):z?null:s.jsx("span",{className:B?"badge-paid":"badge-free",children:O4(T,S)}),z]})]}),s.jsxs("div",{className:"relative mt-auto p-4 pt-10 flex flex-col gap-2 text-white",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h3",{className:"text-[15px] font-semibold truncate drop-shadow-md",children:n}),h&&s.jsxs("span",{className:"shrink-0 rounded-full bg-white/15 border border-white/25 px-1.5 py-0.5 text-[10px] font-medium backdrop-blur-md",children:["v",h]})]}),Se&&s.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-white/85",children:[m&&s.jsx(C0,{name:m.displayName,username:m.username,avatarUrl:m.avatarUrl,hubBase:d,size:15}),s.jsx("span",{className:"truncate",children:Se})]}),r&&s.jsx("p",{className:"text-[12.5px] text-white/80 truncate leading-snug drop-shadow-sm",children:r}),(g||y&&y.length>0)&&s.jsxs("div",{className:"flex flex-nowrap gap-1.5 overflow-hidden",children:[g&&s.jsx("span",{className:"shrink-0 rounded-full bg-white/15 border border-white/20 text-white/95 px-2 py-0.5 text-[10px] font-semibold capitalize backdrop-blur-md",children:g}),y?.slice(0,3).map(_e=>s.jsx("span",{className:"shrink-0 rounded-full bg-white/10 border border-white/15 text-white/85 px-2 py-0.5 text-[10px] backdrop-blur-md",children:_e},_e))]}),(!O||V)&&s.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1 shrink-0",children:[O?s.jsx("span",{}):s.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-white/80",children:[s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(P4,{rating:x}),w>0&&s.jsxs("span",{className:"text-white/60",children:["(",Mo(w),")"]})]}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx("svg",{viewBox:"0 0 24 24",width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":!0,children:s.jsx("path",{d:"M12 3v12m0 0l-4-4m4 4l4-4M5 21h14"})}),Mo(C)]})]}),V&&s.jsx("div",{className:"flex items-center gap-2",onClick:_e=>_e.stopPropagation(),children:V})]})]})]})}return s.jsxs("div",{onClick:G,className:`group asset-card card-shine relative flex flex-col ${G?"cursor-pointer":""} ${L?"ring-1 ring-brand-500/60":""} ${j?"ring-2 ring-brand-500 shadow-lg shadow-brand-500/20":""} ${se}`,children:[s.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-[2px] opacity-0 group-hover:opacity-100 transition-opacity duration-300",style:{background:`linear-gradient(90deg, transparent, ${q.accent}, transparent)`}}),s.jsx("div",{className:"pointer-events-none absolute -top-10 -left-10 w-36 h-36 rounded-full blur-2xl opacity-[0.12] group-hover:opacity-20 transition-opacity duration-300",style:{background:fe}}),z&&s.jsx("div",{className:"absolute top-2.5 right-2.5 z-10",onClick:P=>P.stopPropagation(),children:z}),s.jsxs("div",{className:"relative p-4 flex flex-col flex-1 gap-2.5",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(RW,{type:ee,seed:re,icon:l,hubBase:d,size:46,rounded:"rounded-2xl",className:"ring-1 ring-white/10 shadow-sm shadow-black/20"}),s.jsxs("div",{className:`min-w-0 flex-1 ${z?"pr-7":""}`,children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h3",{className:"text-sm font-semibold text-fg-primary truncate group-hover:text-brand-300 transition-colors",children:n}),h&&s.jsxs("span",{className:"chip shrink-0",children:["v",h]}),pe&&s.jsx("span",{className:"ml-auto shrink-0",children:pe})]}),(Se||I)&&s.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-[11px] text-fg-tertiary min-w-0",children:[m&&s.jsx(C0,{name:m.displayName,username:m.username,avatarUrl:m.avatarUrl,hubBase:d,size:15}),Se&&s.jsx("span",{className:"truncate",children:Se}),I&&s.jsxs(s.Fragment,{children:[Se&&s.jsx("span",{className:"text-fg-muted",children:"·"}),s.jsx("span",{className:"font-semibold shrink-0",style:{color:q.accent},children:q.label})]})]})]})]}),r&&s.jsx("p",{className:"text-[13px] text-fg-secondary truncate leading-snug",children:r}),(g||y&&y.length>0)&&s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[g&&s.jsx("span",{className:"chip-accent capitalize",children:g}),y?.slice(0,3).map(P=>s.jsx("span",{className:"chip",children:P},P)),(y?.length??0)>3&&s.jsxs("span",{className:"text-[10px] text-fg-muted self-center",children:["+",(y?.length??0)-3]})]}),(()=>{const P=X??(O?null:s.jsxs("span",{className:"flex items-center gap-3 text-[11px] text-fg-tertiary",children:[s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(P4,{rating:x}),s.jsx("span",{className:"text-fg-muted",children:w>0?`(${Mo(w)})`:""})]}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx("svg",{viewBox:"0 0 24 24",width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":!0,children:s.jsx("path",{d:"M12 3v12m0 0l-4-4m4 4l4-4M5 21h14"})}),Mo(C)]})]}));return!P&&!V?null:s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 pt-2 mt-auto border-t border-border-subtle/60",onClick:_e=>_e.stopPropagation(),children:[P&&s.jsx("div",{className:"min-w-0 flex items-center gap-2",children:P}),V&&s.jsx("div",{className:"flex flex-wrap items-center gap-2 justify-end",children:V})]})})()]})]})}function Ar({children:e,maxCardWidth:t=400,gap:n="1rem",className:r=""}){const o=k.useRef(null),[l,c]=k.useState(0);k.useEffect(()=>{const h=o.current;if(!h)return;c(h.clientWidth);const g=new ResizeObserver(y=>{for(const x of y)c(x.contentRect.width)});return g.observe(h),()=>g.disconnect()},[]);const d=Math.max(1,Math.ceil((l||t)/t)),m=k.Children.toArray(e),f=Array.from({length:d},()=>[]);return m.forEach((h,g)=>{f[g%d].push(h)}),s.jsx("div",{ref:o,className:`flex items-start ${r}`,style:{gap:n},children:f.map((h,g)=>s.jsx("div",{className:"flex flex-col flex-1 min-w-0",style:{gap:n,maxWidth:t},children:h},g))})}function OW(e){const t=e.indexOf(".markus/builder-artifacts/");return t>=0?"~/"+e.slice(t):e}const DW=[{id:"hireAgent",icon:"✦",color:"from-brand-500 to-purple-600",borderColor:"border-brand-500/30 hover:border-brand-400/50",bgColor:"bg-brand-500/10"},{id:"buildTeam",icon:"◈",color:"from-blue-500 to-blue-600",borderColor:"border-blue-500/30 hover:border-blue-400/50",bgColor:"bg-blue-500/10"},{id:"createSkill",icon:"⬡",color:"from-green-500 to-green-600",borderColor:"border-green-500/30 hover:border-green-400/50",bgColor:"bg-green-500/10"}];function IW(){const[e,t]=k.useState(()=>{const r=window.location.hash.slice(1).split("/");return fc(r[0])===de.BUILDER&&r[1]&&r[2]?{type:r[1],name:decodeURIComponent(r[2])}:null});return k.useEffect(()=>{const n=()=>{const o=window.location.hash.slice(1).split("/");fc(o[0])===de.BUILDER&&o[1]&&o[2]?t({type:o[1],name:decodeURIComponent(o[2])}):t(null)};return window.addEventListener("hashchange",n),()=>window.removeEventListener("hashchange",n)},[]),e}const l6="markus_builder_shared_map";function PW(){try{const e=localStorage.getItem(l6);if(!e)return new Map;const t=JSON.parse(e);return new Map(Object.entries(t))}catch{return new Map}}function Ld(e){try{localStorage.setItem(l6,JSON.stringify(Object.fromEntries(e)))}catch{}}function c6({authUser:e}={}){const{t}=ft(["builder","common"]),n=Uo(),r=IW(),[o,l]=k.useState([]),[c,d]=k.useState([]),[m,f]=k.useState(!1),[h,g]=k.useState("all"),[y,x]=k.useState(null),[w,C]=k.useState(new Map),[T,S]=k.useState(null),[E,j]=k.useState(null),[L,I]=k.useState(null),[O,F]=k.useState(PW),[V,X]=k.useState(null),[z,G]=k.useState(null),[se,ee]=k.useState(null),[q,re]=k.useState(null),[B,J]=k.useState(null),[fe,Se]=k.useState("creations"),[U,W]=k.useState([]),[pe,P]=k.useState(""),[_e,He]=k.useState([]),[Pe,Ge]=k.useState(!1),[ct,mt]=k.useState("all"),Ct=k.useCallback(()=>{f(!0),Promise.all([(Si(Tr.builderArtifacts)??Ee.builder.artifacts.list()).then(ue=>ue?.artifacts??[]).catch(()=>[]),(Si(Tr.builderAgents)??Ee.agents.list()).then(ue=>ue?.agents??[]).catch(()=>[]),(Si(Tr.builderHubMyItems)??lt.myItems()).then(ue=>ue?.items??[]).catch(()=>[]),(Si(Tr.builderInstalled)??Ee.builder.artifacts.installed()).then(ue=>ue?.installed??{}).catch(()=>({}))]).then(([ue,tt,st,ye])=>{if(d(ue),l(tt),st.length>0){const Ae=new Map;for(const oe of st){const H=oe.itemType==="agent"?"agent":oe.itemType==="team"?"team":"skill";for(const te of ue)te.type===H&&(oe.slug===te.name||oe.name===(te.meta.displayName||te.meta.name||te.name))&&Ae.set(`${te.type}/${te.name}`,{id:oe.id,name:oe.name,slug:oe.slug||te.name,version:oe.version||"1.0.0",visibility:oe.visibility??"public",moderationStatus:oe.moderationStatus,pendingReview:oe.pendingReview})}Ae.size>0&&F(oe=>{const H=new Map(oe);for(const[te,Ne]of Ae)H.set(te,Ne);return Ld(H),H})}const je=new Map;for(const Ae of ue){const oe=`${Ae.type}/${Ae.name}`,H=ye[oe];H&&je.set(oe,{agentId:H.agentId,agentIds:H.agentIds,teamId:H.teamId})}C(je)}).finally(()=>f(!1))},[]);k.useEffect(()=>{Ct();const ue=tt=>{tt.detail?.page===de.BUILDER&&Ct()};return window.addEventListener("markus:navigate",ue),()=>window.removeEventListener("markus:navigate",ue)},[Ct]);const Mt=ue=>{const tt=o.find(st=>st.role==="Secretary"||st.name==="Secretary");tt?it.navigate(de.TEAM,{agentId:tt.id,prefillMessage:ue}):it.navigate(de.TEAM,{prefillMessage:ue})},Pt=async ue=>{const tt=`${ue.type}/${ue.name}`;if(!w.has(tt)){x({key:tt,action:"install"});try{const st=await Ee.builder.artifacts.install(ue.type,ue.name),ye={};st.agent&&typeof st.agent=="object"&&(ye.agentId=st.agent.id),st.team&&typeof st.team=="object"&&(ye.teamId=st.team.id),Array.isArray(st.agents)&&(ye.agentIds=st.agents.map(je=>je.id)),C(je=>new Map(je).set(tt,ye)),window.dispatchEvent(new CustomEvent("markus:data-changed"))}catch(st){console.error("Install failed:",st),G({title:t("common:install"),message:t("installFailed",{error:String(st)}),variant:"danger"})}finally{x(null)}}},Kt=async ue=>{const tt=`${ue.type}/${ue.name}`;if(w.has(tt)){x({key:tt,action:"uninstall"});try{await Ee.builder.artifacts.uninstall(ue.type,ue.name),C(st=>{const ye=new Map(st);return ye.delete(tt),ye}),window.dispatchEvent(new CustomEvent("markus:data-changed"))}catch(st){console.error("Uninstall failed:",st),G({title:t("common:uninstall"),message:t("uninstallFailed",{error:String(st)}),variant:"danger"})}finally{x(null)}}},yt=async(ue,tt)=>{const st=`${ue.type}/${ue.name}`;x({key:st,action:"share"});try{const ye=await Ee.builder.artifacts.ensureSlugSafe(ue.type,ue.name,ue.meta.displayName||ue.meta.name||ue.name),je=ye.name,Ae=ye.slug||xc(je);if(!Ae)throw new Error("Invalid package slug: use English kebab-case for the artifact name (e.g. qwen-multimodal). Chinese-only names cannot be shared — rename the package slug and put the Chinese title in displayName.");const oe=`${ue.type}/${je}`;ye.converted&&(d(le=>le.map(Oe=>Oe.type===ue.type&&Oe.name===ue.name?{...Oe,name:je,path:ye.path,meta:{...Oe.meta,name:je,displayName:ye.displayName??Oe.meta.displayName??ue.name}}:Oe)),F(le=>{const Oe=new Map(le),ge=Oe.get(st);return ge&&(Oe.delete(st),Oe.set(oe,{...ge,slug:Ae,name:ye.displayName??ge.name})),Ld(Oe),Oe}),C(le=>{const Oe=new Map(le),ge=Oe.get(st);return ge&&(Oe.delete(st),Oe.set(oe,ge)),Oe}));const H=await Ee.builder.artifacts.get(ue.type,je);let te={...ue.meta,name:je,displayName:ye.displayName??ue.meta.displayName??ue.name};try{const le=H.files?.[`${ue.type}.json`]??H.files?.["agent.json"]??H.files?.["team.json"]??H.files?.["skill.json"];le&&(te={...JSON.parse(le),...te,name:je,displayName:te.displayName})}catch{}const Ne=te.displayName||te.name||je,Re=te.description||"",$e=te.category||"general",Q=Array.isArray(te.tags)?te.tags:[];let Z=te.icon||void 0;const be=te.version||"1.0.0";if(Z&&!Z.startsWith("http")&&/\.(png|jpe?g|gif|webp|svg)$/i.test(Z)){const le=Z.split("/").pop()??Z;try{const Oe=await fetch(`/api/builder/artifacts/${ue.type}s/${encodeURIComponent(je)}/images/${encodeURIComponent(le)}`);if(Oe.ok){const ge=await Oe.blob(),Ve=new File([ge],le,{type:ge.type}),Qe=await lt.uploadImage(Ve);Qe?.url&&(Z=Qe.url)}}catch{}}let Ke;const Ie=[],Ye=Array.isArray(te.screenshots)?te.screenshots:[];for(let le=0;le<Ye.length;le++){const Oe=Ye[le],ge=Oe.split("/").pop()??Oe;try{const Ve=await fetch(`/api/builder/artifacts/${ue.type}s/${encodeURIComponent(je)}/images/${encodeURIComponent(ge)}`);if(Ve.ok){const Qe=await Ve.blob(),K=new File([Qe],ge,{type:Qe.type}),ce=await lt.uploadImage(K);ce?.url&&(Ie.push({url:ce.url,alt:ge,order:le}),(le===0||te.thumbnail===Oe)&&(Ke=ce.url))}}catch{}}const M=await lt.publishViaProxy({itemType:ue.type==="team"?"team":ue.type==="skill"?"skill":"agent",name:Ne,slug:Ae,description:Re,category:$e,tags:Q,icon:Z,version:be,config:{...te,name:je,displayName:Ne},files:H.files&&Object.keys(H.files).length>0?H.files:void 0,thumbnailUrl:Ke,images:Ie.length>0?Ie:void 0,priceCents:tt?.priceCents,donationsEnabled:tt?.donationsEnabled,visibility:tt?.visibility,orgId:tt?.orgId});M.id&&(F(Oe=>{const ge=new Map(Oe);return ge.set(oe,{id:M.id,name:Ne,slug:M.slug??Ae,version:be,visibility:M.visibility??tt?.visibility??"public",moderationStatus:M.moderationStatus,pendingReview:M.pendingReview}),Ld(ge),ge}),(M.visibility??tt?.visibility??"public")!=="org"&&(M.moderationStatus==="pending"||M.pendingReview)?G({title:t("common:share"),message:ye.converted?t("share.convertedAndSubmitted",{previous:ue.name,slug:Ae}):M.updated?t("share.updateSubmitted"):t("share.submittedForReview"),variant:"primary"}):ye.converted&&G({title:t("common:share"),message:t("share.convertedSlug",{previous:ue.name,slug:Ae}),variant:"primary"}))}catch(ye){console.error("Share failed:",ye),G({title:t("common:share"),message:t("shareFailed",{error:ye instanceof Error?ye.message:String(ye)}),variant:"danger"})}finally{x(null)}},Ue=async()=>{if(!V)return;const{key:ue}=V,tt=O.get(ue);if(X(null),!tt)return;const st=tt.id;x({key:ue,action:"hubDelete"});try{await lt.deleteItem(st),F(ye=>{const je=new Map(ye);return je.delete(ue),Ld(je),je})}catch(ye){console.error("Hub delete failed:",ye),G({title:t("unshare"),message:t("hubDeleteFailed",{error:String(ye)}),variant:"danger"})}finally{x(null)}},dt=async()=>{if(!T)return;const ue=T,tt=`${ue.type}/${ue.name}`;S(null),x({key:tt,action:"delete"});try{await Ee.builder.artifacts.delete(ue.type,ue.name),d(st=>st.filter(ye=>!(ye.type===ue.type&&ye.name===ue.name))),C(st=>{const ye=new Map(st);return ye.delete(tt),ye}),window.dispatchEvent(new CustomEvent("markus:data-changed"))}catch(st){console.error("Delete failed:",st)}finally{x(null)}},Nt=h==="all"?c:c.filter(ue=>ue.type===h);k.useEffect(()=>{fe!=="orgAssets"||U.length>0||lt.myOrgs().then(ue=>{W(ue.memberships),ue.memberships.length>0&&!pe&&P(ue.memberships[0].id)}).catch(()=>{})},[fe,U.length,pe]),k.useEffect(()=>{fe!=="orgAssets"||!pe||(Ge(!0),lt.browseItems({orgId:pe,limit:100}).then(ue=>He(ue.items??[])).catch(()=>He([])).finally(()=>Ge(!1)))},[fe,pe]);const bt=ct==="all"?_e:_e.filter(ue=>ue.itemType===ct),Lt=ue=>{history.pushState(null,"",Ti(de.BUILDER,`${ue.type}/${encodeURIComponent(ue.name)}`)),window.dispatchEvent(new HashChangeEvent("hashchange"))};return r?s.jsx(Mi,{type:r.type,name:r.name,authUser:e,onBack:()=>{history.pushState(null,"",Ti(de.BUILDER)),window.dispatchEvent(new HashChangeEvent("hashchange"))}}):s.jsx("div",{className:"flex-1 overflow-y-auto",children:s.jsxs("div",{className:`max-w-5xl mx-auto w-full ${n?"px-4 py-5":"px-6 py-6"}`,children:[s.jsxs("div",{className:"mb-6",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-bold text-fg-primary",children:t("title")}),s.jsx("p",{className:"text-xs text-fg-tertiary mt-1",children:t("subtitle")})]}),s.jsx("button",{onClick:Ct,className:"text-xs text-fg-tertiary hover:text-fg-secondary transition-colors px-3 py-1.5 rounded-lg border border-border-default hover:border-gray-600",children:t("common:refresh")})]}),s.jsx("div",{className:`grid ${n?"grid-cols-1 gap-2":"grid-cols-3 gap-3"}`,children:DW.map(ue=>{const tt=t(`prompts.${ue.id}Prompt`),st=t(`prompts.${ue.id}Examples`,{returnObjects:!0}),ye=Array.isArray(st)?st:[];return s.jsx("button",{onClick:()=>Mt(tt),className:`group text-left w-full rounded-xl border ${ue.borderColor} bg-surface-secondary/60 p-4 transition-all hover:bg-surface-secondary/80 hover:shadow-lg`,children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:`w-10 h-10 text-xl rounded-lg ${ue.bgColor} flex items-center justify-center shrink-0`,children:ue.icon}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:`text-sm font-semibold bg-gradient-to-r ${ue.color} bg-clip-text text-transparent`,children:t(`prompts.${ue.id}`)}),s.jsx("p",{className:"text-[11px] text-fg-tertiary mt-1 leading-relaxed",children:t(`prompts.${ue.id}Desc`)}),ye.length>0&&s.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:ye.slice(0,2).map((je,Ae)=>s.jsxs("span",{className:"text-[10px] text-fg-muted bg-surface-elevated/60 rounded-full px-2 py-0.5 border border-border-default",onClick:oe=>{oe.stopPropagation(),Mt(tt+je)},children:["“",je,"”"]},Ae))})]})]})},ue.id)})})]}),s.jsx("div",{className:"mb-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:()=>Se("creations"),className:`text-sm font-semibold transition-colors ${fe==="creations"?"text-fg-primary":"text-fg-tertiary hover:text-fg-secondary"}`,children:t("myCreations.title")}),s.jsx("button",{onClick:()=>Se("orgAssets"),className:`text-sm font-semibold transition-colors ${fe==="orgAssets"?"text-fg-primary":"text-fg-tertiary hover:text-fg-secondary"}`,children:t("orgAssets.title")})]}),fe==="creations"&&s.jsx("div",{className:"flex gap-1.5",children:["all","agent","team","skill"].map(ue=>s.jsx("button",{onClick:()=>g(ue),className:`text-xs px-2.5 py-1 rounded-lg transition-colors ${h===ue?"bg-brand-600 text-white":"text-fg-tertiary hover:text-fg-secondary hover:bg-surface-elevated"}`,children:t(ue==="all"?"myCreations.filterAll":ue==="agent"?"myCreations.filterAgents":ue==="team"?"myCreations.filterTeams":"myCreations.filterSkills")},ue))}),fe==="orgAssets"&&s.jsx("div",{className:"flex gap-1.5",children:["all","agent","team","skill"].map(ue=>s.jsx("button",{onClick:()=>mt(ue),className:`text-xs px-2.5 py-1 rounded-lg transition-colors ${ct===ue?"bg-brand-600 text-white":"text-fg-tertiary hover:text-fg-secondary hover:bg-surface-elevated"}`,children:t(ue==="all"?"myCreations.filterAll":ue==="agent"?"myCreations.filterAgents":ue==="team"?"myCreations.filterTeams":"myCreations.filterSkills")},ue))})]})}),fe==="orgAssets"&&U.length>0&&s.jsx("div",{className:"flex gap-2 mb-3 overflow-x-auto pb-1",children:U.map(ue=>s.jsx("button",{onClick:()=>P(ue.id),className:`text-xs px-3 py-1.5 rounded-full whitespace-nowrap border transition-colors ${pe===ue.id?"bg-blue-500/15 border-blue-500/40 text-blue-400":"border-border-default text-fg-tertiary hover:text-fg-secondary hover:border-gray-600"}`,children:ue.name},ue.id))}),fe==="orgAssets"&&(U.length===0&&!Pe?s.jsx("div",{className:"text-center py-12",children:s.jsx("div",{className:"text-fg-tertiary text-sm",children:t("orgAssets.noOrgs")})}):Pe?s.jsx("div",{className:"text-center text-fg-tertiary py-12 text-sm",children:t("orgAssets.loading")}):bt.length===0?s.jsx("div",{className:"text-center py-12",children:s.jsx("div",{className:"text-fg-tertiary text-sm",children:t("orgAssets.noItems")})}):s.jsx(Ar,{children:bt.map(ue=>{const tt=ue.author?.username&&ue.slug?`${lt.getUrl()}/@${encodeURIComponent(ue.author.username)}/${encodeURIComponent(ue.slug)}`:null;return s.jsx(ia,{type:ue.itemType,name:ue.name,description:ue.description,seed:ue.slug||ue.id||ue.name,icon:ue.icon,cover:ue.thumbnailUrl,hubBase:lt.getUrl(),author:ue.author,version:ue.version,rating:parseFloat(ue.avgRating)||0,ratingCount:ue.ratingCount,downloadCount:ue.downloadCount,actions:tt?s.jsxs("a",{href:tt,target:"_blank",rel:"noopener noreferrer",onClick:st=>{st.stopPropagation(),yc()&&(st.preventDefault(),_i(tt))},className:"text-xs px-3 py-1.5 rounded-lg border border-border-default text-fg-secondary hover:text-fg-primary hover:border-gray-600 transition-colors inline-flex items-center gap-1",children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),s.jsx("polyline",{points:"15 3 21 3 21 9"}),s.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),"Hub"]}):void 0},ue.id)})})),fe==="creations"&&(m&&c.length===0?s.jsx("div",{className:"text-center text-fg-tertiary py-12 text-sm",children:t("myCreations.loadingArtifacts")}):Nt.length===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx("div",{className:"text-fg-tertiary text-sm",children:t("myCreations.noArtifacts")}),s.jsx("div",{className:"text-fg-muted text-xs mt-1",children:t("myCreations.noArtifactsHint")})]}):s.jsx(Ar,{children:Nt.map(ue=>{const tt=ue.meta.displayName||ue.meta.name||ue.name,st=ue.meta.description||"",ye=`${ue.type}/${ue.name}`,je=y?.key===ye?y.action:null,Ae=O.get(ye),oe=ue.meta.version||"1.0.0",H=!!Ae,te=H&&Ae.version!==oe,Ne=()=>{const Ie=lt.getUser();return!Ae||!Ie?null:`${lt.getUrl()}/@${encodeURIComponent(Ie.username)}/${encodeURIComponent(Ae.slug)}`},Re=H&&(Ae?.moderationStatus==="pending"||Ae?.moderationStatus==="rejected"||!!Ae?.pendingReview),$e=s.jsxs("div",{className:"flex items-center gap-1.5 justify-end",onClick:Ie=>Ie.stopPropagation(),children:[w.has(ye)?s.jsxs("button",{onClick:()=>I(ue),disabled:!!je,className:"text-xs px-3 py-1.5 rounded-lg border border-green-600/30 text-green-600 hover:bg-red-500/10 hover:text-red-500 hover:border-red-500/30 transition-colors disabled:opacity-50 inline-flex items-center gap-1",children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),s.jsx("polyline",{points:"17 8 12 3 7 8"}),s.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),t(je==="uninstall"?"common:uninstalling":"common:uninstall")]}):s.jsxs("button",{onClick:()=>j(ue),disabled:!!je,className:"text-xs px-3 py-1.5 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors disabled:opacity-50 inline-flex items-center gap-1",children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),s.jsx("polyline",{points:"7 10 12 15 17 10"}),s.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),t(je==="install"?"common:installing":"common:install")]}),H&&Re?Ae?.moderationStatus==="pending"?s.jsxs("span",{className:"text-xs px-2 py-1.5 rounded-lg border border-amber-500/30 text-amber-400 inline-flex items-center gap-1",title:t("share.underReviewTip"),children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"12 6 12 12 16 14"})]}),t("share.underReview")]}):Ae?.moderationStatus==="rejected"?s.jsxs("span",{className:"text-xs px-2 py-1.5 rounded-lg border border-red-500/30 text-red-400 inline-flex items-center gap-1",title:t("share.rejectedTip"),children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),s.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),t("share.rejected")]}):s.jsxs("span",{className:"text-xs px-2 py-1.5 rounded-lg border border-amber-500/30 text-amber-400 inline-flex items-center gap-1",title:t("share.updateUnderReviewTip"),children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"12 6 12 12 16 14"})]}),t("share.updateUnderReview")]}):H?s.jsxs(s.Fragment,{children:[te&&s.jsxs("button",{onClick:()=>{const Ie=Ae?.visibility??"public";yt(ue,{visibility:Ie})},disabled:!!je,className:"text-xs px-3 py-1.5 rounded-lg border border-amber-500/30 text-amber-400 hover:bg-amber-500/10 hover:border-amber-500/50 transition-colors disabled:opacity-50 inline-flex items-center gap-1",children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("polyline",{points:"23 4 23 10 17 10"}),s.jsx("polyline",{points:"1 20 1 14 7 14"}),s.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]}),je==="share"?t("common:sharing"):t("share.updateVersion",{version:oe})]}),s.jsxs("a",{href:Ne()??"#",target:"_blank",rel:"noopener noreferrer",onClick:Ie=>{const Ye=Ne();yc()&&Ye&&(Ie.preventDefault(),_i(Ye))},className:`text-xs px-3 py-1.5 rounded-lg border transition-colors inline-flex items-center gap-1 ${Ae?.visibility==="org"?"border-blue-500/30 text-blue-500 hover:text-blue-400 hover:border-blue-400/40":Ae?.visibility==="unlisted"?"border-gray-500/30 text-fg-tertiary hover:text-fg-secondary hover:border-gray-400/40":"border-green-600/30 text-green-600 hover:text-green-500 hover:border-green-500/40"}`,children:[Ae?.visibility==="org"?s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("path",{d:"M3 21h18"}),s.jsx("path",{d:"M9 8h1"}),s.jsx("path",{d:"M9 12h1"}),s.jsx("path",{d:"M9 16h1"}),s.jsx("path",{d:"M14 8h1"}),s.jsx("path",{d:"M14 12h1"}),s.jsx("path",{d:"M14 16h1"}),s.jsx("path",{d:"M5 21V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16"})]}):Ae?.visibility==="unlisted"?s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),s.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}):s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),s.jsx("polyline",{points:"15 3 21 3 21 9"}),s.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),Ae?.visibility==="org"?t("visibility.sharedOrg"):Ae?.visibility==="unlisted"?t("visibility.sharedUnlisted"):t("visibility.shared")]}),s.jsxs("button",{onClick:()=>X({key:ye,name:tt}),disabled:!!je,className:"text-xs px-2.5 py-1.5 rounded-lg border border-border-default text-fg-secondary hover:text-amber-500 hover:border-amber-500/40 hover:bg-amber-500/10 transition-colors disabled:opacity-50 inline-flex items-center gap-1",title:t("removeFromHubTooltip"),children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("path",{d:"M18.84 12.25l1.72-1.71a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),s.jsx("path",{d:"M5.17 11.75l-1.71 1.71a5 5 0 0 0 7.07 7.07l1.71-1.71"}),s.jsx("line",{x1:"2",y1:"2",x2:"22",y2:"22"})]}),t("unshare")]})]}):s.jsxs("button",{onClick:async()=>{await lt.ensureAuth(),Array.isArray(ue.meta.screenshots)&&ue.meta.screenshots.length>0?J(ue):ee(ue)},disabled:!!je,className:"text-xs px-3 py-1.5 rounded-lg border border-border-default text-fg-secondary hover:text-green-600 hover:border-green-500/30 transition-colors disabled:opacity-50 inline-flex items-center gap-1",children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("circle",{cx:"18",cy:"5",r:"3"}),s.jsx("circle",{cx:"6",cy:"12",r:"3"}),s.jsx("circle",{cx:"18",cy:"19",r:"3"}),s.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),s.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),t(je==="share"?"common:sharing":"common:share")]})]}),Q=s.jsx("button",{onClick:()=>S(ue),disabled:!!je,className:"w-7 h-7 rounded-lg text-fg-muted hover:text-red-500 hover:bg-red-500/10 transition-colors disabled:opacity-50 inline-flex items-center justify-center",title:t("deleteLocalTooltip"),children:s.jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("polyline",{points:"3 6 5 6 21 6"}),s.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})}),Z=ue.meta.icon,Ke=!!Z&&/\.(png|jpe?g|gif|webp|svg)$/i.test(Z)?Z.startsWith("http")||Z.startsWith("/")?Z:`/api/builder/artifacts/${ue.type}s/${encodeURIComponent(ue.name)}/images/${encodeURIComponent(Z.split("/").pop()??"")}?v=${ue.updatedAt??""}`:Z;return s.jsx(ia,{type:ue.type,name:tt,description:st,seed:ye,icon:Ke,version:oe,footerLeft:s.jsxs("span",{className:"flex items-center gap-2 text-[10px] text-fg-tertiary min-w-0",children:[s.jsx("button",{onClick:Ie=>{Ie.stopPropagation(),Ee.system.openPath(ue.path).catch(()=>{})},className:"hover:text-fg-secondary transition-colors truncate min-w-0",title:ue.path,children:OW(ue.path)}),s.jsx("span",{className:"shrink-0",children:"·"}),s.jsx("span",{className:"shrink-0",children:new Date(ue.updatedAt).toLocaleDateString()})]}),headerAction:Q,actions:$e,onClick:()=>Lt(ue)},ye)})})),E&&s.jsx(dr,{variant:"primary",title:t("confirmInstall"),message:t("confirmInstallMsg",{name:E.meta.displayName||E.meta.name||E.name}),confirmLabel:t("common:install"),onConfirm:()=>{const ue=E;j(null),Pt(ue)},onCancel:()=>j(null)}),L&&s.jsx(dr,{variant:"primary",title:t("confirmUninstall"),message:t("confirmUninstallMsg",{name:L.meta.displayName||L.meta.name||L.name}),confirmLabel:t("common:uninstall"),onConfirm:()=>{const ue=L;I(null),Kt(ue)},onCancel:()=>I(null)}),T&&s.jsx(dr,{title:t("confirmDeleteLocal"),message:t("deleteCannotUndo",{name:T.meta.displayName||T.meta.name||T.name}),confirmLabel:t("common:delete"),onConfirm:dt,onCancel:()=>S(null)}),V&&s.jsx(dr,{title:t("confirmUnshare"),message:t("removeFromHub",{name:V.name}),confirmLabel:t("unshare"),onConfirm:()=>{Ue()},onCancel:()=>X(null)}),z&&s.jsx(dr,{alertOnly:!0,variant:z.variant??"primary",title:z.title,message:z.message,onConfirm:()=>G(null),onCancel:()=>G(null)}),se&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:()=>ee(null),children:s.jsxs("div",{className:"bg-surface-secondary border border-border-default rounded-xl max-w-sm w-full mx-4 p-6 shadow-2xl",onClick:ue=>ue.stopPropagation(),children:[s.jsx("h3",{className:"text-base font-semibold text-fg-primary mb-2",children:t("common:share")}),s.jsx("p",{className:"text-sm text-fg-secondary mb-5",children:t("share.imagePrompt")}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{onClick:()=>{const ue=se;ee(null),J(ue)},className:"flex-1 text-sm px-4 py-2 rounded-lg border border-border-default text-fg-secondary hover:text-fg-primary hover:border-fg-tertiary transition-colors",children:t("share.directly")}),s.jsx("button",{onClick:()=>{const ue=se;ee(null),Lt(ue)},className:"flex-1 text-sm px-4 py-2 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors",children:t("share.addImagesFirst")})]})]})}),q&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:()=>re(null),children:s.jsx("div",{className:"bg-surface-secondary border border-border-default rounded-xl max-w-sm w-full mx-4 p-6 shadow-2xl",onClick:ue=>ue.stopPropagation(),children:s.jsx(BW,{isUpdate:O.has(`${q.type}/${q.name}`),onCancel:()=>re(null),onConfirm:(ue,tt)=>{const st=q;re(null),yt(st,{priceCents:tt>0?tt:void 0})}})})}),B&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:()=>J(null),children:s.jsx("div",{className:"bg-surface-secondary border border-border-default rounded-xl max-w-sm w-full mx-4 p-6 shadow-2xl",onClick:ue=>ue.stopPropagation(),children:s.jsx(zW,{onCancel:()=>J(null),onConfirm:(ue,tt,st,ye)=>{const je=B;J(null),yt(je,{visibility:ue,orgId:tt,priceCents:st,donationsEnabled:ye})}})})})]})})}function zW({onCancel:e,onConfirm:t}){const{t:n}=ft(["builder","common"]),[r,o]=k.useState("public"),[l,c]=k.useState([]),[d,m]=k.useState(""),[f,h]=k.useState(!1),[g,y]=k.useState(0),[x,w]=k.useState(!1);k.useEffect(()=>{r==="org"&&l.length===0&&(h(!0),lt.myOrgs().then(S=>{c(S.memberships),S.memberships.length>0&&m(S.memberships[0].id)}).catch(()=>{}).finally(()=>h(!1)))},[r,l.length]);const C=r==="public"||r==="unlisted",T=[{value:"public",icon:s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),s.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]}),label:n("visibility.public"),desc:n("visibility.publicDesc")},{value:"org",icon:s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M3 21h18"}),s.jsx("path",{d:"M9 8h1"}),s.jsx("path",{d:"M9 12h1"}),s.jsx("path",{d:"M9 16h1"}),s.jsx("path",{d:"M14 8h1"}),s.jsx("path",{d:"M14 12h1"}),s.jsx("path",{d:"M14 16h1"}),s.jsx("path",{d:"M5 21V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16"})]}),label:n("visibility.org"),desc:n("visibility.orgDesc")},{value:"unlisted",icon:s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),s.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),label:n("visibility.unlisted"),desc:n("visibility.unlistedDesc")}];return s.jsxs(s.Fragment,{children:[s.jsx("h3",{className:"text-base font-semibold text-fg-primary mb-4",children:n("visibility.label")}),s.jsx("div",{className:"space-y-2 mb-5",children:T.map(S=>s.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${r===S.value?"border-brand-500 bg-brand-500/10":"border-border-default hover:border-gray-600"}`,children:[s.jsx("input",{type:"radio",name:"visibility",checked:r===S.value,onChange:()=>o(S.value),className:"accent-brand-500"}),s.jsx("div",{className:"flex items-center gap-2 text-fg-secondary",children:S.icon}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium text-fg-primary",children:S.label}),s.jsx("div",{className:"text-[11px] text-fg-tertiary",children:S.desc})]})]},S.value))}),r==="org"&&s.jsxs("div",{className:"mb-5",children:[s.jsx("label",{className:"text-xs text-fg-secondary block mb-1.5",children:n("visibility.orgSelect")}),f?s.jsx("div",{className:"text-xs text-fg-tertiary py-2",children:"Loading..."}):l.length===0?s.jsx("div",{className:"text-xs text-fg-tertiary py-2",children:n("visibility.orgNone")}):s.jsx("select",{value:d,onChange:S=>m(S.target.value),className:"w-full text-sm px-3 py-2 rounded-lg bg-surface-elevated border border-border-default text-fg-primary",children:l.map(S=>s.jsx("option",{value:S.id,children:S.name},S.id))})]}),C&&s.jsxs("div",{className:"mb-5",children:[s.jsx("label",{className:"text-xs text-fg-secondary block mb-1.5",children:n("pricing.label")}),s.jsx("div",{className:"grid grid-cols-4 gap-2 mb-3",children:u6.map(S=>s.jsx("button",{type:"button",onClick:()=>y(S.cents),className:`text-sm px-2 py-2 rounded-lg border transition-colors ${g===S.cents?"border-brand-500 bg-brand-500/10 text-fg-primary":"border-border-default text-fg-secondary hover:border-gray-600"}`,children:S.label},S.cents))}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:x,onChange:S=>w(S.target.checked),className:"accent-brand-500"}),s.jsx("span",{className:"text-xs text-fg-secondary",children:n("pricing.enableTips")})]})]}),C&&s.jsx("div",{className:"mb-4 text-[11px] text-fg-tertiary rounded-lg border border-border-default px-3 py-2",children:n("pricing.reviewNote")}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{onClick:e,className:"flex-1 text-sm px-4 py-2 rounded-lg border border-border-default text-fg-secondary hover:text-fg-primary hover:border-gray-600 transition-colors",children:n("common:cancel")}),s.jsx("button",{onClick:()=>t(r,r==="org"?d:void 0,C&&g>0?g:void 0,C?x:void 0),disabled:r==="org"&&!d,className:"flex-1 text-sm px-4 py-2 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:n("shareMode.share")})]})]})}const u6=[{cents:0,label:"Free"},{cents:100,label:"$1"},{cents:500,label:"$5"},{cents:1e3,label:"$10"}];function BW({isUpdate:e,onCancel:t,onConfirm:n}){const{t:r}=ft(["builder","common"]),[o,l]=k.useState(0);return s.jsxs(s.Fragment,{children:[s.jsx("h3",{className:"text-base font-semibold text-fg-primary mb-4",children:r(e?"shareMode.titleUpdate":"shareMode.title")}),s.jsx("div",{className:"space-y-2 mb-5",children:u6.map(c=>s.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${o===c.cents?"border-brand-500 bg-brand-500/10":"border-border-default hover:border-gray-600"}`,children:[s.jsx("input",{type:"radio",name:"sharePrice",checked:o===c.cents,onChange:()=>l(c.cents),className:"accent-brand-500"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium text-fg-primary",children:c.label}),s.jsx("div",{className:"text-[11px] text-fg-tertiary",children:c.cents===0?r("shareMode.freeDesc"):r("shareMode.paidDesc")})]})]},c.cents))}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{onClick:t,className:"flex-1 text-sm px-4 py-2 rounded-lg border border-border-default text-fg-secondary hover:text-fg-primary hover:border-gray-600 transition-colors",children:r("common:cancel")}),s.jsx("button",{onClick:()=>n(o>0?"paid":"free",o),className:"flex-1 text-sm px-4 py-2 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors",children:r(e?"shareMode.update":"shareMode.share")})]})]})}const $W=Object.freeze(Object.defineProperty({__proto__:null,AgentBuilder:c6},Symbol.toStringTag,{value:"Module"}));async function d6(e,t){if(!t)return{items:e,highlighted:null,missing:!1};const n=e.find(r=>r.id===t);if(n)return{items:[n,...e.filter(r=>r.id!==t)],highlighted:n,missing:!1};try{const{item:r}=await lt.getItem(t);return r?{items:[r,...e],highlighted:r,missing:!1}:{items:e,highlighted:null,missing:!0}}catch{return{items:e,highlighted:null,missing:!0}}}function HW(e,t){const n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<Math.max(n.length,r.length);o++){const l=n[o]??0,c=r[o]??0;if(l>c)return!0;if(l<c)return!1}return!1}function T0(e,t){const n=e.i18n?.[t];return n?.displayName||n?.name||e.name}function z4(e,t){return e.i18n?.[t]?.description||e.description}const UW={manager:"bg-brand-500/15 text-brand-500",worker:"bg-blue-500/15 text-blue-600"};function FW({authUser:e,highlightItemId:t,onHighlightDone:n}={}){const{t:r,i18n:o}=ft(["store","common"]),l=o.language,[c,d]=k.useState(""),[m,f]=k.useState([]),[h,g]=k.useState([]),[y,x]=k.useState(null),[w,C]=k.useState({}),[T,S]=k.useState(!1),[E,j]=k.useState(!0),[L,I]=k.useState(new Map),[O,F]=k.useState(new Set),[V,X]=k.useState(null),[z,G]=k.useState(null),se=k.useCallback(async()=>{try{const[re,B]=await Promise.all([Ee.builder.artifacts.list().catch(()=>({artifacts:[]})),Ee.builder.artifacts.installed().catch(()=>({installed:{}}))]),J=new Map;for(const fe of re.artifacts){if(fe.type!=="agent")continue;const Se=!!B.installed[`agent/${fe.name}`];J.set(fe.name,{installed:Se,localVersion:fe.meta.version||void 0,localUpdatedAt:fe.updatedAt})}I(J)}catch{}},[]),ee=k.useCallback(async()=>{j(!0);try{const re=c?lt.search({type:"agent",q:c,limit:50}):Si(Tr.hubAgents)??lt.search({type:"agent",limit:50}),B=new URLSearchParams;c&&B.set("q",c);const J=fetch("/api/templates?"+B.toString()).then(W=>W.json()).catch(()=>({templates:[]})),[fe,Se]=await Promise.all([re.catch(()=>({items:[],total:0})),J,se(),lt.isAuthenticated()?lt.purchases.mine().then(W=>F(new Set(W.purchases.map(pe=>pe.itemId)))).catch(()=>{}):Promise.resolve()]),U=await d6(fe?.items??[],t);g(U.items),f(Array.isArray(Se.templates)?Se.templates:[]),U.missing&&n?.()}catch{f([]),g([])}finally{j(!1)}},[c,se,t,n]);k.useEffect(()=>{ee()},[ee]),k.useEffect(()=>{if(!y){C({});return}fetch(`/api/templates/${encodeURIComponent(y.id)}/files`,{credentials:"include"}).then(re=>re.json()).then(re=>C(re.files??{})).catch(()=>C({}))},[y]);const q=async(re,B,J)=>{try{const fe=await fetch("/api/templates/instantiate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({templateId:re,name:B,orgId:"default",teamId:J})});if(!fe.ok)throw new Error(`Failed: ${fe.status}`);S(!1),x(null)}catch(fe){G({title:r("common:create",{defaultValue:"Create"}),message:`Failed to create agent: ${fe}`,variant:"danger"})}};if(V)return s.jsx(Mi,{type:V.type,name:V.name,onBack:()=>X(null)});if(y){const re={type:"agent",name:y.id,displayName:T0(y,l),version:y.version,description:z4(y,l),author:y.author,category:y.category,tags:y.tags,icon:y.icon,files:w,agent:{roleName:y.roleId,agentRole:y.agentRole==="manager"?"manager":"worker"},dependencies:{skills:y.skills}},B=s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 p-5",children:[s.jsx("h3",{className:"text-xs text-fg-tertiary uppercase tracking-wider mb-3",children:r("agentStore.roleConfig")}),s.jsxs("div",{className:"space-y-2.5 text-sm",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-fg-tertiary w-20",children:r("agentStore.role")}),s.jsx("span",{className:"text-fg-secondary font-mono text-xs bg-surface-elevated px-2 py-0.5 rounded",children:y.roleId})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-fg-tertiary w-20",children:r("agentStore.position")}),s.jsx("span",{className:`px-2 py-0.5 rounded text-xs capitalize ${UW[y.agentRole]??""}`,children:y.agentRole})]})]})]}),s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 p-5",children:[s.jsx("h3",{className:"text-xs text-fg-tertiary uppercase tracking-wider mb-3",children:r("agentStore.skills")}),s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[y.skills.map(J=>s.jsx("span",{className:"px-2.5 py-1 text-xs bg-brand-500/10 text-brand-500 rounded-lg border border-brand-500/20",children:J},J)),y.skills.length===0&&s.jsx("span",{className:"text-xs text-fg-tertiary italic",children:r("agentStore.noSkills")})]})]})]}),y.starterTasks&&y.starterTasks.length>0&&s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 p-5",children:[s.jsx("h3",{className:"text-xs text-fg-tertiary uppercase tracking-wider mb-3",children:r("agentStore.starterTasks")}),s.jsx("div",{className:"space-y-2",children:y.starterTasks.map((J,fe)=>s.jsxs("div",{className:"flex items-start gap-3 bg-surface-elevated/50 rounded-lg p-3",children:[s.jsx("span",{className:`inline-block w-2 h-2 rounded-full shrink-0 mt-1 ${J.priority==="high"?"bg-red-400":J.priority==="medium"?"bg-amber-400":"bg-green-400"}`}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm text-fg-primary",children:J.title}),J.description&&s.jsx("div",{className:"text-xs text-fg-tertiary mt-0.5",children:J.description})]})]},fe))})]})]});return s.jsxs(s.Fragment,{children:[s.jsx(Mi,{type:"agent",name:y.id,onBack:()=>x(null),readOnly:!0,initialManifest:re,actionSlot:s.jsx("button",{onClick:()=>S(!0),className:"px-4 py-1.5 text-xs bg-brand-600 hover:bg-brand-500 text-white rounded-lg transition-colors font-medium",children:r("agentStore.hireAgent")}),contentSlot:B}),T&&s.jsx(B4,{template:y,lang:l,onClose:()=>S(!1),onHire:q}),z&&s.jsx(dr,{alertOnly:!0,variant:z.variant??"danger",title:z.title,message:z.message,onConfirm:()=>G(null),onCancel:()=>G(null)})]})}return s.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[s.jsxs("div",{"data-electron-drag":!0,className:"px-6 h-14 flex items-center justify-between shrink-0 gap-3",children:[s.jsx("h2",{className:"text-lg font-semibold",children:r("agentStore.title")}),s.jsx("input",{type:"text",placeholder:r("agentStore.searchPlaceholder"),value:c,onChange:re=>d(re.target.value),className:"px-3 py-1.5 bg-surface-elevated border border-border-default rounded-lg text-sm max-w-xs w-full focus:border-brand-500 focus:outline-none"})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-7 space-y-8",children:E?s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:6}).map((re,B)=>s.jsx("div",{className:"h-56 rounded-2xl skeleton"},B))}):m.length===0&&h.length===0?s.jsxs("div",{className:"text-center py-20",children:[s.jsx("div",{className:"text-4xl mb-4 opacity-30",children:"⧉"}),s.jsx("div",{className:"text-fg-secondary font-medium mb-1",children:c?r("agentStore.noResults",{search:c}):r("agentStore.noAgents")}),s.jsx("div",{className:"text-fg-tertiary text-sm",children:r(c?"agentStore.noResultsHint":"agentStore.noAgentsHint")})]}):s.jsxs(s.Fragment,{children:[m.length>0&&s.jsxs("section",{children:[s.jsxs("div",{className:"flex items-baseline gap-2 mb-3",children:[s.jsx("h3",{className:"section-title",children:r("agentStore.builtin")}),s.jsx("span",{className:"text-xs text-fg-tertiary",children:r("agentStore.available",{count:m.length})})]}),s.jsx(Ar,{columns:3,children:m.map(re=>s.jsx(ia,{type:"agent",name:T0(re,l),description:z4(re,l),seed:re.id,icon:re.icon,version:re.version,category:re.category,tags:re.tags,authorLabel:re.author,hideStats:!0,showTypeBadge:!1,cornerLabel:r("agentStore.builtin"),onClick:()=>x(re)},re.id))})]}),h.length>0&&s.jsxs("section",{children:[s.jsx("h3",{className:"section-title mb-3",children:r("agentStore.markusHub")}),s.jsx(Ar,{columns:3,children:h.map(re=>s.jsx(qW,{item:re,localInfo:L.get(Oc(re)),purchased:e0(re,O),onStatusChange:se,highlight:re.id===t,onHighlightDone:n,onViewDetail:B=>X({type:"agent",name:B})},re.id))})]})]})}),T&&y&&s.jsx(B4,{template:y,lang:l,onClose:()=>S(!1),onHire:q}),z&&s.jsx(dr,{alertOnly:!0,variant:z.variant??"danger",title:z.title,message:z.message,onConfirm:()=>G(null),onCancel:()=>G(null)})]})}function Oc(e,t){if(e.slug&&e.slug.trim())return e.slug.trim();const n=t&&typeof t.name=="string"?t.name.trim():"";return r0(n||e.name,"hub-pkg")}function Ni(e){return(async()=>{const t=await lt.download(e.id),n=t.name||e.name,r=t.config??{},o=Oc(e,r),l=t.itemType==="team"?"team":t.itemType==="skill"?"skill":"agent",c={type:"hub",hubItemId:e.id},d=(t.version||e.version||(typeof r.version=="string"?r.version:"")||"").trim()||void 0;if(t.files&&Object.keys(t.files).length>0)await Ee.builder.artifacts.import(l,o,t.files,c,d);else{const m={...r,...d?{version:d}:{},name:o,displayName:r.displayName||n,description:e.description,source:c};await Ee.builder.artifacts.save(l,m)}return await Ee.builder.artifacts.install(l,o),window.dispatchEvent(new CustomEvent("markus:data-changed")),n})()}async function Qg(e,t){t("checking"),await lt.ensureAuth();const n=await lt.purchases.checkout(e.id);if(n.alreadyOwned)return t("installing"),await Ni(e),"installed";try{if((await lt.creator.getBalance()).availableBalance>=(e.priceCents??0)){const l=await lt.purchases.payWithEarnings(e.id);if(l.ok||l.alreadyOwned)return t("installing"),await Ni(e),"installed"}}catch{}if(!n.checkoutUrl)throw new Error("No checkout URL");t("checkout_opened");const r=window.open(n.checkoutUrl,"_blank","noopener");return new Promise((o,l)=>{const c=setInterval(async()=>{const d=r?r.closed:!1;try{if((await lt.purchases.checkout(e.id)).alreadyOwned){clearInterval(c),t("installing");try{await Ni(e),o("installed")}catch(f){l(f)}return}}catch{}if(d){clearInterval(c);try{if((await lt.purchases.checkout(e.id)).alreadyOwned){t("installing"),await Ni(e),o("installed");return}}catch{}o("cancelled")}},2e3)})}function qW({item:e,localInfo:t,purchased:n,onStatusChange:r,highlight:o,onHighlightDone:l,onViewDetail:c}){const{t:d}=ft(["store"]),[m,f]=k.useState(!1),[h,g]=k.useState(""),y=k.useRef(null),[x,w]=k.useState(!1);k.useEffect(()=>{if(o&&y.current){y.current.scrollIntoView({behavior:"smooth",block:"center"}),w(!0);const V=setTimeout(()=>{w(!1)},4e3);return()=>clearTimeout(V)}},[o,l]);const C=t?.installed??!1,T=C&&e.version&&t?.localVersion&&HW(e.version,t.localVersion),S=(e.priceCents??0)>0,E=async V=>{if(V.stopPropagation(),!m){f(!0),g("");try{await Ni(e),g(T?d("card.upgraded"):d("card.installed")+"!"),r()}catch(X){const z=X instanceof Error?X.message:"";z.includes("402")||z.includes("Purchase required")?g(d("card.purchaseRequired")):g(d("card.failed"))}finally{f(!1)}}},j=async V=>{if(V.stopPropagation(),!m){f(!0),g("");try{await Qg(e,z=>{z==="checkout_opened"?g(d("card.waitingPurchase","Waiting for purchase...")):z==="installing"&&g(d("card.installing"))})==="installed"?(g(d("card.installed")+"!"),r()):g("")}catch(X){g(X instanceof Error?X.message:d("card.failed"))}finally{f(!1)}}},L=S?`$${((e.priceCents??0)/100).toFixed(2)}`:null,I=e.slug&&e.author?.username?`${lt.getUrl()}/@${encodeURIComponent(e.author.username)}/${encodeURIComponent(e.slug)}`:null,O=()=>{C&&c?c(Oc(e)):I&&window.open(I,"_blank","noopener,noreferrer")},F=s.jsxs(s.Fragment,{children:[T?s.jsx("button",{onClick:V=>{E(V)},disabled:m,className:"px-3 py-1.5 text-xs bg-amber-600 hover:bg-amber-500 text-white rounded-lg transition-colors disabled:opacity-50",children:m?d("card.upgrading"):d("card.upgrade",{version:e.version})}):C?s.jsxs("button",{onClick:V=>{E(V)},disabled:m,className:"px-3 py-1.5 text-xs bg-surface-elevated hover:bg-surface-overlay text-fg-secondary border border-border-default rounded-lg transition-colors disabled:opacity-50",children:[d("card.installed"),t?.localVersion?` v${t.localVersion}`:""]}):S&&!n?s.jsx("button",{onClick:V=>{j(V)},disabled:m,className:"px-3 py-1.5 text-xs bg-amber-600 hover:bg-amber-500 text-white rounded-lg transition-colors disabled:opacity-50 inline-flex items-center gap-1",children:m?h||d("card.installing"):s.jsxs(s.Fragment,{children:[d("card.buy","Buy")," ",L]})}):s.jsx("button",{onClick:V=>{E(V)},disabled:m,className:"px-3 py-1.5 text-xs bg-brand-600 hover:bg-brand-500 text-white rounded-lg transition-colors disabled:opacity-50",children:d(m?"card.installing":"card.install")}),h&&!(S&&!n)&&s.jsx("span",{className:`text-[10px] ${h===d("card.failed")||h===d("card.purchaseRequired")?"text-red-500":"text-green-600"}`,children:h})]});return s.jsx("div",{ref:y,className:x?"animate-pulse":"",children:s.jsx(ia,{type:"agent",showTypeBadge:!1,name:e.name,description:e.description,seed:e.slug||e.name,icon:e.icon||"bot",cover:e.thumbnailUrl,hubBase:lt.getUrl(),author:e.author,version:e.version,category:e.category,tags:e.tags,rating:parseFloat(e.avgRating)||0,ratingCount:e.ratingCount,downloadCount:e.downloadCount,priceCents:e.priceCents,currency:e.currency,installed:C,glowing:x,onClick:O,actions:F})})}function B4({template:e,lang:t,onClose:n,onHire:r}){const{t:o}=ft(["store"]),[l,c]=k.useState(`${T0(e,t)} Agent`),[d,m]=k.useState(""),[f,h]=k.useState([]),[g,y]=k.useState(!1);k.useEffect(()=>{fetch("/api/teams",{credentials:"include"}).then(w=>w.json()).then(w=>h(w.teams??[])).catch(()=>{})},[]);const x=async()=>{if(l.trim()){y(!0);try{await r(e.id,l.trim(),d||void 0)}finally{y(!1)}}};return s.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:n,children:s.jsxs("div",{className:"bg-surface-secondary border border-border-default rounded-xl p-6 w-[440px] shadow-2xl",onClick:w=>w.stopPropagation(),children:[s.jsx("div",{className:"flex items-center gap-3 mb-5",children:s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold",children:o("hireModal.title")}),s.jsx("p",{className:"text-xs text-fg-tertiary",children:o("hireModal.creating",{name:T0(e,t)})})]})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-fg-tertiary mb-1.5",children:o("hireModal.agentName")}),s.jsx("input",{type:"text",value:l,onChange:w=>c(w.target.value),className:"input-field",autoFocus:!0})]}),f.length>0&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-fg-tertiary mb-1.5",children:o("hireModal.assignTeam")}),s.jsxs("select",{value:d,onChange:w=>m(w.target.value),className:"input-field",children:[s.jsx("option",{value:"",children:o("hireModal.noTeam")}),f.map(w=>s.jsx("option",{value:w.id,children:w.name},w.id))]})]}),s.jsxs("div",{className:"bg-surface-elevated/50 rounded-lg p-3",children:[s.jsx("div",{className:"text-xs text-fg-tertiary mb-2 font-medium",children:o("hireModal.agentConfig")}),s.jsxs("div",{className:"grid grid-cols-2 gap-y-1.5 gap-x-4 text-xs",children:[s.jsx("div",{className:"text-fg-tertiary",children:o("hireModal.role")}),s.jsx("div",{className:"text-fg-secondary font-mono",children:e.roleId}),s.jsx("div",{className:"text-fg-tertiary",children:o("hireModal.position")}),s.jsx("div",{className:"text-fg-secondary capitalize",children:e.agentRole}),s.jsx("div",{className:"text-fg-tertiary",children:o("hireModal.skills")}),s.jsx("div",{className:"text-fg-secondary",children:e.skills.join(", ")||o("hireModal.none")})]})]})]}),s.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[s.jsx("button",{onClick:n,className:"btn-secondary",children:o("hireModal.cancel")}),s.jsx("button",{onClick:x,disabled:!l.trim()||g,className:"btn-primary",children:o(g?"hireModal.creating_progress":"hireModal.create")})]})]})})}function ih(e,t){const n=e.i18n?.[t];return n?.displayName||n?.name||e.name}function $4(e,t){return e.i18n?.[t]?.description||e.description}function H4(e,t,n){return e.i18n?.[n]?.members?.[t]||t}function GW(e,t){const n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<Math.max(n.length,r.length);o++){const l=n[o]??0,c=r[o]??0;if(l>c)return!0;if(l<c)return!1}return!1}function VW({highlightItemId:e,onHighlightDone:t}={}){const{t:n,i18n:r}=ft(["store","common"]),o=r.language,[l,c]=k.useState(""),[d,m]=k.useState([]),[f,h]=k.useState([]),[g,y]=k.useState(null),[x,w]=k.useState({}),[C,T]=k.useState(!0),[S,E]=k.useState(!1),[j,L]=k.useState(null),[I,O]=k.useState(new Map),[F,V]=k.useState(new Set),[X,z]=k.useState(null),G=k.useCallback(async()=>{try{const[q,re]=await Promise.all([Ee.builder.artifacts.list().catch(()=>({artifacts:[]})),Ee.builder.artifacts.installed().catch(()=>({installed:{}}))]),B=new Map;for(const J of q.artifacts){if(J.type!=="team")continue;const fe=!!re.installed[`team/${J.name}`];B.set(J.name,{installed:fe,localVersion:J.meta.version||void 0,localUpdatedAt:J.updatedAt})}O(B)}catch{}},[]),se=k.useCallback(async()=>{T(!0);try{const q=l?lt.search({type:"team",q:l,limit:50}):Si(Tr.hubTeams)??lt.search({type:"team",limit:50}),[re,B]=await Promise.all([q.catch(()=>({items:[],total:0})),Ee.teamTemplates.list(l||void 0).catch(()=>({templates:[]})),G(),lt.isAuthenticated()?lt.purchases.mine().then(fe=>V(new Set(fe.purchases.map(Se=>Se.itemId)))).catch(()=>{}):Promise.resolve()]),J=await d6(re?.items??[],e);h(J.items),m(B?.templates??[]),J.missing&&t?.()}catch{m([]),h([])}finally{T(!1)}},[l,G,e,t]);k.useEffect(()=>{se()},[se]),k.useEffect(()=>{if(!g){w({});return}fetch(`/api/team-templates/${encodeURIComponent(g.id)}/files`,{credentials:"include"}).then(q=>q.json()).then(q=>w(q.files??{})).catch(()=>w({}))},[g]);const ee=async q=>{E(!0),L(null);try{const B=(await Ee.teams.create(q.name,q.description)).team.id;let J,fe=0;const Se=[];for(const W of q.members){const pe=W.count??1;for(let P=0;P<pe;P++){const _e=W.name??`${q.name} Agent ${P+1}`,He=pe>1?`${_e} ${P+1}`:_e,Pe=W.roleName??W.templateId;try{const Ge=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({name:He,...Pe?{roleName:Pe}:{},orgId:"default",teamId:B,agentRole:W.role??"worker",skills:W.skills??[]})});if(Ge.ok){fe++;const ct=await Ge.json();W.role==="manager"&&!J&&(J=ct.agent?.id)}else{const ct=await Ge.json().catch(()=>({error:`HTTP ${Ge.status}`}));Se.push(`${He}: ${ct.error??Ge.statusText}`)}}catch(Ge){Se.push(`${He}: ${String(Ge)}`)}}}J&&await Ee.teams.update(B,{managerId:J,managerType:"agent"}).catch(()=>{});const U=Se.length>0?` (${Se.length} failed: ${Se[0]})`:"";L({ok:fe>0,message:`Team "${ih(q,o)}" deployed with ${fe} agent(s)${U}`})}catch(re){L({ok:!1,message:`Failed: ${re}`})}finally{E(!1)}};if(X)return s.jsx(Mi,{type:X.type,name:X.name,onBack:()=>z(null)});if(g){const q={...x};g.announcements&&(q["ANNOUNCEMENT.md"]=g.announcements),g.norms&&(q["NORMS.md"]=g.norms);const re={type:"team",name:g.id,displayName:ih(g,o),version:g.version,description:$4(g,o),author:g.author,category:g.category??"general",tags:g.tags??[],files:q,team:{members:g.members.map(J=>({name:H4(g,J.name??J.roleName??J.templateId??"Agent",o),role:J.role??"worker",roleName:J.roleName??J.templateId,count:J.count??1,skills:J.skills??[]}))}},B=s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 overflow-hidden",children:[s.jsx("div",{className:"px-5 py-3 border-b border-border-default bg-surface-elevated/30",children:s.jsx("h3",{className:"text-xs text-fg-tertiary uppercase tracking-wider",children:n("teamStore.teamComposition")})}),s.jsx("div",{className:"p-5 space-y-2",children:g.members.map((J,fe)=>{const Se=H4(g,J.name??J.roleName??J.templateId??"Agent",o);return s.jsxs("div",{className:"flex items-center gap-3 bg-surface-elevated/50 rounded-lg p-3",children:[s.jsx("div",{className:`w-9 h-9 rounded-lg flex items-center justify-center text-sm font-bold shrink-0 ${J.role==="manager"?"bg-amber-500/15 text-amber-400 ring-1 ring-amber-500/30":"bg-blue-500/15 text-blue-400 ring-1 ring-blue-500/30"}`,children:(Se[0]??"?").toUpperCase()}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-fg-primary font-medium",children:Se}),s.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] capitalize font-medium ${J.role==="manager"?"bg-amber-500/15 text-amber-400":"bg-blue-500/15 text-blue-400"}`,children:J.role??"worker"}),(J.count??1)>1&&s.jsxs("span",{className:"text-[10px] text-fg-muted",children:["×",J.count]})]}),(J.roleName||J.templateId)&&s.jsx("div",{className:"text-[10px] text-fg-tertiary font-mono mt-0.5",children:J.roleName??J.templateId})]}),J.skills&&J.skills.length>0&&s.jsxs("div",{className:"flex flex-wrap gap-1 shrink-0",children:[J.skills.slice(0,3).map(U=>s.jsx("span",{className:"px-1.5 py-0.5 text-[9px] bg-surface-elevated text-fg-muted rounded border border-border-default",children:U},U)),J.skills.length>3&&s.jsxs("span",{className:"text-[9px] text-fg-muted",children:["+",J.skills.length-3]})]})]},fe)})})]});return s.jsx(s.Fragment,{children:s.jsx(Mi,{type:"team",name:g.id,onBack:()=>{y(null),L(null)},readOnly:!0,initialManifest:re,contentSlot:B,actionSlot:s.jsxs(s.Fragment,{children:[j&&s.jsx("span",{className:`text-xs ${j.ok?"text-green-500":"text-red-500"}`,children:j.message}),s.jsx("button",{onClick:()=>{ee(g)},disabled:S,className:"px-4 py-1.5 text-xs bg-brand-600 hover:bg-brand-500 text-white rounded-lg transition-colors font-medium disabled:opacity-50",children:n(S?"teamStore.deploying":"teamStore.deployTeam")})]})})})}return s.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[s.jsxs("div",{"data-electron-drag":!0,className:"px-6 h-14 flex items-center justify-between shrink-0 gap-3",children:[s.jsx("h2",{className:"text-lg font-semibold",children:n("teamStore.title")}),s.jsx("input",{type:"text",placeholder:n("teamStore.searchPlaceholder"),value:l,onChange:q=>c(q.target.value),className:"px-3 py-1.5 bg-surface-elevated border border-border-default rounded-lg text-sm max-w-xs w-full focus:border-brand-500 focus:outline-none"})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-7 space-y-8",children:C?s.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:Array.from({length:4}).map((q,re)=>s.jsx("div",{className:"h-56 rounded-2xl skeleton"},re))}):d.length===0&&f.length===0?s.jsxs("div",{className:"text-center py-20",children:[s.jsx("div",{className:"text-4xl mb-4 opacity-30",children:"◉"}),s.jsx("div",{className:"text-fg-secondary font-medium mb-1",children:l?n("teamStore.noResults",{search:l}):n("teamStore.noTeams")}),s.jsx("div",{className:"text-fg-tertiary text-sm",children:n(l?"teamStore.noResultsHint":"teamStore.noTeamsHint")})]}):s.jsxs(s.Fragment,{children:[d.length>0&&s.jsxs("section",{children:[s.jsxs("div",{className:"flex items-baseline gap-2 mb-3",children:[s.jsx("h3",{className:"section-title",children:n("teamStore.builtin")}),s.jsx("span",{className:"text-xs text-fg-tertiary",children:n("teamStore.available",{count:d.length})})]}),s.jsx(Ar,{columns:2,children:d.map(q=>s.jsx(ia,{type:"team",name:ih(q,o),description:$4(q,o),seed:q.id,icon:q.icon||"users",version:q.version,category:q.category,tags:q.tags,authorLabel:q.author,hideStats:!0,showTypeBadge:!1,cornerLabel:n("teamStore.builtin"),onClick:()=>y(q)},q.id))})]}),f.length>0&&s.jsxs("section",{children:[s.jsx("h3",{className:"section-title mb-3",children:n("teamStore.markusHub")}),s.jsx(Ar,{columns:2,children:f.map(q=>s.jsx(KW,{item:q,localInfo:I.get(Oc(q)),purchased:e0(q,F),onStatusChange:G,highlight:q.id===e,onHighlightDone:t,onViewDetail:re=>z({type:"team",name:re})},q.id))})]})]})})]})}function KW({item:e,localInfo:t,purchased:n,onStatusChange:r,highlight:o,onHighlightDone:l,onViewDetail:c}){const{t:d}=ft(["store"]),[m,f]=k.useState(!1),[h,g]=k.useState(""),y=k.useRef(null),[x,w]=k.useState(!1);k.useEffect(()=>{if(o&&y.current){y.current.scrollIntoView({behavior:"smooth",block:"center"}),w(!0);const V=setTimeout(()=>{w(!1)},4e3);return()=>clearTimeout(V)}},[o,l]);const C=t?.installed??!1,T=C&&e.version&&t?.localVersion&&GW(e.version,t.localVersion),S=(e.priceCents??0)>0,E=S?`$${((e.priceCents??0)/100).toFixed(2)}`:null,j=async V=>{if(V.stopPropagation(),!m){f(!0),g("");try{await Ni(e),g(T?d("card.upgraded"):d("card.installed")+"!"),r()}catch(X){const z=X instanceof Error?X.message:"";z.includes("402")||z.includes("Purchase required")?g(d("card.purchaseRequired")):g(d("card.failed"))}finally{f(!1)}}},L=async V=>{if(V.stopPropagation(),!m){f(!0),g("");try{await Qg(e,z=>{z==="checkout_opened"?g(d("card.waitingPurchase","Waiting for purchase...")):z==="installing"&&g(d("card.installing"))})==="installed"?(g(d("card.installed")+"!"),r()):g("")}catch(X){g(X instanceof Error?X.message:d("card.failed"))}finally{f(!1)}}},I=e.slug&&e.author?.username?`${lt.getUrl()}/@${encodeURIComponent(e.author.username)}/${encodeURIComponent(e.slug)}`:null,O=()=>{C&&c?c(Oc(e)):I&&window.open(I,"_blank","noopener,noreferrer")},F=s.jsxs(s.Fragment,{children:[T?s.jsx("button",{onClick:V=>{j(V)},disabled:m,className:"px-3 py-1.5 text-xs bg-amber-600 hover:bg-amber-500 text-white rounded-lg transition-colors disabled:opacity-50",children:m?d("card.upgrading"):d("card.upgrade",{version:e.version})}):C?s.jsxs("button",{onClick:V=>{j(V)},disabled:m,className:"px-3 py-1.5 text-xs bg-surface-elevated hover:bg-surface-overlay text-fg-secondary border border-border-default rounded-lg transition-colors disabled:opacity-50",children:[d("card.installed"),t?.localVersion?` v${t.localVersion}`:""]}):S&&!n?s.jsx("button",{onClick:V=>{L(V)},disabled:m,className:"px-3 py-1.5 text-xs bg-amber-600 hover:bg-amber-500 text-white rounded-lg transition-colors disabled:opacity-50 inline-flex items-center gap-1",children:m?h||d("card.installing"):s.jsxs(s.Fragment,{children:[d("card.buy","Buy")," ",E]})}):s.jsx("button",{onClick:V=>{j(V)},disabled:m,className:"px-3 py-1.5 text-xs bg-brand-600 hover:bg-brand-500 text-white rounded-lg transition-colors disabled:opacity-50",children:d(m?"card.installing":"card.install")}),h&&s.jsx("span",{className:`text-[10px] ${h===d("card.failed")||h===d("card.purchaseRequired")?"text-red-500":"text-green-600"}`,children:h})]});return s.jsx("div",{ref:y,className:x?"animate-pulse":"",children:s.jsx(ia,{type:"team",showTypeBadge:!1,name:e.name,description:e.description,seed:e.slug||e.name,icon:e.icon||"users",cover:e.thumbnailUrl,hubBase:lt.getUrl(),author:e.author,version:e.version,category:e.category,tags:e.tags,rating:parseFloat(e.avgRating)||0,ratingCount:e.ratingCount,downloadCount:e.downloadCount,priceCents:e.priceCents,currency:e.currency,installed:C,glowing:x,onClick:O,actions:F})})}function oh(e,t){return e.i18n?.[t]?.displayName||e.name}function lh(e,t){return e.i18n?.[t]?.description||e.description||""}function m6(e,t){const n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<Math.max(n.length,r.length);o++){const l=n[o]??0,c=r[o]??0;if(l>c)return!0;if(l<c)return!1}return!1}const WW={development:"bg-blue-500/15 text-blue-600",devops:"bg-amber-500/15 text-amber-600",productivity:"bg-green-500/15 text-green-600",custom:"bg-gray-500/15 text-fg-secondary",browser:"bg-brand-500/15 text-brand-500",communication:"bg-green-500/15 text-green-600",data:"bg-brand-500/15 text-brand-500",platform:"bg-blue-500/15 text-blue-600","AI 智能":"bg-brand-500/15 text-brand-500",开发工具:"bg-blue-500/15 text-blue-600",效率提升:"bg-green-500/15 text-green-600",数据分析:"bg-brand-500/15 text-brand-500",内容创作:"bg-brand-500/15 text-brand-500",安全合规:"bg-red-500/15 text-red-500",通讯协作:"bg-green-500/15 text-green-600"};function YW({item:e,installedSkills:t,purchased:n,onMsg:r,onRefresh:o}){const{t:l}=ft(["store"]),[c,d]=k.useState(!1),m=e.name.toLowerCase().trim().replace(/\s+/g,"-").replace(/[\/\\:*?"<>|]+/g,"").replace(/-{2,}/g,"-").replace(/^-|-$/g,"")||"unnamed",f=t.find(S=>S.name===e.name||S.name===m||!!e.slug&&S.name===e.slug),h=!!f,g=h&&e.version&&f?.version&&m6(e.version,f.version),y=(e.priceCents??0)>0,[x,w]=k.useState(""),C=async()=>{if(!c){d(!0),w("");try{await Ni(e),r(g?`Upgraded ${e.name}`:`Installed ${e.name}`,"success"),o()}catch(S){const E=S instanceof Error?S.message:"";E.includes("402")||E.includes("Purchase required")?r(l("card.purchaseRequired"),"error"):r(l("card.failed"),"error")}finally{d(!1)}}},T=async()=>{if(!c){d(!0),w("");try{await Qg(e,E=>{E==="checkout_opened"?w(l("card.waitingPurchase","Waiting for purchase...")):E==="installing"&&w(l("card.installing"))})==="installed"&&(r(`Purchased & installed ${e.name}`,"success"),o()),w("")}catch(S){r(S instanceof Error?S.message:l("card.failed"),"error"),w("")}finally{d(!1)}}};if(g)return s.jsx("button",{onClick:()=>{C()},disabled:c,className:"px-2.5 py-1 text-[10px] bg-amber-600 hover:bg-amber-500 text-white rounded-lg disabled:opacity-50",children:c?l("card.upgrading"):l("card.upgrade",{version:e.version})});if(h)return s.jsxs("span",{className:"px-2.5 py-1 text-[10px] bg-surface-overlay text-fg-secondary rounded-lg",children:[l("card.installed"),f?.version?` (v${f.version})`:""]});if(y&&!n){const S=`$${((e.priceCents??0)/100).toFixed(2)}`;return s.jsx("span",{className:"inline-flex items-center gap-1.5",children:s.jsx("button",{onClick:()=>{T()},disabled:c,className:"px-2.5 py-1 text-[10px] bg-amber-600 hover:bg-amber-500 text-white rounded-lg disabled:opacity-50 inline-flex items-center gap-1",children:c?x||l("card.installing"):s.jsxs(s.Fragment,{children:[l("card.buy","Buy")," ",S]})})})}return s.jsx("button",{onClick:()=>{C()},disabled:c,className:"px-2.5 py-1 text-[10px] bg-brand-600 hover:bg-brand-500 text-white rounded-lg disabled:opacity-50",children:l(c?"card.installing":"card.install")})}function U4({item:e,installedSkills:t,purchased:n,onMsg:r,onRefresh:o,highlight:l,onHighlightDone:c,type:d="skill"}){const m=k.useRef(null),[f,h]=k.useState(!1);k.useEffect(()=>{if(l&&m.current){m.current.scrollIntoView({behavior:"smooth",block:"center"}),h(!0);const x=setTimeout(()=>{h(!1)},4e3);return()=>clearTimeout(x)}},[l,c]);const g=e.slug&&e.author?.username?`${lt.getUrl()}/@${encodeURIComponent(e.author.username)}/${encodeURIComponent(e.slug)}`:null,y=()=>{g&&window.open(g,"_blank","noopener,noreferrer")};return s.jsx("div",{ref:m,className:f?"animate-pulse":"",children:s.jsx(ia,{type:d,showTypeBadge:d!=="skill",name:e.name,description:e.description,seed:e.slug||e.name,icon:e.icon||Vd(e.slug||e.name,e.category),cover:e.thumbnailUrl,hubBase:lt.getUrl(),author:e.author,version:e.version,category:e.category,tags:e.tags,rating:parseFloat(e.avgRating)||0,ratingCount:e.ratingCount,downloadCount:e.downloadCount,priceCents:e.priceCents,currency:e.currency,onClick:y,actions:s.jsx(YW,{item:e,installedSkills:t,purchased:n,onMsg:r,onRefresh:o})})})}function XW({highlightItemId:e,onHighlightDone:t}={}){const{t:n,i18n:r}=ft(["store","common"]),o=r.language,l=Uo(),[c,d]=k.useState("skills"),[m,f]=k.useState(null),[h,g]=k.useState(new Set),[y,x]=k.useState([]),[w,C]=k.useState(null),[T,S]=k.useState([]),[E,j]=k.useState(0),[L,I]=k.useState(1),[O,F]=k.useState([]),[V,X]=k.useState(""),[z,G]=k.useState("score"),[se,ee]=k.useState(""),[q,re]=k.useState(!1),[B,J]=k.useState([]),[fe,Se]=k.useState(!1),[U,W]=k.useState([]),[pe,P]=k.useState(""),[_e,He]=k.useState(!1),[Pe,Ge]=k.useState([]),[ct,mt]=k.useState([]),[Ct,Mt]=k.useState(new Set),[Pt,Kt]=k.useState(!1),[yt,Ue]=k.useState(""),dt=[{id:"skills",labelKey:"skillStore.tabs.all"},{id:"skillhub",labelKey:"skillStore.tabs.skillhub"},{id:"skillssh",labelKey:"skillStore.tabs.skillssh"}],Nt=(H,te="success")=>{f({text:H,type:te}),setTimeout(()=>f(null),te==="error"?1e4:4e3)},bt=k.useCallback(async()=>{try{const H=await Ee.skills.list();x(H.skills)}catch{}},[]),Lt=k.useCallback(async()=>{Se(!0);try{const H=await Ee.skills.builtin();J(H.skills)}catch{}Se(!1)},[]),ue=k.useCallback(async H=>{re(!0);try{const te=await Ee.skills.registrySkillhub({q:H?.q,category:H?.category,page:H?.page??1,limit:24,sort:H?.sort??z});S(te.skills),j(te.total),te.categories?.length&&F(te.categories)}catch{}re(!1)},[z]),tt=k.useCallback(async H=>{He(!0);try{const te=await Ee.skills.registrySkillssh(H);W(te.skills)}catch{}He(!1)},[]),st=k.useCallback(async H=>{Kt(!0);try{const te=H?lt.search({type:"skill",q:H,limit:50}):Si(Tr.hubSkills)??lt.search({type:"skill",limit:50}),Ne=lt.search({subtype:"connector",q:H||void 0,limit:50}).catch(()=>({items:[]})),[Re,$e]=await Promise.all([te,Ne,lt.isAuthenticated()?lt.purchases.mine().then(be=>Mt(new Set(be.purchases.map(Ke=>Ke.itemId)))).catch(()=>{}):Promise.resolve()]);let Q=Re?.items??[],Z=$e?.items??[];if(e){const be=Q.some(Ie=>Ie.id===e),Ke=Z.some(Ie=>Ie.id===e);if(!be&&!Ke)try{const{item:Ie}=await lt.getItem(e);Ie?.subtype==="connector"?Z=[Ie,...Z]:Ie?Q=[Ie,...Q]:t?.()}catch{t?.()}else be&&(Q=[Q.find(Ye=>Ye.id===e),...Q.filter(Ye=>Ye.id!==e)]),Ke&&(Z=[Z.find(Ye=>Ye.id===e),...Z.filter(Ye=>Ye.id!==e)])}Ge(Q),mt(Z)}catch{}Kt(!1)},[e,t]);k.useEffect(()=>{bt(),Lt(),ue(),tt()},[]),k.useEffect(()=>{c==="skills"&&st(yt)},[c,yt,st]);const ye=async H=>{g(te=>new Set(te).add(H.name));try{const te=await Ee.skills.install({name:H.name,source:"skillhub",slug:H.slug,sourceUrl:H.homepage,description:H.description_zh??H.description,category:"custom",version:H.version});await bt(),Nt(`"${H.name}" installed (${te.method}) → ${te.path}`),window.dispatchEvent(new CustomEvent("markus:data-changed"))}catch{Nt(`Download failed for "${H.name}". You can try manually from: ${H.homepage}`,"error")}g(te=>{const Ne=new Set(te);return Ne.delete(H.name),Ne})},je=async H=>{g(te=>new Set(te).add(H.name));try{const te=await Ee.skills.install({name:H.name,source:"skillssh",sourceUrl:H.url,githubRepo:`${H.author}/${H.repo}`,githubSkillPath:H.name});await bt(),Nt(`"${H.name}" installed (${te.method}) → ${te.path}`),window.dispatchEvent(new CustomEvent("markus:data-changed"))}catch{Nt(`Download failed for "${H.name}". You can try manually from: ${H.url}`,"error")}g(te=>{const Ne=new Set(te);return Ne.delete(H.name),Ne})},Ae=async H=>{g(te=>new Set(te).add(H.name));try{const te=await Ee.skills.install({name:H.name,source:"builtin"});await bt(),await Lt(),Nt(`"${H.name}" installed (${te.method}) → ${te.path}`),window.dispatchEvent(new CustomEvent("markus:data-changed"))}catch(te){Nt(`Install failed for "${H.name}": ${te}`,"error")}g(te=>{const Ne=new Set(te);return Ne.delete(H.name),Ne})},oe=U.filter(H=>{if(!pe)return!0;const te=pe.toLowerCase();return H.name.toLowerCase().includes(te)||H.repo.toLowerCase().includes(te)});if(w){const H=w,te={};H.instructions&&(te["SKILL.md"]=H.instructions);const Ne={type:"skill",name:H.name,displayName:oh(H,o),version:H.version,description:lh(H,o),author:H.author??"",category:H.category??"general",tags:H.tags,files:te,skill:{skillFile:H.instructions?"SKILL.md":"",requiredPermissions:H.requiredPermissions,mcpServers:void 0,alwaysOn:!1}},Re=H.installed&&H.installedVersion&&m6(H.version,H.installedVersion)?s.jsx("button",{onClick:()=>{Ae(H)},disabled:h.has(H.name),className:"px-4 py-1.5 text-xs bg-amber-600 hover:bg-amber-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:h.has(H.name)?n("card.upgrading"):n("card.upgrade",{version:H.version})}):H.installed?s.jsxs("span",{className:"px-4 py-1.5 text-xs bg-green-500/10 text-green-500 rounded-lg border border-green-500/20 inline-flex items-center gap-1",children:[s.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}),n("card.installed"),H.installedVersion?` v${H.installedVersion}`:""]}):s.jsx("button",{onClick:()=>{Ae(H)},disabled:h.has(H.name),className:"px-4 py-1.5 text-xs bg-green-600 hover:bg-green-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:h.has(H.name)?n("card.installing"):n("card.install")}),$e=s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 p-5",children:[s.jsx("h3",{className:"text-xs text-fg-tertiary uppercase tracking-wider mb-3",children:n("skillStore.details")}),s.jsxs("div",{className:"space-y-2.5 text-sm",children:[H.category&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-fg-tertiary w-24",children:n("skillStore.category")}),s.jsx("span",{className:`px-2 py-0.5 rounded-full text-[10px] font-medium capitalize ${WW[H.category]??"bg-gray-500/15 text-fg-secondary"}`,children:H.category})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-fg-tertiary w-24",children:n("skillStore.version")}),s.jsx("span",{className:"text-fg-secondary font-mono text-xs",children:H.version})]}),H.hasMcpServers&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-fg-tertiary w-24",children:n("skillStore.integration")}),s.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] bg-purple-500/15 text-purple-400",children:"MCP"})]}),H.hasInstructions&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-fg-tertiary w-24",children:n("skillStore.instructions")}),s.jsx("span",{className:"text-green-500 text-xs",children:"✓"})]})]})]}),(H.requiredPermissions.length>0||H.tags.length>0)&&s.jsxs("div",{className:"space-y-4",children:[H.requiredPermissions.length>0&&s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 p-5",children:[s.jsx("h3",{className:"text-xs text-fg-tertiary uppercase tracking-wider mb-3",children:n("skillStore.permissions")}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:H.requiredPermissions.map(Q=>s.jsx("span",{className:"px-2.5 py-1 text-xs bg-amber-500/10 text-amber-500 rounded-lg border border-amber-500/20",children:Q},Q))})]}),H.tags.length>0&&s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 p-5",children:[s.jsx("h3",{className:"text-xs text-fg-tertiary uppercase tracking-wider mb-3",children:n("skillStore.tags")}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:H.tags.map(Q=>s.jsx("span",{className:"px-2.5 py-1 text-xs bg-surface-elevated text-fg-secondary rounded-lg border border-border-default/50",children:Q},Q))})]})]})]});return s.jsxs(s.Fragment,{children:[s.jsx(Mi,{type:"skill",name:H.name,onBack:()=>C(null),readOnly:!0,initialManifest:Ne,actionSlot:Re,contentSlot:$e}),m&&s.jsx("div",{className:`mx-7 mb-2 px-3 py-1.5 text-xs rounded-lg shrink-0 ${m.type==="error"?"bg-red-500/10 text-red-500":"bg-green-500/10 text-green-600"}`,children:m.text})]})}return s.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[s.jsxs("div",{className:`${l?"px-4":"px-6"} shrink-0`,children:[s.jsx("div",{"data-electron-drag":!0,className:"flex items-center h-14",children:s.jsx("h2",{className:"text-lg font-semibold",children:n("skillStore.title")})}),s.jsx("div",{className:`flex ${l?"flex-wrap":""} gap-1 pb-2 overflow-x-auto scrollbar-hide`,children:dt.map(H=>s.jsx("button",{onClick:()=>d(H.id),className:`px-3 py-1.5 text-xs rounded-lg transition-colors shrink-0 ${c===H.id?"bg-brand-600 text-white":"text-fg-secondary hover:text-fg-primary hover:bg-surface-elevated"}`,children:n(H.labelKey)},H.id))})]}),m&&s.jsx("div",{className:`mx-7 mt-2 px-3 py-1.5 text-xs rounded-lg shrink-0 ${m.type==="error"?"bg-red-500/10 text-red-500":"bg-green-500/10 text-green-600"}`,children:m.text}),c==="skills"&&(()=>{const H=yt.trim().toLowerCase(),te=H?B.filter($e=>oh($e,o).toLowerCase().includes(H)||lh($e,o).toLowerCase().includes(H)):B,Ne=fe&&Pt,Re=te.length===0&&Pe.length===0&&ct.length===0;return s.jsxs("div",{className:`flex-1 overflow-y-auto ${l?"p-4":"p-6"} space-y-8`,children:[s.jsx("div",{className:"flex items-center gap-2",children:s.jsx("input",{value:yt,onChange:$e=>Ue($e.target.value),placeholder:n("skillStore.searchMarkusHub"),className:`px-3 py-1.5 bg-surface-elevated border border-border-default rounded-lg text-sm text-fg-primary focus:border-brand-500 outline-none ${l?"flex-1 min-w-0":"w-72"}`})}),Ne&&Re?s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:6}).map(($e,Q)=>s.jsx("div",{className:"h-56 rounded-2xl skeleton"},Q))}):Re?s.jsxs("div",{className:"text-center text-fg-tertiary py-20",children:[s.jsx("div",{className:"text-4xl mb-3 opacity-30",children:"◇"}),s.jsx("div",{children:n("skillStore.noBuiltin")}),s.jsx("div",{className:"text-xs mt-1",children:n("skillStore.noBuiltinHint")})]}):s.jsxs(s.Fragment,{children:[te.length>0&&s.jsxs("section",{children:[s.jsxs("div",{className:"flex items-baseline gap-2 mb-3",children:[s.jsx("h3",{className:"section-title",children:n("skillStore.tabs.builtin")}),s.jsx("span",{className:"text-xs text-fg-tertiary",children:n("skillStore.builtinCount",{count:te.length})})]}),s.jsx(Ar,{columns:3,children:te.map($e=>s.jsx(ia,{type:"skill",name:oh($e,o),description:lh($e,o),seed:$e.name,icon:Vd($e.name,$e.category),version:$e.version,category:$e.category,tags:$e.tags,authorLabel:$e.author||void 0,installed:$e.installed,hideStats:!0,showTypeBadge:!1,cornerLabel:$e.installed?void 0:n("skillStore.tabs.builtin"),onClick:()=>C($e)},$e.name))})]}),Pe.length>0&&s.jsxs("section",{children:[s.jsx("h3",{className:"section-title mb-3",children:n("skillStore.tabs.markusHub")}),s.jsx(Ar,{columns:3,children:Pe.map($e=>s.jsx(U4,{item:$e,installedSkills:y,purchased:e0($e,Ct),onMsg:Nt,onRefresh:()=>{bt(),st(yt)},highlight:$e.id===e,onHighlightDone:t},$e.id))})]}),ct.length>0&&s.jsxs("section",{children:[s.jsxs("div",{className:"mb-3",children:[s.jsx("h3",{className:"section-title",children:n("tabs.connectors")}),s.jsx("p",{className:"text-xs text-fg-tertiary mt-0.5",children:n("connectorStore.emptyHint","连接器让智能体接入外部工具与服务 (MCP)")})]}),s.jsx(Ar,{columns:3,children:ct.map($e=>s.jsx(U4,{item:$e,type:"connector",installedSkills:y,purchased:e0($e,Ct),onMsg:Nt,onRefresh:()=>{bt(),st(yt)},highlight:$e.id===e,onHighlightDone:t},$e.id))})]})]})]})})(),c==="skillhub"&&s.jsxs("div",{className:`flex-1 overflow-y-auto ${l?"p-4":"p-6"}`,children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3 flex-wrap",children:[s.jsxs("select",{value:V,onChange:H=>{X(H.target.value),I(1),ue({q:se||void 0,category:H.target.value||void 0,page:1})},className:"px-2 py-1.5 bg-surface-elevated border border-border-default rounded-lg text-xs text-fg-secondary outline-none",children:[s.jsx("option",{value:"",children:n("skillStore.allCategories")}),O.map(H=>s.jsx("option",{value:H,children:H},H))]}),s.jsxs("select",{value:z,onChange:H=>{G(H.target.value),I(1),ue({q:se||void 0,category:V||void 0,page:1,sort:H.target.value})},className:"px-2 py-1.5 bg-surface-elevated border border-border-default rounded-lg text-xs text-fg-secondary outline-none",children:[s.jsx("option",{value:"score",children:n("skillStore.sortScore")}),s.jsx("option",{value:"downloads",children:n("skillStore.sortDownloads")}),s.jsx("option",{value:"stars",children:n("skillStore.sortStars")}),s.jsx("option",{value:"installs",children:n("skillStore.sortInstalls")})]}),!l&&s.jsx("span",{className:"text-xs text-fg-tertiary ml-auto",children:s.jsx("a",{href:"https://skillhub.tencent.com",target:"_blank",rel:"noopener noreferrer",className:"text-brand-500 hover:text-brand-500",children:n("skillStore.visitSite")})})]}),s.jsxs("div",{className:"flex items-center gap-2 mb-5",children:[s.jsx("input",{value:se,onChange:H=>ee(H.target.value),onKeyDown:H=>{H.key==="Enter"&&(I(1),ue({q:se||void 0,category:V||void 0,page:1}))},placeholder:n("skillStore.searchSkillhub"),className:"px-3 py-1.5 bg-surface-elevated border border-border-default rounded-lg text-sm text-fg-primary focus:border-brand-500 outline-none flex-1 min-w-0"}),s.jsx("button",{onClick:()=>{I(1),ue({q:se||void 0,category:V||void 0,page:1})},className:"px-3 py-1.5 bg-brand-600 hover:bg-brand-500 text-white text-xs rounded-lg shrink-0",children:"Search"})]}),q?s.jsx("div",{className:"text-center text-fg-tertiary py-20",children:s.jsx("div",{className:"animate-pulse",children:n("skillStore.loadingSkillhub")})}):T.length===0?s.jsxs("div",{className:"text-center text-fg-tertiary py-20",children:[s.jsx("div",{className:"text-4xl mb-3 opacity-30",children:"◎"}),s.jsx("div",{children:n("skillStore.noSkillhub")})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-xs text-fg-tertiary mb-3",children:n("skillStore.skillhubTotal",{count:E.toLocaleString()})}),s.jsx(Ar,{columns:3,children:T.map(H=>{const te=y.some(Ne=>Ne.name===H.name||Ne.name===H.slug);return s.jsx(ia,{type:"skill",name:H.name,description:H.description_zh??H.description??"",seed:H.slug,icon:Vd(H.slug||H.name,H.tags?.[0]),version:H.version,authorLabel:"SkillHub",showTypeBadge:!1,tags:H.tags,installed:te,hideStats:!0,onClick:()=>window.open(H.homepage,"_blank","noopener,noreferrer"),footerLeft:s.jsxs("span",{className:"flex items-center gap-2 text-[10px] text-fg-tertiary",children:[H.stars>0&&s.jsxs("span",{className:"text-amber-600",children:["★ ",H.stars.toLocaleString()]}),H.downloads>0&&s.jsxs("span",{children:[H.downloads>=1e4?`${(H.downloads/1e4).toFixed(1)}万`:H.downloads.toLocaleString()," ",n("skillStore.downloads")]})]}),actions:te?void 0:s.jsx("button",{onClick:()=>{ye(H)},disabled:h.has(H.name),className:"px-2.5 py-1 text-[10px] bg-brand-600 hover:bg-brand-500 text-white rounded-lg disabled:opacity-50",children:h.has(H.name)?"...":n("card.install")})},H.slug)})}),E>24&&s.jsxs("div",{className:"flex items-center justify-center gap-2 mt-6",children:[s.jsx("button",{disabled:L<=1,onClick:()=>{const H=L-1;I(H),ue({q:se||void 0,category:V||void 0,page:H})},className:"px-3 py-1.5 text-xs bg-surface-elevated text-fg-secondary rounded-lg hover:bg-surface-overlay disabled:opacity-30",children:n("skillStore.prevPage")}),s.jsx("span",{className:"text-xs text-fg-tertiary",children:n("skillStore.pageInfo",{current:L,total:Math.ceil(E/24)})}),s.jsx("button",{disabled:L>=Math.ceil(E/24),onClick:()=>{const H=L+1;I(H),ue({q:se||void 0,category:V||void 0,page:H})},className:"px-3 py-1.5 text-xs bg-surface-elevated text-fg-secondary rounded-lg hover:bg-surface-overlay disabled:opacity-30",children:n("skillStore.nextPage")})]})]})]}),c==="skillssh"&&s.jsxs("div",{className:`flex-1 overflow-y-auto ${l?"p-4":"p-6"}`,children:[s.jsxs("div",{className:`flex ${l?"flex-wrap":""} items-center gap-2 mb-5`,children:[s.jsx("input",{value:pe,onChange:H=>P(H.target.value),onKeyDown:H=>{H.key==="Enter"&&pe.trim()&&tt(pe)},placeholder:n("skillStore.searchSkillssh"),className:`px-3 py-1.5 bg-surface-elevated border border-border-default rounded-lg text-sm text-fg-primary focus:border-brand-500 outline-none ${l?"flex-1 min-w-0":"w-72"}`}),s.jsx("button",{onClick:()=>{pe.trim()&&tt(pe)},className:"px-3 py-1.5 bg-brand-600 hover:bg-brand-500 text-white text-xs rounded-lg shrink-0",children:"Search"}),!l&&s.jsx("span",{className:"text-xs text-fg-tertiary ml-auto",children:s.jsx("a",{href:"https://skills.sh",target:"_blank",rel:"noopener noreferrer",className:"text-brand-500 hover:text-brand-500",children:n("skillStore.visitSite")})})]}),_e?s.jsx("div",{className:"text-center text-fg-tertiary py-20",children:s.jsx("div",{className:"animate-pulse",children:n("skillStore.loadingSkillssh")})}):oe.length===0?s.jsxs("div",{className:"text-center text-fg-tertiary py-20",children:[s.jsx("div",{className:"text-4xl mb-3 opacity-30",children:"⬡"}),s.jsx("div",{children:n("skillStore.browseSkillssh")}),s.jsx("div",{className:"text-xs mt-1",children:n("skillStore.browseSkillsshHint")})]}):s.jsx(Ar,{columns:3,children:oe.map(H=>{const te=y.some(Ne=>Ne.name===H.name);return s.jsx(ia,{type:"skill",name:H.name,description:H.description||"",seed:`${H.author}-${H.name}`,icon:Vd(H.name),authorLabel:`${H.author}/${H.repo}`,showTypeBadge:!1,installed:te,hideStats:!0,cornerLabel:te?void 0:"skills.sh",onClick:()=>window.open(H.url,"_blank","noopener,noreferrer"),footerLeft:H.installs?s.jsxs("span",{className:"text-[10px] text-fg-tertiary",children:[H.installs," installs"]}):void 0,actions:te?void 0:s.jsx("button",{onClick:()=>{je(H)},disabled:h.has(H.name),className:"px-2.5 py-1 text-[10px] bg-brand-600 hover:bg-brand-500 text-white rounded-lg disabled:opacity-50",children:h.has(H.name)?"...":n("card.install")})},`${H.author}-${H.name}`)})})]})]})}const QW=["agent","team","skill","connector"];function ch({title:e,subtitle:t,onMore:n,moreLabel:r}){return s.jsxs("div",{className:"flex items-end justify-between mb-3",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"section-title",children:e}),t&&s.jsx("p",{className:"section-subtitle",children:t})]}),n&&s.jsxs("button",{className:"section-link",onClick:n,children:[r??"View all"," →"]})]})}function ZW({item:e,onOpen:t}){const n=Xo(e.subtype==="connector"?"connector":e.itemType),r=Xg(n,e.slug||e.name),o=Ei[n];return s.jsxs("button",{onClick:t,className:"group relative w-full overflow-hidden rounded-2xl text-left h-44 md:h-52",style:{background:r},children:[s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-black/55 via-black/20 to-transparent"}),s.jsx("svg",{className:"absolute -right-8 -bottom-10 opacity-20",width:"220",height:"220",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:s.jsx("path",{d:"M12 2l2.4 6.9L21 9l-5.4 4 2 7-5.6-4.1L6.4 20l2-7L3 9l6.6-.1z",fill:"white"})}),s.jsxs("div",{className:"relative h-full flex flex-col justify-end p-5 md:p-6",children:[s.jsxs("span",{className:"inline-flex w-fit items-center gap-1 rounded-full bg-white/20 backdrop-blur px-2.5 py-0.5 text-[11px] font-semibold text-white mb-2",children:["★ Featured · ",o.label]}),s.jsx("h2",{className:"text-xl md:text-2xl font-bold text-white drop-shadow-sm",children:e.name}),s.jsx("p",{className:"text-sm text-white/85 truncate max-w-lg mt-1",children:e.description}),s.jsxs("div",{className:"flex items-center gap-3 mt-3 text-white/80 text-xs",children:[s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx(C0,{name:e.author?.displayName,username:e.author?.username,avatarUrl:e.author?.avatarUrl,hubBase:lt.getUrl(),size:18}),e.author?.displayName||e.author?.username]}),s.jsxs("span",{children:["↓ ",Mo(e.downloadCount)]}),(e.priceCents??0)>0?s.jsxs("span",{className:"badge-paid",children:["$",((e.priceCents??0)/100).toFixed(0)]}):s.jsx("span",{className:"badge-free",children:"Free"})]})]})]})}function F4({items:e,onOpen:t}){return s.jsx(Ar,{columns:3,children:e.map(n=>s.jsx(ia,{type:n.subtype==="connector"?"connector":n.itemType,name:n.name,description:n.description,seed:n.slug||n.name,icon:n.icon,cover:n.thumbnailUrl,hubBase:lt.getUrl(),author:n.author,category:n.category,tags:n.tags,rating:parseFloat(n.avgRating)||0,ratingCount:n.ratingCount,downloadCount:n.downloadCount,priceCents:n.priceCents,currency:n.currency,onClick:()=>t(n)},n.id))})}function q4(){return s.jsx(Ar,{columns:3,children:Array.from({length:6}).map((e,t)=>s.jsx("div",{className:"h-64 rounded-2xl skeleton"},t))})}function JW({onOpenType:e}){const{t}=ft(["store","common"]),[n,r]=k.useState([]),[o,l]=k.useState(!0);k.useEffect(()=>{let g=!1;return(async()=>{l(!0);try{const y=await lt.search({limit:60,sort:"popular"});g||r(y.items??[])}catch{g||r([])}finally{g||l(!1)}})(),()=>{g=!0}},[]);const c=k.useMemo(()=>{const g=n.filter(x=>x.featured);return(g.length>0?g:n).slice(0,3)},[n]),d=k.useMemo(()=>[...n].sort((g,y)=>(y.trendingScore??y.downloadCount)-(g.trendingScore??g.downloadCount)).slice(0,10),[n]),m=k.useMemo(()=>[...n].sort((g,y)=>(y.createdAt||"").localeCompare(g.createdAt||"")).slice(0,10),[n]),f=k.useMemo(()=>{const g=new Map;for(const y of n){const x=y.author?.username||y.author?.id;if(!x)continue;const w=g.get(x)??{author:y.author,downloads:0,count:0};w.downloads+=y.downloadCount||0,w.count+=1,g.set(x,w)}return[...g.values()].sort((y,x)=>x.downloads-y.downloads).slice(0,6)},[n]),h=g=>e(Xo(g.subtype==="connector"?"connector":g.itemType),g.id);return s.jsxs("div",{className:"flex-1 overflow-y-auto px-5 md:px-7 py-5 space-y-8",children:[s.jsxs("div",{className:"hero-glow rounded-2xl border border-border-subtle bg-surface-secondary p-5 md:p-6",children:[s.jsx("h1",{className:"text-2xl font-bold text-gradient tracking-tight",children:t("discover.title","Markus 广场")}),s.jsx("p",{className:"text-sm text-fg-tertiary mt-1 max-w-2xl",children:t("discover.subtitle","发现社区共享的智能体、AI 小队、技能与连接器 — 由创作者共建的开放生态。")}),s.jsx("div",{className:"flex flex-wrap gap-2 mt-4",children:QW.map(g=>s.jsxs("button",{onClick:()=>e(g),className:`inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-xs font-medium text-white bg-gradient-to-r ${Ei[g].gradient} hover:opacity-90 transition-opacity`,children:[Ei[g].labelZh,s.jsx("span",{className:"opacity-70",children:Ei[g].label})]},g))})]}),o?s.jsx("div",{className:"h-52 rounded-2xl skeleton"}):c.length>0?s.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:c.map(g=>s.jsx(ZW,{item:g,onOpen:()=>h(g)},g.id))}):null,s.jsxs("section",{children:[s.jsx(ch,{title:t("discover.trending","热门趋势"),subtitle:t("discover.trendingSub","社区中下载与评分增长最快的资产")}),o?s.jsx(q4,{}):d.length>0?s.jsx(F4,{items:d,onOpen:h}):s.jsx(eY,{})]}),s.jsxs("section",{children:[s.jsx(ch,{title:t("discover.fresh","新鲜上架"),subtitle:t("discover.freshSub","来自创作者的最新作品")}),o?s.jsx(q4,{}):m.length>0?s.jsx(F4,{items:m,onOpen:h}):null]}),f.length>0&&s.jsxs("section",{children:[s.jsx(ch,{title:t("discover.topCreators","顶尖创作者"),subtitle:t("discover.topCreatorsSub","生态贡献榜")}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:f.map((g,y)=>s.jsxs("div",{className:"asset-card p-4 flex flex-col items-center text-center",children:[s.jsxs("div",{className:"relative",children:[s.jsx(C0,{name:g.author?.displayName,username:g.author?.username,avatarUrl:g.author?.avatarUrl,hubBase:lt.getUrl(),size:48,verified:y<3}),y<3&&s.jsx("span",{className:"absolute -top-1 -left-1 w-5 h-5 rounded-full bg-amber-400 text-black text-[10px] font-bold flex items-center justify-center ring-2 ring-surface-secondary",children:y+1})]}),s.jsx("div",{className:"text-sm font-semibold text-fg-primary truncate w-full mt-2",children:g.author?.displayName||g.author?.username}),s.jsxs("div",{className:"text-[11px] text-fg-tertiary mt-0.5",children:[g.count," 作品 · ↓ ",Mo(g.downloads)]})]},g.author?.username||y))})]})]})}function eY(){const{t:e}=ft(["store"]);return s.jsxs("div",{className:"text-center py-12 rounded-2xl border border-dashed border-border-default",children:[s.jsx("div",{className:"text-3xl mb-2 opacity-40",children:"✦"}),s.jsx("div",{className:"text-fg-secondary font-medium",children:e("discover.empty","生态正在成长中")}),s.jsx("div",{className:"text-fg-tertiary text-sm mt-1",children:e("discover.emptyHint","成为首批创作者,分享你的第一个资产")})]})}function Od(e,t,n){return e.i18n?.[n]?.[t]}function tY(){const{t:e,i18n:t}=ft(["store","common"]),n=Uo(),r=t.language,[o,l]=k.useState([]),[c,d]=k.useState({}),[m,f]=k.useState(new Set),[h,g]=k.useState(null),[y,x]=k.useState(!0),[w,C]=k.useState(""),[T,S]=k.useState("all"),[E,j]=k.useState(null),L=k.useCallback(async()=>{x(!0);try{const[F,V,X,z]=await Promise.all([Ee.builder.artifacts.list().catch(()=>({artifacts:[]})),Ee.builder.artifacts.installed().catch(()=>({installed:{}})),Ee.skills.updates().catch(()=>({updates:[],count:0})),Ee.skills.builtin().catch(()=>({skills:[]}))]),G={};for(const q of X.updates)G[q.name]={availableVersion:q.availableVersion,installedVersion:q.installedVersion,displayName:q.displayName,description:q.description};d(G);const se=F.artifacts.filter(q=>{const re=`${q.type}/${q.name}`;return!!V.installed[re]}),ee=new Set(se.filter(q=>q.type==="skill").map(q=>q.name));for(const q of z.skills)!q.installed||ee.has(q.name)||!(V.installed[`skill/${q.name}`]||G[q.name])&&!q.updateAvailable||!V.installed[`skill/${q.name}`]&&!G[q.name]||(se.push({type:"skill",name:q.name,meta:{displayName:q.i18n?.[r]?.displayName||q.name,description:q.i18n?.[r]?.description||q.description||"",version:q.installedVersion||q.version,author:q.author,category:q.category,tags:q.tags,i18n:q.i18n},path:"",updatedAt:""}),ee.add(q.name));for(const[q,re]of Object.entries(G))ee.has(q)||(se.push({type:"skill",name:q,meta:{displayName:re.displayName||q,description:re.description||"",version:re.installedVersion},path:"",updatedAt:""}),ee.add(q));l(se)}catch{}x(!1)},[r]);k.useEffect(()=>{L()},[L]),k.useEffect(()=>{const F=()=>{L()};return window.addEventListener("markus:data-changed",F),()=>window.removeEventListener("markus:data-changed",F)},[L]),k.useEffect(()=>{if(!h)return;const F=setTimeout(()=>g(null),3e3);return()=>clearTimeout(F)},[h]);const I=async(F,V)=>{if(!m.has(F)){f(X=>new Set(X).add(F));try{await Ee.skills.install({name:F,source:"builtin"});try{localStorage.removeItem("markus:template-updates-ack")}catch{}g({text:e("installedTab.updateSuccess",{name:F,version:V}),type:"success"}),window.dispatchEvent(new CustomEvent("markus:data-changed")),await L()}catch{g({text:e("installedTab.updateFailed",{name:F}),type:"error"})}f(X=>{const z=new Set(X);return z.delete(F),z})}},O=o.filter(F=>{if(T!=="all"&&F.type!==T)return!1;if(!w)return!0;const V=w.toLowerCase(),X=(Od(F.meta,"displayName",r)||F.meta.displayName||F.name).toLowerCase(),z=(Od(F.meta,"description",r)||F.meta.description||"").toLowerCase();return X.includes(V)||z.includes(V)}).sort((F,V)=>{const X=F.type==="skill"&&c[F.name]?1:0;return(V.type==="skill"&&c[V.name]?1:0)-X});return E?s.jsx(Mi,{type:E.type,name:E.name,onBack:()=>j(null)}):s.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[s.jsxs("div",{"data-electron-drag":!0,className:`${n?"px-4":"px-6"} h-14 flex items-center shrink-0 gap-3`,children:[s.jsx("h2",{className:"text-lg font-semibold",children:e("installedTab.title")}),Object.keys(c).length>0&&s.jsxs("span",{className:"px-2 py-0.5 text-[11px] font-medium rounded-md bg-amber-500/15 text-amber-600 border border-amber-500/25",children:[e("installedTab.updateAvailable")," · ",Object.keys(c).length]})]}),s.jsxs("div",{className:`flex flex-wrap items-center gap-2 ${n?"px-4":"px-6"} py-2 shrink-0`,children:[s.jsx("div",{className:"flex gap-1",children:["all","agent","team","skill"].map(F=>s.jsx("button",{onClick:()=>S(F),className:`px-3 py-1 text-xs rounded-md transition-colors ${T===F?"bg-brand-600 text-white":"text-fg-secondary hover:text-fg-primary hover:bg-surface-elevated"}`,children:e(`installedTab.filter${F==="all"?"All":F==="agent"?"Agents":F==="team"?"Teams":"Skills"}`)},F))}),s.jsx("div",{className:"flex-1 min-w-[120px]",children:s.jsx("input",{type:"text",placeholder:e("installedTab.searchPlaceholder"),value:w,onChange:F=>C(F.target.value),className:"px-3 py-1.5 bg-surface-elevated border border-border-default rounded-lg text-sm w-full focus:border-brand-500 focus:outline-none"})})]}),s.jsx("div",{className:`flex-1 overflow-y-auto ${n?"p-4":"p-7"}`,children:y?s.jsx("div",{className:"text-center text-fg-tertiary py-20 animate-pulse",children:e("installedTab.loading")}):O.length===0?s.jsxs("div",{className:"text-center py-20",children:[s.jsx("div",{className:"text-4xl mb-4 opacity-30",children:"⧉"}),s.jsx("div",{className:"text-fg-secondary font-medium mb-1",children:e("installedTab.noItems")}),s.jsx("div",{className:"text-fg-tertiary text-sm",children:e("installedTab.noItemsHint")})]}):s.jsx(Ar,{columns:3,children:O.map(F=>{const V=Od(F.meta,"displayName",r)||F.meta.displayName||F.name,X=Od(F.meta,"description",r)||F.meta.description||"",z=F.meta.version||"",G=F.meta.author||"",se=F.meta.tags??[],ee=F.meta.category||"",q=F.meta.icon,re=q&&/\.(png|jpe?g|gif|webp|svg)$/i.test(q)&&!q.startsWith("http")&&!q.startsWith("data:")&&!q.startsWith("/")?`/api/builder/artifacts/${F.type}s/${encodeURIComponent(F.name)}/${q}`:q,B=F.type==="skill"?c[F.name]:void 0;return s.jsx(ia,{type:F.type,name:V,description:X,seed:F.name,icon:re,author:null,authorLabel:G||void 0,version:B?B.installedVersion:z,category:ee,tags:se,installed:!B,hideStats:!0,cornerLabel:B?e("installedTab.updateAvailable"):void 0,onClick:()=>{F.path&&j({type:F.type,name:F.name})},actions:B?s.jsx("button",{type:"button",disabled:m.has(F.name),onClick:()=>{I(F.name,B.availableVersion)},className:"px-3 py-1.5 text-xs font-medium bg-amber-600 hover:bg-amber-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:m.has(F.name)?e("installedTab.updating"):e("installedTab.updateTo",{version:B.availableVersion})}):void 0},`${F.type}/${F.name}`)})})}),h&&s.jsx("div",{className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-50 px-4 py-2 rounded-lg text-sm shadow-lg ${h.type==="success"?"bg-emerald-600 text-white":"bg-red-600 text-white"}`,children:h.text})]})}const nY=50,rY=30;function aY(e,t,n,r){const o=k.useRef(0),l=k.useRef(0),c=k.useCallback(m=>{o.current=m.touches[0].clientX,l.current=m.touches[0].clientY},[]),d=k.useCallback(m=>{const f=m.changedTouches[0].clientX-o.current,h=m.changedTouches[0].clientY-l.current,g=Math.abs(f),y=Math.abs(h);if(g<nY||Math.atan2(y,g)*(180/Math.PI)>rY)return;if(r?.scrollContainerRef?.current){const C=r.scrollContainerRef.current,T=C.scrollLeft<=1,S=C.scrollLeft+C.clientWidth>=C.scrollWidth-1;if(f>0&&!T||f<0&&!S)return}const w=e.findIndex(C=>C.id===t);f<0&&w<e.length-1?n(e[w+1].id):f>0&&w>0?n(e[w-1].id):f>0&&w===0&&r?.onSwipeOutLeft?r.onSwipeOutLeft():f<0&&w===e.length-1&&r?.onSwipeOutRight&&r.onSwipeOutRight()},[e,t,n,r]);return{onTouchStart:c,onTouchEnd:d}}const sY=["builder","discover","agents","teams","skills","installed"],iY={agent:"agents",team:"teams",skill:"skills",connector:"skills"};function sg(e){return!!e&&sY.includes(e)}function G4(){const e=localStorage.getItem("markus_nav_installItem"),t=localStorage.getItem("markus_nav_storeTab");return{tab:sg(t)?t:"builder",installId:e}}function oY({authUser:e}){const{t}=ft(["nav","store","common"]),n=k.useMemo(()=>[{id:"builder",label:t("nav:tabs.create")},{id:"discover",label:t("nav:tabs.discover")},{id:"agents",label:t("nav:tabs.agents")},{id:"teams",label:t("nav:tabs.teams")},{id:"skills",label:t("nav:tabs.skills")},{id:"installed",label:t("nav:tabs.installed")}],[t]),[r]=k.useState(G4),[o,l]=k.useState(r.tab),[c,d]=k.useState(r.installId),m=aY(n,o,l);k.useEffect(()=>{const h=G4();h.installId&&(d(h.installId),sg(h.tab)&&l(h.tab),localStorage.removeItem("markus_nav_installItem"),localStorage.removeItem("markus_nav_storeTab"))},[]),k.useEffect(()=>{const h=g=>{const y=g.detail,x=y.params?.storeTab??localStorage.getItem("markus_nav_storeTab");sg(x)&&l(x);const w=y.params?.installItem??localStorage.getItem("markus_nav_installItem");w&&d(w),localStorage.removeItem("markus_nav_storeTab"),localStorage.removeItem("markus_nav_installItem")};return window.addEventListener("markus:navigate",h),()=>window.removeEventListener("markus:navigate",h)},[]);const f=(h,g)=>{g&&d(g),l(iY[h]??"agents")};return s.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",onTouchStart:m.onTouchStart,onTouchEnd:m.onTouchEnd,children:[s.jsxs("div",{className:"flex items-center shrink-0 overflow-x-auto scrollbar-hide",children:[s.jsx(Mw,{className:"ml-2"}),n.map(h=>s.jsx("button",{onClick:()=>l(h.id),className:`flex-1 min-w-fit px-3 py-2.5 text-xs font-medium text-center whitespace-nowrap transition-colors border-b-2 ${o===h.id?"border-brand-500 text-brand-500":"border-transparent text-fg-tertiary"}`,children:h.label},h.id))]}),s.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[o==="builder"&&s.jsx(c6,{authUser:e}),o==="discover"&&s.jsx(JW,{onOpenType:f}),o==="agents"&&s.jsx(FW,{authUser:e,highlightItemId:c,onHighlightDone:()=>d(null)}),o==="teams"&&s.jsx(VW,{highlightItemId:c,onHighlightDone:()=>d(null)}),o==="skills"&&s.jsx(XW,{highlightItemId:c,onHighlightDone:()=>d(null)}),o==="installed"&&s.jsx(tY,{})]})]})}const V4="usageType",uh="profile";function lY({onComplete:e,theme:t,onThemeChange:n,skipProfile:r,onProfileUpdated:o}){const{t:l}=ft(["onboarding","common"]),[c,d]=k.useState(0),[m,f]=k.useState(""),[h,g]=k.useState(""),[y,x]=k.useState(""),[w,C]=k.useState(""),[T,S]=k.useState(!1),[E,j]=k.useState(""),[L,I]=k.useState(!1),[O,F]=k.useState(null);k.useEffect(()=>{Ee.auth.me().then(({user:Ue})=>{Ue.name&&f(Ue.name),Ue.email&&g(Ue.email),Ue.avatarUrl&&F(Ue.avatarUrl);const dt=Ue.name||Ue.email?.split("@")[0]||"";dt&&G(Nt=>Nt||l("usageType.defaultOrgName",{name:dt}))}).catch(()=>{}),Ee.settings.getOrg().then(({org:Ue})=>{Ue?.name&&Ue.name!=="My Organization"&&G(Ue.name)}).catch(()=>{}),bn()&&Ee.hubOrgs.invitations().then(Ue=>{Ue.invitations?.length>0&&Se(Ue.invitations)}).catch(()=>{})},[]);const[V,X]=k.useState(null),[z,G]=k.useState(""),[se,ee]=k.useState(!1),[q,re]=k.useState(!1),[B,J]=k.useState(""),[fe,Se]=k.useState([]),[U,W]=k.useState(null),[pe,P]=k.useState(null),_e=async()=>{const Ue=z.trim();if(Ue){ee(!0),J("");try{if(await Ee.settings.updateOrg(Ue),bn()){const dt=await Ee.hubOrgs.mine(),Nt=dt.orgs?.find(bt=>bt.role==="owner")??dt.orgs?.[0];Nt?.id?await Ee.hubOrgs.update(Nt.id,{name:Ue}):await Ee.hubOrgs.create(Ue)}re(!0)}catch{J(l("usageType.orgNameSaveFailed"))}finally{ee(!1)}}},[He,Pe]=k.useState(!0),Ge=async()=>{if(j(""),!m.trim()){j(l("profile.errors.nameRequired"));return}if(!h.trim()){j(l("profile.errors.emailRequired"));return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(h.trim())){j(l("profile.errors.emailInvalid"));return}if(y&&y.length<6){j(l("profile.errors.passwordTooShort"));return}if(y&&y!==w){j(l("profile.errors.passwordMismatch"));return}S(!0);try{const{user:Ue}=await Ee.auth.updateProfile(m.trim(),h.trim());y&&await Ee.auth.changePassword("",y),o?.(Ue),I(!0)}catch{j(l("profile.errors.saveFailed"))}finally{S(!1)}},ct=[{value:"system",label:l("theme.system"),icon:"💻",desc:l("theme.systemDesc")},{value:"light",label:l("theme.light"),icon:"☀️",desc:l("theme.lightDesc")},{value:"dark",label:l("theme.dark"),icon:"🌊",desc:l("theme.darkDesc")},{value:"cyberpunk",label:l("theme.cyberpunk"),icon:"🔮",desc:l("theme.cyberpunkDesc")},{value:"mono",label:l("theme.mono"),icon:"⬛",desc:l("theme.monoDesc")}],mt=[{id:"welcome",title:l("welcome.title"),subtitle:l("welcome.subtitle"),content:s.jsx("p",{className:"text-fg-secondary text-sm leading-relaxed",children:s.jsx(g8,{i18nKey:"welcome.description",ns:"onboarding",components:{strong:s.jsx("strong",{className:"text-fg-primary"})}})})},{id:V4,title:l("usageType.title",{defaultValue:"How will you use Markus?"}),subtitle:l("usageType.subtitle",{defaultValue:"This helps us tailor your experience."}),content:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("button",{onClick:()=>{X("personal"),re(!0)},className:`flex flex-col items-center gap-3 rounded-xl border-2 p-5 transition-all text-left ${V==="personal"?"border-brand-500 bg-brand-500/10":"border-border-default hover:border-fg-tertiary bg-surface-elevated/30"}`,children:[s.jsx("span",{className:"text-2xl",children:"👤"}),s.jsxs("div",{children:[s.jsx("div",{className:"font-medium text-fg-primary text-sm text-center",children:l("usageType.personal",{defaultValue:"Personal"})}),s.jsx("div",{className:"text-[11px] text-fg-tertiary mt-1 text-center",children:l("usageType.personalDesc",{defaultValue:"Individual use with your own AI agents."})})]})]}),s.jsxs("button",{onClick:()=>{X("organization"),re(!1)},className:`flex flex-col items-center gap-3 rounded-xl border-2 p-5 transition-all text-left ${V==="organization"?"border-brand-500 bg-brand-500/10":"border-border-default hover:border-fg-tertiary bg-surface-elevated/30"}`,children:[s.jsx("span",{className:"text-2xl",children:"🏢"}),s.jsxs("div",{children:[s.jsx("div",{className:"font-medium text-fg-primary text-sm text-center",children:l("usageType.organization",{defaultValue:"Team & Enterprise"})}),s.jsx("div",{className:"text-[11px] text-fg-tertiary mt-1 text-center",children:l("usageType.organizationDesc",{defaultValue:"For teams sharing licenses and collaborating."})})]})]})]}),V==="organization"&&s.jsxs("div",{className:"space-y-4 mt-4",children:[fe.length>0&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"text-xs text-fg-tertiary font-medium",children:l("usageType.pendingInvitations")}),fe.map(Ue=>s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 rounded-xl border border-amber-500/20 bg-amber-500/5",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium text-fg-primary",children:Ue.orgName}),s.jsx("div",{className:"text-[11px] text-fg-tertiary",children:l("usageType.invitedBy",{name:Ue.invitedBy})})]}),s.jsx("button",{onClick:async()=>{W(Ue.orgId);try{await Ee.hubOrgs.acceptInvitation(Ue.orgId),P(Ue.orgId),re(!0)}catch{}finally{W(null)}},disabled:U===Ue.orgId||pe===Ue.orgId,className:"px-3 py-1.5 text-xs rounded-lg bg-brand-600 hover:bg-brand-500 disabled:opacity-40 text-white transition-colors",children:pe===Ue.orgId?l("usageType.accepted"):U===Ue.orgId?l("usageType.accepting"):l("usageType.acceptAndJoin")})]},Ue.orgId)),s.jsx("div",{className:"text-[11px] text-fg-tertiary text-center pt-1",children:l("usageType.orCreateNew")})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-fg-tertiary font-medium",children:l("usageType.orgNameLabel")}),s.jsx("input",{type:"text",value:z,onChange:Ue=>{G(Ue.target.value),re(!1),J("")},placeholder:l("usageType.orgNamePlaceholder"),className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors"})]}),B&&s.jsx("p",{className:"text-xs text-red-500",children:B}),s.jsx("button",{onClick:()=>{_e()},disabled:se||!z.trim()||q,className:"w-full px-4 py-2.5 bg-brand-600 hover:bg-brand-500 disabled:opacity-40 text-white text-sm rounded-xl transition-colors",children:l(se?"common:saving":q?"usageType.orgNameSaved":"usageType.setOrgName")})]})]})},{id:uh,title:l("profile.title"),subtitle:l("profile.subtitle"),content:L?s.jsxs("div",{className:"flex items-center gap-3 bg-green-500/10 border border-green-500/30 rounded-xl p-4",children:[s.jsx("span",{className:"text-green-600 text-lg",children:"✓"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium text-green-600",children:l("profile.saved")}),s.jsxs("div",{className:"text-xs text-fg-secondary mt-0.5",children:[m," · ",h]})]})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex justify-center",children:s.jsx(jw,{currentUrl:O,name:m,size:64,targetType:"user"})}),s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs text-fg-tertiary font-medium",children:[l("profile.nameLabel")," ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"text",value:m,onChange:Ue=>f(Ue.target.value),placeholder:l("profile.namePlaceholder"),className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors",autoFocus:!0})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs text-fg-tertiary font-medium",children:[l("profile.emailLabel")," ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"email",value:h,onChange:Ue=>g(Ue.target.value),placeholder:l("profile.emailPlaceholder"),className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-fg-tertiary font-medium",children:l("profile.newPasswordLabel")}),s.jsx("input",{type:"password",value:y,onChange:Ue=>x(Ue.target.value),placeholder:l("profile.newPasswordPlaceholder"),className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors"})]}),y&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-fg-tertiary font-medium",children:l("profile.confirmPasswordLabel")}),s.jsx("input",{type:"password",value:w,onChange:Ue=>C(Ue.target.value),placeholder:l("profile.confirmPasswordPlaceholder"),className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors"})]}),E&&s.jsx("div",{className:"px-3 py-2 bg-red-500/10 border border-red-500/30 rounded-lg text-xs text-red-500",children:E}),s.jsx("button",{onClick:()=>{Ge()},disabled:T||!m.trim()||!h.trim(),className:"w-full px-4 py-2.5 bg-brand-600 hover:bg-brand-500 disabled:opacity-40 text-white text-sm rounded-xl transition-colors",children:l(T?"common:saving":"profile.saveProfile")})]})},{id:"theme",title:l("theme.title"),subtitle:l("theme.subtitle"),content:s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"grid grid-cols-3 gap-3",children:ct.map(Ue=>s.jsxs("button",{onClick:()=>n(Ue.value),className:`flex flex-col items-center gap-2 rounded-xl border-2 p-5 transition-all ${t===Ue.value?"border-brand-500 bg-brand-500/10":"border-border-default hover:border-fg-tertiary bg-surface-elevated/30"}`,children:[s.jsx("span",{className:"text-2xl",children:Ue.icon}),s.jsx("span",{className:"text-sm font-medium text-fg-primary",children:Ue.label}),s.jsx("span",{className:"text-[11px] text-fg-tertiary leading-tight text-center",children:Ue.desc})]},Ue.value))}),s.jsxs("label",{className:"flex items-center gap-2.5 p-3 bg-surface-elevated/30 rounded-lg cursor-pointer group",children:[s.jsx("input",{type:"checkbox",checked:He,onChange:Ue=>Pe(Ue.target.checked),className:"accent-brand-500 shrink-0"}),s.jsx("span",{className:"text-[11px] text-fg-tertiary",children:l("done.telemetry")})]})]})}],Ct=r?mt.filter(Ue=>Ue.id!==uh):mt,Mt=Ct.findIndex(Ue=>Ue.id===V4),Pt=Ct.findIndex(Ue=>Ue.id===uh),Kt=()=>{c===Mt&&Mt>=0&&!V||c===Mt&&V==="organization"&&!q||c===Pt&&Pt>=0&&!L||(c<Ct.length-1?d(c+1):(fetch("/api/settings/telemetry",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:He})}).catch(()=>{}),e()))},yt=Ct[c];return s.jsx("div",{className:"min-h-dvh bg-surface-primary flex items-center justify-center p-4",children:s.jsx("div",{className:"w-full max-w-lg",children:s.jsxs("div",{className:"bg-surface-elevated rounded-2xl p-8",children:[s.jsx("div",{className:"flex gap-1.5 mb-8",children:Ct.map((Ue,dt)=>s.jsx("div",{className:`h-1 flex-1 rounded-full transition-colors ${dt<=c?"bg-brand-500":"bg-surface-elevated"}`},dt))}),s.jsx("h2",{className:"text-2xl font-bold text-fg-primary",children:yt.title}),s.jsx("p",{className:"text-sm text-fg-secondary mt-1 mb-6",children:yt.subtitle}),yt.content,s.jsxs("div",{className:"flex justify-between mt-8",children:[c>0?s.jsx("button",{onClick:()=>d(c-1),className:"px-4 py-2 text-sm text-fg-secondary hover:text-fg-primary transition-colors",children:l("common:back")}):s.jsx("span",{}),s.jsx("button",{onClick:Kt,disabled:Pt>=0&&c===Pt&&!L||Mt>=0&&c===Mt&&(!V||V==="organization"&&!q),className:`px-6 py-2.5 text-white text-sm rounded-xl transition-colors ${Pt>=0&&c===Pt&&!L||Mt>=0&&c===Mt&&(!V||V==="organization"&&!q)?"bg-brand-600/40 cursor-not-allowed":"bg-brand-600 hover:bg-brand-500"}`,children:c===Ct.length-1?l("getStarted"):l("common:next")})]})]})})})}const K4="markus:legal-consent",cY="https://markus.global";function uY({onLogin:e,hasOwner:t}){const{t:n,i18n:r}=ft("auth"),[o,l]=k.useState(null),[c,d]=k.useState(""),[m,f]=k.useState(!1),[h,g]=k.useState(""),[y,x]=k.useState(""),[w,C]=k.useState(!1),[T,S]=k.useState(!1),E=G=>{const se=(r.language||"").toLowerCase().startsWith("zh")?"?lang=zh":"";return`${cY}${G}${se}`},j=()=>{try{localStorage.setItem(K4,JSON.stringify({acceptedAt:new Date().toISOString(),terms:!0,privacy:!0}))}catch{}},L=()=>T?(j(),!0):(C(!1),requestAnimationFrame(()=>C(!0)),!1),I=async()=>{const G=bn(),se=sa();if(!G||!se){d(n("login.hubUnavailable"));return}const ee=await Ee.auth.hubLogin(G,se);if(window.markusDesktop?.clearPendingDeepLinkAuth?.(),ee.cloudAiReady===!1)try{sessionStorage.setItem("markus:cloud-ai-warning",ee.cloudAiError?n("login.cloudAiNotReady",{error:ee.cloudAiError}):n("login.cloudAiNotReadyGeneric"))}catch{}e(ee.user,ee.needsOnboarding??!1,{fromHub:!0})},O=async(G,se=!1)=>{if(!(!se&&!L())){d(""),l(G??"hub");try{if(se&&bn()&&sa()){await I();return}await Hr(G),await I()}catch(ee){const q=ee instanceof Error?ee.message:"";if(!q.includes("cancelled")){if(!se&&bn())return O(G,!0);d(q||n("login.hubUnavailable"))}}finally{l(null)}}},F=()=>{iD(),l(null),d("")};k.useEffect(()=>{const G=window.markusDesktop;if(!G?.peekPendingDeepLinkAuth&&!G?.consumePendingDeepLinkAuth)return;let se=!1;return(async()=>{const ee=G.peekPendingDeepLinkAuth?await G.peekPendingDeepLinkAuth():null;if(se||!ee)return;let q=!1;try{q=!!localStorage.getItem(K4)}catch{}if(!T&&!q){d(n("login.consentRequired"));return}q&&!T&&S(!0),j();const re=G.consumePendingDeepLinkAuth?await G.consumePendingDeepLinkAuth():ee;if(!(se||!re)){d(""),l("hub");try{if(!await sD(re)||!bn()||!sa()){d(n("login.hubUnavailable"));return}await I()}catch{d(n("login.hubUnavailable"))}finally{se||l(null)}}})().catch(()=>{}),()=>{se=!0}},[T]);const V=async G=>{if(G.preventDefault(),!(!h.trim()||!y)&&L()){d(""),l("local");try{const{user:se,needsOnboarding:ee}=await Ee.auth.login(h.trim(),y);e(se,ee??!1)}catch{d(n("login.invalidCredentials"))}finally{l(null)}}},X=n(t?"login.welcomeBack":"login.getStarted"),z="w-full flex items-center justify-center gap-3 h-11 px-4 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary font-medium transition-all hover:border-brand-400/60 hover:shadow-sm active:scale-[0.99] disabled:opacity-50 disabled:pointer-events-none";return s.jsxs("div",{className:"min-h-dvh bg-surface-primary flex flex-col items-center justify-center p-4 relative overflow-hidden",children:[s.jsxs("div",{className:"pointer-events-none absolute inset-0 overflow-hidden",children:[s.jsx("div",{className:"absolute -top-48 left-1/2 -translate-x-1/2 h-[42rem] w-[42rem] rounded-full bg-brand-500/20 blur-[120px]"}),s.jsx("div",{className:"absolute top-1/4 -left-40 h-[26rem] w-[26rem] rounded-full bg-brand-400/10 blur-[100px]"}),s.jsx("div",{className:"absolute -bottom-40 -right-32 h-[34rem] w-[34rem] rounded-full bg-brand-600/10 blur-[110px]"})]}),s.jsxs("div",{className:"w-full max-w-[26rem] relative z-10 flex-1 flex flex-col justify-center",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx("img",{src:"/logo.png",alt:"Markus",className:"w-16 h-16 mx-auto mb-4 rounded-2xl shadow-xl shadow-brand-900/20 ring-1 ring-border-default/40"}),s.jsx("div",{className:"text-[1.75rem] leading-none font-extrabold tracking-tight text-fg-primary mb-2",children:"Markus"}),s.jsx("div",{className:"text-sm text-fg-tertiary",children:X})]}),s.jsx("div",{className:"bg-surface-secondary/70 backdrop-blur-xl border border-border-default/80 rounded-3xl p-7 sm:p-8 shadow-2xl shadow-black/10",children:m?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-base font-semibold text-fg-primary",children:n("login.localTitle")}),s.jsx("div",{className:"text-xs text-fg-tertiary mt-0.5",children:n("login.localAccountHint")})]}),s.jsxs("form",{onSubmit:V,className:"space-y-3",children:[s.jsx("input",{type:"email",value:h,onChange:G=>g(G.target.value),autoComplete:"email",autoFocus:!0,placeholder:n("login.email"),className:"w-full px-4 h-11 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 focus:ring-2 focus:ring-brand-500/20 outline-none transition-all placeholder:text-fg-tertiary",required:!0}),s.jsx("input",{type:"password",value:y,onChange:G=>x(G.target.value),autoComplete:"current-password",placeholder:n("login.password"),className:"w-full px-4 h-11 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 focus:ring-2 focus:ring-brand-500/20 outline-none transition-all placeholder:text-fg-tertiary",required:!0}),c&&s.jsx("div",{className:"px-3 py-2 bg-red-500/10 border border-red-500/30 rounded-lg text-xs text-red-500",children:c}),!t&&s.jsx("p",{className:"text-[11px] text-fg-tertiary",children:n("login.defaultCredentials")}),s.jsx("button",{type:"submit",disabled:o==="local"||!h||!y,className:"w-full h-11 bg-brand-600 hover:bg-brand-500 disabled:opacity-50 text-white text-sm font-semibold rounded-xl transition-all shadow-md shadow-brand-900/30 hover:shadow-lg active:scale-[0.99]",children:n(o==="local"?"login.signingIn":"login.signIn")})]}),s.jsx("div",{className:"text-center",children:s.jsx("button",{onClick:()=>{f(!1),d("")},className:"text-xs text-fg-tertiary hover:text-fg-secondary transition-colors",children:n("login.backToHub")})})]}):s.jsxs("div",{className:"space-y-3",children:[s.jsxs("button",{onClick:()=>O("google"),disabled:!!o,className:z,children:[s.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",children:[s.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 01-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z"}),s.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),s.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),s.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),n(o==="google"?"login.connectingHub":"login.withGoogle")]}),s.jsxs("button",{onClick:()=>O("github"),disabled:!!o,className:z,children:[s.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),n(o==="github"?"login.connectingHub":"login.withGithub")]}),s.jsxs("button",{onClick:()=>O("email"),disabled:!!o,className:z,children:[s.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75"})}),n(o==="email"?"login.connectingHub":"login.withEmail")]}),o&&(o==="google"||o==="github"||o==="email"||o==="hub")&&s.jsxs("div",{className:"px-3 py-2.5 bg-brand-500/10 border border-brand-500/30 rounded-lg text-xs text-fg-secondary space-y-2",children:[s.jsx("p",{children:n("login.browserOpened")}),s.jsx("button",{type:"button",onClick:F,className:"text-brand-500 hover:text-brand-400 underline font-medium",children:n("login.cancelWaiting")})]}),c&&s.jsx("div",{className:"px-3 py-2 bg-red-500/10 border border-red-500/30 rounded-lg text-xs text-red-500",children:c}),s.jsxs("div",{className:"flex items-center gap-3 py-1 text-[11px] text-fg-tertiary",children:[s.jsx("span",{className:"h-px flex-1 bg-border-default"}),n("login.or"),s.jsx("span",{className:"h-px flex-1 bg-border-default"})]}),s.jsx("button",{onClick:()=>{f(!0),d("")},disabled:!!o,className:"w-full h-11 px-4 rounded-xl text-sm text-fg-secondary font-medium transition-all hover:bg-surface-elevated/70 disabled:opacity-50",children:n("login.useLocalAccount")})]})}),s.jsxs("label",{onAnimationEnd:()=>C(!1),className:`mt-5 flex items-start justify-center gap-2 text-[11px] leading-relaxed cursor-pointer select-none px-2 transition-colors ${w?"animate-shake text-fg-primary font-medium":"text-fg-tertiary"}`,children:[s.jsx("input",{type:"checkbox",checked:T,onChange:G=>{S(G.target.checked),G.target.checked&&C(!1)},className:"mt-0.5 h-3.5 w-3.5 shrink-0 accent-brand-600 cursor-pointer"}),s.jsxs("span",{className:"text-center",children:[n("login.consentPrefix")," ",s.jsx("a",{href:E("/terms"),target:"_blank",rel:"noopener noreferrer",className:"text-brand-500 hover:text-brand-400 underline",children:n("login.termsLink")})," ",n("login.consentAnd")," ",s.jsx("a",{href:E("/privacy"),target:"_blank",rel:"noopener noreferrer",className:"text-brand-500 hover:text-brand-400 underline",children:n("login.privacyLink")})]})]})]}),s.jsxs("div",{className:"relative z-10 flex flex-wrap items-center justify-center gap-x-5 gap-y-1 py-6 text-[11px] text-fg-tertiary",children:[s.jsx("a",{href:"https://markus.global",target:"_blank",rel:"noopener noreferrer",className:"hover:text-fg-secondary transition-colors",children:"markus.global"}),s.jsx("a",{href:"mailto:business@markus.global",className:"hover:text-fg-secondary transition-colors",children:n("login.contactSales")})]})]})}function dY({token:e,onComplete:t}){const{t:n}=ft("auth"),[r,o]=k.useState(null),[l,c]=k.useState(""),[d,m]=k.useState(""),[f,h]=k.useState(""),[g,y]=k.useState(!1),[x,w]=k.useState(!1),[C,T]=k.useState(!1);k.useEffect(()=>{Ee.auth.inviteInfo(e).then(E=>o(E)).catch(()=>T(!0))},[e]);const S=async E=>{if(E.preventDefault(),h(""),l.length<6){h(n("invite.passwordMinLength"));return}if(l!==d){h(n("invite.passwordsDoNotMatch"));return}y(!0);try{await Ee.auth.setup(e,l),w(!0),setTimeout(()=>{window.location.hash="",t()},2e3)}catch{h(n("invite.error"))}finally{y(!1)}};return s.jsxs("div",{className:"min-h-dvh bg-surface-primary flex items-center justify-center p-4 relative overflow-hidden",children:[s.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_top,_var(--tw-gradient-stops))] from-brand-950/50 via-transparent to-transparent"}),s.jsxs("div",{className:"w-full max-w-sm relative z-10",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx("img",{src:"/logo.png",alt:"Markus",className:"w-14 h-14 mx-auto mb-3 rounded-xl shadow-lg shadow-black/40"}),s.jsx("div",{className:"text-2xl font-extrabold tracking-tight text-fg-primary mb-1",children:"Markus"}),s.jsx("div",{className:"text-sm text-fg-tertiary",children:n("invite.subtitle")})]}),s.jsx("div",{className:"bg-surface-secondary/80 backdrop-blur-sm border border-border-default rounded-2xl p-8 space-y-5 shadow-2xl shadow-black/30",children:C?s.jsxs("div",{className:"text-center space-y-3",children:[s.jsx("div",{className:"text-red-500 text-3xl",children:"⚠"}),s.jsx("p",{className:"text-sm text-fg-secondary",children:n("invite.invalidLink")}),s.jsx("button",{onClick:()=>{window.location.hash="",t()},className:"text-sm text-brand-500 hover:text-brand-400",children:n("login.signIn")})]}):x?s.jsxs("div",{className:"text-center space-y-3",children:[s.jsx("div",{className:"text-green-500 text-3xl",children:"✓"}),s.jsx("p",{className:"text-sm text-fg-secondary",children:n("invite.setupComplete")})]}):r?s.jsxs("form",{onSubmit:S,className:"space-y-5",children:[s.jsx("h2",{className:"text-lg font-semibold text-fg-primary text-center",children:n("invite.greeting",{name:r.name})}),s.jsx("p",{className:"text-xs text-fg-tertiary text-center",children:r.email}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-fg-tertiary font-medium",children:n("invite.setPassword")}),s.jsx("input",{type:"password",value:l,onChange:E=>c(E.target.value),autoComplete:"new-password",autoFocus:!0,className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors",required:!0})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-fg-tertiary font-medium",children:n("invite.confirmPassword")}),s.jsx("input",{type:"password",value:d,onChange:E=>m(E.target.value),autoComplete:"new-password",className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors",required:!0})]}),f&&s.jsx("div",{className:"px-3 py-2 bg-red-500/10 border border-red-500/30 rounded-lg text-xs text-red-500",children:f}),s.jsx("button",{type:"submit",disabled:g||!l||!d,className:"w-full py-2.5 bg-brand-600 hover:bg-brand-500 disabled:opacity-50 text-white text-sm font-medium rounded-xl transition-all shadow-md shadow-brand-900/40 hover:shadow-lg hover:shadow-brand-900/50",children:n(g?"invite.settingUp":"invite.setupAccount")})]}):s.jsx("div",{className:"text-center text-fg-tertiary text-sm animate-pulse py-4",children:"Loading…"})})]})]})}function mY({onComplete:e,isFirstTime:t}){const{t:n}=ft("auth"),[r,o]=k.useState(""),[l,c]=k.useState(""),[d,m]=k.useState(""),[f,h]=k.useState(""),[g,y]=k.useState(!1),x=async w=>{if(w.preventDefault(),h(""),l.length<6){h(n("changePassword.passwordMinLength"));return}if(l!==d){h(n("changePassword.passwordsDoNotMatch"));return}y(!0);try{await Ee.auth.changePassword(r,l),e()}catch{h(n("changePassword.failedToChange"))}finally{y(!1)}};return s.jsxs("div",{className:"min-h-dvh bg-surface-primary flex items-center justify-center p-4 relative overflow-hidden",children:[s.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_top,_var(--tw-gradient-stops))] from-brand-950/50 via-transparent to-transparent"}),s.jsxs("div",{className:"w-full max-w-sm relative z-10",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx("img",{src:"/logo.png",alt:"Markus",className:"w-14 h-14 mx-auto mb-3 rounded-xl shadow-lg shadow-black/40"}),s.jsx("div",{className:"text-2xl font-extrabold tracking-tight text-fg-primary mb-1",children:"Markus"}),s.jsx("div",{className:"text-sm text-fg-tertiary",children:n("login.subtitle")})]}),s.jsxs("form",{onSubmit:x,className:"bg-surface-secondary/80 backdrop-blur-sm border border-border-default rounded-2xl p-8 space-y-5 shadow-2xl shadow-black/30",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold text-fg-primary text-center",children:n(t?"changePassword.setYourPassword":"changePassword.changePassword")}),t&&s.jsx("p",{className:"text-xs text-amber-600/80 text-center mt-2",children:n("changePassword.defaultPasswordWarning")})]}),!t&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-fg-tertiary font-medium",children:n("changePassword.currentPassword")}),s.jsx("input",{type:"password",value:r,onChange:w=>o(w.target.value),autoComplete:"current-password",className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-fg-tertiary font-medium",children:n("changePassword.newPassword")}),s.jsx("input",{type:"password",value:l,onChange:w=>c(w.target.value),autoComplete:"new-password",className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors",required:!0,minLength:6})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-fg-tertiary font-medium",children:n("changePassword.confirmNewPassword")}),s.jsx("input",{type:"password",value:d,onChange:w=>m(w.target.value),autoComplete:"new-password",className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors",required:!0})]}),f&&s.jsx("div",{className:"px-3 py-2 bg-red-500/10 border border-red-500/30 rounded-lg text-xs text-red-500",children:f}),s.jsx("button",{type:"submit",disabled:g||!l||!d,className:"w-full py-2.5 bg-brand-600 hover:bg-brand-500 disabled:opacity-50 text-white text-sm font-medium rounded-xl transition-colors",children:n(g?"changePassword.saving":t?"changePassword.setPasswordAndContinue":"changePassword.changePassword")})]})]})]})}function fY({side:e,defaultWidth:t,minWidth:n,maxWidth:r,collapsedWidth:o=0,storageKey:l}){const[c,d]=k.useState(()=>{try{const C=localStorage.getItem(`${l}_w`);if(C)return Math.max(n,Math.min(r,parseInt(C,10)))}catch{}return t}),[m,f]=k.useState(()=>{try{return localStorage.getItem(`${l}_c`)==="1"}catch{return!1}}),h=k.useRef(!1),g=k.useRef(n),y=k.useRef(r);g.current=n,y.current=r,k.useEffect(()=>{try{localStorage.setItem(`${l}_w`,String(c))}catch{}},[c,l]),k.useEffect(()=>{try{localStorage.setItem(`${l}_c`,m?"1":"0")}catch{}},[m,l]),k.useEffect(()=>{d(C=>Math.max(n,Math.min(r,C)))},[n,r]);const x=k.useCallback(C=>{C.preventDefault(),h.current=!0;const T=C.clientX,S=c,E=L=>{if(!h.current)return;const I=L.clientX-T;d(Math.max(g.current,Math.min(y.current,S+I)))},j=()=>{h.current=!1,document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",j),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",E),document.addEventListener("mouseup",j),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[c,e]),w=k.useCallback(()=>f(C=>!C),[]);return{width:m?o:c,rawWidth:c,collapsed:m,toggle:w,setCollapsed:f,setWidth:d,onResizeStart:x}}const fX=[{value:"system",label:"System"},{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"cyberpunk",label:"Cyberpunk"},{value:"mono",label:"Mono"}],ig="markus-theme";function W4(e){const t=document.documentElement;t.classList.remove("light","dark","cyberpunk","mono"),e==="light"?t.classList.add("light"):e==="dark"?t.classList.add("dark"):e==="cyberpunk"?t.classList.add("cyberpunk"):e==="mono"&&t.classList.add("mono")}function pY(){try{const e=localStorage.getItem(ig);if(e==="midnight")return localStorage.setItem(ig,"dark"),"dark";if(e==="light"||e==="dark"||e==="system"||e==="cyberpunk"||e==="mono")return e}catch{}return"system"}function hY(){const[e,t]=k.useState(pY),n=k.useCallback(r=>{t(r);try{localStorage.setItem(ig,r)}catch{}W4(r)},[]);return k.useEffect(()=>{W4(e)},[e]),{mode:e,setMode:n}}const Wd={agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]},gY={team:["agents","workflows","tasks","requirements","projects","deliverables"],work:["workflows","projects","requirements","tasks","agents","deliverables"],deliverables:["deliverables","agents","tasks","requirements","projects","workflows"]},bY=["agents","tasks","requirements","projects","deliverables","workflows"];let Y4="",X4="all",Q4=Wd,Z4=!1;function xY({onClose:e,currentPage:t}){const{t:n}=ft(["common","home","work"]);Ho(!0);const[r,o]=k.useState(Y4),[l,c]=k.useState(X4),[d,m]=k.useState(Q4),[f,h]=k.useState(!1),[g,y]=k.useState(Z4),[x,w]=k.useState(-1);k.useEffect(()=>{Y4=r},[r]),k.useEffect(()=>{X4=l},[l]),k.useEffect(()=>{Q4=d},[d]),k.useEffect(()=>{Z4=g},[g]);const C=k.useRef(null),T=k.useRef(void 0),S=k.useRef(null),E=k.useRef(null);k.useEffect(()=>{setTimeout(()=>{C.current?.focus(),C.current?.select()},100)},[]);const j=k.useCallback(async ee=>{if(!ee.trim()){m(Wd),y(!1),w(-1);return}h(!0),y(!0),w(-1);const q=ee.toLowerCase();try{const[re,B,J,fe,Se,U]=await Promise.allSettled([Ee.agents.list(),Ee.tasks.list({search:ee,pageSize:20}),Ee.requirements.list(),Ee.projects.list(),Ee.deliverables.search({q:ee,limit:20}),Ee.teams.list()]),W=re.status==="fulfilled"?re.value.agents.filter(Ge=>Ge.name?.toLowerCase().includes(q)||Ge.role?.toLowerCase().includes(q)):[],pe=B.status==="fulfilled"?B.value.tasks:[],P=J.status==="fulfilled"?J.value.requirements.filter(Ge=>Ge.title?.toLowerCase().includes(q)||Ge.description?.toLowerCase().includes(q)):[],_e=fe.status==="fulfilled"?fe.value.projects.filter(Ge=>Ge.name?.toLowerCase().includes(q)||Ge.description?.toLowerCase().includes(q)):[],He=Se.status==="fulfilled"?Se.value.results:[],Pe=[];if(U.status==="fulfilled"){const Ge=await Promise.allSettled(U.value.teams.map(ct=>Ee.workflows.list(ct.id)));for(const ct of Ge)if(ct.status==="fulfilled")for(const mt of ct.value.workflows)(mt.name.toLowerCase().includes(q)||(mt.displayName||"").toLowerCase().includes(q)||mt.description?.toLowerCase().includes(q))&&Pe.push(mt)}m({agents:W,tasks:pe,requirements:P,projects:_e,deliverables:He,workflows:Pe})}catch{m(Wd)}finally{h(!1)}},[]),L=ee=>{o(ee),T.current&&clearTimeout(T.current),T.current=setTimeout(()=>j(ee),400)},I=k.useCallback((ee,q)=>{e(),it.navigate(ee,q)},[e]),O=[{id:"all",label:n("common:all",{defaultValue:"全部"})},{id:"agents",label:n("common:agents",{defaultValue:"智能体"})},{id:"tasks",label:n("common:tasks",{defaultValue:"任务"})},{id:"requirements",label:n("common:requirements",{defaultValue:"需求"})},{id:"projects",label:n("common:projects",{defaultValue:"项目"})},{id:"deliverables",label:n("common:deliverables",{defaultValue:"交付物"})},{id:"workflows",label:n("common:workflows",{defaultValue:"工作流"})}],F=k.useMemo(()=>gY[t||""]||bY,[t]),V=k.useMemo(()=>{const ee=[],q=l==="all"?8:void 0,re=B=>{if(l!=="all"&&l!==B)return;const J=d[B].length;if(B==="workflows"){const fe=q?d.workflows.slice(0,q):d.workflows;for(const Se of fe)ee.push({id:Se.name,type:"workflow",page:de.WORK,params:{boardType:"workflows"}})}else{const fe=d[B],Se=q?fe.slice(0,q):fe;for(const U of Se)switch(B){case"agents":ee.push({id:U.id,type:"agent",page:de.TEAM,params:{agentId:U.id}});break;case"tasks":ee.push({id:U.id,type:"task",page:de.WORK,params:{openTask:U.id}});break;case"requirements":ee.push({id:U.id,type:"requirement",page:de.WORK,params:{openRequirement:U.id}});break;case"projects":ee.push({id:U.id,type:"project",page:de.WORK,params:{projectId:U.id}});break;case"deliverables":ee.push({id:U.id,type:"deliverable",page:de.DELIVERABLES,params:{openDeliverable:U.id}});break}}q&&J>q&&ee.push({id:`more_${B}`,type:"showMore",page:"",expandCategory:B,totalCount:J})};for(const B of F)re(B);return ee},[d,l,F]),X=k.useCallback(ee=>{if(ee.type==="showMore"&&ee.expandCategory){c(ee.expandCategory),w(-1);return}I(ee.page,ee.params)},[I]);k.useEffect(()=>{const ee=E.current;if(!ee||x<0)return;const q=ee.querySelector(`[data-idx="${x}"]`);q&&q.scrollIntoView({block:"nearest"})},[x]);const z=k.useCallback(ee=>{if(ee.key==="Escape"){e();return}if(ee.key==="Tab"){ee.preventDefault();const B=O.map(Se=>Se.id),J=B.indexOf(l),fe=ee.shiftKey?J<=0?B.length-1:J-1:J>=B.length-1?0:J+1;c(B[fe]),w(-1);return}const q=ee.ctrlKey&&ee.key==="n"||ee.key==="ArrowDown",re=ee.ctrlKey&&ee.key==="p"||ee.key==="ArrowUp";if(q||re){ee.preventDefault(),w(B=>{const J=V.length-1;return J<0?-1:q?B>=J?0:B+1:B<=0?J:B-1});return}ee.key==="Enter"&&(ee.preventDefault(),x>=0&&x<V.length&&X(V[x]))},[e,V,x,X,O,l]);k.useEffect(()=>(document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)),[z]);const G=V.length>0;let se=0;return s.jsx("div",{ref:S,className:"fixed inset-0 bg-black/50 flex items-start justify-center z-50 pt-[8vh]",onClick:ee=>{ee.target===S.current&&e()},children:s.jsxs("div",{className:"bg-surface-primary border border-border-default rounded-2xl shadow-2xl w-full max-w-3xl max-h-[78vh] flex flex-col overflow-hidden animate-fadeIn",children:[s.jsxs("div",{className:"shrink-0 px-5 pt-4 pb-3 border-b border-border-default space-y-3",children:[s.jsxs("div",{className:"relative",children:[s.jsxs("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg-tertiary",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"11",cy:"11",r:"8"}),s.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),s.jsx("input",{ref:C,value:r,onChange:ee=>L(ee.target.value),placeholder:n("common:search"),className:"w-full bg-surface-elevated border border-border-default rounded-xl pl-9 pr-9 py-2.5 text-sm text-fg-primary placeholder:text-fg-tertiary focus:border-brand-500 focus:outline-none transition-colors"}),r&&s.jsx("button",{onClick:()=>{o(""),m(Wd),y(!1),w(-1),C.current?.focus()},className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg-tertiary hover:text-fg-secondary",children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),s.jsx("div",{className:"flex gap-1 overflow-x-auto scrollbar-hide",children:O.map(ee=>s.jsx("button",{onClick:()=>{c(ee.id),w(-1)},className:`px-3 py-1.5 text-xs rounded-lg whitespace-nowrap transition-colors ${l===ee.id?"bg-brand-600 text-white":"bg-surface-elevated text-fg-secondary hover:text-fg-primary"}`,children:ee.label},ee.id))})]}),s.jsxs("div",{ref:E,className:"flex-1 overflow-y-auto px-5 py-3",children:[f&&s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx("div",{className:"text-fg-tertiary text-sm animate-pulse",children:n("common:loading")})}),!f&&g&&!G&&s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[s.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-fg-tertiary mb-2",children:[s.jsx("circle",{cx:"11",cy:"11",r:"8"}),s.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),s.jsx("p",{className:"text-sm text-fg-tertiary",children:n("common:noResults",{defaultValue:"没有找到相关结果"})})]}),!f&&G&&s.jsx("div",{className:"space-y-4",children:F.map(ee=>{if(l!=="all"&&l!==ee)return null;const q=l==="all"?8:void 0,re=B=>{const J=se++,fe=B==="agents"?d.agents.length:B==="tasks"?d.tasks.length:B==="requirements"?d.requirements.length:B==="projects"?d.projects.length:B==="workflows"?d.workflows.length:d.deliverables.length;return s.jsxs("button",{"data-idx":J,onClick:()=>{c(B),w(-1)},className:`mt-1 w-full text-xs py-1.5 rounded-lg transition-colors ${J===x?"bg-brand-600/15 ring-1 ring-brand-500/40 text-brand-500":"text-brand-500 hover:text-brand-400 hover:bg-surface-overlay"}`,children:[n("common:showAll",{defaultValue:"查看全部"})," (",fe,")"]})};return ee==="agents"&&d.agents.length>0?s.jsxs("section",{children:[s.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:n("common:agents",{defaultValue:"智能体"})}),s.jsx("div",{className:"space-y-0.5",children:(q?d.agents.slice(0,q):d.agents).map(B=>{const J=se++;return s.jsxs("button",{"data-idx":J,onClick:()=>I(de.TEAM,{agentId:B.id}),className:`w-full flex items-center gap-3 px-3 py-2 rounded-xl transition-colors text-left ${J===x?"bg-brand-600/15 ring-1 ring-brand-500/40":"hover:bg-surface-overlay"}`,children:[s.jsx(Hs,{name:B.name||"Agent",avatarUrl:B.avatarUrl,size:28}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-fg-primary truncate",children:B.name}),s.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:B.role||B.status})]}),s.jsx(yY,{status:B.status})]},B.id)})}),q&&d.agents.length>q&&re("agents")]},"agents"):ee==="tasks"&&d.tasks.length>0?s.jsxs("section",{children:[s.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:n("common:tasks",{defaultValue:"任务"})}),s.jsx("div",{className:"space-y-0.5",children:(q?d.tasks.slice(0,q):d.tasks).map(B=>{const J=se++;return s.jsxs("button",{"data-idx":J,onClick:()=>I(de.WORK,{openTask:B.id}),className:`w-full flex items-center gap-3 px-3 py-2 rounded-xl transition-colors text-left ${J===x?"bg-brand-600/15 ring-1 ring-brand-500/40":"hover:bg-surface-overlay"}`,children:[s.jsx(vY,{status:B.status}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-sm text-fg-primary truncate",children:B.title}),s.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[B.status," · ",B.priority||""]})]})]},B.id)})}),q&&d.tasks.length>q&&re("tasks")]},"tasks"):ee==="requirements"&&d.requirements.length>0?s.jsxs("section",{children:[s.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:n("common:requirements",{defaultValue:"需求"})}),s.jsx("div",{className:"space-y-0.5",children:(q?d.requirements.slice(0,q):d.requirements).map(B=>{const J=se++;return s.jsxs("button",{"data-idx":J,onClick:()=>I(de.WORK,{openRequirement:B.id}),className:`w-full flex items-center gap-3 px-3 py-2 rounded-xl transition-colors text-left ${J===x?"bg-brand-600/15 ring-1 ring-brand-500/40":"hover:bg-surface-overlay"}`,children:[s.jsx("div",{className:`w-7 h-7 rounded-lg flex items-center justify-center shrink-0 ${B.status==="approved"?"text-green-500 bg-green-500/15":B.status==="pending"?"text-amber-500 bg-amber-500/15":B.status==="rejected"?"text-red-500 bg-red-500/15":"text-fg-tertiary bg-surface-elevated"}`,children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),s.jsx("polyline",{points:"14 2 14 8 20 8"}),s.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),s.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-sm text-fg-primary truncate",children:B.title}),s.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[B.status," · ",B.priority||""]})]})]},B.id)})}),q&&d.requirements.length>q&&re("requirements")]},"requirements"):ee==="projects"&&d.projects.length>0?s.jsxs("section",{children:[s.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:n("common:projects",{defaultValue:"项目"})}),s.jsx("div",{className:"space-y-0.5",children:(q?d.projects.slice(0,q):d.projects).map(B=>{const J=se++;return s.jsxs("button",{"data-idx":J,onClick:()=>I(de.WORK,{projectId:B.id}),className:`w-full flex items-center gap-3 px-3 py-2 rounded-xl transition-colors text-left ${J===x?"bg-brand-600/15 ring-1 ring-brand-500/40":"hover:bg-surface-overlay"}`,children:[s.jsx("div",{className:"w-7 h-7 rounded-lg bg-brand-500/15 flex items-center justify-center shrink-0",children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-brand-500",children:s.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-sm text-fg-primary truncate",children:B.name}),B.description&&s.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:B.description})]})]},B.id)})}),q&&d.projects.length>q&&re("projects")]},"projects"):ee==="deliverables"&&d.deliverables.length>0?s.jsxs("section",{children:[s.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:n("common:deliverables",{defaultValue:"交付物"})}),s.jsx("div",{className:"space-y-0.5",children:(q?d.deliverables.slice(0,q):d.deliverables).map(B=>{const J=se++;return s.jsxs("button",{"data-idx":J,onClick:()=>I(de.DELIVERABLES,{openDeliverable:B.id}),className:`w-full flex items-center gap-3 px-3 py-2 rounded-xl transition-colors text-left ${J===x?"bg-brand-600/15 ring-1 ring-brand-500/40":"hover:bg-surface-overlay"}`,children:[s.jsx("div",{className:"w-7 h-7 rounded-lg bg-purple-500/15 flex items-center justify-center shrink-0",children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-purple-500",children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),s.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-sm text-fg-primary truncate",children:B.title}),s.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[B.type," · ",B.status]})]})]},B.id)})}),q&&d.deliverables.length>q&&re("deliverables")]},"deliverables"):ee==="workflows"&&d.workflows.length>0?s.jsxs("section",{children:[s.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:n("common:workflows",{defaultValue:"工作流"})}),s.jsx("div",{className:"space-y-0.5",children:(q?d.workflows.slice(0,q):d.workflows).map(B=>{const J=se++;return s.jsxs("button",{"data-idx":J,onClick:()=>I(de.WORK,{boardType:"workflows"}),className:`w-full flex items-center gap-3 px-3 py-2 rounded-xl transition-colors text-left ${J===x?"bg-brand-600/15 ring-1 ring-brand-500/40":"hover:bg-surface-overlay"}`,children:[s.jsx("div",{className:"w-7 h-7 rounded-lg bg-teal-500/15 flex items-center justify-center shrink-0",children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-teal-500",children:[s.jsx("circle",{cx:"12",cy:"12",r:"3"}),s.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-sm text-fg-primary truncate",children:B.displayName||B.name}),s.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[B.stepCount," steps · v",B.version]})]})]},B.name)})}),q&&d.workflows.length>q&&re("workflows")]},"workflows"):null})}),!f&&!g&&s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[s.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-fg-tertiary mb-2",children:[s.jsx("circle",{cx:"11",cy:"11",r:"8"}),s.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),s.jsx("p",{className:"text-sm text-fg-tertiary",children:n("common:searchHint",{defaultValue:"输入关键词搜索"})})]})]}),s.jsxs("div",{className:"shrink-0 px-5 py-2 border-t border-border-default flex items-center gap-4 text-xs text-fg-tertiary flex-wrap",children:[s.jsxs("span",{children:[s.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-surface-elevated border border-border-default text-[11px] font-medium",children:navigator.platform.toUpperCase().includes("MAC")?"Cmd+P":"Ctrl+P"})," ",n("common:toggle",{defaultValue:"唤起/关闭"})]}),s.jsxs("span",{children:[s.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-surface-elevated border border-border-default text-[11px] font-medium",children:"Tab"})," ",n("common:switchTab",{defaultValue:"切换分类"})]}),s.jsxs("span",{children:[s.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-surface-elevated border border-border-default text-[11px] font-medium",children:"↑↓"})," ",n("common:navigate",{defaultValue:"导航"})]}),s.jsxs("span",{children:[s.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-surface-elevated border border-border-default text-[11px] font-medium",children:"Enter"})," ",n("common:open",{defaultValue:"打开"})]}),s.jsxs("span",{children:[s.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-surface-elevated border border-border-default text-[11px] font-medium",children:"Esc"})," ",n("common:close",{defaultValue:"关闭"})]})]})]})})}function yY({status:e}){const t=e==="active"||e==="idle"?"bg-green-500":e==="working"||e==="busy"?"bg-blue-500":"bg-gray-400";return s.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${t}`})}function vY({status:e}){const t=e==="completed"?"text-green-500 bg-green-500/15":e==="in_progress"?"text-blue-500 bg-blue-500/15":e==="pending"?"text-amber-500 bg-amber-500/15":"text-fg-tertiary bg-surface-elevated";return s.jsx("div",{className:`w-7 h-7 rounded-lg flex items-center justify-center shrink-0 ${t}`,children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M9 11l3 3L22 4"}),s.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})})}const wY=[{id:"toggle-left",group:"layout",keys:["B"],label:"Toggle left sidebar (L0 + page L1)",labelKey:"shortcuts.toggleLeft",page:"any"},{id:"help",group:"help",keys:["/"],label:"Show keyboard shortcuts",labelKey:"shortcuts.help",page:"any"},{id:"search",group:"search",keys:["P"],label:"Global search",labelKey:"shortcuts.search",page:"any"},{id:"nav-l0-jk",group:"navigation",keys:["J / K"],label:"L0: switch page up / down",labelKey:"shortcuts.navL0Jk",page:"any",bare:!0},{id:"nav-l0-l",group:"navigation",keys:["L"],label:"L0: enter page L1 (Team / Tasks / Output / Store / Settings)",labelKey:"shortcuts.navL0L",page:"any",bare:!0},{id:"nav-l0-h",group:"navigation",keys:["H"],label:"From page L1: focus app rail (L0)",labelKey:"shortcuts.navL0H",page:"any",bare:!0},{id:"settings-back",group:"navigation",keys:["H"],label:"Settings: go back to previous page",labelKey:"shortcuts.settingsBack",page:"any",bare:!0},{id:"nav-jk-settings",group:"navigation",keys:["J / K"],label:"Settings L1: switch settings tabs",labelKey:"shortcuts.navJkSettings",page:"any",bare:!0},{id:"nav-hl-work",group:"navigation",keys:["H / L"],label:"Tasks: item list ↔ project L1 ↔ app rail",labelKey:"shortcuts.navHlWork",page:"work",bare:!0},{id:"nav-jk-work",group:"navigation",keys:["J / K"],label:"Tasks: move project / item selection",labelKey:"shortcuts.navJkWork",page:"work",bare:!0},{id:"nav-hl-team",group:"navigation",keys:["H / L"],label:"Team: L0 ↔ L1 ↔ L2 (L ignored on deepest pane)",labelKey:"shortcuts.navHlTeam",page:"team",bare:!0},{id:"nav-jk-team",group:"navigation",keys:["J / K"],label:"Team L1: move roster selection",labelKey:"shortcuts.navJkTeam",page:"team",bare:!0},{id:"nav-jk-team-l2",group:"navigation",keys:["J / K"],label:"Team L2: move team member selection",labelKey:"shortcuts.navJkTeamL2",page:"team",bare:!0},{id:"nav-jk-deliverables",group:"navigation",keys:["J / K"],label:"Output L1: move deliverable selection",labelKey:"shortcuts.navJkDeliverables",page:"deliverables",bare:!0},{id:"nav-jk-store",group:"navigation",keys:["J / K"],label:"Store L1: switch store tabs",labelKey:"shortcuts.navJkStore",page:"store",bare:!0},{id:"toggle-project-detail",group:"tasks",keys:["J"],label:"Toggle project detail (Tasks)",labelKey:"shortcuts.toggleProjectDetail",page:"work"},{id:"toggle-item-detail",group:"tasks",keys:["L"],label:"Toggle task / requirement detail (Tasks)",labelKey:"shortcuts.toggleItemDetail",page:"work"},{id:"cycle-board",group:"tasks",keys:["Ctrl","Tab"],label:"Cycle Tasks views",labelKey:"shortcuts.cycleBoard",page:"work",bare:!0},{id:"toggle-browser",group:"team",keys:["L"],label:"Toggle right panel · Browser",labelKey:"shortcuts.toggleBrowser",page:"team"},{id:"toggle-terminal",group:"team",keys:["J"],label:"Toggle right panel · Terminal",labelKey:"shortcuts.toggleTerminal",page:"team"},{id:"next-tab",group:"rightPanel",keys:["Shift","]"],label:"Next right-panel tab",labelKey:"shortcuts.nextTab",page:"team"},{id:"prev-tab",group:"rightPanel",keys:["Shift","["],label:"Previous right-panel tab",labelKey:"shortcuts.prevTab",page:"team"},{id:"tab-n",group:"rightPanel",keys:["1…9"],label:"Jump to Nth right-panel tab",labelKey:"shortcuts.tabN",page:"team"},{id:"close-tab",group:"rightPanel",keys:["W"],label:"Close right-panel tab",labelKey:"shortcuts.closeTab",page:"team"},{id:"new-tab",group:"rightPanel",keys:["T"],label:"New browser tab / shell",labelKey:"shortcuts.newTab",page:"team"},{id:"term-search",group:"terminal",keys:["F"],label:"Search in terminal",labelKey:"shortcuts.termSearch",page:"team"},{id:"term-to-chat",group:"terminal",keys:["Shift","A"],label:"Add terminal selection to chat",labelKey:"shortcuts.termToChat",page:"team"}];function kY(e,t,n){return n||e[0]==="Ctrl"||e[0]==="Tab"||e[0]==="J / K"||e[0]==="H / L"?e.join(e[0]==="Ctrl"?"+":" "):e.length===1&&(e[0]==="H"||e[0]==="L"||e[0]==="J"||e[0]==="K")?e[0]:[t?"⌘":"Ctrl",...e].join(t?"":"+")}function SY(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable?!0:e.closest(".xterm")!==null}function J4(e){return e instanceof HTMLElement?e.closest(".xterm")!==null:!1}const NY=["layout","navigation","tasks","team","search","rightPanel","terminal","help"];function CY(e){return e===de.TEAM?"team":e===de.WORK?"work":e===de.DELIVERABLES?"deliverables":e===de.STORE?"store":"any"}function TY({open:e,onClose:t,page:n}){const{t:r}=ft("common"),o=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),l=CY(n);return k.useEffect(()=>{if(!e)return;const c=d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),t())};return window.addEventListener("keydown",c,!0),()=>window.removeEventListener("keydown",c,!0)},[e,t]),e?s.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/45 backdrop-blur-[1px] p-4",onMouseDown:c=>{c.target===c.currentTarget&&t()},role:"dialog","aria-modal":"true","aria-label":r("shortcuts.title"),children:s.jsxs("div",{className:"w-full max-w-lg max-h-[80vh] overflow-auto rounded-xl border border-border-default bg-surface-primary shadow-2xl",children:[s.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between gap-3 px-4 py-3 border-b border-border-default bg-surface-primary",children:[s.jsx("h2",{className:"text-sm font-semibold text-fg-primary",children:r("shortcuts.title")}),s.jsx("button",{type:"button",onClick:t,className:"w-7 h-7 flex items-center justify-center rounded-md text-fg-tertiary hover:text-fg-secondary hover:bg-surface-elevated","aria-label":r("shortcuts.close"),children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),s.jsx("div",{className:"px-4 py-3 space-y-4",children:NY.map(c=>{const d=wY.filter(m=>{if(m.group!==c)return!1;const f=m.page??"any";return f==="any"?!0:f===l});return d.length===0?null:s.jsxs("section",{children:[s.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wide text-fg-tertiary mb-2",children:r(`shortcuts.groups.${c}`)}),s.jsx("ul",{className:"space-y-1.5",children:d.map(m=>s.jsxs("li",{className:"flex items-center justify-between gap-3 text-sm",children:[s.jsx("span",{className:"text-fg-secondary min-w-0",children:r(m.labelKey??m.label,{defaultValue:m.label})}),s.jsx("kbd",{className:"shrink-0 px-1.5 py-0.5 rounded bg-surface-elevated border border-border-default text-[11px] font-medium text-fg-primary font-mono",children:kY(m.keys,o,m.bare)})]},m.id))})]},c)})})]})}):null}function AY({authUser:e,onClose:t,onSaved:n,onUserUpdated:r}){const{t:o}=ft("common");Ho(!0);const[l,c]=k.useState(e.name||""),[d,m]=k.useState(e.email||""),[f,h]=k.useState(!1),[g,y]=k.useState(""),[x,w]=k.useState(()=>Ew(e.avatarUrl,sa()?.avatarUrl)),C=async T=>{if(T.preventDefault(),!l.trim()){y(o("profile.nameRequired"));return}if(d&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(d.trim())){y(o("profile.invalidEmail"));return}h(!0),y("");try{const{user:S}=await Ee.auth.updateProfile(l.trim(),d.trim());n({...S,avatarUrl:x??S.avatarUrl})}catch{y(o("profile.failedToSave"))}finally{h(!1)}};return s.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-[10000]",onClick:t,children:s.jsxs("form",{onSubmit:C,className:"bg-surface-secondary border border-border-default rounded-xl p-6 w-[400px] max-w-[calc(100vw-2rem)] shadow-2xl",onClick:T=>T.stopPropagation(),children:[s.jsx("h3",{className:"text-base font-semibold mb-5",children:o("profile.editProfile")}),s.jsx("div",{className:"flex justify-center mb-5",children:s.jsx(jw,{currentUrl:x,name:l,size:72,targetType:"user",targetId:e.id,onUploaded:T=>{w(T),r?.({...e,avatarUrl:T})}})}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-fg-tertiary font-medium mb-1",children:o("profile.name")}),s.jsx("input",{value:l,onChange:T=>c(T.target.value),className:"w-full px-3 py-2 bg-surface-elevated border border-border-default rounded-lg text-sm text-fg-primary focus:border-brand-500 outline-none"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-fg-tertiary font-medium mb-1",children:o("profile.email")}),s.jsx("input",{value:d,onChange:T=>m(T.target.value),type:"email",className:"w-full px-3 py-2 bg-surface-elevated border border-border-default rounded-lg text-sm text-fg-primary focus:border-brand-500 outline-none"})]}),g&&s.jsx("div",{className:"text-xs text-red-500 bg-red-500/10 border border-red-500/30 rounded-lg px-3 py-2",children:g})]}),s.jsxs("div",{className:"flex justify-end gap-3 mt-5",children:[s.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm border border-border-default rounded-lg hover:bg-surface-elevated",children:o("cancel")}),s.jsx("button",{type:"submit",disabled:f,className:"px-4 py-2 text-sm bg-brand-600 hover:bg-brand-500 disabled:opacity-50 text-white rounded-lg",children:o(f?"saving":"save")})]})]})})}const ew=k.lazy(()=>Gr(()=>import("./Team-vmqHkmh8.js"),__vite__mapDeps([2,3,4,5,6])).then(e=>({default:e.TeamPage}))),tw=k.lazy(()=>Gr(()=>import("./Settings-6xm2sHhm.js"),[]).then(e=>({default:e.Settings}))),EY=k.lazy(()=>Gr(()=>import("./Store-dbJSFCFw.js"),[]).then(e=>({default:e.StorePage}))),_Y=k.lazy(()=>Gr(()=>Promise.resolve().then(()=>$W),void 0).then(e=>({default:e.AgentBuilder}))),nw=k.lazy(()=>Gr(()=>import("./Work-Ds7q6pZg.js"),__vite__mapDeps([7,4,1,8,3,9])).then(e=>({default:e.WorkPage}))),rw=k.lazy(()=>Gr(()=>import("./Deliverables-CtPvquKO.js"),__vite__mapDeps([10,4,5])).then(e=>({default:e.DeliverablesPage}))),jY=k.lazy(()=>Gr(()=>import("./Notifications-C_e9_V74.js"),[]).then(e=>({default:e.NotificationsPage}))),MY=k.lazy(()=>Gr(()=>import("./Search-DZBGpN3c.js"),[]).then(e=>({default:e.SearchPage}))),RY={visibility:"hidden",position:"absolute",inset:0,pointerEvents:"none",zIndex:-1};function LY(e){try{const t=navigator.language,n=Intl.DateTimeFormat().resolvedOptions().timeZone,r=e.preferences??{};if(r.locale===t&&r.timezone===n)return;Ee.auth.updatePreferences({locale:t,timezone:n}).catch(()=>{})}catch{}}function OY(){return s.jsx("div",{className:"flex-1 flex items-center justify-center text-fg-tertiary text-sm animate-pulse",children:"Loading..."})}const DY=k.memo(function({id:t,activePage:n,children:r}){const o=t===n;return s.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",style:o?void 0:RY,children:s.jsx(k.Suspense,{fallback:s.jsx(OY,{}),children:r})})},(e,t)=>{const n=e.id===e.activePage,r=t.id===t.activePage;return n!==r?!1:r?e.children===t.children:!0}),Dd={};function f6(e){return typeof window<"u"&&window.matchMedia("(max-width: 767px)").matches?yw[e]??e:e}function aw(){return f6(pc())}function IY(){const{t:e}=ft("common"),[t,n]=k.useState(aw),[r,o]=k.useState(()=>!localStorage.getItem("markus_onboarded")),[l,c]=k.useState(!0),d=Uo(),m=hY(),f=fY({side:"left",defaultWidth:160,minWidth:140,maxWidth:400,collapsedWidth:64,storageKey:"markus_sidebar"}),[h,g]=k.useState(()=>new Set([aw()])),[y,x]=k.useState("loading"),[w,C]=k.useState(!1),[T,S]=k.useState(null),[E,j]=k.useState({hasOwner:!1,hasMultipleUsers:!1}),[L,I]=k.useState(!1),[O,F]=k.useState(!1),[V,X]=k.useState(null),[z,G]=k.useState(!1),[se,ee]=k.useState(null),[q,re]=k.useState(()=>{const Q=localStorage.getItem("markus_update_dismissed");return Q||null}),[B,J]=k.useState(!1),[fe,Se]=k.useState(!1),U=Lc(),W=U?.leftCollapsed??!1,pe=U?.toggleLeftCollapsed,P=U?.setLeftCollapsed,_e=U?.keyboardPane??"l0",He=U?.setKeyboardPane,Pe=U?.l0FocusPageId??null,Ge=U?.setL0FocusPageId,ct=k.useRef(t);ct.current=t;const mt=k.useRef(de.HOME),Ct=U?.toggleRightPanel,Mt=U?.toggleTerminalPanel,Pt=U?.cycleRightPanelTab,Kt=U?.activateRightPanelTabAt,yt=U?.openNewRightPanelTab,Ue=U?.rightPanelOpen??!1,dt=U?.activeRightPanelTabId??null,Nt=U?.openRightPanel,bt=U?.closeRightPanelTab,Lt=U?.updateRightPanelBrowserTab,ue=U?.updateRightPanelTerminalTab,tt=k.useRef(U?.rightPanelTabs);tt.current=U?.rightPanelTabs,k.useEffect(()=>{const Q=window.markusDesktop?.browser?.onPageEvent;if(!(!Q||!Nt))return Q(Z=>{if(Z.type==="closed"){const be=tt.current?.find(Ke=>Ke.payload.kind==="url"&&Ke.payload.browserId===Z.browserId);be&&bt&&bt(be.id);return}if(Z.type==="navigated"){if(Z.url&&gc(Z.url))return;Z.browserId&&Lt&&Lt(Z.browserId,{url:Z.url,title:Z.title||Z.url});return}if(Z.type==="opened"||Z.type==="selected"){if(!Z.url&&!Z.browserId||Z.browserId.startsWith("eb_")||rV(Z.browserId)||Z.url&&gc(Z.url))return;Nt({kind:"url",url:Z.url||"about:blank",title:Z.title||Z.url||"Browser",browserId:Z.browserId,pageId:Z.pageId})}})},[Nt,bt,Lt]),k.useEffect(()=>{const Q=window.markusDesktop?.terminal?.onEvent;if(!(!Q||!Nt))return Q(Z=>{if(Z.type==="closed"){const be=tt.current?.find(Ke=>Ke.payload.kind==="terminal"&&Ke.payload.terminalId===Z.id);be&&bt&&bt(be.id);return}if(Z.type==="cwd"){Z.cwd&&ue?.(Z.id,{cwd:Z.cwd});return}if(Z.type==="selected"){(Z.title||Z.cwd)&&ue?.(Z.id,{title:Z.title,cwd:Z.cwd});return}if(Z.type==="opened"){if(Vg.has(Z.id)){(Z.title||Z.cwd)&&ue?.(Z.id,{title:Z.title,cwd:Z.cwd});return}wi(Z.id),Nt({kind:"terminal",terminalId:Z.id,title:Z.title||"Terminal",cwd:Z.cwd})}})},[Nt,bt,ue]);const st=U?.handleTerminalExit;k.useEffect(()=>{const Q=window.markusDesktop?.terminal?.onExit;if(!(!Q||!st))return Q(Z=>{st(Z.id)})},[st]),k.useLayoutEffect(()=>{const Q=t===de.TEAM&&Ue&&U?.rightPanelMode==="browser";up(Q)},[t,Ue,U?.rightPanelMode]),k.useEffect(()=>{window.markusDesktop?.browser?.hideAll?.()},[]);const ye=k.useRef(!1);k.useEffect(()=>{if(!ye.current){ye.current=!0;return}f.setCollapsed(W)},[W,f.setCollapsed]),k.useEffect(()=>{if(d)return;const Q=navigator.platform.toUpperCase().includes("MAC"),Z=Ke=>{Q&&Ke.metaKey&&!Ke.ctrlKey&&Ke.key==="p"?(Ke.preventDefault(),J(Ie=>!Ie)):!Q&&Ke.ctrlKey&&!Ke.metaKey&&Ke.key==="p"&&(Ke.preventDefault(),J(Ie=>!Ie))},be=()=>J(!0);return document.addEventListener("keydown",Z),window.addEventListener("markus:open-search",be),()=>{document.removeEventListener("keydown",Z),window.removeEventListener("markus:open-search",be)}},[d]);const je=k.useCallback(()=>!Ue||!dt||!bt?!1:(bt(dt),!0),[Ue,dt,bt]);k.useEffect(()=>{const Q=window.markusDesktop?.onAppShortcut?.(Z=>{if(Z.type==="close-tab"){je();return}Z.type==="new-tab"&&yt?.()});return()=>{Q?.()}},[je,yt]),k.useEffect(()=>{if(d||!pe||!Ct)return;const Q=navigator.platform.toUpperCase().includes("MAC"),Z=be=>{if(!(Q?be.metaKey&&!be.ctrlKey:be.ctrlKey&&!be.metaKey)||be.altKey)return;if(!be.shiftKey&&(be.key==="/"||be.code==="Slash")){be.preventDefault(),Se(Ye=>!Ye);return}if(be.shiftKey&&(be.key==="?"||be.key==="/")){be.preventDefault(),Se(Ye=>!Ye);return}if(be.shiftKey&&Ue&&Pt){if(be.key==="]"||be.code==="BracketRight"){be.preventDefault(),Pt(1);return}if(be.key==="["||be.code==="BracketLeft"){be.preventDefault(),Pt(-1);return}}if(!be.shiftKey&&Ue&&Kt){const Ye=be.key>="1"&&be.key<="9"?Number(be.key):0;if(Ye>=1){be.preventDefault(),Kt(Ye-1);return}}if(be.shiftKey)return;const Ie=be.key.toLowerCase();if(Ie==="w"){be.preventDefault(),be.stopPropagation(),je();return}if(Ie==="t"){be.preventDefault(),yt?.();return}if(Ie==="b"){if(t===de.DELIVERABLES)return;be.preventDefault(),pe()}else if(t===de.TEAM&&Ie==="l"){if(!Q&&J4(be.target)||Q&&J4(be.target)&&be.ctrlKey)return;be.preventDefault(),Ct()}else t===de.TEAM&&Ie==="j"&&Mt&&(be.preventDefault(),Mt())};return document.addEventListener("keydown",Z,!0),()=>document.removeEventListener("keydown",Z,!0)},[d,t,pe,Ct,Mt,Pt,Kt,Ue,je,yt]);const Ae=k.useCallback((Q,Z)=>{let be=fc(Q);d?be=yw[be]??be:be===de.NOTIFICATIONS&&(be=de.HOME),be!==de.TEAM&&up(!1);const Ke=pc(),Ie=window.location.hash.slice(1);Ie!==hh(Ke)?Dd[Ke]=Ie:delete Dd[Ke];const Ye=ct.current;if(be===de.SETTINGS&&Ye!==de.SETTINGS&&(mt.current=Ye,it.setSettingsReturnPage(Ye),He?.("l1"),Ge?.(de.SETTINGS)),Ye===de.SETTINGS&&be!==de.SETTINGS&&(He?.("l0"),Ge?.(be)),be===de.SETTINGS&&Z?.tab){const le=`settings/${Z.tab}`;Dd[be]=le,history.pushState(null,"","#"+le),window.dispatchEvent(new HashChangeEvent("hashchange")),n(be),g(Oe=>Oe.has(be)?Oe:new Set([...Oe,be]));return}const M=be!==de.WORK?Dd[be]:void 0;M&&M!==hh(be)?(history.pushState(null,"",Ti(be)),history.pushState(null,"","#"+M)):history.pushState(null,"",Ti(be)),window.dispatchEvent(new HashChangeEvent("hashchange")),n(be),g(le=>le.has(be)?le:new Set([...le,be]))},[d,He,Ge]);k.useEffect(()=>{it.setHandler((Q,Z)=>Ae(Q,Z))},[Ae]),k.useEffect(()=>{_e==="l0"&&t!==de.SETTINGS&&Ge?.(t)},[_e,t,Ge]),k.useEffect(()=>{if(d||!He||!Ge)return;const Q=Z=>{if(Z.metaKey||Z.ctrlKey||Z.altKey||SY(Z.target))return;const be=Z.key.length===1?Z.key.toLowerCase():Z.key;if(t===de.SETTINGS&&(be==="h"||be==="ArrowLeft")){Z.preventDefault(),Z.stopImmediatePropagation(),it.leaveSettings();return}if(_e!=="l0"||t===de.SETTINGS)return;const Ke=Pe&&vo.includes(Pe)?Pe:t,Ie=Math.max(0,vo.indexOf(Ke));if(be==="j"||be==="ArrowDown"){Z.preventDefault(),Z.stopImmediatePropagation();const Ye=vo[Math.min(vo.length-1,Ie+1)];Ge(Ye),Ye!==t&&Ae(Ye),requestAnimationFrame(()=>{document.querySelector(`[data-l0-page-id="${Ye}"]`)?.scrollIntoView({block:"nearest"})});return}if(be==="k"||be==="ArrowUp"){Z.preventDefault(),Z.stopImmediatePropagation();const Ye=vo[Math.max(0,Ie-1)];Ge(Ye),Ye!==t&&Ae(Ye),requestAnimationFrame(()=>{document.querySelector(`[data-l0-page-id="${Ye}"]`)?.scrollIntoView({block:"nearest"})});return}if(be==="l"||be==="ArrowRight"||be==="Enter"){const Ye=Pe&&vo.includes(Pe)?Pe:t;if(!XO.has(Ye)){Z.preventDefault(),Z.stopImmediatePropagation();return}Z.preventDefault(),Z.stopImmediatePropagation(),Ye!==t&&Ae(Ye),P?.(!1),He("l1");return}(be==="h"||be==="ArrowLeft")&&(Z.preventDefault(),Z.stopImmediatePropagation())};return document.addEventListener("keydown",Q,!0),()=>document.removeEventListener("keydown",Q,!0)},[d,_e,Pe,t,Ae,He,Ge,P]),k.useEffect(()=>{const Q=()=>C(!0);return window.addEventListener("markus:open-edit-profile",Q),()=>window.removeEventListener("markus:open-edit-profile",Q)},[]),k.useEffect(()=>{if(!window.markusDesktop)return;!d&&t!==de.SETTINGS&&!f.collapsed?window.markusDesktop.setTrafficLightPosition(16,16):window.markusDesktop.setTrafficLightPosition(6,16)},[f.collapsed,t,d]),k.useEffect(()=>{window.markusDesktop&&window.markusDesktop.onNotificationClick(Q=>{if(Q.openNotifications&&window.dispatchEvent(new CustomEvent("markus:open-notifications")),Q.page){const Z=fc(Q.page);Q.params&&Object.entries(Q.params).forEach(([be,Ke])=>localStorage.setItem(`markus_nav_${be}`,Ke)),Ae(Z),window.dispatchEvent(new CustomEvent("markus:navigate",{detail:{page:Z,params:Q.params}}))}})},[Ae]);const oe=k.useCallback(()=>{fetch("/api/settings/llm").then(Q=>Q.ok?Q.json():null).then(Q=>{if(Q?.providers){const Z=Object.values(Q.providers).some(be=>be.configured);X(Z)}}).catch(()=>{})},[]),H=k.useCallback((Q,Z)=>{if(!Q)return;const Ke=Z&&{agent:"agents",team:"teams",skill:"skills"}[Z]||"agents";localStorage.setItem("markus_nav_installItem",Q),localStorage.setItem("markus_nav_storeTab",Ke);const Ie=new URLSearchParams(window.location.search);Ie.get("install")||(Ie.set("install",Q),Z&&Ie.set("type",Z));const Ye=Ie.toString();window.history.replaceState(null,"",`${window.location.pathname}?${Ye}${Ti(de.STORE)}`);const M=()=>it.navigate(de.STORE,{storeTab:Ke,installItem:Q});M(),setTimeout(M,500),setTimeout(M,1500)},[]);k.useEffect(()=>{const Q=new URLSearchParams(window.location.search),Z=Q.get("install");Z&&H(Z,Q.get("type"));const be=window.markusDesktop;be?.onDeepLinkInstall?.(({id:Ye,type:M})=>H(Ye,M)),be?.consumePendingDeepLinkInstall?.().then(Ye=>{Ye?.id&&H(Ye.id,Ye.type)}),Ee.auth.me().then(({user:Ye})=>{x(Ye),S(!0),LY(Ye),va.connect(Ye.id),oe(),Ee.health().then(le=>{le.updateAvailable&&le.latestVersion&&ee({latestVersion:le.latestVersion,currentVersion:le.version})}).catch(()=>{});const M=()=>{gi(Tr.builderArtifacts,()=>Ee.builder.artifacts.list()),gi(Tr.builderAgents,()=>Ee.agents.list()),gi(Tr.builderHubMyItems,()=>lt.myItems()),gi(Tr.builderInstalled,()=>Ee.builder.artifacts.installed()),gi(Tr.hubAgents,()=>lt.search({type:"agent",limit:50})),gi(Tr.hubTeams,()=>lt.search({type:"team",limit:50})),gi(Tr.hubSkills,()=>lt.search({type:"skill",limit:50}))};typeof requestIdleCallback=="function"?requestIdleCallback(M,{timeout:5e3}):setTimeout(M,3e3)}).catch(()=>{x(null),Ee.auth.status().then(({initialized:Ye,hasOwner:M,hasMultipleUsers:le})=>{S(Ye),j({hasOwner:M,hasMultipleUsers:le})}).catch(()=>S(!0))}),va.connect();const Ke=va.on("notification",()=>{window.dispatchEvent(new CustomEvent("markus:notifications-changed"))}),Ie=()=>{const Ye=f6(pc());Ye!==de.TEAM&&up(!1),n(Ye),g(M=>M.has(Ye)?M:new Set([...M,Ye]))};return window.addEventListener("hashchange",Ie),window.addEventListener("popstate",Ie),()=>{Ke(),va.disconnect(),window.removeEventListener("hashchange",Ie),window.removeEventListener("popstate",Ie)}},[]);const te=y!=="loading"&&y!==null?y:void 0,Ne=k.useMemo(()=>d?{[de.HOME]:s.jsx(dv,{authUser:te}),[de.TEAM]:s.jsx(ew,{authUser:te}),[de.BUILDER]:s.jsx(oY,{authUser:te}),[de.SETTINGS]:s.jsx(tw,{theme:m.mode,onThemeChange:m.setMode,authUser:te,onLogout:()=>{Ee.auth.logout().catch(()=>{}),Ro(),x(null)},onUserUpdated:Q=>x(Q)}),[de.WORK]:s.jsx(nw,{authUser:te}),[de.DELIVERABLES]:s.jsx(rw,{authUser:te}),[de.NOTIFICATIONS]:s.jsx(jY,{authUser:te}),[de.SEARCH]:s.jsx(MY,{})}:{[de.HOME]:s.jsx(dv,{authUser:te}),[de.TEAM]:s.jsx(ew,{authUser:te}),[de.SETTINGS]:s.jsx(tw,{theme:m.mode,onThemeChange:m.setMode,authUser:te,onLogout:()=>{Ee.auth.logout().catch(()=>{}),Ro(),x(null)},onUserUpdated:Q=>x(Q)}),[de.STORE]:s.jsx(EY,{authUser:te}),[de.BUILDER]:s.jsx(_Y,{authUser:te}),[de.WORK]:s.jsx(nw,{authUser:te}),[de.DELIVERABLES]:s.jsx(rw,{authUser:te})},[te?.id,te?.role,m.mode,d]);if(y==="loading"||y===null&&T===null)return s.jsx("div",{className:"min-h-dvh bg-surface-primary flex items-center justify-center",children:s.jsx("div",{className:"text-fg-tertiary text-sm animate-pulse",children:e("loading")})});const $e=(typeof window<"u"?window.location.hash:"").match(/^#invite\?token=([a-f0-9]+)/);return $e?s.jsx(dY,{token:$e[1],onComplete:()=>{window.location.hash="",localStorage.removeItem("markus_onboarded"),o(!0),I(!0),x("loading"),Ee.auth.me().then(Q=>x(Q.user)).catch(()=>x(null))}}):y===null?s.jsx(uY,{hasOwner:E.hasOwner,hasMultipleUsers:E.hasMultipleUsers,onLogin:(Q,Z,be)=>{x(Q),va.connect(Q.id),Z?(localStorage.removeItem("markus_onboarded"),o(!0),be?.fromHub&&I(!0)):localStorage.getItem("markus_onboarded")||(localStorage.setItem("markus_onboarded","1"),o(!1))}}):O?s.jsx(mY,{onComplete:()=>F(!1),isFirstTime:!0}):r?s.jsx(lY,{theme:m.mode,onThemeChange:m.setMode,skipProfile:L,onProfileUpdated:Q=>{const Z={id:Q.id,name:Q.name,email:Q.email,role:Q.role,orgId:Q.orgId??"default",avatarUrl:Q.avatarUrl};x(Z)},onComplete:()=>{localStorage.setItem("markus_onboarded","1"),o(!1),I(!1),Ee.auth.me().then(Q=>x(Q.user)).catch(()=>{}),oe(),Ae(de.HOME)}}):s.jsxs("div",{className:`flex h-dvh bg-surface-primary text-fg-primary overflow-x-hidden ${d?"flex-col":""}`,children:[!d&&t!==de.SETTINGS&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"relative z-40 shrink-0",style:{width:f.width},children:s.jsx(fW,{currentPage:t,onNavigate:Q=>{Ae(Q),c(!1),He?.("l0"),Ge?.(Q)},authUser:y,collapsed:f.collapsed,onToggleCollapse:f.toggle,onLogout:()=>{Ee.auth.logout().catch(()=>{}),Ro(),x(null)},keyboardFocusPageId:Pe,keyboardPaneActive:_e==="l0"})}),s.jsx("div",{className:`${f.collapsed?"w-0":"w-1.5 cursor-col-resize"} shrink-0 group relative z-10 flex items-center justify-center`,onMouseDown:f.collapsed?void 0:f.onResizeStart,children:!f.collapsed&&s.jsx("div",{className:"w-px h-2/3 border-l border-dashed border-transparent group-hover:border-border-default group-active:border-fg-tertiary transition-colors"})})]}),s.jsxs("div",{className:`flex-1 overflow-hidden flex flex-col min-w-0 ${d&&t!==de.SETTINGS&&t!==de.SEARCH?"pb-14":""}`,children:[V===!1&&!z&&t!==de.SETTINGS&&s.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-amber-500/10 border-b border-amber-500/30 text-amber-600 text-sm shrink-0",children:[s.jsx("span",{className:d?"text-xs":"",children:e("llmBanner.message")}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:()=>{window.location.hash="#settings/providers"},className:"px-3 py-1 bg-amber-700/50 hover:bg-amber-700/70 text-white text-xs rounded-lg transition-colors",children:e("llmBanner.goToSettings")}),s.jsx("button",{onClick:()=>G(!0),className:"text-amber-500 hover:text-amber-600 text-xs",children:e("dismiss")})]})]}),se&&q!==se.latestVersion&&s.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-brand-500/10 border-b border-brand-500/30 text-brand-400 text-sm shrink-0",children:[s.jsx("span",{className:d?"text-xs":"",children:e("update.available",{latest:se.latestVersion,current:se.currentVersion})}),s.jsxs("span",{className:"flex items-center gap-3 shrink-0",children:[s.jsx("a",{href:"https://markus.global/#download",target:"_blank",rel:"noopener noreferrer",className:"text-xs font-medium text-brand-400 hover:text-brand-300 transition-colors",children:e("update.download")}),s.jsx("button",{onClick:()=>{re(se.latestVersion),localStorage.setItem("markus_update_dismissed",se.latestVersion)},className:"text-fg-tertiary hover:text-fg-secondary text-xs shrink-0",children:e("dismiss")})]})]}),s.jsx("main",{className:"flex-1 overflow-hidden flex flex-col relative",children:Object.keys(Ne).map(Q=>h.has(Q)?s.jsx(DY,{id:Q,activePage:t,children:Ne[Q]},Q):null)})]}),d&&t!==de.SETTINGS&&t!==de.SEARCH&&s.jsx(xW,{currentPage:t,onNavigate:Ae,userId:te?.id}),d&&s.jsx(mD,{authUser:te,onNavigate:Ae}),!d&&B&&s.jsx(xY,{onClose:()=>J(!1),currentPage:t}),!d&&s.jsx(TY,{open:fe,onClose:()=>Se(!1),page:t}),w&&te&&s.jsx(AY,{authUser:te,onClose:()=>C(!1),onUserUpdated:Q=>x(Q),onSaved:Q=>{C(!1),x(Q)}})]})}N7.createRoot(document.getElementById("root")).render(s.jsx(k.StrictMode,{children:s.jsx(cV,{children:s.jsx(IY,{})})}));export{g8 as $,Hs as A,Ya as B,Ti as C,dr as D,JO as E,HY as F,K3 as G,VY as H,tY as I,b4 as J,A4 as K,UK as L,Mw as M,uW as N,HK as O,de as P,UY as Q,PY as R,JW as S,FW as T,ZK as U,KY as V,yc as W,fX as X,zY as Y,sa as Z,Gr as _,Uo as a,BY as a0,$Y as a1,wi as a2,Sd as a3,_i as a4,r0 as a5,lX as a6,XK as a7,OV as a8,r4 as a9,sW as aA,oX as aB,WY as aC,qY as aD,G3 as aE,DV as aa,Ai as ab,Yo as ac,JY as ad,bW as ae,mX as af,rX as ag,GY as ah,ZY as ai,QY as aj,YY as ak,aW as al,Yg as am,XY as an,tX as ao,nX as ap,sX as aq,eX as ar,MV as as,dX as at,aX as au,cX as av,iX as aw,lW as ax,uX as ay,F3 as az,dD as b,Lc as c,aY as d,VW as e,XW as f,Ni as g,lt as h,SY as i,s as j,Sa as k,Ee as l,fY as m,it as n,bn as o,fc as p,Er as q,k as r,Wg as s,Hr as t,ft as u,Tc as v,va as w,A0 as x,x8 as y,Ho as z};
672
+ prose-blockquote:border-brand-500/40 prose-blockquote:text-fg-secondary`,children:s.jsx(Eh,{remarkPlugins:t,rehypePlugins:n,components:r,children:e})})}function sh({filename:e,content:t,onSave:n,embedded:r,readOnly:o}){const{t:l}=ft(["builder","common"]),[c,d]=k.useState(!1),[m,f]=k.useState(t),[h,g]=k.useState(!1),y=/\.(md|mdx|markdown)$/i.test(e),x=k.useRef(null);k.useEffect(()=>{f(t)},[t]),k.useEffect(()=>{if(c&&x.current){const T=x.current;T.style.height="auto",T.style.height=Math.max(200,T.scrollHeight)+"px"}},[c,m]);const w=async()=>{g(!0),await n(m),g(!1),d(!1)},C=o?null:s.jsx("div",{className:"flex items-center gap-2",children:c?s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>{f(t),d(!1)},className:"text-[10px] px-2.5 py-1 rounded-md text-fg-tertiary hover:text-fg-secondary border border-border-default transition-colors",children:l("common:cancel")}),s.jsx("button",{onClick:w,disabled:h,className:"text-[10px] px-2.5 py-1 rounded-md bg-brand-600 hover:bg-brand-500 text-white transition-colors disabled:opacity-50",children:l(h?"common:saving":"common:save")})]}):s.jsxs("button",{onClick:()=>d(!0),className:"text-[10px] px-2.5 py-1 rounded-md text-fg-tertiary hover:text-fg-secondary border border-border-default transition-colors inline-flex items-center gap-1",children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),s.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),l("detail.edit")]})});return r?s.jsxs("div",{children:[s.jsx("div",{className:"flex items-center justify-end px-4 py-2 border-b border-border-default bg-surface-elevated/20",children:C}),c?s.jsx("textarea",{ref:x,value:m,onChange:T=>f(T.target.value),className:"w-full bg-surface-elevated/20 text-sm text-fg-primary font-mono p-4 focus:outline-none resize-y min-h-[200px] leading-relaxed",spellCheck:!1}):s.jsx("div",{className:"p-4",children:y?s.jsx(ag,{content:t}):s.jsx("pre",{className:"text-xs leading-relaxed text-fg-secondary whitespace-pre-wrap font-mono",children:t})})]}):s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-border-default bg-surface-elevated/30",children:[s.jsx("span",{className:"text-xs font-medium text-fg-secondary font-mono",children:e}),C]}),c?s.jsx("textarea",{ref:x,value:m,onChange:T=>f(T.target.value),className:"w-full bg-surface-elevated/20 text-sm text-fg-primary font-mono p-4 focus:outline-none resize-y min-h-[200px] leading-relaxed",spellCheck:!1}):s.jsx("div",{className:"p-4",children:y?s.jsx(ag,{content:t}):s.jsx("pre",{className:"text-xs leading-relaxed text-fg-secondary whitespace-pre-wrap font-mono",children:t})})]})}const I4={"README.md":0,"ROLE.md":1,"HEARTBEAT.md":2,"POLICIES.md":3,"CONTEXT.md":4,"ANNOUNCEMENT.md":0,"NORMS.md":1};function AW(e){return[...e].sort(([t],[n])=>{const r=I4[t]??99,o=I4[n]??99;return r!==o?r-o:t.localeCompare(n)})}function S0({files:e,onSave:t,noHeader:n,readOnly:r}){const o=k.useMemo(()=>AW(e),[e]),[l,c]=k.useState(0);if(o.length===1)return n?s.jsx(sh,{filename:o[0][0],content:o[0][1],onSave:h=>t(o[0][0],h),readOnly:r}):s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-sm font-semibold text-fg-primary mb-4 uppercase tracking-wider",children:"Files"}),s.jsx(sh,{filename:o[0][0],content:o[0][1],onSave:h=>t(o[0][0],h),readOnly:r})]});const[d,m]=o[l]??o[0],f=s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 overflow-hidden",children:[s.jsx("div",{className:"flex items-center gap-0 overflow-x-auto bg-surface-elevated/30",children:o.map(([h],g)=>s.jsx("button",{onClick:()=>c(g),className:`px-4 py-2.5 text-xs font-medium whitespace-nowrap border-b-2 transition-colors ${g===l?"border-brand-500 text-brand-400 bg-surface-secondary/50":"border-transparent text-fg-tertiary hover:text-fg-secondary hover:bg-surface-elevated/50"}`,children:h},h))}),s.jsx(sh,{filename:d,content:m,onSave:h=>t(d,h),embedded:!0,readOnly:r},d)]});return n?f:s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-sm font-semibold text-fg-primary mb-4 uppercase tracking-wider",children:"Files"}),f]})}function EW({images:e,artifactType:t,artifactName:n,onUpload:r,onRemove:o,readOnly:l,cacheBust:c}){const{t:d}=ft(["builder"]),m=k.useRef(null);return e.length===0?l?null:s.jsxs("div",{className:"border-2 border-dashed border-border-default rounded-xl p-6 text-center text-fg-muted text-sm cursor-pointer hover:border-brand-500/30 transition-colors",onClick:()=>m.current?.click(),onDragOver:f=>f.preventDefault(),onDrop:f=>{f.preventDefault();const h=f.dataTransfer.files[0];h?.type.startsWith("image/")&&r(h)},children:[s.jsxs("svg",{className:"w-8 h-8 mx-auto mb-2 text-fg-muted/50",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),s.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),s.jsx("polyline",{points:"21 15 16 10 5 21"})]}),s.jsx("span",{className:"block",children:d("images.dropOrClick")}),s.jsx("span",{className:"block text-xs text-fg-muted/60 mt-1",children:d("images.hint")}),s.jsx("input",{ref:m,type:"file",accept:"image/*",className:"hidden",onChange:f=>{const h=f.target.files?.[0];h&&r(h),f.target.value=""}})]}):s.jsxs("div",{children:[s.jsxs("div",{className:"flex gap-3 overflow-x-auto pb-2",children:[e.map(f=>{const h=f.split("/").pop()??f;return s.jsxs("div",{className:"relative group shrink-0 rounded-lg border border-border-default overflow-hidden bg-surface-elevated",children:[s.jsx("img",{src:`/api/builder/artifacts/${t}s/${encodeURIComponent(n)}/images/${encodeURIComponent(h)}${c!=null?`?v=${c}`:""}`,alt:h,className:"h-32 w-auto object-cover"}),!l&&s.jsx("button",{onClick:()=>o(h),className:"absolute top-1.5 right-1.5 w-5 h-5 rounded-full bg-red-600/80 text-white flex items-center justify-center text-[10px] opacity-0 group-hover:opacity-100 transition-opacity",children:"×"})]},f)}),!l&&s.jsx("button",{onClick:()=>m.current?.click(),className:"shrink-0 h-32 w-24 rounded-lg border-2 border-dashed border-border-default flex items-center justify-center text-fg-muted hover:border-brand-500/30 hover:text-brand-400 transition-colors",children:s.jsxs("svg",{className:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),s.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})})]}),!l&&s.jsx("input",{ref:m,type:"file",accept:"image/*",className:"hidden",onChange:f=>{const h=f.target.files?.[0];h&&r(h),f.target.value=""}})]})}function _W({members:e,teamTopFiles:t,files:n,artifactName:r,onFileSave:o,readOnly:l}){const{t:c}=ft(["builder"]),[d,m]=k.useState(0),f=k.useMemo(()=>{const T=new Set;for(const S of Object.keys(n)){const E=S.match(/^members\/([^/]+)\//);E&&T.add(E[1])}return[...T]},[n]),h=k.useMemo(()=>{const T=new Map,S=new Set;for(let L=0;L<e.length;L++){const O=e[L].slug;O&&f.includes(O)&&!S.has(O)&&(T.set(L,O),S.add(O))}for(let L=0;L<e.length;L++){if(T.has(L))continue;const I=r0(e[L].name);I&&f.includes(I)&&!S.has(I)&&(T.set(L,I),S.add(I))}for(let L=0;L<e.length;L++){if(T.has(L))continue;const I=e[L].roleName;if(I){const O=r0(I);f.includes(O)&&!S.has(O)&&(T.set(L,O),S.add(O))}}for(let L=0;L<e.length;L++){if(T.has(L))continue;const I=e[L].name;for(const O of f){if(S.has(O))continue;const F=n[`members/${O}/ROLE.md`];if(!F)continue;const V=F.match(/^#\s+(.+)$/m)?.[1]?.trim();if(V&&(V.toLowerCase().includes(I.toLowerCase())||I.toLowerCase().includes(V.toLowerCase()))){T.set(L,O),S.add(O);break}}}const E=f.filter(L=>!S.has(L));let j=0;for(let L=0;L<e.length;L++)T.has(L)||j<E.length&&(T.set(L,E[j]),j++);return T},[e,f,n]),g=k.useCallback((T,S)=>{const E=h.get(S);return E?Object.entries(n).filter(([j])=>j.startsWith(`members/${E}/`)):[]},[n,h]),y=k.useMemo(()=>{const T=[{label:c("detail.overview")}];for(const S of e)T.push({label:S.name,role:S.role});return T},[e,c]),x=d>0?e[d-1]:null,w=d-1;return s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 overflow-hidden",children:[s.jsx("div",{className:"flex items-center gap-0 overflow-x-auto bg-surface-elevated/30 border-b border-border-default",children:y.map((T,S)=>{const E=S===d,j=T.role==="manager",L=S===0?E?"border-brand-500 text-brand-400":"border-transparent text-fg-tertiary hover:text-fg-secondary":j?E?"border-amber-500 text-amber-400":"border-transparent text-fg-tertiary hover:text-fg-secondary":E?"border-blue-500 text-blue-400":"border-transparent text-fg-tertiary hover:text-fg-secondary";return s.jsxs("button",{onClick:()=>m(S),className:`px-4 py-2.5 text-xs font-medium whitespace-nowrap border-b-2 transition-colors flex items-center gap-1.5 ${L} ${E?"bg-surface-secondary/50":"hover:bg-surface-elevated/50"}`,children:[S===0&&s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),s.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),S>0&&((()=>{const I=S-1,O=h.get(I),F=O?`/api/builder/artifacts/teams/${encodeURIComponent(r)}/members/${encodeURIComponent(O)}/images/avatar.jpg`:null;return F?s.jsx("img",{src:F,alt:T.label,className:`w-5 h-5 rounded-full object-cover shrink-0 ring-1 ${j?"ring-amber-500/40":"ring-blue-500/40"}`,onError:V=>{V.target.style.display="none",V.target.nextElementSibling?.classList.remove("hidden")}}):null})(),s.jsx("span",{className:`w-5 h-5 rounded-full text-[9px] font-bold flex items-center justify-center shrink-0 ${j?"bg-amber-500/20 text-amber-400":"bg-blue-500/20 text-blue-400"} ${(()=>{const I=S-1;return h.get(I)?"hidden":""})()}`,children:(T.label[0]??"?").toUpperCase()})),T.label]},S)})}),s.jsx("div",{className:"p-5",children:d===0?s.jsxs("div",{className:"space-y-6",children:[t.length>0&&s.jsx(S0,{noHeader:!0,files:t,onSave:C,readOnly:l}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider mb-3",children:c("sidebar.composition")}),s.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:e.map((T,S)=>{const E=T.role==="manager";return s.jsxs("button",{onClick:()=>m(S+1),className:"text-left rounded-lg border border-border-default bg-surface-elevated/30 px-4 py-3 flex gap-3 items-center hover:border-gray-600 transition-colors cursor-pointer",children:[(()=>{const j=h.get(S),L=j?`/api/builder/artifacts/teams/${encodeURIComponent(r)}/members/${encodeURIComponent(j)}/images/avatar.jpg`:null;return L?s.jsx("img",{src:L,alt:T.name,className:`w-8 h-8 rounded-full object-cover shrink-0 ring-1 ${E?"ring-amber-500/30":"ring-blue-500/30"}`,onError:I=>{I.target.style.display="none",I.target.nextElementSibling?.classList.remove("hidden")}}):null})(),s.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold shrink-0 ${E?"bg-amber-500/15 text-amber-400 ring-1 ring-amber-500/30":"bg-blue-500/15 text-blue-400 ring-1 ring-blue-500/30"} ${h.get(S)?"hidden":""}`,children:(T.name[0]??"?").toUpperCase()}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-xs font-medium text-fg-primary truncate",children:T.name}),s.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded-full font-medium ${E?"bg-amber-500/15 text-amber-400":"bg-blue-500/15 text-blue-400"}`,children:T.role}),T.count>1&&s.jsxs("span",{className:"text-[9px] text-fg-muted",children:["×",T.count]})]}),T.skills&&T.skills.length>0&&s.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[T.skills.slice(0,3).map(j=>s.jsx("span",{className:"text-[9px] px-1.5 py-0.5 bg-surface-elevated text-fg-muted rounded border border-border-default",children:j},j)),T.skills.length>3&&s.jsxs("span",{className:"text-[9px] text-fg-muted",children:["+",T.skills.length-3]})]})]}),s.jsx("svg",{className:"w-3.5 h-3.5 text-fg-muted shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"9 18 15 12 9 6"})})]},S)})})]})]}):x?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[(()=>{const T=h.get(w),S=T?`/api/builder/artifacts/teams/${encodeURIComponent(r)}/members/${encodeURIComponent(T)}/images/avatar.jpg`:null;return S?s.jsx("img",{src:S,alt:x.name,className:`w-12 h-12 rounded-full object-cover shrink-0 ring-2 ${x.role==="manager"?"ring-amber-500/30":"ring-blue-500/30"}`,onError:E=>{E.target.style.display="none",E.target.nextElementSibling?.classList.remove("hidden")}}):null})(),s.jsx("div",{className:`w-12 h-12 rounded-full flex items-center justify-center text-lg font-bold shrink-0 ${x.role==="manager"?"bg-amber-500/15 text-amber-400 ring-2 ring-amber-500/30":"bg-blue-500/15 text-blue-400 ring-2 ring-blue-500/30"} ${h.get(w)?"hidden":""}`,children:(x.name[0]??"?").toUpperCase()}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-sm font-semibold text-fg-primary",children:x.name}),s.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full font-medium ${x.role==="manager"?"bg-amber-500/15 text-amber-400":"bg-blue-500/15 text-blue-400"}`,children:x.role}),x.count>1&&s.jsxs("span",{className:"text-[10px] text-fg-muted",children:["×",x.count]})]}),x.roleName&&s.jsx("div",{className:"text-xs text-fg-tertiary mt-0.5 italic",children:x.roleName})]})]}),x.skills&&x.skills.length>0&&s.jsx("div",{className:"flex flex-wrap gap-1.5",children:x.skills.map(T=>s.jsx("span",{className:"text-[10px] px-2.5 py-1 bg-surface-elevated text-fg-muted rounded-full border border-border-default",children:T},T))}),(()=>{const T=g(x.name,w);return T.length===0?s.jsx("p",{className:"text-xs text-fg-muted italic",children:"No files for this member yet."}):s.jsx(S0,{noHeader:!0,readOnly:l,files:T.map(([S,E])=>[S.replace(/^members\/[^/]+\//,""),E]),onSave:(S,E)=>{const j=T.find(([L])=>L.endsWith(`/${S}`));j&&o(j[0],E)}})})()]}):null})]});function C(T,S){o(T,S)}}function Mi({type:e,name:t,onBack:n,authUser:r,readOnly:o,initialManifest:l,actionSlot:c,contentSlot:d}){const{t:m}=ft(["builder","common"]),f=Uo(),[h,g]=k.useState(!0),[y,x]=k.useState(t),[w,C]=k.useState({}),[T,S]=k.useState(null),[E,j]=k.useState(""),[L,I]=k.useState("idle"),[O,F]=k.useState({shared:!1}),[V,X]=k.useState(!1),[z,G]=k.useState(!1),[se,ee]=k.useState(!1),[q,re]=k.useState(!1),[B,J]=k.useState(!1),[fe,Se]=k.useState(!1),[U,W]=k.useState(null),[pe,P]=k.useState(0),[_e,He]=k.useState(""),[Pe,Ge]=k.useState(""),[ct,mt]=k.useState(""),[Ct,Mt]=k.useState(""),[Pt,Kt]=k.useState([]),[yt,Ue]=k.useState(""),dt=k.useRef(null),Nt=k.useRef(l);Nt.current=l,k.useEffect(()=>{x(t)},[t]);const bt=k.useCallback(async()=>{const Q=Nt.current;if(Q){S(Q),He(Q.displayName||Q.name||t),Ge(Q.description||""),mt(Q.version||"1.0.0"),Mt(Q.category||"general"),Kt(Q.tags||[]),Ue(Q.icon||""),C(Q.files??{}),g(!1);return}g(!0);try{let Z=t;try{const Ie=await Ee.builder.artifacts.ensureSlugSafe(e,t);Z=Ie.name,x(Z),Ie.converted&&(history.replaceState(null,"",Ti(de.BUILDER,`${e}/${encodeURIComponent(Z)}`)),window.dispatchEvent(new CustomEvent("markus:data-changed")))}catch{x(t)}const be=await Ee.builder.artifacts.get(e,Z);C(be.files??{}),j(be.path??"");const Ke=be.files[`${e}.json`]??be.files["agent.json"]??be.files["team.json"]??be.files["skill.json"];if(Ke){const Ie=JSON.parse(Ke);S(Ie),He(Ie.displayName||Ie.name||t),Ge(Ie.description||""),mt(Ie.version||"1.0.0"),Mt(Ie.category||"general"),Kt(Ie.tags||[]),Ue(Ie.icon||"")}}catch(Z){console.error("Failed to load artifact:",Z)}finally{g(!1)}},[e,t]);k.useEffect(()=>{bt()},[bt]),k.useEffect(()=>{l?.files&&C(l.files)},[l?.files]),k.useEffect(()=>{if(!o){try{const Q=localStorage.getItem("markus_builder_shared_map");if(Q){const Z=JSON.parse(Q),be=`${e}/${t}`;Z[be]&&F({shared:!0,id:Z[be].id,slug:Z[be].slug,version:Z[be].version,visibility:Z[be].visibility??"public"})}}catch{}lt.myItems().then(Q=>{const Z=Q?.items??[],be=e==="agent"?"agent":e==="team"?"team":"skill";for(const Ke of Z)if(Ke.itemType===be&&(Ke.slug===t||Ke.name===t)){F({shared:!0,id:Ke.id,slug:Ke.slug,version:Ke.version,visibility:Ke.visibility??"public",moderationStatus:Ke.moderationStatus,pendingReview:Ke.pendingReview});return}}).catch(()=>{})}},[e,t,o]);const Lt=k.useCallback(async Q=>{if(!(!T||o)){I("saving");try{const Z={...T,...Q};await Ee.builder.artifacts.save(e,Z),S(Z),I("saved"),setTimeout(()=>I(be=>be==="saved"?"idle":be),2e3)}catch{I("error"),setTimeout(()=>I("idle"),3e3)}}},[T,e]),ue=k.useCallback(Q=>{dt.current&&clearTimeout(dt.current),dt.current=setTimeout(()=>Lt(Q),800)},[Lt]),tt=k.useCallback((Q,Z)=>{const be={};Q==="displayName"?(He(Z),be.displayName=Z,G(!0)):Q==="description"?(Ge(Z),be.description=Z,G(!0)):Q==="version"?(mt(Z),be.version=Z,G(!1),ee(!1)):Q==="category"?(Mt(Z),be.category=Z,G(!0)):Q==="tags"?(Kt(Z),be.tags=Z,G(!0)):Q==="icon"&&(Ue(Z),be.icon=Z||void 0,G(!0)),ue({...T,...be})},[T,ue]),st=k.useCallback(async(Q,Z)=>{try{const be={...w,[Q]:Z};C(be);const Ke={...T,files:be};await Ee.builder.artifacts.save(e,Ke),I("saved"),G(!0),setTimeout(()=>I(Ie=>Ie==="saved"?"idle":Ie),2e3)}catch{I("error")}},[w,e,T]),ye=k.useCallback(async Q=>{if(T){X(!0);try{await lt.ensureAuth();const Z=await Ee.builder.artifacts.ensureSlugSafe(e,y,T.displayName||T.name||y),be=Z.name,Ke=Z.slug||xc(be);if(!Ke)throw new Error("Invalid package slug: use English kebab-case for the artifact name (e.g. qwen-multimodal). Chinese-only names cannot be shared — rename the package slug and put the Chinese title in displayName.");const Ie=Z.displayName||T.displayName||T.name||y;Z.converted&&(x(be),S(ze=>ze&&{...ze,name:Ke,displayName:Ie}),history.replaceState(null,"",Ti(de.BUILDER,`${e}/${encodeURIComponent(be)}`)),window.dispatchEvent(new CustomEvent("markus:data-changed")));const Ye={...T,name:Ke,displayName:Ie},M=Ye.description||"",le=Ye.category||"general",Oe=Ye.tags??[];let ge=Ye.icon||void 0;const Ve=Ye.version||"1.0.0";if(ge&&!ge.startsWith("http")&&/\.(png|jpe?g|gif|webp|svg)$/i.test(ge)){const ze=ge.split("/").pop()??ge;try{const rt=await fetch(`/api/builder/artifacts/${e}s/${encodeURIComponent(be)}/images/${encodeURIComponent(ze)}`,{cache:"no-store"});if(rt.ok){const vt=await rt.blob(),Fe=new File([vt],ze,{type:vt.type}),at=await lt.uploadImage(Fe);at?.url&&(ge=at.url)}}catch{}}let Qe;const K=[],ce=Ye.screenshots??[];for(let ze=0;ze<ce.length;ze++){const rt=ce[ze],vt=rt.split("/").pop()??rt;try{const Fe=await fetch(`/api/builder/artifacts/${e}s/${encodeURIComponent(be)}/images/${encodeURIComponent(vt)}`,{cache:"no-store"});if(Fe.ok){const at=await Fe.blob(),kt=new File([at],vt,{type:at.type}),xn=await lt.uploadImage(kt);xn?.url&&(K.push({url:xn.url,alt:vt,order:ze}),ze===0&&(Qe=xn.url))}}catch{}}const Te=await lt.publishViaProxy({itemType:e==="team"?"team":e==="skill"?"skill":"agent",name:Ie,slug:Ke,description:M,category:le,tags:Oe,icon:ge,version:Ve,config:Ye,files:Object.keys(w).length>0?w:void 0,thumbnailUrl:Qe,images:K.length>0?K:void 0,priceCents:Q?.priceCents,donationsEnabled:Q?.donationsEnabled,visibility:Q?.visibility,orgId:Q?.orgId});Te.id&&(F({shared:!0,id:Te.id,slug:Te.slug??Ke,version:Ve,visibility:Te.visibility??Q?.visibility??"public",moderationStatus:Te.moderationStatus,pendingReview:Te.pendingReview}),G(!1),(Te.visibility??Q?.visibility??"public")!=="org"&&(Te.moderationStatus==="pending"||Te.pendingReview)?W({title:m("common:share"),message:Z.converted?m("share.convertedAndSubmitted",{previous:t,slug:Ke}):Te.updated?m("share.updateSubmitted"):m("share.submittedForReview"),variant:"primary"}):Z.converted&&W({title:m("common:share"),message:m("share.convertedSlug",{previous:t,slug:Ke}),variant:"primary"}))}catch(Z){console.error("Share to Hub failed:",Z),W({title:m("common:share"),message:Z instanceof Error?Z.message:String(Z),variant:"danger"})}finally{X(!1)}}},[T,w,e,t,y,m]),je=async Q=>{const Z=new FormData;Z.append("image",Q);try{await fetch(`/api/builder/artifacts/${e}s/${encodeURIComponent(y)}/images`,{method:"POST",body:Z,credentials:"include"}),await bt(),G(!0),P(be=>be+1)}catch(be){console.error("Image upload failed:",be)}},Ae=async Q=>{try{await fetch(`/api/builder/artifacts/${e}s/${encodeURIComponent(y)}/images/${encodeURIComponent(Q)}`,{method:"DELETE",credentials:"include"}),await bt(),G(!0),P(Z=>Z+1)}catch(Z){console.error("Image remove failed:",Z)}},oe=D4[e]??D4.agent,H=T?.screenshots??[],te=T?.skill?.skillFile?w[T.skill.skillFile]:w["SKILL.md"]??w["README.md"],Ne=k.useMemo(()=>e!=="agent"?[]:Object.entries(w).filter(([Q])=>!Q.endsWith(".json")&&!Q.startsWith("images/")&&!Q.startsWith("members/")),[w,e]),Re=k.useMemo(()=>e!=="team"?[]:Object.entries(w).filter(([Q])=>!Q.endsWith(".json")&&!Q.startsWith("images/")&&!Q.startsWith("members/")),[w,e]),$e=k.useMemo(()=>{if(e==="agent"||e==="team")return[];const Q=new Set;if(e==="skill"){const Z=T?.skill?.skillFile;Z&&w[Z]&&Q.add(Z),!Z&&w["SKILL.md"]&&Q.add("SKILL.md"),!Z&&!w["SKILL.md"]&&w["README.md"]&&Q.add("README.md")}return Object.entries(w).filter(([Z])=>!Z.endsWith(".json")&&!Z.startsWith("images/")&&!Z.startsWith("members/")&&!Q.has(Z))},[w,e,T?.skill?.skillFile]);return h?s.jsx("div",{className:"flex-1 overflow-y-auto",children:s.jsxs("div",{className:"px-6 py-8",children:[s.jsxs("button",{onClick:n,className:"text-xs text-brand-400 hover:text-brand-300 mb-4 inline-flex items-center gap-1",children:[s.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"15 18 9 12 15 6"})}),m("detail.backToBuilder")]}),s.jsx("div",{className:"text-fg-tertiary text-sm animate-pulse py-20 text-center",children:m("common:loading")})]})}):T?s.jsxs("div",{className:"flex-1 overflow-y-auto",children:[s.jsxs("div",{className:`${f?"px-4 py-5":"px-6 py-8"}`,children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("button",{onClick:n,className:"text-xs text-brand-400 hover:text-brand-300 inline-flex items-center gap-1",children:[s.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"15 18 9 12 15 6"})}),m(o?"common:back":"detail.backToBuilder")]}),s.jsxs("div",{className:"flex items-center gap-2",children:[!o&&L==="saving"&&s.jsx("span",{className:"text-[10px] text-fg-muted animate-pulse",children:m("detail.saving")}),!o&&L==="saved"&&s.jsxs("span",{className:"text-[10px] text-green-500 inline-flex items-center gap-1",children:[s.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}),m("detail.saved")]}),!o&&L==="error"&&s.jsx("span",{className:"text-[10px] text-red-500",children:m("detail.saveFailed")}),c,!o&&O.shared&&(()=>{const Q=lt.getUser(),Z=Q&&O.slug?`${lt.getUrl()}/@${encodeURIComponent(Q.username)}/${encodeURIComponent(O.slug)}`:null,be=ct||T?.version||"1.0.0",Ke=O.version!==be;return s.jsxs(s.Fragment,{children:[O.moderationStatus==="pending"?s.jsxs("span",{className:"text-xs px-2 py-1.5 rounded-lg border border-amber-500/30 text-amber-400 inline-flex items-center gap-1",title:m("share.underReviewTip"),children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"12 6 12 12 16 14"})]}),m("share.underReview")]}):O.moderationStatus==="rejected"?s.jsxs("span",{className:"text-xs px-2 py-1.5 rounded-lg border border-red-500/30 text-red-400 inline-flex items-center gap-1",title:m("share.rejectedTip"),children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),s.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),m("share.rejected")]}):O.pendingReview?s.jsxs("span",{className:"text-xs px-2 py-1.5 rounded-lg border border-amber-500/30 text-amber-400 inline-flex items-center gap-1",title:m("share.updateUnderReviewTip"),children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"12 6 12 12 16 14"})]}),m("share.updateUnderReview")]}):null,Z&&s.jsxs("a",{href:Z,target:"_blank",rel:"noopener noreferrer",onClick:Ie=>{yc()&&(Ie.preventDefault(),_i(Z))},className:`text-xs px-3 py-1.5 rounded-lg border transition-colors inline-flex items-center gap-1.5 ${O.visibility==="org"?"border-blue-500/30 text-blue-500 hover:text-blue-400 hover:border-blue-400/50":O.visibility==="unlisted"?"border-gray-500/30 text-fg-tertiary hover:text-fg-secondary hover:border-gray-400/50":"border-green-600/30 text-green-600 hover:text-green-500 hover:border-green-500/50"}`,children:[O.visibility==="org"?s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M3 21h18"}),s.jsx("path",{d:"M9 8h1"}),s.jsx("path",{d:"M9 12h1"}),s.jsx("path",{d:"M9 16h1"}),s.jsx("path",{d:"M14 8h1"}),s.jsx("path",{d:"M14 12h1"}),s.jsx("path",{d:"M14 16h1"}),s.jsx("path",{d:"M5 21V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16"})]}):O.visibility==="unlisted"?s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),s.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}):s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),s.jsx("polyline",{points:"15 3 21 3 21 9"}),s.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),O.visibility==="org"?m("visibility.sharedOrg"):O.visibility==="unlisted"?m("visibility.sharedUnlisted"):m("share.viewOnHub")]}),Ke&&s.jsx("button",{onClick:()=>{ye({visibility:O.visibility})},disabled:V,className:"text-xs px-3 py-1.5 rounded-lg border border-amber-500/30 text-amber-400 hover:bg-amber-500/10 hover:border-amber-500/50 transition-colors disabled:opacity-50",children:V?m("share.updating"):m("share.updateVersion",{version:be})})]})})(),!o&&!O.shared&&s.jsx("button",{onClick:()=>J(!0),disabled:V,className:"text-xs px-3 py-1.5 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors disabled:opacity-50",children:m(V?"share.sharing":"share.toHub")})]})]}),!o&&z&&!se&&s.jsxs("div",{className:"mb-4 px-4 py-2.5 rounded-lg bg-amber-50 dark:bg-amber-500/10 border border-amber-300 dark:border-amber-500/20 flex items-center justify-between",children:[s.jsx("span",{className:"text-xs text-amber-800 dark:text-amber-300",children:m("versionBump.contentModified")}),s.jsx("button",{onClick:()=>ee(!0),className:"text-xs px-3 py-1 rounded bg-amber-200 dark:bg-amber-500/20 text-amber-800 dark:text-amber-300 hover:bg-amber-300 dark:hover:bg-amber-500/30 transition-colors",children:m("versionBump.bumpVersion")})]}),!o&&se&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-amber-50 dark:bg-amber-500/10 border border-amber-300 dark:border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs text-amber-800 dark:text-amber-300",children:m("versionBump.newVersion")}),s.jsx("input",{type:"text",defaultValue:(()=>{const Q=(ct||"1.0.0").split(".");return Q[2]=String(Number(Q[2]??0)+1),Q.join(".")})(),className:"text-xs px-2 py-1 rounded bg-surface-elevated border border-border-default text-fg-primary w-24 font-mono",onKeyDown:Q=>{Q.key==="Enter"&&tt("version",Q.target.value)}}),s.jsx("button",{onClick:Q=>{const Z=Q.target.parentElement?.querySelector("input");Z&&tt("version",Z.value)},className:"text-xs px-3 py-1 rounded bg-amber-200 dark:bg-amber-500/20 text-amber-800 dark:text-amber-300 hover:bg-amber-300 dark:hover:bg-amber-500/30 transition-colors",children:m("common:confirm")}),s.jsx("button",{onClick:()=>ee(!1),className:"text-xs text-fg-tertiary hover:text-fg-secondary",children:m("common:cancel")})]}),O.shared&&s.jsx("p",{className:"text-[10px] text-fg-tertiary mt-2",children:"After bumping the version, you can share the new version to Hub."})]}),s.jsxs("div",{className:`flex gap-8 ${f?"flex-col":""}`,children:[s.jsxs("div",{className:`${f?"w-full":"flex-1 min-w-0"}`,children:[s.jsxs("div",{className:"flex items-start gap-4 mb-6",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{onClick:()=>!o&&Se(!fe),className:`w-16 h-16 rounded-xl ${oe.bg} flex items-center justify-center text-3xl shrink-0 ${o?"":"cursor-pointer hover:ring-2"} ${oe.ring} transition-all overflow-hidden`,children:yt&&yt.startsWith("images/")?s.jsx("img",{src:`/api/builder/artifacts/${e}s/${encodeURIComponent(y)}/images/${encodeURIComponent(yt.replace("images/",""))}?v=${pe}`,alt:"",className:"w-full h-full object-cover"}):yt&&(yt.startsWith("http")||yt.startsWith("/"))?s.jsx("img",{src:yt,alt:"",className:"w-full h-full object-cover"}):(()=>{const Q=yt||"";if(Q&&[...Q].length<=2&&new RegExp("\\p{Emoji}","u").test(Q))return Q;const be=Ei[Xo(e)].accent;return s.jsx("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:s.jsx("path",{d:s6(_e||t||e),fill:be})})})()}),!o&&fe&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Se(!1)}),s.jsxs("div",{className:"absolute top-full left-0 mt-2 z-50 bg-surface-secondary border border-border-default rounded-xl p-3 shadow-xl w-80",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx("input",{type:"text",placeholder:m("detail.pasteEmojiOrUrl"),className:"flex-1 text-sm px-2 py-1.5 rounded-lg bg-surface-elevated border border-border-default text-fg-primary placeholder:text-fg-muted",defaultValue:yt,onKeyDown:Q=>{Q.key==="Enter"&&(tt("icon",Q.target.value),Se(!1))}}),s.jsxs("label",{className:"text-[10px] text-brand-400 hover:text-brand-300 cursor-pointer px-1.5 py-1 border border-brand-500/30 rounded-lg",children:[m("detail.upload"),s.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:async Q=>{const Z=Q.target.files?.[0];if(!Z)return;const be=new FormData;be.append("image",Z);try{const Ke=await fetch(`/api/builder/artifacts/${e}s/${encodeURIComponent(y)}/images`,{method:"POST",body:be,credentials:"include"});if(Ke.ok){const Ye=(await Ke.json()).path;if(Ue(Ye),Se(!1),T){const M={...T,icon:Ye};S(M),await Ee.builder.artifacts.save(e,M)}G(!0)}}catch{}}})]}),yt&&s.jsx("button",{onClick:()=>{tt("icon",""),Se(!1)},className:"text-[10px] text-fg-tertiary hover:text-red-400 px-1",children:"✕"})]}),s.jsx("div",{className:"max-h-64 overflow-y-auto",children:SW.map(Q=>s.jsxs("div",{className:"mb-2.5",children:[s.jsx("div",{className:"text-[10px] text-fg-tertiary mb-1 sticky top-0 bg-surface-secondary py-0.5",children:Q.label}),s.jsx("div",{className:"flex flex-wrap gap-0.5",children:Q.emojis.map(Z=>s.jsx("button",{onClick:()=>{tt("icon",Z),Se(!1)},className:`w-7 h-7 rounded flex items-center justify-center text-base hover:bg-surface-elevated transition-colors ${yt===Z?"ring-1.5 ring-brand-500 bg-brand-500/10":""}`,children:Z},Z))})]},Q.label))})]})]})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx(ah,{value:_e,onChange:Q=>tt("displayName",Q),renderAs:"h1",className:"text-xl font-bold text-fg-primary",placeholder:m("detail.untitled"),readOnly:o}),s.jsx("span",{className:`text-[10px] font-medium uppercase tracking-wider px-2 py-0.5 rounded-full ${oe.bg} ${oe.color}`,children:oe.label}),s.jsx(ah,{value:ct,onChange:Q=>tt("version",Q),renderAs:"badge",className:"text-[10px] px-2 py-0.5 rounded-full bg-surface-elevated text-fg-tertiary border border-border-default font-mono",placeholder:"1.0.0",readOnly:o})]}),s.jsx(ah,{value:Pe,onChange:Q=>tt("description",Q),renderAs:"p",className:"text-sm text-fg-secondary mt-1.5 leading-relaxed",placeholder:m("detail.addDescription"),multiline:!0,readOnly:o}),s.jsxs("div",{className:"flex items-center gap-2 mt-2 flex-wrap",children:[s.jsx(CW,{value:Ct,options:kW,onChange:Q=>tt("category",Q),className:"text-xs px-2 py-0.5 rounded bg-surface-elevated text-fg-tertiary",readOnly:o}),s.jsx(TW,{tags:Pt,onChange:Q=>tt("tags",Q),readOnly:o})]})]})]}),s.jsx("div",{className:"mb-8",children:s.jsx(EW,{images:H,artifactType:e,artifactName:t,onUpload:je,onRemove:Ae,readOnly:o,cacheBust:pe})}),d&&s.jsx("div",{className:"mb-8",children:d}),e==="team"&&T.team&&s.jsx("div",{className:"mb-8",children:s.jsx(_W,{members:T.team.members,teamTopFiles:Re,files:w,artifactName:y,onFileSave:st,readOnly:o})}),e==="agent"&&Ne.length>0&&s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-sm font-semibold text-fg-primary mb-4 uppercase tracking-wider",children:"About This Agent"}),s.jsx(S0,{noHeader:!0,files:Ne,onSave:st,readOnly:o})]}),e==="skill"&&s.jsxs("div",{className:"mb-8",children:[T.skill?.requiredPermissions&&T.skill.requiredPermissions.length>0&&s.jsxs("div",{className:"mb-6",children:[s.jsx("h2",{className:"text-sm font-semibold text-fg-primary mb-3 uppercase tracking-wider",children:m("sidebar.permissions")}),s.jsx("div",{className:"flex flex-wrap gap-2",children:T.skill.requiredPermissions.map(Q=>{const Z=NW[Q];return s.jsxs("span",{className:`inline-flex items-center gap-1.5 text-xs px-3 py-1.5 rounded-lg border font-medium ${Z?.color??"bg-surface-elevated text-fg-secondary border-border-default"}`,children:[s.jsx("span",{className:"font-mono text-[10px]",children:Z?.icon??"?"})," ",Q]},Q)})})]}),T.skill?.mcpServers&&Object.keys(T.skill.mcpServers).length>0&&s.jsxs("div",{className:"mb-6",children:[s.jsx("h2",{className:"text-sm font-semibold text-fg-primary mb-3 uppercase tracking-wider",children:"Integrations"}),s.jsx("div",{className:"grid gap-2",children:Object.entries(T.skill.mcpServers).map(([Q,Z])=>s.jsxs("div",{className:"rounded-lg border border-border-default bg-surface-secondary/40 px-4 py-3 flex items-center gap-3",children:[s.jsx("span",{className:"w-8 h-8 rounded-lg bg-purple-500/15 flex items-center justify-center text-purple-400 text-sm shrink-0",children:"◎"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-xs font-medium text-fg-primary",children:Q}),s.jsx("div",{className:"text-[10px] text-fg-muted font-mono truncate",children:typeof Z=="object"?JSON.stringify(Z).slice(0,80):String(Z)})]})]},Q))})]}),te&&s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-semibold text-fg-primary mb-3 uppercase tracking-wider",children:"Instructions"}),s.jsx("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 p-5",children:s.jsx(ag,{content:te})})]})]}),$e.length>0&&s.jsx(S0,{files:$e,onSave:st,readOnly:o})]}),s.jsx("div",{className:`${f?"w-full":"w-72 shrink-0"}`,children:s.jsxs("div",{className:`${f?"":"sticky top-6"} space-y-4`,children:[s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/60 p-4 space-y-3",children:[s.jsx("div",{className:"text-xs font-medium text-fg-tertiary uppercase tracking-wider",children:m("sidebar.info")}),s.jsxs("div",{className:"space-y-2 text-xs",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.type")}),s.jsx("span",{className:`font-medium ${oe.color}`,children:oe.label})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.category")}),s.jsx("span",{className:"text-fg-secondary",children:Ct})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.version")}),s.jsx("span",{className:"text-fg-secondary font-mono",children:ct})]}),T.author&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.author")}),s.jsx("span",{className:"text-fg-secondary",children:typeof T.author=="string"?T.author:T.author?.name??""})]})]})]}),e==="agent"&&T.agent&&s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/60 p-4 space-y-3",children:[s.jsx("div",{className:"text-xs font-medium text-fg-tertiary uppercase tracking-wider",children:m("sidebar.agentSpecs")}),s.jsxs("div",{className:"space-y-2 text-xs",children:[T.agent.roleName&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.role")}),s.jsx("span",{className:"text-fg-secondary",children:T.agent.roleName})]}),T.agent.llmProvider&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.provider")}),s.jsx("span",{className:"text-fg-secondary",children:T.agent.llmProvider})]}),T.agent.llmModel&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.model")}),s.jsx("span",{className:"text-fg-secondary font-mono",children:T.agent.llmModel})]}),T.agent.temperature!==void 0&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.temperature")}),s.jsx("span",{className:"text-fg-secondary",children:T.agent.temperature})]})]})]}),e==="team"&&T.team&&s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/60 p-4 space-y-3",children:[s.jsx("div",{className:"text-xs font-medium text-fg-tertiary uppercase tracking-wider",children:m("sidebar.composition")}),s.jsxs("div",{className:"space-y-2 text-xs",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.totalMembers")}),s.jsx("span",{className:"text-fg-secondary",children:T.team.members.reduce((Q,Z)=>Q+Z.count,0)})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.managers")}),s.jsx("span",{className:"text-amber-400",children:T.team.members.filter(Q=>Q.role==="manager").reduce((Q,Z)=>Q+Z.count,0)})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.workers")}),s.jsx("span",{className:"text-blue-400",children:T.team.members.filter(Q=>Q.role!=="manager").reduce((Q,Z)=>Q+Z.count,0)})]})]})]}),e==="skill"&&T.skill&&s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/60 p-4 space-y-3",children:[s.jsx("div",{className:"text-xs font-medium text-fg-tertiary uppercase tracking-wider",children:m("sidebar.skillInfo")}),s.jsxs("div",{className:"space-y-2 text-xs",children:[T.skill.alwaysOn!==void 0&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.alwaysOn")}),s.jsx("span",{className:T.skill.alwaysOn?"text-green-400":"text-fg-secondary",children:T.skill.alwaysOn?m("sidebar.yes"):m("sidebar.no")})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.skillFile")}),s.jsx("span",{className:"text-fg-secondary font-mono truncate ml-2",children:T.skill.skillFile})]}),T.skill.requiredPermissions&&T.skill.requiredPermissions.length>0&&s.jsxs("div",{children:[s.jsx("span",{className:"text-fg-muted",children:m("sidebar.permissions")}),s.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:T.skill.requiredPermissions.map(Q=>s.jsx("span",{className:"text-[10px] px-1.5 py-0.5 bg-surface-elevated text-fg-muted rounded border border-border-default",children:Q},Q))})]})]})]}),T.dependencies&&(T.dependencies.skills?.length||T.dependencies.env?.length)?s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/60 p-4 space-y-3",children:[s.jsx("div",{className:"text-xs font-medium text-fg-tertiary uppercase tracking-wider",children:m("sidebar.dependencies")}),T.dependencies.skills?.length?s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] text-fg-muted mb-1",children:m("sidebar.skills")}),s.jsx("div",{className:"flex flex-wrap gap-1",children:T.dependencies.skills.map(Q=>s.jsx("span",{className:"text-[10px] px-2 py-0.5 bg-surface-elevated text-fg-secondary rounded border border-border-default",children:Q},Q))})]}):null,T.dependencies.env?.length?s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] text-fg-muted mb-1",children:m("sidebar.environment")}),s.jsx("div",{className:"flex flex-wrap gap-1",children:T.dependencies.env.map(Q=>s.jsx("span",{className:"text-[10px] px-2 py-0.5 bg-surface-elevated text-fg-secondary rounded font-mono border border-border-default",children:Q},Q))})]}):null]}):null,!o&&E&&s.jsxs("button",{onClick:()=>Ee.system.openPath(E).catch(()=>{}),className:"w-full text-left rounded-xl border border-border-default bg-surface-secondary/60 px-4 py-3 text-[10px] text-fg-muted hover:text-fg-secondary hover:border-gray-600 transition-colors truncate",title:E,children:[s.jsx("span",{className:"text-fg-tertiary block mb-0.5",children:m("sidebar.openInFinder")}),E.replace(/.*\.markus\//,"~/.markus/")]})]})})]})]}),!o&&q&&s.jsx(MW,{onClose:()=>re(!1),onConfirm:(Q,Z)=>{re(!1),ye({donationsEnabled:!1,priceCents:Q==="paid"?Z:void 0})},isUpdate:O.shared}),!o&&B&&s.jsx(jW,{onClose:()=>J(!1),onConfirm:(Q,Z,be,Ke)=>{J(!1),ye({visibility:Q,orgId:Z,priceCents:be,donationsEnabled:Ke})}}),U&&s.jsx(dr,{alertOnly:!0,variant:U.variant??"primary",title:U.title,message:U.message,onConfirm:()=>W(null),onCancel:()=>W(null)})]}):s.jsx("div",{className:"flex-1 overflow-y-auto",children:s.jsxs("div",{className:"px-6 py-8",children:[s.jsxs("button",{onClick:n,className:"text-xs text-brand-400 hover:text-brand-300 mb-4 inline-flex items-center gap-1",children:[s.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("polyline",{points:"15 18 9 12 15 6"})}),m("detail.backToBuilder")]}),s.jsx("div",{className:"text-fg-tertiary text-sm py-20 text-center",children:m("detail.notFound")})]})})}function jW({onClose:e,onConfirm:t}){const{t:n}=ft(["builder","common"]),[r,o]=k.useState("public"),[l,c]=k.useState([]),[d,m]=k.useState(""),[f,h]=k.useState(!1),[g,y]=k.useState(0),[x,w]=k.useState(!1);k.useEffect(()=>{r==="org"&&l.length===0&&(h(!0),lt.myOrgs().then(S=>{c(S.memberships),S.memberships.length>0&&m(S.memberships[0].id)}).catch(()=>{}).finally(()=>h(!1)))},[r,l.length]);const C=r==="public"||r==="unlisted",T=[{value:"public",icon:s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),s.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]}),label:n("visibility.public"),desc:n("visibility.publicDesc")},{value:"org",icon:s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M3 21h18"}),s.jsx("path",{d:"M9 8h1"}),s.jsx("path",{d:"M9 12h1"}),s.jsx("path",{d:"M9 16h1"}),s.jsx("path",{d:"M14 8h1"}),s.jsx("path",{d:"M14 12h1"}),s.jsx("path",{d:"M14 16h1"}),s.jsx("path",{d:"M5 21V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16"})]}),label:n("visibility.org"),desc:n("visibility.orgDesc")},{value:"unlisted",icon:s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),s.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),label:n("visibility.unlisted"),desc:n("visibility.unlistedDesc")}];return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:e,children:s.jsxs("div",{className:"bg-surface-secondary border border-border-default rounded-xl max-w-sm w-full mx-4 p-6 shadow-2xl",onClick:S=>S.stopPropagation(),children:[s.jsx("h3",{className:"text-base font-semibold text-fg-primary mb-1",children:n("visibility.label")}),s.jsx("p",{className:"text-[11px] text-fg-tertiary mb-4 leading-relaxed",children:n("visibility.subtitle")}),s.jsxs("div",{className:"text-[10px] uppercase tracking-wider text-fg-tertiary font-semibold mb-2",children:["1 · ",n("visibility.public")," / ",n("visibility.org")]}),s.jsx("div",{className:"space-y-2 mb-5",children:T.map(S=>s.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${r===S.value?"border-brand-500 bg-brand-500/10":"border-border-default hover:border-gray-600"}`,children:[s.jsx("input",{type:"radio",name:"visibility",checked:r===S.value,onChange:()=>o(S.value),className:"accent-brand-500"}),s.jsx("div",{className:"flex items-center gap-2 text-fg-secondary",children:S.icon}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium text-fg-primary",children:S.label}),s.jsx("div",{className:"text-[11px] text-fg-tertiary",children:S.desc})]})]},S.value))}),r==="org"&&s.jsxs("div",{className:"mb-5",children:[s.jsx("label",{className:"text-xs text-fg-secondary block mb-1.5",children:n("visibility.orgSelect")}),f?s.jsx("div",{className:"text-xs text-fg-tertiary py-2",children:"Loading..."}):l.length===0?s.jsx("div",{className:"text-xs text-fg-tertiary py-2",children:n("visibility.orgNone")}):s.jsx("select",{value:d,onChange:S=>m(S.target.value),className:"w-full text-sm px-3 py-2 rounded-lg bg-surface-elevated border border-border-default text-fg-primary",children:l.map(S=>s.jsx("option",{value:S.id,children:S.name},S.id))})]}),C&&s.jsxs("div",{className:"mb-5",children:[s.jsxs("div",{className:"text-[10px] uppercase tracking-wider text-fg-tertiary font-semibold mb-2",children:["2 · ",n("pricing.label")]}),s.jsx("label",{className:"text-xs text-fg-secondary block mb-1.5",children:n("pricing.label")}),s.jsx("div",{className:"grid grid-cols-4 gap-2 mb-3",children:o6.map(S=>s.jsx("button",{type:"button",onClick:()=>y(S.cents),className:`text-sm px-2 py-2 rounded-lg border transition-colors ${g===S.cents?"border-brand-500 bg-brand-500/10 text-fg-primary":"border-border-default text-fg-secondary hover:border-gray-600"}`,children:S.label},S.cents))}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:x,onChange:S=>w(S.target.checked),className:"accent-brand-500"}),s.jsx("span",{className:"text-xs text-fg-secondary",children:n("pricing.enableTips")})]})]}),C&&s.jsx("div",{className:"mb-4 text-[11px] text-fg-tertiary rounded-lg border border-border-default px-3 py-2",children:n("pricing.reviewNote")}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{onClick:e,className:"flex-1 text-sm px-4 py-2 rounded-lg border border-border-default text-fg-secondary hover:text-fg-primary hover:border-gray-600 transition-colors",children:n("common:cancel")}),s.jsx("button",{onClick:()=>t(r,r==="org"?d:void 0,C&&g>0?g:void 0,C?x:void 0),disabled:r==="org"&&!d,className:"flex-1 text-sm px-4 py-2 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:n("shareMode.share")})]})]})})}const o6=[{cents:0,label:"Free"},{cents:100,label:"$1"},{cents:500,label:"$5"},{cents:1e3,label:"$10"}];function MW({onClose:e,onConfirm:t,isUpdate:n}){const{t:r}=ft(["builder","common"]),[o,l]=k.useState(0);return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:e,children:s.jsxs("div",{className:"bg-surface-secondary border border-border-default rounded-xl max-w-sm w-full mx-4 p-6 shadow-2xl",onClick:c=>c.stopPropagation(),children:[s.jsx("h3",{className:"text-base font-semibold text-fg-primary mb-4",children:r(n?"shareMode.titleUpdate":"share.toHub")}),s.jsx("div",{className:"space-y-2 mb-5",children:o6.map(c=>s.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${o===c.cents?"border-brand-500 bg-brand-500/10":"border-border-default hover:border-gray-600"}`,children:[s.jsx("input",{type:"radio",name:"sharePrice",checked:o===c.cents,onChange:()=>l(c.cents),className:"accent-brand-500"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium text-fg-primary",children:c.label}),s.jsx("div",{className:"text-[11px] text-fg-tertiary",children:c.cents===0?r("shareMode.freeDesc"):r("shareMode.paidDesc")})]})]},c.cents))}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{onClick:e,className:"flex-1 text-sm px-4 py-2 rounded-lg border border-border-default text-fg-secondary hover:text-fg-primary hover:border-gray-600 transition-colors",children:r("common:cancel")}),s.jsx("button",{onClick:()=>t(o>0?"paid":"free",o),className:"flex-1 text-sm px-4 py-2 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors",children:r(n?"shareMode.update":"shareMode.share")})]})]})})}function N0(e,t){return!e||!i6(e)?null:e.startsWith("http")||e.startsWith("data:")?e:e.startsWith("/")&&t?`${t}${e}`:e}function RW({type:e,seed:t,icon:n,hubBase:r,size:o=44,className:l="",rounded:c="rounded-xl"}){const d=Xo(e),m=N0(n,r),f=k.useMemo(()=>Xg(d,t),[d,t]),h=k.useMemo(()=>s6(t),[t]),[g,y]=k.useState(!1);return m&&!g?s.jsx("img",{src:m,alt:"",onError:()=>y(!0),style:{width:o,height:o},className:`${c} object-cover shrink-0 ${l}`}):vW(n)?s.jsx("div",{style:{width:o,height:o,background:f,fontSize:o*.5},className:`${c} shrink-0 flex items-center justify-center shadow-inner ${l}`,children:s.jsx("span",{className:"drop-shadow-sm",children:n})}):n&&MK(n)?s.jsx("div",{style:{width:o,height:o,background:f},className:`${c} shrink-0 flex items-center justify-center text-white shadow-inner ${l}`,children:s.jsx(Yo,{name:n,size:o*.52,className:"drop-shadow-sm"})}):s.jsx("div",{style:{width:o,height:o,background:f},className:`${c} shrink-0 flex items-center justify-center shadow-inner ${l}`,children:s.jsx("svg",{width:o*.55,height:o*.55,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:s.jsx("path",{d:h,fill:"rgba(255,255,255,0.92)"})})})}function C0({name:e,username:t,avatarUrl:n,hubBase:r,size:o=24,className:l="",verified:c}){const d=t||e||"markus",m=N0(n,r),[f,h]=k.useState(!1),g=m&&!f?m:wW(d);return s.jsxs("span",{className:`relative inline-flex shrink-0 ${l}`,style:{width:o,height:o},children:[s.jsx("img",{src:g,alt:e||t||"",onError:()=>h(!0),className:"w-full h-full rounded-full object-cover ring-1 ring-white/10 bg-surface-elevated"}),c&&s.jsx("span",{className:"absolute -right-0.5 -bottom-0.5 flex items-center justify-center rounded-full bg-brand-500 ring-2 ring-surface-primary",style:{width:o*.42,height:o*.42},children:s.jsx("svg",{viewBox:"0 0 24 24",width:"60%",height:"60%",fill:"white","aria-hidden":!0,children:s.jsx("path",{d:"M9 16.2l-3.5-3.5 1.4-1.4L9 13.4l7.1-7.1 1.4 1.4z"})})})]})}function LW({type:e,className:t=""}){const n=Xo(e),r=Ei[n];return s.jsx("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold tracking-wide text-white bg-gradient-to-r ${r.gradient} ${t}`,children:r.label})}function P4({rating:e=0}){const t=Math.round(e);return s.jsx("span",{className:"inline-flex items-center","aria-label":`${e} out of 5`,children:[0,1,2,3,4].map(n=>s.jsx("svg",{viewBox:"0 0 24 24",width:"12",height:"12",className:n<t?"text-amber-400":"text-fg-muted/40",fill:"currentColor","aria-hidden":!0,children:s.jsx("path",{d:"M12 2l2.4 6.9L21 9l-5.4 4 2 7-5.6-4.1L6.4 20l2-7L3 9l6.6-.1z"})},n))})}function ia(e){const{type:t,name:n,description:r,seed:o,icon:l,cover:c,hubBase:d,author:m,authorLabel:f,version:h,category:g,tags:y,rating:x=0,ratingCount:w=0,downloadCount:C=0,priceCents:T,currency:S="usd",installed:E,glowing:j,selected:L,showTypeBadge:I=!0,hideStats:O=!1,cornerLabel:F,actions:V,footerLeft:X,headerAction:z,onClick:G,className:se=""}=e,ee=Xo(t),q=Ei[ee],re=o||n,B=(T??0)>0,J=!!N0(c||void 0,d),fe=Xg(ee,re),Se=f??m?.displayName??m?.username??"",[U,W]=k.useState(null),pe=E?s.jsx("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-500/12 text-emerald-400 border border-emerald-500/25 px-2 py-0.5 text-[10px] font-semibold",children:s.jsx("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.5",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})})}):F?s.jsx("span",{className:"chip",children:F}):B?s.jsx("span",{className:"badge-paid",children:O4(T,S)}):null;if(J){const P=N0(c||void 0,d);return s.jsxs("div",{onClick:G,style:{aspectRatio:U??void 0},className:`group asset-card card-shine relative flex flex-col overflow-hidden min-h-[180px] ${G?"cursor-pointer":""} ${L?"ring-1 ring-brand-500/60":""} ${j?"ring-2 ring-brand-500 shadow-lg shadow-brand-500/20":""} ${se}`,children:[s.jsx("img",{src:P,alt:"",onLoad:_e=>{const He=_e.currentTarget;He.naturalWidth&&He.naturalHeight&&W(Math.min(1.9,Math.max(1,He.naturalWidth/He.naturalHeight)))},className:"absolute inset-0 w-full h-full object-cover transition-transform duration-[600ms] group-hover:scale-[1.05]"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/90 via-black/50 to-black/5"}),s.jsx("div",{className:"absolute inset-x-0 top-0 h-20 bg-gradient-to-b from-black/50 to-transparent"}),s.jsxs("div",{className:"relative flex items-start justify-between gap-2 p-3",children:[s.jsx("span",{children:I&&s.jsx(LW,{type:ee})}),s.jsxs("span",{className:"flex items-center gap-1.5",onClick:_e=>_e.stopPropagation(),children:[E?s.jsx("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-500/25 text-emerald-50 border border-emerald-300/40 px-2 py-0.5 text-[10px] font-semibold backdrop-blur-md",children:s.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})})}):F?s.jsx("span",{className:"inline-flex items-center rounded-full bg-white/15 text-white border border-white/25 px-2 py-0.5 text-[10px] font-medium backdrop-blur-md",children:F}):z?null:s.jsx("span",{className:B?"badge-paid":"badge-free",children:O4(T,S)}),z]})]}),s.jsxs("div",{className:"relative mt-auto p-4 pt-10 flex flex-col gap-2 text-white",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h3",{className:"text-[15px] font-semibold truncate drop-shadow-md",children:n}),h&&s.jsxs("span",{className:"shrink-0 rounded-full bg-white/15 border border-white/25 px-1.5 py-0.5 text-[10px] font-medium backdrop-blur-md",children:["v",h]})]}),Se&&s.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-white/85",children:[m&&s.jsx(C0,{name:m.displayName,username:m.username,avatarUrl:m.avatarUrl,hubBase:d,size:15}),s.jsx("span",{className:"truncate",children:Se})]}),r&&s.jsx("p",{className:"text-[12.5px] text-white/80 truncate leading-snug drop-shadow-sm",children:r}),(g||y&&y.length>0)&&s.jsxs("div",{className:"flex flex-nowrap gap-1.5 overflow-hidden",children:[g&&s.jsx("span",{className:"shrink-0 rounded-full bg-white/15 border border-white/20 text-white/95 px-2 py-0.5 text-[10px] font-semibold capitalize backdrop-blur-md",children:g}),y?.slice(0,3).map(_e=>s.jsx("span",{className:"shrink-0 rounded-full bg-white/10 border border-white/15 text-white/85 px-2 py-0.5 text-[10px] backdrop-blur-md",children:_e},_e))]}),(!O||V)&&s.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1 shrink-0",children:[O?s.jsx("span",{}):s.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-white/80",children:[s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(P4,{rating:x}),w>0&&s.jsxs("span",{className:"text-white/60",children:["(",Mo(w),")"]})]}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx("svg",{viewBox:"0 0 24 24",width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":!0,children:s.jsx("path",{d:"M12 3v12m0 0l-4-4m4 4l4-4M5 21h14"})}),Mo(C)]})]}),V&&s.jsx("div",{className:"flex items-center gap-2",onClick:_e=>_e.stopPropagation(),children:V})]})]})]})}return s.jsxs("div",{onClick:G,className:`group asset-card card-shine relative flex flex-col ${G?"cursor-pointer":""} ${L?"ring-1 ring-brand-500/60":""} ${j?"ring-2 ring-brand-500 shadow-lg shadow-brand-500/20":""} ${se}`,children:[s.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-[2px] opacity-0 group-hover:opacity-100 transition-opacity duration-300",style:{background:`linear-gradient(90deg, transparent, ${q.accent}, transparent)`}}),s.jsx("div",{className:"pointer-events-none absolute -top-10 -left-10 w-36 h-36 rounded-full blur-2xl opacity-[0.12] group-hover:opacity-20 transition-opacity duration-300",style:{background:fe}}),z&&s.jsx("div",{className:"absolute top-2.5 right-2.5 z-10",onClick:P=>P.stopPropagation(),children:z}),s.jsxs("div",{className:"relative p-4 flex flex-col flex-1 gap-2.5",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(RW,{type:ee,seed:re,icon:l,hubBase:d,size:46,rounded:"rounded-2xl",className:"ring-1 ring-white/10 shadow-sm shadow-black/20"}),s.jsxs("div",{className:`min-w-0 flex-1 ${z?"pr-7":""}`,children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h3",{className:"text-sm font-semibold text-fg-primary truncate group-hover:text-brand-300 transition-colors",children:n}),h&&s.jsxs("span",{className:"chip shrink-0",children:["v",h]}),pe&&s.jsx("span",{className:"ml-auto shrink-0",children:pe})]}),(Se||I)&&s.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-[11px] text-fg-tertiary min-w-0",children:[m&&s.jsx(C0,{name:m.displayName,username:m.username,avatarUrl:m.avatarUrl,hubBase:d,size:15}),Se&&s.jsx("span",{className:"truncate",children:Se}),I&&s.jsxs(s.Fragment,{children:[Se&&s.jsx("span",{className:"text-fg-muted",children:"·"}),s.jsx("span",{className:"font-semibold shrink-0",style:{color:q.accent},children:q.label})]})]})]})]}),r&&s.jsx("p",{className:"text-[13px] text-fg-secondary truncate leading-snug",children:r}),(g||y&&y.length>0)&&s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[g&&s.jsx("span",{className:"chip-accent capitalize",children:g}),y?.slice(0,3).map(P=>s.jsx("span",{className:"chip",children:P},P)),(y?.length??0)>3&&s.jsxs("span",{className:"text-[10px] text-fg-muted self-center",children:["+",(y?.length??0)-3]})]}),(()=>{const P=X??(O?null:s.jsxs("span",{className:"flex items-center gap-3 text-[11px] text-fg-tertiary",children:[s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(P4,{rating:x}),s.jsx("span",{className:"text-fg-muted",children:w>0?`(${Mo(w)})`:""})]}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx("svg",{viewBox:"0 0 24 24",width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":!0,children:s.jsx("path",{d:"M12 3v12m0 0l-4-4m4 4l4-4M5 21h14"})}),Mo(C)]})]}));return!P&&!V?null:s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 pt-2 mt-auto border-t border-border-subtle/60",onClick:_e=>_e.stopPropagation(),children:[P&&s.jsx("div",{className:"min-w-0 flex items-center gap-2",children:P}),V&&s.jsx("div",{className:"flex flex-wrap items-center gap-2 justify-end",children:V})]})})()]})]})}function Ar({children:e,maxCardWidth:t=400,gap:n="1rem",className:r=""}){const o=k.useRef(null),[l,c]=k.useState(0);k.useEffect(()=>{const h=o.current;if(!h)return;c(h.clientWidth);const g=new ResizeObserver(y=>{for(const x of y)c(x.contentRect.width)});return g.observe(h),()=>g.disconnect()},[]);const d=Math.max(1,Math.ceil((l||t)/t)),m=k.Children.toArray(e),f=Array.from({length:d},()=>[]);return m.forEach((h,g)=>{f[g%d].push(h)}),s.jsx("div",{ref:o,className:`flex items-start ${r}`,style:{gap:n},children:f.map((h,g)=>s.jsx("div",{className:"flex flex-col flex-1 min-w-0",style:{gap:n,maxWidth:t},children:h},g))})}function OW(e){const t=e.indexOf(".markus/builder-artifacts/");return t>=0?"~/"+e.slice(t):e}const DW=[{id:"hireAgent",icon:"✦",color:"from-brand-500 to-purple-600",borderColor:"border-brand-500/30 hover:border-brand-400/50",bgColor:"bg-brand-500/10"},{id:"buildTeam",icon:"◈",color:"from-blue-500 to-blue-600",borderColor:"border-blue-500/30 hover:border-blue-400/50",bgColor:"bg-blue-500/10"},{id:"createSkill",icon:"⬡",color:"from-green-500 to-green-600",borderColor:"border-green-500/30 hover:border-green-400/50",bgColor:"bg-green-500/10"}];function IW(){const[e,t]=k.useState(()=>{const r=window.location.hash.slice(1).split("/");return fc(r[0])===de.BUILDER&&r[1]&&r[2]?{type:r[1],name:decodeURIComponent(r[2])}:null});return k.useEffect(()=>{const n=()=>{const o=window.location.hash.slice(1).split("/");fc(o[0])===de.BUILDER&&o[1]&&o[2]?t({type:o[1],name:decodeURIComponent(o[2])}):t(null)};return window.addEventListener("hashchange",n),()=>window.removeEventListener("hashchange",n)},[]),e}const l6="markus_builder_shared_map";function PW(){try{const e=localStorage.getItem(l6);if(!e)return new Map;const t=JSON.parse(e);return new Map(Object.entries(t))}catch{return new Map}}function Ld(e){try{localStorage.setItem(l6,JSON.stringify(Object.fromEntries(e)))}catch{}}function c6({authUser:e}={}){const{t}=ft(["builder","common"]),n=Uo(),r=IW(),[o,l]=k.useState([]),[c,d]=k.useState([]),[m,f]=k.useState(!1),[h,g]=k.useState("all"),[y,x]=k.useState(null),[w,C]=k.useState(new Map),[T,S]=k.useState(null),[E,j]=k.useState(null),[L,I]=k.useState(null),[O,F]=k.useState(PW),[V,X]=k.useState(null),[z,G]=k.useState(null),[se,ee]=k.useState(null),[q,re]=k.useState(null),[B,J]=k.useState(null),[fe,Se]=k.useState("creations"),[U,W]=k.useState([]),[pe,P]=k.useState(""),[_e,He]=k.useState([]),[Pe,Ge]=k.useState(!1),[ct,mt]=k.useState("all"),Ct=k.useCallback(()=>{f(!0),Promise.all([(Si(Tr.builderArtifacts)??Ee.builder.artifacts.list()).then(ue=>ue?.artifacts??[]).catch(()=>[]),(Si(Tr.builderAgents)??Ee.agents.list()).then(ue=>ue?.agents??[]).catch(()=>[]),(Si(Tr.builderHubMyItems)??lt.myItems()).then(ue=>ue?.items??[]).catch(()=>[]),(Si(Tr.builderInstalled)??Ee.builder.artifacts.installed()).then(ue=>ue?.installed??{}).catch(()=>({}))]).then(([ue,tt,st,ye])=>{if(d(ue),l(tt),st.length>0){const Ae=new Map;for(const oe of st){const H=oe.itemType==="agent"?"agent":oe.itemType==="team"?"team":"skill";for(const te of ue)te.type===H&&(oe.slug===te.name||oe.name===(te.meta.displayName||te.meta.name||te.name))&&Ae.set(`${te.type}/${te.name}`,{id:oe.id,name:oe.name,slug:oe.slug||te.name,version:oe.version||"1.0.0",visibility:oe.visibility??"public",moderationStatus:oe.moderationStatus,pendingReview:oe.pendingReview})}Ae.size>0&&F(oe=>{const H=new Map(oe);for(const[te,Ne]of Ae)H.set(te,Ne);return Ld(H),H})}const je=new Map;for(const Ae of ue){const oe=`${Ae.type}/${Ae.name}`,H=ye[oe];H&&je.set(oe,{agentId:H.agentId,agentIds:H.agentIds,teamId:H.teamId})}C(je)}).finally(()=>f(!1))},[]);k.useEffect(()=>{Ct();const ue=tt=>{tt.detail?.page===de.BUILDER&&Ct()};return window.addEventListener("markus:navigate",ue),()=>window.removeEventListener("markus:navigate",ue)},[Ct]);const Mt=ue=>{const tt=o.find(st=>st.role==="Secretary"||st.name==="Secretary");tt?it.navigate(de.TEAM,{agentId:tt.id,prefillMessage:ue}):it.navigate(de.TEAM,{prefillMessage:ue})},Pt=async ue=>{const tt=`${ue.type}/${ue.name}`;if(!w.has(tt)){x({key:tt,action:"install"});try{const st=await Ee.builder.artifacts.install(ue.type,ue.name),ye={};st.agent&&typeof st.agent=="object"&&(ye.agentId=st.agent.id),st.team&&typeof st.team=="object"&&(ye.teamId=st.team.id),Array.isArray(st.agents)&&(ye.agentIds=st.agents.map(je=>je.id)),C(je=>new Map(je).set(tt,ye)),window.dispatchEvent(new CustomEvent("markus:data-changed"))}catch(st){console.error("Install failed:",st),G({title:t("common:install"),message:t("installFailed",{error:String(st)}),variant:"danger"})}finally{x(null)}}},Kt=async ue=>{const tt=`${ue.type}/${ue.name}`;if(w.has(tt)){x({key:tt,action:"uninstall"});try{await Ee.builder.artifacts.uninstall(ue.type,ue.name),C(st=>{const ye=new Map(st);return ye.delete(tt),ye}),window.dispatchEvent(new CustomEvent("markus:data-changed"))}catch(st){console.error("Uninstall failed:",st),G({title:t("common:uninstall"),message:t("uninstallFailed",{error:String(st)}),variant:"danger"})}finally{x(null)}}},yt=async(ue,tt)=>{const st=`${ue.type}/${ue.name}`;x({key:st,action:"share"});try{const ye=await Ee.builder.artifacts.ensureSlugSafe(ue.type,ue.name,ue.meta.displayName||ue.meta.name||ue.name),je=ye.name,Ae=ye.slug||xc(je);if(!Ae)throw new Error("Invalid package slug: use English kebab-case for the artifact name (e.g. qwen-multimodal). Chinese-only names cannot be shared — rename the package slug and put the Chinese title in displayName.");const oe=`${ue.type}/${je}`;ye.converted&&(d(le=>le.map(Oe=>Oe.type===ue.type&&Oe.name===ue.name?{...Oe,name:je,path:ye.path,meta:{...Oe.meta,name:je,displayName:ye.displayName??Oe.meta.displayName??ue.name}}:Oe)),F(le=>{const Oe=new Map(le),ge=Oe.get(st);return ge&&(Oe.delete(st),Oe.set(oe,{...ge,slug:Ae,name:ye.displayName??ge.name})),Ld(Oe),Oe}),C(le=>{const Oe=new Map(le),ge=Oe.get(st);return ge&&(Oe.delete(st),Oe.set(oe,ge)),Oe}));const H=await Ee.builder.artifacts.get(ue.type,je);let te={...ue.meta,name:je,displayName:ye.displayName??ue.meta.displayName??ue.name};try{const le=H.files?.[`${ue.type}.json`]??H.files?.["agent.json"]??H.files?.["team.json"]??H.files?.["skill.json"];le&&(te={...JSON.parse(le),...te,name:je,displayName:te.displayName})}catch{}const Ne=te.displayName||te.name||je,Re=te.description||"",$e=te.category||"general",Q=Array.isArray(te.tags)?te.tags:[];let Z=te.icon||void 0;const be=te.version||"1.0.0";if(Z&&!Z.startsWith("http")&&/\.(png|jpe?g|gif|webp|svg)$/i.test(Z)){const le=Z.split("/").pop()??Z;try{const Oe=await fetch(`/api/builder/artifacts/${ue.type}s/${encodeURIComponent(je)}/images/${encodeURIComponent(le)}`);if(Oe.ok){const ge=await Oe.blob(),Ve=new File([ge],le,{type:ge.type}),Qe=await lt.uploadImage(Ve);Qe?.url&&(Z=Qe.url)}}catch{}}let Ke;const Ie=[],Ye=Array.isArray(te.screenshots)?te.screenshots:[];for(let le=0;le<Ye.length;le++){const Oe=Ye[le],ge=Oe.split("/").pop()??Oe;try{const Ve=await fetch(`/api/builder/artifacts/${ue.type}s/${encodeURIComponent(je)}/images/${encodeURIComponent(ge)}`);if(Ve.ok){const Qe=await Ve.blob(),K=new File([Qe],ge,{type:Qe.type}),ce=await lt.uploadImage(K);ce?.url&&(Ie.push({url:ce.url,alt:ge,order:le}),(le===0||te.thumbnail===Oe)&&(Ke=ce.url))}}catch{}}const M=await lt.publishViaProxy({itemType:ue.type==="team"?"team":ue.type==="skill"?"skill":"agent",name:Ne,slug:Ae,description:Re,category:$e,tags:Q,icon:Z,version:be,config:{...te,name:je,displayName:Ne},files:H.files&&Object.keys(H.files).length>0?H.files:void 0,thumbnailUrl:Ke,images:Ie.length>0?Ie:void 0,priceCents:tt?.priceCents,donationsEnabled:tt?.donationsEnabled,visibility:tt?.visibility,orgId:tt?.orgId});M.id&&(F(Oe=>{const ge=new Map(Oe);return ge.set(oe,{id:M.id,name:Ne,slug:M.slug??Ae,version:be,visibility:M.visibility??tt?.visibility??"public",moderationStatus:M.moderationStatus,pendingReview:M.pendingReview}),Ld(ge),ge}),(M.visibility??tt?.visibility??"public")!=="org"&&(M.moderationStatus==="pending"||M.pendingReview)?G({title:t("common:share"),message:ye.converted?t("share.convertedAndSubmitted",{previous:ue.name,slug:Ae}):M.updated?t("share.updateSubmitted"):t("share.submittedForReview"),variant:"primary"}):ye.converted&&G({title:t("common:share"),message:t("share.convertedSlug",{previous:ue.name,slug:Ae}),variant:"primary"}))}catch(ye){console.error("Share failed:",ye),G({title:t("common:share"),message:t("shareFailed",{error:ye instanceof Error?ye.message:String(ye)}),variant:"danger"})}finally{x(null)}},Ue=async()=>{if(!V)return;const{key:ue}=V,tt=O.get(ue);if(X(null),!tt)return;const st=tt.id;x({key:ue,action:"hubDelete"});try{await lt.deleteItem(st),F(ye=>{const je=new Map(ye);return je.delete(ue),Ld(je),je})}catch(ye){console.error("Hub delete failed:",ye),G({title:t("unshare"),message:t("hubDeleteFailed",{error:String(ye)}),variant:"danger"})}finally{x(null)}},dt=async()=>{if(!T)return;const ue=T,tt=`${ue.type}/${ue.name}`;S(null),x({key:tt,action:"delete"});try{await Ee.builder.artifacts.delete(ue.type,ue.name),d(st=>st.filter(ye=>!(ye.type===ue.type&&ye.name===ue.name))),C(st=>{const ye=new Map(st);return ye.delete(tt),ye}),window.dispatchEvent(new CustomEvent("markus:data-changed"))}catch(st){console.error("Delete failed:",st)}finally{x(null)}},Nt=h==="all"?c:c.filter(ue=>ue.type===h);k.useEffect(()=>{fe!=="orgAssets"||U.length>0||lt.myOrgs().then(ue=>{W(ue.memberships),ue.memberships.length>0&&!pe&&P(ue.memberships[0].id)}).catch(()=>{})},[fe,U.length,pe]),k.useEffect(()=>{fe!=="orgAssets"||!pe||(Ge(!0),lt.browseItems({orgId:pe,limit:100}).then(ue=>He(ue.items??[])).catch(()=>He([])).finally(()=>Ge(!1)))},[fe,pe]);const bt=ct==="all"?_e:_e.filter(ue=>ue.itemType===ct),Lt=ue=>{history.pushState(null,"",Ti(de.BUILDER,`${ue.type}/${encodeURIComponent(ue.name)}`)),window.dispatchEvent(new HashChangeEvent("hashchange"))};return r?s.jsx(Mi,{type:r.type,name:r.name,authUser:e,onBack:()=>{history.pushState(null,"",Ti(de.BUILDER)),window.dispatchEvent(new HashChangeEvent("hashchange"))}}):s.jsx("div",{className:"flex-1 overflow-y-auto",children:s.jsxs("div",{className:`max-w-5xl mx-auto w-full ${n?"px-4 py-5":"px-6 py-6"}`,children:[s.jsxs("div",{className:"mb-6",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-bold text-fg-primary",children:t("title")}),s.jsx("p",{className:"text-xs text-fg-tertiary mt-1",children:t("subtitle")})]}),s.jsx("button",{onClick:Ct,className:"text-xs text-fg-tertiary hover:text-fg-secondary transition-colors px-3 py-1.5 rounded-lg border border-border-default hover:border-gray-600",children:t("common:refresh")})]}),s.jsx("div",{className:`grid ${n?"grid-cols-1 gap-2":"grid-cols-3 gap-3"}`,children:DW.map(ue=>{const tt=t(`prompts.${ue.id}Prompt`),st=t(`prompts.${ue.id}Examples`,{returnObjects:!0}),ye=Array.isArray(st)?st:[];return s.jsx("button",{onClick:()=>Mt(tt),className:`group text-left w-full rounded-xl border ${ue.borderColor} bg-surface-secondary/60 p-4 transition-all hover:bg-surface-secondary/80 hover:shadow-lg`,children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:`w-10 h-10 text-xl rounded-lg ${ue.bgColor} flex items-center justify-center shrink-0`,children:ue.icon}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:`text-sm font-semibold bg-gradient-to-r ${ue.color} bg-clip-text text-transparent`,children:t(`prompts.${ue.id}`)}),s.jsx("p",{className:"text-[11px] text-fg-tertiary mt-1 leading-relaxed",children:t(`prompts.${ue.id}Desc`)}),ye.length>0&&s.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:ye.slice(0,2).map((je,Ae)=>s.jsxs("span",{className:"text-[10px] text-fg-muted bg-surface-elevated/60 rounded-full px-2 py-0.5 border border-border-default",onClick:oe=>{oe.stopPropagation(),Mt(tt+je)},children:["“",je,"”"]},Ae))})]})]})},ue.id)})})]}),s.jsx("div",{className:"mb-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:()=>Se("creations"),className:`text-sm font-semibold transition-colors ${fe==="creations"?"text-fg-primary":"text-fg-tertiary hover:text-fg-secondary"}`,children:t("myCreations.title")}),s.jsx("button",{onClick:()=>Se("orgAssets"),className:`text-sm font-semibold transition-colors ${fe==="orgAssets"?"text-fg-primary":"text-fg-tertiary hover:text-fg-secondary"}`,children:t("orgAssets.title")})]}),fe==="creations"&&s.jsx("div",{className:"flex gap-1.5",children:["all","agent","team","skill"].map(ue=>s.jsx("button",{onClick:()=>g(ue),className:`text-xs px-2.5 py-1 rounded-lg transition-colors ${h===ue?"bg-brand-600 text-white":"text-fg-tertiary hover:text-fg-secondary hover:bg-surface-elevated"}`,children:t(ue==="all"?"myCreations.filterAll":ue==="agent"?"myCreations.filterAgents":ue==="team"?"myCreations.filterTeams":"myCreations.filterSkills")},ue))}),fe==="orgAssets"&&s.jsx("div",{className:"flex gap-1.5",children:["all","agent","team","skill"].map(ue=>s.jsx("button",{onClick:()=>mt(ue),className:`text-xs px-2.5 py-1 rounded-lg transition-colors ${ct===ue?"bg-brand-600 text-white":"text-fg-tertiary hover:text-fg-secondary hover:bg-surface-elevated"}`,children:t(ue==="all"?"myCreations.filterAll":ue==="agent"?"myCreations.filterAgents":ue==="team"?"myCreations.filterTeams":"myCreations.filterSkills")},ue))})]})}),fe==="orgAssets"&&U.length>0&&s.jsx("div",{className:"flex gap-2 mb-3 overflow-x-auto pb-1",children:U.map(ue=>s.jsx("button",{onClick:()=>P(ue.id),className:`text-xs px-3 py-1.5 rounded-full whitespace-nowrap border transition-colors ${pe===ue.id?"bg-blue-500/15 border-blue-500/40 text-blue-400":"border-border-default text-fg-tertiary hover:text-fg-secondary hover:border-gray-600"}`,children:ue.name},ue.id))}),fe==="orgAssets"&&(U.length===0&&!Pe?s.jsx("div",{className:"text-center py-12",children:s.jsx("div",{className:"text-fg-tertiary text-sm",children:t("orgAssets.noOrgs")})}):Pe?s.jsx("div",{className:"text-center text-fg-tertiary py-12 text-sm",children:t("orgAssets.loading")}):bt.length===0?s.jsx("div",{className:"text-center py-12",children:s.jsx("div",{className:"text-fg-tertiary text-sm",children:t("orgAssets.noItems")})}):s.jsx(Ar,{children:bt.map(ue=>{const tt=ue.author?.username&&ue.slug?`${lt.getUrl()}/@${encodeURIComponent(ue.author.username)}/${encodeURIComponent(ue.slug)}`:null;return s.jsx(ia,{type:ue.itemType,name:ue.name,description:ue.description,seed:ue.slug||ue.id||ue.name,icon:ue.icon,cover:ue.thumbnailUrl,hubBase:lt.getUrl(),author:ue.author,version:ue.version,rating:parseFloat(ue.avgRating)||0,ratingCount:ue.ratingCount,downloadCount:ue.downloadCount,actions:tt?s.jsxs("a",{href:tt,target:"_blank",rel:"noopener noreferrer",onClick:st=>{st.stopPropagation(),yc()&&(st.preventDefault(),_i(tt))},className:"text-xs px-3 py-1.5 rounded-lg border border-border-default text-fg-secondary hover:text-fg-primary hover:border-gray-600 transition-colors inline-flex items-center gap-1",children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),s.jsx("polyline",{points:"15 3 21 3 21 9"}),s.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),"Hub"]}):void 0},ue.id)})})),fe==="creations"&&(m&&c.length===0?s.jsx("div",{className:"text-center text-fg-tertiary py-12 text-sm",children:t("myCreations.loadingArtifacts")}):Nt.length===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx("div",{className:"text-fg-tertiary text-sm",children:t("myCreations.noArtifacts")}),s.jsx("div",{className:"text-fg-muted text-xs mt-1",children:t("myCreations.noArtifactsHint")})]}):s.jsx(Ar,{children:Nt.map(ue=>{const tt=ue.meta.displayName||ue.meta.name||ue.name,st=ue.meta.description||"",ye=`${ue.type}/${ue.name}`,je=y?.key===ye?y.action:null,Ae=O.get(ye),oe=ue.meta.version||"1.0.0",H=!!Ae,te=H&&Ae.version!==oe,Ne=()=>{const Ie=lt.getUser();return!Ae||!Ie?null:`${lt.getUrl()}/@${encodeURIComponent(Ie.username)}/${encodeURIComponent(Ae.slug)}`},Re=H&&(Ae?.moderationStatus==="pending"||Ae?.moderationStatus==="rejected"||!!Ae?.pendingReview),$e=s.jsxs("div",{className:"flex items-center gap-1.5 justify-end",onClick:Ie=>Ie.stopPropagation(),children:[w.has(ye)?s.jsxs("button",{onClick:()=>I(ue),disabled:!!je,className:"text-xs px-3 py-1.5 rounded-lg border border-green-600/30 text-green-600 hover:bg-red-500/10 hover:text-red-500 hover:border-red-500/30 transition-colors disabled:opacity-50 inline-flex items-center gap-1",children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),s.jsx("polyline",{points:"17 8 12 3 7 8"}),s.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),t(je==="uninstall"?"common:uninstalling":"common:uninstall")]}):s.jsxs("button",{onClick:()=>j(ue),disabled:!!je,className:"text-xs px-3 py-1.5 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors disabled:opacity-50 inline-flex items-center gap-1",children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),s.jsx("polyline",{points:"7 10 12 15 17 10"}),s.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),t(je==="install"?"common:installing":"common:install")]}),H&&Re?Ae?.moderationStatus==="pending"?s.jsxs("span",{className:"text-xs px-2 py-1.5 rounded-lg border border-amber-500/30 text-amber-400 inline-flex items-center gap-1",title:t("share.underReviewTip"),children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"12 6 12 12 16 14"})]}),t("share.underReview")]}):Ae?.moderationStatus==="rejected"?s.jsxs("span",{className:"text-xs px-2 py-1.5 rounded-lg border border-red-500/30 text-red-400 inline-flex items-center gap-1",title:t("share.rejectedTip"),children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),s.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),t("share.rejected")]}):s.jsxs("span",{className:"text-xs px-2 py-1.5 rounded-lg border border-amber-500/30 text-amber-400 inline-flex items-center gap-1",title:t("share.updateUnderReviewTip"),children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"12 6 12 12 16 14"})]}),t("share.updateUnderReview")]}):H?s.jsxs(s.Fragment,{children:[te&&s.jsxs("button",{onClick:()=>{const Ie=Ae?.visibility??"public";yt(ue,{visibility:Ie})},disabled:!!je,className:"text-xs px-3 py-1.5 rounded-lg border border-amber-500/30 text-amber-400 hover:bg-amber-500/10 hover:border-amber-500/50 transition-colors disabled:opacity-50 inline-flex items-center gap-1",children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("polyline",{points:"23 4 23 10 17 10"}),s.jsx("polyline",{points:"1 20 1 14 7 14"}),s.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]}),je==="share"?t("common:sharing"):t("share.updateVersion",{version:oe})]}),s.jsxs("a",{href:Ne()??"#",target:"_blank",rel:"noopener noreferrer",onClick:Ie=>{const Ye=Ne();yc()&&Ye&&(Ie.preventDefault(),_i(Ye))},className:`text-xs px-3 py-1.5 rounded-lg border transition-colors inline-flex items-center gap-1 ${Ae?.visibility==="org"?"border-blue-500/30 text-blue-500 hover:text-blue-400 hover:border-blue-400/40":Ae?.visibility==="unlisted"?"border-gray-500/30 text-fg-tertiary hover:text-fg-secondary hover:border-gray-400/40":"border-green-600/30 text-green-600 hover:text-green-500 hover:border-green-500/40"}`,children:[Ae?.visibility==="org"?s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("path",{d:"M3 21h18"}),s.jsx("path",{d:"M9 8h1"}),s.jsx("path",{d:"M9 12h1"}),s.jsx("path",{d:"M9 16h1"}),s.jsx("path",{d:"M14 8h1"}),s.jsx("path",{d:"M14 12h1"}),s.jsx("path",{d:"M14 16h1"}),s.jsx("path",{d:"M5 21V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16"})]}):Ae?.visibility==="unlisted"?s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),s.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}):s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),s.jsx("polyline",{points:"15 3 21 3 21 9"}),s.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),Ae?.visibility==="org"?t("visibility.sharedOrg"):Ae?.visibility==="unlisted"?t("visibility.sharedUnlisted"):t("visibility.shared")]}),s.jsxs("button",{onClick:()=>X({key:ye,name:tt}),disabled:!!je,className:"text-xs px-2.5 py-1.5 rounded-lg border border-border-default text-fg-secondary hover:text-amber-500 hover:border-amber-500/40 hover:bg-amber-500/10 transition-colors disabled:opacity-50 inline-flex items-center gap-1",title:t("removeFromHubTooltip"),children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("path",{d:"M18.84 12.25l1.72-1.71a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),s.jsx("path",{d:"M5.17 11.75l-1.71 1.71a5 5 0 0 0 7.07 7.07l1.71-1.71"}),s.jsx("line",{x1:"2",y1:"2",x2:"22",y2:"22"})]}),t("unshare")]})]}):s.jsxs("button",{onClick:async()=>{await lt.ensureAuth(),Array.isArray(ue.meta.screenshots)&&ue.meta.screenshots.length>0?J(ue):ee(ue)},disabled:!!je,className:"text-xs px-3 py-1.5 rounded-lg border border-border-default text-fg-secondary hover:text-green-600 hover:border-green-500/30 transition-colors disabled:opacity-50 inline-flex items-center gap-1",children:[s.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("circle",{cx:"18",cy:"5",r:"3"}),s.jsx("circle",{cx:"6",cy:"12",r:"3"}),s.jsx("circle",{cx:"18",cy:"19",r:"3"}),s.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),s.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),t(je==="share"?"common:sharing":"common:share")]})]}),Q=s.jsx("button",{onClick:()=>S(ue),disabled:!!je,className:"w-7 h-7 rounded-lg text-fg-muted hover:text-red-500 hover:bg-red-500/10 transition-colors disabled:opacity-50 inline-flex items-center justify-center",title:t("deleteLocalTooltip"),children:s.jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("polyline",{points:"3 6 5 6 21 6"}),s.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})}),Z=ue.meta.icon,Ke=!!Z&&/\.(png|jpe?g|gif|webp|svg)$/i.test(Z)?Z.startsWith("http")||Z.startsWith("/")?Z:`/api/builder/artifacts/${ue.type}s/${encodeURIComponent(ue.name)}/images/${encodeURIComponent(Z.split("/").pop()??"")}?v=${ue.updatedAt??""}`:Z;return s.jsx(ia,{type:ue.type,name:tt,description:st,seed:ye,icon:Ke,version:oe,footerLeft:s.jsxs("span",{className:"flex items-center gap-2 text-[10px] text-fg-tertiary min-w-0",children:[s.jsx("button",{onClick:Ie=>{Ie.stopPropagation(),Ee.system.openPath(ue.path).catch(()=>{})},className:"hover:text-fg-secondary transition-colors truncate min-w-0",title:ue.path,children:OW(ue.path)}),s.jsx("span",{className:"shrink-0",children:"·"}),s.jsx("span",{className:"shrink-0",children:new Date(ue.updatedAt).toLocaleDateString()})]}),headerAction:Q,actions:$e,onClick:()=>Lt(ue)},ye)})})),E&&s.jsx(dr,{variant:"primary",title:t("confirmInstall"),message:t("confirmInstallMsg",{name:E.meta.displayName||E.meta.name||E.name}),confirmLabel:t("common:install"),onConfirm:()=>{const ue=E;j(null),Pt(ue)},onCancel:()=>j(null)}),L&&s.jsx(dr,{variant:"primary",title:t("confirmUninstall"),message:t("confirmUninstallMsg",{name:L.meta.displayName||L.meta.name||L.name}),confirmLabel:t("common:uninstall"),onConfirm:()=>{const ue=L;I(null),Kt(ue)},onCancel:()=>I(null)}),T&&s.jsx(dr,{title:t("confirmDeleteLocal"),message:t("deleteCannotUndo",{name:T.meta.displayName||T.meta.name||T.name}),confirmLabel:t("common:delete"),onConfirm:dt,onCancel:()=>S(null)}),V&&s.jsx(dr,{title:t("confirmUnshare"),message:t("removeFromHub",{name:V.name}),confirmLabel:t("unshare"),onConfirm:()=>{Ue()},onCancel:()=>X(null)}),z&&s.jsx(dr,{alertOnly:!0,variant:z.variant??"primary",title:z.title,message:z.message,onConfirm:()=>G(null),onCancel:()=>G(null)}),se&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:()=>ee(null),children:s.jsxs("div",{className:"bg-surface-secondary border border-border-default rounded-xl max-w-sm w-full mx-4 p-6 shadow-2xl",onClick:ue=>ue.stopPropagation(),children:[s.jsx("h3",{className:"text-base font-semibold text-fg-primary mb-2",children:t("common:share")}),s.jsx("p",{className:"text-sm text-fg-secondary mb-5",children:t("share.imagePrompt")}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{onClick:()=>{const ue=se;ee(null),J(ue)},className:"flex-1 text-sm px-4 py-2 rounded-lg border border-border-default text-fg-secondary hover:text-fg-primary hover:border-fg-tertiary transition-colors",children:t("share.directly")}),s.jsx("button",{onClick:()=>{const ue=se;ee(null),Lt(ue)},className:"flex-1 text-sm px-4 py-2 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors",children:t("share.addImagesFirst")})]})]})}),q&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:()=>re(null),children:s.jsx("div",{className:"bg-surface-secondary border border-border-default rounded-xl max-w-sm w-full mx-4 p-6 shadow-2xl",onClick:ue=>ue.stopPropagation(),children:s.jsx(BW,{isUpdate:O.has(`${q.type}/${q.name}`),onCancel:()=>re(null),onConfirm:(ue,tt)=>{const st=q;re(null),yt(st,{priceCents:tt>0?tt:void 0})}})})}),B&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:()=>J(null),children:s.jsx("div",{className:"bg-surface-secondary border border-border-default rounded-xl max-w-sm w-full mx-4 p-6 shadow-2xl",onClick:ue=>ue.stopPropagation(),children:s.jsx(zW,{onCancel:()=>J(null),onConfirm:(ue,tt,st,ye)=>{const je=B;J(null),yt(je,{visibility:ue,orgId:tt,priceCents:st,donationsEnabled:ye})}})})})]})})}function zW({onCancel:e,onConfirm:t}){const{t:n}=ft(["builder","common"]),[r,o]=k.useState("public"),[l,c]=k.useState([]),[d,m]=k.useState(""),[f,h]=k.useState(!1),[g,y]=k.useState(0),[x,w]=k.useState(!1);k.useEffect(()=>{r==="org"&&l.length===0&&(h(!0),lt.myOrgs().then(S=>{c(S.memberships),S.memberships.length>0&&m(S.memberships[0].id)}).catch(()=>{}).finally(()=>h(!1)))},[r,l.length]);const C=r==="public"||r==="unlisted",T=[{value:"public",icon:s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),s.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]}),label:n("visibility.public"),desc:n("visibility.publicDesc")},{value:"org",icon:s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M3 21h18"}),s.jsx("path",{d:"M9 8h1"}),s.jsx("path",{d:"M9 12h1"}),s.jsx("path",{d:"M9 16h1"}),s.jsx("path",{d:"M14 8h1"}),s.jsx("path",{d:"M14 12h1"}),s.jsx("path",{d:"M14 16h1"}),s.jsx("path",{d:"M5 21V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16"})]}),label:n("visibility.org"),desc:n("visibility.orgDesc")},{value:"unlisted",icon:s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),s.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),label:n("visibility.unlisted"),desc:n("visibility.unlistedDesc")}];return s.jsxs(s.Fragment,{children:[s.jsx("h3",{className:"text-base font-semibold text-fg-primary mb-4",children:n("visibility.label")}),s.jsx("div",{className:"space-y-2 mb-5",children:T.map(S=>s.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${r===S.value?"border-brand-500 bg-brand-500/10":"border-border-default hover:border-gray-600"}`,children:[s.jsx("input",{type:"radio",name:"visibility",checked:r===S.value,onChange:()=>o(S.value),className:"accent-brand-500"}),s.jsx("div",{className:"flex items-center gap-2 text-fg-secondary",children:S.icon}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium text-fg-primary",children:S.label}),s.jsx("div",{className:"text-[11px] text-fg-tertiary",children:S.desc})]})]},S.value))}),r==="org"&&s.jsxs("div",{className:"mb-5",children:[s.jsx("label",{className:"text-xs text-fg-secondary block mb-1.5",children:n("visibility.orgSelect")}),f?s.jsx("div",{className:"text-xs text-fg-tertiary py-2",children:"Loading..."}):l.length===0?s.jsx("div",{className:"text-xs text-fg-tertiary py-2",children:n("visibility.orgNone")}):s.jsx("select",{value:d,onChange:S=>m(S.target.value),className:"w-full text-sm px-3 py-2 rounded-lg bg-surface-elevated border border-border-default text-fg-primary",children:l.map(S=>s.jsx("option",{value:S.id,children:S.name},S.id))})]}),C&&s.jsxs("div",{className:"mb-5",children:[s.jsx("label",{className:"text-xs text-fg-secondary block mb-1.5",children:n("pricing.label")}),s.jsx("div",{className:"grid grid-cols-4 gap-2 mb-3",children:u6.map(S=>s.jsx("button",{type:"button",onClick:()=>y(S.cents),className:`text-sm px-2 py-2 rounded-lg border transition-colors ${g===S.cents?"border-brand-500 bg-brand-500/10 text-fg-primary":"border-border-default text-fg-secondary hover:border-gray-600"}`,children:S.label},S.cents))}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:x,onChange:S=>w(S.target.checked),className:"accent-brand-500"}),s.jsx("span",{className:"text-xs text-fg-secondary",children:n("pricing.enableTips")})]})]}),C&&s.jsx("div",{className:"mb-4 text-[11px] text-fg-tertiary rounded-lg border border-border-default px-3 py-2",children:n("pricing.reviewNote")}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{onClick:e,className:"flex-1 text-sm px-4 py-2 rounded-lg border border-border-default text-fg-secondary hover:text-fg-primary hover:border-gray-600 transition-colors",children:n("common:cancel")}),s.jsx("button",{onClick:()=>t(r,r==="org"?d:void 0,C&&g>0?g:void 0,C?x:void 0),disabled:r==="org"&&!d,className:"flex-1 text-sm px-4 py-2 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:n("shareMode.share")})]})]})}const u6=[{cents:0,label:"Free"},{cents:100,label:"$1"},{cents:500,label:"$5"},{cents:1e3,label:"$10"}];function BW({isUpdate:e,onCancel:t,onConfirm:n}){const{t:r}=ft(["builder","common"]),[o,l]=k.useState(0);return s.jsxs(s.Fragment,{children:[s.jsx("h3",{className:"text-base font-semibold text-fg-primary mb-4",children:r(e?"shareMode.titleUpdate":"shareMode.title")}),s.jsx("div",{className:"space-y-2 mb-5",children:u6.map(c=>s.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${o===c.cents?"border-brand-500 bg-brand-500/10":"border-border-default hover:border-gray-600"}`,children:[s.jsx("input",{type:"radio",name:"sharePrice",checked:o===c.cents,onChange:()=>l(c.cents),className:"accent-brand-500"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium text-fg-primary",children:c.label}),s.jsx("div",{className:"text-[11px] text-fg-tertiary",children:c.cents===0?r("shareMode.freeDesc"):r("shareMode.paidDesc")})]})]},c.cents))}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{onClick:t,className:"flex-1 text-sm px-4 py-2 rounded-lg border border-border-default text-fg-secondary hover:text-fg-primary hover:border-gray-600 transition-colors",children:r("common:cancel")}),s.jsx("button",{onClick:()=>n(o>0?"paid":"free",o),className:"flex-1 text-sm px-4 py-2 rounded-lg bg-brand-600 hover:bg-brand-500 text-white transition-colors",children:r(e?"shareMode.update":"shareMode.share")})]})]})}const $W=Object.freeze(Object.defineProperty({__proto__:null,AgentBuilder:c6},Symbol.toStringTag,{value:"Module"}));async function d6(e,t){if(!t)return{items:e,highlighted:null,missing:!1};const n=e.find(r=>r.id===t);if(n)return{items:[n,...e.filter(r=>r.id!==t)],highlighted:n,missing:!1};try{const{item:r}=await lt.getItem(t);return r?{items:[r,...e],highlighted:r,missing:!1}:{items:e,highlighted:null,missing:!0}}catch{return{items:e,highlighted:null,missing:!0}}}function HW(e,t){const n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<Math.max(n.length,r.length);o++){const l=n[o]??0,c=r[o]??0;if(l>c)return!0;if(l<c)return!1}return!1}function T0(e,t){const n=e.i18n?.[t];return n?.displayName||n?.name||e.name}function z4(e,t){return e.i18n?.[t]?.description||e.description}const UW={manager:"bg-brand-500/15 text-brand-500",worker:"bg-blue-500/15 text-blue-600"};function FW({authUser:e,highlightItemId:t,onHighlightDone:n}={}){const{t:r,i18n:o}=ft(["store","common"]),l=o.language,[c,d]=k.useState(""),[m,f]=k.useState([]),[h,g]=k.useState([]),[y,x]=k.useState(null),[w,C]=k.useState({}),[T,S]=k.useState(!1),[E,j]=k.useState(!0),[L,I]=k.useState(new Map),[O,F]=k.useState(new Set),[V,X]=k.useState(null),[z,G]=k.useState(null),se=k.useCallback(async()=>{try{const[re,B]=await Promise.all([Ee.builder.artifacts.list().catch(()=>({artifacts:[]})),Ee.builder.artifacts.installed().catch(()=>({installed:{}}))]),J=new Map;for(const fe of re.artifacts){if(fe.type!=="agent")continue;const Se=!!B.installed[`agent/${fe.name}`];J.set(fe.name,{installed:Se,localVersion:fe.meta.version||void 0,localUpdatedAt:fe.updatedAt})}I(J)}catch{}},[]),ee=k.useCallback(async()=>{j(!0);try{const re=c?lt.search({type:"agent",q:c,limit:50}):Si(Tr.hubAgents)??lt.search({type:"agent",limit:50}),B=new URLSearchParams;c&&B.set("q",c);const J=fetch("/api/templates?"+B.toString()).then(W=>W.json()).catch(()=>({templates:[]})),[fe,Se]=await Promise.all([re.catch(()=>({items:[],total:0})),J,se(),lt.isAuthenticated()?lt.purchases.mine().then(W=>F(new Set(W.purchases.map(pe=>pe.itemId)))).catch(()=>{}):Promise.resolve()]),U=await d6(fe?.items??[],t);g(U.items),f(Array.isArray(Se.templates)?Se.templates:[]),U.missing&&n?.()}catch{f([]),g([])}finally{j(!1)}},[c,se,t,n]);k.useEffect(()=>{ee()},[ee]),k.useEffect(()=>{if(!y){C({});return}fetch(`/api/templates/${encodeURIComponent(y.id)}/files`,{credentials:"include"}).then(re=>re.json()).then(re=>C(re.files??{})).catch(()=>C({}))},[y]);const q=async(re,B,J)=>{try{const fe=await fetch("/api/templates/instantiate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({templateId:re,name:B,orgId:"default",teamId:J})});if(!fe.ok)throw new Error(`Failed: ${fe.status}`);S(!1),x(null)}catch(fe){G({title:r("common:create",{defaultValue:"Create"}),message:`Failed to create agent: ${fe}`,variant:"danger"})}};if(V)return s.jsx(Mi,{type:V.type,name:V.name,onBack:()=>X(null)});if(y){const re={type:"agent",name:y.id,displayName:T0(y,l),version:y.version,description:z4(y,l),author:y.author,category:y.category,tags:y.tags,icon:y.icon,files:w,agent:{roleName:y.roleId,agentRole:y.agentRole==="manager"?"manager":"worker"},dependencies:{skills:y.skills}},B=s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 p-5",children:[s.jsx("h3",{className:"text-xs text-fg-tertiary uppercase tracking-wider mb-3",children:r("agentStore.roleConfig")}),s.jsxs("div",{className:"space-y-2.5 text-sm",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-fg-tertiary w-20",children:r("agentStore.role")}),s.jsx("span",{className:"text-fg-secondary font-mono text-xs bg-surface-elevated px-2 py-0.5 rounded",children:y.roleId})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-fg-tertiary w-20",children:r("agentStore.position")}),s.jsx("span",{className:`px-2 py-0.5 rounded text-xs capitalize ${UW[y.agentRole]??""}`,children:y.agentRole})]})]})]}),s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 p-5",children:[s.jsx("h3",{className:"text-xs text-fg-tertiary uppercase tracking-wider mb-3",children:r("agentStore.skills")}),s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[y.skills.map(J=>s.jsx("span",{className:"px-2.5 py-1 text-xs bg-brand-500/10 text-brand-500 rounded-lg border border-brand-500/20",children:J},J)),y.skills.length===0&&s.jsx("span",{className:"text-xs text-fg-tertiary italic",children:r("agentStore.noSkills")})]})]})]}),y.starterTasks&&y.starterTasks.length>0&&s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 p-5",children:[s.jsx("h3",{className:"text-xs text-fg-tertiary uppercase tracking-wider mb-3",children:r("agentStore.starterTasks")}),s.jsx("div",{className:"space-y-2",children:y.starterTasks.map((J,fe)=>s.jsxs("div",{className:"flex items-start gap-3 bg-surface-elevated/50 rounded-lg p-3",children:[s.jsx("span",{className:`inline-block w-2 h-2 rounded-full shrink-0 mt-1 ${J.priority==="high"?"bg-red-400":J.priority==="medium"?"bg-amber-400":"bg-green-400"}`}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm text-fg-primary",children:J.title}),J.description&&s.jsx("div",{className:"text-xs text-fg-tertiary mt-0.5",children:J.description})]})]},fe))})]})]});return s.jsxs(s.Fragment,{children:[s.jsx(Mi,{type:"agent",name:y.id,onBack:()=>x(null),readOnly:!0,initialManifest:re,actionSlot:s.jsx("button",{onClick:()=>S(!0),className:"px-4 py-1.5 text-xs bg-brand-600 hover:bg-brand-500 text-white rounded-lg transition-colors font-medium",children:r("agentStore.hireAgent")}),contentSlot:B}),T&&s.jsx(B4,{template:y,lang:l,onClose:()=>S(!1),onHire:q}),z&&s.jsx(dr,{alertOnly:!0,variant:z.variant??"danger",title:z.title,message:z.message,onConfirm:()=>G(null),onCancel:()=>G(null)})]})}return s.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[s.jsxs("div",{"data-electron-drag":!0,className:"px-6 h-14 flex items-center justify-between shrink-0 gap-3",children:[s.jsx("h2",{className:"text-lg font-semibold",children:r("agentStore.title")}),s.jsx("input",{type:"text",placeholder:r("agentStore.searchPlaceholder"),value:c,onChange:re=>d(re.target.value),className:"px-3 py-1.5 bg-surface-elevated border border-border-default rounded-lg text-sm max-w-xs w-full focus:border-brand-500 focus:outline-none"})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-7 space-y-8",children:E?s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:6}).map((re,B)=>s.jsx("div",{className:"h-56 rounded-2xl skeleton"},B))}):m.length===0&&h.length===0?s.jsxs("div",{className:"text-center py-20",children:[s.jsx("div",{className:"text-4xl mb-4 opacity-30",children:"⧉"}),s.jsx("div",{className:"text-fg-secondary font-medium mb-1",children:c?r("agentStore.noResults",{search:c}):r("agentStore.noAgents")}),s.jsx("div",{className:"text-fg-tertiary text-sm",children:r(c?"agentStore.noResultsHint":"agentStore.noAgentsHint")})]}):s.jsxs(s.Fragment,{children:[m.length>0&&s.jsxs("section",{children:[s.jsxs("div",{className:"flex items-baseline gap-2 mb-3",children:[s.jsx("h3",{className:"section-title",children:r("agentStore.builtin")}),s.jsx("span",{className:"text-xs text-fg-tertiary",children:r("agentStore.available",{count:m.length})})]}),s.jsx(Ar,{columns:3,children:m.map(re=>s.jsx(ia,{type:"agent",name:T0(re,l),description:z4(re,l),seed:re.id,icon:re.icon,version:re.version,category:re.category,tags:re.tags,authorLabel:re.author,hideStats:!0,showTypeBadge:!1,cornerLabel:r("agentStore.builtin"),onClick:()=>x(re)},re.id))})]}),h.length>0&&s.jsxs("section",{children:[s.jsx("h3",{className:"section-title mb-3",children:r("agentStore.markusHub")}),s.jsx(Ar,{columns:3,children:h.map(re=>s.jsx(qW,{item:re,localInfo:L.get(Oc(re)),purchased:e0(re,O),onStatusChange:se,highlight:re.id===t,onHighlightDone:n,onViewDetail:B=>X({type:"agent",name:B})},re.id))})]})]})}),T&&y&&s.jsx(B4,{template:y,lang:l,onClose:()=>S(!1),onHire:q}),z&&s.jsx(dr,{alertOnly:!0,variant:z.variant??"danger",title:z.title,message:z.message,onConfirm:()=>G(null),onCancel:()=>G(null)})]})}function Oc(e,t){if(e.slug&&e.slug.trim())return e.slug.trim();const n=t&&typeof t.name=="string"?t.name.trim():"";return r0(n||e.name,"hub-pkg")}function Ni(e){return(async()=>{const t=await lt.download(e.id),n=t.name||e.name,r=t.config??{},o=Oc(e,r),l=t.itemType==="team"?"team":t.itemType==="skill"?"skill":"agent",c={type:"hub",hubItemId:e.id},d=(t.version||e.version||(typeof r.version=="string"?r.version:"")||"").trim()||void 0;if(t.files&&Object.keys(t.files).length>0)await Ee.builder.artifacts.import(l,o,t.files,c,d);else{const m={...r,...d?{version:d}:{},name:o,displayName:r.displayName||n,description:e.description,source:c};await Ee.builder.artifacts.save(l,m)}return await Ee.builder.artifacts.install(l,o),window.dispatchEvent(new CustomEvent("markus:data-changed")),n})()}async function Qg(e,t){t("checking"),await lt.ensureAuth();const n=await lt.purchases.checkout(e.id);if(n.alreadyOwned)return t("installing"),await Ni(e),"installed";try{if((await lt.creator.getBalance()).availableBalance>=(e.priceCents??0)){const l=await lt.purchases.payWithEarnings(e.id);if(l.ok||l.alreadyOwned)return t("installing"),await Ni(e),"installed"}}catch{}if(!n.checkoutUrl)throw new Error("No checkout URL");t("checkout_opened");const r=window.open(n.checkoutUrl,"_blank","noopener");return new Promise((o,l)=>{const c=setInterval(async()=>{const d=r?r.closed:!1;try{if((await lt.purchases.checkout(e.id)).alreadyOwned){clearInterval(c),t("installing");try{await Ni(e),o("installed")}catch(f){l(f)}return}}catch{}if(d){clearInterval(c);try{if((await lt.purchases.checkout(e.id)).alreadyOwned){t("installing"),await Ni(e),o("installed");return}}catch{}o("cancelled")}},2e3)})}function qW({item:e,localInfo:t,purchased:n,onStatusChange:r,highlight:o,onHighlightDone:l,onViewDetail:c}){const{t:d}=ft(["store"]),[m,f]=k.useState(!1),[h,g]=k.useState(""),y=k.useRef(null),[x,w]=k.useState(!1);k.useEffect(()=>{if(o&&y.current){y.current.scrollIntoView({behavior:"smooth",block:"center"}),w(!0);const V=setTimeout(()=>{w(!1)},4e3);return()=>clearTimeout(V)}},[o,l]);const C=t?.installed??!1,T=C&&e.version&&t?.localVersion&&HW(e.version,t.localVersion),S=(e.priceCents??0)>0,E=async V=>{if(V.stopPropagation(),!m){f(!0),g("");try{await Ni(e),g(T?d("card.upgraded"):d("card.installed")+"!"),r()}catch(X){const z=X instanceof Error?X.message:"";z.includes("402")||z.includes("Purchase required")?g(d("card.purchaseRequired")):g(d("card.failed"))}finally{f(!1)}}},j=async V=>{if(V.stopPropagation(),!m){f(!0),g("");try{await Qg(e,z=>{z==="checkout_opened"?g(d("card.waitingPurchase","Waiting for purchase...")):z==="installing"&&g(d("card.installing"))})==="installed"?(g(d("card.installed")+"!"),r()):g("")}catch(X){g(X instanceof Error?X.message:d("card.failed"))}finally{f(!1)}}},L=S?`$${((e.priceCents??0)/100).toFixed(2)}`:null,I=e.slug&&e.author?.username?`${lt.getUrl()}/@${encodeURIComponent(e.author.username)}/${encodeURIComponent(e.slug)}`:null,O=()=>{C&&c?c(Oc(e)):I&&window.open(I,"_blank","noopener,noreferrer")},F=s.jsxs(s.Fragment,{children:[T?s.jsx("button",{onClick:V=>{E(V)},disabled:m,className:"px-3 py-1.5 text-xs bg-amber-600 hover:bg-amber-500 text-white rounded-lg transition-colors disabled:opacity-50",children:m?d("card.upgrading"):d("card.upgrade",{version:e.version})}):C?s.jsxs("button",{onClick:V=>{E(V)},disabled:m,className:"px-3 py-1.5 text-xs bg-surface-elevated hover:bg-surface-overlay text-fg-secondary border border-border-default rounded-lg transition-colors disabled:opacity-50",children:[d("card.installed"),t?.localVersion?` v${t.localVersion}`:""]}):S&&!n?s.jsx("button",{onClick:V=>{j(V)},disabled:m,className:"px-3 py-1.5 text-xs bg-amber-600 hover:bg-amber-500 text-white rounded-lg transition-colors disabled:opacity-50 inline-flex items-center gap-1",children:m?h||d("card.installing"):s.jsxs(s.Fragment,{children:[d("card.buy","Buy")," ",L]})}):s.jsx("button",{onClick:V=>{E(V)},disabled:m,className:"px-3 py-1.5 text-xs bg-brand-600 hover:bg-brand-500 text-white rounded-lg transition-colors disabled:opacity-50",children:d(m?"card.installing":"card.install")}),h&&!(S&&!n)&&s.jsx("span",{className:`text-[10px] ${h===d("card.failed")||h===d("card.purchaseRequired")?"text-red-500":"text-green-600"}`,children:h})]});return s.jsx("div",{ref:y,className:x?"animate-pulse":"",children:s.jsx(ia,{type:"agent",showTypeBadge:!1,name:e.name,description:e.description,seed:e.slug||e.name,icon:e.icon||"bot",cover:e.thumbnailUrl,hubBase:lt.getUrl(),author:e.author,version:e.version,category:e.category,tags:e.tags,rating:parseFloat(e.avgRating)||0,ratingCount:e.ratingCount,downloadCount:e.downloadCount,priceCents:e.priceCents,currency:e.currency,installed:C,glowing:x,onClick:O,actions:F})})}function B4({template:e,lang:t,onClose:n,onHire:r}){const{t:o}=ft(["store"]),[l,c]=k.useState(`${T0(e,t)} Agent`),[d,m]=k.useState(""),[f,h]=k.useState([]),[g,y]=k.useState(!1);k.useEffect(()=>{fetch("/api/teams",{credentials:"include"}).then(w=>w.json()).then(w=>h(w.teams??[])).catch(()=>{})},[]);const x=async()=>{if(l.trim()){y(!0);try{await r(e.id,l.trim(),d||void 0)}finally{y(!1)}}};return s.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",onClick:n,children:s.jsxs("div",{className:"bg-surface-secondary border border-border-default rounded-xl p-6 w-[440px] shadow-2xl",onClick:w=>w.stopPropagation(),children:[s.jsx("div",{className:"flex items-center gap-3 mb-5",children:s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold",children:o("hireModal.title")}),s.jsx("p",{className:"text-xs text-fg-tertiary",children:o("hireModal.creating",{name:T0(e,t)})})]})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-fg-tertiary mb-1.5",children:o("hireModal.agentName")}),s.jsx("input",{type:"text",value:l,onChange:w=>c(w.target.value),className:"input-field",autoFocus:!0})]}),f.length>0&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-fg-tertiary mb-1.5",children:o("hireModal.assignTeam")}),s.jsxs("select",{value:d,onChange:w=>m(w.target.value),className:"input-field",children:[s.jsx("option",{value:"",children:o("hireModal.noTeam")}),f.map(w=>s.jsx("option",{value:w.id,children:w.name},w.id))]})]}),s.jsxs("div",{className:"bg-surface-elevated/50 rounded-lg p-3",children:[s.jsx("div",{className:"text-xs text-fg-tertiary mb-2 font-medium",children:o("hireModal.agentConfig")}),s.jsxs("div",{className:"grid grid-cols-2 gap-y-1.5 gap-x-4 text-xs",children:[s.jsx("div",{className:"text-fg-tertiary",children:o("hireModal.role")}),s.jsx("div",{className:"text-fg-secondary font-mono",children:e.roleId}),s.jsx("div",{className:"text-fg-tertiary",children:o("hireModal.position")}),s.jsx("div",{className:"text-fg-secondary capitalize",children:e.agentRole}),s.jsx("div",{className:"text-fg-tertiary",children:o("hireModal.skills")}),s.jsx("div",{className:"text-fg-secondary",children:e.skills.join(", ")||o("hireModal.none")})]})]})]}),s.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[s.jsx("button",{onClick:n,className:"btn-secondary",children:o("hireModal.cancel")}),s.jsx("button",{onClick:x,disabled:!l.trim()||g,className:"btn-primary",children:o(g?"hireModal.creating_progress":"hireModal.create")})]})]})})}function ih(e,t){const n=e.i18n?.[t];return n?.displayName||n?.name||e.name}function $4(e,t){return e.i18n?.[t]?.description||e.description}function H4(e,t,n){return e.i18n?.[n]?.members?.[t]||t}function GW(e,t){const n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<Math.max(n.length,r.length);o++){const l=n[o]??0,c=r[o]??0;if(l>c)return!0;if(l<c)return!1}return!1}function VW({highlightItemId:e,onHighlightDone:t}={}){const{t:n,i18n:r}=ft(["store","common"]),o=r.language,[l,c]=k.useState(""),[d,m]=k.useState([]),[f,h]=k.useState([]),[g,y]=k.useState(null),[x,w]=k.useState({}),[C,T]=k.useState(!0),[S,E]=k.useState(!1),[j,L]=k.useState(null),[I,O]=k.useState(new Map),[F,V]=k.useState(new Set),[X,z]=k.useState(null),G=k.useCallback(async()=>{try{const[q,re]=await Promise.all([Ee.builder.artifacts.list().catch(()=>({artifacts:[]})),Ee.builder.artifacts.installed().catch(()=>({installed:{}}))]),B=new Map;for(const J of q.artifacts){if(J.type!=="team")continue;const fe=!!re.installed[`team/${J.name}`];B.set(J.name,{installed:fe,localVersion:J.meta.version||void 0,localUpdatedAt:J.updatedAt})}O(B)}catch{}},[]),se=k.useCallback(async()=>{T(!0);try{const q=l?lt.search({type:"team",q:l,limit:50}):Si(Tr.hubTeams)??lt.search({type:"team",limit:50}),[re,B]=await Promise.all([q.catch(()=>({items:[],total:0})),Ee.teamTemplates.list(l||void 0).catch(()=>({templates:[]})),G(),lt.isAuthenticated()?lt.purchases.mine().then(fe=>V(new Set(fe.purchases.map(Se=>Se.itemId)))).catch(()=>{}):Promise.resolve()]),J=await d6(re?.items??[],e);h(J.items),m(B?.templates??[]),J.missing&&t?.()}catch{m([]),h([])}finally{T(!1)}},[l,G,e,t]);k.useEffect(()=>{se()},[se]),k.useEffect(()=>{if(!g){w({});return}fetch(`/api/team-templates/${encodeURIComponent(g.id)}/files`,{credentials:"include"}).then(q=>q.json()).then(q=>w(q.files??{})).catch(()=>w({}))},[g]);const ee=async q=>{E(!0),L(null);try{const B=(await Ee.teams.create(q.name,q.description)).team.id;let J,fe=0;const Se=[];for(const W of q.members){const pe=W.count??1;for(let P=0;P<pe;P++){const _e=W.name??`${q.name} Agent ${P+1}`,He=pe>1?`${_e} ${P+1}`:_e,Pe=W.roleName??W.templateId;try{const Ge=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({name:He,...Pe?{roleName:Pe}:{},orgId:"default",teamId:B,agentRole:W.role??"worker",skills:W.skills??[]})});if(Ge.ok){fe++;const ct=await Ge.json();W.role==="manager"&&!J&&(J=ct.agent?.id)}else{const ct=await Ge.json().catch(()=>({error:`HTTP ${Ge.status}`}));Se.push(`${He}: ${ct.error??Ge.statusText}`)}}catch(Ge){Se.push(`${He}: ${String(Ge)}`)}}}J&&await Ee.teams.update(B,{managerId:J,managerType:"agent"}).catch(()=>{});const U=Se.length>0?` (${Se.length} failed: ${Se[0]})`:"";L({ok:fe>0,message:`Team "${ih(q,o)}" deployed with ${fe} agent(s)${U}`})}catch(re){L({ok:!1,message:`Failed: ${re}`})}finally{E(!1)}};if(X)return s.jsx(Mi,{type:X.type,name:X.name,onBack:()=>z(null)});if(g){const q={...x};g.announcements&&(q["ANNOUNCEMENT.md"]=g.announcements),g.norms&&(q["NORMS.md"]=g.norms);const re={type:"team",name:g.id,displayName:ih(g,o),version:g.version,description:$4(g,o),author:g.author,category:g.category??"general",tags:g.tags??[],files:q,team:{members:g.members.map(J=>({name:H4(g,J.name??J.roleName??J.templateId??"Agent",o),role:J.role??"worker",roleName:J.roleName??J.templateId,count:J.count??1,skills:J.skills??[]}))}},B=s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 overflow-hidden",children:[s.jsx("div",{className:"px-5 py-3 border-b border-border-default bg-surface-elevated/30",children:s.jsx("h3",{className:"text-xs text-fg-tertiary uppercase tracking-wider",children:n("teamStore.teamComposition")})}),s.jsx("div",{className:"p-5 space-y-2",children:g.members.map((J,fe)=>{const Se=H4(g,J.name??J.roleName??J.templateId??"Agent",o);return s.jsxs("div",{className:"flex items-center gap-3 bg-surface-elevated/50 rounded-lg p-3",children:[s.jsx("div",{className:`w-9 h-9 rounded-lg flex items-center justify-center text-sm font-bold shrink-0 ${J.role==="manager"?"bg-amber-500/15 text-amber-400 ring-1 ring-amber-500/30":"bg-blue-500/15 text-blue-400 ring-1 ring-blue-500/30"}`,children:(Se[0]??"?").toUpperCase()}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-fg-primary font-medium",children:Se}),s.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] capitalize font-medium ${J.role==="manager"?"bg-amber-500/15 text-amber-400":"bg-blue-500/15 text-blue-400"}`,children:J.role??"worker"}),(J.count??1)>1&&s.jsxs("span",{className:"text-[10px] text-fg-muted",children:["×",J.count]})]}),(J.roleName||J.templateId)&&s.jsx("div",{className:"text-[10px] text-fg-tertiary font-mono mt-0.5",children:J.roleName??J.templateId})]}),J.skills&&J.skills.length>0&&s.jsxs("div",{className:"flex flex-wrap gap-1 shrink-0",children:[J.skills.slice(0,3).map(U=>s.jsx("span",{className:"px-1.5 py-0.5 text-[9px] bg-surface-elevated text-fg-muted rounded border border-border-default",children:U},U)),J.skills.length>3&&s.jsxs("span",{className:"text-[9px] text-fg-muted",children:["+",J.skills.length-3]})]})]},fe)})})]});return s.jsx(s.Fragment,{children:s.jsx(Mi,{type:"team",name:g.id,onBack:()=>{y(null),L(null)},readOnly:!0,initialManifest:re,contentSlot:B,actionSlot:s.jsxs(s.Fragment,{children:[j&&s.jsx("span",{className:`text-xs ${j.ok?"text-green-500":"text-red-500"}`,children:j.message}),s.jsx("button",{onClick:()=>{ee(g)},disabled:S,className:"px-4 py-1.5 text-xs bg-brand-600 hover:bg-brand-500 text-white rounded-lg transition-colors font-medium disabled:opacity-50",children:n(S?"teamStore.deploying":"teamStore.deployTeam")})]})})})}return s.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[s.jsxs("div",{"data-electron-drag":!0,className:"px-6 h-14 flex items-center justify-between shrink-0 gap-3",children:[s.jsx("h2",{className:"text-lg font-semibold",children:n("teamStore.title")}),s.jsx("input",{type:"text",placeholder:n("teamStore.searchPlaceholder"),value:l,onChange:q=>c(q.target.value),className:"px-3 py-1.5 bg-surface-elevated border border-border-default rounded-lg text-sm max-w-xs w-full focus:border-brand-500 focus:outline-none"})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-7 space-y-8",children:C?s.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:Array.from({length:4}).map((q,re)=>s.jsx("div",{className:"h-56 rounded-2xl skeleton"},re))}):d.length===0&&f.length===0?s.jsxs("div",{className:"text-center py-20",children:[s.jsx("div",{className:"text-4xl mb-4 opacity-30",children:"◉"}),s.jsx("div",{className:"text-fg-secondary font-medium mb-1",children:l?n("teamStore.noResults",{search:l}):n("teamStore.noTeams")}),s.jsx("div",{className:"text-fg-tertiary text-sm",children:n(l?"teamStore.noResultsHint":"teamStore.noTeamsHint")})]}):s.jsxs(s.Fragment,{children:[d.length>0&&s.jsxs("section",{children:[s.jsxs("div",{className:"flex items-baseline gap-2 mb-3",children:[s.jsx("h3",{className:"section-title",children:n("teamStore.builtin")}),s.jsx("span",{className:"text-xs text-fg-tertiary",children:n("teamStore.available",{count:d.length})})]}),s.jsx(Ar,{columns:2,children:d.map(q=>s.jsx(ia,{type:"team",name:ih(q,o),description:$4(q,o),seed:q.id,icon:q.icon||"users",version:q.version,category:q.category,tags:q.tags,authorLabel:q.author,hideStats:!0,showTypeBadge:!1,cornerLabel:n("teamStore.builtin"),onClick:()=>y(q)},q.id))})]}),f.length>0&&s.jsxs("section",{children:[s.jsx("h3",{className:"section-title mb-3",children:n("teamStore.markusHub")}),s.jsx(Ar,{columns:2,children:f.map(q=>s.jsx(KW,{item:q,localInfo:I.get(Oc(q)),purchased:e0(q,F),onStatusChange:G,highlight:q.id===e,onHighlightDone:t,onViewDetail:re=>z({type:"team",name:re})},q.id))})]})]})})]})}function KW({item:e,localInfo:t,purchased:n,onStatusChange:r,highlight:o,onHighlightDone:l,onViewDetail:c}){const{t:d}=ft(["store"]),[m,f]=k.useState(!1),[h,g]=k.useState(""),y=k.useRef(null),[x,w]=k.useState(!1);k.useEffect(()=>{if(o&&y.current){y.current.scrollIntoView({behavior:"smooth",block:"center"}),w(!0);const V=setTimeout(()=>{w(!1)},4e3);return()=>clearTimeout(V)}},[o,l]);const C=t?.installed??!1,T=C&&e.version&&t?.localVersion&&GW(e.version,t.localVersion),S=(e.priceCents??0)>0,E=S?`$${((e.priceCents??0)/100).toFixed(2)}`:null,j=async V=>{if(V.stopPropagation(),!m){f(!0),g("");try{await Ni(e),g(T?d("card.upgraded"):d("card.installed")+"!"),r()}catch(X){const z=X instanceof Error?X.message:"";z.includes("402")||z.includes("Purchase required")?g(d("card.purchaseRequired")):g(d("card.failed"))}finally{f(!1)}}},L=async V=>{if(V.stopPropagation(),!m){f(!0),g("");try{await Qg(e,z=>{z==="checkout_opened"?g(d("card.waitingPurchase","Waiting for purchase...")):z==="installing"&&g(d("card.installing"))})==="installed"?(g(d("card.installed")+"!"),r()):g("")}catch(X){g(X instanceof Error?X.message:d("card.failed"))}finally{f(!1)}}},I=e.slug&&e.author?.username?`${lt.getUrl()}/@${encodeURIComponent(e.author.username)}/${encodeURIComponent(e.slug)}`:null,O=()=>{C&&c?c(Oc(e)):I&&window.open(I,"_blank","noopener,noreferrer")},F=s.jsxs(s.Fragment,{children:[T?s.jsx("button",{onClick:V=>{j(V)},disabled:m,className:"px-3 py-1.5 text-xs bg-amber-600 hover:bg-amber-500 text-white rounded-lg transition-colors disabled:opacity-50",children:m?d("card.upgrading"):d("card.upgrade",{version:e.version})}):C?s.jsxs("button",{onClick:V=>{j(V)},disabled:m,className:"px-3 py-1.5 text-xs bg-surface-elevated hover:bg-surface-overlay text-fg-secondary border border-border-default rounded-lg transition-colors disabled:opacity-50",children:[d("card.installed"),t?.localVersion?` v${t.localVersion}`:""]}):S&&!n?s.jsx("button",{onClick:V=>{L(V)},disabled:m,className:"px-3 py-1.5 text-xs bg-amber-600 hover:bg-amber-500 text-white rounded-lg transition-colors disabled:opacity-50 inline-flex items-center gap-1",children:m?h||d("card.installing"):s.jsxs(s.Fragment,{children:[d("card.buy","Buy")," ",E]})}):s.jsx("button",{onClick:V=>{j(V)},disabled:m,className:"px-3 py-1.5 text-xs bg-brand-600 hover:bg-brand-500 text-white rounded-lg transition-colors disabled:opacity-50",children:d(m?"card.installing":"card.install")}),h&&s.jsx("span",{className:`text-[10px] ${h===d("card.failed")||h===d("card.purchaseRequired")?"text-red-500":"text-green-600"}`,children:h})]});return s.jsx("div",{ref:y,className:x?"animate-pulse":"",children:s.jsx(ia,{type:"team",showTypeBadge:!1,name:e.name,description:e.description,seed:e.slug||e.name,icon:e.icon||"users",cover:e.thumbnailUrl,hubBase:lt.getUrl(),author:e.author,version:e.version,category:e.category,tags:e.tags,rating:parseFloat(e.avgRating)||0,ratingCount:e.ratingCount,downloadCount:e.downloadCount,priceCents:e.priceCents,currency:e.currency,installed:C,glowing:x,onClick:O,actions:F})})}function oh(e,t){return e.i18n?.[t]?.displayName||e.name}function lh(e,t){return e.i18n?.[t]?.description||e.description||""}function m6(e,t){const n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<Math.max(n.length,r.length);o++){const l=n[o]??0,c=r[o]??0;if(l>c)return!0;if(l<c)return!1}return!1}const WW={development:"bg-blue-500/15 text-blue-600",devops:"bg-amber-500/15 text-amber-600",productivity:"bg-green-500/15 text-green-600",custom:"bg-gray-500/15 text-fg-secondary",browser:"bg-brand-500/15 text-brand-500",communication:"bg-green-500/15 text-green-600",data:"bg-brand-500/15 text-brand-500",platform:"bg-blue-500/15 text-blue-600","AI 智能":"bg-brand-500/15 text-brand-500",开发工具:"bg-blue-500/15 text-blue-600",效率提升:"bg-green-500/15 text-green-600",数据分析:"bg-brand-500/15 text-brand-500",内容创作:"bg-brand-500/15 text-brand-500",安全合规:"bg-red-500/15 text-red-500",通讯协作:"bg-green-500/15 text-green-600"};function YW({item:e,installedSkills:t,purchased:n,onMsg:r,onRefresh:o}){const{t:l}=ft(["store"]),[c,d]=k.useState(!1),m=e.name.toLowerCase().trim().replace(/\s+/g,"-").replace(/[\/\\:*?"<>|]+/g,"").replace(/-{2,}/g,"-").replace(/^-|-$/g,"")||"unnamed",f=t.find(S=>S.name===e.name||S.name===m||!!e.slug&&S.name===e.slug),h=!!f,g=h&&e.version&&f?.version&&m6(e.version,f.version),y=(e.priceCents??0)>0,[x,w]=k.useState(""),C=async()=>{if(!c){d(!0),w("");try{await Ni(e),r(g?`Upgraded ${e.name}`:`Installed ${e.name}`,"success"),o()}catch(S){const E=S instanceof Error?S.message:"";E.includes("402")||E.includes("Purchase required")?r(l("card.purchaseRequired"),"error"):r(l("card.failed"),"error")}finally{d(!1)}}},T=async()=>{if(!c){d(!0),w("");try{await Qg(e,E=>{E==="checkout_opened"?w(l("card.waitingPurchase","Waiting for purchase...")):E==="installing"&&w(l("card.installing"))})==="installed"&&(r(`Purchased & installed ${e.name}`,"success"),o()),w("")}catch(S){r(S instanceof Error?S.message:l("card.failed"),"error"),w("")}finally{d(!1)}}};if(g)return s.jsx("button",{onClick:()=>{C()},disabled:c,className:"px-2.5 py-1 text-[10px] bg-amber-600 hover:bg-amber-500 text-white rounded-lg disabled:opacity-50",children:c?l("card.upgrading"):l("card.upgrade",{version:e.version})});if(h)return s.jsxs("span",{className:"px-2.5 py-1 text-[10px] bg-surface-overlay text-fg-secondary rounded-lg",children:[l("card.installed"),f?.version?` (v${f.version})`:""]});if(y&&!n){const S=`$${((e.priceCents??0)/100).toFixed(2)}`;return s.jsx("span",{className:"inline-flex items-center gap-1.5",children:s.jsx("button",{onClick:()=>{T()},disabled:c,className:"px-2.5 py-1 text-[10px] bg-amber-600 hover:bg-amber-500 text-white rounded-lg disabled:opacity-50 inline-flex items-center gap-1",children:c?x||l("card.installing"):s.jsxs(s.Fragment,{children:[l("card.buy","Buy")," ",S]})})})}return s.jsx("button",{onClick:()=>{C()},disabled:c,className:"px-2.5 py-1 text-[10px] bg-brand-600 hover:bg-brand-500 text-white rounded-lg disabled:opacity-50",children:l(c?"card.installing":"card.install")})}function U4({item:e,installedSkills:t,purchased:n,onMsg:r,onRefresh:o,highlight:l,onHighlightDone:c,type:d="skill"}){const m=k.useRef(null),[f,h]=k.useState(!1);k.useEffect(()=>{if(l&&m.current){m.current.scrollIntoView({behavior:"smooth",block:"center"}),h(!0);const x=setTimeout(()=>{h(!1)},4e3);return()=>clearTimeout(x)}},[l,c]);const g=e.slug&&e.author?.username?`${lt.getUrl()}/@${encodeURIComponent(e.author.username)}/${encodeURIComponent(e.slug)}`:null,y=()=>{g&&window.open(g,"_blank","noopener,noreferrer")};return s.jsx("div",{ref:m,className:f?"animate-pulse":"",children:s.jsx(ia,{type:d,showTypeBadge:d!=="skill",name:e.name,description:e.description,seed:e.slug||e.name,icon:e.icon||Vd(e.slug||e.name,e.category),cover:e.thumbnailUrl,hubBase:lt.getUrl(),author:e.author,version:e.version,category:e.category,tags:e.tags,rating:parseFloat(e.avgRating)||0,ratingCount:e.ratingCount,downloadCount:e.downloadCount,priceCents:e.priceCents,currency:e.currency,onClick:y,actions:s.jsx(YW,{item:e,installedSkills:t,purchased:n,onMsg:r,onRefresh:o})})})}function XW({highlightItemId:e,onHighlightDone:t}={}){const{t:n,i18n:r}=ft(["store","common"]),o=r.language,l=Uo(),[c,d]=k.useState("skills"),[m,f]=k.useState(null),[h,g]=k.useState(new Set),[y,x]=k.useState([]),[w,C]=k.useState(null),[T,S]=k.useState([]),[E,j]=k.useState(0),[L,I]=k.useState(1),[O,F]=k.useState([]),[V,X]=k.useState(""),[z,G]=k.useState("score"),[se,ee]=k.useState(""),[q,re]=k.useState(!1),[B,J]=k.useState([]),[fe,Se]=k.useState(!1),[U,W]=k.useState([]),[pe,P]=k.useState(""),[_e,He]=k.useState(!1),[Pe,Ge]=k.useState([]),[ct,mt]=k.useState([]),[Ct,Mt]=k.useState(new Set),[Pt,Kt]=k.useState(!1),[yt,Ue]=k.useState(""),dt=[{id:"skills",labelKey:"skillStore.tabs.all"},{id:"skillhub",labelKey:"skillStore.tabs.skillhub"},{id:"skillssh",labelKey:"skillStore.tabs.skillssh"}],Nt=(H,te="success")=>{f({text:H,type:te}),setTimeout(()=>f(null),te==="error"?1e4:4e3)},bt=k.useCallback(async()=>{try{const H=await Ee.skills.list();x(H.skills)}catch{}},[]),Lt=k.useCallback(async()=>{Se(!0);try{const H=await Ee.skills.builtin();J(H.skills)}catch{}Se(!1)},[]),ue=k.useCallback(async H=>{re(!0);try{const te=await Ee.skills.registrySkillhub({q:H?.q,category:H?.category,page:H?.page??1,limit:24,sort:H?.sort??z});S(te.skills),j(te.total),te.categories?.length&&F(te.categories)}catch{}re(!1)},[z]),tt=k.useCallback(async H=>{He(!0);try{const te=await Ee.skills.registrySkillssh(H);W(te.skills)}catch{}He(!1)},[]),st=k.useCallback(async H=>{Kt(!0);try{const te=H?lt.search({type:"skill",q:H,limit:50}):Si(Tr.hubSkills)??lt.search({type:"skill",limit:50}),Ne=lt.search({subtype:"connector",q:H||void 0,limit:50}).catch(()=>({items:[]})),[Re,$e]=await Promise.all([te,Ne,lt.isAuthenticated()?lt.purchases.mine().then(be=>Mt(new Set(be.purchases.map(Ke=>Ke.itemId)))).catch(()=>{}):Promise.resolve()]);let Q=Re?.items??[],Z=$e?.items??[];if(e){const be=Q.some(Ie=>Ie.id===e),Ke=Z.some(Ie=>Ie.id===e);if(!be&&!Ke)try{const{item:Ie}=await lt.getItem(e);Ie?.subtype==="connector"?Z=[Ie,...Z]:Ie?Q=[Ie,...Q]:t?.()}catch{t?.()}else be&&(Q=[Q.find(Ye=>Ye.id===e),...Q.filter(Ye=>Ye.id!==e)]),Ke&&(Z=[Z.find(Ye=>Ye.id===e),...Z.filter(Ye=>Ye.id!==e)])}Ge(Q),mt(Z)}catch{}Kt(!1)},[e,t]);k.useEffect(()=>{bt(),Lt(),ue(),tt()},[]),k.useEffect(()=>{c==="skills"&&st(yt)},[c,yt,st]);const ye=async H=>{g(te=>new Set(te).add(H.name));try{const te=await Ee.skills.install({name:H.name,source:"skillhub",slug:H.slug,sourceUrl:H.homepage,description:H.description_zh??H.description,category:"custom",version:H.version});await bt(),Nt(`"${H.name}" installed (${te.method}) → ${te.path}`),window.dispatchEvent(new CustomEvent("markus:data-changed"))}catch{Nt(`Download failed for "${H.name}". You can try manually from: ${H.homepage}`,"error")}g(te=>{const Ne=new Set(te);return Ne.delete(H.name),Ne})},je=async H=>{g(te=>new Set(te).add(H.name));try{const te=await Ee.skills.install({name:H.name,source:"skillssh",sourceUrl:H.url,githubRepo:`${H.author}/${H.repo}`,githubSkillPath:H.name});await bt(),Nt(`"${H.name}" installed (${te.method}) → ${te.path}`),window.dispatchEvent(new CustomEvent("markus:data-changed"))}catch{Nt(`Download failed for "${H.name}". You can try manually from: ${H.url}`,"error")}g(te=>{const Ne=new Set(te);return Ne.delete(H.name),Ne})},Ae=async H=>{g(te=>new Set(te).add(H.name));try{const te=await Ee.skills.install({name:H.name,source:"builtin"});await bt(),await Lt(),Nt(`"${H.name}" installed (${te.method}) → ${te.path}`),window.dispatchEvent(new CustomEvent("markus:data-changed"))}catch(te){Nt(`Install failed for "${H.name}": ${te}`,"error")}g(te=>{const Ne=new Set(te);return Ne.delete(H.name),Ne})},oe=U.filter(H=>{if(!pe)return!0;const te=pe.toLowerCase();return H.name.toLowerCase().includes(te)||H.repo.toLowerCase().includes(te)});if(w){const H=w,te={};H.instructions&&(te["SKILL.md"]=H.instructions);const Ne={type:"skill",name:H.name,displayName:oh(H,o),version:H.version,description:lh(H,o),author:H.author??"",category:H.category??"general",tags:H.tags,files:te,skill:{skillFile:H.instructions?"SKILL.md":"",requiredPermissions:H.requiredPermissions,mcpServers:void 0,alwaysOn:!1}},Re=H.installed&&H.installedVersion&&m6(H.version,H.installedVersion)?s.jsx("button",{onClick:()=>{Ae(H)},disabled:h.has(H.name),className:"px-4 py-1.5 text-xs bg-amber-600 hover:bg-amber-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:h.has(H.name)?n("card.upgrading"):n("card.upgrade",{version:H.version})}):H.installed?s.jsxs("span",{className:"px-4 py-1.5 text-xs bg-green-500/10 text-green-500 rounded-lg border border-green-500/20 inline-flex items-center gap-1",children:[s.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}),n("card.installed"),H.installedVersion?` v${H.installedVersion}`:""]}):s.jsx("button",{onClick:()=>{Ae(H)},disabled:h.has(H.name),className:"px-4 py-1.5 text-xs bg-green-600 hover:bg-green-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:h.has(H.name)?n("card.installing"):n("card.install")}),$e=s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 p-5",children:[s.jsx("h3",{className:"text-xs text-fg-tertiary uppercase tracking-wider mb-3",children:n("skillStore.details")}),s.jsxs("div",{className:"space-y-2.5 text-sm",children:[H.category&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-fg-tertiary w-24",children:n("skillStore.category")}),s.jsx("span",{className:`px-2 py-0.5 rounded-full text-[10px] font-medium capitalize ${WW[H.category]??"bg-gray-500/15 text-fg-secondary"}`,children:H.category})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-fg-tertiary w-24",children:n("skillStore.version")}),s.jsx("span",{className:"text-fg-secondary font-mono text-xs",children:H.version})]}),H.hasMcpServers&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-fg-tertiary w-24",children:n("skillStore.integration")}),s.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] bg-purple-500/15 text-purple-400",children:"MCP"})]}),H.hasInstructions&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-fg-tertiary w-24",children:n("skillStore.instructions")}),s.jsx("span",{className:"text-green-500 text-xs",children:"✓"})]})]})]}),(H.requiredPermissions.length>0||H.tags.length>0)&&s.jsxs("div",{className:"space-y-4",children:[H.requiredPermissions.length>0&&s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 p-5",children:[s.jsx("h3",{className:"text-xs text-fg-tertiary uppercase tracking-wider mb-3",children:n("skillStore.permissions")}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:H.requiredPermissions.map(Q=>s.jsx("span",{className:"px-2.5 py-1 text-xs bg-amber-500/10 text-amber-500 rounded-lg border border-amber-500/20",children:Q},Q))})]}),H.tags.length>0&&s.jsxs("div",{className:"rounded-xl border border-border-default bg-surface-secondary/40 p-5",children:[s.jsx("h3",{className:"text-xs text-fg-tertiary uppercase tracking-wider mb-3",children:n("skillStore.tags")}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:H.tags.map(Q=>s.jsx("span",{className:"px-2.5 py-1 text-xs bg-surface-elevated text-fg-secondary rounded-lg border border-border-default/50",children:Q},Q))})]})]})]});return s.jsxs(s.Fragment,{children:[s.jsx(Mi,{type:"skill",name:H.name,onBack:()=>C(null),readOnly:!0,initialManifest:Ne,actionSlot:Re,contentSlot:$e}),m&&s.jsx("div",{className:`mx-7 mb-2 px-3 py-1.5 text-xs rounded-lg shrink-0 ${m.type==="error"?"bg-red-500/10 text-red-500":"bg-green-500/10 text-green-600"}`,children:m.text})]})}return s.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[s.jsxs("div",{className:`${l?"px-4":"px-6"} shrink-0`,children:[s.jsx("div",{"data-electron-drag":!0,className:"flex items-center h-14",children:s.jsx("h2",{className:"text-lg font-semibold",children:n("skillStore.title")})}),s.jsx("div",{className:`flex ${l?"flex-wrap":""} gap-1 pb-2 overflow-x-auto scrollbar-hide`,children:dt.map(H=>s.jsx("button",{onClick:()=>d(H.id),className:`px-3 py-1.5 text-xs rounded-lg transition-colors shrink-0 ${c===H.id?"bg-brand-600 text-white":"text-fg-secondary hover:text-fg-primary hover:bg-surface-elevated"}`,children:n(H.labelKey)},H.id))})]}),m&&s.jsx("div",{className:`mx-7 mt-2 px-3 py-1.5 text-xs rounded-lg shrink-0 ${m.type==="error"?"bg-red-500/10 text-red-500":"bg-green-500/10 text-green-600"}`,children:m.text}),c==="skills"&&(()=>{const H=yt.trim().toLowerCase(),te=H?B.filter($e=>oh($e,o).toLowerCase().includes(H)||lh($e,o).toLowerCase().includes(H)):B,Ne=fe&&Pt,Re=te.length===0&&Pe.length===0&&ct.length===0;return s.jsxs("div",{className:`flex-1 overflow-y-auto ${l?"p-4":"p-6"} space-y-8`,children:[s.jsx("div",{className:"flex items-center gap-2",children:s.jsx("input",{value:yt,onChange:$e=>Ue($e.target.value),placeholder:n("skillStore.searchMarkusHub"),className:`px-3 py-1.5 bg-surface-elevated border border-border-default rounded-lg text-sm text-fg-primary focus:border-brand-500 outline-none ${l?"flex-1 min-w-0":"w-72"}`})}),Ne&&Re?s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:6}).map(($e,Q)=>s.jsx("div",{className:"h-56 rounded-2xl skeleton"},Q))}):Re?s.jsxs("div",{className:"text-center text-fg-tertiary py-20",children:[s.jsx("div",{className:"text-4xl mb-3 opacity-30",children:"◇"}),s.jsx("div",{children:n("skillStore.noBuiltin")}),s.jsx("div",{className:"text-xs mt-1",children:n("skillStore.noBuiltinHint")})]}):s.jsxs(s.Fragment,{children:[te.length>0&&s.jsxs("section",{children:[s.jsxs("div",{className:"flex items-baseline gap-2 mb-3",children:[s.jsx("h3",{className:"section-title",children:n("skillStore.tabs.builtin")}),s.jsx("span",{className:"text-xs text-fg-tertiary",children:n("skillStore.builtinCount",{count:te.length})})]}),s.jsx(Ar,{columns:3,children:te.map($e=>s.jsx(ia,{type:"skill",name:oh($e,o),description:lh($e,o),seed:$e.name,icon:Vd($e.name,$e.category),version:$e.version,category:$e.category,tags:$e.tags,authorLabel:$e.author||void 0,installed:$e.installed,hideStats:!0,showTypeBadge:!1,cornerLabel:$e.installed?void 0:n("skillStore.tabs.builtin"),onClick:()=>C($e)},$e.name))})]}),Pe.length>0&&s.jsxs("section",{children:[s.jsx("h3",{className:"section-title mb-3",children:n("skillStore.tabs.markusHub")}),s.jsx(Ar,{columns:3,children:Pe.map($e=>s.jsx(U4,{item:$e,installedSkills:y,purchased:e0($e,Ct),onMsg:Nt,onRefresh:()=>{bt(),st(yt)},highlight:$e.id===e,onHighlightDone:t},$e.id))})]}),ct.length>0&&s.jsxs("section",{children:[s.jsxs("div",{className:"mb-3",children:[s.jsx("h3",{className:"section-title",children:n("tabs.connectors")}),s.jsx("p",{className:"text-xs text-fg-tertiary mt-0.5",children:n("connectorStore.emptyHint","连接器让智能体接入外部工具与服务 (MCP)")})]}),s.jsx(Ar,{columns:3,children:ct.map($e=>s.jsx(U4,{item:$e,type:"connector",installedSkills:y,purchased:e0($e,Ct),onMsg:Nt,onRefresh:()=>{bt(),st(yt)},highlight:$e.id===e,onHighlightDone:t},$e.id))})]})]})]})})(),c==="skillhub"&&s.jsxs("div",{className:`flex-1 overflow-y-auto ${l?"p-4":"p-6"}`,children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3 flex-wrap",children:[s.jsxs("select",{value:V,onChange:H=>{X(H.target.value),I(1),ue({q:se||void 0,category:H.target.value||void 0,page:1})},className:"px-2 py-1.5 bg-surface-elevated border border-border-default rounded-lg text-xs text-fg-secondary outline-none",children:[s.jsx("option",{value:"",children:n("skillStore.allCategories")}),O.map(H=>s.jsx("option",{value:H,children:H},H))]}),s.jsxs("select",{value:z,onChange:H=>{G(H.target.value),I(1),ue({q:se||void 0,category:V||void 0,page:1,sort:H.target.value})},className:"px-2 py-1.5 bg-surface-elevated border border-border-default rounded-lg text-xs text-fg-secondary outline-none",children:[s.jsx("option",{value:"score",children:n("skillStore.sortScore")}),s.jsx("option",{value:"downloads",children:n("skillStore.sortDownloads")}),s.jsx("option",{value:"stars",children:n("skillStore.sortStars")}),s.jsx("option",{value:"installs",children:n("skillStore.sortInstalls")})]}),!l&&s.jsx("span",{className:"text-xs text-fg-tertiary ml-auto",children:s.jsx("a",{href:"https://skillhub.tencent.com",target:"_blank",rel:"noopener noreferrer",className:"text-brand-500 hover:text-brand-500",children:n("skillStore.visitSite")})})]}),s.jsxs("div",{className:"flex items-center gap-2 mb-5",children:[s.jsx("input",{value:se,onChange:H=>ee(H.target.value),onKeyDown:H=>{H.key==="Enter"&&(I(1),ue({q:se||void 0,category:V||void 0,page:1}))},placeholder:n("skillStore.searchSkillhub"),className:"px-3 py-1.5 bg-surface-elevated border border-border-default rounded-lg text-sm text-fg-primary focus:border-brand-500 outline-none flex-1 min-w-0"}),s.jsx("button",{onClick:()=>{I(1),ue({q:se||void 0,category:V||void 0,page:1})},className:"px-3 py-1.5 bg-brand-600 hover:bg-brand-500 text-white text-xs rounded-lg shrink-0",children:"Search"})]}),q?s.jsx("div",{className:"text-center text-fg-tertiary py-20",children:s.jsx("div",{className:"animate-pulse",children:n("skillStore.loadingSkillhub")})}):T.length===0?s.jsxs("div",{className:"text-center text-fg-tertiary py-20",children:[s.jsx("div",{className:"text-4xl mb-3 opacity-30",children:"◎"}),s.jsx("div",{children:n("skillStore.noSkillhub")})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-xs text-fg-tertiary mb-3",children:n("skillStore.skillhubTotal",{count:E.toLocaleString()})}),s.jsx(Ar,{columns:3,children:T.map(H=>{const te=y.some(Ne=>Ne.name===H.name||Ne.name===H.slug);return s.jsx(ia,{type:"skill",name:H.name,description:H.description_zh??H.description??"",seed:H.slug,icon:Vd(H.slug||H.name,H.tags?.[0]),version:H.version,authorLabel:"SkillHub",showTypeBadge:!1,tags:H.tags,installed:te,hideStats:!0,onClick:()=>window.open(H.homepage,"_blank","noopener,noreferrer"),footerLeft:s.jsxs("span",{className:"flex items-center gap-2 text-[10px] text-fg-tertiary",children:[H.stars>0&&s.jsxs("span",{className:"text-amber-600",children:["★ ",H.stars.toLocaleString()]}),H.downloads>0&&s.jsxs("span",{children:[H.downloads>=1e4?`${(H.downloads/1e4).toFixed(1)}万`:H.downloads.toLocaleString()," ",n("skillStore.downloads")]})]}),actions:te?void 0:s.jsx("button",{onClick:()=>{ye(H)},disabled:h.has(H.name),className:"px-2.5 py-1 text-[10px] bg-brand-600 hover:bg-brand-500 text-white rounded-lg disabled:opacity-50",children:h.has(H.name)?"...":n("card.install")})},H.slug)})}),E>24&&s.jsxs("div",{className:"flex items-center justify-center gap-2 mt-6",children:[s.jsx("button",{disabled:L<=1,onClick:()=>{const H=L-1;I(H),ue({q:se||void 0,category:V||void 0,page:H})},className:"px-3 py-1.5 text-xs bg-surface-elevated text-fg-secondary rounded-lg hover:bg-surface-overlay disabled:opacity-30",children:n("skillStore.prevPage")}),s.jsx("span",{className:"text-xs text-fg-tertiary",children:n("skillStore.pageInfo",{current:L,total:Math.ceil(E/24)})}),s.jsx("button",{disabled:L>=Math.ceil(E/24),onClick:()=>{const H=L+1;I(H),ue({q:se||void 0,category:V||void 0,page:H})},className:"px-3 py-1.5 text-xs bg-surface-elevated text-fg-secondary rounded-lg hover:bg-surface-overlay disabled:opacity-30",children:n("skillStore.nextPage")})]})]})]}),c==="skillssh"&&s.jsxs("div",{className:`flex-1 overflow-y-auto ${l?"p-4":"p-6"}`,children:[s.jsxs("div",{className:`flex ${l?"flex-wrap":""} items-center gap-2 mb-5`,children:[s.jsx("input",{value:pe,onChange:H=>P(H.target.value),onKeyDown:H=>{H.key==="Enter"&&pe.trim()&&tt(pe)},placeholder:n("skillStore.searchSkillssh"),className:`px-3 py-1.5 bg-surface-elevated border border-border-default rounded-lg text-sm text-fg-primary focus:border-brand-500 outline-none ${l?"flex-1 min-w-0":"w-72"}`}),s.jsx("button",{onClick:()=>{pe.trim()&&tt(pe)},className:"px-3 py-1.5 bg-brand-600 hover:bg-brand-500 text-white text-xs rounded-lg shrink-0",children:"Search"}),!l&&s.jsx("span",{className:"text-xs text-fg-tertiary ml-auto",children:s.jsx("a",{href:"https://skills.sh",target:"_blank",rel:"noopener noreferrer",className:"text-brand-500 hover:text-brand-500",children:n("skillStore.visitSite")})})]}),_e?s.jsx("div",{className:"text-center text-fg-tertiary py-20",children:s.jsx("div",{className:"animate-pulse",children:n("skillStore.loadingSkillssh")})}):oe.length===0?s.jsxs("div",{className:"text-center text-fg-tertiary py-20",children:[s.jsx("div",{className:"text-4xl mb-3 opacity-30",children:"⬡"}),s.jsx("div",{children:n("skillStore.browseSkillssh")}),s.jsx("div",{className:"text-xs mt-1",children:n("skillStore.browseSkillsshHint")})]}):s.jsx(Ar,{columns:3,children:oe.map(H=>{const te=y.some(Ne=>Ne.name===H.name);return s.jsx(ia,{type:"skill",name:H.name,description:H.description||"",seed:`${H.author}-${H.name}`,icon:Vd(H.name),authorLabel:`${H.author}/${H.repo}`,showTypeBadge:!1,installed:te,hideStats:!0,cornerLabel:te?void 0:"skills.sh",onClick:()=>window.open(H.url,"_blank","noopener,noreferrer"),footerLeft:H.installs?s.jsxs("span",{className:"text-[10px] text-fg-tertiary",children:[H.installs," installs"]}):void 0,actions:te?void 0:s.jsx("button",{onClick:()=>{je(H)},disabled:h.has(H.name),className:"px-2.5 py-1 text-[10px] bg-brand-600 hover:bg-brand-500 text-white rounded-lg disabled:opacity-50",children:h.has(H.name)?"...":n("card.install")})},`${H.author}-${H.name}`)})})]})]})}const QW=["agent","team","skill","connector"];function ch({title:e,subtitle:t,onMore:n,moreLabel:r}){return s.jsxs("div",{className:"flex items-end justify-between mb-3",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"section-title",children:e}),t&&s.jsx("p",{className:"section-subtitle",children:t})]}),n&&s.jsxs("button",{className:"section-link",onClick:n,children:[r??"View all"," →"]})]})}function ZW({item:e,onOpen:t}){const n=Xo(e.subtype==="connector"?"connector":e.itemType),r=Xg(n,e.slug||e.name),o=Ei[n];return s.jsxs("button",{onClick:t,className:"group relative w-full overflow-hidden rounded-2xl text-left h-44 md:h-52",style:{background:r},children:[s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-black/55 via-black/20 to-transparent"}),s.jsx("svg",{className:"absolute -right-8 -bottom-10 opacity-20",width:"220",height:"220",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:s.jsx("path",{d:"M12 2l2.4 6.9L21 9l-5.4 4 2 7-5.6-4.1L6.4 20l2-7L3 9l6.6-.1z",fill:"white"})}),s.jsxs("div",{className:"relative h-full flex flex-col justify-end p-5 md:p-6",children:[s.jsxs("span",{className:"inline-flex w-fit items-center gap-1 rounded-full bg-white/20 backdrop-blur px-2.5 py-0.5 text-[11px] font-semibold text-white mb-2",children:["★ Featured · ",o.label]}),s.jsx("h2",{className:"text-xl md:text-2xl font-bold text-white drop-shadow-sm",children:e.name}),s.jsx("p",{className:"text-sm text-white/85 truncate max-w-lg mt-1",children:e.description}),s.jsxs("div",{className:"flex items-center gap-3 mt-3 text-white/80 text-xs",children:[s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx(C0,{name:e.author?.displayName,username:e.author?.username,avatarUrl:e.author?.avatarUrl,hubBase:lt.getUrl(),size:18}),e.author?.displayName||e.author?.username]}),s.jsxs("span",{children:["↓ ",Mo(e.downloadCount)]}),(e.priceCents??0)>0?s.jsxs("span",{className:"badge-paid",children:["$",((e.priceCents??0)/100).toFixed(0)]}):s.jsx("span",{className:"badge-free",children:"Free"})]})]})]})}function F4({items:e,onOpen:t}){return s.jsx(Ar,{columns:3,children:e.map(n=>s.jsx(ia,{type:n.subtype==="connector"?"connector":n.itemType,name:n.name,description:n.description,seed:n.slug||n.name,icon:n.icon,cover:n.thumbnailUrl,hubBase:lt.getUrl(),author:n.author,category:n.category,tags:n.tags,rating:parseFloat(n.avgRating)||0,ratingCount:n.ratingCount,downloadCount:n.downloadCount,priceCents:n.priceCents,currency:n.currency,onClick:()=>t(n)},n.id))})}function q4(){return s.jsx(Ar,{columns:3,children:Array.from({length:6}).map((e,t)=>s.jsx("div",{className:"h-64 rounded-2xl skeleton"},t))})}function JW({onOpenType:e}){const{t}=ft(["store","common"]),[n,r]=k.useState([]),[o,l]=k.useState(!0);k.useEffect(()=>{let g=!1;return(async()=>{l(!0);try{const y=await lt.search({limit:60,sort:"popular"});g||r(y.items??[])}catch{g||r([])}finally{g||l(!1)}})(),()=>{g=!0}},[]);const c=k.useMemo(()=>{const g=n.filter(x=>x.featured);return(g.length>0?g:n).slice(0,3)},[n]),d=k.useMemo(()=>[...n].sort((g,y)=>(y.trendingScore??y.downloadCount)-(g.trendingScore??g.downloadCount)).slice(0,10),[n]),m=k.useMemo(()=>[...n].sort((g,y)=>(y.createdAt||"").localeCompare(g.createdAt||"")).slice(0,10),[n]),f=k.useMemo(()=>{const g=new Map;for(const y of n){const x=y.author?.username||y.author?.id;if(!x)continue;const w=g.get(x)??{author:y.author,downloads:0,count:0};w.downloads+=y.downloadCount||0,w.count+=1,g.set(x,w)}return[...g.values()].sort((y,x)=>x.downloads-y.downloads).slice(0,6)},[n]),h=g=>e(Xo(g.subtype==="connector"?"connector":g.itemType),g.id);return s.jsxs("div",{className:"flex-1 overflow-y-auto px-5 md:px-7 py-5 space-y-8",children:[s.jsxs("div",{className:"hero-glow rounded-2xl border border-border-subtle bg-surface-secondary p-5 md:p-6",children:[s.jsx("h1",{className:"text-2xl font-bold text-gradient tracking-tight",children:t("discover.title","Markus 广场")}),s.jsx("p",{className:"text-sm text-fg-tertiary mt-1 max-w-2xl",children:t("discover.subtitle","发现社区共享的智能体、AI 小队、技能与连接器 — 由创作者共建的开放生态。")}),s.jsx("div",{className:"flex flex-wrap gap-2 mt-4",children:QW.map(g=>s.jsxs("button",{onClick:()=>e(g),className:`inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-xs font-medium text-white bg-gradient-to-r ${Ei[g].gradient} hover:opacity-90 transition-opacity`,children:[Ei[g].labelZh,s.jsx("span",{className:"opacity-70",children:Ei[g].label})]},g))})]}),o?s.jsx("div",{className:"h-52 rounded-2xl skeleton"}):c.length>0?s.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:c.map(g=>s.jsx(ZW,{item:g,onOpen:()=>h(g)},g.id))}):null,s.jsxs("section",{children:[s.jsx(ch,{title:t("discover.trending","热门趋势"),subtitle:t("discover.trendingSub","社区中下载与评分增长最快的资产")}),o?s.jsx(q4,{}):d.length>0?s.jsx(F4,{items:d,onOpen:h}):s.jsx(eY,{})]}),s.jsxs("section",{children:[s.jsx(ch,{title:t("discover.fresh","新鲜上架"),subtitle:t("discover.freshSub","来自创作者的最新作品")}),o?s.jsx(q4,{}):m.length>0?s.jsx(F4,{items:m,onOpen:h}):null]}),f.length>0&&s.jsxs("section",{children:[s.jsx(ch,{title:t("discover.topCreators","顶尖创作者"),subtitle:t("discover.topCreatorsSub","生态贡献榜")}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:f.map((g,y)=>s.jsxs("div",{className:"asset-card p-4 flex flex-col items-center text-center",children:[s.jsxs("div",{className:"relative",children:[s.jsx(C0,{name:g.author?.displayName,username:g.author?.username,avatarUrl:g.author?.avatarUrl,hubBase:lt.getUrl(),size:48,verified:y<3}),y<3&&s.jsx("span",{className:"absolute -top-1 -left-1 w-5 h-5 rounded-full bg-amber-400 text-black text-[10px] font-bold flex items-center justify-center ring-2 ring-surface-secondary",children:y+1})]}),s.jsx("div",{className:"text-sm font-semibold text-fg-primary truncate w-full mt-2",children:g.author?.displayName||g.author?.username}),s.jsxs("div",{className:"text-[11px] text-fg-tertiary mt-0.5",children:[g.count," 作品 · ↓ ",Mo(g.downloads)]})]},g.author?.username||y))})]})]})}function eY(){const{t:e}=ft(["store"]);return s.jsxs("div",{className:"text-center py-12 rounded-2xl border border-dashed border-border-default",children:[s.jsx("div",{className:"text-3xl mb-2 opacity-40",children:"✦"}),s.jsx("div",{className:"text-fg-secondary font-medium",children:e("discover.empty","生态正在成长中")}),s.jsx("div",{className:"text-fg-tertiary text-sm mt-1",children:e("discover.emptyHint","成为首批创作者,分享你的第一个资产")})]})}function Od(e,t,n){return e.i18n?.[n]?.[t]}function tY(){const{t:e,i18n:t}=ft(["store","common"]),n=Uo(),r=t.language,[o,l]=k.useState([]),[c,d]=k.useState({}),[m,f]=k.useState(new Set),[h,g]=k.useState(null),[y,x]=k.useState(!0),[w,C]=k.useState(""),[T,S]=k.useState("all"),[E,j]=k.useState(null),L=k.useCallback(async()=>{x(!0);try{const[F,V,X,z]=await Promise.all([Ee.builder.artifacts.list().catch(()=>({artifacts:[]})),Ee.builder.artifacts.installed().catch(()=>({installed:{}})),Ee.skills.updates().catch(()=>({updates:[],count:0})),Ee.skills.builtin().catch(()=>({skills:[]}))]),G={};for(const q of X.updates)G[q.name]={availableVersion:q.availableVersion,installedVersion:q.installedVersion,displayName:q.displayName,description:q.description};d(G);const se=F.artifacts.filter(q=>{const re=`${q.type}/${q.name}`;return!!V.installed[re]}),ee=new Set(se.filter(q=>q.type==="skill").map(q=>q.name));for(const q of z.skills)!q.installed||ee.has(q.name)||!(V.installed[`skill/${q.name}`]||G[q.name])&&!q.updateAvailable||!V.installed[`skill/${q.name}`]&&!G[q.name]||(se.push({type:"skill",name:q.name,meta:{displayName:q.i18n?.[r]?.displayName||q.name,description:q.i18n?.[r]?.description||q.description||"",version:q.installedVersion||q.version,author:q.author,category:q.category,tags:q.tags,i18n:q.i18n},path:"",updatedAt:""}),ee.add(q.name));for(const[q,re]of Object.entries(G))ee.has(q)||(se.push({type:"skill",name:q,meta:{displayName:re.displayName||q,description:re.description||"",version:re.installedVersion},path:"",updatedAt:""}),ee.add(q));l(se)}catch{}x(!1)},[r]);k.useEffect(()=>{L()},[L]),k.useEffect(()=>{const F=()=>{L()};return window.addEventListener("markus:data-changed",F),()=>window.removeEventListener("markus:data-changed",F)},[L]),k.useEffect(()=>{if(!h)return;const F=setTimeout(()=>g(null),3e3);return()=>clearTimeout(F)},[h]);const I=async(F,V)=>{if(!m.has(F)){f(X=>new Set(X).add(F));try{await Ee.skills.install({name:F,source:"builtin"});try{localStorage.removeItem("markus:template-updates-ack")}catch{}g({text:e("installedTab.updateSuccess",{name:F,version:V}),type:"success"}),window.dispatchEvent(new CustomEvent("markus:data-changed")),await L()}catch{g({text:e("installedTab.updateFailed",{name:F}),type:"error"})}f(X=>{const z=new Set(X);return z.delete(F),z})}},O=o.filter(F=>{if(T!=="all"&&F.type!==T)return!1;if(!w)return!0;const V=w.toLowerCase(),X=(Od(F.meta,"displayName",r)||F.meta.displayName||F.name).toLowerCase(),z=(Od(F.meta,"description",r)||F.meta.description||"").toLowerCase();return X.includes(V)||z.includes(V)}).sort((F,V)=>{const X=F.type==="skill"&&c[F.name]?1:0;return(V.type==="skill"&&c[V.name]?1:0)-X});return E?s.jsx(Mi,{type:E.type,name:E.name,onBack:()=>j(null)}):s.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[s.jsxs("div",{"data-electron-drag":!0,className:`${n?"px-4":"px-6"} h-14 flex items-center shrink-0 gap-3`,children:[s.jsx("h2",{className:"text-lg font-semibold",children:e("installedTab.title")}),Object.keys(c).length>0&&s.jsxs("span",{className:"px-2 py-0.5 text-[11px] font-medium rounded-md bg-amber-500/15 text-amber-600 border border-amber-500/25",children:[e("installedTab.updateAvailable")," · ",Object.keys(c).length]})]}),s.jsxs("div",{className:`flex flex-wrap items-center gap-2 ${n?"px-4":"px-6"} py-2 shrink-0`,children:[s.jsx("div",{className:"flex gap-1",children:["all","agent","team","skill"].map(F=>s.jsx("button",{onClick:()=>S(F),className:`px-3 py-1 text-xs rounded-md transition-colors ${T===F?"bg-brand-600 text-white":"text-fg-secondary hover:text-fg-primary hover:bg-surface-elevated"}`,children:e(`installedTab.filter${F==="all"?"All":F==="agent"?"Agents":F==="team"?"Teams":"Skills"}`)},F))}),s.jsx("div",{className:"flex-1 min-w-[120px]",children:s.jsx("input",{type:"text",placeholder:e("installedTab.searchPlaceholder"),value:w,onChange:F=>C(F.target.value),className:"px-3 py-1.5 bg-surface-elevated border border-border-default rounded-lg text-sm w-full focus:border-brand-500 focus:outline-none"})})]}),s.jsx("div",{className:`flex-1 overflow-y-auto ${n?"p-4":"p-7"}`,children:y?s.jsx("div",{className:"text-center text-fg-tertiary py-20 animate-pulse",children:e("installedTab.loading")}):O.length===0?s.jsxs("div",{className:"text-center py-20",children:[s.jsx("div",{className:"text-4xl mb-4 opacity-30",children:"⧉"}),s.jsx("div",{className:"text-fg-secondary font-medium mb-1",children:e("installedTab.noItems")}),s.jsx("div",{className:"text-fg-tertiary text-sm",children:e("installedTab.noItemsHint")})]}):s.jsx(Ar,{columns:3,children:O.map(F=>{const V=Od(F.meta,"displayName",r)||F.meta.displayName||F.name,X=Od(F.meta,"description",r)||F.meta.description||"",z=F.meta.version||"",G=F.meta.author||"",se=F.meta.tags??[],ee=F.meta.category||"",q=F.meta.icon,re=q&&/\.(png|jpe?g|gif|webp|svg)$/i.test(q)&&!q.startsWith("http")&&!q.startsWith("data:")&&!q.startsWith("/")?`/api/builder/artifacts/${F.type}s/${encodeURIComponent(F.name)}/${q}`:q,B=F.type==="skill"?c[F.name]:void 0;return s.jsx(ia,{type:F.type,name:V,description:X,seed:F.name,icon:re,author:null,authorLabel:G||void 0,version:B?B.installedVersion:z,category:ee,tags:se,installed:!B,hideStats:!0,cornerLabel:B?e("installedTab.updateAvailable"):void 0,onClick:()=>{F.path&&j({type:F.type,name:F.name})},actions:B?s.jsx("button",{type:"button",disabled:m.has(F.name),onClick:()=>{I(F.name,B.availableVersion)},className:"px-3 py-1.5 text-xs font-medium bg-amber-600 hover:bg-amber-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:m.has(F.name)?e("installedTab.updating"):e("installedTab.updateTo",{version:B.availableVersion})}):void 0},`${F.type}/${F.name}`)})})}),h&&s.jsx("div",{className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-50 px-4 py-2 rounded-lg text-sm shadow-lg ${h.type==="success"?"bg-emerald-600 text-white":"bg-red-600 text-white"}`,children:h.text})]})}const nY=50,rY=30;function aY(e,t,n,r){const o=k.useRef(0),l=k.useRef(0),c=k.useCallback(m=>{o.current=m.touches[0].clientX,l.current=m.touches[0].clientY},[]),d=k.useCallback(m=>{const f=m.changedTouches[0].clientX-o.current,h=m.changedTouches[0].clientY-l.current,g=Math.abs(f),y=Math.abs(h);if(g<nY||Math.atan2(y,g)*(180/Math.PI)>rY)return;if(r?.scrollContainerRef?.current){const C=r.scrollContainerRef.current,T=C.scrollLeft<=1,S=C.scrollLeft+C.clientWidth>=C.scrollWidth-1;if(f>0&&!T||f<0&&!S)return}const w=e.findIndex(C=>C.id===t);f<0&&w<e.length-1?n(e[w+1].id):f>0&&w>0?n(e[w-1].id):f>0&&w===0&&r?.onSwipeOutLeft?r.onSwipeOutLeft():f<0&&w===e.length-1&&r?.onSwipeOutRight&&r.onSwipeOutRight()},[e,t,n,r]);return{onTouchStart:c,onTouchEnd:d}}const sY=["builder","discover","agents","teams","skills","installed"],iY={agent:"agents",team:"teams",skill:"skills",connector:"skills"};function sg(e){return!!e&&sY.includes(e)}function G4(){const e=localStorage.getItem("markus_nav_installItem"),t=localStorage.getItem("markus_nav_storeTab");return{tab:sg(t)?t:"builder",installId:e}}function oY({authUser:e}){const{t}=ft(["nav","store","common"]),n=k.useMemo(()=>[{id:"builder",label:t("nav:tabs.create")},{id:"discover",label:t("nav:tabs.discover")},{id:"agents",label:t("nav:tabs.agents")},{id:"teams",label:t("nav:tabs.teams")},{id:"skills",label:t("nav:tabs.skills")},{id:"installed",label:t("nav:tabs.installed")}],[t]),[r]=k.useState(G4),[o,l]=k.useState(r.tab),[c,d]=k.useState(r.installId),m=aY(n,o,l);k.useEffect(()=>{const h=G4();h.installId&&(d(h.installId),sg(h.tab)&&l(h.tab),localStorage.removeItem("markus_nav_installItem"),localStorage.removeItem("markus_nav_storeTab"))},[]),k.useEffect(()=>{const h=g=>{const y=g.detail,x=y.params?.storeTab??localStorage.getItem("markus_nav_storeTab");sg(x)&&l(x);const w=y.params?.installItem??localStorage.getItem("markus_nav_installItem");w&&d(w),localStorage.removeItem("markus_nav_storeTab"),localStorage.removeItem("markus_nav_installItem")};return window.addEventListener("markus:navigate",h),()=>window.removeEventListener("markus:navigate",h)},[]);const f=(h,g)=>{g&&d(g),l(iY[h]??"agents")};return s.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",onTouchStart:m.onTouchStart,onTouchEnd:m.onTouchEnd,children:[s.jsxs("div",{className:"flex items-center shrink-0 overflow-x-auto scrollbar-hide",children:[s.jsx(Mw,{className:"ml-2"}),n.map(h=>s.jsx("button",{onClick:()=>l(h.id),className:`flex-1 min-w-fit px-3 py-2.5 text-xs font-medium text-center whitespace-nowrap transition-colors border-b-2 ${o===h.id?"border-brand-500 text-brand-500":"border-transparent text-fg-tertiary"}`,children:h.label},h.id))]}),s.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[o==="builder"&&s.jsx(c6,{authUser:e}),o==="discover"&&s.jsx(JW,{onOpenType:f}),o==="agents"&&s.jsx(FW,{authUser:e,highlightItemId:c,onHighlightDone:()=>d(null)}),o==="teams"&&s.jsx(VW,{highlightItemId:c,onHighlightDone:()=>d(null)}),o==="skills"&&s.jsx(XW,{highlightItemId:c,onHighlightDone:()=>d(null)}),o==="installed"&&s.jsx(tY,{})]})]})}const V4="usageType",uh="profile";function lY({onComplete:e,theme:t,onThemeChange:n,skipProfile:r,onProfileUpdated:o}){const{t:l}=ft(["onboarding","common"]),[c,d]=k.useState(0),[m,f]=k.useState(""),[h,g]=k.useState(""),[y,x]=k.useState(""),[w,C]=k.useState(""),[T,S]=k.useState(!1),[E,j]=k.useState(""),[L,I]=k.useState(!1),[O,F]=k.useState(null);k.useEffect(()=>{Ee.auth.me().then(({user:Ue})=>{Ue.name&&f(Ue.name),Ue.email&&g(Ue.email),Ue.avatarUrl&&F(Ue.avatarUrl);const dt=Ue.name||Ue.email?.split("@")[0]||"";dt&&G(Nt=>Nt||l("usageType.defaultOrgName",{name:dt}))}).catch(()=>{}),Ee.settings.getOrg().then(({org:Ue})=>{Ue?.name&&Ue.name!=="My Organization"&&G(Ue.name)}).catch(()=>{}),bn()&&Ee.hubOrgs.invitations().then(Ue=>{Ue.invitations?.length>0&&Se(Ue.invitations)}).catch(()=>{})},[]);const[V,X]=k.useState(null),[z,G]=k.useState(""),[se,ee]=k.useState(!1),[q,re]=k.useState(!1),[B,J]=k.useState(""),[fe,Se]=k.useState([]),[U,W]=k.useState(null),[pe,P]=k.useState(null),_e=async()=>{const Ue=z.trim();if(Ue){ee(!0),J("");try{if(await Ee.settings.updateOrg(Ue),bn()){const dt=await Ee.hubOrgs.mine(),Nt=dt.orgs?.find(bt=>bt.role==="owner")??dt.orgs?.[0];Nt?.id?await Ee.hubOrgs.update(Nt.id,{name:Ue}):await Ee.hubOrgs.create(Ue)}re(!0)}catch{J(l("usageType.orgNameSaveFailed"))}finally{ee(!1)}}},[He,Pe]=k.useState(!0),Ge=async()=>{if(j(""),!m.trim()){j(l("profile.errors.nameRequired"));return}if(!h.trim()){j(l("profile.errors.emailRequired"));return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(h.trim())){j(l("profile.errors.emailInvalid"));return}if(y&&y.length<6){j(l("profile.errors.passwordTooShort"));return}if(y&&y!==w){j(l("profile.errors.passwordMismatch"));return}S(!0);try{const{user:Ue}=await Ee.auth.updateProfile(m.trim(),h.trim());y&&await Ee.auth.changePassword("",y),o?.(Ue),I(!0)}catch{j(l("profile.errors.saveFailed"))}finally{S(!1)}},ct=[{value:"system",label:l("theme.system"),icon:"💻",desc:l("theme.systemDesc")},{value:"light",label:l("theme.light"),icon:"☀️",desc:l("theme.lightDesc")},{value:"dark",label:l("theme.dark"),icon:"🌊",desc:l("theme.darkDesc")},{value:"cyberpunk",label:l("theme.cyberpunk"),icon:"🔮",desc:l("theme.cyberpunkDesc")},{value:"mono",label:l("theme.mono"),icon:"⬛",desc:l("theme.monoDesc")}],mt=[{id:"welcome",title:l("welcome.title"),subtitle:l("welcome.subtitle"),content:s.jsx("p",{className:"text-fg-secondary text-sm leading-relaxed",children:s.jsx(g8,{i18nKey:"welcome.description",ns:"onboarding",components:{strong:s.jsx("strong",{className:"text-fg-primary"})}})})},{id:V4,title:l("usageType.title",{defaultValue:"How will you use Markus?"}),subtitle:l("usageType.subtitle",{defaultValue:"This helps us tailor your experience."}),content:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("button",{onClick:()=>{X("personal"),re(!0)},className:`flex flex-col items-center gap-3 rounded-xl border-2 p-5 transition-all text-left ${V==="personal"?"border-brand-500 bg-brand-500/10":"border-border-default hover:border-fg-tertiary bg-surface-elevated/30"}`,children:[s.jsx("span",{className:"text-2xl",children:"👤"}),s.jsxs("div",{children:[s.jsx("div",{className:"font-medium text-fg-primary text-sm text-center",children:l("usageType.personal",{defaultValue:"Personal"})}),s.jsx("div",{className:"text-[11px] text-fg-tertiary mt-1 text-center",children:l("usageType.personalDesc",{defaultValue:"Individual use with your own AI agents."})})]})]}),s.jsxs("button",{onClick:()=>{X("organization"),re(!1)},className:`flex flex-col items-center gap-3 rounded-xl border-2 p-5 transition-all text-left ${V==="organization"?"border-brand-500 bg-brand-500/10":"border-border-default hover:border-fg-tertiary bg-surface-elevated/30"}`,children:[s.jsx("span",{className:"text-2xl",children:"🏢"}),s.jsxs("div",{children:[s.jsx("div",{className:"font-medium text-fg-primary text-sm text-center",children:l("usageType.organization",{defaultValue:"Team & Enterprise"})}),s.jsx("div",{className:"text-[11px] text-fg-tertiary mt-1 text-center",children:l("usageType.organizationDesc",{defaultValue:"For teams sharing licenses and collaborating."})})]})]})]}),V==="organization"&&s.jsxs("div",{className:"space-y-4 mt-4",children:[fe.length>0&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"text-xs text-fg-tertiary font-medium",children:l("usageType.pendingInvitations")}),fe.map(Ue=>s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 rounded-xl border border-amber-500/20 bg-amber-500/5",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium text-fg-primary",children:Ue.orgName}),s.jsx("div",{className:"text-[11px] text-fg-tertiary",children:l("usageType.invitedBy",{name:Ue.invitedBy})})]}),s.jsx("button",{onClick:async()=>{W(Ue.orgId);try{await Ee.hubOrgs.acceptInvitation(Ue.orgId),P(Ue.orgId),re(!0)}catch{}finally{W(null)}},disabled:U===Ue.orgId||pe===Ue.orgId,className:"px-3 py-1.5 text-xs rounded-lg bg-brand-600 hover:bg-brand-500 disabled:opacity-40 text-white transition-colors",children:pe===Ue.orgId?l("usageType.accepted"):U===Ue.orgId?l("usageType.accepting"):l("usageType.acceptAndJoin")})]},Ue.orgId)),s.jsx("div",{className:"text-[11px] text-fg-tertiary text-center pt-1",children:l("usageType.orCreateNew")})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-fg-tertiary font-medium",children:l("usageType.orgNameLabel")}),s.jsx("input",{type:"text",value:z,onChange:Ue=>{G(Ue.target.value),re(!1),J("")},placeholder:l("usageType.orgNamePlaceholder"),className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors"})]}),B&&s.jsx("p",{className:"text-xs text-red-500",children:B}),s.jsx("button",{onClick:()=>{_e()},disabled:se||!z.trim()||q,className:"w-full px-4 py-2.5 bg-brand-600 hover:bg-brand-500 disabled:opacity-40 text-white text-sm rounded-xl transition-colors",children:l(se?"common:saving":q?"usageType.orgNameSaved":"usageType.setOrgName")})]})]})},{id:uh,title:l("profile.title"),subtitle:l("profile.subtitle"),content:L?s.jsxs("div",{className:"flex items-center gap-3 bg-green-500/10 border border-green-500/30 rounded-xl p-4",children:[s.jsx("span",{className:"text-green-600 text-lg",children:"✓"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium text-green-600",children:l("profile.saved")}),s.jsxs("div",{className:"text-xs text-fg-secondary mt-0.5",children:[m," · ",h]})]})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex justify-center",children:s.jsx(jw,{currentUrl:O,name:m,size:64,targetType:"user"})}),s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs text-fg-tertiary font-medium",children:[l("profile.nameLabel")," ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"text",value:m,onChange:Ue=>f(Ue.target.value),placeholder:l("profile.namePlaceholder"),className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors",autoFocus:!0})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs text-fg-tertiary font-medium",children:[l("profile.emailLabel")," ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"email",value:h,onChange:Ue=>g(Ue.target.value),placeholder:l("profile.emailPlaceholder"),className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-fg-tertiary font-medium",children:l("profile.newPasswordLabel")}),s.jsx("input",{type:"password",value:y,onChange:Ue=>x(Ue.target.value),placeholder:l("profile.newPasswordPlaceholder"),className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors"})]}),y&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-fg-tertiary font-medium",children:l("profile.confirmPasswordLabel")}),s.jsx("input",{type:"password",value:w,onChange:Ue=>C(Ue.target.value),placeholder:l("profile.confirmPasswordPlaceholder"),className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors"})]}),E&&s.jsx("div",{className:"px-3 py-2 bg-red-500/10 border border-red-500/30 rounded-lg text-xs text-red-500",children:E}),s.jsx("button",{onClick:()=>{Ge()},disabled:T||!m.trim()||!h.trim(),className:"w-full px-4 py-2.5 bg-brand-600 hover:bg-brand-500 disabled:opacity-40 text-white text-sm rounded-xl transition-colors",children:l(T?"common:saving":"profile.saveProfile")})]})},{id:"theme",title:l("theme.title"),subtitle:l("theme.subtitle"),content:s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"grid grid-cols-3 gap-3",children:ct.map(Ue=>s.jsxs("button",{onClick:()=>n(Ue.value),className:`flex flex-col items-center gap-2 rounded-xl border-2 p-5 transition-all ${t===Ue.value?"border-brand-500 bg-brand-500/10":"border-border-default hover:border-fg-tertiary bg-surface-elevated/30"}`,children:[s.jsx("span",{className:"text-2xl",children:Ue.icon}),s.jsx("span",{className:"text-sm font-medium text-fg-primary",children:Ue.label}),s.jsx("span",{className:"text-[11px] text-fg-tertiary leading-tight text-center",children:Ue.desc})]},Ue.value))}),s.jsxs("label",{className:"flex items-center gap-2.5 p-3 bg-surface-elevated/30 rounded-lg cursor-pointer group",children:[s.jsx("input",{type:"checkbox",checked:He,onChange:Ue=>Pe(Ue.target.checked),className:"accent-brand-500 shrink-0"}),s.jsx("span",{className:"text-[11px] text-fg-tertiary",children:l("done.telemetry")})]})]})}],Ct=r?mt.filter(Ue=>Ue.id!==uh):mt,Mt=Ct.findIndex(Ue=>Ue.id===V4),Pt=Ct.findIndex(Ue=>Ue.id===uh),Kt=()=>{c===Mt&&Mt>=0&&!V||c===Mt&&V==="organization"&&!q||c===Pt&&Pt>=0&&!L||(c<Ct.length-1?d(c+1):(fetch("/api/settings/telemetry",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:He})}).catch(()=>{}),e()))},yt=Ct[c];return s.jsx("div",{className:"min-h-dvh bg-surface-primary flex items-center justify-center p-4",children:s.jsx("div",{className:"w-full max-w-lg",children:s.jsxs("div",{className:"bg-surface-elevated rounded-2xl p-8",children:[s.jsx("div",{className:"flex gap-1.5 mb-8",children:Ct.map((Ue,dt)=>s.jsx("div",{className:`h-1 flex-1 rounded-full transition-colors ${dt<=c?"bg-brand-500":"bg-surface-elevated"}`},dt))}),s.jsx("h2",{className:"text-2xl font-bold text-fg-primary",children:yt.title}),s.jsx("p",{className:"text-sm text-fg-secondary mt-1 mb-6",children:yt.subtitle}),yt.content,s.jsxs("div",{className:"flex justify-between mt-8",children:[c>0?s.jsx("button",{onClick:()=>d(c-1),className:"px-4 py-2 text-sm text-fg-secondary hover:text-fg-primary transition-colors",children:l("common:back")}):s.jsx("span",{}),s.jsx("button",{onClick:Kt,disabled:Pt>=0&&c===Pt&&!L||Mt>=0&&c===Mt&&(!V||V==="organization"&&!q),className:`px-6 py-2.5 text-white text-sm rounded-xl transition-colors ${Pt>=0&&c===Pt&&!L||Mt>=0&&c===Mt&&(!V||V==="organization"&&!q)?"bg-brand-600/40 cursor-not-allowed":"bg-brand-600 hover:bg-brand-500"}`,children:c===Ct.length-1?l("getStarted"):l("common:next")})]})]})})})}const K4="markus:legal-consent",cY="https://markus.global";function uY({onLogin:e,hasOwner:t}){const{t:n,i18n:r}=ft("auth"),[o,l]=k.useState(null),[c,d]=k.useState(""),[m,f]=k.useState(!1),[h,g]=k.useState(""),[y,x]=k.useState(""),[w,C]=k.useState(!1),[T,S]=k.useState(!1),E=G=>{const se=(r.language||"").toLowerCase().startsWith("zh")?"?lang=zh":"";return`${cY}${G}${se}`},j=()=>{try{localStorage.setItem(K4,JSON.stringify({acceptedAt:new Date().toISOString(),terms:!0,privacy:!0}))}catch{}},L=()=>T?(j(),!0):(C(!1),requestAnimationFrame(()=>C(!0)),!1),I=async()=>{const G=bn(),se=sa();if(!G||!se){d(n("login.hubUnavailable"));return}const ee=await Ee.auth.hubLogin(G,se);if(window.markusDesktop?.clearPendingDeepLinkAuth?.(),ee.cloudAiReady===!1)try{sessionStorage.setItem("markus:cloud-ai-warning",ee.cloudAiError?n("login.cloudAiNotReady",{error:ee.cloudAiError}):n("login.cloudAiNotReadyGeneric"))}catch{}e(ee.user,ee.needsOnboarding??!1,{fromHub:!0})},O=async(G,se=!1)=>{if(!(!se&&!L())){d(""),l(G??"hub");try{if(se&&bn()&&sa()){await I();return}await Hr(G),await I()}catch(ee){const q=ee instanceof Error?ee.message:"";if(!q.includes("cancelled")){if(!se&&bn())return O(G,!0);d(q||n("login.hubUnavailable"))}}finally{l(null)}}},F=()=>{iD(),l(null),d("")};k.useEffect(()=>{const G=window.markusDesktop;if(!G?.peekPendingDeepLinkAuth&&!G?.consumePendingDeepLinkAuth)return;let se=!1;return(async()=>{const ee=G.peekPendingDeepLinkAuth?await G.peekPendingDeepLinkAuth():null;if(se||!ee)return;let q=!1;try{q=!!localStorage.getItem(K4)}catch{}if(!T&&!q){d(n("login.consentRequired"));return}q&&!T&&S(!0),j();const re=G.consumePendingDeepLinkAuth?await G.consumePendingDeepLinkAuth():ee;if(!(se||!re)){d(""),l("hub");try{if(!await sD(re)||!bn()||!sa()){d(n("login.hubUnavailable"));return}await I()}catch{d(n("login.hubUnavailable"))}finally{se||l(null)}}})().catch(()=>{}),()=>{se=!0}},[T]);const V=async G=>{if(G.preventDefault(),!(!h.trim()||!y)&&L()){d(""),l("local");try{const{user:se,needsOnboarding:ee}=await Ee.auth.login(h.trim(),y);e(se,ee??!1)}catch{d(n("login.invalidCredentials"))}finally{l(null)}}},X=n(t?"login.welcomeBack":"login.getStarted"),z="w-full flex items-center justify-center gap-3 h-11 px-4 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary font-medium transition-all hover:border-brand-400/60 hover:shadow-sm active:scale-[0.99] disabled:opacity-50 disabled:pointer-events-none";return s.jsxs("div",{className:"min-h-dvh bg-surface-primary flex flex-col items-center justify-center p-4 relative overflow-hidden",children:[s.jsxs("div",{className:"pointer-events-none absolute inset-0 overflow-hidden",children:[s.jsx("div",{className:"absolute -top-48 left-1/2 -translate-x-1/2 h-[42rem] w-[42rem] rounded-full bg-brand-500/20 blur-[120px]"}),s.jsx("div",{className:"absolute top-1/4 -left-40 h-[26rem] w-[26rem] rounded-full bg-brand-400/10 blur-[100px]"}),s.jsx("div",{className:"absolute -bottom-40 -right-32 h-[34rem] w-[34rem] rounded-full bg-brand-600/10 blur-[110px]"})]}),s.jsxs("div",{className:"w-full max-w-[26rem] relative z-10 flex-1 flex flex-col justify-center",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx("img",{src:"/logo.png",alt:"Markus",className:"w-16 h-16 mx-auto mb-4 rounded-2xl shadow-xl shadow-brand-900/20 ring-1 ring-border-default/40"}),s.jsx("div",{className:"text-[1.75rem] leading-none font-extrabold tracking-tight text-fg-primary mb-2",children:"Markus"}),s.jsx("div",{className:"text-sm text-fg-tertiary",children:X})]}),s.jsx("div",{className:"bg-surface-secondary/70 backdrop-blur-xl border border-border-default/80 rounded-3xl p-7 sm:p-8 shadow-2xl shadow-black/10",children:m?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-base font-semibold text-fg-primary",children:n("login.localTitle")}),s.jsx("div",{className:"text-xs text-fg-tertiary mt-0.5",children:n("login.localAccountHint")})]}),s.jsxs("form",{onSubmit:V,className:"space-y-3",children:[s.jsx("input",{type:"email",value:h,onChange:G=>g(G.target.value),autoComplete:"email",autoFocus:!0,placeholder:n("login.email"),className:"w-full px-4 h-11 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 focus:ring-2 focus:ring-brand-500/20 outline-none transition-all placeholder:text-fg-tertiary",required:!0}),s.jsx("input",{type:"password",value:y,onChange:G=>x(G.target.value),autoComplete:"current-password",placeholder:n("login.password"),className:"w-full px-4 h-11 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 focus:ring-2 focus:ring-brand-500/20 outline-none transition-all placeholder:text-fg-tertiary",required:!0}),c&&s.jsx("div",{className:"px-3 py-2 bg-red-500/10 border border-red-500/30 rounded-lg text-xs text-red-500",children:c}),!t&&s.jsx("p",{className:"text-[11px] text-fg-tertiary",children:n("login.defaultCredentials")}),s.jsx("button",{type:"submit",disabled:o==="local"||!h||!y,className:"w-full h-11 bg-brand-600 hover:bg-brand-500 disabled:opacity-50 text-white text-sm font-semibold rounded-xl transition-all shadow-md shadow-brand-900/30 hover:shadow-lg active:scale-[0.99]",children:n(o==="local"?"login.signingIn":"login.signIn")})]}),s.jsx("div",{className:"text-center",children:s.jsx("button",{onClick:()=>{f(!1),d("")},className:"text-xs text-fg-tertiary hover:text-fg-secondary transition-colors",children:n("login.backToHub")})})]}):s.jsxs("div",{className:"space-y-3",children:[s.jsxs("button",{onClick:()=>O("google"),disabled:!!o,className:z,children:[s.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",children:[s.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 01-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z"}),s.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),s.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),s.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),n(o==="google"?"login.connectingHub":"login.withGoogle")]}),s.jsxs("button",{onClick:()=>O("github"),disabled:!!o,className:z,children:[s.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),n(o==="github"?"login.connectingHub":"login.withGithub")]}),s.jsxs("button",{onClick:()=>O("email"),disabled:!!o,className:z,children:[s.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75"})}),n(o==="email"?"login.connectingHub":"login.withEmail")]}),o&&(o==="google"||o==="github"||o==="email"||o==="hub")&&s.jsxs("div",{className:"px-3 py-2.5 bg-brand-500/10 border border-brand-500/30 rounded-lg text-xs text-fg-secondary space-y-2",children:[s.jsx("p",{children:n("login.browserOpened")}),s.jsx("button",{type:"button",onClick:F,className:"text-brand-500 hover:text-brand-400 underline font-medium",children:n("login.cancelWaiting")})]}),c&&s.jsx("div",{className:"px-3 py-2 bg-red-500/10 border border-red-500/30 rounded-lg text-xs text-red-500",children:c}),s.jsxs("div",{className:"flex items-center gap-3 py-1 text-[11px] text-fg-tertiary",children:[s.jsx("span",{className:"h-px flex-1 bg-border-default"}),n("login.or"),s.jsx("span",{className:"h-px flex-1 bg-border-default"})]}),s.jsx("button",{onClick:()=>{f(!0),d("")},disabled:!!o,className:"w-full h-11 px-4 rounded-xl text-sm text-fg-secondary font-medium transition-all hover:bg-surface-elevated/70 disabled:opacity-50",children:n("login.useLocalAccount")})]})}),s.jsxs("label",{onAnimationEnd:()=>C(!1),className:`mt-5 flex items-start justify-center gap-2 text-[11px] leading-relaxed cursor-pointer select-none px-2 transition-colors ${w?"animate-shake text-fg-primary font-medium":"text-fg-tertiary"}`,children:[s.jsx("input",{type:"checkbox",checked:T,onChange:G=>{S(G.target.checked),G.target.checked&&C(!1)},className:"mt-0.5 h-3.5 w-3.5 shrink-0 accent-brand-600 cursor-pointer"}),s.jsxs("span",{className:"text-center",children:[n("login.consentPrefix")," ",s.jsx("a",{href:E("/terms"),target:"_blank",rel:"noopener noreferrer",className:"text-brand-500 hover:text-brand-400 underline",children:n("login.termsLink")})," ",n("login.consentAnd")," ",s.jsx("a",{href:E("/privacy"),target:"_blank",rel:"noopener noreferrer",className:"text-brand-500 hover:text-brand-400 underline",children:n("login.privacyLink")})]})]})]}),s.jsxs("div",{className:"relative z-10 flex flex-wrap items-center justify-center gap-x-5 gap-y-1 py-6 text-[11px] text-fg-tertiary",children:[s.jsx("a",{href:"https://markus.global",target:"_blank",rel:"noopener noreferrer",className:"hover:text-fg-secondary transition-colors",children:"markus.global"}),s.jsx("a",{href:"mailto:business@markus.global",className:"hover:text-fg-secondary transition-colors",children:n("login.contactSales")})]})]})}function dY({token:e,onComplete:t}){const{t:n}=ft("auth"),[r,o]=k.useState(null),[l,c]=k.useState(""),[d,m]=k.useState(""),[f,h]=k.useState(""),[g,y]=k.useState(!1),[x,w]=k.useState(!1),[C,T]=k.useState(!1);k.useEffect(()=>{Ee.auth.inviteInfo(e).then(E=>o(E)).catch(()=>T(!0))},[e]);const S=async E=>{if(E.preventDefault(),h(""),l.length<6){h(n("invite.passwordMinLength"));return}if(l!==d){h(n("invite.passwordsDoNotMatch"));return}y(!0);try{await Ee.auth.setup(e,l),w(!0),setTimeout(()=>{window.location.hash="",t()},2e3)}catch{h(n("invite.error"))}finally{y(!1)}};return s.jsxs("div",{className:"min-h-dvh bg-surface-primary flex items-center justify-center p-4 relative overflow-hidden",children:[s.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_top,_var(--tw-gradient-stops))] from-brand-950/50 via-transparent to-transparent"}),s.jsxs("div",{className:"w-full max-w-sm relative z-10",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx("img",{src:"/logo.png",alt:"Markus",className:"w-14 h-14 mx-auto mb-3 rounded-xl shadow-lg shadow-black/40"}),s.jsx("div",{className:"text-2xl font-extrabold tracking-tight text-fg-primary mb-1",children:"Markus"}),s.jsx("div",{className:"text-sm text-fg-tertiary",children:n("invite.subtitle")})]}),s.jsx("div",{className:"bg-surface-secondary/80 backdrop-blur-sm border border-border-default rounded-2xl p-8 space-y-5 shadow-2xl shadow-black/30",children:C?s.jsxs("div",{className:"text-center space-y-3",children:[s.jsx("div",{className:"text-red-500 text-3xl",children:"⚠"}),s.jsx("p",{className:"text-sm text-fg-secondary",children:n("invite.invalidLink")}),s.jsx("button",{onClick:()=>{window.location.hash="",t()},className:"text-sm text-brand-500 hover:text-brand-400",children:n("login.signIn")})]}):x?s.jsxs("div",{className:"text-center space-y-3",children:[s.jsx("div",{className:"text-green-500 text-3xl",children:"✓"}),s.jsx("p",{className:"text-sm text-fg-secondary",children:n("invite.setupComplete")})]}):r?s.jsxs("form",{onSubmit:S,className:"space-y-5",children:[s.jsx("h2",{className:"text-lg font-semibold text-fg-primary text-center",children:n("invite.greeting",{name:r.name})}),s.jsx("p",{className:"text-xs text-fg-tertiary text-center",children:r.email}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-fg-tertiary font-medium",children:n("invite.setPassword")}),s.jsx("input",{type:"password",value:l,onChange:E=>c(E.target.value),autoComplete:"new-password",autoFocus:!0,className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors",required:!0})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-fg-tertiary font-medium",children:n("invite.confirmPassword")}),s.jsx("input",{type:"password",value:d,onChange:E=>m(E.target.value),autoComplete:"new-password",className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors",required:!0})]}),f&&s.jsx("div",{className:"px-3 py-2 bg-red-500/10 border border-red-500/30 rounded-lg text-xs text-red-500",children:f}),s.jsx("button",{type:"submit",disabled:g||!l||!d,className:"w-full py-2.5 bg-brand-600 hover:bg-brand-500 disabled:opacity-50 text-white text-sm font-medium rounded-xl transition-all shadow-md shadow-brand-900/40 hover:shadow-lg hover:shadow-brand-900/50",children:n(g?"invite.settingUp":"invite.setupAccount")})]}):s.jsx("div",{className:"text-center text-fg-tertiary text-sm animate-pulse py-4",children:"Loading…"})})]})]})}function mY({onComplete:e,isFirstTime:t}){const{t:n}=ft("auth"),[r,o]=k.useState(""),[l,c]=k.useState(""),[d,m]=k.useState(""),[f,h]=k.useState(""),[g,y]=k.useState(!1),x=async w=>{if(w.preventDefault(),h(""),l.length<6){h(n("changePassword.passwordMinLength"));return}if(l!==d){h(n("changePassword.passwordsDoNotMatch"));return}y(!0);try{await Ee.auth.changePassword(r,l),e()}catch{h(n("changePassword.failedToChange"))}finally{y(!1)}};return s.jsxs("div",{className:"min-h-dvh bg-surface-primary flex items-center justify-center p-4 relative overflow-hidden",children:[s.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_top,_var(--tw-gradient-stops))] from-brand-950/50 via-transparent to-transparent"}),s.jsxs("div",{className:"w-full max-w-sm relative z-10",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx("img",{src:"/logo.png",alt:"Markus",className:"w-14 h-14 mx-auto mb-3 rounded-xl shadow-lg shadow-black/40"}),s.jsx("div",{className:"text-2xl font-extrabold tracking-tight text-fg-primary mb-1",children:"Markus"}),s.jsx("div",{className:"text-sm text-fg-tertiary",children:n("login.subtitle")})]}),s.jsxs("form",{onSubmit:x,className:"bg-surface-secondary/80 backdrop-blur-sm border border-border-default rounded-2xl p-8 space-y-5 shadow-2xl shadow-black/30",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold text-fg-primary text-center",children:n(t?"changePassword.setYourPassword":"changePassword.changePassword")}),t&&s.jsx("p",{className:"text-xs text-amber-600/80 text-center mt-2",children:n("changePassword.defaultPasswordWarning")})]}),!t&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-fg-tertiary font-medium",children:n("changePassword.currentPassword")}),s.jsx("input",{type:"password",value:r,onChange:w=>o(w.target.value),autoComplete:"current-password",className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-fg-tertiary font-medium",children:n("changePassword.newPassword")}),s.jsx("input",{type:"password",value:l,onChange:w=>c(w.target.value),autoComplete:"new-password",className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors",required:!0,minLength:6})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-fg-tertiary font-medium",children:n("changePassword.confirmNewPassword")}),s.jsx("input",{type:"password",value:d,onChange:w=>m(w.target.value),autoComplete:"new-password",className:"w-full px-4 py-2.5 bg-surface-elevated border border-border-default rounded-xl text-sm text-fg-primary focus:border-brand-500 outline-none transition-colors",required:!0})]}),f&&s.jsx("div",{className:"px-3 py-2 bg-red-500/10 border border-red-500/30 rounded-lg text-xs text-red-500",children:f}),s.jsx("button",{type:"submit",disabled:g||!l||!d,className:"w-full py-2.5 bg-brand-600 hover:bg-brand-500 disabled:opacity-50 text-white text-sm font-medium rounded-xl transition-colors",children:n(g?"changePassword.saving":t?"changePassword.setPasswordAndContinue":"changePassword.changePassword")})]})]})]})}function fY({side:e,defaultWidth:t,minWidth:n,maxWidth:r,collapsedWidth:o=0,storageKey:l}){const[c,d]=k.useState(()=>{try{const C=localStorage.getItem(`${l}_w`);if(C)return Math.max(n,Math.min(r,parseInt(C,10)))}catch{}return t}),[m,f]=k.useState(()=>{try{return localStorage.getItem(`${l}_c`)==="1"}catch{return!1}}),h=k.useRef(!1),g=k.useRef(n),y=k.useRef(r);g.current=n,y.current=r,k.useEffect(()=>{try{localStorage.setItem(`${l}_w`,String(c))}catch{}},[c,l]),k.useEffect(()=>{try{localStorage.setItem(`${l}_c`,m?"1":"0")}catch{}},[m,l]),k.useEffect(()=>{d(C=>Math.max(n,Math.min(r,C)))},[n,r]);const x=k.useCallback(C=>{C.preventDefault(),h.current=!0;const T=C.clientX,S=c,E=L=>{if(!h.current)return;const I=L.clientX-T;d(Math.max(g.current,Math.min(y.current,S+I)))},j=()=>{h.current=!1,document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",j),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",E),document.addEventListener("mouseup",j),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[c,e]),w=k.useCallback(()=>f(C=>!C),[]);return{width:m?o:c,rawWidth:c,collapsed:m,toggle:w,setCollapsed:f,setWidth:d,onResizeStart:x}}const fX=[{value:"system",label:"System"},{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"cyberpunk",label:"Cyberpunk"},{value:"mono",label:"Mono"}],ig="markus-theme";function W4(e){const t=document.documentElement;t.classList.remove("light","dark","cyberpunk","mono"),e==="light"?t.classList.add("light"):e==="dark"?t.classList.add("dark"):e==="cyberpunk"?t.classList.add("cyberpunk"):e==="mono"&&t.classList.add("mono")}function pY(){try{const e=localStorage.getItem(ig);if(e==="midnight")return localStorage.setItem(ig,"dark"),"dark";if(e==="light"||e==="dark"||e==="system"||e==="cyberpunk"||e==="mono")return e}catch{}return"system"}function hY(){const[e,t]=k.useState(pY),n=k.useCallback(r=>{t(r);try{localStorage.setItem(ig,r)}catch{}W4(r)},[]);return k.useEffect(()=>{W4(e)},[e]),{mode:e,setMode:n}}const Wd={agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]},gY={team:["agents","workflows","tasks","requirements","projects","deliverables"],work:["workflows","projects","requirements","tasks","agents","deliverables"],deliverables:["deliverables","agents","tasks","requirements","projects","workflows"]},bY=["agents","tasks","requirements","projects","deliverables","workflows"];let Y4="",X4="all",Q4=Wd,Z4=!1;function xY({onClose:e,currentPage:t}){const{t:n}=ft(["common","home","work"]);Ho(!0);const[r,o]=k.useState(Y4),[l,c]=k.useState(X4),[d,m]=k.useState(Q4),[f,h]=k.useState(!1),[g,y]=k.useState(Z4),[x,w]=k.useState(-1);k.useEffect(()=>{Y4=r},[r]),k.useEffect(()=>{X4=l},[l]),k.useEffect(()=>{Q4=d},[d]),k.useEffect(()=>{Z4=g},[g]);const C=k.useRef(null),T=k.useRef(void 0),S=k.useRef(null),E=k.useRef(null);k.useEffect(()=>{setTimeout(()=>{C.current?.focus(),C.current?.select()},100)},[]);const j=k.useCallback(async ee=>{if(!ee.trim()){m(Wd),y(!1),w(-1);return}h(!0),y(!0),w(-1);const q=ee.toLowerCase();try{const[re,B,J,fe,Se,U]=await Promise.allSettled([Ee.agents.list(),Ee.tasks.list({search:ee,pageSize:20}),Ee.requirements.list(),Ee.projects.list(),Ee.deliverables.search({q:ee,limit:20}),Ee.teams.list()]),W=re.status==="fulfilled"?re.value.agents.filter(Ge=>Ge.name?.toLowerCase().includes(q)||Ge.role?.toLowerCase().includes(q)):[],pe=B.status==="fulfilled"?B.value.tasks:[],P=J.status==="fulfilled"?J.value.requirements.filter(Ge=>Ge.title?.toLowerCase().includes(q)||Ge.description?.toLowerCase().includes(q)):[],_e=fe.status==="fulfilled"?fe.value.projects.filter(Ge=>Ge.name?.toLowerCase().includes(q)||Ge.description?.toLowerCase().includes(q)):[],He=Se.status==="fulfilled"?Se.value.results:[],Pe=[];if(U.status==="fulfilled"){const Ge=await Promise.allSettled(U.value.teams.map(ct=>Ee.workflows.list(ct.id)));for(const ct of Ge)if(ct.status==="fulfilled")for(const mt of ct.value.workflows)(mt.name.toLowerCase().includes(q)||(mt.displayName||"").toLowerCase().includes(q)||mt.description?.toLowerCase().includes(q))&&Pe.push(mt)}m({agents:W,tasks:pe,requirements:P,projects:_e,deliverables:He,workflows:Pe})}catch{m(Wd)}finally{h(!1)}},[]),L=ee=>{o(ee),T.current&&clearTimeout(T.current),T.current=setTimeout(()=>j(ee),400)},I=k.useCallback((ee,q)=>{e(),it.navigate(ee,q)},[e]),O=[{id:"all",label:n("common:all",{defaultValue:"全部"})},{id:"agents",label:n("common:agents",{defaultValue:"智能体"})},{id:"tasks",label:n("common:tasks",{defaultValue:"任务"})},{id:"requirements",label:n("common:requirements",{defaultValue:"需求"})},{id:"projects",label:n("common:projects",{defaultValue:"项目"})},{id:"deliverables",label:n("common:deliverables",{defaultValue:"交付物"})},{id:"workflows",label:n("common:workflows",{defaultValue:"工作流"})}],F=k.useMemo(()=>gY[t||""]||bY,[t]),V=k.useMemo(()=>{const ee=[],q=l==="all"?8:void 0,re=B=>{if(l!=="all"&&l!==B)return;const J=d[B].length;if(B==="workflows"){const fe=q?d.workflows.slice(0,q):d.workflows;for(const Se of fe)ee.push({id:Se.name,type:"workflow",page:de.WORK,params:{boardType:"workflows"}})}else{const fe=d[B],Se=q?fe.slice(0,q):fe;for(const U of Se)switch(B){case"agents":ee.push({id:U.id,type:"agent",page:de.TEAM,params:{agentId:U.id}});break;case"tasks":ee.push({id:U.id,type:"task",page:de.WORK,params:{openTask:U.id}});break;case"requirements":ee.push({id:U.id,type:"requirement",page:de.WORK,params:{openRequirement:U.id}});break;case"projects":ee.push({id:U.id,type:"project",page:de.WORK,params:{projectId:U.id}});break;case"deliverables":ee.push({id:U.id,type:"deliverable",page:de.DELIVERABLES,params:{openDeliverable:U.id}});break}}q&&J>q&&ee.push({id:`more_${B}`,type:"showMore",page:"",expandCategory:B,totalCount:J})};for(const B of F)re(B);return ee},[d,l,F]),X=k.useCallback(ee=>{if(ee.type==="showMore"&&ee.expandCategory){c(ee.expandCategory),w(-1);return}I(ee.page,ee.params)},[I]);k.useEffect(()=>{const ee=E.current;if(!ee||x<0)return;const q=ee.querySelector(`[data-idx="${x}"]`);q&&q.scrollIntoView({block:"nearest"})},[x]);const z=k.useCallback(ee=>{if(ee.key==="Escape"){e();return}if(ee.key==="Tab"){ee.preventDefault();const B=O.map(Se=>Se.id),J=B.indexOf(l),fe=ee.shiftKey?J<=0?B.length-1:J-1:J>=B.length-1?0:J+1;c(B[fe]),w(-1);return}const q=ee.ctrlKey&&ee.key==="n"||ee.key==="ArrowDown",re=ee.ctrlKey&&ee.key==="p"||ee.key==="ArrowUp";if(q||re){ee.preventDefault(),w(B=>{const J=V.length-1;return J<0?-1:q?B>=J?0:B+1:B<=0?J:B-1});return}ee.key==="Enter"&&(ee.preventDefault(),x>=0&&x<V.length&&X(V[x]))},[e,V,x,X,O,l]);k.useEffect(()=>(document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)),[z]);const G=V.length>0;let se=0;return s.jsx("div",{ref:S,className:"fixed inset-0 bg-black/50 flex items-start justify-center z-50 pt-[8vh]",onClick:ee=>{ee.target===S.current&&e()},children:s.jsxs("div",{className:"bg-surface-primary border border-border-default rounded-2xl shadow-2xl w-full max-w-3xl max-h-[78vh] flex flex-col overflow-hidden animate-fadeIn",children:[s.jsxs("div",{className:"shrink-0 px-5 pt-4 pb-3 border-b border-border-default space-y-3",children:[s.jsxs("div",{className:"relative",children:[s.jsxs("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg-tertiary",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"11",cy:"11",r:"8"}),s.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),s.jsx("input",{ref:C,value:r,onChange:ee=>L(ee.target.value),placeholder:n("common:search"),className:"w-full bg-surface-elevated border border-border-default rounded-xl pl-9 pr-9 py-2.5 text-sm text-fg-primary placeholder:text-fg-tertiary focus:border-brand-500 focus:outline-none transition-colors"}),r&&s.jsx("button",{onClick:()=>{o(""),m(Wd),y(!1),w(-1),C.current?.focus()},className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg-tertiary hover:text-fg-secondary",children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),s.jsx("div",{className:"flex gap-1 overflow-x-auto scrollbar-hide",children:O.map(ee=>s.jsx("button",{onClick:()=>{c(ee.id),w(-1)},className:`px-3 py-1.5 text-xs rounded-lg whitespace-nowrap transition-colors ${l===ee.id?"bg-brand-600 text-white":"bg-surface-elevated text-fg-secondary hover:text-fg-primary"}`,children:ee.label},ee.id))})]}),s.jsxs("div",{ref:E,className:"flex-1 overflow-y-auto px-5 py-3",children:[f&&s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx("div",{className:"text-fg-tertiary text-sm animate-pulse",children:n("common:loading")})}),!f&&g&&!G&&s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[s.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-fg-tertiary mb-2",children:[s.jsx("circle",{cx:"11",cy:"11",r:"8"}),s.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),s.jsx("p",{className:"text-sm text-fg-tertiary",children:n("common:noResults",{defaultValue:"没有找到相关结果"})})]}),!f&&G&&s.jsx("div",{className:"space-y-4",children:F.map(ee=>{if(l!=="all"&&l!==ee)return null;const q=l==="all"?8:void 0,re=B=>{const J=se++,fe=B==="agents"?d.agents.length:B==="tasks"?d.tasks.length:B==="requirements"?d.requirements.length:B==="projects"?d.projects.length:B==="workflows"?d.workflows.length:d.deliverables.length;return s.jsxs("button",{"data-idx":J,onClick:()=>{c(B),w(-1)},className:`mt-1 w-full text-xs py-1.5 rounded-lg transition-colors ${J===x?"bg-brand-600/15 ring-1 ring-brand-500/40 text-brand-500":"text-brand-500 hover:text-brand-400 hover:bg-surface-overlay"}`,children:[n("common:showAll",{defaultValue:"查看全部"})," (",fe,")"]})};return ee==="agents"&&d.agents.length>0?s.jsxs("section",{children:[s.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:n("common:agents",{defaultValue:"智能体"})}),s.jsx("div",{className:"space-y-0.5",children:(q?d.agents.slice(0,q):d.agents).map(B=>{const J=se++;return s.jsxs("button",{"data-idx":J,onClick:()=>I(de.TEAM,{agentId:B.id}),className:`w-full flex items-center gap-3 px-3 py-2 rounded-xl transition-colors text-left ${J===x?"bg-brand-600/15 ring-1 ring-brand-500/40":"hover:bg-surface-overlay"}`,children:[s.jsx(Hs,{name:B.name||"Agent",avatarUrl:B.avatarUrl,size:28}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-fg-primary truncate",children:B.name}),s.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:B.role||B.status})]}),s.jsx(yY,{status:B.status})]},B.id)})}),q&&d.agents.length>q&&re("agents")]},"agents"):ee==="tasks"&&d.tasks.length>0?s.jsxs("section",{children:[s.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:n("common:tasks",{defaultValue:"任务"})}),s.jsx("div",{className:"space-y-0.5",children:(q?d.tasks.slice(0,q):d.tasks).map(B=>{const J=se++;return s.jsxs("button",{"data-idx":J,onClick:()=>I(de.WORK,{openTask:B.id}),className:`w-full flex items-center gap-3 px-3 py-2 rounded-xl transition-colors text-left ${J===x?"bg-brand-600/15 ring-1 ring-brand-500/40":"hover:bg-surface-overlay"}`,children:[s.jsx(vY,{status:B.status}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-sm text-fg-primary truncate",children:B.title}),s.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[B.status," · ",B.priority||""]})]})]},B.id)})}),q&&d.tasks.length>q&&re("tasks")]},"tasks"):ee==="requirements"&&d.requirements.length>0?s.jsxs("section",{children:[s.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:n("common:requirements",{defaultValue:"需求"})}),s.jsx("div",{className:"space-y-0.5",children:(q?d.requirements.slice(0,q):d.requirements).map(B=>{const J=se++;return s.jsxs("button",{"data-idx":J,onClick:()=>I(de.WORK,{openRequirement:B.id}),className:`w-full flex items-center gap-3 px-3 py-2 rounded-xl transition-colors text-left ${J===x?"bg-brand-600/15 ring-1 ring-brand-500/40":"hover:bg-surface-overlay"}`,children:[s.jsx("div",{className:`w-7 h-7 rounded-lg flex items-center justify-center shrink-0 ${B.status==="approved"?"text-green-500 bg-green-500/15":B.status==="pending"?"text-amber-500 bg-amber-500/15":B.status==="rejected"?"text-red-500 bg-red-500/15":"text-fg-tertiary bg-surface-elevated"}`,children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),s.jsx("polyline",{points:"14 2 14 8 20 8"}),s.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),s.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-sm text-fg-primary truncate",children:B.title}),s.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[B.status," · ",B.priority||""]})]})]},B.id)})}),q&&d.requirements.length>q&&re("requirements")]},"requirements"):ee==="projects"&&d.projects.length>0?s.jsxs("section",{children:[s.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:n("common:projects",{defaultValue:"项目"})}),s.jsx("div",{className:"space-y-0.5",children:(q?d.projects.slice(0,q):d.projects).map(B=>{const J=se++;return s.jsxs("button",{"data-idx":J,onClick:()=>I(de.WORK,{projectId:B.id}),className:`w-full flex items-center gap-3 px-3 py-2 rounded-xl transition-colors text-left ${J===x?"bg-brand-600/15 ring-1 ring-brand-500/40":"hover:bg-surface-overlay"}`,children:[s.jsx("div",{className:"w-7 h-7 rounded-lg bg-brand-500/15 flex items-center justify-center shrink-0",children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-brand-500",children:s.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-sm text-fg-primary truncate",children:B.name}),B.description&&s.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:B.description})]})]},B.id)})}),q&&d.projects.length>q&&re("projects")]},"projects"):ee==="deliverables"&&d.deliverables.length>0?s.jsxs("section",{children:[s.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:n("common:deliverables",{defaultValue:"交付物"})}),s.jsx("div",{className:"space-y-0.5",children:(q?d.deliverables.slice(0,q):d.deliverables).map(B=>{const J=se++;return s.jsxs("button",{"data-idx":J,onClick:()=>I(de.DELIVERABLES,{openDeliverable:B.id}),className:`w-full flex items-center gap-3 px-3 py-2 rounded-xl transition-colors text-left ${J===x?"bg-brand-600/15 ring-1 ring-brand-500/40":"hover:bg-surface-overlay"}`,children:[s.jsx("div",{className:"w-7 h-7 rounded-lg bg-purple-500/15 flex items-center justify-center shrink-0",children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-purple-500",children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),s.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-sm text-fg-primary truncate",children:B.title}),s.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[B.type," · ",B.status]})]})]},B.id)})}),q&&d.deliverables.length>q&&re("deliverables")]},"deliverables"):ee==="workflows"&&d.workflows.length>0?s.jsxs("section",{children:[s.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:n("common:workflows",{defaultValue:"工作流"})}),s.jsx("div",{className:"space-y-0.5",children:(q?d.workflows.slice(0,q):d.workflows).map(B=>{const J=se++;return s.jsxs("button",{"data-idx":J,onClick:()=>I(de.WORK,{boardType:"workflows"}),className:`w-full flex items-center gap-3 px-3 py-2 rounded-xl transition-colors text-left ${J===x?"bg-brand-600/15 ring-1 ring-brand-500/40":"hover:bg-surface-overlay"}`,children:[s.jsx("div",{className:"w-7 h-7 rounded-lg bg-teal-500/15 flex items-center justify-center shrink-0",children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-teal-500",children:[s.jsx("circle",{cx:"12",cy:"12",r:"3"}),s.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-sm text-fg-primary truncate",children:B.displayName||B.name}),s.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[B.stepCount," steps · v",B.version]})]})]},B.name)})}),q&&d.workflows.length>q&&re("workflows")]},"workflows"):null})}),!f&&!g&&s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[s.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-fg-tertiary mb-2",children:[s.jsx("circle",{cx:"11",cy:"11",r:"8"}),s.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),s.jsx("p",{className:"text-sm text-fg-tertiary",children:n("common:searchHint",{defaultValue:"输入关键词搜索"})})]})]}),s.jsxs("div",{className:"shrink-0 px-5 py-2 border-t border-border-default flex items-center gap-4 text-xs text-fg-tertiary flex-wrap",children:[s.jsxs("span",{children:[s.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-surface-elevated border border-border-default text-[11px] font-medium",children:navigator.platform.toUpperCase().includes("MAC")?"Cmd+P":"Ctrl+P"})," ",n("common:toggle",{defaultValue:"唤起/关闭"})]}),s.jsxs("span",{children:[s.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-surface-elevated border border-border-default text-[11px] font-medium",children:"Tab"})," ",n("common:switchTab",{defaultValue:"切换分类"})]}),s.jsxs("span",{children:[s.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-surface-elevated border border-border-default text-[11px] font-medium",children:"↑↓"})," ",n("common:navigate",{defaultValue:"导航"})]}),s.jsxs("span",{children:[s.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-surface-elevated border border-border-default text-[11px] font-medium",children:"Enter"})," ",n("common:open",{defaultValue:"打开"})]}),s.jsxs("span",{children:[s.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-surface-elevated border border-border-default text-[11px] font-medium",children:"Esc"})," ",n("common:close",{defaultValue:"关闭"})]})]})]})})}function yY({status:e}){const t=e==="active"||e==="idle"?"bg-green-500":e==="working"||e==="busy"?"bg-blue-500":"bg-gray-400";return s.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${t}`})}function vY({status:e}){const t=e==="completed"?"text-green-500 bg-green-500/15":e==="in_progress"?"text-blue-500 bg-blue-500/15":e==="pending"?"text-amber-500 bg-amber-500/15":"text-fg-tertiary bg-surface-elevated";return s.jsx("div",{className:`w-7 h-7 rounded-lg flex items-center justify-center shrink-0 ${t}`,children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M9 11l3 3L22 4"}),s.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})})}const wY=[{id:"toggle-left",group:"layout",keys:["B"],label:"Toggle left sidebar (L0 + page L1)",labelKey:"shortcuts.toggleLeft",page:"any"},{id:"help",group:"help",keys:["/"],label:"Show keyboard shortcuts",labelKey:"shortcuts.help",page:"any"},{id:"search",group:"search",keys:["P"],label:"Global search",labelKey:"shortcuts.search",page:"any"},{id:"nav-l0-jk",group:"navigation",keys:["J / K"],label:"L0: switch page up / down",labelKey:"shortcuts.navL0Jk",page:"any",bare:!0},{id:"nav-l0-l",group:"navigation",keys:["L"],label:"L0: enter page L1 (Team / Tasks / Output / Store / Settings)",labelKey:"shortcuts.navL0L",page:"any",bare:!0},{id:"nav-l0-h",group:"navigation",keys:["H"],label:"From page L1: focus app rail (L0)",labelKey:"shortcuts.navL0H",page:"any",bare:!0},{id:"settings-back",group:"navigation",keys:["H"],label:"Settings: go back to previous page",labelKey:"shortcuts.settingsBack",page:"any",bare:!0},{id:"nav-jk-settings",group:"navigation",keys:["J / K"],label:"Settings L1: switch settings tabs",labelKey:"shortcuts.navJkSettings",page:"any",bare:!0},{id:"nav-hl-work",group:"navigation",keys:["H / L"],label:"Tasks: item list ↔ project L1 ↔ app rail",labelKey:"shortcuts.navHlWork",page:"work",bare:!0},{id:"nav-jk-work",group:"navigation",keys:["J / K"],label:"Tasks: move project / item selection",labelKey:"shortcuts.navJkWork",page:"work",bare:!0},{id:"nav-hl-team",group:"navigation",keys:["H / L"],label:"Team: L0 ↔ L1 ↔ L2 (L ignored on deepest pane)",labelKey:"shortcuts.navHlTeam",page:"team",bare:!0},{id:"nav-jk-team",group:"navigation",keys:["J / K"],label:"Team L1: move roster selection",labelKey:"shortcuts.navJkTeam",page:"team",bare:!0},{id:"nav-jk-team-l2",group:"navigation",keys:["J / K"],label:"Team L2: move team member selection",labelKey:"shortcuts.navJkTeamL2",page:"team",bare:!0},{id:"nav-jk-deliverables",group:"navigation",keys:["J / K"],label:"Output L1: move deliverable selection",labelKey:"shortcuts.navJkDeliverables",page:"deliverables",bare:!0},{id:"nav-jk-store",group:"navigation",keys:["J / K"],label:"Store L1: switch store tabs",labelKey:"shortcuts.navJkStore",page:"store",bare:!0},{id:"toggle-project-detail",group:"tasks",keys:["J"],label:"Toggle project detail (Tasks)",labelKey:"shortcuts.toggleProjectDetail",page:"work"},{id:"toggle-item-detail",group:"tasks",keys:["L"],label:"Toggle task / requirement detail (Tasks)",labelKey:"shortcuts.toggleItemDetail",page:"work"},{id:"cycle-board",group:"tasks",keys:["Ctrl","Tab"],label:"Cycle Tasks views",labelKey:"shortcuts.cycleBoard",page:"work",bare:!0},{id:"toggle-browser",group:"team",keys:["L"],label:"Toggle right panel · Browser",labelKey:"shortcuts.toggleBrowser",page:"team"},{id:"toggle-terminal",group:"team",keys:["J"],label:"Toggle right panel · Terminal",labelKey:"shortcuts.toggleTerminal",page:"team"},{id:"next-tab",group:"rightPanel",keys:["Shift","]"],label:"Next right-panel tab",labelKey:"shortcuts.nextTab",page:"team"},{id:"prev-tab",group:"rightPanel",keys:["Shift","["],label:"Previous right-panel tab",labelKey:"shortcuts.prevTab",page:"team"},{id:"tab-n",group:"rightPanel",keys:["1…9"],label:"Jump to Nth right-panel tab",labelKey:"shortcuts.tabN",page:"team"},{id:"close-tab",group:"rightPanel",keys:["W"],label:"Close right-panel tab",labelKey:"shortcuts.closeTab",page:"team"},{id:"new-tab",group:"rightPanel",keys:["T"],label:"New browser tab / shell",labelKey:"shortcuts.newTab",page:"team"},{id:"term-search",group:"terminal",keys:["F"],label:"Search in terminal",labelKey:"shortcuts.termSearch",page:"team"},{id:"term-to-chat",group:"terminal",keys:["Shift","A"],label:"Add terminal selection to chat",labelKey:"shortcuts.termToChat",page:"team"}];function kY(e,t,n){return n||e[0]==="Ctrl"||e[0]==="Tab"||e[0]==="J / K"||e[0]==="H / L"?e.join(e[0]==="Ctrl"?"+":" "):e.length===1&&(e[0]==="H"||e[0]==="L"||e[0]==="J"||e[0]==="K")?e[0]:[t?"⌘":"Ctrl",...e].join(t?"":"+")}function SY(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable?!0:e.closest(".xterm")!==null}function J4(e){return e instanceof HTMLElement?e.closest(".xterm")!==null:!1}const NY=["layout","navigation","tasks","team","search","rightPanel","terminal","help"];function CY(e){return e===de.TEAM?"team":e===de.WORK?"work":e===de.DELIVERABLES?"deliverables":e===de.STORE?"store":"any"}function TY({open:e,onClose:t,page:n}){const{t:r}=ft("common"),o=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),l=CY(n);return k.useEffect(()=>{if(!e)return;const c=d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),t())};return window.addEventListener("keydown",c,!0),()=>window.removeEventListener("keydown",c,!0)},[e,t]),e?s.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/45 backdrop-blur-[1px] p-4",onMouseDown:c=>{c.target===c.currentTarget&&t()},role:"dialog","aria-modal":"true","aria-label":r("shortcuts.title"),children:s.jsxs("div",{className:"w-full max-w-lg max-h-[80vh] overflow-auto rounded-xl border border-border-default bg-surface-primary shadow-2xl",children:[s.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between gap-3 px-4 py-3 border-b border-border-default bg-surface-primary",children:[s.jsx("h2",{className:"text-sm font-semibold text-fg-primary",children:r("shortcuts.title")}),s.jsx("button",{type:"button",onClick:t,className:"w-7 h-7 flex items-center justify-center rounded-md text-fg-tertiary hover:text-fg-secondary hover:bg-surface-elevated","aria-label":r("shortcuts.close"),children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),s.jsx("div",{className:"px-4 py-3 space-y-4",children:NY.map(c=>{const d=wY.filter(m=>{if(m.group!==c)return!1;const f=m.page??"any";return f==="any"?!0:f===l});return d.length===0?null:s.jsxs("section",{children:[s.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wide text-fg-tertiary mb-2",children:r(`shortcuts.groups.${c}`)}),s.jsx("ul",{className:"space-y-1.5",children:d.map(m=>s.jsxs("li",{className:"flex items-center justify-between gap-3 text-sm",children:[s.jsx("span",{className:"text-fg-secondary min-w-0",children:r(m.labelKey??m.label,{defaultValue:m.label})}),s.jsx("kbd",{className:"shrink-0 px-1.5 py-0.5 rounded bg-surface-elevated border border-border-default text-[11px] font-medium text-fg-primary font-mono",children:kY(m.keys,o,m.bare)})]},m.id))})]},c)})})]})}):null}function AY({authUser:e,onClose:t,onSaved:n,onUserUpdated:r}){const{t:o}=ft("common");Ho(!0);const[l,c]=k.useState(e.name||""),[d,m]=k.useState(e.email||""),[f,h]=k.useState(!1),[g,y]=k.useState(""),[x,w]=k.useState(()=>Ew(e.avatarUrl,sa()?.avatarUrl)),C=async T=>{if(T.preventDefault(),!l.trim()){y(o("profile.nameRequired"));return}if(d&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(d.trim())){y(o("profile.invalidEmail"));return}h(!0),y("");try{const{user:S}=await Ee.auth.updateProfile(l.trim(),d.trim());n({...S,avatarUrl:x??S.avatarUrl})}catch{y(o("profile.failedToSave"))}finally{h(!1)}};return s.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-[10000]",onClick:t,children:s.jsxs("form",{onSubmit:C,className:"bg-surface-secondary border border-border-default rounded-xl p-6 w-[400px] max-w-[calc(100vw-2rem)] shadow-2xl",onClick:T=>T.stopPropagation(),children:[s.jsx("h3",{className:"text-base font-semibold mb-5",children:o("profile.editProfile")}),s.jsx("div",{className:"flex justify-center mb-5",children:s.jsx(jw,{currentUrl:x,name:l,size:72,targetType:"user",targetId:e.id,onUploaded:T=>{w(T),r?.({...e,avatarUrl:T})}})}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-fg-tertiary font-medium mb-1",children:o("profile.name")}),s.jsx("input",{value:l,onChange:T=>c(T.target.value),className:"w-full px-3 py-2 bg-surface-elevated border border-border-default rounded-lg text-sm text-fg-primary focus:border-brand-500 outline-none"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-xs text-fg-tertiary font-medium mb-1",children:o("profile.email")}),s.jsx("input",{value:d,onChange:T=>m(T.target.value),type:"email",className:"w-full px-3 py-2 bg-surface-elevated border border-border-default rounded-lg text-sm text-fg-primary focus:border-brand-500 outline-none"})]}),g&&s.jsx("div",{className:"text-xs text-red-500 bg-red-500/10 border border-red-500/30 rounded-lg px-3 py-2",children:g})]}),s.jsxs("div",{className:"flex justify-end gap-3 mt-5",children:[s.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm border border-border-default rounded-lg hover:bg-surface-elevated",children:o("cancel")}),s.jsx("button",{type:"submit",disabled:f,className:"px-4 py-2 text-sm bg-brand-600 hover:bg-brand-500 disabled:opacity-50 text-white rounded-lg",children:o(f?"saving":"save")})]})]})})}const ew=k.lazy(()=>Gr(()=>import("./Team-NM2SsmjN.js"),__vite__mapDeps([2,3,4,5,6])).then(e=>({default:e.TeamPage}))),tw=k.lazy(()=>Gr(()=>import("./Settings-WAXEtxMR.js"),[]).then(e=>({default:e.Settings}))),EY=k.lazy(()=>Gr(()=>import("./Store-DOGCOxTK.js"),[]).then(e=>({default:e.StorePage}))),_Y=k.lazy(()=>Gr(()=>Promise.resolve().then(()=>$W),void 0).then(e=>({default:e.AgentBuilder}))),nw=k.lazy(()=>Gr(()=>import("./Work-ornw-1Zh.js"),__vite__mapDeps([7,4,1,8,3,9])).then(e=>({default:e.WorkPage}))),rw=k.lazy(()=>Gr(()=>import("./Deliverables-CJFzxbLw.js"),__vite__mapDeps([10,4,5])).then(e=>({default:e.DeliverablesPage}))),jY=k.lazy(()=>Gr(()=>import("./Notifications-Cz2LKhGE.js"),[]).then(e=>({default:e.NotificationsPage}))),MY=k.lazy(()=>Gr(()=>import("./Search-dq45wHQN.js"),[]).then(e=>({default:e.SearchPage}))),RY={visibility:"hidden",position:"absolute",inset:0,pointerEvents:"none",zIndex:-1};function LY(e){try{const t=navigator.language,n=Intl.DateTimeFormat().resolvedOptions().timeZone,r=e.preferences??{};if(r.locale===t&&r.timezone===n)return;Ee.auth.updatePreferences({locale:t,timezone:n}).catch(()=>{})}catch{}}function OY(){return s.jsx("div",{className:"flex-1 flex items-center justify-center text-fg-tertiary text-sm animate-pulse",children:"Loading..."})}const DY=k.memo(function({id:t,activePage:n,children:r}){const o=t===n;return s.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",style:o?void 0:RY,children:s.jsx(k.Suspense,{fallback:s.jsx(OY,{}),children:r})})},(e,t)=>{const n=e.id===e.activePage,r=t.id===t.activePage;return n!==r?!1:r?e.children===t.children:!0}),Dd={};function f6(e){return typeof window<"u"&&window.matchMedia("(max-width: 767px)").matches?yw[e]??e:e}function aw(){return f6(pc())}function IY(){const{t:e}=ft("common"),[t,n]=k.useState(aw),[r,o]=k.useState(()=>!localStorage.getItem("markus_onboarded")),[l,c]=k.useState(!0),d=Uo(),m=hY(),f=fY({side:"left",defaultWidth:160,minWidth:140,maxWidth:400,collapsedWidth:64,storageKey:"markus_sidebar"}),[h,g]=k.useState(()=>new Set([aw()])),[y,x]=k.useState("loading"),[w,C]=k.useState(!1),[T,S]=k.useState(null),[E,j]=k.useState({hasOwner:!1,hasMultipleUsers:!1}),[L,I]=k.useState(!1),[O,F]=k.useState(!1),[V,X]=k.useState(null),[z,G]=k.useState(!1),[se,ee]=k.useState(null),[q,re]=k.useState(()=>{const Q=localStorage.getItem("markus_update_dismissed");return Q||null}),[B,J]=k.useState(!1),[fe,Se]=k.useState(!1),U=Lc(),W=U?.leftCollapsed??!1,pe=U?.toggleLeftCollapsed,P=U?.setLeftCollapsed,_e=U?.keyboardPane??"l0",He=U?.setKeyboardPane,Pe=U?.l0FocusPageId??null,Ge=U?.setL0FocusPageId,ct=k.useRef(t);ct.current=t;const mt=k.useRef(de.HOME),Ct=U?.toggleRightPanel,Mt=U?.toggleTerminalPanel,Pt=U?.cycleRightPanelTab,Kt=U?.activateRightPanelTabAt,yt=U?.openNewRightPanelTab,Ue=U?.rightPanelOpen??!1,dt=U?.activeRightPanelTabId??null,Nt=U?.openRightPanel,bt=U?.closeRightPanelTab,Lt=U?.updateRightPanelBrowserTab,ue=U?.updateRightPanelTerminalTab,tt=k.useRef(U?.rightPanelTabs);tt.current=U?.rightPanelTabs,k.useEffect(()=>{const Q=window.markusDesktop?.browser?.onPageEvent;if(!(!Q||!Nt))return Q(Z=>{if(Z.type==="closed"){const be=tt.current?.find(Ke=>Ke.payload.kind==="url"&&Ke.payload.browserId===Z.browserId);be&&bt&&bt(be.id);return}if(Z.type==="navigated"){if(Z.url&&gc(Z.url))return;Z.browserId&&Lt&&Lt(Z.browserId,{url:Z.url,title:Z.title||Z.url});return}if(Z.type==="opened"||Z.type==="selected"){if(!Z.url&&!Z.browserId||Z.browserId.startsWith("eb_")||rV(Z.browserId)||Z.url&&gc(Z.url))return;Nt({kind:"url",url:Z.url||"about:blank",title:Z.title||Z.url||"Browser",browserId:Z.browserId,pageId:Z.pageId})}})},[Nt,bt,Lt]),k.useEffect(()=>{const Q=window.markusDesktop?.terminal?.onEvent;if(!(!Q||!Nt))return Q(Z=>{if(Z.type==="closed"){const be=tt.current?.find(Ke=>Ke.payload.kind==="terminal"&&Ke.payload.terminalId===Z.id);be&&bt&&bt(be.id);return}if(Z.type==="cwd"){Z.cwd&&ue?.(Z.id,{cwd:Z.cwd});return}if(Z.type==="selected"){(Z.title||Z.cwd)&&ue?.(Z.id,{title:Z.title,cwd:Z.cwd});return}if(Z.type==="opened"){if(Vg.has(Z.id)){(Z.title||Z.cwd)&&ue?.(Z.id,{title:Z.title,cwd:Z.cwd});return}wi(Z.id),Nt({kind:"terminal",terminalId:Z.id,title:Z.title||"Terminal",cwd:Z.cwd})}})},[Nt,bt,ue]);const st=U?.handleTerminalExit;k.useEffect(()=>{const Q=window.markusDesktop?.terminal?.onExit;if(!(!Q||!st))return Q(Z=>{st(Z.id)})},[st]),k.useLayoutEffect(()=>{const Q=t===de.TEAM&&Ue&&U?.rightPanelMode==="browser";up(Q)},[t,Ue,U?.rightPanelMode]),k.useEffect(()=>{window.markusDesktop?.browser?.hideAll?.()},[]);const ye=k.useRef(!1);k.useEffect(()=>{if(!ye.current){ye.current=!0;return}f.setCollapsed(W)},[W,f.setCollapsed]),k.useEffect(()=>{if(d)return;const Q=navigator.platform.toUpperCase().includes("MAC"),Z=Ke=>{Q&&Ke.metaKey&&!Ke.ctrlKey&&Ke.key==="p"?(Ke.preventDefault(),J(Ie=>!Ie)):!Q&&Ke.ctrlKey&&!Ke.metaKey&&Ke.key==="p"&&(Ke.preventDefault(),J(Ie=>!Ie))},be=()=>J(!0);return document.addEventListener("keydown",Z),window.addEventListener("markus:open-search",be),()=>{document.removeEventListener("keydown",Z),window.removeEventListener("markus:open-search",be)}},[d]);const je=k.useCallback(()=>!Ue||!dt||!bt?!1:(bt(dt),!0),[Ue,dt,bt]);k.useEffect(()=>{const Q=window.markusDesktop?.onAppShortcut?.(Z=>{if(Z.type==="close-tab"){je();return}Z.type==="new-tab"&&yt?.()});return()=>{Q?.()}},[je,yt]),k.useEffect(()=>{if(d||!pe||!Ct)return;const Q=navigator.platform.toUpperCase().includes("MAC"),Z=be=>{if(!(Q?be.metaKey&&!be.ctrlKey:be.ctrlKey&&!be.metaKey)||be.altKey)return;if(!be.shiftKey&&(be.key==="/"||be.code==="Slash")){be.preventDefault(),Se(Ye=>!Ye);return}if(be.shiftKey&&(be.key==="?"||be.key==="/")){be.preventDefault(),Se(Ye=>!Ye);return}if(be.shiftKey&&Ue&&Pt){if(be.key==="]"||be.code==="BracketRight"){be.preventDefault(),Pt(1);return}if(be.key==="["||be.code==="BracketLeft"){be.preventDefault(),Pt(-1);return}}if(!be.shiftKey&&Ue&&Kt){const Ye=be.key>="1"&&be.key<="9"?Number(be.key):0;if(Ye>=1){be.preventDefault(),Kt(Ye-1);return}}if(be.shiftKey)return;const Ie=be.key.toLowerCase();if(Ie==="w"){be.preventDefault(),be.stopPropagation(),je();return}if(Ie==="t"){be.preventDefault(),yt?.();return}if(Ie==="b"){if(t===de.DELIVERABLES)return;be.preventDefault(),pe()}else if(t===de.TEAM&&Ie==="l"){if(!Q&&J4(be.target)||Q&&J4(be.target)&&be.ctrlKey)return;be.preventDefault(),Ct()}else t===de.TEAM&&Ie==="j"&&Mt&&(be.preventDefault(),Mt())};return document.addEventListener("keydown",Z,!0),()=>document.removeEventListener("keydown",Z,!0)},[d,t,pe,Ct,Mt,Pt,Kt,Ue,je,yt]);const Ae=k.useCallback((Q,Z)=>{let be=fc(Q);d?be=yw[be]??be:be===de.NOTIFICATIONS&&(be=de.HOME),be!==de.TEAM&&up(!1);const Ke=pc(),Ie=window.location.hash.slice(1);Ie!==hh(Ke)?Dd[Ke]=Ie:delete Dd[Ke];const Ye=ct.current;if(be===de.SETTINGS&&Ye!==de.SETTINGS&&(mt.current=Ye,it.setSettingsReturnPage(Ye),He?.("l1"),Ge?.(de.SETTINGS)),Ye===de.SETTINGS&&be!==de.SETTINGS&&(He?.("l0"),Ge?.(be)),be===de.SETTINGS&&Z?.tab){const le=`settings/${Z.tab}`;Dd[be]=le,history.pushState(null,"","#"+le),window.dispatchEvent(new HashChangeEvent("hashchange")),n(be),g(Oe=>Oe.has(be)?Oe:new Set([...Oe,be]));return}const M=be!==de.WORK?Dd[be]:void 0;M&&M!==hh(be)?(history.pushState(null,"",Ti(be)),history.pushState(null,"","#"+M)):history.pushState(null,"",Ti(be)),window.dispatchEvent(new HashChangeEvent("hashchange")),n(be),g(le=>le.has(be)?le:new Set([...le,be]))},[d,He,Ge]);k.useEffect(()=>{it.setHandler((Q,Z)=>Ae(Q,Z))},[Ae]),k.useEffect(()=>{_e==="l0"&&t!==de.SETTINGS&&Ge?.(t)},[_e,t,Ge]),k.useEffect(()=>{if(d||!He||!Ge)return;const Q=Z=>{if(Z.metaKey||Z.ctrlKey||Z.altKey||SY(Z.target))return;const be=Z.key.length===1?Z.key.toLowerCase():Z.key;if(t===de.SETTINGS&&(be==="h"||be==="ArrowLeft")){Z.preventDefault(),Z.stopImmediatePropagation(),it.leaveSettings();return}if(_e!=="l0"||t===de.SETTINGS)return;const Ke=Pe&&vo.includes(Pe)?Pe:t,Ie=Math.max(0,vo.indexOf(Ke));if(be==="j"||be==="ArrowDown"){Z.preventDefault(),Z.stopImmediatePropagation();const Ye=vo[Math.min(vo.length-1,Ie+1)];Ge(Ye),Ye!==t&&Ae(Ye),requestAnimationFrame(()=>{document.querySelector(`[data-l0-page-id="${Ye}"]`)?.scrollIntoView({block:"nearest"})});return}if(be==="k"||be==="ArrowUp"){Z.preventDefault(),Z.stopImmediatePropagation();const Ye=vo[Math.max(0,Ie-1)];Ge(Ye),Ye!==t&&Ae(Ye),requestAnimationFrame(()=>{document.querySelector(`[data-l0-page-id="${Ye}"]`)?.scrollIntoView({block:"nearest"})});return}if(be==="l"||be==="ArrowRight"||be==="Enter"){const Ye=Pe&&vo.includes(Pe)?Pe:t;if(!XO.has(Ye)){Z.preventDefault(),Z.stopImmediatePropagation();return}Z.preventDefault(),Z.stopImmediatePropagation(),Ye!==t&&Ae(Ye),P?.(!1),He("l1");return}(be==="h"||be==="ArrowLeft")&&(Z.preventDefault(),Z.stopImmediatePropagation())};return document.addEventListener("keydown",Q,!0),()=>document.removeEventListener("keydown",Q,!0)},[d,_e,Pe,t,Ae,He,Ge,P]),k.useEffect(()=>{const Q=()=>C(!0);return window.addEventListener("markus:open-edit-profile",Q),()=>window.removeEventListener("markus:open-edit-profile",Q)},[]),k.useEffect(()=>{if(!window.markusDesktop)return;!d&&t!==de.SETTINGS&&!f.collapsed?window.markusDesktop.setTrafficLightPosition(16,16):window.markusDesktop.setTrafficLightPosition(6,16)},[f.collapsed,t,d]),k.useEffect(()=>{window.markusDesktop&&window.markusDesktop.onNotificationClick(Q=>{if(Q.openNotifications&&window.dispatchEvent(new CustomEvent("markus:open-notifications")),Q.page){const Z=fc(Q.page);Q.params&&Object.entries(Q.params).forEach(([be,Ke])=>localStorage.setItem(`markus_nav_${be}`,Ke)),Ae(Z),window.dispatchEvent(new CustomEvent("markus:navigate",{detail:{page:Z,params:Q.params}}))}})},[Ae]);const oe=k.useCallback(()=>{fetch("/api/settings/llm").then(Q=>Q.ok?Q.json():null).then(Q=>{if(Q?.providers){const Z=Object.values(Q.providers).some(be=>be.configured);X(Z)}}).catch(()=>{})},[]),H=k.useCallback((Q,Z)=>{if(!Q)return;const Ke=Z&&{agent:"agents",team:"teams",skill:"skills"}[Z]||"agents";localStorage.setItem("markus_nav_installItem",Q),localStorage.setItem("markus_nav_storeTab",Ke);const Ie=new URLSearchParams(window.location.search);Ie.get("install")||(Ie.set("install",Q),Z&&Ie.set("type",Z));const Ye=Ie.toString();window.history.replaceState(null,"",`${window.location.pathname}?${Ye}${Ti(de.STORE)}`);const M=()=>it.navigate(de.STORE,{storeTab:Ke,installItem:Q});M(),setTimeout(M,500),setTimeout(M,1500)},[]);k.useEffect(()=>{const Q=new URLSearchParams(window.location.search),Z=Q.get("install");Z&&H(Z,Q.get("type"));const be=window.markusDesktop;be?.onDeepLinkInstall?.(({id:Ye,type:M})=>H(Ye,M)),be?.consumePendingDeepLinkInstall?.().then(Ye=>{Ye?.id&&H(Ye.id,Ye.type)}),Ee.auth.me().then(({user:Ye})=>{x(Ye),S(!0),LY(Ye),va.connect(Ye.id),oe(),Ee.health().then(le=>{le.updateAvailable&&le.latestVersion&&ee({latestVersion:le.latestVersion,currentVersion:le.version})}).catch(()=>{});const M=()=>{gi(Tr.builderArtifacts,()=>Ee.builder.artifacts.list()),gi(Tr.builderAgents,()=>Ee.agents.list()),gi(Tr.builderHubMyItems,()=>lt.myItems()),gi(Tr.builderInstalled,()=>Ee.builder.artifacts.installed()),gi(Tr.hubAgents,()=>lt.search({type:"agent",limit:50})),gi(Tr.hubTeams,()=>lt.search({type:"team",limit:50})),gi(Tr.hubSkills,()=>lt.search({type:"skill",limit:50}))};typeof requestIdleCallback=="function"?requestIdleCallback(M,{timeout:5e3}):setTimeout(M,3e3)}).catch(()=>{x(null),Ee.auth.status().then(({initialized:Ye,hasOwner:M,hasMultipleUsers:le})=>{S(Ye),j({hasOwner:M,hasMultipleUsers:le})}).catch(()=>S(!0))}),va.connect();const Ke=va.on("notification",()=>{window.dispatchEvent(new CustomEvent("markus:notifications-changed"))}),Ie=()=>{const Ye=f6(pc());Ye!==de.TEAM&&up(!1),n(Ye),g(M=>M.has(Ye)?M:new Set([...M,Ye]))};return window.addEventListener("hashchange",Ie),window.addEventListener("popstate",Ie),()=>{Ke(),va.disconnect(),window.removeEventListener("hashchange",Ie),window.removeEventListener("popstate",Ie)}},[]);const te=y!=="loading"&&y!==null?y:void 0,Ne=k.useMemo(()=>d?{[de.HOME]:s.jsx(dv,{authUser:te}),[de.TEAM]:s.jsx(ew,{authUser:te}),[de.BUILDER]:s.jsx(oY,{authUser:te}),[de.SETTINGS]:s.jsx(tw,{theme:m.mode,onThemeChange:m.setMode,authUser:te,onLogout:()=>{Ee.auth.logout().catch(()=>{}),Ro(),x(null)},onUserUpdated:Q=>x(Q)}),[de.WORK]:s.jsx(nw,{authUser:te}),[de.DELIVERABLES]:s.jsx(rw,{authUser:te}),[de.NOTIFICATIONS]:s.jsx(jY,{authUser:te}),[de.SEARCH]:s.jsx(MY,{})}:{[de.HOME]:s.jsx(dv,{authUser:te}),[de.TEAM]:s.jsx(ew,{authUser:te}),[de.SETTINGS]:s.jsx(tw,{theme:m.mode,onThemeChange:m.setMode,authUser:te,onLogout:()=>{Ee.auth.logout().catch(()=>{}),Ro(),x(null)},onUserUpdated:Q=>x(Q)}),[de.STORE]:s.jsx(EY,{authUser:te}),[de.BUILDER]:s.jsx(_Y,{authUser:te}),[de.WORK]:s.jsx(nw,{authUser:te}),[de.DELIVERABLES]:s.jsx(rw,{authUser:te})},[te?.id,te?.role,m.mode,d]);if(y==="loading"||y===null&&T===null)return s.jsx("div",{className:"min-h-dvh bg-surface-primary flex items-center justify-center",children:s.jsx("div",{className:"text-fg-tertiary text-sm animate-pulse",children:e("loading")})});const $e=(typeof window<"u"?window.location.hash:"").match(/^#invite\?token=([a-f0-9]+)/);return $e?s.jsx(dY,{token:$e[1],onComplete:()=>{window.location.hash="",localStorage.removeItem("markus_onboarded"),o(!0),I(!0),x("loading"),Ee.auth.me().then(Q=>x(Q.user)).catch(()=>x(null))}}):y===null?s.jsx(uY,{hasOwner:E.hasOwner,hasMultipleUsers:E.hasMultipleUsers,onLogin:(Q,Z,be)=>{x(Q),va.connect(Q.id),Z?(localStorage.removeItem("markus_onboarded"),o(!0),be?.fromHub&&I(!0)):localStorage.getItem("markus_onboarded")||(localStorage.setItem("markus_onboarded","1"),o(!1))}}):O?s.jsx(mY,{onComplete:()=>F(!1),isFirstTime:!0}):r?s.jsx(lY,{theme:m.mode,onThemeChange:m.setMode,skipProfile:L,onProfileUpdated:Q=>{const Z={id:Q.id,name:Q.name,email:Q.email,role:Q.role,orgId:Q.orgId??"default",avatarUrl:Q.avatarUrl};x(Z)},onComplete:()=>{localStorage.setItem("markus_onboarded","1"),o(!1),I(!1),Ee.auth.me().then(Q=>x(Q.user)).catch(()=>{}),oe(),Ae(de.HOME)}}):s.jsxs("div",{className:`flex h-dvh bg-surface-primary text-fg-primary overflow-x-hidden ${d?"flex-col":""}`,children:[!d&&t!==de.SETTINGS&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"relative z-40 shrink-0",style:{width:f.width},children:s.jsx(fW,{currentPage:t,onNavigate:Q=>{Ae(Q),c(!1),He?.("l0"),Ge?.(Q)},authUser:y,collapsed:f.collapsed,onToggleCollapse:f.toggle,onLogout:()=>{Ee.auth.logout().catch(()=>{}),Ro(),x(null)},keyboardFocusPageId:Pe,keyboardPaneActive:_e==="l0"})}),s.jsx("div",{className:`${f.collapsed?"w-0":"w-1.5 cursor-col-resize"} shrink-0 group relative z-10 flex items-center justify-center`,onMouseDown:f.collapsed?void 0:f.onResizeStart,children:!f.collapsed&&s.jsx("div",{className:"w-px h-2/3 border-l border-dashed border-transparent group-hover:border-border-default group-active:border-fg-tertiary transition-colors"})})]}),s.jsxs("div",{className:`flex-1 overflow-hidden flex flex-col min-w-0 ${d&&t!==de.SETTINGS&&t!==de.SEARCH?"pb-14":""}`,children:[V===!1&&!z&&t!==de.SETTINGS&&s.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-amber-500/10 border-b border-amber-500/30 text-amber-600 text-sm shrink-0",children:[s.jsx("span",{className:d?"text-xs":"",children:e("llmBanner.message")}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:()=>{window.location.hash="#settings/providers"},className:"px-3 py-1 bg-amber-700/50 hover:bg-amber-700/70 text-white text-xs rounded-lg transition-colors",children:e("llmBanner.goToSettings")}),s.jsx("button",{onClick:()=>G(!0),className:"text-amber-500 hover:text-amber-600 text-xs",children:e("dismiss")})]})]}),se&&q!==se.latestVersion&&s.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-brand-500/10 border-b border-brand-500/30 text-brand-400 text-sm shrink-0",children:[s.jsx("span",{className:d?"text-xs":"",children:e("update.available",{latest:se.latestVersion,current:se.currentVersion})}),s.jsxs("span",{className:"flex items-center gap-3 shrink-0",children:[s.jsx("a",{href:"https://markus.global/#download",target:"_blank",rel:"noopener noreferrer",className:"text-xs font-medium text-brand-400 hover:text-brand-300 transition-colors",children:e("update.download")}),s.jsx("button",{onClick:()=>{re(se.latestVersion),localStorage.setItem("markus_update_dismissed",se.latestVersion)},className:"text-fg-tertiary hover:text-fg-secondary text-xs shrink-0",children:e("dismiss")})]})]}),s.jsx("main",{className:"flex-1 overflow-hidden flex flex-col relative",children:Object.keys(Ne).map(Q=>h.has(Q)?s.jsx(DY,{id:Q,activePage:t,children:Ne[Q]},Q):null)})]}),d&&t!==de.SETTINGS&&t!==de.SEARCH&&s.jsx(xW,{currentPage:t,onNavigate:Ae,userId:te?.id}),d&&s.jsx(mD,{authUser:te,onNavigate:Ae}),!d&&B&&s.jsx(xY,{onClose:()=>J(!1),currentPage:t}),!d&&s.jsx(TY,{open:fe,onClose:()=>Se(!1),page:t}),w&&te&&s.jsx(AY,{authUser:te,onClose:()=>C(!1),onUserUpdated:Q=>x(Q),onSaved:Q=>{C(!1),x(Q)}})]})}N7.createRoot(document.getElementById("root")).render(s.jsx(k.StrictMode,{children:s.jsx(cV,{children:s.jsx(IY,{})})}));export{g8 as $,Hs as A,Ya as B,Ti as C,dr as D,JO as E,HY as F,K3 as G,VY as H,tY as I,b4 as J,A4 as K,UK as L,Mw as M,uW as N,HK as O,de as P,UY as Q,PY as R,JW as S,FW as T,ZK as U,KY as V,yc as W,fX as X,zY as Y,sa as Z,Gr as _,Uo as a,BY as a0,$Y as a1,wi as a2,Sd as a3,_i as a4,r0 as a5,lX as a6,XK as a7,OV as a8,r4 as a9,sW as aA,oX as aB,WY as aC,qY as aD,G3 as aE,DV as aa,Ai as ab,Yo as ac,JY as ad,bW as ae,mX as af,rX as ag,GY as ah,ZY as ai,QY as aj,YY as ak,aW as al,Yg as am,XY as an,tX as ao,nX as ap,sX as aq,eX as ar,MV as as,dX as at,aX as au,cX as av,iX as aw,lW as ax,uX as ay,F3 as az,dD as b,Lc as c,aY as d,VW as e,XW as f,Ni as g,lt as h,SY as i,s as j,Sa as k,Ee as l,fY as m,it as n,bn as o,fc as p,Er as q,k as r,Wg as s,Hr as t,ft as u,Tc as v,va as w,A0 as x,x8 as y,Ho as z};