fix(desktop): 对话里的外部链接改由系统浏览器打开

WKWebView 里点 <a> 是整页导航,应用会被跳走且无法返回。两层修:
- UI:Markdown 容器事件委托,外链 preventDefault 后经 opener 插件
  (浏览器模式 window.open 新标签)打开;非 http(s) 协议直接拦下
- 壳:主窗口加 on_navigation 守卫兜底,只放行 loopback 与壳自带页面,
  其余导航拒绝并转交系统浏览器;无头探针新增 nav-guard 断言
This commit is contained in:
xiaomakuaiz committed 2026-07-15 07:51:03 +00:00
1 parent 7d63461f7c
commit 686c81126e
7 files changed
+510 -17

No files matched your search

+13 -13
View File
@@ -53,13 +53,13 @@
`+l[u].replace(" at new "," at ");return e.displayName&&g.includes("<anonymous>")&&(g=g.replace("<anonymous>",e.displayName)),g}while(1<=u&&0<=m);break}}}finally{ae=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?L(e):""}function me(e){switch(e.tag){case 5:return L(e.type);case 16:return L("Lazy");case 13:return L("Suspense");case 19:return L("SuspenseList");case 0:case 2:case 15:return e=ue(e.type,!1),e;case 11:return e=ue(e.type.render,!1),e;case 1:return e=ue(e.type,!0),e;default:return""}}function ge(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ee:return"Fragment";case de:return"Portal";case mt:return"Profiler";case Ge:return"StrictMode";case et:return"Suspense";case ut:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Jt:return(e.displayName||"Context")+".Consumer";case be:return(e._context.displayName||"Context")+".Provider";case Be:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ue:return t=e.displayName||null,t!==null?t:ge(e.type)||"Memo";case Ke:t=e._payload,e=e._init;try{return ge(e(t))}catch{}}return null}function xe(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ge(t);case 8:return t===Ge?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ye(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Se(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function tt(e){var t=Se(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(u){r=""+u,o.call(this,u)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(u){r=""+u},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Te(e){e._valueTracker||(e._valueTracker=tt(e))}function $n(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Se(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ae(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function er(e,t){var n=t.checked;return U({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function fe(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ye(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function $t(e,t){t=t.checked,t!=null&&q(e,"checked",t,!1)}function On(e,t){$t(e,t);var n=ye(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Dn(e,t.type,n):t.hasOwnProperty("defaultValue")&&Dn(e,t.type,ye(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function It(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Dn(e,t,n){(t!=="number"||Ae(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ht=Array.isArray;function zt(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l<n.length;l++)t["$"+n[l]]=!0;for(n=0;n<e.length;n++)l=t.hasOwnProperty("$"+e[n].value),e[n].selected!==l&&(e[n].selected=l),l&&r&&(e[n].defaultSelected=!0)}else{for(n=""+ye(n),t=null,l=0;l<e.length;l++){if(e[l].value===n){e[l].selected=!0,r&&(e[l].defaultSelected=!0);return}t!==null||e[l].disabled||(t=e[l])}t!==null&&(t.selected=!0)}}function Pt(e,t){if(t.dangerouslLine truncated
`).replace(sp,"")}function Di(e,t,n){if(t=Nu(t),Nu(e)!==t&&n)throw Error(s(425))}function Mi(){}var ls=null,is=null;function os(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var ss=typeof setTimeout=="function"?setTimeout:void 0,ap=typeof clearTimeout=="function"?clearTimeout:void 0,Lu=typeof Promise=="function"?Promise:void 0,up=typeof queueMicrotask=="function"?queueMicrotask:typeof Lu<"u"?function(e){return Lu.resolve(null).then(e).catch(cp)}:ss;function cp(e){setTimeout(function(){throw e})}function as(e,t){var n=t,r=0;do{var l=n.nextSibling;if(e.removeChild(n),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(r===0){e.removeChild(l),jl(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=l}while(n);jl(t)}function ur(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Iu(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var tl=Math.random().toString(36).slice(2),Nn="__reactFiber$"+tl,Ql="__reactProps$"+tl,Wn="__reactContainer$"+tl,us="__reactEvents$"+tl,fp="__reactListeners$"+tl,dp="__reactHandles$"+tl;function Ar(e){var t=e[Nn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Wn]||n[Nn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Iu(e);e!==null;){if(n=e[Nn])return n;e=Iu(e)}return t}e=n,n=e.parentNode}return null}function Gl(e){return e=e[Nn]||e[Wn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function nl(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(s(33))}function Fi(e){return e[Ql]||null}var cs=[],rl=-1;function cr(e){return{current:e}}function De(e){0>rl||(e.current=cs[rl],cs[rl]=null,rl--)}function ze(e,t){rl++,cs[rl]=e.current,e.current=t}var fr={},wt=cr(fr),Mt=cr(!1),Nr=fr;function ll(e,t){var n=e.type.contextTypes;if(!n)return fr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function Ft(e){return e=e.childContextTypes,e!=null}function bi(){De(Mt),De(wt)}function zu(e,t,n){if(wt.current!==fr)throw Error(s(168));ze(wt,t),ze(Mt,n)}function Pu(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(s(108,xe(e)||"Unknown",l));return U({},n,r)}function Bi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||fr,Nr=wt.current,ze(wt,e),ze(Mt,Mt.current),!0}function ju(e,t,n){var r=e.stateNode;if(!r)throw Error(s(169));n?(e=Pu(e,t,Nr),r.__reactInternalMemoizedMergedChildContext=e,De(Mt),De(wt),ze(wt,e)):De(Mt),ze(Mt,n)}var Hn=null,Ui=!1,fs=!1;function Ou(e){Hn===null?Hn=[e]:Hn.push(e)}function pp(e){Ui=!0,Ou(e)}function dr(){if(!fs&&Hn!==null){fs=!0;var e=0,t=d;try{var n=Hn;for(d=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Hn=null,Ui=!1}catch(l){throw Hn!==null&&(Hn=Hn.slice(e+1)),xi(mn,dr),l}finally{d=t,fs=!1}}return null}var il=[],ol=0,Wi=null,Hi=0,nn=[],rn=0,Lr=null,Vn=1,Qn="";function Ir(e,t){il[ol++]=Hi,il[ol++]=Wi,Wi=e,Hi=t}function Du(e,t,n){nn[rn++]=Vn,nn[rn++]=Qn,nn[rn++]=Lr,Lr=e;var r=Vn;e=Qn;var l=32-vt(r)-1;r&=~(1<<l),n+=1;var o=32-vt(t)+l;if(30<o){var u=l-l%5;o=(r&(1<<u)-1).toString(32),r>>=u,l-=u,Vn=1<<32-vt(t)+l|n<<l|r,Qn=o+e}else Vn=1<<o|n<<l|r,Qn=e}function ds(e){e.return!==null&&(Ir(e,1),Du(e,1,0))}function ps(e){for(;e===Wi;)Wi=il[--ol],il[ol]=null,Hi=il[--ol],il[ol]=null;for(;e===Lr;)Lr=nn[--rn],nn[rn]=null,Qn=nn[--rn],nn[rn]=null,Vn=nn[--rn],nn[rn]=null}var Kt=null,qt=null,Fe=!1,yn=null;function Mu(e,t){var n=an(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Fu(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Kt=e,qt=ur(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Kt=e,qt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Lr!==null?{id:Vn,overflow:Qn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=an(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Kt=e,qt=null,!0):!1;default:return!1}}function hs(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ms(e){if(Fe){var t=qt;if(t){var n=t;if(!Fu(e,t)){if(hs(e))throw Error(s(418));t=ur(n.nextSibling);var r=Kt;t&&Fu(e,t)?Mu(r,n):(e.flags=e.flags&-4097|2,Fe=!1,Kt=e)}}else{if(hs(e))throw Error(s(418));e.flags=e.flags&-4097|2,Fe=!1,Kt=e}}}function bu(e){for(e=e.retLine truncated
Error generating stack: `+o.message+`
`+o.stack}return{value:e,source:t,stack:l,digest:null}}function Ms(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Fs(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Sp=typeof WeakMap=="function"?WeakMap:Map;function xc(e,t,n){n=Yn(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){uo||(uo=!0,$s=r),Fs(e,t)},n}function wc(e,t,n){n=Yn(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=t.value;n.payload=function(){return r(l)},n.callback=function(){Fs(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Fs(e,t),typeof r!="function"&&(gr===null?gr=new Set([this]):gr.add(this));var u=t.stack;this.componentDidCatch(t.value,{componentStack:u!==null?u:""})}),n}function kc(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Sp;var l=new Set;r.set(t,l)}else l=r.get(t),l===void 0&&(l=new Set,r.set(t,l));l.has(n)||(l.add(n),e=Dp.bind(null,e,t,n),t.then(e,e))}function Sc(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Ec(e,t,n,r,l){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Yn(-1,1),t.tag=2,hr(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=l,e)}var Ep=le.ReactCurrentOwner,bt=!1;function Rt(e,t,n,r){t.child=e===null?Hu(t,null,n,r):al(t,e.child,n,r)}function Tc(e,t,n,r,l){n=n.render;var o=t.ref;return cl(t,l),r=Ns(e,t,n,r,o,l),n=Ls(),e!==null&&!bt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Kn(e,t,l)):(Fe&&n&&ds(t),t.flags|=1,Rt(e,t,r,l),t.child)}function Cc(e,t,n,r,l){if(e===null){var o=n.type;return typeof o=="function"&&!oa(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,_c(e,t,o,r,l)):(e=go(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,(e.lanes&l)===0){var u=o.memoizedProps;if(n=n.compare,n=n!==null?n:Bl,n(u,r)&&e.ref===t.ref)return Kn(e,t,l)}return t.flags|=1,e=wr(o,r),e.ref=t.ref,e.return=t,t.child=e}function _c(e,t,n,r,l){if(e!==null){var o=e.memoizedProps;if(Bl(o,r)&&e.ref===t.ref)if(bt=!1,t.pendingProps=r=o,(e.lanes&l)!==0)(e.flags&131072)!==0&&(bt=!0);else return t.lanes=e.lanes,Kn(e,t,l)}return bs(e,t,n,r,l)}function Rc(e,t,n){var r=t.pendingProps,l=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ze(hl,Xt),Xt|=n;else{if((n&1073741824)===0)return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ze(hl,Xt),Xt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,ze(hl,Xt),Xt|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,ze(hl,Xt),Xt|=r;return Rt(e,t,l,n),t.child}function Ac(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function bs(e,t,n,r,l){var o=Ft(n)?Nr:wt.current;return o=ll(t,o),cl(t,l),n=Ns(e,t,n,r,o,l),r=Ls(),e!==null&&!bt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Kn(e,t,l)):(Fe&&r&&ds(t),t.flags|=1,Rt(e,t,n,l),t.child)}function Nc(e,t,n,r,l){if(Ft(n)){var o=!0;Bi(t)}else o=!1;if(cl(t,l),t.stateNode===null)lo(e,t),yc(t,n,r),Ds(t,n,r,l),r=!0;else if(e===null){var u=t.stateNode,m=t.memoizedProps;u.props=m;var g=u.context,_=n.contextType;typeof _=="object"&&_!==null?_=ln(_):(_=Ft(n)?Nr:wt.current,_=ll(t,_));var P=n.getDerivedStateFromProps,j=typeof P=="function"||typeof u.getSnapshotBeforeUpdate=="function";j||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(m!==r||g!==_)&&vc(t,u,r,_),pr=!1;var z=t.memoizedState;u.state=z,qi(t,r,u,l),g=t.memoizedState,m!==r||z!==g||Mt.current||pr?(typeof P=="function"&&(Os(t,n,P,r),g=t.memoizedState),(m=pr||gc(t,n,m,r,z,g,_))?(j||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=g),u.props=r,u.state=g,u.context=_,r=m):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{u=t.stateNode,Qu(e,t),m=t.memoizedProps,_=t.type===t.elementType?m:vn(t.type,m),u.props=_,j=t.pendingProps,z=u.context,g=n.contextType,typeof g=="object"&&g!==null?g=ln(g):(g=Ft(n)?Nr:wt.current,g=ll(t,g));var B=n.getDerivedStateFromProps;(P=typeof B=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(m!==j||z!==g)&&vc(t,u,r,g),pr=!1,z=t.memoizedState,u.state=z,qi(t,r,u,Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yh(a,i){return hh(a)||mh(a,i)||vh(a,i)||gh()}function vh(a,i){if(a){if(typeof a=="string")return wf(a,i);var s={}.toString.call(a).slice(8,-1);return s==="Object"&&a.constructor&&(s=a.constructor.name),s==="Map"||s==="Set"?Array.from(a):s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?wf(a,i):void 0}}const $f=Object.entries,kf=Object.setPrototypeOf,xh=Object.isFrozen,wh=Object.getPrototypeOf,kh=Object.getOwnPropertyDescriptor;let pt=Object.freeze,ht=Object.seal,kl=Object.create,ed=typeof Reflect<"u"&&Reflect,Na=ed.apply,La=ed.construct;pt||(pt=function(i){return i});ht||(ht=function(i){return i});Na||(Na=function(i,s){for(var c=arguments.length,f=new Array(c>2?c-2:0),h=2;h<c;h++)f[h-2]=arguments[h];return i.apply(s,f)});La||(La=function(i){for(var s=arguments.length,c=new Array(s>1?s-1:0),f=1;f<s;f++)c[f-1]=arguments[f];return new i(...c)});const yl=$e(Array.prototype.forEach),Sh=$e(Array.prototype.lastIndexOf),Sf=$e(Array.prototype.pop),vl=$e(Array.prototype.push),Eh=$e(Array.prototype.splice),Er=Array.isArray,hi=$e(String.prototype.toLowerCase),va=$e(String.prototype.toString),Ef=$e(String.prototype.match),ui=$e(String.prototype.replace),Tf=$e(String.prototype.indexOf),Th=$e(String.prototype.trim),Ch=$e(Number.prototype.toString),_h=$e(Boolean.prototype.toString),Cf=typeof BigInt>"u"?null:$e(BigInt.prototype.toString),_f=typeof Symbol>"u"?null:$e(Symbol.prototype.toString),at=$e(Object.prototype.hasOwnProperty),ci=$e(Object.prototype.toString),st=$e(RegExp.prototype.test),Br=Rh(TypeError);function $e(a){return function(i){i instanceof RegExp&&(i.lastIndex=0);for(var s=arguments.length,c=new Array(s>1?s-1:0),f=1;f<s;f++)c[f-1]=arguments[f];return Na(a,i,c)}}function Rh(a){return function(){for(var i=arguments.length,s=new Array(i),c=0;c<i;c++)s[c]=arguments[c];return La(a,s)}}function ve(a,i){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:hi;if(kf&&kf(a,null),!Er(i))return a;let c=i.length;for(;c--;){let f=i[c];if(typeof f=="string"){const h=s(f);h!==f&&(xh(i)||(i[c]=h),f=h)}a[f]=!0}return a}function Ah(a){for(let i=0;i<a.length;i++)at(a,i)||(a[i]=null);return a}function Nt(a){const i=kl(null);for(const c of $f(a)){var s=yh(c,2);const f=s[0],h=s[1];at(a,f)&&(Er(h)?i[f]=Ah(h):h&&typeof h=="object"&&h.constructor===Object?i[f]=Nt(h):i[f]=h)}return i}function Nh(a){switch(typeof a){case"string":return a;case"number":return Ch(a);case"boolean":return _h(a);case"bigint":return Cf?Cf(a):"0";case"symbol":return _f?_f(a):"Symbol()";case"undefined":return ci(a);case"function":case"object":{if(a===null)return ci(a);const i=a,s=Pn(i,"toString");if(typeof s=="function"){const c=s(i);return typeof c=="string"?c:ci(c)}return ci(a)}default:return ci(a)}}function Pn(a,i){for(;a!==null;){const c=kh(a,i);if(c){if(c.get)return $e(c.get);if(typeof c.value=="function")return $e(c.value)}a=wh(a)}function s(){return null}return s}function Lh(a){try{return st(a,""),!0}catch{return!1}}const Rf=pt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),xa=pt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),wa=pt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ih=pt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","sLine truncated
`+xt),ct&&(xt=_t(xt)),de&&tr?Be(xt):xt},i.setConfig=function(){let O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};El(O),En=!0,Mn=Te,un=Ae},i.clearConfig=function(){Dt=null,En=!1,Mn=null,un=null,de=Ge,Ee=""},i.isValidAttribute=function(O,d,T){Dt||El({});const I=Pe(O),H=Pe(d);return Rr(I,H,T)},i.addHook=function(O,d){typeof d=="function"&&at(y,O)&&vl(y[O],d)},i.removeHook=function(O,d){if(at(y,O)){if(d!==void 0){const T=Sh(y[O],d);return T===-1?void 0:Eh(y[O],T,1)[0]}return Sf(y[O])}},i.removeHooks=function(O){at(y,O)&&(y[O]=[])},i.removeAllHooks=function(){y=jf()},i}var Gh=td();function Fa(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Hr=Fa();function nd(a){Hr=a}var gi={exec:()=>null};function Re(a,i=""){let s=typeof a=="string"?a:a.source;const c={replace:(f,h)=>{let w=typeof h=="string"?h:h.source;return w=w.replace(Lt.caret,"$1"),s=s.replace(f,w),c},getRegex:()=>new RegExp(s,i)};return c}var Lt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:a=>new RegExp(`^( {0,3}${a})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}#`),htmlBeginRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}<(?:[a-z].*>|!--)`,"i")},Yh=/^(?:[ \t]*(?:\n|$))+/,Kh=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,qh=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,yi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Xh=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ba=/(?:[*+-]|\d{1,9}[.)])/,rd=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ld=Re(rd).replace(/bull/g,ba).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Zh=Re(rd).replace(/bull/g,ba).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ba=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Jh=/^[^\n]+/,Ua=/(?!\s*\])(?:\\.|[^\[\]\\])+/,$h=Re(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ua).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),em=Re(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ba).getRegex(),Io="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Wa=/\x3C!--(?:-?>|[\s\S]*?(?:-->|$))/,tm=Re("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(Line truncated
]`).replace("lheading",ld).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},im=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,om=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,od=/^( {2,}|\\)\n(?!\s*$)/,sm=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,zo=/[\p{P}\p{S}]/u,Va=/[\s\p{P}\p{S}]/u,sd=/[^\s\p{P}\p{S}]/u,am=Re(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Va).getRegex(),ad=/(?!~)[\p{P}\p{S}]/u,um=/(?!~)[\s\p{P}\p{S}]/u,cm=/(?:[^\s\p{P}\p{S}]|~)/u,fm=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,ud=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,dm=Re(ud,"u").replace(/punct/g,zo).getRegex(),pm=Re(ud,"u").replace(/punct/g,ad).getRegex(),cd="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",hm=Re(cd,"gu").replace(/notPunctSpace/g,sd).replace(/punctSpace/g,Va).replace(/punct/g,zo).getRegex(),mm=Re(cd,"gu").replace(/notPunctSpace/g,cm).replace(/punctSpace/g,um).replace(/punct/g,ad).getRegex(),gm=Re("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,sd).replace(/punctSpace/g,Va).replace(/punct/g,zo).getRegex(),ym=Re(/\\(punct)/,"gu").replace(/punct/g,zo).getRegex(),vm=Re(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),xm=Re(Wa).replace("(?:-->|$)","-->").getRegex(),wm=Re("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",xm).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ao=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,km=Re(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Ao).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),fd=Re(/^!?\[(label)\]\[(ref)\]/).replace("label",Ao).replace("ref",Ua).getRegex(),dd=Re(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ua).getRegex(),Sm=Re("reflink|nolink(?!\\()","g").replace("reflink",fd).replace("nolink",dd).getRegex(),Qa={_backpedal:gi,anyPunctuation:ym,autolink:vm,blockSkip:fm,br:od,code:om,del:gi,emStrongLDelim:dm,emStrongRDelimAst:hm,emStrongRDelimUnd:gm,escape:im,link:km,nolink:dd,punctuation:am,reflink:fd,reflinkSearch:Sm,tag:wm,text:sm,url:gi},Em={...Qa,link:Re(/^!?\[(label)\]\((.*?)\)/).replace("label",Ao).getRegex(),reflink:Re(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ao).getRegex()},Ia={...Qa,emStrongRDelimAst:mm,emStrongLDelim:pm,url:Re(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Tm={...Ia,br:Re(od).replace("{2,}","*").getRegex(),text:Re(Ia.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},_o={normal:Ha,gfm:rm,pedantic:lm},fi={normal:Qa,gfm:Ia,breaks:Tm,pedantic:Em},Cm={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Df=a=>Cm[a];function jn(a,i){if(i){if(Lt.escapeTest.test(a))return a.replace(Lt.escapeReplace,Df)}else if(Lt.escapeTestNoEncode.test(a))return a.replace(Lt.escapeReplaceNoEncode,Df);return a}function Mf(a){try{a=encodeURI(a).replace(Lt.percentDecode,"%")}catch{return null}return a}function Ff(a,i){var h;const s=a.replace(Lt.findPipe,(w,v,R)=>{let k=!1,A=v;for(;--A>=0&&R[A]==="\\";)k=!k;return k?"|":" |"}),c=s.split(Lt.splitPipe);let f=0;if(c[0].trim()||c.shift(),c.length>0&&!((h=c.at(-1))!=null&&h.trim())&&c.pop(),i)if(c.length>i)c.splice(i);else for(;c.length<i;)c.push("");for(;f<c.length;f++)c[f]=c[f].trim().replace(Lt.slashPipe,"|");return c}function di(a,i,s){const c=a.length;if(c===0)return"";let f=0;for(;f<c&&a.charAt(c-f-1)===i;)f++;return a.slice(0,c-f)}function _m(a,i){if(a.indexOf(i[1])===-1)return-1;let s=0;for(let c=0;c<a.length;c++)if(a[c]==="\\")c++;else if(a[c]===i[0])s++;else if(a[c]===i[1]Line truncated
`+o.stack}return{value:e,source:t,stack:l,digest:null}}function Ms(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Fs(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Sp=typeof WeakMap=="function"?WeakMap:Map;function xc(e,t,n){n=Yn(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){uo||(uo=!0,$s=r),Fs(e,t)},n}function wc(e,t,n){n=Yn(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=t.value;n.payload=function(){return r(l)},n.callback=function(){Fs(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Fs(e,t),typeof r!="function"&&(gr===null?gr=new Set([this]):gr.add(this));var u=t.stack;this.componentDidCatch(t.value,{componentStack:u!==null?u:""})}),n}function kc(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Sp;var l=new Set;r.set(t,l)}else l=r.get(t),l===void 0&&(l=new Set,r.set(t,l));l.has(n)||(l.add(n),e=Dp.bind(null,e,t,n),t.then(e,e))}function Sc(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Ec(e,t,n,r,l){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Yn(-1,1),t.tag=2,hr(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=l,e)}var Ep=le.ReactCurrentOwner,bt=!1;function Rt(e,t,n,r){t.child=e===null?Hu(t,null,n,r):al(t,e.child,n,r)}function Tc(e,t,n,r,l){n=n.render;var o=t.ref;return cl(t,l),r=Ns(e,t,n,r,o,l),n=Ls(),e!==null&&!bt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Kn(e,t,l)):(Fe&&n&&ds(t),t.flags|=1,Rt(e,t,r,l),t.child)}function Cc(e,t,n,r,l){if(e===null){var o=n.type;return typeof o=="function"&&!oa(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,_c(e,t,o,r,l)):(e=go(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,(e.lanes&l)===0){var u=o.memoizedProps;if(n=n.compare,n=n!==null?n:Bl,n(u,r)&&e.ref===t.ref)return Kn(e,t,l)}return t.flags|=1,e=wr(o,r),e.ref=t.ref,e.return=t,t.child=e}function _c(e,t,n,r,l){if(e!==null){var o=e.memoizedProps;if(Bl(o,r)&&e.ref===t.ref)if(bt=!1,t.pendingProps=r=o,(e.lanes&l)!==0)(e.flags&131072)!==0&&(bt=!0);else return t.lanes=e.lanes,Kn(e,t,l)}return bs(e,t,n,r,l)}function Rc(e,t,n){var r=t.pendingProps,l=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ze(hl,Xt),Xt|=n;else{if((n&1073741824)===0)return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ze(hl,Xt),Xt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,ze(hl,Xt),Xt|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,ze(hl,Xt),Xt|=r;return Rt(e,t,l,n),t.child}function Ac(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function bs(e,t,n,r,l){var o=Ft(n)?Nr:wt.current;return o=ll(t,o),cl(t,l),n=Ns(e,t,n,r,o,l),r=Ls(),e!==null&&!bt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Kn(e,t,l)):(Fe&&r&&ds(t),t.flags|=1,Rt(e,t,n,l),t.child)}function Nc(e,t,n,r,l){if(Ft(n)){var o=!0;Bi(t)}else o=!1;if(cl(t,l),t.stateNode===null)lo(e,t),yc(t,n,r),Ds(t,n,r,l),r=!0;else if(e===null){var u=t.stateNode,m=t.memoizedProps;u.props=m;var g=u.context,_=n.contextType;typeof _=="object"&&_!==null?_=ln(_):(_=Ft(n)?Nr:wt.current,_=ll(t,_));var P=n.getDerivedStateFromProps,j=typeof P=="function"||typeof u.getSnapshotBeforeUpdate=="function";j||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(m!==r||g!==_)&&vc(t,u,r,_),pr=!1;var z=t.memoizedState;u.state=z,qi(t,r,u,l),g=t.memoizedState,m!==r||z!==g||Mt.current||pr?(typeof P=="function"&&(Os(t,n,P,r),g=t.memoizedState),(m=pr||gc(t,n,m,r,z,g,_))?(j||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=g),u.props=r,u.state=g,u.context=_,r=m):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{u=t.stateNode,Qu(e,t),m=t.memoizedProps,_=t.type===t.elementType?m:vn(t.type,m),u.props=_,j=t.pendingProps,z=u.context,g=n.contextType,typeof g=="object"&&g!==null?g=ln(g):(g=Ft(n)?Nr:wt.current,g=ll(t,g));var B=n.getDerivedStateFromProps;(P=typeof B=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(m!==j||z!==g)&&vc(t,u,r,g),pr=!1,z=t.memoizedState,u.state=z,qi(t,r,u,Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vh(a,i){return mh(a)||gh(a,i)||xh(a,i)||yh()}function xh(a,i){if(a){if(typeof a=="string")return wf(a,i);var s={}.toString.call(a).slice(8,-1);return s==="Object"&&a.constructor&&(s=a.constructor.name),s==="Map"||s==="Set"?Array.from(a):s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?wf(a,i):void 0}}const $f=Object.entries,kf=Object.setPrototypeOf,wh=Object.isFrozen,kh=Object.getPrototypeOf,Sh=Object.getOwnPropertyDescriptor;let pt=Object.freeze,ht=Object.seal,kl=Object.create,ed=typeof Reflect<"u"&&Reflect,Na=ed.apply,La=ed.construct;pt||(pt=function(i){return i});ht||(ht=function(i){return i});Na||(Na=function(i,s){for(var c=arguments.length,f=new Array(c>2?c-2:0),h=2;h<c;h++)f[h-2]=arguments[h];return i.apply(s,f)});La||(La=function(i){for(var s=arguments.length,c=new Array(s>1?s-1:0),f=1;f<s;f++)c[f-1]=arguments[f];return new i(...c)});const yl=$e(Array.prototype.forEach),Eh=$e(Array.prototype.lastIndexOf),Sf=$e(Array.prototype.pop),vl=$e(Array.prototype.push),Th=$e(Array.prototype.splice),Er=Array.isArray,hi=$e(String.prototype.toLowerCase),va=$e(String.prototype.toString),Ef=$e(String.prototype.match),ui=$e(String.prototype.replace),Tf=$e(String.prototype.indexOf),Ch=$e(String.prototype.trim),_h=$e(Number.prototype.toString),Rh=$e(Boolean.prototype.toString),Cf=typeof BigInt>"u"?null:$e(BigInt.prototype.toString),_f=typeof Symbol>"u"?null:$e(Symbol.prototype.toString),at=$e(Object.prototype.hasOwnProperty),ci=$e(Object.prototype.toString),st=$e(RegExp.prototype.test),Br=Ah(TypeError);function $e(a){return function(i){i instanceof RegExp&&(i.lastIndex=0);for(var s=arguments.length,c=new Array(s>1?s-1:0),f=1;f<s;f++)c[f-1]=arguments[f];return Na(a,i,c)}}function Ah(a){return function(){for(var i=arguments.length,s=new Array(i),c=0;c<i;c++)s[c]=arguments[c];return La(a,s)}}function ve(a,i){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:hi;if(kf&&kf(a,null),!Er(i))return a;let c=i.length;for(;c--;){let f=i[c];if(typeof f=="string"){const h=s(f);h!==f&&(wh(i)||(i[c]=h),f=h)}a[f]=!0}return a}function Nh(a){for(let i=0;i<a.length;i++)at(a,i)||(a[i]=null);return a}function Nt(a){const i=kl(null);for(const c of $f(a)){var s=vh(c,2);const f=s[0],h=s[1];at(a,f)&&(Er(h)?i[f]=Nh(h):h&&typeof h=="object"&&h.constructor===Object?i[f]=Nt(h):i[f]=h)}return i}function Lh(a){switch(typeof a){case"string":return a;case"number":return _h(a);case"boolean":return Rh(a);case"bigint":return Cf?Cf(a):"0";case"symbol":return _f?_f(a):"Symbol()";case"undefined":return ci(a);case"function":case"object":{if(a===null)return ci(a);const i=a,s=Pn(i,"toString");if(typeof s=="function"){const c=s(i);return typeof c=="string"?c:ci(c)}return ci(a)}default:return ci(a)}}function Pn(a,i){for(;a!==null;){const c=Sh(a,i);if(c){if(c.get)return $e(c.get);if(typeof c.value=="function")return $e(c.value)}a=kh(a)}function s(){return null}return s}function Ih(a){try{return st(a,""),!0}catch{return!1}}const Rf=pt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),xa=pt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),wa=pt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),zh=pt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","sLine truncated
`+xt),ct&&(xt=_t(xt)),de&&tr?Be(xt):xt},i.setConfig=function(){let O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};El(O),En=!0,Mn=Te,un=Ae},i.clearConfig=function(){Dt=null,En=!1,Mn=null,un=null,de=Ge,Ee=""},i.isValidAttribute=function(O,d,T){Dt||El({});const I=Pe(O),H=Pe(d);return Rr(I,H,T)},i.addHook=function(O,d){typeof d=="function"&&at(y,O)&&vl(y[O],d)},i.removeHook=function(O,d){if(at(y,O)){if(d!==void 0){const T=Eh(y[O],d);return T===-1?void 0:Th(y[O],T,1)[0]}return Sf(y[O])}},i.removeHooks=function(O){at(y,O)&&(y[O]=[])},i.removeAllHooks=function(){y=jf()},i}var Yh=td();function Fa(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Hr=Fa();function nd(a){Hr=a}var gi={exec:()=>null};function Re(a,i=""){let s=typeof a=="string"?a:a.source;const c={replace:(f,h)=>{let w=typeof h=="string"?h:h.source;return w=w.replace(Lt.caret,"$1"),s=s.replace(f,w),c},getRegex:()=>new RegExp(s,i)};return c}var Lt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:a=>new RegExp(`^( {0,3}${a})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}#`),htmlBeginRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}<(?:[a-z].*>|!--)`,"i")},Kh=/^(?:[ \t]*(?:\n|$))+/,qh=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Xh=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,yi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Zh=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ba=/(?:[*+-]|\d{1,9}[.)])/,rd=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ld=Re(rd).replace(/bull/g,ba).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Jh=Re(rd).replace(/bull/g,ba).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ba=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,$h=/^[^\n]+/,Ua=/(?!\s*\])(?:\\.|[^\[\]\\])+/,em=Re(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ua).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),tm=Re(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ba).getRegex(),Io="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Wa=/\x3C!--(?:-?>|[\s\S]*?(?:-->|$))/,nm=Re("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(Line truncated
]`).replace("lheading",ld).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},om=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,sm=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,od=/^( {2,}|\\)\n(?!\s*$)/,am=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,zo=/[\p{P}\p{S}]/u,Va=/[\s\p{P}\p{S}]/u,sd=/[^\s\p{P}\p{S}]/u,um=Re(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Va).getRegex(),ad=/(?!~)[\p{P}\p{S}]/u,cm=/(?!~)[\s\p{P}\p{S}]/u,fm=/(?:[^\s\p{P}\p{S}]|~)/u,dm=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,ud=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,pm=Re(ud,"u").replace(/punct/g,zo).getRegex(),hm=Re(ud,"u").replace(/punct/g,ad).getRegex(),cd="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",mm=Re(cd,"gu").replace(/notPunctSpace/g,sd).replace(/punctSpace/g,Va).replace(/punct/g,zo).getRegex(),gm=Re(cd,"gu").replace(/notPunctSpace/g,fm).replace(/punctSpace/g,cm).replace(/punct/g,ad).getRegex(),ym=Re("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,sd).replace(/punctSpace/g,Va).replace(/punct/g,zo).getRegex(),vm=Re(/\\(punct)/,"gu").replace(/punct/g,zo).getRegex(),xm=Re(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),wm=Re(Wa).replace("(?:-->|$)","-->").getRegex(),km=Re("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",wm).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ao=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Sm=Re(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Ao).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),fd=Re(/^!?\[(label)\]\[(ref)\]/).replace("label",Ao).replace("ref",Ua).getRegex(),dd=Re(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ua).getRegex(),Em=Re("reflink|nolink(?!\\()","g").replace("reflink",fd).replace("nolink",dd).getRegex(),Qa={_backpedal:gi,anyPunctuation:vm,autolink:xm,blockSkip:dm,br:od,code:sm,del:gi,emStrongLDelim:pm,emStrongRDelimAst:mm,emStrongRDelimUnd:ym,escape:om,link:Sm,nolink:dd,punctuation:um,reflink:fd,reflinkSearch:Em,tag:km,text:am,url:gi},Tm={...Qa,link:Re(/^!?\[(label)\]\((.*?)\)/).replace("label",Ao).getRegex(),reflink:Re(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ao).getRegex()},Ia={...Qa,emStrongRDelimAst:gm,emStrongLDelim:hm,url:Re(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Cm={...Ia,br:Re(od).replace("{2,}","*").getRegex(),text:Re(Ia.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},_o={normal:Ha,gfm:lm,pedantic:im},fi={normal:Qa,gfm:Ia,breaks:Cm,pedantic:Tm},_m={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Df=a=>_m[a];function jn(a,i){if(i){if(Lt.escapeTest.test(a))return a.replace(Lt.escapeReplace,Df)}else if(Lt.escapeTestNoEncode.test(a))return a.replace(Lt.escapeReplaceNoEncode,Df);return a}function Mf(a){try{a=encodeURI(a).replace(Lt.percentDecode,"%")}catch{return null}return a}function Ff(a,i){var h;const s=a.replace(Lt.findPipe,(w,v,R)=>{let k=!1,A=v;for(;--A>=0&&R[A]==="\\";)k=!k;return k?"|":" |"}),c=s.split(Lt.splitPipe);let f=0;if(c[0].trim()||c.shift(),c.length>0&&!((h=c.at(-1))!=null&&h.trim())&&c.pop(),i)if(c.length>i)c.splice(i);else for(;c.length<i;)c.push("");for(;f<c.length;f++)c[f]=c[f].trim().replace(Lt.slashPipe,"|");return c}function di(a,i,s){const c=a.length;if(c===0)return"";let f=0;for(;f<c&&a.charAt(c-f-1)===i;)f++;return a.slice(0,c-f)}function Rm(a,i){if(a.indexOf(i[1])===-1)return-1;let s=0;for(let c=0;c<a.length;c++)if(a[c]==="\\")c++;else if(a[c]===i[0])s++;else if(a[c]===i[1]Line truncated
`).map(h=>{const w=h.match(s.other.beginningSpace);if(w===null)return h;const[v]=w;return v.length>=f.length?h.slice(f.length):h}).join(`
`)}var No=class{constructor(a){Ie(this,"options");Ie(this,"rules");Ie(this,"lexer");this.options=a||Hr}space(a){const i=this.rules.block.newline.exec(a);if(i&&i[0].length>0)return{type:"space",raw:i[0]}}code(a){const i=this.rules.block.code.exec(a);if(i){const s=i[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:i[0],codeBlockStyle:"indented",text:this.options.pedantic?s:di(s,`
`)}}}fences(a){const i=this.rules.block.fences.exec(a);if(i){const s=i[0],c=Rm(s,i[3]||"",this.rules);return{type:"code",raw:s,lang:i[2]?i[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):i[2],text:c}}}heading(a){const i=this.rules.block.heading.exec(a);if(i){let s=i[2].trim();if(this.rules.other.endingHash.test(s)){const c=di(s,"#");(this.options.pedantic||!c||this.rules.other.endingSpaceChar.test(c))&&(s=c.trim())}return{type:"heading",raw:i[0],depth:i[1].length,text:s,tokens:this.lexer.inline(s)}}}hr(a){const i=this.rules.block.hr.exec(a);if(i)return{type:"hr",raw:di(i[0],`
`)}}}fences(a){const i=this.rules.block.fences.exec(a);if(i){const s=i[0],c=Am(s,i[3]||"",this.rules);return{type:"code",raw:s,lang:i[2]?i[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):i[2],text:c}}}heading(a){const i=this.rules.block.heading.exec(a);if(i){let s=i[2].trim();if(this.rules.other.endingHash.test(s)){const c=di(s,"#");(this.options.pedantic||!c||this.rules.other.endingSpaceChar.test(c))&&(s=c.trim())}return{type:"heading",raw:i[0],depth:i[1].length,text:s,tokens:this.lexer.inline(s)}}}hr(a){const i=this.rules.block.hr.exec(a);if(i)return{type:"hr",raw:di(i[0],`
`)}}blockquote(a){const i=this.rules.block.blockquote.exec(a);if(i){let s=di(i[0],`
`).split(`
`),c="",f="";const h=[];for(;s.length>0;){let w=!1;const v=[];let R;for(R=0;R<s.length;R++)if(this.rules.other.blockquoteStart.test(s[R]))v.push(s[R]),w=!0;else if(!w)v.push(s[R]);else break;s=s.slice(R);const k=v.join(`
@@ -80,7 +80,7 @@ ${A}`:A;const M=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.block
`+N}!re&&!N.trim()&&(re=!0),k+=de+`
`,a=a.substring(de.length+1),M=Ee.slice(Y)}}f.loose||(w?f.loose=!0:this.rules.other.doubleBlankLine.test(k)&&(w=!0));let J=null,oe;this.options.gfm&&(J=this.rules.other.listIsTask.exec(A),J&&(oe=J[0]!=="[ ] ",A=A.replace(this.rules.other.listReplaceTask,""))),f.items.push({type:"list_item",raw:k,task:!!J,checked:oe,loose:!1,text:A,tokens:[]}),f.raw+=k}const v=f.items.at(-1);if(v)v.raw=v.raw.trimEnd(),v.text=v.text.trimEnd();else return;f.raw=f.raw.trimEnd();for(let R=0;R<f.items.length;R++)if(this.lexer.state.top=!1,f.items[R].tokens=this.lexer.blockTokens(f.items[R].text,[]),!f.loose){const k=f.items[R].tokens.filter(M=>M.type==="space"),A=k.length>0&&k.some(M=>this.rules.other.anyLine.test(M.raw));f.loose=A}if(f.loose)for(let R=0;R<f.items.length;R++)f.items[R].loose=!0;return f}}html(a){const i=this.rules.block.html.exec(a);if(i)return{type:"html",block:!0,raw:i[0],pre:i[1]==="pre"||i[1]==="script"||i[1]==="style",text:i[0]}}def(a){const i=this.rules.block.def.exec(a);if(i){const s=i[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),c=i[2]?i[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",f=i[3]?i[3].substring(1,i[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):i[3];return{type:"def",tag:s,raw:i[0],href:c,title:f}}}table(a){var w;const i=this.rules.block.table.exec(a);if(!i||!this.rules.other.tableDelimiter.test(i[2]))return;const s=Ff(i[1]),c=i[2].replace(this.rules.other.tableAlignChars,"").split("|"),f=(w=i[3])!=null&&w.trim()?i[3].replace(this.rules.other.tableRowBlankLine,"").split(`
`):[],h={type:"table",raw:i[0],header:[],align:[],rows:[]};if(s.length===c.length){for(const v of c)this.rules.other.tableAlignRight.test(v)?h.align.push("right"):this.rules.other.tableAlignCenter.test(v)?h.align.push("center"):this.rules.other.tableAlignLeft.test(v)?h.align.push("left"):h.align.push(null);for(let v=0;v<s.length;v++)h.header.push({text:s[v],tokens:this.lexer.inline(s[v]),header:!0,align:h.align[v]});for(const v of f)h.rows.push(Ff(v,h.header.length).map((R,k)=>({text:R,tokens:this.lexer.inline(R),header:!1,align:h.align[k]})));return h}}lheading(a){const i=this.rules.block.lheading.exec(a);if(i)return{type:"heading",raw:i[0],depth:i[2].charAt(0)==="="?1:2,text:i[1],tokens:this.lexer.inline(i[1])}}paragraph(a){const i=this.rules.block.paragraph.exec(a);if(i){const s=i[1].charAt(i[1].length-1)===`
`?i[1].slice(0,-1):i[1];return{type:"paragraph",raw:i[0],text:s,tokens:this.lexer.inline(s)}}}text(a){const i=this.rules.block.text.exec(a);if(i)return{type:"text",raw:i[0],text:i[0],tokens:this.lexer.inline(i[0])}}escape(a){const i=this.rules.inline.escape.exec(a);if(i)return{type:"escape",raw:i[0],text:i[1]}}tag(a){const i=this.rules.inline.tag.exec(a);if(i)return!this.lexer.state.inLink&&this.rules.other.startATag.test(i[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(i[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(i[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(i[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:i[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:i[0]}}link(a){const i=this.rules.inline.link.exec(a);if(i){const s=i[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(s)){if(!this.rules.other.endAngleBracket.test(s))return;const h=di(s.slice(0,-1),"\\");if((s.length-h.length)%2===0)return}else{const h=_m(i[2],"()");if(h===-2)return;if(h>-1){const v=(i[0].indexOf("!")===0?5:4)+i[1].length+h;i[2]=i[2].substring(0,h),i[0]=i[0].substring(0,v).trim(),i[3]=""}}let c=i[2],f="";if(this.options.pedantic){const h=this.rules.other.pedanticHrefTitle.exec(c);h&&(c=h[1],f=h[3])}else f=i[3]?i[3].slice(1,-1):"";return c=c.trim(),this.rules.other.startAngleBracket.test(c)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(s)?c=c.slice(1):c=c.slice(1,-1)),bf(i,{href:c&&c.replace(this.rules.inline.anyPunctuation,"$1"),title:f&&f.replace(this.rules.inline.anyPunctuation,"$1")},i[0],this.lexer,this.rules)}}reflink(a,i){let s;if((s=this.rules.inline.reflink.exec(a))||(s=this.rules.inline.nolink.exec(a))){const c=(s[2]||s[1]).replace(this.rules.other.multipleSpaceGlobal," "),f=i[c.toLowerCase()];if(!f){const h=s[0].charAt(0);return{type:"text",raw:h,text:h}}return bf(s,f,s[0],this.lexer,this.rules)}}emStrong(a,i,s=""){let c=this.rules.inline.emStrongLDelim.exec(a);if(!c||c[3]&&s.match(this.rules.other.unicodeAlphaNumeric))return;if(!(c[1]||c[2]||"")||!s||this.rules.inline.punctuation.exec(s)){const h=[...c[0]].length-1;let w,v,R=h,k=0;const A=c[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(A.lastIndex=0,i=i.slice(-1*a.length+h);(c=A.exec(i))!=null;){if(w=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!w)continue;if(v=[...w].length,c[3]||c[4]){R+=v;continue}else if((c[5]||c[6])&&h%3&&!((h+v)%3)){k+=v;continue}if(R-=v,R>0)continue;v=Math.min(v,v+R+k);const M=[...c[0]][0].length,N=a.slice(0,h+c.index+M+v);if(Math.min(h,v)%2){const Y=N.slice(1,-1);return{type:"em",raw:N,text:Y,tokens:this.lexer.inlineTokens(Y)}}const re=N.slice(2,-2);return{type:"strong",raw:N,text:re,tokens:this.lexer.inlineTokens(re)}}}}codespan(a){const i=this.rules.inline.code.exec(a);if(i){let s=i[2].replace(this.rules.other.newLineCharGlobal," ");const c=this.rules.other.nonSpaceChar.test(s),f=this.rules.other.startingSpaceChar.test(s)&&this.rules.other.endingSpaceChar.test(s);return c&&f&&(s=s.substring(1,s.length-1)),{type:"codespan",raw:i[0],text:s}}}br(a){const i=this.rules.inline.br.exec(a);if(i)return{type:"br",raw:i[0]}}del(a){const i=this.rules.inline.del.exec(a);if(i)return{type:"del",raw:i[0],text:i[2],tokens:this.lexer.inlineTokens(i[2])}}autolink(a){const i=this.rules.inline.autolink.exec(a);if(i){let s,c;return i[2]==="@"?(s=i[1],c="mailto:"+s):(s=i[1],c=s),{type:"link",raw:i[0],text:s,href:c,tokens:[{type:"text",raw:s,text:s}]}}}url(a){var s;let i;if(i=this.rules.inline.url.exec(a)){let c,f;if(i[2]==="@")c=i[0],f="mailto:"+c;else{let h;do h=i[0],i[0]=((s=this.rules.inline._backpedal.exec(i[0]))==null?void 0:s[0])??"";while(h!==i[0]);c=i[0],i[1]==="www."?f="http://"+i[0]:f=i[0]}return{type:"link",raw:i[0],text:c,href:f,tokens:[{type:"text",raw:c,text:c}]}}}inlineText(a){const i=this.rules.inline.text.exec(a);if(i){const s=this.lexer.state.inRawBlock;return{type:"text",raw:i[0],text:i[0],escaped:s}}}},Zn=class za{constructor(i){Ie(this,"tokens");Ie(this,"options");Ie(this,"state");Ie(this,"tokenizer");Ie(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=i||Hr,this.options.tokenizer=this.options.tokenizer||new No,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const s={other:Lt,block:_o.normal,inline:fi.normal};this.options.pedantic?(s.block=_o.pedantic,s.inline=fi.pedantic):this.options.gfm&&(s.block=_o.gfm,this.options.breaks?s.inline=fi.breaks:s.inline=fi.gfm),this.tokenizer.rules=s}static get rules(){return{block:_o,inline:fi}}static lex(i,s){return new za(s).lex(i)}static lexInline(i,s){return new za(s).inlineTokens(i)}lex(i){i=i.replace(Lt.carriageReturn,`
`?i[1].slice(0,-1):i[1];return{type:"paragraph",raw:i[0],text:s,tokens:this.lexer.inline(s)}}}text(a){const i=this.rules.block.text.exec(a);if(i)return{type:"text",raw:i[0],text:i[0],tokens:this.lexer.inline(i[0])}}escape(a){const i=this.rules.inline.escape.exec(a);if(i)return{type:"escape",raw:i[0],text:i[1]}}tag(a){const i=this.rules.inline.tag.exec(a);if(i)return!this.lexer.state.inLink&&this.rules.other.startATag.test(i[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(i[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(i[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(i[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:i[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:i[0]}}link(a){const i=this.rules.inline.link.exec(a);if(i){const s=i[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(s)){if(!this.rules.other.endAngleBracket.test(s))return;const h=di(s.slice(0,-1),"\\");if((s.length-h.length)%2===0)return}else{const h=Rm(i[2],"()");if(h===-2)return;if(h>-1){const v=(i[0].indexOf("!")===0?5:4)+i[1].length+h;i[2]=i[2].substring(0,h),i[0]=i[0].substring(0,v).trim(),i[3]=""}}let c=i[2],f="";if(this.options.pedantic){const h=this.rules.other.pedanticHrefTitle.exec(c);h&&(c=h[1],f=h[3])}else f=i[3]?i[3].slice(1,-1):"";return c=c.trim(),this.rules.other.startAngleBracket.test(c)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(s)?c=c.slice(1):c=c.slice(1,-1)),bf(i,{href:c&&c.replace(this.rules.inline.anyPunctuation,"$1"),title:f&&f.replace(this.rules.inline.anyPunctuation,"$1")},i[0],this.lexer,this.rules)}}reflink(a,i){let s;if((s=this.rules.inline.reflink.exec(a))||(s=this.rules.inline.nolink.exec(a))){const c=(s[2]||s[1]).replace(this.rules.other.multipleSpaceGlobal," "),f=i[c.toLowerCase()];if(!f){const h=s[0].charAt(0);return{type:"text",raw:h,text:h}}return bf(s,f,s[0],this.lexer,this.rules)}}emStrong(a,i,s=""){let c=this.rules.inline.emStrongLDelim.exec(a);if(!c||c[3]&&s.match(this.rules.other.unicodeAlphaNumeric))return;if(!(c[1]||c[2]||"")||!s||this.rules.inline.punctuation.exec(s)){const h=[...c[0]].length-1;let w,v,R=h,k=0;const A=c[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(A.lastIndex=0,i=i.slice(-1*a.length+h);(c=A.exec(i))!=null;){if(w=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!w)continue;if(v=[...w].length,c[3]||c[4]){R+=v;continue}else if((c[5]||c[6])&&h%3&&!((h+v)%3)){k+=v;continue}if(R-=v,R>0)continue;v=Math.min(v,v+R+k);const M=[...c[0]][0].length,N=a.slice(0,h+c.index+M+v);if(Math.min(h,v)%2){const Y=N.slice(1,-1);return{type:"em",raw:N,text:Y,tokens:this.lexer.inlineTokens(Y)}}const re=N.slice(2,-2);return{type:"strong",raw:N,text:re,tokens:this.lexer.inlineTokens(re)}}}}codespan(a){const i=this.rules.inline.code.exec(a);if(i){let s=i[2].replace(this.rules.other.newLineCharGlobal," ");const c=this.rules.other.nonSpaceChar.test(s),f=this.rules.other.startingSpaceChar.test(s)&&this.rules.other.endingSpaceChar.test(s);return c&&f&&(s=s.substring(1,s.length-1)),{type:"codespan",raw:i[0],text:s}}}br(a){const i=this.rules.inline.br.exec(a);if(i)return{type:"br",raw:i[0]}}del(a){const i=this.rules.inline.del.exec(a);if(i)return{type:"del",raw:i[0],text:i[2],tokens:this.lexer.inlineTokens(i[2])}}autolink(a){const i=this.rules.inline.autolink.exec(a);if(i){let s,c;return i[2]==="@"?(s=i[1],c="mailto:"+s):(s=i[1],c=s),{type:"link",raw:i[0],text:s,href:c,tokens:[{type:"text",raw:s,text:s}]}}}url(a){var s;let i;if(i=this.rules.inline.url.exec(a)){let c,f;if(i[2]==="@")c=i[0],f="mailto:"+c;else{let h;do h=i[0],i[0]=((s=this.rules.inline._backpedal.exec(i[0]))==null?void 0:s[0])??"";while(h!==i[0]);c=i[0],i[1]==="www."?f="http://"+i[0]:f=i[0]}return{type:"link",raw:i[0],text:c,href:f,tokens:[{type:"text",raw:c,text:c}]}}}inlineText(a){const i=this.rules.inline.text.exec(a);if(i){const s=this.lexer.state.inRawBlock;return{type:"text",raw:i[0],text:i[0],escaped:s}}}},Zn=class za{constructor(i){Ie(this,"tokens");Ie(this,"options");Ie(this,"state");Ie(this,"tokenizer");Ie(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=i||Hr,this.options.tokenizer=this.options.tokenizer||new No,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const s={other:Lt,block:_o.normal,inline:fi.normal};this.options.pedantic?(s.block=_o.pedantic,s.inline=fi.pedantic):this.options.gfm&&(s.block=_o.gfm,this.options.breaks?s.inline=fi.breaks:s.inline=fi.gfm),this.tokenizer.rules=s}static get rules(){return{block:_o,inline:fi}}static lex(i,s){return new za(s).lex(i)}static lexInline(i,s){return new za(s).inlineTokens(i)}lex(i){i=i.replace(Lt.carriageReturn,`
`),this.blockTokens(i,this.tokens);for(let s=0;s<this.inlineQueue.length;s++){const c=this.inlineQueue[s];this.inlineTokens(c.src,c.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(i,s=[],c=!1){var f,h,w;for(this.options.pedantic&&(i=i.replace(Lt.tabCharGlobal," ").replace(Lt.spaceLine,""));i;){let v;if((h=(f=this.options.extensions)==null?void 0:f.block)!=null&&h.some(k=>(v=k.call({lexer:this},i,s))?(i=i.substring(v.raw.length),s.push(v),!0):!1))continue;if(v=this.tokenizer.space(i)){i=i.substring(v.raw.length);const k=s.at(-1);v.raw.length===1&&k!==void 0?k.raw+=`
`:s.push(v);continue}if(v=this.tokenizer.code(i)){i=i.substring(v.raw.length);const k=s.at(-1);(k==null?void 0:k.type)==="paragraph"||(k==null?void 0:k.type)==="text"?(k.raw+=`
`+v.raw,k.text+=`
@@ -109,13 +109,13 @@ ${this.parser.parse(a)}</blockquote>
${a}</tr>
`}tablecell(a){const i=this.parser.parseInline(a.tokens),s=a.header?"th":"td";return(a.align?`<${s} align="${a.align}">`:`<${s}>`)+i+`</${s}>
`}strong({tokens:a}){return`<strong>${this.parser.parseInline(a)}</strong>`}em({tokens:a}){return`<em>${this.parser.parseInline(a)}</em>`}codespan({text:a}){return`<code>${jn(a,!0)}</code>`}br(a){return"<br>"}del({tokens:a}){return`<del>${this.parser.parseInline(a)}</del>`}link({href:a,title:i,tokens:s}){const c=this.parser.parseInline(s),f=Mf(a);if(f===null)return c;a=f;let h='<a href="'+a+'"';return i&&(h+=' title="'+jn(i)+'"'),h+=">"+c+"</a>",h}image({href:a,title:i,text:s,tokens:c}){c&&(s=this.parser.parseInline(c,this.parser.textRenderer));const f=Mf(a);if(f===null)return jn(s);a=f;let h=`<img src="${a}" alt="${s}"`;return i&&(h+=` title="${jn(i)}"`),h+=">",h}text(a){return"tokens"in a&&a.tokens?this.parser.parseInline(a.tokens):"escaped"in a&&a.escaped?a.text:jn(a.text)}},Ga=class{strong({text:a}){return a}em({text:a}){return a}codespan({text:a}){return a}del({text:a}){return a}html({text:a}){return a}text({text:a}){return a}link({text:a}){return""+a}image({text:a}){return""+a}br(){return""}},Jn=class Pa{constructor(i){Ie(this,"options");Ie(this,"renderer");Ie(this,"textRenderer");this.options=i||Hr,this.options.renderer=this.options.renderer||new Lo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ga}static parse(i,s){return new Pa(s).parse(i)}static parseInline(i,s){return new Pa(s).parseInline(i)}parse(i,s=!0){var f,h;let c="";for(let w=0;w<i.length;w++){const v=i[w];if((h=(f=this.options.extensions)==null?void 0:f.renderers)!=null&&h[v.type]){const k=v,A=this.options.extensions.renderers[k.type].call({parser:this},k);if(A!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(k.type)){c+=A||"";continue}}const R=v;switch(R.type){case"space":{c+=this.renderer.space(R);continue}case"hr":{c+=this.renderer.hr(R);continue}case"heading":{c+=this.renderer.heading(R);continue}case"code":{c+=this.renderer.code(R);continue}case"table":{c+=this.renderer.table(R);continue}case"blockquote":{c+=this.renderer.blockquote(R);continue}case"list":{c+=this.renderer.list(R);continue}case"html":{c+=this.renderer.html(R);continue}case"paragraph":{c+=this.renderer.paragraph(R);continue}case"text":{let k=R,A=this.renderer.text(k);for(;w+1<i.length&&i[w+1].type==="text";)k=i[++w],A+=`
`+this.renderer.text(k);s?c+=this.renderer.paragraph({type:"paragraph",raw:A,text:A,tokens:[{type:"text",raw:A,text:A,escaped:!0}]}):c+=A;continue}default:{const k='Token with "'+R.type+'" type was not found.';if(this.options.silent)return console.error(k),"";throw new Error(k)}}}return c}parseInline(i,s=this.renderer){var f,h;let c="";for(let w=0;w<i.length;w++){const v=i[w];if((h=(f=this.options.extensions)==null?void 0:f.renderers)!=null&&h[v.type]){const k=this.options.extensions.renderers[v.type].call({parser:this},v);if(k!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(v.type)){c+=k||"";continue}}const R=v;switch(R.type){case"escape":{c+=s.text(R);break}case"html":{c+=s.html(R);break}case"link":{c+=s.link(R);break}case"image":{c+=s.image(R);break}case"strong":{c+=s.strong(R);break}case"em":{c+=s.em(R);break}case"codespan":{c+=s.codespan(R);break}case"br":{c+=s.br(R);break}case"del":{c+=s.del(R);break}case"text":{c+=s.text(R);break}default:{const k='Token with "'+R.type+'" type was not found.';if(this.options.silent)return console.error(k),"";throw new Error(k)}}}return c}},Ra,Ro=(Ra=class{constructor(a){Ie(this,"options");Ie(this,"block");this.options=a||Hr}preprocess(a){return a}postprocess(a){return a}processAllTokens(a){return a}provideLexer(){return this.block?Zn.lex:Zn.lexInline}provideParser(){return this.block?Jn.parse:Jn.parseInline}},Ie(Ra,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),Ra),Am=class{constructor(...a){Ie(this,"defaults",Fa());Ie(this,"options",this.setOptions);Ie(this,"parse",this.parseMarkdown(!0));Ie(this,"parseInline",this.parseMarkdown(!1));Ie(this,"Parser",Jn);Ie(this,"Renderer",Lo);Ie(this,"TextRenderer",Ga);Ie(this,"Lexer",Zn);Ie(this,"Tokenizer",No);Ie(this,"Hooks",Ro);this.use(...a)}walkTokens(a,i){var c,f;let s=[];for(const h of a)switch(s=s.concat(i.call(this,h)),h.type){case"table":{const w=h;for(const v of w.header)s=s.concat(this.walkTokens(v.tokens,i));for(const v of w.rows)for(const R of v)s=s.concat(this.walkTokens(R.tokens,i));break}case"list":{const w=h;s=s.concat(this.walkTokens(w.items,i));break}default:{const w=h;(f=(c=this.defaults.extensions)==null?void 0:c.childTokens)!=null&&f[w.type]?this.defaults.extensions.childTokens[w.type].forEach(v=>{const R=w[v].flat(1/0);s=s.concat(this.walkTokens(R,i))}):w.tokens&&(s=s.concat(this.walkTokens(w.tokens,i)))}}return s}use(...a){const i=this.defaults.extensions||{renderers:{},childTokens:{}};return a.forEach(s=>{const c={...s};if(c.async=this.defaults.async||c.async||!1,s.extensions&&(s.extensions.forEach(f=>{if(!f.name)throw new Error("extension name required");if("renderer"in f){const h=i.renderers[f.name];h?i.renderers[f.name]=function(...w){let v=f.renderer.apply(this,w);return v===!1&&(v=h.apply(this,w)),v}:i.renderers[f.name]=f.renderer}if("tokenizer"in f){if(!f.level||f.level!=="block"&&f.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const h=i[f.level];h?h.unshift(f.tokenizer):i[f.level]=[f.tokenizer],f.start&&(f.level==="block"?i.startBlock?i.startBlock.push(f.start):i.startBlock=[f.start]:f.level==="inline"&&(i.startInline?i.startInline.push(f.start):i.startInline=[f.start]))}"childTokens"in f&&f.childTokens&&(i.childTokens[f.name]=f.childTokens)}),c.extensions=i),s.renderer){const f=this.defaults.renderer||new Lo(this.defaults);for(const h in s.renderer){if(!(h in f))throw new Error(`renderer '${h}' does not exist`);if(["options","parser"].includes(h))continue;const w=h,v=s.renderer[w],R=f[w];f[w]=(...k)=>{let A=v.apply(f,k);return A===!1&&(A=R.apply(f,k)),A||""}}c.renderer=f}if(s.tokenizer){const f=this.defaults.tokenizer||new No(this.defaults);for(const h in s.tokenizer){if(!(h in f))throw new Error(`tokenizer '${h}' does not exist`);if(["options","rules","lexer"].includes(h))continue;const w=h,v=s.tokenizer[w],R=f[w];f[w]=(...k)=>{let A=v.apply(f,k);return A===!1&&(A=R.apply(f,k)),A}}c.tokenizer=f}if(s.hooks){const f=this.defaults.hooks||new Ro;for(const h in s.hooks){if(!(h in f))throw new Error(`hook '${h}' does not exist`);if(["options","block"].includes(h))continue;const w=h,v=s.hooks[w],R=f[w];Ro.passThroughHooks.has(h)?f[w]=k=>{if(this.defaults.async)return Promise.resolve(v.call(f,k)).then(M=>R.call(f,M));const A=v.call(f,k);return R.call(f,A)}:f[w]=(...k)=>{let A=v.apply(f,k);return A===!1&&(A=R.apply(f,k)),A}}c.hooks=f}if(s.walkTokens){const f=this.defaults.walkTokens,h=s.walkTokens;c.walkTokens=function(w){let v=[];return v.push(h.call(this,w)),f&&(v=v.concat(f.call(this,w))),v}}this.defaults={...this.defaults,...c}}),this}setOptions(a){return this.defaults={...this.defaults,...a},this}lexer(a,i){return Zn.lex(a,i??this.defaults)}parser(a,i){return Jn.parse(a,i??this.defaults)}parseMarkdown(a){return(s,c)=>{const f={...c},h={...this.defaults,...f},w=this.onError(!!h.silent,!!h.async);if(this.defaults.async===!0&&f.async===!1)return w(new Error("marked(): The async option was set to tLine truncated
Please report this to https://github.com/markedjs/marked.`,a){const c="<p>An error occurred:</p><pre>"+jn(s.message+"",!0)+"</pre>";return i?Promise.resolve(c):c}if(i)return Promise.reject(s);throw s}}},Wr=new Am;function _e(a,i){return Wr.parse(a,i)}_e.options=_e.setOptions=function(a){return Wr.setOptions(a),_e.defaults=Wr.defaults,nd(_e.defaults),_e};_e.getDefaults=Fa;_e.defaults=Hr;_e.use=function(...a){return Wr.use(...a),_e.defaults=Wr.defaults,nd(_e.defaults),_e};_e.walkTokens=function(a,i){return Wr.walkTokens(a,i)};_e.parseInline=Wr.parseInline;_e.Parser=Jn;_e.parser=Jn.parse;_e.Renderer=Lo;_e.TextRenderer=Ga;_e.Lexer=Zn;_e.lexer=Zn.lex;_e.Tokenizer=No;_e.Hooks=Ro;_e.parse=_e;_e.options;_e.setOptions;_e.use;_e.walkTokens;_e.parseInline;Jn.parse;Zn.lex;const ja={items:[],running:!1,usage:null,streamKind:"",turnEnded:!1,model:""},Nm={approved:"已允许",denied:"已拒绝",timeout:"已超时(按拒绝处理)",cancelled:"已取消"};function Bf(a){switch(a){case"allowed":return"已允许";case"rejected":return"已拒绝";case"expired":return"(已过期)";default:return Nm[a]??a}}function Uf(a,i,s){const c=a.items.slice(),f=c[c.length-1];return a.streamKind===i&&f&&f.kind===i?c[c.length-1]={...f,text:f.text+s}:c.push({kind:i,text:s}),{...a,items:c,streamKind:i}}function Ur(a,i){return{...a,items:[...a.items,i],streamKind:""}}function Wf(a){return a.map(i=>i.kind==="perm"&&i.state==="open"?{...i,state:"expired"}:i)}function Lm(a,i,s){const c=a.items.slice();for(let f=c.length-1;f>=0;f--){const h=c[f];if(!(h.kind!=="tool"||h.tcId!==i)){switch(s.kind){case"subagent_tool":{const w=(h.subItems??[]).slice(),v=w.findIndex(k=>k.id===s.id),R={id:s.id??String(w.length),title:s.title??"",status:s.status??"run"};v>=0?w[v]={...R,title:R.title||w[v].title}:w.push(R),c[f]={...h,subItems:w};break}case"output":c[f]={...h,lastLine:s.line};break;case"child_session":c[f]={...h,childSessionId:s.childSessionId};break}return{...a,items:c}}}return a}function Im(a,i){var s,c;switch(i.sessionUpdate){case"agent_message_chunk":return Uf(a,"agent",((s=i.content)==null?void 0:s.text)??"");case"agent_thought_chunk":return Uf(a,"thought",((c=i.content)==null?void 0:c.text)??"");case"tool_call":return Ur(a,{kind:"tool",tcId:i.toolCallId??"",title:i.title||i.kind||"工具调用",status:"run",out:""});case"tool_call_update":{if(i.status==="in_progress")return i.progress?Lm(a,i.toolCallId??"",i.progress):a;const f=a.items.slice();for(let h=f.length-1;h>=0;h--){const w=f[h];if(w.kind==="tool"&&w.tcId===i.toolCallId){const v=typeof i.rawOutput=="string"?i.rawOutput.split(`
`)[0].slice(0,160):"";f[h]={...w,status:i.status==="completed"?"ok":"fail",out:v,lastLine:void 0};break}}return{...a,items:f}}case"plan":{const f=a.items.slice();for(let h=f.length-1;h>=0;h--)if(f[h].kind==="plan")return f[h]={kind:"plan",entries:i.entries??[]},{...a,items:f,streamKind:""};return Ur(a,{kind:"plan",entries:i.entries??[]})}case"llm_call_retry":return Ur(a,{kind:"sys",text:`模型调用重试 #${i.attempt??"?"}: ${i.message??""}`});case"usage_update":return{...a,usage:{used:i.used??0,size:i.size??0}};case"compact_status":return Ur(a,{kind:"sys",text:i.status==="started"?"⟳ 上下文接近上限,正在压缩…":"⟳ 上下文压缩完成"});case"model_update":{const f=i.model??"";return{...Ur(a,{kind:"sys",text:`模型已切换为 ${f}`}),model:f}}default:return a}}function zm(a,i){switch(i.type){case"task-started":return{...a,running:!0};case"task-ended":return{...a,running:!1,streamKind:"",turnEnded:!0,items:[...Wf(a.items),{kind:"sys",text:"— 本轮结束 —"}]};case"task-error":{const s=ai(i);return{...a,running:!1,streamKind:"",items:[...Wf(a.items),{kind:"sys",text:"✗ "+((s==null?void 0:s.error)||"未知错误"),error:!0}]}}case"user-input":{const s=ai(i);let c="";try{c=s!=null&&s.content?Da(s.content):""}catch{c=(s==null?void 0:s.content)??""}return Ur(a,{kind:"user",text:c})}case"permission-req":{const s=ai(i);return s!=null&&s.id?Ur(a,{kind:"perm",id:s.id,title:s.title??"",tool:s.tool??"",state:"open"}):a}case"permission-resolved":{const s=ai(i);return s!=null&&s.id?{...a,items:a.items.map(c=>c.kind==="perm"&&c.id===s.id&&c.state==="open"?{...c,state:s.outcome??"expired"}:c)}:a}case"task-running":if(i.kind==="acp_event"){const s=ai(i);if(s!=null&&s.update)return Im(a,s.update)}return a;default:return a}}function pd(a,i){let s=a;for(const c of i)s=zm(s,c);return s}function Pm(a,i,s){return{...a,items:a.items.map(c=>c.kind==="perm"&&c.id===i&&c.state==="open"?{...c,state:s?"allowed":"rejected"}:c)}}_e.setOptions({gfm:!0,breaks:!0});const Tt="ui-monospace,Menlo,monospace";function jm({text:a}){const i=Z.useMemo(()=>Gh.sanitize(_e.parse(a,{async:!1})),[a]);return p.jsx("div",{className:"md",dangerouslySetInnerHTML:{__html:i}})}function Om({meta:a,active:i,onClick:s}){const c=a.status==="running"?{text:"运行中",color:"var(--amberT)"}:a.status==="error"?{text:"出错",color:"var(--err)"}:a.status==="interrupted"?{text:"已中断",color:"var(--t5)"}:{text:a.turns>0?a.turns+" 轮":"",color:"var(--t5)"};return p.jsx("div",{className:"hv-cardh",title:a.workdir,onClick:s,style:{background:i?"var(--card2)":"transparent",borderRadius:10,padding:"9px 13px",cursor:"pointer"},children:p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,fontWeight:i?600:400,color:i?"var(--t1)":"var(--t3)",whiteSpace:"nowrap"},children:[p.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:a.title||"(未命名)"}),a.worktree&&p.jsx("span",{title:"隔离 worktree 会话",style:{flex:"none",fontSize:10,fontWeight:600,color:"var(--amberT)",background:"var(--amberBg)",borderRadius:5,padding:"1px 6px"},children:"隔离"}),p.jsx("span",{style:{marginLeft:"auto",fontSize:11,fontWeight:400,color:c.color},children:c.text})]})})}function Dm({text:a}){const[i,s]=Z.useState(!1),c=a.trim().split(`
`)[0]||"…";return p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[p.jsxs("div",{className:"hv-t3",onClick:()=>s(!i),style:{display:"flex",alignItems:"center",gap:9,fontSize:12,color:"var(--t4)",cursor:"pointer",whiteSpace:"nowrap",minWidth:0},children:[p.jsx("span",{style:{flex:"none"},children:"✦ 思考"}),p.jsxs("span",{style:{color:"var(--t5)",overflow:"hidden",textOverflow:"ellipsis"},children:["— ",c]}),p.jsx("span",{style:{color:"var(--t5)",flex:"none"},children:i?"▾":"▸"})]}),i&&p.jsx("div",{style:{borderLeft:"2px solid var(--line)",padding:"2px 0 2px 14px",fontSize:12.5,color:"var(--t4)",lineHeight:1.8,whiteSpace:"pre-wrap",animation:"mcin .2s ease"},children:a})]})}function Mm({entries:a}){const i=s=>s==="completed"?"☑":s==="in_progress"?"◐":"☐";return p.jsx("div",{style:{border:"1px solid var(--line)",borderRadius:14,background:"var(--card)",padding:"13px 16px",fontSize:12.5,display:"flex",flexDirection:"column",gap:4,animation:"mcin .25s ease"},children:a.map((s,c)=>p.jsxs("div",{style:{color:s.status==="completed"?"var(--t5)":s.status==="in_progress"?"var(--amberT)":"var(--t3)",textDecoration:s.status==="completed"?"line-through":"none"},children:[p.jsx("span",{style:{display:"inline-block",width:18},children:i(s.status)})," ",s.content]},c))})}function Hf(a){return a==="run"?"◌":a==="ok"?"✓":"✗"}const Vf=5;function Fm({item:a,radius:i,onOpenChild:s}){const c=a.subItems??[],f=c.length-Vf,h=a.title.indexOf(" "),w=h>0?a.title.slice(0,h):"",v=h>0?a.title.slice(h+1):a.title,R={display:"flex",gap:8,alignItems:"baseline",padding:"0 14px 7px 35px",font:"11.5px/1.7 "+Tt,color:"var(--t4)",whiteSpace:"nowrap",minWidth:0};return p.jsxs("div",{style:{background:"var(--card)",borderRadius:i,overflow:"hidden"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"9px 14px",fontSize:12.5,whiteSpace:"nowrap",minWidth:0},children:[p.jsx("span",{style:{color:a.status==="run"?"var(--t4)":a.status==="ok"?"var(--ok)":"var(--err)",fontSize:11,flex:"none",display:"inline-block",animation:a.status==="run"?"mcspin 1s linear infinite":"none"},children:Hf(a.status)}),w&&p.jsx("span",{style:{color:"var(--t3)",flex:"none"},children:w}),p.jsx("span",{style:{font:"12px "+Tt,color:"var(--t1)",overflow:"hidden",textOverflow:"ellipsis"},children:v}),a.childSessionId&&s&&p.jsx("span",{className:"hv-t1",onClick:()=>s(a.childSessionId),style:{font:"11.5px "+Tt,color:"var(--amberT)",cursor:"pointer",flex:"none"},children:"查看子会话"}),a.out&&p.jsx("span",{style:{marginLeft:"auto",color:"var(--t5)",fontSize:11,flex:"none",maxWidth:"45%",overflow:"hidden",textOverflow:"ellipsis"},children:a.out})]}),f>0&&p.jsxs("div",{style:{...R,color:"var(--t5)"},children:[p.jsx("span",{style:{flex:"none"},children:"↳"}),"… 已省略前 ",f," 步"]}),c.slice(-Vf).map(k=>p.jsxs("div",{style:R,children:[p.jsx("span",{style:{color:"var(--t5)",flex:"none"},children:"↳"}),p.jsx("span",{style:{color:k.status==="run"?"var(--t4)":k.status==="ok"?"var(--ok)":"var(--err)",fontSize:10,flex:"none"},children:Hf(k.status)}),p.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",minWidth:0},children:k.title})]},k.id)),a.status==="run"&&a.lastLine&&p.jsxs("div",{style:{...R,display:"block",color:"var(--t5)",fontStyle:"italic",overflow:"hidden",textOverflow:"ellipsis",animation:"mcpulse 1.2s infinite"},children:["↳ ",a.lastLine]})]})}function Qf(a){switch(a){case"allowed":case"approved":return{text:"✓ 已允许",color:"var(--ok)"};case"rejected":case"denied":return{text:"✕ 已拒绝",color:"var(--err)"};case"timeout":return{text:"✕ "+Bf(a),color:"var(--err)"};default:return{text:Bf(a),color:"var(--t5)"}}}function bm({item:a,onAnswer:i}){const s={padding:"7px 18px",background:"var(--card2)",color:"var(--t2)",borderRadius:9,cursor:"pointer"};return p.jsxs("div",{style:{border:"1px solid var(--amberBd)",borderRadius:14,background:"var(--amberBg)",padding:"15px 17px",maxWidth:540,animation:"mcin .25s ease"},children:[p.jsxs("div",{style:{fontSize:13,fontWeight:600,color:"var(--amberT)",whiteSpace:"nowrap"},children:["需要确认 · ",a.tool||"执行操作"]}),p.jsx("div",{style:{margin:"10px 0 12px",padding:"9px 13px",background:"var(--codeBg)",borderRadius:9,font:"12.5px "+Tt,color:"var(--t1)",wordBreak:"break-all"},children:a.title}),a.state==="open"?p.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",fontSize:12.5,fontWeight:600,flexWrap:"wrap"},children:[p.jsx("div",{className:"hv-op",onClick:()=>i(a.id,"allow"),style:{...s,background:"var(--amber)",color:"var(--onAmber)"},children:"允许"}),p.jsx("div",{className:"hv-cardh",onClick:()=>i(a.id,"always"),style:s,children:"本会话始终"}),p.jsx("div",{className:"hv-cardh",onClick:()=>i(a.id,"persist"),style:s,children:"此项目永久"}),p.jsx("div",{className:"hv-err",onClick:()=>i(a.id,"deny"),style:{padding:"7px 14px",color:"var(--t4)",borderRadius:9,cursor:"pointer"},children:"拒绝"}),p.jsx("Line truncated
`)){const h=f.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(h){s=+h[1],c=+h[2],i.push({no:"",text:f,kind:"h"});continue}f.startsWith("diff ")||f.startsWith("index ")||f.startsWith("+++")||f.startsWith("---")||f.startsWith("new file")||f.startsWith("deleted file")||f.startsWith("similarity")||f.startsWith("rename")||f.startsWith("old mode")||f.startsWith("new mode")||(f.startsWith("+")?i.push({no:String(c++),text:f,kind:"add"}):f.startsWith("-")?i.push({no:String(s++),text:f,kind:"del"}):(i.push({no:String(c),text:f,kind:"ctx"}),s++,c++))}return i}function Wm({text:a}){const i=Z.useMemo(()=>Um(a),[a]);return i.some(s=>s.kind==="h")?p.jsx("div",{style:{font:"12px/1.9 "+Tt},children:i.map((s,c)=>s.kind==="h"?p.jsxs("div",{style:{display:"flex",padding:"2px 24px",background:"var(--card)",color:"var(--t4)",fontSize:11},children:[p.jsx("span",{style:{width:36,flex:"none"}}),p.jsx("span",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all"},children:s.text})]},c):p.jsxs("div",{style:{display:"flex",padding:"0 24px",background:s.kind==="add"?"var(--addBg)":s.kind==="del"?"var(--delBg)":"transparent",color:s.kind==="add"?"var(--addT)":s.kind==="del"?"var(--delT)":"var(--t3)"},children:[p.jsx("span",{style:{width:36,color:"var(--t5)",flex:"none",opacity:.6},children:s.no}),p.jsx("span",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",minWidth:0},children:s.text||" "})]},c))}):p.jsx("pre",{style:{margin:0,padding:"10px 24px",font:"12px/1.9 "+Tt,color:"var(--t4)",whiteSpace:"pre-wrap"},children:a})}const Gf="data:image/png;base64,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 truncated
`)){const f=c.indexOf("=");if(f<=0)continue;const h=c.slice(0,f).trim();h&&(i[h]=c.slice(f+1).trim(),s++)}return s?i:void 0}const Hm=a=>a&&typeof a=="object"?Object.entries(a).map(([i,s])=>`${i}=${String(s)}`).join(`
`):"";function Vm(a){const i={};for(const s of a){const c=s.name.trim();if(c)if(s.type==="stdio"){if(!s.command.trim())continue;const f=s.args.trim()?s.args.trim().split(/\s+/):void 0;i[c]={command:s.command.trim(),args:f,env:Yf(s.kv)}}else{if(!s.url.trim())continue;i[c]={url:s.url.trim(),headers:Yf(s.kv)}}}return i}function Qm(a){return Object.entries(a).map(([i,s])=>{const c=s??{},f=typeof c.command=="string"&&c.command!=="";return{name:i,type:f?"stdio":"http",url:typeof c.url=="string"?c.url:"",command:typeof c.command=="string"?c.command:"",args:Array.isArray(c.args)?c.args.map(String).join(" "):"",kv:Hm(f?c.env:c.headers)}})}const xl={width:588,maxWidth:"100%",background:"var(--card)",border:"1px solid var(--line)",borderRadius:16,padding:18,boxSizing:"border-box"},Xn={width:"100%",background:"var(--codeBg)",border:"1px solid var(--line)",borderRadius:9,padding:"8px 11px",font:"11.5px "+Tt,color:"var(--t1)",outline:"none",minWidth:0,boxSizing:"border-box"},Kf={background:"var(--codeBg)",border:"1px solid var(--line)",borderRadius:9,padding:"8px 8px",fontSize:12,color:"var(--t1)",outline:"none",cursor:"pointer"},Ea={padding:"7px 14px",background:"var(--card2)",borderRadius:9,cursor:"pointer",fontSize:12,fontWeight:600,color:"var(--t2)",whiteSpace:"nowrap",userSelect:"none"};function Sn({label:a,children:i}){return p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsx("div",{style:{fontSize:11,color:"var(--t4)",marginBottom:4},children:a}),i]})}function Gm(){try{return localStorage.getItem("mc.theme")==="light"?"light":"dark"}catch{return"dark"}}function Ym(a){document.documentElement.classList.toggle("light",a==="light");try{localStorage.setItem("mc.theme",a)}catch{}}function Km(){const[a,i]=Z.useState(Gm()),s=f=>{Ym(f),i(f)},c=(f,h)=>p.jsx("div",{onClick:()=>s(f),style:{padding:"6px 18px",fontSize:12.5,fontWeight:600,borderRadius:8,cursor:"pointer",userSelect:"none",background:a===f?"var(--amber)":"transparent",color:a===f?"var(--onAmber)":"var(--t3)"},children:h});return p.jsxs("div",{style:{display:"inline-flex",background:"var(--card)",borderRadius:10,padding:3,gap:2},children:[c("dark","深色"),c("light","浅色")]})}const qf=()=>({name:"",provider:"anthropic",base_url:"",api_key:"",model:""}),qm=()=>({name:"",type:"http",url:"",command:"",args:"",kv:""});function Xm({onClose:a}){const i=Aa(),[s,c]=Z.useState([]),[f,h]=Z.useState(0),[w,v]=Z.useState([]),[R,k]=Z.useState(!1),[A,M]=Z.useState(""),[N,re]=Z.useState(!1);Z.useEffect(()=>{i&&uh().then(Q=>{const W=(Q==null?void 0:Q.models)??[];c(W.length?W:[qf()]),h(Math.max(0,W.findIndex(q=>q.default))),v(Qm((Q==null?void 0:Q.mcp_servers)??{})),k(!0)}).catch(Q=>M("读取配置失败: "+(Q instanceof Error?Q.message:String(Q))))},[i]);const Y=(Q,W)=>c(q=>q.map((le,he)=>he===Q?{...le,...W}:le)),J=(Q,W)=>v(q=>q.map((le,he)=>he===Q?{...le,...W}:le)),oe=async()=>{for(const W of s)if(!W.name.trim()||!W.base_url.trim()||!W.api_key.trim()||!W.model.trim()){M(`模型「${W.name.trim()||"未命名"}」信息不完整(需名称/接口地址/API Key/模型标识)`);return}const Q=new Set;for(const W of s){if(Q.has(W.name.trim())){M(`模型名称重复: ${W.name.trim()}`);return}Q.add(W.name.trim())}M(""),re(!0);try{await ch({models:s.map((W,q)=>({...W,name:W.name.trim(),default:q===f})),mcp_servers:Vm(w)})}catch(W){M(W instanceof Error?W.message:String(W)),re(!1)}};return p.jsx("div",{style:{flex:1,overflowY:"auto",animation:"mcin .25s ease"},children:p.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:14,padding:"40px 24px 60px"},children:[p.jsxs("div",{style:{width:588,maxWidth:"100%",display:"flex",alignItems:"center"},children:[p.jsx("div",{style:{fontSize:18,fontWeight:700,color:"var(--t1)",letterSpacing:"-.01em"},children:"设置"}),p.jsx("div",{className:"hv-cardh",onClick:a,style:{...Ea,marginLeft:"auto"},children:"返回"})]}),p.jsx("div",{style:{width:588,maxWidth:"100%",display:"flex",alignItems:"center",marginTop:6},children:p.jsx("span",{style:{font:"600 10.5px system-ui",color:"var(--t4)",letterSpacing:".1em"},children:"外观"})}),p.jsxs("div",{style:{...xl,display:"flex",alignItems:"center",gap:12},children:[p.jsx(Km,{}),p.jsx("span",{style:{fontSize:12,color:"var(--t5)"},children:"跟随本机保存,重启后保持。"})]}),!i&&p.jsx("div",{style:{...xl,color:"var(--t4)",fontSize:12.5,lineHeight:1.7},children:"浏览器模式下配置只读:模型与 MCP 由启动 mc-agent 的宿主(桌面应用或环境变量)管理。"}),i&&!R&&!A&&p.jsx("div",{style:{fontSize:12.5,color:"var(--t5)"},children:"读取配置中…"}),i&&R&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{width:588,maxWidth:"100%",display:"flex",alignItems:"center",marginTop:6},children:[p.jsx("span",{style:{font:"600 10.5px system-ui",color:"var(--t4)",letterSpacing:".1em"},children:"模型"}),p.jsx("div",{className:"hv-cardh",onClick:()=>c(Q=>[...Q,qf()]),style:{...Ea,marginLeft:"auto",padding:"4px 10px"},children:"+ 添加模型"})]}),s.length==Line truncated
`+this.renderer.text(k);s?c+=this.renderer.paragraph({type:"paragraph",raw:A,text:A,tokens:[{type:"text",raw:A,text:A,escaped:!0}]}):c+=A;continue}default:{const k='Token with "'+R.type+'" type was not found.';if(this.options.silent)return console.error(k),"";throw new Error(k)}}}return c}parseInline(i,s=this.renderer){var f,h;let c="";for(let w=0;w<i.length;w++){const v=i[w];if((h=(f=this.options.extensions)==null?void 0:f.renderers)!=null&&h[v.type]){const k=this.options.extensions.renderers[v.type].call({parser:this},v);if(k!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(v.type)){c+=k||"";continue}}const R=v;switch(R.type){case"escape":{c+=s.text(R);break}case"html":{c+=s.html(R);break}case"link":{c+=s.link(R);break}case"image":{c+=s.image(R);break}case"strong":{c+=s.strong(R);break}case"em":{c+=s.em(R);break}case"codespan":{c+=s.codespan(R);break}case"br":{c+=s.br(R);break}case"del":{c+=s.del(R);break}case"text":{c+=s.text(R);break}default:{const k='Token with "'+R.type+'" type was not found.';if(this.options.silent)return console.error(k),"";throw new Error(k)}}}return c}},Ra,Ro=(Ra=class{constructor(a){Ie(this,"options");Ie(this,"block");this.options=a||Hr}preprocess(a){return a}postprocess(a){return a}processAllTokens(a){return a}provideLexer(){return this.block?Zn.lex:Zn.lexInline}provideParser(){return this.block?Jn.parse:Jn.parseInline}},Ie(Ra,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),Ra),Nm=class{constructor(...a){Ie(this,"defaults",Fa());Ie(this,"options",this.setOptions);Ie(this,"parse",this.parseMarkdown(!0));Ie(this,"parseInline",this.parseMarkdown(!1));Ie(this,"Parser",Jn);Ie(this,"Renderer",Lo);Ie(this,"TextRenderer",Ga);Ie(this,"Lexer",Zn);Ie(this,"Tokenizer",No);Ie(this,"Hooks",Ro);this.use(...a)}walkTokens(a,i){var c,f;let s=[];for(const h of a)switch(s=s.concat(i.call(this,h)),h.type){case"table":{const w=h;for(const v of w.header)s=s.concat(this.walkTokens(v.tokens,i));for(const v of w.rows)for(const R of v)s=s.concat(this.walkTokens(R.tokens,i));break}case"list":{const w=h;s=s.concat(this.walkTokens(w.items,i));break}default:{const w=h;(f=(c=this.defaults.extensions)==null?void 0:c.childTokens)!=null&&f[w.type]?this.defaults.extensions.childTokens[w.type].forEach(v=>{const R=w[v].flat(1/0);s=s.concat(this.walkTokens(R,i))}):w.tokens&&(s=s.concat(this.walkTokens(w.tokens,i)))}}return s}use(...a){const i=this.defaults.extensions||{renderers:{},childTokens:{}};return a.forEach(s=>{const c={...s};if(c.async=this.defaults.async||c.async||!1,s.extensions&&(s.extensions.forEach(f=>{if(!f.name)throw new Error("extension name required");if("renderer"in f){const h=i.renderers[f.name];h?i.renderers[f.name]=function(...w){let v=f.renderer.apply(this,w);return v===!1&&(v=h.apply(this,w)),v}:i.renderers[f.name]=f.renderer}if("tokenizer"in f){if(!f.level||f.level!=="block"&&f.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const h=i[f.level];h?h.unshift(f.tokenizer):i[f.level]=[f.tokenizer],f.start&&(f.level==="block"?i.startBlock?i.startBlock.push(f.start):i.startBlock=[f.start]:f.level==="inline"&&(i.startInline?i.startInline.push(f.start):i.startInline=[f.start]))}"childTokens"in f&&f.childTokens&&(i.childTokens[f.name]=f.childTokens)}),c.extensions=i),s.renderer){const f=this.defaults.renderer||new Lo(this.defaults);for(const h in s.renderer){if(!(h in f))throw new Error(`renderer '${h}' does not exist`);if(["options","parser"].includes(h))continue;const w=h,v=s.renderer[w],R=f[w];f[w]=(...k)=>{let A=v.apply(f,k);return A===!1&&(A=R.apply(f,k)),A||""}}c.renderer=f}if(s.tokenizer){const f=this.defaults.tokenizer||new No(this.defaults);for(const h in s.tokenizer){if(!(h in f))throw new Error(`tokenizer '${h}' does not exist`);if(["options","rules","lexer"].includes(h))continue;const w=h,v=s.tokenizer[w],R=f[w];f[w]=(...k)=>{let A=v.apply(f,k);return A===!1&&(A=R.apply(f,k)),A}}c.tokenizer=f}if(s.hooks){const f=this.defaults.hooks||new Ro;for(const h in s.hooks){if(!(h in f))throw new Error(`hook '${h}' does not exist`);if(["options","block"].includes(h))continue;const w=h,v=s.hooks[w],R=f[w];Ro.passThroughHooks.has(h)?f[w]=k=>{if(this.defaults.async)return Promise.resolve(v.call(f,k)).then(M=>R.call(f,M));const A=v.call(f,k);return R.call(f,A)}:f[w]=(...k)=>{let A=v.apply(f,k);return A===!1&&(A=R.apply(f,k)),A}}c.hooks=f}if(s.walkTokens){const f=this.defaults.walkTokens,h=s.walkTokens;c.walkTokens=function(w){let v=[];return v.push(h.call(this,w)),f&&(v=v.concat(f.call(this,w))),v}}this.defaults={...this.defaults,...c}}),this}setOptions(a){return this.defaults={...this.defaults,...a},this}lexer(a,i){return Zn.lex(a,i??this.defaults)}parser(a,i){return Jn.parse(a,i??this.defaults)}parseMarkdown(a){return(s,c)=>{const f={...c},h={...this.defaults,...f},w=this.onError(!!h.silent,!!h.async);if(this.defaults.async===!0&&f.async===!1)return w(new Error("marked(): The async option was set to tLine truncated
Please report this to https://github.com/markedjs/marked.`,a){const c="<p>An error occurred:</p><pre>"+jn(s.message+"",!0)+"</pre>";return i?Promise.resolve(c):c}if(i)return Promise.reject(s);throw s}}},Wr=new Nm;function _e(a,i){return Wr.parse(a,i)}_e.options=_e.setOptions=function(a){return Wr.setOptions(a),_e.defaults=Wr.defaults,nd(_e.defaults),_e};_e.getDefaults=Fa;_e.defaults=Hr;_e.use=function(...a){return Wr.use(...a),_e.defaults=Wr.defaults,nd(_e.defaults),_e};_e.walkTokens=function(a,i){return Wr.walkTokens(a,i)};_e.parseInline=Wr.parseInline;_e.Parser=Jn;_e.parser=Jn.parse;_e.Renderer=Lo;_e.TextRenderer=Ga;_e.Lexer=Zn;_e.lexer=Zn.lex;_e.Tokenizer=No;_e.Hooks=Ro;_e.parse=_e;_e.options;_e.setOptions;_e.use;_e.walkTokens;_e.parseInline;Jn.parse;Zn.lex;const ja={items:[],running:!1,usage:null,streamKind:"",turnEnded:!1,model:""},Lm={approved:"已允许",denied:"已拒绝",timeout:"已超时(按拒绝处理)",cancelled:"已取消"};function Bf(a){switch(a){case"allowed":return"已允许";case"rejected":return"已拒绝";case"expired":return"(已过期)";default:return Lm[a]??a}}function Uf(a,i,s){const c=a.items.slice(),f=c[c.length-1];return a.streamKind===i&&f&&f.kind===i?c[c.length-1]={...f,text:f.text+s}:c.push({kind:i,text:s}),{...a,items:c,streamKind:i}}function Ur(a,i){return{...a,items:[...a.items,i],streamKind:""}}function Wf(a){return a.map(i=>i.kind==="perm"&&i.state==="open"?{...i,state:"expired"}:i)}function Im(a,i,s){const c=a.items.slice();for(let f=c.length-1;f>=0;f--){const h=c[f];if(!(h.kind!=="tool"||h.tcId!==i)){switch(s.kind){case"subagent_tool":{const w=(h.subItems??[]).slice(),v=w.findIndex(k=>k.id===s.id),R={id:s.id??String(w.length),title:s.title??"",status:s.status??"run"};v>=0?w[v]={...R,title:R.title||w[v].title}:w.push(R),c[f]={...h,subItems:w};break}case"output":c[f]={...h,lastLine:s.line};break;case"child_session":c[f]={...h,childSessionId:s.childSessionId};break}return{...a,items:c}}}return a}function zm(a,i){var s,c;switch(i.sessionUpdate){case"agent_message_chunk":return Uf(a,"agent",((s=i.content)==null?void 0:s.text)??"");case"agent_thought_chunk":return Uf(a,"thought",((c=i.content)==null?void 0:c.text)??"");case"tool_call":return Ur(a,{kind:"tool",tcId:i.toolCallId??"",title:i.title||i.kind||"工具调用",status:"run",out:""});case"tool_call_update":{if(i.status==="in_progress")return i.progress?Im(a,i.toolCallId??"",i.progress):a;const f=a.items.slice();for(let h=f.length-1;h>=0;h--){const w=f[h];if(w.kind==="tool"&&w.tcId===i.toolCallId){const v=typeof i.rawOutput=="string"?i.rawOutput.split(`
`)[0].slice(0,160):"";f[h]={...w,status:i.status==="completed"?"ok":"fail",out:v,lastLine:void 0};break}}return{...a,items:f}}case"plan":{const f=a.items.slice();for(let h=f.length-1;h>=0;h--)if(f[h].kind==="plan")return f[h]={kind:"plan",entries:i.entries??[]},{...a,items:f,streamKind:""};return Ur(a,{kind:"plan",entries:i.entries??[]})}case"llm_call_retry":return Ur(a,{kind:"sys",text:`模型调用重试 #${i.attempt??"?"}: ${i.message??""}`});case"usage_update":return{...a,usage:{used:i.used??0,size:i.size??0}};case"compact_status":return Ur(a,{kind:"sys",text:i.status==="started"?"⟳ 上下文接近上限,正在压缩…":"⟳ 上下文压缩完成"});case"model_update":{const f=i.model??"";return{...Ur(a,{kind:"sys",text:`模型已切换为 ${f}`}),model:f}}default:return a}}function Pm(a,i){switch(i.type){case"task-started":return{...a,running:!0};case"task-ended":return{...a,running:!1,streamKind:"",turnEnded:!0,items:[...Wf(a.items),{kind:"sys",text:"— 本轮结束 —"}]};case"task-error":{const s=ai(i);return{...a,running:!1,streamKind:"",items:[...Wf(a.items),{kind:"sys",text:"✗ "+((s==null?void 0:s.error)||"未知错误"),error:!0}]}}case"user-input":{const s=ai(i);let c="";try{c=s!=null&&s.content?Da(s.content):""}catch{c=(s==null?void 0:s.content)??""}return Ur(a,{kind:"user",text:c})}case"permission-req":{const s=ai(i);return s!=null&&s.id?Ur(a,{kind:"perm",id:s.id,title:s.title??"",tool:s.tool??"",state:"open"}):a}case"permission-resolved":{const s=ai(i);return s!=null&&s.id?{...a,items:a.items.map(c=>c.kind==="perm"&&c.id===s.id&&c.state==="open"?{...c,state:s.outcome??"expired"}:c)}:a}case"task-running":if(i.kind==="acp_event"){const s=ai(i);if(s!=null&&s.update)return zm(a,s.update)}return a;default:return a}}function pd(a,i){let s=a;for(const c of i)s=Pm(s,c);return s}function jm(a,i,s){return{...a,items:a.items.map(c=>c.kind==="perm"&&c.id===i&&c.state==="open"?{...c,state:s?"allowed":"rejected"}:c)}}_e.setOptions({gfm:!0,breaks:!0});const Tt="ui-monospace,Menlo,monospace";function Om(a){const i=a.target.closest("a");if(!i)return;a.preventDefault();const s=i.getAttribute("href")||"";/^https?:/i.test(s)&&fh(s)}function Dm({text:a}){const i=Z.useMemo(()=>Yh.sanitize(_e.parse(a,{async:!1})),[a]);return p.jsx("div",{className:"md",onClick:Om,dangerouslySetInnerHTML:{__html:i}})}function Mm({meta:a,active:i,onClick:s}){const c=a.status==="running"?{text:"运行中",color:"var(--amberT)"}:a.status==="error"?{text:"出错",color:"var(--err)"}:a.status==="interrupted"?{text:"已中断",color:"var(--t5)"}:{text:a.turns>0?a.turns+" 轮":"",color:"var(--t5)"};return p.jsx("div",{className:"hv-cardh",title:a.workdir,onClick:s,style:{background:i?"var(--card2)":"transparent",borderRadius:10,padding:"9px 13px",cursor:"pointer"},children:p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,fontWeight:i?600:400,color:i?"var(--t1)":"var(--t3)",whiteSpace:"nowrap"},children:[p.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:a.title||"(未命名)"}),a.worktree&&p.jsx("span",{title:"隔离 worktree 会话",style:{flex:"none",fontSize:10,fontWeight:600,color:"var(--amberT)",background:"var(--amberBg)",borderRadius:5,padding:"1px 6px"},children:"隔离"}),p.jsx("span",{style:{marginLeft:"auto",fontSize:11,fontWeight:400,color:c.color},children:c.text})]})})}function Fm({text:a}){const[i,s]=Z.useState(!1),c=a.trim().split(`
`)[0]||"…";return p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[p.jsxs("div",{className:"hv-t3",onClick:()=>s(!i),style:{display:"flex",alignItems:"center",gap:9,fontSize:12,color:"var(--t4)",cursor:"pointer",whiteSpace:"nowrap",minWidth:0},children:[p.jsx("span",{style:{flex:"none"},children:"✦ 思考"}),p.jsxs("span",{style:{color:"var(--t5)",overflow:"hidden",textOverflow:"ellipsis"},children:["— ",c]}),p.jsx("span",{style:{color:"var(--t5)",flex:"none"},children:i?"▾":"▸"})]}),i&&p.jsx("div",{style:{borderLeft:"2px solid var(--line)",padding:"2px 0 2px 14px",fontSize:12.5,color:"var(--t4)",lineHeight:1.8,whiteSpace:"pre-wrap",animation:"mcin .2s ease"},children:a})]})}function bm({entries:a}){const i=s=>s==="completed"?"☑":s==="in_progress"?"◐":"☐";return p.jsx("div",{style:{border:"1px solid var(--line)",borderRadius:14,background:"var(--card)",padding:"13px 16px",fontSize:12.5,display:"flex",flexDirection:"column",gap:4,animation:"mcin .25s ease"},children:a.map((s,c)=>p.jsxs("div",{style:{color:s.status==="completed"?"var(--t5)":s.status==="in_progress"?"var(--amberT)":"var(--t3)",textDecoration:s.status==="completed"?"line-through":"none"},children:[p.jsx("span",{style:{display:"inline-block",width:18},children:i(s.status)})," ",s.content]},c))})}function Hf(a){return a==="run"?"◌":a==="ok"?"✓":"✗"}const Vf=5;function Bm({item:a,radius:i,onOpenChild:s}){const c=a.subItems??[],f=c.length-Vf,h=a.title.indexOf(" "),w=h>0?a.title.slice(0,h):"",v=h>0?a.title.slice(h+1):a.title,R={display:"flex",gap:8,alignItems:"baseline",padding:"0 14px 7px 35px",font:"11.5px/1.7 "+Tt,color:"var(--t4)",whiteSpace:"nowrap",minWidth:0};return p.jsxs("div",{style:{background:"var(--card)",borderRadius:i,overflow:"hidden"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"9px 14px",fontSize:12.5,whiteSpace:"nowrap",minWidth:0},children:[p.jsx("span",{style:{color:a.status==="run"?"var(--t4)":a.status==="ok"?"var(--ok)":"var(--err)",fontSize:11,flex:"none",display:"inline-block",animation:a.status==="run"?"mcspin 1s linear infinite":"none"},children:Hf(a.status)}),w&&p.jsx("span",{style:{color:"var(--t3)",flex:"none"},children:w}),p.jsx("span",{style:{font:"12px "+Tt,color:"var(--t1)",overflow:"hidden",textOverflow:"ellipsis"},children:v}),a.childSessionId&&s&&p.jsx("span",{className:"hv-t1",onClick:()=>s(a.childSessionId),style:{font:"11.5px "+Tt,color:"var(--amberT)",cursor:"pointer",flex:"none"},children:"查看子会话"}),a.out&&p.jsx("span",{style:{marginLeft:"auto",color:"var(--t5)",fontSize:11,flex:"none",maxWidth:"45%",overflow:"hidden",textOverflow:"ellipsis"},children:a.out})]}),f>0&&p.jsxs("div",{style:{...R,color:"var(--t5)"},children:[p.jsx("span",{style:{flex:"none"},children:"↳"}),"… 已省略前 ",f," 步"]}),c.slice(-Vf).map(k=>p.jsxs("div",{style:R,children:[p.jsx("span",{style:{color:"var(--t5)",flex:"none"},children:"↳"}),p.jsx("span",{style:{color:k.status==="run"?"var(--t4)":k.status==="ok"?"var(--ok)":"var(--err)",fontSize:10,flex:"none"},children:Hf(k.status)}),p.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",minWidth:0},children:k.title})]},k.id)),a.status==="run"&&a.lastLine&&p.jsxs("div",{style:{...R,display:"block",color:"var(--t5)",fontStyle:"italic",overflow:"hidden",textOverflow:"ellipsis",animation:"mcpulse 1.2s infinite"},children:["↳ ",a.lastLine]})]})}function Qf(a){switch(a){case"allowed":case"approved":return{text:"✓ 已允许",color:"var(--ok)"};case"rejected":case"denied":return{text:"✕ 已拒绝",color:"var(--err)"};case"timeout":return{text:"✕ "+Bf(a),color:"var(--err)"};default:return{text:Bf(a),color:"var(--t5)"}}}function Um({item:a,onAnswer:i}){const s={padding:"7px 18px",background:"var(--card2)",color:"var(--t2)",borderRadius:9,cursor:"pointer"};return p.jsxs("div",{style:{border:"1px solid var(--amberBd)",borderRadius:14,background:"var(--amberBg)",padding:"15px 17px",maxWidth:540,animation:"mcin .25s ease"},children:[p.jsxs("div",{style:{fontSize:13,fontWeight:600,color:"var(--amberT)",whiteSpace:"nowrap"},children:["需要确认 · ",a.tool||"执行操作"]}),p.jsx("div",{style:{margin:"10px 0 12px",padding:"9px 13px",background:"var(--codeBg)",borderRadius:9,font:"12.5px "+Tt,color:"var(--t1)",wordBreak:"break-all"},children:a.title}),a.state==="open"?p.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",fontSize:12.5,fontWeight:600,flexWrap:"wrap"},children:[p.jsx("div",{className:"hv-op",onClick:()=>i(a.id,"allow"),style:{...s,background:"var(--amber)",color:"var(--onAmber)"},children:"允许"}),p.jsx("div",{className:"hv-cardh",onClick:()=>i(a.id,"always"),style:s,children:"本会话始终"}),p.jsx("div",{className:"hv-cardh",onClick:()=>i(a.id,"persist"),style:s,children:"此项目永久"}),p.jsx("div",{className:"hv-err",onClick:()=>i(a.id,"deny"),style:{padding:"7px 14px",color:"var(--t4)",borderRadius:9,cursor:"pointer"},children:"拒绝"}),p.jsx("Line truncated
`)){const h=f.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(h){s=+h[1],c=+h[2],i.push({no:"",text:f,kind:"h"});continue}f.startsWith("diff ")||f.startsWith("index ")||f.startsWith("+++")||f.startsWith("---")||f.startsWith("new file")||f.startsWith("deleted file")||f.startsWith("similarity")||f.startsWith("rename")||f.startsWith("old mode")||f.startsWith("new mode")||(f.startsWith("+")?i.push({no:String(c++),text:f,kind:"add"}):f.startsWith("-")?i.push({no:String(s++),text:f,kind:"del"}):(i.push({no:String(c),text:f,kind:"ctx"}),s++,c++))}return i}function Vm({text:a}){const i=Z.useMemo(()=>Hm(a),[a]);return i.some(s=>s.kind==="h")?p.jsx("div",{style:{font:"12px/1.9 "+Tt},children:i.map((s,c)=>s.kind==="h"?p.jsxs("div",{style:{display:"flex",padding:"2px 24px",background:"var(--card)",color:"var(--t4)",fontSize:11},children:[p.jsx("span",{style:{width:36,flex:"none"}}),p.jsx("span",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all"},children:s.text})]},c):p.jsxs("div",{style:{display:"flex",padding:"0 24px",background:s.kind==="add"?"var(--addBg)":s.kind==="del"?"var(--delBg)":"transparent",color:s.kind==="add"?"var(--addT)":s.kind==="del"?"var(--delT)":"var(--t3)"},children:[p.jsx("span",{style:{width:36,color:"var(--t5)",flex:"none",opacity:.6},children:s.no}),p.jsx("span",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",minWidth:0},children:s.text||" "})]},c))}):p.jsx("pre",{style:{margin:0,padding:"10px 24px",font:"12px/1.9 "+Tt,color:"var(--t4)",whiteSpace:"pre-wrap"},children:a})}const Gf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAqiklEQVR42u1dB3xUVfb+3ps+kx5CCB0EEQVlBZUiglRhseEq6toLKLpiZ1fR1cX2d1fXhoKKYGFRRFBUiiIiAgqKIlV6JwkJKZNMy5T3/+59byaTELDsRorv5je/STJvXrnn3FO/c65V44A5frfDak6ByQDmMBnAHCYDmMNkAHOYDGAOkwHMYTKAOUwGMIfJAOYwGcAcJgOYw2QAc5gMYA6TAcxhMoA5TAYwh8kA5jAZwBwmA5jDZABzmAxgDpMBzGEywDE0NPnSEu9iKPwRw2K8mwxwjBE8ZpBcJYFVSe44oZVj/vmV32NlkCB2lC9B6NqruioWxY6IF1sjpdgaLsPOmA+bouXo726BEe6O8rvKMcQYvxsGEA8Z5VqvTXRvLISVwX1YEtiDryKF2IBy7LL6ELBEKfN5nC8IBMKUlXbsbnwjmlhSpcRQjxEmOOZVgCCWeFlJMvESIz9Sic99u/BR1TZ8qRVgt5VEtsb0L5SFoe71wrFrP9Q1e6F2bgVfzxboFs6WxE+2CUwGOMIJL34sJLpYrYFYBB/7t2Cqbz3mR/PhdZLgNj5+sQ/29QWwfLMN2ood0DYWQiuqAMorEXM5EPt8NEVHBPdmnKarCC1KwaBAyk3yQdxm0I5SqWA9Ngkft9gVbImUYVL5akwNbsFWhx+w89OCStjn7YIyfz2wbDPA1R6rophXKCFs/KbLptv/Dw9F1QmZONuXgws8beT57YqlTvtQZ4Kjz2y0HmuGXVzMr64qwtOl32JaZCv8Hk0sVTiW7Iby4ffQFqwDduwnt1AKOO36y+OAEtMkBbWyAJQebRG6tBPc+yN4tdnAhOrID1fSOCzHFhqIO2IV2KFVYq/mw6MZPTDY0fKosw+OCQaIcNp1Ha9gY1Up/lG6BP+JbIbmtsJSGYVrxmpoU79CjCIeVREobhI83SUtQ00QnfJciRq2cESTn0X/fh7/H0VezIWHSxfj+1gR9ighlFjD+jIX0kLoAZ/4O4h3rJtMBjhc4l4Qv5zW/MOlSzHOtxpVKfTny6pgf20ZtClfQ9tQwINoDaToKx0kuhaNIS6zlTi9LCSqtxLR0YMQ6dsOln2V2JKicbVvAPwRYL8f6s5SWHeWQd1eBmVbMZTRA+A/LhPDnMcdlQai9Whf9WK8XbkedxZ/gfyUKggN7ZhAor+6CNhaBNVBome4DY6JGQ6hoauVmlpcfmSzQfmO9sFHqwAS2rqpCJYtJPTOItoOXnoJtCMiZD0tAK1rR4RaN0DbSCoGeFrKs6gmA/w2/rwgflE0gBH7PsHMyCYgzQPHp9uBxz8CftgBxcmVnunhwfyGWO3KoQhjfCbUAdWDZeFGqAt+1L8nrqiq0IRxSCkiPtcYH1AqyHx/6Stn8HbnyfJ+glQZzriRaDJA/Yh8IWLFZM8ObMPVRXNQ7IrBXkQijf4PtGkrSCsSJjNFJ3wkVot1fs5FBBPYDAmhJHhD2AqJmFlFCFrHJogOOIG/+7EzrULemyB+VNoAR48qUI8W4kcN40pM65jSL/HHohkoTlfhmPMjtCH/hjJ1OZQUp1yhkvDJAU7l4NKk5m9anNOMV0yXAtGk80k1wVVeWEFvYj2sqan4v/D3aLvjNczybZHup/iJQjNDwf9L4luMSb0kfxZmRDfCYnFCHTsbykufQ3FQkLl0witxUa/8tCo5hDI4+PGaIRkiUelRRPueCMsd5yDUJZf2QSVGpnXBCzn95HmS7RSTAf5L4vu0MPrvnY6vrIWw0zfXbp4MZdEGKGkp1aJb0uanGeDnPLBysOPjf8TVgzegM9/IPojeMYBepB9dYjn4sPFFaGTx8G8ygaKaDPBrdb4Q+34tgp6738Z3jhI4t3oRveplqJv26da9WIlJ5FKkMa8TR/kvGODnco9C11ETqsLrQ/TME2B77koE8uxo4rdjcYs/o6Ul7YhmgiOWAZLDqn33vocF6h44tnkRu/gFJmvK9UBOOFrTn1Nqrd/6ZAKl1omsJHCpD7Hm2bBMGo5gx2w0DzixrOnlaKS6E5LMNAJ/weoX45biBVig7IKjIIDY5S9ByacvnuasSXyltsjXfpGI/9USIPl3IYnodqp7yxC79AU4V5VgpzOIAbunISQSSLxi7Ag0DNUjNcgjJmxK5Qa8GPgOtgjdq+GToGxn/D7VCa2Ge3cIa007NCsoP4cRtFqvg/KYYRjSE1EYLIpd+RJc2yqxWi3GNYVz/nup83thgHjuvoBInL+Ufs4JTYX24Eyo32xJ0vl1hPK0A725/2rWtV/xXRoginAZBRMUliEy8nU4ww68HVyPNyrXSaaOIGYywM+RsH/dvwSlKVHYZ62FOnkpxX6KLvZxYFBPonwsFlitZB2+i2CQRRV/W+T/D7XOtZ8gvKoqifOI88pzx6+lqjWMz4RGIhMoGR5YvtuK2NhZZNw03L5/IQpjfsncR5IqOKKMwLih9F3VPnQueheWML2Ac/4JhbF4MEcvXL1k4gsCKLSuA8EgtJDf+K9Fhm71uH9U8rjVzTCxg+AO4v2SH1c7hIQQRBbHB/0i9l9loD+sOqWjYf2LFjtcHup9egLRaLROiaBVhhikGolgr2a4UW2Plxv0P6LiA0dkKPjpiu+44u2wPrOQmby9tPhTddGvVBvgFq5Av89HqRBCi+PaonfPHuhyaie0aN4MLpcLPn62Zes2fLX8WyxavBT79u6GxZXCzxyIRKK1iK/VYCox/GUlRH840LnzqTirRzd0POlENM5rJKXNvqIirPtxA77geb9a9g20cBiejHQyTExnsPjpVF0saE/PgbXbSLweXYe70jujnS3riEkbW48UHH6MEyd85c0EW0wP79QNqUlfQCER9KRMtagVRBIEat/hZPztnjtwwZDBSM1qeBA/jVHbPTvw5n/ewdPPv4j8XbvgyczkitXRgjUmg6Le52Nghyv/kksvxaiRw9G9K6FgNg+qY8RJmjMWxJLFX+HRJ5/GnI/nwMGwsIX3FtOM44QqoD0Q+3oLrPPWInhBO7xYvhLPNuhTIzZwOBnhsKgAHYsfk0Sq7Rs/WfoNRivLYX9nJXDT6zLLl8wAgvjBinLcPPJmPPPPx2B3p1MK+BDhKhSPoiTpiPjfVifdRtWJ/QW7Mere+zDlzbfgTMvQWc94fKHTfaVlaNW2DSY8/2/0HzhIN0lDFVJiSAPPsDh06aHpdoEzRf7vxXEv4La7/0aciIUZZYsONBGHSYwBmapXe4TfJqq4yorNTa6thpYleT7xuoRjWgLE9bzFWEUVBHLsDHv5HkYGiTQrQIyegxM4e/UBGTUx4QFvKR4ZOxb3jxlDwleiykeAhiVu7B3Es6iqIhH9yG6YjbfeeAOndOyAe/82Bk7qb2lAipVfWoIze/fGrHfeQmbDxuSpUsk8usF3cH0Line truncated
`)){const f=c.indexOf("=");if(f<=0)continue;const h=c.slice(0,f).trim();h&&(i[h]=c.slice(f+1).trim(),s++)}return s?i:void 0}const Qm=a=>a&&typeof a=="object"?Object.entries(a).map(([i,s])=>`${i}=${String(s)}`).join(`
`):"";function Gm(a){const i={};for(const s of a){const c=s.name.trim();if(c)if(s.type==="stdio"){if(!s.command.trim())continue;const f=s.args.trim()?s.args.trim().split(/\s+/):void 0;i[c]={command:s.command.trim(),args:f,env:Yf(s.kv)}}else{if(!s.url.trim())continue;i[c]={url:s.url.trim(),headers:Yf(s.kv)}}}return i}function Ym(a){return Object.entries(a).map(([i,s])=>{const c=s??{},f=typeof c.command=="string"&&c.command!=="";return{name:i,type:f?"stdio":"http",url:typeof c.url=="string"?c.url:"",command:typeof c.command=="string"?c.command:"",args:Array.isArray(c.args)?c.args.map(String).join(" "):"",kv:Qm(f?c.env:c.headers)}})}const xl={width:588,maxWidth:"100%",background:"var(--card)",border:"1px solid var(--line)",borderRadius:16,padding:18,boxSizing:"border-box"},Xn={width:"100%",background:"var(--codeBg)",border:"1px solid var(--line)",borderRadius:9,padding:"8px 11px",font:"11.5px "+Tt,color:"var(--t1)",outline:"none",minWidth:0,boxSizing:"border-box"},Kf={background:"var(--codeBg)",border:"1px solid var(--line)",borderRadius:9,padding:"8px 8px",fontSize:12,color:"var(--t1)",outline:"none",cursor:"pointer"},Ea={padding:"7px 14px",background:"var(--card2)",borderRadius:9,cursor:"pointer",fontSize:12,fontWeight:600,color:"var(--t2)",whiteSpace:"nowrap",userSelect:"none"};function Sn({label:a,children:i}){return p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsx("div",{style:{fontSize:11,color:"var(--t4)",marginBottom:4},children:a}),i]})}function Km(){try{return localStorage.getItem("mc.theme")==="light"?"light":"dark"}catch{return"dark"}}function qm(a){document.documentElement.classList.toggle("light",a==="light");try{localStorage.setItem("mc.theme",a)}catch{}}function Xm(){const[a,i]=Z.useState(Km()),s=f=>{qm(f),i(f)},c=(f,h)=>p.jsx("div",{onClick:()=>s(f),style:{padding:"6px 18px",fontSize:12.5,fontWeight:600,borderRadius:8,cursor:"pointer",userSelect:"none",background:a===f?"var(--amber)":"transparent",color:a===f?"var(--onAmber)":"var(--t3)"},children:h});return p.jsxs("div",{style:{display:"inline-flex",background:"var(--card)",borderRadius:10,padding:3,gap:2},children:[c("dark","深色"),c("light","浅色")]})}const qf=()=>({name:"",provider:"anthropic",base_url:"",api_key:"",model:""}),Zm=()=>({name:"",type:"http",url:"",command:"",args:"",kv:""});function Jm({onClose:a}){const i=Aa(),[s,c]=Z.useState([]),[f,h]=Z.useState(0),[w,v]=Z.useState([]),[R,k]=Z.useState(!1),[A,M]=Z.useState(""),[N,re]=Z.useState(!1);Z.useEffect(()=>{i&&uh().then(Q=>{const W=(Q==null?void 0:Q.models)??[];c(W.length?W:[qf()]),h(Math.max(0,W.findIndex(q=>q.default))),v(Ym((Q==null?void 0:Q.mcp_servers)??{})),k(!0)}).catch(Q=>M("读取配置失败: "+(Q instanceof Error?Q.message:String(Q))))},[i]);const Y=(Q,W)=>c(q=>q.map((le,he)=>he===Q?{...le,...W}:le)),J=(Q,W)=>v(q=>q.map((le,he)=>he===Q?{...le,...W}:le)),oe=async()=>{for(const W of s)if(!W.name.trim()||!W.base_url.trim()||!W.api_key.trim()||!W.model.trim()){M(`模型「${W.name.trim()||"未命名"}」信息不完整(需名称/接口地址/API Key/模型标识)`);return}const Q=new Set;for(const W of s){if(Q.has(W.name.trim())){M(`模型名称重复: ${W.name.trim()}`);return}Q.add(W.name.trim())}M(""),re(!0);try{await ch({models:s.map((W,q)=>({...W,name:W.name.trim(),default:q===f})),mcp_servers:Gm(w)})}catch(W){M(W instanceof Error?W.message:String(W)),re(!1)}};return p.jsx("div",{style:{flex:1,overflowY:"auto",animation:"mcin .25s ease"},children:p.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:14,padding:"40px 24px 60px"},children:[p.jsxs("div",{style:{width:588,maxWidth:"100%",display:"flex",alignItems:"center"},children:[p.jsx("div",{style:{fontSize:18,fontWeight:700,color:"var(--t1)",letterSpacing:"-.01em"},children:"设置"}),p.jsx("div",{className:"hv-cardh",onClick:a,style:{...Ea,marginLeft:"auto"},children:"返回"})]}),p.jsx("div",{style:{width:588,maxWidth:"100%",display:"flex",alignItems:"center",marginTop:6},children:p.jsx("span",{style:{font:"600 10.5px system-ui",color:"var(--t4)",letterSpacing:".1em"},children:"外观"})}),p.jsxs("div",{style:{...xl,display:"flex",alignItems:"center",gap:12},children:[p.jsx(Xm,{}),p.jsx("span",{style:{fontSize:12,color:"var(--t5)"},children:"跟随本机保存,重启后保持。"})]}),!i&&p.jsx("div",{style:{...xl,color:"var(--t4)",fontSize:12.5,lineHeight:1.7},children:"浏览器模式下配置只读:模型与 MCP 由启动 mc-agent 的宿主(桌面应用或环境变量)管理。"}),i&&!R&&!A&&p.jsx("div",{style:{fontSize:12.5,color:"var(--t5)"},children:"读取配置中…"}),i&&R&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{width:588,maxWidth:"100%",display:"flex",alignItems:"center",marginTop:6},children:[p.jsx("span",{style:{font:"600 10.5px system-ui",color:"var(--t4)",letterSpacing:".1em"},children:"模型"}),p.jsx("div",{className:"hv-cardh",onClick:()=>c(Q=>[...Q,qf()]),style:{...Ea,marginLeft:"auto",padding:"4px 10px"},children:"+ 添加模型"})]}),s.length==Line truncated
<style rel="stylesheet" crossorigin>:root{--bg: #131316;--side: #0e0e10;--card: rgba(255, 255, 255, .04);--card2: rgba(255, 255, 255, .07);--cardh: rgba(255, 255, 255, .09);--line: rgba(255, 255, 255, .05);--t1: #fafafa;--t2: #d8d8de;--t3: #a1a1ac;--t4: #71717c;--t5: #55555e;--amber: #10b981;--amberT: #34d399;--amberBg: rgba(16, 185, 129, .08);--amberBd: rgba(16, 185, 129, .28);--ok: #34d399;--err: #f87171;--onAmber: #04130c;--codeBg: rgba(0, 0, 0, .35);--addBg: rgba(52, 211, 153, .07);--addT: #9fe8c9;--delBg: rgba(248, 113, 113, .08);--delT: #f0a8a8;--pop: #1b1b1f;--shadow: 0 24px 64px rgba(0, 0, 0, .55)}:root.light{--bg: #f7f6f4;--side: #efedea;--card: rgba(0, 0, 0, .04);--card2: rgba(0, 0, 0, .07);--cardh: rgba(0, 0, 0, .09);--line: rgba(0, 0, 0, .06);--t1: #1f1d1a;--t2: #44413c;--t3: #6b665e;--t4: #8f8a82;--t5: #b3ada3;--amber: #059669;--amberT: #047857;--amberBg: rgba(5, 150, 105, .09);--amberBd: rgba(5, 150, 105, .3);--ok: #16a34a;--err: #dc2626;--onAmber: #fff;--codeBg: rgba(0, 0, 0, .05);--addBg: rgba(22, 163, 74, .08);--addT: #15803d;--delBg: rgba(220, 38, 38, .07);--delT: #b91c1c;--pop: #ffffff;--shadow: 0 24px 64px rgba(0, 0, 0, .18)}*{box-sizing:border-box}html,body,#root{height:100%}body{margin:0;font-family:system-ui,-apple-system,PingFang SC,Microsoft YaHei,sans-serif;background:var(--bg);color:var(--t2);font-size:13.5px}a{color:var(--amberT)}a:hover{color:var(--amber)}input,textarea,select,button{font-family:inherit}::placeholder{color:var(--t5)}@keyframes mcspin{to{transform:rotate(360deg)}}@keyframes mcpulse{0%,to{opacity:1}50%{opacity:.35}}@keyframes mcin{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}@keyframes mcslide{0%{transform:translate(40px);opacity:0}to{transform:none;opacity:1}}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:#ffffff24;border-radius:4px}::-webkit-scrollbar-thumb:hover{background:#ffffff3d}*{scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.14) transparent}:root.light ::-webkit-scrollbar-thumb{background:#00000024}:root.light ::-webkit-scrollbar-thumb:hover{background:#0000003d}:root.light *{scrollbar-color:rgba(0,0,0,.14) transparent}.hv-card:hover{background:var(--card)!important}.hv-card2:hover{background:var(--card2)!important}.hv-cardh:hover{background:var(--cardh)!important}.hv-t1:hover{color:var(--t1)!important}.hv-t3:hover{color:var(--t3)!important}.hv-err:hover{color:var(--err)!important}.hv-op:hover{opacity:.85}.md>:first-child{margin-top:0}.md>:last-child{margin-bottom:0}.md pre{background:var(--codeBg);border-radius:9px;padding:10px 14px;overflow-x:auto;font:12px/1.7 ui-monospace,Menlo,monospace}.md code{background:var(--card2);border-radius:4px;padding:1px 5px;font-family:ui-monospace,Menlo,monospace;font-size:12px}.md pre code{background:transparent;padding:0}.md table{border-collapse:collapse}.md th,.md td{border:1px solid var(--line);padding:4px 10px}.md blockquote{border-left:3px solid var(--line);margin-left:0;padding-left:12px;color:var(--t4)}select option{background:var(--pop);color:var(--t1)}</style>
</head>
<body>
+10
View File
@@ -96,6 +96,16 @@ export async function saveHostConfig(config: HostConfig): Promise<void> {
await tauri.core.invoke("save_config", { config });
}
/** 在系统浏览器打开外部链接:壳内经 opener 插件,浏览器模式开新标签页。 */
export function openExternal(url: string): void {
const tauri = (window as { __TAURI__?: TauriGlobal }).__TAURI__;
if (tauri?.core?.invoke) {
tauri.core.invoke("plugin:opener|open_url", { url }).catch(() => {});
} else {
window.open(url, "_blank", "noopener,noreferrer");
}
}
/** 订阅壳事件(如托盘"设置"),返回退订函数;非壳环境为空操作。 */
export function onHostEvent(name: string, cb: () => void): () => void {
const tauri = (window as { __TAURI__?: TauriGlobal }).__TAURI__;
+13 -2
View File
@@ -2,7 +2,8 @@
// 样式值取自「MonkeyCode 原型(离线版)」的内联样式,逐一对应,不另行发挥。
import DOMPurify from "dompurify";
import { marked } from "marked";
import { useMemo, useState, type ReactElement } from "react";
import { useMemo, useState, type MouseEvent as ReactMouseEvent, type ReactElement } from "react";
import { openExternal } from "./client";
import { permStateLabel } from "./reduce";
import type { LogItem, PlanEntry, SessionMeta } from "./types";
@@ -10,10 +11,20 @@ marked.setOptions({ gfm: true, breaks: true });
export const MONO = "ui-monospace,Menlo,monospace";
/** 正文里的链接一律不走 webview 导航(WKWebView 里点 <a> 会把应用页面跳走):
* http(s) 交系统浏览器/新标签页,其余协议直接拦下。 */
function onMarkdownClick(e: ReactMouseEvent<HTMLDivElement>) {
const a = (e.target as HTMLElement).closest("a");
if (!a) return;
e.preventDefault();
const href = a.getAttribute("href") || "";
if (/^https?:/i.test(href)) openExternal(href);
}
/** agent 正文按 Markdown 渲染(净化后注入);流式期间随批次重渲染 */
export function Markdown({ text }: { text: string }) {
const html = useMemo(() => DOMPurify.sanitize(marked.parse(text, { async: false }) as string), [text]);
return <div className="md" dangerouslySetInnerHTML={{ __html: html }} />;
return <div className="md" onClick={onMarkdownClick} dangerouslySetInnerHTML={{ __html: html }} />;
}
/** 侧栏会话行:名称 + 右侧状态/轮数(时间无信息量,不展示) */
+448
View File
@@ -56,6 +56,137 @@ dependencies = [
"derive_arbitrary",
]
[[package]]
name = "async-broadcast"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532"
dependencies = [
"event-listener",
"event-listener-strategy",
"futures-core",
"pin-project-lite",
]
[[package]]
name = "async-channel"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2"
dependencies = [
"concurrent-queue",
"event-listener-strategy",
"futures-core",
"pin-project-lite",
]
[[package]]
name = "async-executor"
version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a"
dependencies = [
"async-task",
"concurrent-queue",
"fastrand",
"futures-lite",
"pin-project-lite",
"slab",
]
[[package]]
name = "async-io"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc"
dependencies = [
"autocfg",
"cfg-if",
"concurrent-queue",
"futures-io",
"futures-lite",
"parking",
"polling",
"rustix",
"slab",
"windows-sys 0.61.2",
]
[[package]]
name = "async-lock"
version = "3.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311"
dependencies = [
"event-listener",
"event-listener-strategy",
"pin-project-lite",
]
[[package]]
name = "async-process"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75"
dependencies = [
"async-channel",
"async-io",
"async-lock",
"async-signal",
"async-task",
"blocking",
"cfg-if",
"event-listener",
"futures-lite",
"rustix",
]
[[package]]
name = "async-recursion"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.118",
]
[[package]]
name = "async-signal"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485"
dependencies = [
"async-io",
"async-lock",
"atomic-waker",
"cfg-if",
"futures-core",
"futures-io",
"rustix",
"signal-hook-registry",
"slab",
"windows-sys 0.61.2",
]
[[package]]
name = "async-task"
version = "4.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"
[[package]]
name = "async-trait"
version = "0.1.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.118",
]
[[package]]
name = "atk"
version = "0.18.2"
@@ -151,6 +282,19 @@ dependencies = [
"objc2",
]
[[package]]
name = "blocking"
version = "1.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e83f8d02be6967315521be875afa792a316e28d57b5a2d401897e2a7921b7f21"
dependencies = [
"async-channel",
"async-task",
"futures-io",
"futures-lite",
"piper",
]
[[package]]
name = "brotli"
version = "8.0.4"
@@ -346,6 +490,15 @@ dependencies = [
"memchr",
]
[[package]]
name = "concurrent-queue"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "cookie"
version = "0.18.1"
@@ -727,6 +880,33 @@ version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7"
[[package]]
name = "endi"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099"
[[package]]
name = "enumflags2"
version = "0.7.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef"
dependencies = [
"enumflags2_derive",
"serde",
]
[[package]]
name = "enumflags2_derive"
version = "0.7.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.118",
]
[[package]]
name = "equivalent"
version = "1.0.2"
@@ -754,6 +934,27 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "event-listener"
version = "5.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab"
dependencies = [
"concurrent-queue",
"parking",
"pin-project-lite",
]
[[package]]
name = "event-listener-strategy"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93"
dependencies = [
"event-listener",
"pin-project-lite",
]
[[package]]
name = "fastrand"
version = "2.4.1"
@@ -885,6 +1086,19 @@ version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718"
[[package]]
name = "futures-lite"
version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad"
dependencies = [
"fastrand",
"futures-core",
"futures-io",
"parking",
"pin-project-lite",
]
[[package]]
name = "futures-macro"
version = "0.3.32"
@@ -1239,6 +1453,12 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "hermit-abi"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
[[package]]
name = "hex"
version = "0.4.3"
@@ -1546,6 +1766,25 @@ version = "2.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2"
[[package]]
name = "is-docker"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3"
dependencies = [
"once_cell",
]
[[package]]
name = "is-wsl"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5"
dependencies = [
"is-docker",
"once_cell",
]
[[package]]
name = "itoa"
version = "1.0.18"
@@ -1799,6 +2038,7 @@ dependencies = [
"tauri",
"tauri-build",
"tauri-plugin-dialog",
"tauri-plugin-opener",
"tauri-plugin-updater",
]
@@ -2162,6 +2402,17 @@ version = "1.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
[[package]]
name = "open"
version = "5.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0b3d059e795d52b8a72fef45658620edd4d9c359b338564aa14391ffa511ed5"
dependencies = [
"dunce",
"is-wsl",
"libc",
]
[[package]]
name = "openssl-probe"
version = "0.2.1"
@@ -2174,6 +2425,16 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "ordered-stream"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50"
dependencies = [
"futures-core",
"pin-project-lite",
]
[[package]]
name = "osakit"
version = "0.3.1"
@@ -2213,6 +2474,12 @@ dependencies = [
"system-deps",
]
[[package]]
name = "parking"
version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"
[[package]]
name = "parking_lot"
version = "0.12.5"
@@ -2301,6 +2568,17 @@ version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
[[package]]
name = "piper"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1"
dependencies = [
"atomic-waker",
"fastrand",
"futures-io",
]
[[package]]
name = "pkg-config"
version = "0.3.33"
@@ -2346,6 +2624,20 @@ dependencies = [
"miniz_oxide",
]
[[package]]
name = "polling"
version = "3.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218"
dependencies = [
"cfg-if",
"concurrent-queue",
"hermit-abi",
"pin-project-lite",
"rustix",
"windows-sys 0.61.2",
]
[[package]]
name = "potential_utf"
version = "0.1.5"
@@ -3026,6 +3318,16 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
[[package]]
name = "signal-hook-registry"
version = "1.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b"
dependencies = [
"errno",
"libc",
]
[[package]]
name = "simd-adler32"
version = "0.3.9"
@@ -3471,6 +3773,28 @@ dependencies = [
"url",
]
[[package]]
name = "tauri-plugin-opener"
version = "2.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17e1bea14edce6b793a04e2417e3fd924b9bc4faae83cdee7d714156cceeed29"
dependencies = [
"dunce",
"glob",
"objc2-app-kit",
"objc2-foundation",
"open",
"schemars 0.8.22",
"serde",
"serde_json",
"tauri",
"tauri-plugin",
"thiserror 2.0.18",
"url",
"windows",
"zbus",
]
[[package]]
name = "tauri-plugin-updater"
version = "2.10.1"
@@ -3930,9 +4254,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
dependencies = [
"pin-project-lite",
"tracing-attributes",
"tracing-core",
]
[[package]]
name = "tracing-attributes"
version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.118",
]
[[package]]
name = "tracing-core"
version = "0.1.36"
@@ -3982,6 +4318,17 @@ version = "1.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
[[package]]
name = "uds_windows"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e"
dependencies = [
"memoffset",
"tempfile",
"windows-sys 0.61.2",
]
[[package]]
name = "unic-char-property"
version = "0.9.0"
@@ -4907,6 +5254,67 @@ dependencies = [
"synstructure",
]
[[package]]
name = "zbus"
version = "5.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a28b97f866896a4be7aefd2b5a8e01bb6773d19a775d54ab28b4d094b9a4480e"
dependencies = [
"async-broadcast",
"async-executor",
"async-io",
"async-lock",
"async-process",
"async-recursion",
"async-task",
"async-trait",
"blocking",
"enumflags2",
"event-listener",
"futures-core",
"futures-lite",
"hex",
"libc",
"ordered-stream",
"rustix",
"serde",
"serde_repr",
"tracing",
"uds_windows",
"uuid",
"windows-sys 0.61.2",
"winnow 1.0.3",
"zbus_macros",
"zbus_names",
"zvariant",
]
[[package]]
name = "zbus_macros"
version = "5.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e05ad887425eecf5e8384dc2406a4a9313eb73468712fc1cdea362eb4fe0469"
dependencies = [
"proc-macro-crate 3.5.0",
"proc-macro2",
"quote",
"syn 2.0.118",
"zbus_names",
"zvariant",
"zvariant_utils",
]
[[package]]
name = "zbus_names"
version = "4.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1039ca249fee9559680f3a9f05b55e0761fee51af4f6c1e7d8c1f31e549721d2"
dependencies = [
"serde",
"winnow 1.0.3",
"zvariant",
]
[[package]]
name = "zerofrom"
version = "0.1.8"
@@ -4984,3 +5392,43 @@ name = "zmij"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd2f034a4bebf216c9e4b7083603e024cf930873fd67830cfb083c9fa33129d9"
[[package]]
name = "zvariant"
version = "5.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cf057bb00bf5c9ad77abb6147b0ca4818236a1858416e9d988e40d6322fefa7"
dependencies = [
"endi",
"enumflags2",
"serde",
"winnow 1.0.3",
"zvariant_derive",
"zvariant_utils",
]
[[package]]
name = "zvariant_derive"
version = "5.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8118ca6bda77bfc0ab51d660db0c955f2505eef854c9a449435bccb616933b31"
dependencies = [
"proc-macro-crate 3.5.0",
"proc-macro2",
"quote",
"syn 2.0.118",
"zvariant_utils",
]
[[package]]
name = "zvariant_utils"
version = "3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90cb9383f9b45290407a1258b202d3f8f01db719eb60b4e4055c6375af4fc7c7"
dependencies = [
"proc-macro2",
"quote",
"serde",
"syn 2.0.118",
"winnow 1.0.3",
]
+1
View File
@@ -14,6 +14,7 @@ getrandom = "0.2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tauri-plugin-dialog = "2"
tauri-plugin-opener = "2"
tauri-plugin-updater = "2"
[profile.release]
+23 -1
View File
@@ -271,9 +271,27 @@ fn show_kernel_ui(app: &AppHandle, url: &str) {
let _ = win.show();
let _ = win.set_focus();
} else {
let opener = app.clone();
let mut builder = WebviewWindowBuilder::new(app, "main", WebviewUrl::External(parsed))
.title("MonkeyCode")
.inner_size(1200.0, 800.0);
.inner_size(1200.0, 800.0)
// 导航守卫:webview 只许待在内核 UI(loopback)与壳自带页面;
// 其余导航(对话里的外部链接等)一律拒绝并交系统浏览器,
// 防止应用被"跳走"后无法返回。UI 侧已拦截点击,这里是兜底。
.on_navigation(move |url| {
let internal = match url.scheme() {
"tauri" => true, // 壳自带页面(错误页)
"http" | "https" => {
matches!(url.host_str(), Some("127.0.0.1" | "localhost" | "tauri.localhost"))
}
_ => false,
};
if !internal {
use tauri_plugin_opener::OpenerExt;
let _ = opener.opener().open_url(url.as_str(), None::<&str>);
}
internal
});
// 无头冒烟探针:页面加载后自动走一遍 远程页→IPC→壳配置 链路,
// 结果经本地回环上报(无头环境唯一可靠的回读通道)
if std::env::var("MC_DESKTOP_IPC_PROBE").is_ok() {
@@ -286,6 +304,9 @@ fn show_kernel_ui(app: &AppHandle, url: &str) {
window.__TAURI__.core.invoke('get_config') \
.then(() => report('invoke-ok')) \
.catch((e) => report('invoke-err:' + String(e).slice(0, 80))); \
/* 导航守卫:外域跳转应被拒;页面存活才能发出 1 秒后的上报 */ \
setTimeout(() => { location.href = 'https://nav-guard.invalid/x'; }, 1000); \
setTimeout(() => report('nav-guard-ok'), 2000); \
}, 3000);",
);
}
@@ -311,6 +332,7 @@ fn main() {
eprintln!("[mc-desktop] main 进入");
tauri::Builder::default()
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_updater::Builder::new().build())
.manage(Kernel(Mutex::new(None)))
.manage(TrayReady(AtomicBool::new(true)))
+2 -1
View File
@@ -36,7 +36,8 @@
"core:default",
"allow-get-config",
"allow-save-config",
"dialog:allow-open"
"dialog:allow-open",
"opener:allow-open-url"
]
}
]