feat: 会话支持粘贴/拖拽图片(文件落工作区 + 路径引用 + read_file 看图)

图片不内联进消息:上传到 <workdir>/.mc-agent/uploads/(带自免疫 .gitignore),
对话文本附 [图片] 路径行,模型经 read_file 查看,也可用工具按路径二次处理。
不动 RunTurn/帧协议;compact 后路径仍在文本里可重读。

- provider:新增 image 块与 tool_result 富内容(Blocks);Anthropic 线格式
  原生序列化;OpenAI Chat/Responses 工具结果不支持图片(协议限制),
  序列化层转"占位文本 + 合成 user 图片消息",三协议模型都能看图,
  归一化历史保持标准形状(跨协议切模型一致)
- tools:BlocksTool 接口;read_file 图片分支(png/jpg/gif/webp,>1568px
  等比缩放重编码,小图原字节直传;golang.org/x/image)
- loop:execToolUse 接富内容结果;compact 摘要以 [图片] 占位不再静默丢图
- server:上传/回读路由(MIME 白名单、20MB 上限、路径穿越防护)
- UI:composer 粘贴/拖拽(拖入蒙层)→ 缩略 chips → 发送;气泡缩略图 +
  点击大图;与排队机制兼容

测试:三协议 wire 形状、read_file 图片分支、上传路由、"读图进入下次请求
历史"集成测试;无头浏览器端到端(拖入→发送→缩略图→落盘)。

(含并行开发的 Windows 自绘标题栏 UI 部分 titlebar.tsx,壳侧配套另行提交)
This commit is contained in:
xiaomakuaiz committed 2026-07-16 12:58:16 +00:00
1 parent b11e09b385
commit 30807f9553
23 files changed
+1369 -115

No files matched your search

+61 -58
View File
@@ -7,7 +7,7 @@
<style>
html, body { background: #fcfdfc; }
</style>
<script type="module" crossorigin>var hh=Object.defineProperty;var gh=(o,i,s)=>i in o?hh(o,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[i]=s;var Oe=(o,i,s)=>gh(o,typeof i!="symbol"?i+"":i,s);(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))c(f);new MutationObserver(f=>{for(const h of f)if(h.type==="childList")for(const y of h.addedNodes)y.tagName==="LINK"&&y.rel==="modulepreload"&&c(y)}).observe(document,{childList:!0,subtree:!0});function s(f){const h={};return f.integrity&&(h.integrity=f.integrity),f.referrerPolicy&&(h.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?h.credentials="include":f.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function c(f){if(f.ep)return;f.ep=!0;const h=s(f);fetch(f.href,h)}})();var ka={exports:{}},si={},Sa={exports:{}},ve={};/**
<script type="module" crossorigin>var vh=Object.defineProperty;var yh=(o,l,s)=>l in o?vh(o,l,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[l]=s;var _e=(o,l,s)=>yh(o,typeof l!="symbol"?l+"":l,s);(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))c(f);new MutationObserver(f=>{for(const h of f)if(h.type==="childList")for(const y of h.addedNodes)y.tagName==="LINK"&&y.rel==="modulepreload"&&c(y)}).observe(document,{childList:!0,subtree:!0});function s(f){const h={};return f.integrity&&(h.integrity=f.integrity),f.referrerPolicy&&(h.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?h.credentials="include":f.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function c(f){if(f.ep)return;f.ep=!0;const h=s(f);fetch(f.href,h)}})();var Ta={exports:{}},ui={},ja={exports:{}},Se={};/**
* @license React
* react.production.min.js
*
@@ -15,7 +15,7 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var wd;function mh(){if(wd)return ve;wd=1;var o=Symbol.for("react.element"),i=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),y=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),k=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),_=Symbol.iterator;function N(x){return x===null||typeof x!="object"?null:(x=_&&x[_]||x["@@iterator"],typeof x=="function"?x:null)}var H={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},B=Object.assign,K={};function J(x,A,pe){this.props=x,this.context=A,this.refs=K,this.updater=pe||H}J.prototype.isReactComponent={},J.prototype.setState=function(x,A){if(typeof x!="object"&&typeof x!="function"&&x!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,x,A,"setState")},J.prototype.forceUpdate=function(x){this.updater.enqueueForceUpdate(this,x,"forceUpdate")};function fe(){}fe.prototype=J.prototype;function me(x,A,pe){this.props=x,this.context=A,this.refs=K,this.updater=pe||H}var de=me.prototype=new fe;de.constructor=me,B(de,J.prototype),de.isPureReactComponent=!0;var ee=Array.isArray,G=Object.prototype.hasOwnProperty,re={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function U(x,A,pe){var he,ge={},we=null,Ce=null;if(A!=null)for(he in A.ref!==void 0&&(Ce=A.ref),A.key!==void 0&&(we=""+A.key),A)G.call(A,he)&&!I.hasOwnProperty(he)&&(ge[he]=A[he]);var ke=arguments.length-2;if(ke===1)ge.children=pe;else if(1<ke){for(var Le=Array(ke),Ee=0;Ee<ke;Ee++)Le[Ee]=arguments[Ee+2];ge.children=Le}if(x&&x.defaultProps)for(he in ke=x.defaultProps,ke)ge[he]===void 0&&(ge[he]=ke[he]);return{$$typeof:o,type:x,key:we,ref:Ce,props:ge,_owner:re.current}}function ne(x,A){return{$$typeof:o,type:x.type,key:A,ref:x.ref,props:x.props,_owner:x._owner}}function ye(x){return typeof x=="object"&&x!==null&&x.$$typeof===o}function _e(x){var A={"=":"=0",":":"=2"};return"$"+x.replace(/[=:]/g,function(pe){return A[pe]})}var Ze=/\/+/g;function Ve(x,A){return typeof x=="object"&&x!==null&&x.key!=null?_e(""+x.key):A.toString(36)}function ft(x,A,pe,he,ge){var we=typeof x;(we==="undefined"||we==="boolean")&&(x=null);var Ce=!1;if(x===null)Ce=!0;else switch(we){case"string":case"number":Ce=!0;break;case"object":switch(x.$$typeof){case o:case i:Ce=!0}}if(Ce)return Ce=x,ge=ge(Ce),x=he===""?"."+Ve(Ce,0):he,ee(ge)?(pe="",x!=null&&(pe=x.replace(Ze,"$&/")+"/"),ft(ge,A,pe,"",function(Ee){return Ee})):ge!=null&&(ye(ge)&&(ge=ne(ge,pe+(!ge.key||Ce&&Ce.key===ge.key?"":(""+ge.key).replace(Ze,"$&/")+"/")+x)),A.push(ge)),1;if(Ce=0,he=he===""?".":he+":",ee(x))for(var ke=0;ke<x.length;ke++){we=x[ke];var Le=he+Ve(we,ke);Ce+=ft(we,A,pe,Le,ge)}else if(Le=N(x),typeof Le=="function")for(x=Le.call(x),ke=0;!(we=x.next()).done;)we=we.value,Le=he+Ve(we,ke++),Ce+=ft(we,A,pe,Le,ge);else if(we==="object")throw A=String(x),Error("Objects are not valid as a React child (found: "+(A==="[object Object]"?"object with keys {"+Object.keys(x).join(", ")+"}":A)+"). If you meant to render a collection of children, use an array instead.");return Ce}function lt(x,A,pe){if(x==null)return x;var he=[],ge=0;return ft(x,he,"","",function(we){return A.call(pe,we,ge++)}),he}function De(x){if(x._status===-1){var A=x._result;A=A(),A.then(function(pe){(x._status===0||x._status===-1)&&(x._status=1,x._result=pe)},function(pe){(x._status===0||x._status===-1)&&(x._status=2,x._result=pe)}),x._status===-1&&(x._status=0,x._result=A)}if(x._status===1)return x._result.default;throw x._result}var Se={current:null},z={transition:null},le={ReactCurrentDispatcher:Se,ReactCurrentBatchConfig:z,ReactCurrentOwner:re};function V(){throw Error("act(...) is not supported in production builds of React.")}return ve.Children={map:lt,forEach:function(x,A,pe){lt(x,function(){A.apply(this,arguments)},pe)},count:function(x){var A=0;return lt(x,function(){A++}),A},toArray:function(x){return lt(x,function(A){return A})||[]},only:function(x){if(!ye(x))throw Error("React.Children.only expected to receive a single React element child.");return x}},ve.Component=J,ve.Fragment=s,ve.Profiler=f,ve.PureComponent=me,ve.StrictMode=c,ve.Suspense=S,ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=le,ve.act=V,ve.cloneElement=function(x,A,pe){if(x==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+x+".");var he=B({},x.props),ge=x.key,we=x.ref,Ce=x._owner;if(A!=null){if(A.ref!==void 0&&(we=A.ref,Ce=re.current),A.key!==void 0&&(ge=""+A.key),x.type&&x.type.defaultProps)var ke=x.type.defaultProps;for(Le in A)G.call(A,Le)&&!I.hasOwnProperty(Le)&&(he[Le]=A[Le]===void 0&&ke!==void 0?ke[Le]:A[Le])}var Le=arguments.length-2;if(Le===1)he.children=pe;else if(1<Le){ke=Array(Le);for(var Ee=0;Ee<Le;Ee++)ke[Ee]=arguments[Ee+2];he.chiLine truncated
*/var Td;function xh(){if(Td)return Se;Td=1;var o=Symbol.for("react.element"),l=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),y=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),w=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),O=Symbol.iterator;function N(x){return x===null||typeof x!="object"?null:(x=O&&x[O]||x["@@iterator"],typeof x=="function"?x:null)}var V={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Q=Object.assign,J={};function $(x,A,fe){this.props=x,this.context=A,this.refs=J,this.updater=fe||V}$.prototype.isReactComponent={},$.prototype.setState=function(x,A){if(typeof x!="object"&&typeof x!="function"&&x!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,x,A,"setState")},$.prototype.forceUpdate=function(x){this.updater.enqueueForceUpdate(this,x,"forceUpdate")};function he(){}he.prototype=$.prototype;function xe(x,A,fe){this.props=x,this.context=A,this.refs=J,this.updater=fe||V}var ge=xe.prototype=new he;ge.constructor=xe,Q(ge,$.prototype),ge.isPureReactComponent=!0;var re=Array.isArray,q=Object.prototype.hasOwnProperty,oe={current:null},z={key:!0,ref:!0,__self:!0,__source:!0};function W(x,A,fe){var me,ve={},ke=null,Ee=null;if(A!=null)for(me in A.ref!==void 0&&(Ee=A.ref),A.key!==void 0&&(ke=""+A.key),A)q.call(A,me)&&!z.hasOwnProperty(me)&&(ve[me]=A[me]);var ye=arguments.length-2;if(ye===1)ve.children=fe;else if(1<ye){for(var H=Array(ye),pe=0;pe<ye;pe++)H[pe]=arguments[pe+2];ve.children=H}if(x&&x.defaultProps)for(me in ye=x.defaultProps,ye)ve[me]===void 0&&(ve[me]=ye[me]);return{$$typeof:o,type:x,key:ke,ref:Ee,props:ve,_owner:oe.current}}function te(x,A){return{$$typeof:o,type:x.type,key:A,ref:x.ref,props:x.props,_owner:x._owner}}function we(x){return typeof x=="object"&&x!==null&&x.$$typeof===o}function Ie(x){var A={"=":"=0",":":"=2"};return"$"+x.replace(/[=:]/g,function(fe){return A[fe]})}var Xe=/\/+/g;function Oe(x,A){return typeof x=="object"&&x!==null&&x.key!=null?Ie(""+x.key):A.toString(36)}function $e(x,A,fe,me,ve){var ke=typeof x;(ke==="undefined"||ke==="boolean")&&(x=null);var Ee=!1;if(x===null)Ee=!0;else switch(ke){case"string":case"number":Ee=!0;break;case"object":switch(x.$$typeof){case o:case l:Ee=!0}}if(Ee)return Ee=x,ve=ve(Ee),x=me===""?"."+Oe(Ee,0):me,re(ve)?(fe="",x!=null&&(fe=x.replace(Xe,"$&/")+"/"),$e(ve,A,fe,"",function(pe){return pe})):ve!=null&&(we(ve)&&(ve=te(ve,fe+(!ve.key||Ee&&Ee.key===ve.key?"":(""+ve.key).replace(Xe,"$&/")+"/")+x)),A.push(ve)),1;if(Ee=0,me=me===""?".":me+":",re(x))for(var ye=0;ye<x.length;ye++){ke=x[ye];var H=me+Oe(ke,ye);Ee+=$e(ke,A,fe,H,ve)}else if(H=N(x),typeof H=="function")for(x=H.call(x),ye=0;!(ke=x.next()).done;)ke=ke.value,H=me+Oe(ke,ye++),Ee+=$e(ke,A,fe,H,ve);else if(ke==="object")throw A=String(x),Error("Objects are not valid as a React child (found: "+(A==="[object Object]"?"object with keys {"+Object.keys(x).join(", ")+"}":A)+"). If you meant to render a collection of children, use an array instead.");return Ee}function it(x,A,fe){if(x==null)return x;var me=[],ve=0;return $e(x,me,"","",function(ke){return A.call(fe,ke,ve++)}),me}function Fe(x){if(x._status===-1){var A=x._result;A=A(),A.then(function(fe){(x._status===0||x._status===-1)&&(x._status=1,x._result=fe)},function(fe){(x._status===0||x._status===-1)&&(x._status=2,x._result=fe)}),x._status===-1&&(x._status=0,x._result=A)}if(x._status===1)return x._result.default;throw x._result}var ze={current:null},U={transition:null},ie={ReactCurrentDispatcher:ze,ReactCurrentBatchConfig:U,ReactCurrentOwner:oe};function Y(){throw Error("act(...) is not supported in production builds of React.")}return Se.Children={map:it,forEach:function(x,A,fe){it(x,function(){A.apply(this,arguments)},fe)},count:function(x){var A=0;return it(x,function(){A++}),A},toArray:function(x){return it(x,function(A){return A})||[]},only:function(x){if(!we(x))throw Error("React.Children.only expected to receive a single React element child.");return x}},Se.Component=$,Se.Fragment=s,Se.Profiler=f,Se.PureComponent=xe,Se.StrictMode=c,Se.Suspense=S,Se.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ie,Se.act=Y,Se.cloneElement=function(x,A,fe){if(x==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+x+".");var me=Q({},x.props),ve=x.key,ke=x.ref,Ee=x._owner;if(A!=null){if(A.ref!==void 0&&(ke=A.ref,Ee=oe.current),A.key!==void 0&&(ve=""+A.key),x.type&&x.type.defaultProps)var ye=x.type.defaultProps;for(H in A)q.call(A,H)&&!z.hasOwnProperty(H)&&(me[H]=A[H]===void 0&&ye!==void 0?ye[H]:A[H])}var H=arguments.length-2;if(H===1)me.children=fe;else if(1<H){ye=Array(H);for(var pe=0;pe<H;pe++)ye[pe]=arguments[pe+2];me.children=ye}return{$$typeLine truncated
* @license React
* react-jsx-runtime.production.min.js
*
@@ -23,7 +23,7 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Sd;function vh(){if(Sd)return si;Sd=1;var o=Qa(),i=Symbol.for("react.element"),s=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,f=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,h={key:!0,ref:!0,__self:!0,__source:!0};function y(m,S,k){var j,_={},N=null,H=null;k!==void 0&&(N=""+k),S.key!==void 0&&(N=""+S.key),S.ref!==void 0&&(H=S.ref);for(j in S)c.call(S,j)&&!h.hasOwnProperty(j)&&(_[j]=S[j]);if(m&&m.defaultProps)for(j in S=m.defaultProps,S)_[j]===void 0&&(_[j]=S[j]);return{$$typeof:i,type:m,key:N,ref:H,props:_,_owner:f.current}}return si.Fragment=s,si.jsx=y,si.jsxs=y,si}var Ed;function yh(){return Ed||(Ed=1,ka.exports=vh()),ka.exports}var u=yh(),Y=Qa(),jo={},Ea={exports:{}},Mt={},Ta={exports:{}},Ca={};/**
*/var Cd;function wh(){if(Cd)return ui;Cd=1;var o=qa(),l=Symbol.for("react.element"),s=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,f=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,h={key:!0,ref:!0,__self:!0,__source:!0};function y(m,S,w){var C,O={},N=null,V=null;w!==void 0&&(N=""+w),S.key!==void 0&&(N=""+S.key),S.ref!==void 0&&(V=S.ref);for(C in S)c.call(S,C)&&!h.hasOwnProperty(C)&&(O[C]=S[C]);if(m&&m.defaultProps)for(C in S=m.defaultProps,S)O[C]===void 0&&(O[C]=S[C]);return{$$typeof:l,type:m,key:N,ref:V,props:O,_owner:f.current}}return ui.Fragment=s,ui.jsx=y,ui.jsxs=y,ui}var Rd;function kh(){return Rd||(Rd=1,Ta.exports=wh()),Ta.exports}var u=kh(),B=qa(),Co={},Ca={exports:{}},Ft={},Ra={exports:{}},Na={};/**
* @license React
* scheduler.production.min.js
*
@@ -31,7 +31,7 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Td;function xh(){return Td||(Td=1,(function(o){function i(z,le){var V=z.length;z.push(le);e:for(;0<V;){var x=V-1>>>1,A=z[x];if(0<f(A,le))z[x]=le,z[V]=A,V=x;else break e}}function s(z){return z.length===0?null:z[0]}function c(z){if(z.length===0)return null;var le=z[0],V=z.pop();if(V!==le){z[0]=V;e:for(var x=0,A=z.length,pe=A>>>1;x<pe;){var he=2*(x+1)-1,ge=z[he],we=he+1,Ce=z[we];if(0>f(ge,V))we<A&&0>f(Ce,ge)?(z[x]=Ce,z[we]=V,x=we):(z[x]=ge,z[he]=V,x=he);else if(we<A&&0>f(Ce,V))z[x]=Ce,z[we]=V,x=we;else break e}}return le}function f(z,le){var V=z.sortIndex-le.sortIndex;return V!==0?V:z.id-le.id}if(typeof performance=="object"&&typeof performance.now=="function"){var h=performance;o.unstable_now=function(){return h.now()}}else{var y=Date,m=y.now();o.unstable_now=function(){return y.now()-m}}var S=[],k=[],j=1,_=null,N=3,H=!1,B=!1,K=!1,J=typeof setTimeout=="function"?setTimeout:null,fe=typeof clearTimeout=="function"?clearTimeout:null,me=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function de(z){for(var le=s(k);le!==null;){if(le.callback===null)c(k);else if(le.startTime<=z)c(k),le.sortIndex=le.expirationTime,i(S,le);else break;le=s(k)}}function ee(z){if(K=!1,de(z),!B)if(s(S)!==null)B=!0,De(G);else{var le=s(k);le!==null&&Se(ee,le.startTime-z)}}function G(z,le){B=!1,K&&(K=!1,fe(U),U=-1),H=!0;var V=N;try{for(de(le),_=s(S);_!==null&&(!(_.expirationTime>le)||z&&!_e());){var x=_.callback;if(typeof x=="function"){_.callback=null,N=_.priorityLevel;var A=x(_.expirationTime<=le);le=o.unstable_now(),typeof A=="function"?_.callback=A:_===s(S)&&c(S),de(le)}else c(S);_=s(S)}if(_!==null)var pe=!0;else{var he=s(k);he!==null&&Se(ee,he.startTime-le),pe=!1}return pe}finally{_=null,N=V,H=!1}}var re=!1,I=null,U=-1,ne=5,ye=-1;function _e(){return!(o.unstable_now()-ye<ne)}function Ze(){if(I!==null){var z=o.unstable_now();ye=z;var le=!0;try{le=I(!0,z)}finally{le?Ve():(re=!1,I=null)}}else re=!1}var Ve;if(typeof me=="function")Ve=function(){me(Ze)};else if(typeof MessageChannel<"u"){var ft=new MessageChannel,lt=ft.port2;ft.port1.onmessage=Ze,Ve=function(){lt.postMessage(null)}}else Ve=function(){J(Ze,0)};function De(z){I=z,re||(re=!0,Ve())}function Se(z,le){U=J(function(){z(o.unstable_now())},le)}o.unstable_IdlePriority=5,o.unstable_ImmediatePriority=1,o.unstable_LowPriority=4,o.unstable_NormalPriority=3,o.unstable_Profiling=null,o.unstable_UserBlockingPriority=2,o.unstable_cancelCallback=function(z){z.callback=null},o.unstable_continueExecution=function(){B||H||(B=!0,De(G))},o.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ne=0<z?Math.floor(1e3/z):5},o.unstable_getCurrentPriorityLevel=function(){return N},o.unstable_getFirstCallbackNode=function(){return s(S)},o.unstable_next=function(z){switch(N){case 1:case 2:case 3:var le=3;break;default:le=N}var V=N;N=le;try{return z()}finally{N=V}},o.unstable_pauseExecution=function(){},o.unstable_requestPaint=function(){},o.unstable_runWithPriority=function(z,le){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var V=N;N=z;try{return le()}finally{N=V}},o.unstable_scheduleCallback=function(z,le,V){var x=o.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?x+V:x):V=x,z){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=V+A,z={id:j++,callback:le,priorityLevel:z,startTime:V,expirationTime:A,sortIndex:-1},V>x?(z.sortIndex=V,i(k,z),s(S)===null&&z===s(k)&&(K?(fe(U),U=-1):K=!0,Se(ee,V-x))):(z.sortIndex=A,i(S,z),B||H||(B=!0,De(G))),z},o.unstable_shouldYield=_e,o.unstable_wrapCallback=function(z){var le=N;return function(){var V=N;N=le;try{return z.apply(this,arguments)}finally{N=V}}}})(Ca)),Ca}var Cd;function wh(){return Cd||(Cd=1,Ta.exports=xh()),Ta.exports}/**
*/var Nd;function Sh(){return Nd||(Nd=1,(function(o){function l(U,ie){var Y=U.length;U.push(ie);e:for(;0<Y;){var x=Y-1>>>1,A=U[x];if(0<f(A,ie))U[x]=ie,U[Y]=A,Y=x;else break e}}function s(U){return U.length===0?null:U[0]}function c(U){if(U.length===0)return null;var ie=U[0],Y=U.pop();if(Y!==ie){U[0]=Y;e:for(var x=0,A=U.length,fe=A>>>1;x<fe;){var me=2*(x+1)-1,ve=U[me],ke=me+1,Ee=U[ke];if(0>f(ve,Y))ke<A&&0>f(Ee,ve)?(U[x]=Ee,U[ke]=Y,x=ke):(U[x]=ve,U[me]=Y,x=me);else if(ke<A&&0>f(Ee,Y))U[x]=Ee,U[ke]=Y,x=ke;else break e}}return ie}function f(U,ie){var Y=U.sortIndex-ie.sortIndex;return Y!==0?Y:U.id-ie.id}if(typeof performance=="object"&&typeof performance.now=="function"){var h=performance;o.unstable_now=function(){return h.now()}}else{var y=Date,m=y.now();o.unstable_now=function(){return y.now()-m}}var S=[],w=[],C=1,O=null,N=3,V=!1,Q=!1,J=!1,$=typeof setTimeout=="function"?setTimeout:null,he=typeof clearTimeout=="function"?clearTimeout:null,xe=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function ge(U){for(var ie=s(w);ie!==null;){if(ie.callback===null)c(w);else if(ie.startTime<=U)c(w),ie.sortIndex=ie.expirationTime,l(S,ie);else break;ie=s(w)}}function re(U){if(J=!1,ge(U),!Q)if(s(S)!==null)Q=!0,Fe(q);else{var ie=s(w);ie!==null&&ze(re,ie.startTime-U)}}function q(U,ie){Q=!1,J&&(J=!1,he(W),W=-1),V=!0;var Y=N;try{for(ge(ie),O=s(S);O!==null&&(!(O.expirationTime>ie)||U&&!Ie());){var x=O.callback;if(typeof x=="function"){O.callback=null,N=O.priorityLevel;var A=x(O.expirationTime<=ie);ie=o.unstable_now(),typeof A=="function"?O.callback=A:O===s(S)&&c(S),ge(ie)}else c(S);O=s(S)}if(O!==null)var fe=!0;else{var me=s(w);me!==null&&ze(re,me.startTime-ie),fe=!1}return fe}finally{O=null,N=Y,V=!1}}var oe=!1,z=null,W=-1,te=5,we=-1;function Ie(){return!(o.unstable_now()-we<te)}function Xe(){if(z!==null){var U=o.unstable_now();we=U;var ie=!0;try{ie=z(!0,U)}finally{ie?Oe():(oe=!1,z=null)}}else oe=!1}var Oe;if(typeof xe=="function")Oe=function(){xe(Xe)};else if(typeof MessageChannel<"u"){var $e=new MessageChannel,it=$e.port2;$e.port1.onmessage=Xe,Oe=function(){it.postMessage(null)}}else Oe=function(){$(Xe,0)};function Fe(U){z=U,oe||(oe=!0,Oe())}function ze(U,ie){W=$(function(){U(o.unstable_now())},ie)}o.unstable_IdlePriority=5,o.unstable_ImmediatePriority=1,o.unstable_LowPriority=4,o.unstable_NormalPriority=3,o.unstable_Profiling=null,o.unstable_UserBlockingPriority=2,o.unstable_cancelCallback=function(U){U.callback=null},o.unstable_continueExecution=function(){Q||V||(Q=!0,Fe(q))},o.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):te=0<U?Math.floor(1e3/U):5},o.unstable_getCurrentPriorityLevel=function(){return N},o.unstable_getFirstCallbackNode=function(){return s(S)},o.unstable_next=function(U){switch(N){case 1:case 2:case 3:var ie=3;break;default:ie=N}var Y=N;N=ie;try{return U()}finally{N=Y}},o.unstable_pauseExecution=function(){},o.unstable_requestPaint=function(){},o.unstable_runWithPriority=function(U,ie){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var Y=N;N=U;try{return ie()}finally{N=Y}},o.unstable_scheduleCallback=function(U,ie,Y){var x=o.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?x+Y:x):Y=x,U){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=Y+A,U={id:C++,callback:ie,priorityLevel:U,startTime:Y,expirationTime:A,sortIndex:-1},Y>x?(U.sortIndex=Y,l(w,U),s(S)===null&&U===s(w)&&(J?(he(W),W=-1):J=!0,ze(re,Y-x))):(U.sortIndex=A,l(S,U),Q||V||(Q=!0,Fe(q))),U},o.unstable_shouldYield=Ie,o.unstable_wrapCallback=function(U){var ie=N;return function(){var Y=N;N=ie;try{return U.apply(this,arguments)}finally{N=Y}}}})(Na)),Na}var Id;function Eh(){return Id||(Id=1,Ra.exports=Sh()),Ra.exports}/**
* @license React
* react-dom.production.min.js
*
@@ -39,76 +39,79 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var jd;function kh(){if(jd)return Mt;jd=1;var o=Qa(),i=wh();function s(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var c=new Set,f={};function h(e,t){y(e,t),y(e+"Capture",t)}function y(e,t){for(f[e]=t,e=0;e<t.length;e++)c.add(t[e])}var m=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),S=Object.prototype.hasOwnProperty,k=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,j={},_={};function N(e){return S.call(_,e)?!0:S.call(j,e)?!1:k.test(e)?_[e]=!0:(j[e]=!0,!1)}function H(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function B(e,t,n,r){if(t===null||typeof t>"u"||H(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function K(e,t,n,r,l,a,d){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=d}var J={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){J[e]=new K(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];J[t]=new K(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){J[e]=new K(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){J[e]=new K(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){J[e]=new K(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){J[e]=new K(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){J[e]=new K(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){J[e]=new K(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){J[e]=new K(e,5,!1,e.toLowerCase(),null,!1,!1)});var fe=/[\-:]([a-z])/g;function me(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(fe,me);J[t]=new K(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(fe,me);J[t]=new K(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(fe,me);J[t]=new K(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){J[e]=new K(e,1,!1,e.toLowerCase(),null,!1,!1)}),J.xlinkHref=new K("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){J[e]=new K(e,1,!1,e.toLowerCase(),null,!0,!0)});function de(e,t,n,r){var l=J.hasOwnProperty(t)?J[t]:null;(l!==null?l.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="nLine truncated
`+x+e}var pe=!1;function he(e,t){if(!e||pe)return"";pe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(R){var r=R}Reflect.construct(e,[],t)}else{try{t.call()}catch(R){r=R}e.call(t.prototype)}else{try{throw Error()}catch(R){r=R}e()}}catch(R){if(R&&r&&typeof R.stack=="string"){for(var l=R.stack.split(`
*/var zd;function Th(){if(zd)return Ft;zd=1;var o=qa(),l=Eh();function s(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var c=new Set,f={};function h(e,t){y(e,t),y(e+"Capture",t)}function y(e,t){for(f[e]=t,e=0;e<t.length;e++)c.add(t[e])}var m=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),S=Object.prototype.hasOwnProperty,w=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,C={},O={};function N(e){return S.call(O,e)?!0:S.call(C,e)?!1:w.test(e)?O[e]=!0:(C[e]=!0,!1)}function V(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Q(e,t,n,r){if(t===null||typeof t>"u"||V(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function J(e,t,n,r,i,a,d){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=d}var $={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){$[e]=new J(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];$[t]=new J(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){$[e]=new J(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){$[e]=new J(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){$[e]=new J(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){$[e]=new J(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){$[e]=new J(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){$[e]=new J(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){$[e]=new J(e,5,!1,e.toLowerCase(),null,!1,!1)});var he=/[\-:]([a-z])/g;function xe(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(he,xe);$[t]=new J(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(he,xe);$[t]=new J(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(he,xe);$[t]=new J(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){$[e]=new J(e,1,!1,e.toLowerCase(),null,!1,!1)}),$.xlinkHref=new J("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){$[e]=new J(e,1,!1,e.toLowerCase(),null,!0,!0)});function ge(e,t,n,r){var i=$.hasOwnProperty(t)?$[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="nLine truncated
`+x+e}var fe=!1;function me(e,t){if(!e||fe)return"";fe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(R){var r=R}Reflect.construct(e,[],t)}else{try{t.call()}catch(R){r=R}e.call(t.prototype)}else{try{throw Error()}catch(R){r=R}e()}}catch(R){if(R&&r&&typeof R.stack=="string"){for(var i=R.stack.split(`
`),a=r.stack.split(`
`),d=l.length-1,g=a.length-1;1<=d&&0<=g&&l[d]!==a[g];)g--;for(;1<=d&&0<=g;d--,g--)if(l[d]!==a[g]){if(d!==1||g!==1)do if(d--,g--,0>g||l[d]!==a[g]){var v=`
`+l[d].replace(" at new "," at ");return e.displayName&&v.includes("<anonymous>")&&(v=v.replace("<anonymous>",e.displayName)),v}while(1<=d&&0<=g);break}}}finally{pe=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?A(e):""}function ge(e){switch(e.tag){case 5:return A(e.type);case 16:return A("Lazy");case 13:return A("Suspense");case 19:return A("SuspenseList");case 0:case 2:case 15:return e=he(e.type,!1),e;case 11:return e=he(e.type.render,!1),e;case 1:return e=he(e.type,!0),e;default:return""}}function we(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 I:return"Fragment";case re:return"Portal";case ne:return"Profiler";case U:return"StrictMode";case Ve:return"Suspense";case ft:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case _e:return(e.displayName||"Context")+".Consumer";case ye:return(e._context.displayName||"Context")+".Provider";case Ze:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case lt:return t=e.displayName||null,t!==null?t:we(e.type)||"Memo";case De:t=e._payload,e=e._init;try{return we(e(t))}catch{}}return null}function Ce(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 we(t);case 8:return t===U?"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 ke(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Le(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ee(e){var t=Le(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,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(d){r=""+d,a.call(this,d)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(d){r=""+d},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ne(e){e._valueTracker||(e._valueTracker=Ee(e))}function In(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Le(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function xe(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 Zt(e,t){var n=t.checked;return V({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Pe(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ke(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 an(e,t){t=t.checked,t!=null&&de(e,"checked",t,!1)}function vn(e,t){an(e,t);var n=ke(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")?yn(e,t.type,n):t.hasOwnProperty("defaultValue")&&yn(e,t.type,ke(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 yn(e,t,n){(t!=="number"||xe(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var un=Array.isArray;function Wt(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=""+ke(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 Bn(e,t){if(t.dangerouslySLine truncated
`).replace(Rp,"")}function Mi(e,t,n){if(t=Fu(t),Fu(e)!==t&&n)throw Error(s(425))}function Fi(){}var fs=null,ps=null;function hs(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 gs=typeof setTimeout=="function"?setTimeout:void 0,Np=typeof clearTimeout=="function"?clearTimeout:void 0,Wu=typeof Promise=="function"?Promise:void 0,Ip=typeof queueMicrotask=="function"?queueMicrotask:typeof Wu<"u"?function(e){return Wu.resolve(null).then(e).catch(zp)}:gs;function zp(e){setTimeout(function(){throw e})}function ms(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),Dl(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=l}while(n);Dl(t)}function lr(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 Uu(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 el=Math.random().toString(36).slice(2),Sn="__reactFiber$"+el,Ql="__reactProps$"+el,Pn="__reactContainer$"+el,vs="__reactEvents$"+el,Ap="__reactListeners$"+el,Lp="__reactHandles$"+el;function Cr(e){var t=e[Sn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Pn]||n[Sn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Uu(e);e!==null;){if(n=e[Sn])return n;e=Uu(e)}return t}e=n,n=e.parentNode}return null}function Yl(e){return e=e[Sn]||e[Pn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function tl(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(s(33))}function Wi(e){return e[Ql]||null}var ys=[],nl=-1;function ir(e){return{current:e}}function Be(e){0>nl||(e.current=ys[nl],ys[nl]=null,nl--)}function be(e,t){nl++,ys[nl]=e.current,e.current=t}var or={},wt=ir(or),Pt=ir(!1),jr=or;function rl(e,t){var n=e.type.contextTypes;if(!n)return or;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},a;for(a in n)l[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function Dt(e){return e=e.childContextTypes,e!=null}function Ui(){Be(Pt),Be(wt)}function Hu(e,t,n){if(wt.current!==or)throw Error(s(168));be(wt,t),be(Pt,n)}function Bu(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,Ce(e)||"Unknown",l));return V({},n,r)}function Hi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||or,jr=wt.current,be(wt,e),be(Pt,Pt.current),!0}function Vu(e,t,n){var r=e.stateNode;if(!r)throw Error(s(169));n?(e=Bu(e,t,jr),r.__reactInternalMemoizedMergedChildContext=e,Be(Pt),Be(wt),be(wt,e)):Be(Pt),be(Pt,n)}var Dn=null,Bi=!1,xs=!1;function Qu(e){Dn===null?Dn=[e]:Dn.push(e)}function Pp(e){Bi=!0,Qu(e)}function sr(){if(!xs&&Dn!==null){xs=!0;var e=0,t=p;try{var n=Dn;for(p=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Dn=null,Bi=!1}catch(l){throw Dn!==null&&(Dn=Dn.slice(e+1)),ki(cn,sr),l}finally{p=t,xs=!1}}return null}var ll=[],il=0,Vi=null,Qi=0,en=[],tn=0,Rr=null,On=1,bn="";function Nr(e,t){ll[il++]=Qi,ll[il++]=Vi,Vi=e,Qi=t}function Yu(e,t,n){en[tn++]=On,en[tn++]=bn,en[tn++]=Rr,Rr=e;var r=On;e=bn;var l=32-yt(r)-1;r&=~(1<<l),n+=1;var a=32-yt(t)+l;if(30<a){var d=l-l%5;a=(r&(1<<d)-1).toString(32),r>>=d,l-=d,On=1<<32-yt(t)+l|n<<l|r,bn=a+e}else On=1<<a|n<<l|r,bn=e}function ws(e){e.return!==null&&(Nr(e,1),Yu(e,1,0))}function ks(e){for(;e===Vi;)Vi=ll[--il],ll[il]=null,Qi=ll[--il],ll[il]=null;for(;e===Rr;)Rr=en[--tn],en[tn]=null,bn=en[--tn],en[tn]=null,On=en[--tn],en[tn]=null}var Yt=null,Gt=null,Ye=!1,fn=null;function Gu(e,t){var n=on(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 qu(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,Yt=e,Gt=lr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Yt=e,Gt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Rr!==null?{id:On,overflow:bn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=on(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Yt=e,Gt=null,!0):!1;default:return!1}}function Ss(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Es(e){if(Ye){var t=Gt;if(t){var n=t;if(!qu(e,t)){if(Ss(e))throw Error(s(418));t=lr(n.nextSibling);var r=Yt;t&&qu(e,t)?Gu(r,n):(e.flags=e.flags&-4097|2,Ye=!1,Yt=e)}}else{if(Ss(e))throw Error(s(418));e.flags=e.flags&-4097|2,Ye=!1,Yt=e}}}function Xu(e){for(e=e.retLine truncated
`),d=i.length-1,g=a.length-1;1<=d&&0<=g&&i[d]!==a[g];)g--;for(;1<=d&&0<=g;d--,g--)if(i[d]!==a[g]){if(d!==1||g!==1)do if(d--,g--,0>g||i[d]!==a[g]){var v=`
`+i[d].replace(" at new "," at ");return e.displayName&&v.includes("<anonymous>")&&(v=v.replace("<anonymous>",e.displayName)),v}while(1<=d&&0<=g);break}}}finally{fe=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?A(e):""}function ve(e){switch(e.tag){case 5:return A(e.type);case 16:return A("Lazy");case 13:return A("Suspense");case 19:return A("SuspenseList");case 0:case 2:case 15:return e=me(e.type,!1),e;case 11:return e=me(e.type.render,!1),e;case 1:return e=me(e.type,!0),e;default:return""}}function ke(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 z:return"Fragment";case oe:return"Portal";case te:return"Profiler";case W:return"StrictMode";case Oe:return"Suspense";case $e:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ie:return(e.displayName||"Context")+".Consumer";case we:return(e._context.displayName||"Context")+".Provider";case Xe:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case it:return t=e.displayName||null,t!==null?t:ke(e.type)||"Memo";case Fe:t=e._payload,e=e._init;try{return ke(e(t))}catch{}}return null}function Ee(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 ke(t);case 8:return t===W?"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 H(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function pe(e){var t=H(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 i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(d){r=""+d,a.call(this,d)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(d){r=""+d},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Te(e){e._valueTracker||(e._valueTracker=pe(e))}function qt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=H(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function je(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 Xt(e,t){var n=t.checked;return Y({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function De(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 un(e,t){t=t.checked,t!=null&&ge(e,"checked",t,!1)}function yn(e,t){un(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")?xn(e,t.type,n):t.hasOwnProperty("defaultValue")&&xn(e,t.type,ye(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Lt(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 xn(e,t,n){(t!=="number"||je(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Zt=Array.isArray;function yt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+ye(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Gn(e,t){if(t.dangerouslySetILine truncated
`).replace(zp,"")}function Mi(e,t,n){if(t=Bu(t),Bu(e)!==t&&n)throw Error(s(425))}function Fi(){}var gs=null,ms=null;function vs(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 ys=typeof setTimeout=="function"?setTimeout:void 0,Ap=typeof clearTimeout=="function"?clearTimeout:void 0,Vu=typeof Promise=="function"?Promise:void 0,Lp=typeof queueMicrotask=="function"?queueMicrotask:typeof Vu<"u"?function(e){return Vu.resolve(null).then(e).catch(Pp)}:ys;function Pp(e){setTimeout(function(){throw e})}function xs(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),_l(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);_l(t)}function or(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 Qu(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),Rn="__reactFiber$"+tl,Gl="__reactProps$"+tl,On="__reactContainer$"+tl,ws="__reactEvents$"+tl,Dp="__reactListeners$"+tl,bp="__reactHandles$"+tl;function Cr(e){var t=e[Rn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[On]||n[Rn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Qu(e);e!==null;){if(n=e[Rn])return n;e=Qu(e)}return t}e=n,n=e.parentNode}return null}function ql(e){return e=e[Rn]||e[On],!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 Wi(e){return e[Gl]||null}var ks=[],rl=-1;function sr(e){return{current:e}}function Be(e){0>rl||(e.current=ks[rl],ks[rl]=null,rl--)}function Me(e,t){rl++,ks[rl]=e.current,e.current=t}var ar={},kt=sr(ar),Dt=sr(!1),Rr=ar;function ll(e,t){var n=e.type.contextTypes;if(!n)return ar;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function bt(e){return e=e.childContextTypes,e!=null}function Ui(){Be(Dt),Be(kt)}function Yu(e,t,n){if(kt.current!==ar)throw Error(s(168));Me(kt,t),Me(Dt,n)}function Gu(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(s(108,Ee(e)||"Unknown",i));return Y({},n,r)}function Hi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ar,Rr=kt.current,Me(kt,e),Me(Dt,Dt.current),!0}function qu(e,t,n){var r=e.stateNode;if(!r)throw Error(s(169));n?(e=Gu(e,t,Rr),r.__reactInternalMemoizedMergedChildContext=e,Be(Dt),Be(kt),Me(kt,e)):Be(Dt),Me(Dt,n)}var Mn=null,Bi=!1,Ss=!1;function Xu(e){Mn===null?Mn=[e]:Mn.push(e)}function _p(e){Bi=!0,Xu(e)}function ur(){if(!Ss&&Mn!==null){Ss=!0;var e=0,t=p;try{var n=Mn;for(p=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Mn=null,Bi=!1}catch(i){throw Mn!==null&&(Mn=Mn.slice(e+1)),ki(dn,ur),i}finally{p=t,Ss=!1}}return null}var il=[],ol=0,Vi=null,Qi=0,tn=[],nn=0,Nr=null,Fn=1,Wn="";function Ir(e,t){il[ol++]=Qi,il[ol++]=Vi,Vi=e,Qi=t}function Zu(e,t,n){tn[nn++]=Fn,tn[nn++]=Wn,tn[nn++]=Nr,Nr=e;var r=Fn;e=Wn;var i=32-xt(r)-1;r&=~(1<<i),n+=1;var a=32-xt(t)+i;if(30<a){var d=i-i%5;a=(r&(1<<d)-1).toString(32),r>>=d,i-=d,Fn=1<<32-xt(t)+i|n<<i|r,Wn=a+e}else Fn=1<<a|n<<i|r,Wn=e}function Es(e){e.return!==null&&(Ir(e,1),Zu(e,1,0))}function Ts(e){for(;e===Vi;)Vi=il[--ol],il[ol]=null,Qi=il[--ol],il[ol]=null;for(;e===Nr;)Nr=tn[--nn],tn[nn]=null,Wn=tn[--nn],tn[nn]=null,Fn=tn[--nn],tn[nn]=null}var Vt=null,Qt=null,Qe=!1,pn=null;function Ku(e,t){var n=sn(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 Ju(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,Vt=e,Qt=or(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Vt=e,Qt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Nr!==null?{id:Fn,overflow:Wn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=sn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Vt=e,Qt=null,!0):!1;default:return!1}}function js(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Cs(e){if(Qe){var t=Qt;if(t){var n=t;if(!Ju(e,t)){if(js(e))throw Error(s(418));t=or(n.nextSibling);var r=Vt;t&&Ju(e,t)?Ku(r,n):(e.flags=e.flags&-4097|2,Qe=!1,Vt=e)}}else{if(js(e))throw Error(s(418));e.flags=e.flags&-4097|2,Qe=!1,Vt=e}}}function $u(e){for(e=e.retLine truncated
Error generating stack: `+a.message+`
`+a.stack}return{value:e,source:t,stack:l,digest:null}}function Qs(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ys(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Hp=typeof WeakMap=="function"?WeakMap:Map;function Ic(e,t,n){n=Mn(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){fo||(fo=!0,sa=r),Ys(e,t)},n}function zc(e,t,n){n=Mn(-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(){Ys(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch=="function"&&(n.callback=function(){Ys(e,t),typeof r!="function"&&(dr===null?dr=new Set([this]):dr.add(this));var d=t.stack;this.componentDidCatch(t.value,{componentStack:d!==null?d:""})}),n}function Ac(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Hp;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=nh.bind(null,e,t,n),t.then(e,e))}function Lc(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 Pc(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=Mn(-1,1),t.tag=2,ur(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=l,e)}var Bp=ee.ReactCurrentOwner,Ot=!1;function Ct(e,t,n,r){t.child=e===null?$u(t,null,n,r):sl(t,e.child,n,r)}function Dc(e,t,n,r,l){n=n.render;var a=t.ref;return ul(t,l),r=_s(e,t,n,r,a,l),n=Ms(),e!==null&&!Ot?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Fn(e,t,l)):(Ye&&n&&ws(t),t.flags|=1,Ct(e,t,r,l),t.child)}function Oc(e,t,n,r,l){if(e===null){var a=n.type;return typeof a=="function"&&!ha(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,bc(e,t,a,r,l)):(e=yo(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&l)===0){var d=a.memoizedProps;if(n=n.compare,n=n!==null?n:Wl,n(d,r)&&e.ref===t.ref)return Fn(e,t,l)}return t.flags|=1,e=gr(a,r),e.ref=t.ref,e.return=t,t.child=e}function bc(e,t,n,r,l){if(e!==null){var a=e.memoizedProps;if(Wl(a,r)&&e.ref===t.ref)if(Ot=!1,t.pendingProps=r=a,(e.lanes&l)!==0)(e.flags&131072)!==0&&(Ot=!0);else return t.lanes=e.lanes,Fn(e,t,l)}return Gs(e,t,n,r,l)}function _c(e,t,n){var r=t.pendingProps,l=r.children,a=e!==null?e.memoizedState:null;if(r.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},be(pl,qt),qt|=n;else{if((n&1073741824)===0)return e=a!==null?a.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,be(pl,qt),qt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a!==null?a.baseLanes:n,be(pl,qt),qt|=r}else a!==null?(r=a.baseLanes|n,t.memoizedState=null):r=n,be(pl,qt),qt|=r;return Ct(e,t,l,n),t.child}function Mc(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Gs(e,t,n,r,l){var a=Dt(n)?jr:wt.current;return a=rl(t,a),ul(t,l),n=_s(e,t,n,r,a,l),r=Ms(),e!==null&&!Ot?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Fn(e,t,l)):(Ye&&r&&ws(t),t.flags|=1,Ct(e,t,n,l),t.child)}function Fc(e,t,n,r,l){if(Dt(n)){var a=!0;Hi(t)}else a=!1;if(ul(t,l),t.stateNode===null)oo(e,t),Rc(t,n,r),Vs(t,n,r,l),r=!0;else if(e===null){var d=t.stateNode,g=t.memoizedProps;d.props=g;var v=d.context,R=n.contextType;typeof R=="object"&&R!==null?R=nn(R):(R=Dt(n)?jr:wt.current,R=rl(t,R));var O=n.getDerivedStateFromProps,b=typeof O=="function"||typeof d.getSnapshotBeforeUpdate=="function";b||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(g!==r||v!==R)&&Nc(t,d,r,R),ar=!1;var D=t.memoizedState;d.state=D,Ki(t,r,d,l),v=t.memoizedState,g!==r||D!==v||Pt.current||ar?(typeof O=="function"&&(Bs(t,n,O,r),v=t.memoizedState),(g=ar||jc(t,n,g,r,D,v,R))?(b||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=v),d.props=r,d.state=v,d.context=R,r=g):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{d=t.stateNode,tc(e,t),g=t.memoizedProps,R=t.type===t.elementType?g:pn(t.type,g),d.props=R,b=t.pendingProps,D=d.context,v=n.contextType,typeof v=="object"&&v!==null?v=nn(v):(v=Dt(n)?jr:wt.current,v=rl(t,v));var Q=n.getDerivedStateFromProps;(O=typeof Q=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(g!==b||D!==v)&&Nc(t,d,r,v),ar=!1,D=t.memoizedState,d.state=D,Ki(t,r,d,Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bh(o,i){return Wh(o)||Uh(o,i)||Vh(o,i)||Hh()}function Vh(o,i){if(o){if(typeof o=="string")return Id(o,i);var s={}.toString.call(o).slice(8,-1);return s==="Object"&&o.constructor&&(s=o.constructor.name),s==="Map"||s==="Set"?Array.from(o):s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?Id(o,i):void 0}}const uf=Object.entries,zd=Object.setPrototypeOf,Qh=Object.isFrozen,Yh=Object.getPrototypeOf,Gh=Object.getOwnPropertyDescriptor;let mt=Object.freeze,vt=Object.seal,yl=Object.create,cf=typeof Reflect<"u"&&Reflect,Pa=cf.apply,Da=cf.construct;mt||(mt=function(i){return i});vt||(vt=function(i){return i});Pa||(Pa=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)});Da||(Da=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 ml=nt(Array.prototype.forEach),qh=nt(Array.prototype.lastIndexOf),Ad=nt(Array.prototype.pop),vl=nt(Array.prototype.push),Xh=nt(Array.prototype.splice),xr=Array.isArray,pi=nt(String.prototype.toLowerCase),ja=nt(String.prototype.toString),Ld=nt(String.prototype.match),ui=nt(String.prototype.replace),Pd=nt(String.prototype.indexOf),Zh=nt(String.prototype.trim),Kh=nt(Number.prototype.toString),Jh=nt(Boolean.prototype.toString),Dd=typeof BigInt>"u"?null:nt(BigInt.prototype.toString),Od=typeof Symbol>"u"?null:nt(Symbol.prototype.toString),dt=nt(Object.prototype.hasOwnProperty),ci=nt(Object.prototype.toString),ct=nt(RegExp.prototype.test),_r=$h(TypeError);function nt(o){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 Pa(o,i,c)}}function $h(o){return function(){for(var i=arguments.length,s=new Array(i),c=0;c<i;c++)s[c]=arguments[c];return Da(o,s)}}function Te(o,i){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:pi;if(zd&&zd(o,null),!xr(i))return o;let c=i.length;for(;c--;){let f=i[c];if(typeof f=="string"){const h=s(f);h!==f&&(Qh(i)||(i[c]=h),f=h)}o[f]=!0}return o}function eg(o){for(let i=0;i<o.length;i++)dt(o,i)||(o[i]=null);return o}function Rt(o){const i=yl(null);for(const c of uf(o)){var s=Bh(c,2);const f=s[0],h=s[1];dt(o,f)&&(xr(h)?i[f]=eg(h):h&&typeof h=="object"&&h.constructor===Object?i[f]=Rt(h):i[f]=h)}return i}function tg(o){switch(typeof o){case"string":return o;case"number":return Kh(o);case"boolean":return Jh(o);case"bigint":return Dd?Dd(o):"0";case"symbol":return Od?Od(o):"Symbol()";case"undefined":return ci(o);case"function":case"object":{if(o===null)return ci(o);const i=o,s=Rn(i,"toString");if(typeof s=="function"){const c=s(i);return typeof c=="string"?c:ci(c)}return ci(o)}default:return ci(o)}}function Rn(o,i){for(;o!==null;){const c=Gh(o,i);if(c){if(c.get)return nt(c.get);if(typeof c.value=="function")return nt(c.value)}o=Yh(o)}function s(){return null}return s}function ng(o){try{return ct(o,""),!0}catch{return!1}}const bd=mt(["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"]),Ra=mt(["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"]),Na=mt(["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"]),rg=mt(["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),zt&&(xt=Tt(xt)),re&&Yn?Ze(xt):xt},i.setConfig=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};El(M),Vn=!0,Ut=Ne,xn=xe},i.clearConfig=function(){Lt=null,Vn=!1,Ut=null,xn=null,re=U,I=""},i.isValidAttribute=function(M,p,C){Lt||El({});const P=We(M),q=We(p);return Tr(P,q,C)},i.addHook=function(M,p){typeof p=="function"&&dt(x,M)&&vl(x[M],p)},i.removeHook=function(M,p){if(dt(x,M)){if(p!==void 0){const C=qh(x[M],p);return C===-1?void 0:Xh(x[M],C,1)[0]}return Ad(x[M])}},i.removeHooks=function(M){dt(x,M)&&(x[M]=[])},i.removeAllHooks=function(){x=Bd()},i}var yg=df();function Ga(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Wr=Ga();function ff(o){Wr=o}var gi={exec:()=>null};function Ae(o,i=""){let s=typeof o=="string"?o:o.source;const c={replace:(f,h)=>{let y=typeof h=="string"?h:h.source;return y=y.replace(Nt.caret,"$1"),s=s.replace(f,y),c},getRegex:()=>new RegExp(s,i)};return c}var Nt={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:o=>new RegExp(`^( {0,3}${o})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:o=>new RegExp(`^ {0,${Math.min(3,o-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:o=>new RegExp(`^ {0,${Math.min(3,o-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:o=>new RegExp(`^ {0,${Math.min(3,o-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:o=>new RegExp(`^ {0,${Math.min(3,o-1)}}#`),htmlBeginRegex:o=>new RegExp(`^ {0,${Math.min(3,o-1)}}<(?:[a-z].*>|!--)`,"i")},xg=/^(?:[ \t]*(?:\n|$))+/,wg=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,kg=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,xi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Sg=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,qa=/(?:[*+-]|\d{1,9}[.)])/,pf=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,hf=Ae(pf).replace(/bull/g,qa).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(),Eg=Ae(pf).replace(/bull/g,qa).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(),Xa=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Tg=/^[^\n]+/,Za=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Cg=Ae(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Za).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),jg=Ae(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,qa).getRegex(),_o="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",Ka=/\x3C!--(?:-?>|[\s\S]*?(?:-->|$))/,Rg=Ae("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:Line truncated
]`).replace("lheading",hf).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ag=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Lg=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,mf=/^( {2,}|\\)\n(?!\s*$)/,Pg=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Mo=/[\p{P}\p{S}]/u,$a=/[\s\p{P}\p{S}]/u,vf=/[^\s\p{P}\p{S}]/u,Dg=Ae(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,$a).getRegex(),yf=/(?!~)[\p{P}\p{S}]/u,Og=/(?!~)[\s\p{P}\p{S}]/u,bg=/(?:[^\s\p{P}\p{S}]|~)/u,_g=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,xf=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Mg=Ae(xf,"u").replace(/punct/g,Mo).getRegex(),Fg=Ae(xf,"u").replace(/punct/g,yf).getRegex(),wf="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Wg=Ae(wf,"gu").replace(/notPunctSpace/g,vf).replace(/punctSpace/g,$a).replace(/punct/g,Mo).getRegex(),Ug=Ae(wf,"gu").replace(/notPunctSpace/g,bg).replace(/punctSpace/g,Og).replace(/punct/g,yf).getRegex(),Hg=Ae("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,vf).replace(/punctSpace/g,$a).replace(/punct/g,Mo).getRegex(),Bg=Ae(/\\(punct)/,"gu").replace(/punct/g,Mo).getRegex(),Vg=Ae(/^<(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(),Qg=Ae(Ka).replace("(?:-->|$)","-->").getRegex(),Yg=Ae("^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",Qg).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Po=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Gg=Ae(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Po).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),kf=Ae(/^!?\[(label)\]\[(ref)\]/).replace("label",Po).replace("ref",Za).getRegex(),Sf=Ae(/^!?\[(ref)\](?:\[\])?/).replace("ref",Za).getRegex(),qg=Ae("reflink|nolink(?!\\()","g").replace("reflink",kf).replace("nolink",Sf).getRegex(),eu={_backpedal:gi,anyPunctuation:Bg,autolink:Vg,blockSkip:_g,br:mf,code:Lg,del:gi,emStrongLDelim:Mg,emStrongRDelimAst:Wg,emStrongRDelimUnd:Hg,escape:Ag,link:Gg,nolink:Sf,punctuation:Dg,reflink:kf,reflinkSearch:qg,tag:Yg,text:Pg,url:gi},Xg={...eu,link:Ae(/^!?\[(label)\]\((.*?)\)/).replace("label",Po).getRegex(),reflink:Ae(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Po).getRegex()},Oa={...eu,emStrongRDelimAst:Ug,emStrongLDelim:Fg,url:Ae(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},Zg={...Oa,br:Ae(mf).replace("{2,}","*").getRegex(),text:Ae(Oa.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},No={normal:Ja,gfm:Ig,pedantic:zg},di={normal:eu,gfm:Oa,breaks:Zg,pedantic:Xg},Kg={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Qd=o=>Kg[o];function Nn(o,i){if(i){if(Nt.escapeTest.test(o))return o.replace(Nt.escapeReplace,Qd)}else if(Nt.escapeTestNoEncode.test(o))return o.replace(Nt.escapeReplaceNoEncode,Qd);return o}function Yd(o){try{o=encodeURI(o).replace(Nt.percentDecode,"%")}catch{return null}return o}function Gd(o,i){var h;const s=o.replace(Nt.findPipe,(y,m,S)=>{let k=!1,j=m;for(;--j>=0&&S[j]==="\\";)k=!k;return k?"|":" |"}),c=s.split(Nt.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(Nt.slashPipe,"|");return c}function fi(o,i,s){const c=o.length;if(c===0)return"";let f=0;for(;f<c&&o.charAt(c-f-1)===i;)f++;return o.slice(0,c-f)}function Jg(o,i){if(o.indexOf(i[1])===-1)return-1;let s=0;for(let c=0;c<o.length;c++)if(o[c]==="\\")c++;else if(o[c]===i[0])s++;else if(o[c]===i[1]Line truncated
`+a.stack}return{value:e,source:t,stack:i,digest:null}}function qs(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Xs(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Qp=typeof WeakMap=="function"?WeakMap:Map;function Pc(e,t,n){n=Hn(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){fo||(fo=!0,ca=r),Xs(e,t)},n}function Dc(e,t,n){n=Hn(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Xs(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch=="function"&&(n.callback=function(){Xs(e,t),typeof r!="function"&&(pr===null?pr=new Set([this]):pr.add(this));var d=t.stack;this.componentDidCatch(t.value,{componentStack:d!==null?d:""})}),n}function bc(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Qp;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=ih.bind(null,e,t,n),t.then(e,e))}function _c(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 Oc(e,t,n,r,i){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=Hn(-1,1),t.tag=2,dr(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=i,e)}var Yp=re.ReactCurrentOwner,_t=!1;function Nt(e,t,n,r){t.child=e===null?rc(t,null,n,r):al(t,e.child,n,r)}function Mc(e,t,n,r,i){n=n.render;var a=t.ref;return cl(t,i),r=Ws(e,t,n,r,a,i),n=Us(),e!==null&&!_t?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Bn(e,t,i)):(Qe&&n&&Es(t),t.flags|=1,Nt(e,t,r,i),t.child)}function Fc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a=="function"&&!va(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Wc(e,t,a,r,i)):(e=yo(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var d=a.memoizedProps;if(n=n.compare,n=n!==null?n:Hl,n(d,r)&&e.ref===t.ref)return Bn(e,t,i)}return t.flags|=1,e=vr(a,r),e.ref=t.ref,e.return=t,t.child=e}function Wc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Hl(a,r)&&e.ref===t.ref)if(_t=!1,t.pendingProps=r=a,(e.lanes&i)!==0)(e.flags&131072)!==0&&(_t=!0);else return t.lanes=e.lanes,Bn(e,t,i)}return Zs(e,t,n,r,i)}function Uc(e,t,n){var r=t.pendingProps,i=r.children,a=e!==null?e.memoizedState:null;if(r.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Me(hl,Yt),Yt|=n;else{if((n&1073741824)===0)return e=a!==null?a.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Me(hl,Yt),Yt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a!==null?a.baseLanes:n,Me(hl,Yt),Yt|=r}else a!==null?(r=a.baseLanes|n,t.memoizedState=null):r=n,Me(hl,Yt),Yt|=r;return Nt(e,t,i,n),t.child}function Hc(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Zs(e,t,n,r,i){var a=bt(n)?Rr:kt.current;return a=ll(t,a),cl(t,i),n=Ws(e,t,n,r,a,i),r=Us(),e!==null&&!_t?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Bn(e,t,i)):(Qe&&r&&Es(t),t.flags|=1,Nt(e,t,n,i),t.child)}function Bc(e,t,n,r,i){if(bt(n)){var a=!0;Hi(t)}else a=!1;if(cl(t,i),t.stateNode===null)oo(e,t),Ac(t,n,r),Gs(t,n,r,i),r=!0;else if(e===null){var d=t.stateNode,g=t.memoizedProps;d.props=g;var v=d.context,R=n.contextType;typeof R=="object"&&R!==null?R=rn(R):(R=bt(n)?Rr:kt.current,R=ll(t,R));var D=n.getDerivedStateFromProps,_=typeof D=="function"||typeof d.getSnapshotBeforeUpdate=="function";_||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(g!==r||v!==R)&&Lc(t,d,r,R),cr=!1;var P=t.memoizedState;d.state=P,Ki(t,r,d,i),v=t.memoizedState,g!==r||P!==v||Dt.current||cr?(typeof D=="function"&&(Ys(t,n,D,r),v=t.memoizedState),(g=cr||zc(t,n,g,r,P,v,R))?(_||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=v),d.props=r,d.state=v,d.context=R,r=g):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{d=t.stateNode,ic(e,t),g=t.memoizedProps,R=t.type===t.elementType?g:hn(t.type,g),d.props=R,_=t.pendingProps,P=d.context,v=n.contextType,typeof v=="object"&&v!==null?v=rn(v):(v=bt(n)?Rr:kt.current,v=ll(t,v));var G=n.getDerivedStateFromProps;(D=typeof G=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(g!==_||P!==v)&&Lc(t,d,r,v),cr=!1,P=t.memoizedState,d.state=P,Ki(t,r,d,Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eg(o,l){return Kh(o)||Jh(o,l)||tg(o,l)||$h()}function tg(o,l){if(o){if(typeof o=="string")return Pd(o,l);var s={}.toString.call(o).slice(8,-1);return s==="Object"&&o.constructor&&(s=o.constructor.name),s==="Map"||s==="Set"?Array.from(o):s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?Pd(o,l):void 0}}const ff=Object.entries,Dd=Object.setPrototypeOf,ng=Object.isFrozen,rg=Object.getPrototypeOf,lg=Object.getOwnPropertyDescriptor;let mt=Object.freeze,vt=Object.seal,xl=Object.create,pf=typeof Reflect<"u"&&Reflect,Oa=pf.apply,Ma=pf.construct;mt||(mt=function(l){return l});vt||(vt=function(l){return l});Oa||(Oa=function(l,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 l.apply(s,f)});Ma||(Ma=function(l){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 l(...c)});const vl=rt(Array.prototype.forEach),ig=rt(Array.prototype.lastIndexOf),bd=rt(Array.prototype.pop),yl=rt(Array.prototype.push),og=rt(Array.prototype.splice),kr=Array.isArray,gi=rt(String.prototype.toLowerCase),Ia=rt(String.prototype.toString),_d=rt(String.prototype.match),di=rt(String.prototype.replace),Od=rt(String.prototype.indexOf),sg=rt(String.prototype.trim),ag=rt(Number.prototype.toString),ug=rt(Boolean.prototype.toString),Md=typeof BigInt>"u"?null:rt(BigInt.prototype.toString),Fd=typeof Symbol>"u"?null:rt(Symbol.prototype.toString),pt=rt(Object.prototype.hasOwnProperty),fi=rt(Object.prototype.toString),ft=rt(RegExp.prototype.test),Mr=cg(TypeError);function rt(o){return function(l){l instanceof RegExp&&(l.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 Oa(o,l,c)}}function cg(o){return function(){for(var l=arguments.length,s=new Array(l),c=0;c<l;c++)s[c]=arguments[c];return Ma(o,s)}}function Ce(o,l){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:gi;if(Dd&&Dd(o,null),!kr(l))return o;let c=l.length;for(;c--;){let f=l[c];if(typeof f=="string"){const h=s(f);h!==f&&(ng(l)||(l[c]=h),f=h)}o[f]=!0}return o}function dg(o){for(let l=0;l<o.length;l++)pt(o,l)||(o[l]=null);return o}function zt(o){const l=xl(null);for(const c of ff(o)){var s=eg(c,2);const f=s[0],h=s[1];pt(o,f)&&(kr(h)?l[f]=dg(h):h&&typeof h=="object"&&h.constructor===Object?l[f]=zt(h):l[f]=h)}return l}function fg(o){switch(typeof o){case"string":return o;case"number":return ag(o);case"boolean":return ug(o);case"bigint":return Md?Md(o):"0";case"symbol":return Fd?Fd(o):"Symbol()";case"undefined":return fi(o);case"function":case"object":{if(o===null)return fi(o);const l=o,s=Ln(l,"toString");if(typeof s=="function"){const c=s(l);return typeof c=="string"?c:fi(c)}return fi(o)}default:return fi(o)}}function Ln(o,l){for(;o!==null;){const c=lg(o,l);if(c){if(c.get)return rt(c.get);if(typeof c.value=="function")return rt(c.value)}o=rg(o)}function s(){return null}return s}function pg(o){try{return ft(o,""),!0}catch{return!1}}const Wd=mt(["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"]),za=mt(["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"]),Aa=mt(["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"]),hg=mt(["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
`+wt),Ut&&(wt=Rt(wt)),oe&&Xn?Xe(wt):wt},l.setConfig=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};jl(M),Dn=!0,wn=Te,kn=je},l.clearConfig=function(){Pt=null,Dn=!1,wn=null,kn=null,oe=W,z=""},l.isValidAttribute=function(M,p,j){Pt||jl({});const L=We(M),X=We(p);return jr(L,X,j)},l.addHook=function(M,p){typeof p=="function"&&pt(x,M)&&yl(x[M],p)},l.removeHook=function(M,p){if(pt(x,M)){if(p!==void 0){const j=ig(x[M],p);return j===-1?void 0:og(x[M],j,1)[0]}return bd(x[M])}},l.removeHooks=function(M){pt(x,M)&&(x[M]=[])},l.removeAllHooks=function(){x=Gd()},l}var Ig=hf();function Ka(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ur=Ka();function gf(o){Ur=o}var vi={exec:()=>null};function Pe(o,l=""){let s=typeof o=="string"?o:o.source;const c={replace:(f,h)=>{let y=typeof h=="string"?h:h.source;return y=y.replace(At.caret,"$1"),s=s.replace(f,y),c},getRegex:()=>new RegExp(s,l)};return c}var At={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:o=>new RegExp(`^( {0,3}${o})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:o=>new RegExp(`^ {0,${Math.min(3,o-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:o=>new RegExp(`^ {0,${Math.min(3,o-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:o=>new RegExp(`^ {0,${Math.min(3,o-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:o=>new RegExp(`^ {0,${Math.min(3,o-1)}}#`),htmlBeginRegex:o=>new RegExp(`^ {0,${Math.min(3,o-1)}}<(?:[a-z].*>|!--)`,"i")},zg=/^(?:[ \t]*(?:\n|$))+/,Ag=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Lg=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,xi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Pg=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ja=/(?:[*+-]|\d{1,9}[.)])/,mf=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,vf=Pe(mf).replace(/bull/g,Ja).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(),Dg=Pe(mf).replace(/bull/g,Ja).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(),$a=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,bg=/^[^\n]+/,eu=/(?!\s*\])(?:\\.|[^\[\]\\])+/,_g=Pe(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",eu).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Og=Pe(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ja).getRegex(),Wo="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",tu=/\x3C!--(?:-?>|[\s\S]*?(?:-->|$))/,Mg=Pe("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:Line truncated
]`).replace("lheading",vf).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Hg=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Bg=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,xf=/^( {2,}|\\)\n(?!\s*$)/,Vg=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Uo=/[\p{P}\p{S}]/u,ru=/[\s\p{P}\p{S}]/u,wf=/[^\s\p{P}\p{S}]/u,Qg=Pe(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ru).getRegex(),kf=/(?!~)[\p{P}\p{S}]/u,Yg=/(?!~)[\s\p{P}\p{S}]/u,Gg=/(?:[^\s\p{P}\p{S}]|~)/u,qg=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Sf=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Xg=Pe(Sf,"u").replace(/punct/g,Uo).getRegex(),Zg=Pe(Sf,"u").replace(/punct/g,kf).getRegex(),Ef="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Kg=Pe(Ef,"gu").replace(/notPunctSpace/g,wf).replace(/punctSpace/g,ru).replace(/punct/g,Uo).getRegex(),Jg=Pe(Ef,"gu").replace(/notPunctSpace/g,Gg).replace(/punctSpace/g,Yg).replace(/punct/g,kf).getRegex(),$g=Pe("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,wf).replace(/punctSpace/g,ru).replace(/punct/g,Uo).getRegex(),em=Pe(/\\(punct)/,"gu").replace(/punct/g,Uo).getRegex(),tm=Pe(/^<(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(),nm=Pe(tu).replace("(?:-->|$)","-->").getRegex(),rm=Pe("^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",nm).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Do=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,lm=Pe(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Do).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Tf=Pe(/^!?\[(label)\]\[(ref)\]/).replace("label",Do).replace("ref",eu).getRegex(),jf=Pe(/^!?\[(ref)\](?:\[\])?/).replace("ref",eu).getRegex(),im=Pe("reflink|nolink(?!\\()","g").replace("reflink",Tf).replace("nolink",jf).getRegex(),lu={_backpedal:vi,anyPunctuation:em,autolink:tm,blockSkip:qg,br:xf,code:Bg,del:vi,emStrongLDelim:Xg,emStrongRDelimAst:Kg,emStrongRDelimUnd:$g,escape:Hg,link:lm,nolink:jf,punctuation:Qg,reflink:Tf,reflinkSearch:im,tag:rm,text:Vg,url:vi},om={...lu,link:Pe(/^!?\[(label)\]\((.*?)\)/).replace("label",Do).getRegex(),reflink:Pe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Do).getRegex()},Fa={...lu,emStrongRDelimAst:Jg,emStrongLDelim:Zg,url:Pe(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},sm={...Fa,br:Pe(xf).replace("{2,}","*").getRegex(),text:Pe(Fa.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},No={normal:nu,gfm:Wg,pedantic:Ug},pi={normal:lu,gfm:Fa,breaks:sm,pedantic:om},am={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Xd=o=>am[o];function Pn(o,l){if(l){if(At.escapeTest.test(o))return o.replace(At.escapeReplace,Xd)}else if(At.escapeTestNoEncode.test(o))return o.replace(At.escapeReplaceNoEncode,Xd);return o}function Zd(o){try{o=encodeURI(o).replace(At.percentDecode,"%")}catch{return null}return o}function Kd(o,l){var h;const s=o.replace(At.findPipe,(y,m,S)=>{let w=!1,C=m;for(;--C>=0&&S[C]==="\\";)w=!w;return w?"|":" |"}),c=s.split(At.splitPipe);let f=0;if(c[0].trim()||c.shift(),c.length>0&&!((h=c.at(-1))!=null&&h.trim())&&c.pop(),l)if(c.length>l)c.splice(l);else for(;c.length<l;)c.push("");for(;f<c.length;f++)c[f]=c[f].trim().replace(At.slashPipe,"|");return c}function hi(o,l,s){const c=o.length;if(c===0)return"";let f=0;for(;f<c&&o.charAt(c-f-1)===l;)f++;return o.slice(0,c-f)}function um(o,l){if(o.indexOf(l[1])===-1)return-1;let s=0;for(let c=0;c<o.length;c++)if(o[c]==="\\")c++;else if(o[c]===l[0])s++;else if(o[c]===l[1]Line truncated
`).map(h=>{const y=h.match(s.other.beginningSpace);if(y===null)return h;const[m]=y;return m.length>=f.length?h.slice(f.length):h}).join(`
`)}var Do=class{constructor(o){Oe(this,"options");Oe(this,"rules");Oe(this,"lexer");this.options=o||Wr}space(o){const i=this.rules.block.newline.exec(o);if(i&&i[0].length>0)return{type:"space",raw:i[0]}}code(o){const i=this.rules.block.code.exec(o);if(i){const s=i[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:i[0],codeBlockStyle:"indented",text:this.options.pedantic?s:fi(s,`
`)}}}fences(o){const i=this.rules.block.fences.exec(o);if(i){const s=i[0],c=$g(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(o){const i=this.rules.block.heading.exec(o);if(i){let s=i[2].trim();if(this.rules.other.endingHash.test(s)){const c=fi(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(o){const i=this.rules.block.hr.exec(o);if(i)return{type:"hr",raw:fi(i[0],`
`)}}blockquote(o){const i=this.rules.block.blockquote.exec(o);if(i){let s=fi(i[0],`
`)}var bo=class{constructor(o){_e(this,"options");_e(this,"rules");_e(this,"lexer");this.options=o||Ur}space(o){const l=this.rules.block.newline.exec(o);if(l&&l[0].length>0)return{type:"space",raw:l[0]}}code(o){const l=this.rules.block.code.exec(o);if(l){const s=l[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:l[0],codeBlockStyle:"indented",text:this.options.pedantic?s:hi(s,`
`)}}}fences(o){const l=this.rules.block.fences.exec(o);if(l){const s=l[0],c=cm(s,l[3]||"",this.rules);return{type:"code",raw:s,lang:l[2]?l[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):l[2],text:c}}}heading(o){const l=this.rules.block.heading.exec(o);if(l){let s=l[2].trim();if(this.rules.other.endingHash.test(s)){const c=hi(s,"#");(this.options.pedantic||!c||this.rules.other.endingSpaceChar.test(c))&&(s=c.trim())}return{type:"heading",raw:l[0],depth:l[1].length,text:s,tokens:this.lexer.inline(s)}}}hr(o){const l=this.rules.block.hr.exec(o);if(l)return{type:"hr",raw:hi(l[0],`
`)}}blockquote(o){const l=this.rules.block.blockquote.exec(o);if(l){let s=hi(l[0],`
`).split(`
`),c="",f="";const h=[];for(;s.length>0;){let y=!1;const m=[];let S;for(S=0;S<s.length;S++)if(this.rules.other.blockquoteStart.test(s[S]))m.push(s[S]),y=!0;else if(!y)m.push(s[S]);else break;s=s.slice(S);const k=m.join(`
`),j=k.replace(this.rules.other.blockquoteSetextReplace,`
`),c="",f="";const h=[];for(;s.length>0;){let y=!1;const m=[];let S;for(S=0;S<s.length;S++)if(this.rules.other.blockquoteStart.test(s[S]))m.push(s[S]),y=!0;else if(!y)m.push(s[S]);else break;s=s.slice(S);const w=m.join(`
`),C=w.replace(this.rules.other.blockquoteSetextReplace,`
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");c=c?`${c}
${k}`:k,f=f?`${f}
${j}`:j;const _=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(j,h,!0),this.lexer.state.top=_,s.length===0)break;const N=h.at(-1);if((N==null?void 0:N.type)==="code")break;if((N==null?void 0:N.type)==="blockquote"){const H=N,B=H.raw+`
${w}`:w,f=f?`${f}
${C}`:C;const O=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(C,h,!0),this.lexer.state.top=O,s.length===0)break;const N=h.at(-1);if((N==null?void 0:N.type)==="code")break;if((N==null?void 0:N.type)==="blockquote"){const V=N,Q=V.raw+`
`+s.join(`
`),K=this.blockquote(B);h[h.length-1]=K,c=c.substring(0,c.length-H.raw.length)+K.raw,f=f.substring(0,f.length-H.text.length)+K.text;break}else if((N==null?void 0:N.type)==="list"){const H=N,B=H.raw+`
`),J=this.blockquote(Q);h[h.length-1]=J,c=c.substring(0,c.length-V.raw.length)+J.raw,f=f.substring(0,f.length-V.text.length)+J.text;break}else if((N==null?void 0:N.type)==="list"){const V=N,Q=V.raw+`
`+s.join(`
`),K=this.list(B);h[h.length-1]=K,c=c.substring(0,c.length-N.raw.length)+K.raw,f=f.substring(0,f.length-H.raw.length)+K.raw,s=B.substring(h.at(-1).raw.length).split(`
`);continue}}return{type:"blockquote",raw:c,tokens:h,text:f}}}list(o){let i=this.rules.block.list.exec(o);if(i){let s=i[1].trim();const c=s.length>1,f={type:"list",raw:"",ordered:c,start:c?+s.slice(0,-1):"",loose:!1,items:[]};s=c?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=c?s:"[*+-]");const h=this.rules.other.listItemRegex(s);let y=!1;for(;o;){let S=!1,k="",j="";if(!(i=h.exec(o))||this.rules.block.hr.test(o))break;k=i[0],o=o.substring(k.length);let _=i[2].split(`
`,1)[0].replace(this.rules.other.listReplaceTabs,fe=>" ".repeat(3*fe.length)),N=o.split(`
`,1)[0],H=!_.trim(),B=0;if(this.options.pedantic?(B=2,j=_.trimStart()):H?B=i[1].length+1:(B=i[2].search(this.rules.other.nonSpaceChar),B=B>4?1:B,j=_.slice(B),B+=i[1].length),H&&this.rules.other.blankLine.test(N)&&(k+=N+`
`,o=o.substring(N.length+1),S=!0),!S){const fe=this.rules.other.nextBulletRegex(B),me=this.rules.other.hrRegex(B),de=this.rules.other.fencesBeginRegex(B),ee=this.rules.other.headingBeginRegex(B),G=this.rules.other.htmlBeginRegex(B);for(;o;){const re=o.split(`
`,1)[0];let I;if(N=re,this.options.pedantic?(N=N.replace(this.rules.other.listReplaceNesting," "),I=N):I=N.replace(this.rules.other.tabCharGlobal," "),de.test(N)||ee.test(N)||G.test(N)||fe.test(N)||me.test(N))break;if(I.search(this.rules.other.nonSpaceChar)>=B||!N.trim())j+=`
`+I.slice(B);else{if(H||_.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||de.test(_)||ee.test(_)||me.test(_))break;j+=`
`+N}!H&&!N.trim()&&(H=!0),k+=re+`
`,o=o.substring(re.length+1),_=I.slice(B)}}f.loose||(y?f.loose=!0:this.rules.other.doubleBlankLine.test(k)&&(y=!0));let K=null,J;this.options.gfm&&(K=this.rules.other.listIsTask.exec(j),K&&(J=K[0]!=="[ ] ",j=j.replace(this.rules.other.listReplaceTask,""))),f.items.push({type:"list_item",raw:k,task:!!K,checked:J,loose:!1,text:j,tokens:[]}),f.raw+=k}const m=f.items.at(-1);if(m)m.raw=m.raw.trimEnd(),m.text=m.text.trimEnd();else return;f.raw=f.raw.trimEnd();for(let S=0;S<f.items.length;S++)if(this.lexer.state.top=!1,f.items[S].tokens=this.lexer.blockTokens(f.items[S].text,[]),!f.loose){const k=f.items[S].tokens.filter(_=>_.type==="space"),j=k.length>0&&k.some(_=>this.rules.other.anyLine.test(_.raw));f.loose=j}if(f.loose)for(let S=0;S<f.items.length;S++)f.items[S].loose=!0;return f}}html(o){const i=this.rules.block.html.exec(o);if(i)return{type:"html",block:!0,raw:i[0],pre:i[1]==="pre"||i[1]==="script"||i[1]==="style",text:i[0]}}def(o){const i=this.rules.block.def.exec(o);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(o){var y;const i=this.rules.block.table.exec(o);if(!i||!this.rules.other.tableDelimiter.test(i[2]))return;const s=Gd(i[1]),c=i[2].replace(this.rules.other.tableAlignChars,"").split("|"),f=(y=i[3])!=null&&y.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 m of c)this.rules.other.tableAlignRight.test(m)?h.align.push("right"):this.rules.other.tableAlignCenter.test(m)?h.align.push("center"):this.rules.other.tableAlignLeft.test(m)?h.align.push("left"):h.align.push(null);for(let m=0;m<s.length;m++)h.header.push({text:s[m],tokens:this.lexer.inline(s[m]),header:!0,align:h.align[m]});for(const m of f)h.rows.push(Gd(m,h.header.length).map((S,k)=>({text:S,tokens:this.lexer.inline(S),header:!1,align:h.align[k]})));return h}}lheading(o){const i=this.rules.block.lheading.exec(o);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(o){const i=this.rules.block.paragraph.exec(o);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(o){const i=this.rules.block.text.exec(o);if(i)return{type:"text",raw:i[0],text:i[0],tokens:this.lexer.inline(i[0])}}escape(o){const i=this.rules.inline.escape.exec(o);if(i)return{type:"escape",raw:i[0],text:i[1]}}tag(o){const i=this.rules.inline.tag.exec(o);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(o){const i=this.rules.inline.link.exec(o);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=fi(s.slice(0,-1),"\\");if((s.length-h.length)%2===0)return}else{const h=Jg(i[2],"()");if(h===-2)return;if(h>-1){const m=(i[0].indexOf("!")===0?5:4)+i[1].length+h;i[2]=i[2].substring(0,h),i[0]=i[0].substring(0,m).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)),qd(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(o,i){let s;if((s=this.rules.inline.reflink.exec(o))||(s=this.rules.inline.nolink.exec(o))){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 qd(s,f,s[0],this.lexer,this.rules)}}emStrong(o,i,s=""){let c=this.rules.inline.emStrongLDelim.exec(o);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 y,m,S=h,k=0;const j=c[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(j.lastIndex=0,i=i.slice(-1*o.length+h);(c=j.exec(i))!=null;){if(y=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!y)continue;if(m=[...y].length,c[3]||c[4]){S+=m;continue}else if((c[5]||c[6])&&h%3&&!((h+m)%3)){k+=m;continue}if(S-=m,S>0)continue;m=Math.min(m,m+S+k);const _=[...c[0]][0].length,N=o.slice(0,h+c.index+_+m);if(Math.min(h,m)%2){const B=N.slice(1,-1);return{type:"em",raw:N,text:B,tokens:this.lexer.inlineTokens(B)}}const H=N.slice(2,-2);return{type:"strong",raw:N,text:H,tokens:this.lexer.inlineTokens(H)}}}}codespan(o){const i=this.rules.inline.code.exec(o);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(o){const i=this.rules.inline.br.exec(o);if(i)return{type:"br",raw:i[0]}}del(o){const i=this.rules.inline.del.exec(o);if(i)return{type:"del",raw:i[0],text:i[2],tokens:this.lexer.inlineTokens(i[2])}}autolink(o){const i=this.rules.inline.autolink.exec(o);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(o){var s;let i;if(i=this.rules.inline.url.exec(o)){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(o){const i=this.rules.inline.text.exec(o);if(i){const s=this.lexer.state.inRawBlock;return{type:"text",raw:i[0],text:i[0],escaped:s}}}},Un=class ba{constructor(i){Oe(this,"tokens");Oe(this,"options");Oe(this,"state");Oe(this,"tokenizer");Oe(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=i||Wr,this.options.tokenizer=this.options.tokenizer||new Do,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:Nt,block:No.normal,inline:di.normal};this.options.pedantic?(s.block=No.pedantic,s.inline=di.pedantic):this.options.gfm&&(s.block=No.gfm,this.options.breaks?s.inline=di.breaks:s.inline=di.gfm),this.tokenizer.rules=s}static get rules(){return{block:No,inline:di}}static lex(i,s){return new ba(s).lex(i)}static lexInline(i,s){return new ba(s).inlineTokens(i)}lex(i){i=i.replace(Nt.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,y;for(this.options.pedantic&&(i=i.replace(Nt.tabCharGlobal," ").replace(Nt.spaceLine,""));i;){let m;if((h=(f=this.options.extensions)==null?void 0:f.block)!=null&&h.some(k=>(m=k.call({lexer:this},i,s))?(i=i.substring(m.raw.length),s.push(m),!0):!1))continue;if(m=this.tokenizer.space(i)){i=i.substring(m.raw.length);const k=s.at(-1);m.raw.length===1&&k!==void 0?k.raw+=`
`:s.push(m);continue}if(m=this.tokenizer.code(i)){i=i.substring(m.raw.length);const k=s.at(-1);(k==null?void 0:k.type)==="paragraph"||(k==null?void 0:k.type)==="text"?(k.raw+=`
`+m.raw,k.text+=`
`+m.text,this.inlineQueue.at(-1).src=k.text):s.push(m);continue}if(m=this.tokenizer.fences(i)){i=i.substring(m.raw.length),s.push(m);continue}if(m=this.tokenizer.heading(i)){i=i.substring(m.raw.length),s.push(m);continue}if(m=this.tokenizer.hr(i)){i=i.substring(m.raw.length),s.push(m);continue}if(m=this.tokenizer.blockquote(i)){i=i.substring(m.raw.length),s.push(m);continue}if(m=this.tokenizer.list(i)){i=i.substring(m.raw.length),s.push(m);continue}if(m=this.tokenizer.html(i)){i=i.substring(m.raw.length),s.push(m);continue}if(m=this.tokenizer.def(i)){i=i.substring(m.raw.length);const k=s.at(-1);(k==null?void 0:k.type)==="paragraph"||(k==null?void 0:k.type)==="text"?(k.raw+=`
`+m.raw,k.text+=`
`+m.raw,this.inlineQueue.at(-1).src=k.text):this.tokens.links[m.tag]||(this.tokens.links[m.tag]={href:m.href,title:m.title});continue}if(m=this.tokenizer.table(i)){i=i.substring(m.raw.length),s.push(m);continue}if(m=this.tokenizer.lheading(i)){i=i.substring(m.raw.length),s.push(m);continue}let S=i;if((y=this.options.extensions)!=null&&y.startBlock){let k=1/0;const j=i.slice(1);let _;this.options.extensions.startBlock.forEach(N=>{_=N.call({lexer:this},j),typeof _=="number"&&_>=0&&(k=Math.min(k,_))}),k<1/0&&k>=0&&(S=i.substring(0,k+1))}if(this.state.top&&(m=this.tokenizer.paragraph(S))){const k=s.at(-1);c&&(k==null?void 0:k.type)==="paragraph"?(k.raw+=`
`+m.raw,k.text+=`
`+m.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=k.text):s.push(m),c=S.length!==i.length,i=i.substring(m.raw.length);continue}if(m=this.tokenizer.text(i)){i=i.substring(m.raw.length);const k=s.at(-1);(k==null?void 0:k.type)==="text"?(k.raw+=`
`+m.raw,k.text+=`
`+m.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=k.text):s.push(m);continue}if(i){const k="Infinite loop on byte: "+i.charCodeAt(0);if(this.options.silent){console.error(k);break}else throw new Error(k)}}return this.state.top=!0,s}inline(i,s=[]){return this.inlineQueue.push({src:i,tokens:s}),s}inlineTokens(i,s=[]){var m,S,k;let c=i,f=null;if(this.tokens.links){const j=Object.keys(this.tokens.links);if(j.length>0)for(;(f=this.tokenizer.rules.inline.reflinkSearch.exec(c))!=null;)j.includes(f[0].slice(f[0].lastIndexOf("[")+1,-1))&&(c=c.slice(0,f.index)+"["+"a".repeat(f[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(f=this.tokenizer.rules.inline.anyPunctuation.exec(c))!=null;)c=c.slice(0,f.index)+"++"+c.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(f=this.tokenizer.rules.inline.blockSkip.exec(c))!=null;)c=c.slice(0,f.index)+"["+"a".repeat(f[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let h=!1,y="";for(;i;){h||(y=""),h=!1;let j;if((S=(m=this.options.extensions)==null?void 0:m.inline)!=null&&S.some(N=>(j=N.call({lexer:this},i,s))?(i=i.substring(j.raw.length),s.push(j),!0):!1))continue;if(j=this.tokenizer.escape(i)){i=i.substring(j.raw.length),s.push(j);continue}if(j=this.tokenizer.tag(i)){i=i.substring(j.raw.length),s.push(j);continue}if(j=this.tokenizer.link(i)){i=i.substring(j.raw.length),s.push(j);continue}if(j=this.tokenizer.reflink(i,this.tokens.links)){i=i.substring(j.raw.length);const N=s.at(-1);j.type==="text"&&(N==null?void 0:N.type)==="text"?(N.raw+=j.raw,N.text+=j.text):s.push(j);continue}if(j=this.tokenizer.emStrong(i,c,y)){i=i.substring(j.raw.length),s.push(j);continue}if(j=this.tokenizer.codespan(i)){i=i.substring(j.raw.length),s.push(j);continue}if(j=this.tokenizer.br(i)){i=i.substring(j.raw.length),s.push(j);continue}if(j=this.tokenizer.del(i)){i=i.substring(j.raw.length),s.push(j);continue}if(j=this.tokenizer.autolink(i)){i=i.substring(j.raw.length),s.push(j);continue}if(!this.state.inLink&&(j=this.tokenizer.url(i))){i=i.substring(j.raw.length),s.push(j);continue}let _=i;if((k=this.options.extensions)!=null&&k.startInline){let N=1/0;const H=i.slice(1);let B;this.options.extensions.startInline.forEach(K=>{B=K.call({lexer:this},H),typeof B=="number"&&B>=0&&(N=Math.min(N,B))}),N<1/0&&N>=0&&(_=i.substring(0,N+1))}if(j=this.tokenizer.inlineText(_)){i=i.substring(j.raw.length),j.raw.slice(-1)!=="_"&&(y=j.raw.slice(-1)),h=!0;const N=s.at(-1);(N==null?void 0:N.type)==="text"?(N.raw+=j.raw,N.text+=j.text):s.push(j);continue}if(i){const N="Infinite loop on byte: "+i.charCodeAt(0);if(this.options.silent){console.error(N);break}else throw new Error(N)}}return s}},Oo=class{constructor(o){Oe(this,"options");Oe(this,"parser");this.options=o||Wr}space(o){return""}code({text:o,lang:i,escaped:s}){var h;const c=(h=(i||"").match(Nt.notSpaceStart))==null?void 0:h[0],f=o.replace(Nt.endingNewline,"")+`
`;return c?'<pre><code class="language-'+Nn(c)+'">'+(s?f:Nn(f,!0))+`</code></pre>
`:"<pre><code>"+(s?f:Nn(f,!0))+`</code></pre>
`),J=this.list(Q);h[h.length-1]=J,c=c.substring(0,c.length-N.raw.length)+J.raw,f=f.substring(0,f.length-V.raw.length)+J.raw,s=Q.substring(h.at(-1).raw.length).split(`
`);continue}}return{type:"blockquote",raw:c,tokens:h,text:f}}}list(o){let l=this.rules.block.list.exec(o);if(l){let s=l[1].trim();const c=s.length>1,f={type:"list",raw:"",ordered:c,start:c?+s.slice(0,-1):"",loose:!1,items:[]};s=c?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=c?s:"[*+-]");const h=this.rules.other.listItemRegex(s);let y=!1;for(;o;){let S=!1,w="",C="";if(!(l=h.exec(o))||this.rules.block.hr.test(o))break;w=l[0],o=o.substring(w.length);let O=l[2].split(`
`,1)[0].replace(this.rules.other.listReplaceTabs,he=>" ".repeat(3*he.length)),N=o.split(`
`,1)[0],V=!O.trim(),Q=0;if(this.options.pedantic?(Q=2,C=O.trimStart()):V?Q=l[1].length+1:(Q=l[2].search(this.rules.other.nonSpaceChar),Q=Q>4?1:Q,C=O.slice(Q),Q+=l[1].length),V&&this.rules.other.blankLine.test(N)&&(w+=N+`
`,o=o.substring(N.length+1),S=!0),!S){const he=this.rules.other.nextBulletRegex(Q),xe=this.rules.other.hrRegex(Q),ge=this.rules.other.fencesBeginRegex(Q),re=this.rules.other.headingBeginRegex(Q),q=this.rules.other.htmlBeginRegex(Q);for(;o;){const oe=o.split(`
`,1)[0];let z;if(N=oe,this.options.pedantic?(N=N.replace(this.rules.other.listReplaceNesting," "),z=N):z=N.replace(this.rules.other.tabCharGlobal," "),ge.test(N)||re.test(N)||q.test(N)||he.test(N)||xe.test(N))break;if(z.search(this.rules.other.nonSpaceChar)>=Q||!N.trim())C+=`
`+z.slice(Q);else{if(V||O.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||ge.test(O)||re.test(O)||xe.test(O))break;C+=`
`+N}!V&&!N.trim()&&(V=!0),w+=oe+`
`,o=o.substring(oe.length+1),O=z.slice(Q)}}f.loose||(y?f.loose=!0:this.rules.other.doubleBlankLine.test(w)&&(y=!0));let J=null,$;this.options.gfm&&(J=this.rules.other.listIsTask.exec(C),J&&($=J[0]!=="[ ] ",C=C.replace(this.rules.other.listReplaceTask,""))),f.items.push({type:"list_item",raw:w,task:!!J,checked:$,loose:!1,text:C,tokens:[]}),f.raw+=w}const m=f.items.at(-1);if(m)m.raw=m.raw.trimEnd(),m.text=m.text.trimEnd();else return;f.raw=f.raw.trimEnd();for(let S=0;S<f.items.length;S++)if(this.lexer.state.top=!1,f.items[S].tokens=this.lexer.blockTokens(f.items[S].text,[]),!f.loose){const w=f.items[S].tokens.filter(O=>O.type==="space"),C=w.length>0&&w.some(O=>this.rules.other.anyLine.test(O.raw));f.loose=C}if(f.loose)for(let S=0;S<f.items.length;S++)f.items[S].loose=!0;return f}}html(o){const l=this.rules.block.html.exec(o);if(l)return{type:"html",block:!0,raw:l[0],pre:l[1]==="pre"||l[1]==="script"||l[1]==="style",text:l[0]}}def(o){const l=this.rules.block.def.exec(o);if(l){const s=l[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),c=l[2]?l[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",f=l[3]?l[3].substring(1,l[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):l[3];return{type:"def",tag:s,raw:l[0],href:c,title:f}}}table(o){var y;const l=this.rules.block.table.exec(o);if(!l||!this.rules.other.tableDelimiter.test(l[2]))return;const s=Kd(l[1]),c=l[2].replace(this.rules.other.tableAlignChars,"").split("|"),f=(y=l[3])!=null&&y.trim()?l[3].replace(this.rules.other.tableRowBlankLine,"").split(`
`):[],h={type:"table",raw:l[0],header:[],align:[],rows:[]};if(s.length===c.length){for(const m of c)this.rules.other.tableAlignRight.test(m)?h.align.push("right"):this.rules.other.tableAlignCenter.test(m)?h.align.push("center"):this.rules.other.tableAlignLeft.test(m)?h.align.push("left"):h.align.push(null);for(let m=0;m<s.length;m++)h.header.push({text:s[m],tokens:this.lexer.inline(s[m]),header:!0,align:h.align[m]});for(const m of f)h.rows.push(Kd(m,h.header.length).map((S,w)=>({text:S,tokens:this.lexer.inline(S),header:!1,align:h.align[w]})));return h}}lheading(o){const l=this.rules.block.lheading.exec(o);if(l)return{type:"heading",raw:l[0],depth:l[2].charAt(0)==="="?1:2,text:l[1],tokens:this.lexer.inline(l[1])}}paragraph(o){const l=this.rules.block.paragraph.exec(o);if(l){const s=l[1].charAt(l[1].length-1)===`
`?l[1].slice(0,-1):l[1];return{type:"paragraph",raw:l[0],text:s,tokens:this.lexer.inline(s)}}}text(o){const l=this.rules.block.text.exec(o);if(l)return{type:"text",raw:l[0],text:l[0],tokens:this.lexer.inline(l[0])}}escape(o){const l=this.rules.inline.escape.exec(o);if(l)return{type:"escape",raw:l[0],text:l[1]}}tag(o){const l=this.rules.inline.tag.exec(o);if(l)return!this.lexer.state.inLink&&this.rules.other.startATag.test(l[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(l[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(l[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(l[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:l[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:l[0]}}link(o){const l=this.rules.inline.link.exec(o);if(l){const s=l[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(s)){if(!this.rules.other.endAngleBracket.test(s))return;const h=hi(s.slice(0,-1),"\\");if((s.length-h.length)%2===0)return}else{const h=um(l[2],"()");if(h===-2)return;if(h>-1){const m=(l[0].indexOf("!")===0?5:4)+l[1].length+h;l[2]=l[2].substring(0,h),l[0]=l[0].substring(0,m).trim(),l[3]=""}}let c=l[2],f="";if(this.options.pedantic){const h=this.rules.other.pedanticHrefTitle.exec(c);h&&(c=h[1],f=h[3])}else f=l[3]?l[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)),Jd(l,{href:c&&c.replace(this.rules.inline.anyPunctuation,"$1"),title:f&&f.replace(this.rules.inline.anyPunctuation,"$1")},l[0],this.lexer,this.rules)}}reflink(o,l){let s;if((s=this.rules.inline.reflink.exec(o))||(s=this.rules.inline.nolink.exec(o))){const c=(s[2]||s[1]).replace(this.rules.other.multipleSpaceGlobal," "),f=l[c.toLowerCase()];if(!f){const h=s[0].charAt(0);return{type:"text",raw:h,text:h}}return Jd(s,f,s[0],this.lexer,this.rules)}}emStrong(o,l,s=""){let c=this.rules.inline.emStrongLDelim.exec(o);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 y,m,S=h,w=0;const C=c[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(C.lastIndex=0,l=l.slice(-1*o.length+h);(c=C.exec(l))!=null;){if(y=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!y)continue;if(m=[...y].length,c[3]||c[4]){S+=m;continue}else if((c[5]||c[6])&&h%3&&!((h+m)%3)){w+=m;continue}if(S-=m,S>0)continue;m=Math.min(m,m+S+w);const O=[...c[0]][0].length,N=o.slice(0,h+c.index+O+m);if(Math.min(h,m)%2){const Q=N.slice(1,-1);return{type:"em",raw:N,text:Q,tokens:this.lexer.inlineTokens(Q)}}const V=N.slice(2,-2);return{type:"strong",raw:N,text:V,tokens:this.lexer.inlineTokens(V)}}}}codespan(o){const l=this.rules.inline.code.exec(o);if(l){let s=l[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:l[0],text:s}}}br(o){const l=this.rules.inline.br.exec(o);if(l)return{type:"br",raw:l[0]}}del(o){const l=this.rules.inline.del.exec(o);if(l)return{type:"del",raw:l[0],text:l[2],tokens:this.lexer.inlineTokens(l[2])}}autolink(o){const l=this.rules.inline.autolink.exec(o);if(l){let s,c;return l[2]==="@"?(s=l[1],c="mailto:"+s):(s=l[1],c=s),{type:"link",raw:l[0],text:s,href:c,tokens:[{type:"text",raw:s,text:s}]}}}url(o){var s;let l;if(l=this.rules.inline.url.exec(o)){let c,f;if(l[2]==="@")c=l[0],f="mailto:"+c;else{let h;do h=l[0],l[0]=((s=this.rules.inline._backpedal.exec(l[0]))==null?void 0:s[0])??"";while(h!==l[0]);c=l[0],l[1]==="www."?f="http://"+l[0]:f=l[0]}return{type:"link",raw:l[0],text:c,href:f,tokens:[{type:"text",raw:c,text:c}]}}}inlineText(o){const l=this.rules.inline.text.exec(o);if(l){const s=this.lexer.state.inRawBlock;return{type:"text",raw:l[0],text:l[0],escaped:s}}}},Qn=class Wa{constructor(l){_e(this,"tokens");_e(this,"options");_e(this,"state");_e(this,"tokenizer");_e(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=l||Ur,this.options.tokenizer=this.options.tokenizer||new bo,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:At,block:No.normal,inline:pi.normal};this.options.pedantic?(s.block=No.pedantic,s.inline=pi.pedantic):this.options.gfm&&(s.block=No.gfm,this.options.breaks?s.inline=pi.breaks:s.inline=pi.gfm),this.tokenizer.rules=s}static get rules(){return{block:No,inline:pi}}static lex(l,s){return new Wa(s).lex(l)}static lexInline(l,s){return new Wa(s).inlineTokens(l)}lex(l){l=l.replace(At.carriageReturn,`
`),this.blockTokens(l,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(l,s=[],c=!1){var f,h,y;for(this.options.pedantic&&(l=l.replace(At.tabCharGlobal," ").replace(At.spaceLine,""));l;){let m;if((h=(f=this.options.extensions)==null?void 0:f.block)!=null&&h.some(w=>(m=w.call({lexer:this},l,s))?(l=l.substring(m.raw.length),s.push(m),!0):!1))continue;if(m=this.tokenizer.space(l)){l=l.substring(m.raw.length);const w=s.at(-1);m.raw.length===1&&w!==void 0?w.raw+=`
`:s.push(m);continue}if(m=this.tokenizer.code(l)){l=l.substring(m.raw.length);const w=s.at(-1);(w==null?void 0:w.type)==="paragraph"||(w==null?void 0:w.type)==="text"?(w.raw+=`
`+m.raw,w.text+=`
`+m.text,this.inlineQueue.at(-1).src=w.text):s.push(m);continue}if(m=this.tokenizer.fences(l)){l=l.substring(m.raw.length),s.push(m);continue}if(m=this.tokenizer.heading(l)){l=l.substring(m.raw.length),s.push(m);continue}if(m=this.tokenizer.hr(l)){l=l.substring(m.raw.length),s.push(m);continue}if(m=this.tokenizer.blockquote(l)){l=l.substring(m.raw.length),s.push(m);continue}if(m=this.tokenizer.list(l)){l=l.substring(m.raw.length),s.push(m);continue}if(m=this.tokenizer.html(l)){l=l.substring(m.raw.length),s.push(m);continue}if(m=this.tokenizer.def(l)){l=l.substring(m.raw.length);const w=s.at(-1);(w==null?void 0:w.type)==="paragraph"||(w==null?void 0:w.type)==="text"?(w.raw+=`
`+m.raw,w.text+=`
`+m.raw,this.inlineQueue.at(-1).src=w.text):this.tokens.links[m.tag]||(this.tokens.links[m.tag]={href:m.href,title:m.title});continue}if(m=this.tokenizer.table(l)){l=l.substring(m.raw.length),s.push(m);continue}if(m=this.tokenizer.lheading(l)){l=l.substring(m.raw.length),s.push(m);continue}let S=l;if((y=this.options.extensions)!=null&&y.startBlock){let w=1/0;const C=l.slice(1);let O;this.options.extensions.startBlock.forEach(N=>{O=N.call({lexer:this},C),typeof O=="number"&&O>=0&&(w=Math.min(w,O))}),w<1/0&&w>=0&&(S=l.substring(0,w+1))}if(this.state.top&&(m=this.tokenizer.paragraph(S))){const w=s.at(-1);c&&(w==null?void 0:w.type)==="paragraph"?(w.raw+=`
`+m.raw,w.text+=`
`+m.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=w.text):s.push(m),c=S.length!==l.length,l=l.substring(m.raw.length);continue}if(m=this.tokenizer.text(l)){l=l.substring(m.raw.length);const w=s.at(-1);(w==null?void 0:w.type)==="text"?(w.raw+=`
`+m.raw,w.text+=`
`+m.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=w.text):s.push(m);continue}if(l){const w="Infinite loop on byte: "+l.charCodeAt(0);if(this.options.silent){console.error(w);break}else throw new Error(w)}}return this.state.top=!0,s}inline(l,s=[]){return this.inlineQueue.push({src:l,tokens:s}),s}inlineTokens(l,s=[]){var m,S,w;let c=l,f=null;if(this.tokens.links){const C=Object.keys(this.tokens.links);if(C.length>0)for(;(f=this.tokenizer.rules.inline.reflinkSearch.exec(c))!=null;)C.includes(f[0].slice(f[0].lastIndexOf("[")+1,-1))&&(c=c.slice(0,f.index)+"["+"a".repeat(f[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(f=this.tokenizer.rules.inline.anyPunctuation.exec(c))!=null;)c=c.slice(0,f.index)+"++"+c.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(f=this.tokenizer.rules.inline.blockSkip.exec(c))!=null;)c=c.slice(0,f.index)+"["+"a".repeat(f[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let h=!1,y="";for(;l;){h||(y=""),h=!1;let C;if((S=(m=this.options.extensions)==null?void 0:m.inline)!=null&&S.some(N=>(C=N.call({lexer:this},l,s))?(l=l.substring(C.raw.length),s.push(C),!0):!1))continue;if(C=this.tokenizer.escape(l)){l=l.substring(C.raw.length),s.push(C);continue}if(C=this.tokenizer.tag(l)){l=l.substring(C.raw.length),s.push(C);continue}if(C=this.tokenizer.link(l)){l=l.substring(C.raw.length),s.push(C);continue}if(C=this.tokenizer.reflink(l,this.tokens.links)){l=l.substring(C.raw.length);const N=s.at(-1);C.type==="text"&&(N==null?void 0:N.type)==="text"?(N.raw+=C.raw,N.text+=C.text):s.push(C);continue}if(C=this.tokenizer.emStrong(l,c,y)){l=l.substring(C.raw.length),s.push(C);continue}if(C=this.tokenizer.codespan(l)){l=l.substring(C.raw.length),s.push(C);continue}if(C=this.tokenizer.br(l)){l=l.substring(C.raw.length),s.push(C);continue}if(C=this.tokenizer.del(l)){l=l.substring(C.raw.length),s.push(C);continue}if(C=this.tokenizer.autolink(l)){l=l.substring(C.raw.length),s.push(C);continue}if(!this.state.inLink&&(C=this.tokenizer.url(l))){l=l.substring(C.raw.length),s.push(C);continue}let O=l;if((w=this.options.extensions)!=null&&w.startInline){let N=1/0;const V=l.slice(1);let Q;this.options.extensions.startInline.forEach(J=>{Q=J.call({lexer:this},V),typeof Q=="number"&&Q>=0&&(N=Math.min(N,Q))}),N<1/0&&N>=0&&(O=l.substring(0,N+1))}if(C=this.tokenizer.inlineText(O)){l=l.substring(C.raw.length),C.raw.slice(-1)!=="_"&&(y=C.raw.slice(-1)),h=!0;const N=s.at(-1);(N==null?void 0:N.type)==="text"?(N.raw+=C.raw,N.text+=C.text):s.push(C);continue}if(l){const N="Infinite loop on byte: "+l.charCodeAt(0);if(this.options.silent){console.error(N);break}else throw new Error(N)}}return s}},_o=class{constructor(o){_e(this,"options");_e(this,"parser");this.options=o||Ur}space(o){return""}code({text:o,lang:l,escaped:s}){var h;const c=(h=(l||"").match(At.notSpaceStart))==null?void 0:h[0],f=o.replace(At.endingNewline,"")+`
`;return c?'<pre><code class="language-'+Pn(c)+'">'+(s?f:Pn(f,!0))+`</code></pre>
`:"<pre><code>"+(s?f:Pn(f,!0))+`</code></pre>
`}blockquote({tokens:o}){return`<blockquote>
${this.parser.parse(o)}</blockquote>
`}html({text:o}){return o}heading({tokens:o,depth:i}){return`<h${i}>${this.parser.parseInline(o)}</h${i}>
`}html({text:o}){return o}heading({tokens:o,depth:l}){return`<h${l}>${this.parser.parseInline(o)}</h${l}>
`}hr(o){return`<hr>
`}list(o){const i=o.ordered,s=o.start;let c="";for(let y=0;y<o.items.length;y++){const m=o.items[y];c+=this.listitem(m)}const f=i?"ol":"ul",h=i&&s!==1?' start="'+s+'"':"";return"<"+f+h+`>
`}list(o){const l=o.ordered,s=o.start;let c="";for(let y=0;y<o.items.length;y++){const m=o.items[y];c+=this.listitem(m)}const f=l?"ol":"ul",h=l&&s!==1?' start="'+s+'"':"";return"<"+f+h+`>
`+c+"</"+f+`>
`}listitem(o){var s;let i="";if(o.task){const c=this.checkbox({checked:!!o.checked});o.loose?((s=o.tokens[0])==null?void 0:s.type)==="paragraph"?(o.tokens[0].text=c+" "+o.tokens[0].text,o.tokens[0].tokens&&o.tokens[0].tokens.length>0&&o.tokens[0].tokens[0].type==="text"&&(o.tokens[0].tokens[0].text=c+" "+Nn(o.tokens[0].tokens[0].text),o.tokens[0].tokens[0].escaped=!0)):o.tokens.unshift({type:"text",raw:c+" ",text:c+" ",escaped:!0}):i+=c+" "}return i+=this.parser.parse(o.tokens,!!o.loose),`<li>${i}</li>
`}listitem(o){var s;let l="";if(o.task){const c=this.checkbox({checked:!!o.checked});o.loose?((s=o.tokens[0])==null?void 0:s.type)==="paragraph"?(o.tokens[0].text=c+" "+o.tokens[0].text,o.tokens[0].tokens&&o.tokens[0].tokens.length>0&&o.tokens[0].tokens[0].type==="text"&&(o.tokens[0].tokens[0].text=c+" "+Pn(o.tokens[0].tokens[0].text),o.tokens[0].tokens[0].escaped=!0)):o.tokens.unshift({type:"text",raw:c+" ",text:c+" ",escaped:!0}):l+=c+" "}return l+=this.parser.parse(o.tokens,!!o.loose),`<li>${l}</li>
`}checkbox({checked:o}){return"<input "+(o?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:o}){return`<p>${this.parser.parseInline(o)}</p>
`}table(o){let i="",s="";for(let f=0;f<o.header.length;f++)s+=this.tablecell(o.header[f]);i+=this.tablerow({text:s});let c="";for(let f=0;f<o.rows.length;f++){const h=o.rows[f];s="";for(let y=0;y<h.length;y++)s+=this.tablecell(h[y]);c+=this.tablerow({text:s})}return c&&(c=`<tbody>${c}</tbody>`),`<table>
`}table(o){let l="",s="";for(let f=0;f<o.header.length;f++)s+=this.tablecell(o.header[f]);l+=this.tablerow({text:s});let c="";for(let f=0;f<o.rows.length;f++){const h=o.rows[f];s="";for(let y=0;y<h.length;y++)s+=this.tablecell(h[y]);c+=this.tablerow({text:s})}return c&&(c=`<tbody>${c}</tbody>`),`<table>
<thead>
`+i+`</thead>
`+l+`</thead>
`+c+`</table>
`}tablerow({text:o}){return`<tr>
${o}</tr>
`}tablecell(o){const i=this.parser.parseInline(o.tokens),s=o.header?"th":"td";return(o.align?`<${s} align="${o.align}">`:`<${s}>`)+i+`</${s}>
`}strong({tokens:o}){return`<strong>${this.parser.parseInline(o)}</strong>`}em({tokens:o}){return`<em>${this.parser.parseInline(o)}</em>`}codespan({text:o}){return`<code>${Nn(o,!0)}</code>`}br(o){return"<br>"}del({tokens:o}){return`<del>${this.parser.parseInline(o)}</del>`}link({href:o,title:i,tokens:s}){const c=this.parser.parseInline(s),f=Yd(o);if(f===null)return c;o=f;let h='<a href="'+o+'"';return i&&(h+=' title="'+Nn(i)+'"'),h+=">"+c+"</a>",h}image({href:o,title:i,text:s,tokens:c}){c&&(s=this.parser.parseInline(c,this.parser.textRenderer));const f=Yd(o);if(f===null)return Nn(s);o=f;let h=`<img src="${o}" alt="${s}"`;return i&&(h+=` title="${Nn(i)}"`),h+=">",h}text(o){return"tokens"in o&&o.tokens?this.parser.parseInline(o.tokens):"escaped"in o&&o.escaped?o.text:Nn(o.text)}},tu=class{strong({text:o}){return o}em({text:o}){return o}codespan({text:o}){return o}del({text:o}){return o}html({text:o}){return o}text({text:o}){return o}link({text:o}){return""+o}image({text:o}){return""+o}br(){return""}},Hn=class _a{constructor(i){Oe(this,"options");Oe(this,"renderer");Oe(this,"textRenderer");this.options=i||Wr,this.options.renderer=this.options.renderer||new Oo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new tu}static parse(i,s){return new _a(s).parse(i)}static parseInline(i,s){return new _a(s).parseInline(i)}parse(i,s=!0){var f,h;let c="";for(let y=0;y<i.length;y++){const m=i[y];if((h=(f=this.options.extensions)==null?void 0:f.renderers)!=null&&h[m.type]){const k=m,j=this.options.extensions.renderers[k.type].call({parser:this},k);if(j!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(k.type)){c+=j||"";continue}}const S=m;switch(S.type){case"space":{c+=this.renderer.space(S);continue}case"hr":{c+=this.renderer.hr(S);continue}case"heading":{c+=this.renderer.heading(S);continue}case"code":{c+=this.renderer.code(S);continue}case"table":{c+=this.renderer.table(S);continue}case"blockquote":{c+=this.renderer.blockquote(S);continue}case"list":{c+=this.renderer.list(S);continue}case"html":{c+=this.renderer.html(S);continue}case"paragraph":{c+=this.renderer.paragraph(S);continue}case"text":{let k=S,j=this.renderer.text(k);for(;y+1<i.length&&i[y+1].type==="text";)k=i[++y],j+=`
`+this.renderer.text(k);s?c+=this.renderer.paragraph({type:"paragraph",raw:j,text:j,tokens:[{type:"text",raw:j,text:j,escaped:!0}]}):c+=j;continue}default:{const k='Token with "'+S.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 y=0;y<i.length;y++){const m=i[y];if((h=(f=this.options.extensions)==null?void 0:f.renderers)!=null&&h[m.type]){const k=this.options.extensions.renderers[m.type].call({parser:this},m);if(k!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(m.type)){c+=k||"";continue}}const S=m;switch(S.type){case"escape":{c+=s.text(S);break}case"html":{c+=s.html(S);break}case"link":{c+=s.link(S);break}case"image":{c+=s.image(S);break}case"strong":{c+=s.strong(S);break}case"em":{c+=s.em(S);break}case"codespan":{c+=s.codespan(S);break}case"br":{c+=s.br(S);break}case"del":{c+=s.del(S);break}case"text":{c+=s.text(S);break}default:{const k='Token with "'+S.type+'" type was not found.';if(this.options.silent)return console.error(k),"";throw new Error(k)}}}return c}},La,Ao=(La=class{constructor(o){Oe(this,"options");Oe(this,"block");this.options=o||Wr}preprocess(o){return o}postprocess(o){return o}processAllTokens(o){return o}provideLexer(){return this.block?Un.lex:Un.lexInline}provideParser(){return this.block?Hn.parse:Hn.parseInline}},Oe(La,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),La),em=class{constructor(...o){Oe(this,"defaults",Ga());Oe(this,"options",this.setOptions);Oe(this,"parse",this.parseMarkdown(!0));Oe(this,"parseInline",this.parseMarkdown(!1));Oe(this,"Parser",Hn);Oe(this,"Renderer",Oo);Oe(this,"TextRenderer",tu);Oe(this,"Lexer",Un);Oe(this,"Tokenizer",Do);Oe(this,"Hooks",Ao);this.use(...o)}walkTokens(o,i){var c,f;let s=[];for(const h of o)switch(s=s.concat(i.call(this,h)),h.type){case"table":{const y=h;for(const m of y.header)s=s.concat(this.walkTokens(m.tokens,i));for(const m of y.rows)for(const S of m)s=s.concat(this.walkTokens(S.tokens,i));break}case"list":{const y=h;s=s.concat(this.walkTokens(y.items,i));break}default:{const y=h;(f=(c=this.defaults.extensions)==null?void 0:c.childTokens)!=null&&f[y.type]?this.defaults.extensions.childTokens[y.type].forEach(m=>{const S=y[m].flat(1/0);s=s.concat(this.walkTokens(S,i))}):y.tokens&&(s=s.concat(this.walkTokens(y.tokens,i)))}}return s}use(...o){const i=this.defaults.extensions||{renderers:{},childTokens:{}};return o.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(...y){let m=f.renderer.apply(this,y);return m===!1&&(m=h.apply(this,y)),m}: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 Oo(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 y=h,m=s.renderer[y],S=f[y];f[y]=(...k)=>{let j=m.apply(f,k);return j===!1&&(j=S.apply(f,k)),j||""}}c.renderer=f}if(s.tokenizer){const f=this.defaults.tokenizer||new Do(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 y=h,m=s.tokenizer[y],S=f[y];f[y]=(...k)=>{let j=m.apply(f,k);return j===!1&&(j=S.apply(f,k)),j}}c.tokenizer=f}if(s.hooks){const f=this.defaults.hooks||new Ao;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 y=h,m=s.hooks[y],S=f[y];Ao.passThroughHooks.has(h)?f[y]=k=>{if(this.defaults.async)return Promise.resolve(m.call(f,k)).then(_=>S.call(f,_));const j=m.call(f,k);return S.call(f,j)}:f[y]=(...k)=>{let j=m.apply(f,k);return j===!1&&(j=S.apply(f,k)),j}}c.hooks=f}if(s.walkTokens){const f=this.defaults.walkTokens,h=s.walkTokens;c.walkTokens=function(y){let m=[];return m.push(h.call(this,y)),f&&(m=m.concat(f.call(this,y))),m}}this.defaults={...this.defaults,...c}}),this}setOptions(o){return this.defaults={...this.defaults,...o},this}lexer(o,i){return Un.lex(o,i??this.defaults)}parser(o,i){return Hn.parse(o,i??this.defaults)}parseMarkdown(o){return(s,c)=>{const f={...c},h={...this.defaults,...f},y=this.onError(!!h.silent,!!h.async);if(this.defaults.async===!0&&f.async===!1)return y(new Error("marked(): The async option was set to tLine truncated
Please report this to https://github.com/markedjs/marked.`,o){const c="<p>An error occurred:</p><pre>"+Nn(s.message+"",!0)+"</pre>";return i?Promise.resolve(c):c}if(i)return Promise.reject(s);throw s}}},Fr=new em;function ze(o,i){return Fr.parse(o,i)}ze.options=ze.setOptions=function(o){return Fr.setOptions(o),ze.defaults=Fr.defaults,ff(ze.defaults),ze};ze.getDefaults=Ga;ze.defaults=Wr;ze.use=function(...o){return Fr.use(...o),ze.defaults=Fr.defaults,ff(ze.defaults),ze};ze.walkTokens=function(o,i){return Fr.walkTokens(o,i)};ze.parseInline=Fr.parseInline;ze.Parser=Hn;ze.parser=Hn.parse;ze.Renderer=Oo;ze.TextRenderer=tu;ze.Lexer=Un;ze.lexer=Un.lex;ze.Tokenizer=Do;ze.Hooks=Ao;ze.parse=ze;ze.options;ze.setOptions;ze.use;ze.walkTokens;ze.parseInline;Hn.parse;Un.lex;const rt={flex:"none",display:"block"};function Ma({size:o=13,color:i="var(--t3)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...rt,...s},children:u.jsx("path",{d:"M1.5 4a1.5 1.5 0 0 1 1.5-1.5h2.6l1.3 1.5H11A1.5 1.5 0 0 1 12.5 5.5v5A1.5 1.5 0 0 1 11 12H3a1.5 1.5 0 0 1-1.5-1.5V4z",stroke:i,strokeWidth:"1.2",strokeLinejoin:"round"})})}function Fa({size:o=14,color:i="var(--t5)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 16 16",fill:"none",style:{...rt,...s},children:u.jsx("path",{d:"M4.5 12.5a3 3 0 0 1-.4-5.97 4 4 0 0 1 7.8-.03 2.75 2.75 0 0 1-.4 6H4.5z",stroke:i,strokeWidth:"1.2",strokeLinejoin:"round"})})}function Ef({size:o=14,color:i="var(--t5)",strokeWidth:s=1.2,style:c}){return u.jsxs("svg",{width:o,height:o,viewBox:"0 0 16 16",fill:"none",style:{...rt,...c},children:[u.jsx("rect",{x:"2",y:"3.5",width:"12",height:"7.5",rx:"1.4",stroke:i,strokeWidth:s}),u.jsx("path",{d:"M5.5 13.5h5",stroke:i,strokeWidth:s,strokeLinecap:"round"})]})}function Fo({size:o=11,color:i="var(--t4)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 12 12",fill:"none",style:{...rt,...s},children:u.jsx("path",{d:"M6 2v8M2 6h8",stroke:i,strokeWidth:"1.4",strokeLinecap:"round"})})}function Tf({size:o=10,color:i="var(--t5)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 10 10",fill:"none",style:{...rt,...s},children:u.jsx("path",{d:"M3.5 2L7 5 3.5 8",stroke:i,strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function Wa({size:o=8,color:i="var(--t6)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 10 10",fill:"none",style:{...rt,...s},children:u.jsx("path",{d:"M2 3.5 5 6.5 8 3.5",stroke:i,strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function Cf({size:o=12,color:i="var(--t3)",style:s}){return u.jsxs("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...rt,...s},children:[u.jsx("circle",{cx:"3",cy:"7",r:"1.1",fill:i}),u.jsx("circle",{cx:"7",cy:"7",r:"1.1",fill:i}),u.jsx("circle",{cx:"11",cy:"7",r:"1.1",fill:i})]})}function jf({size:o=12,color:i="var(--t3)",style:s}){return u.jsxs("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...rt,...s},children:[u.jsx("rect",{x:"2",y:"2.5",width:"10",height:"3",rx:"1",stroke:i,strokeWidth:"1.2"}),u.jsx("path",{d:"M3 5.5v4A1.5 1.5 0 0 0 4.5 11h5A1.5 1.5 0 0 0 11 9.5v-4M5.5 7.5h3",stroke:i,strokeWidth:"1.2",strokeLinecap:"round"})]})}function bo({size:o=12,color:i="var(--err)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...rt,...s},children:u.jsx("path",{d:"M2.5 3.5h9M5.5 3.5v-1h3v1M4 3.5l.5 7A1.5 1.5 0 0 0 6 12h2a1.5 1.5 0 0 0 1.5-1.5l.5-7",stroke:i,strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function tm({size:o=15,color:i="var(--t3)",style:s}){return u.jsxs("svg",{width:o,height:o,viewBox:"0 0 16 16",fill:"none",style:{...rt,...s},children:[u.jsx("path",{d:"M6.8 1.8h2.4l.3 1.6c.5.2 1 .4 1.4.8l1.6-.6 1.2 2-1.3 1.1c.05.25.1.55.1.85s-.05.6-.1.85l1.3 1.1-1.2 2-1.6-.6c-.4.35-.9.6-1.4.8l-.3 1.6H6.8l-.3-1.6c-.5-.2-1-.45-1.4-.8l-1.6.6-1.2-2 1.3-1.1A4.6 4.6 0 0 1 3.5 8c0-.3.03-.6.1-.85L2.3 6l1.2-2 1.6.6c.4-.35.9-.6 1.4-.8l.3-2z",stroke:i,strokeWidth:"1.2",strokeLinejoin:"round"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.9",stroke:i,strokeWidth:"1.2"})]})}function nm({size:o=12,color:i="var(--t3)",style:s}){return u.jsxs("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...rt,...s},children:[u.jsx("path",{d:"M4 2.5v6.2a2 2 0 1 0 1.3.05V4.8",stroke:i,strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("circle",{cx:"4.6",cy:"10.7",r:"1.6",stroke:i,strokeWidth:"1.2"}),u.jsx("circle",{cx:"9.4",cy:"3.3",r:"1.6",stroke:i,strokeWidth:"1.2"}),u.jsx("path",{d:"M9.4 4.9v2.3a2 2 0 0 1-2 2h-.7",stroke:i,strokeWidth:"1.2",strokeLinecap:"round"})]})}function rm({size:o=13,color:i="var(--t5)",style:s}){return u.jsxs("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...rt,...s},children:[u.jsx("circle",{cx:"7",cy:"7",r:"5.5",stroke:i,strokeWidth:"1.2"}),u.jsx("path",{d:"M7 4v3.2l2.2 1.3",stroke:i,strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ua({size:o=9,color:i="var(--t5)",style:s}){return u.jsx("svg",{Line truncated
`)[0].slice(0,160):"";f[h]={...y,status:i.status==="completed"?"ok":"fail",out:m,lastLine:void 0};break}}return{...o,items:f}}case"plan":{const f=o.items.slice();for(let h=f.length-1;h>=0;h--)if(f[h].kind==="plan")return f[h]={kind:"plan",entries:i.entries??[]},{...o,items:f,streamKind:""};return yr(o,{kind:"plan",entries:i.entries??[]})}case"llm_call_retry":return yr(o,{kind:"sys",text:`模型调用重试 #${i.attempt??"?"}: ${i.message??""}`});case"usage_update":return{...o,usage:{used:i.used??0,size:i.size??0}};case"compact_status":return yr(o,{kind:"sys",text:i.status==="started"?"⟳ 上下文接近上限,正在压缩…":"⟳ 上下文压缩完成"});case"model_update":{const f=i.model??"";return{...yr(o,{kind:"sys",text:`模型已切换为 ${f}`}),model:f}}case"permission_mode_update":{const f=i.mode??"default";return{...yr(o,{kind:"sys",text:f==="yolo"?"⚡ 已开启 YOLO 模式:所有操作不再询问,直接执行":"已恢复默认权限模式"}),permMode:f}}default:return o}}function fm(o,i){switch(i.type){case"task-started":return{...o,running:!0};case"task-ended":return{...o,running:!1,streamKind:"",turnEnded:!0,items:[...Kd(o.items),{kind:"sys",text:"— 本轮结束 —"}]};case"task-error":{const s=ai(i);return{...o,running:!1,streamKind:"",items:[...Kd(o.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?Ya(s.content):""}catch{c=(s==null?void 0:s.content)??""}return yr(o,{kind:"user",text:c})}case"permission-req":{const s=ai(i);return s!=null&&s.id?yr(o,{kind:"perm",id:s.id,title:s.title??"",tool:s.tool??"",state:"open"}):o}case"permission-resolved":{const s=ai(i);return s!=null&&s.id?{...o,items:o.items.map(c=>c.kind==="perm"&&c.id===s.id&&c.state==="open"?{...c,state:s.outcome??"expired"}:c)}:o}case"task-running":if(i.kind==="acp_event"){const s=ai(i);if(s!=null&&s.update)return dm(o,s.update)}return o;default:return o}}function If(o,i){let s=o;for(const c of i)s=fm(s,c);return s}function pm(o,i,s){return{...o,items:o.items.map(c=>c.kind==="perm"&&c.id===i&&c.state==="open"?{...c,state:s?"allowed":"rejected"}:c)}}ze.setOptions({gfm:!0,breaks:!0});const Ft="ui-monospace,Menlo,monospace";function hm(o){const i=o.target.closest("a");if(!i)return;o.preventDefault();const s=i.getAttribute("href")||"";/^https?:/i.test(s)&&bh(s)}function gm({text:o}){const i=Y.useMemo(()=>yg.sanitize(ze.parse(o,{async:!1})),[o]);return u.jsx("div",{className:"md",onClick:hm,dangerouslySetInnerHTML:{__html:i}})}function mm({text:o}){const[i,s]=Y.useState(!1);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[u.jsxs("div",{onClick:()=>s(!i),style:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:"var(--t4)",cursor:"pointer",userSelect:"none",lineHeight:1.6,minWidth:0},children:[u.jsx(im,{}),u.jsx("span",{style:{fontWeight:600,color:"var(--t3)",flex:"none"},children:"思考"}),!i&&u.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.trim().replace(/\s+/g," ")}),i&&u.jsx("span",{style:{flex:1}}),u.jsx(Tf,{size:9,color:"var(--t6)",style:{transform:i?"rotate(90deg)":"none",transition:"transform .15s ease"}})]}),i&&u.jsx("div",{style:{marginLeft:5,borderLeft:"2px solid var(--line)",padding:"2px 0 2px 13px",fontSize:12,color:"var(--t4)",lineHeight:1.7,whiteSpace:"pre-wrap",wordBreak:"break-word",animation:"mcin .2s ease"},children:o})]})}const zf={background:"var(--card)",border:"1px solid var(--cardBd)",borderRadius:10,boxShadow:"var(--cardSh)",padding:"11px 14px"};function vm({entries:o}){const i=s=>s==="completed"?"☑":s==="in_progress"?"◐":"☐";return u.jsx("div",{style:{...zf,fontSize:12.5,display:"flex",flexDirection:"column",gap:4,animation:"mcin .25s ease"},children:o.map((s,c)=>u.jsxs("div",{style:{color:s.status==="completed"?"var(--t5)":s.status==="in_progress"?"var(--acc)":"var(--t2)",textDecoration:s.status==="completed"?"line-through":"none"},children:[u.jsx("span",{style:{display:"inline-block",width:18},children:i(s.status)})," ",s.content]},c))})}function ym({status:o}){const i=o==="run";return u.jsx("span",{style:{width:7,height:7,borderRadius:"50%",flex:"none",border:`1.5px solid ${i?"var(--acc)":o==="ok"?"var(--t5)":"var(--err)"}`,background:i?"var(--accBd)":"transparent",animation:i?"mcpulse 1.4s infinite":"none"}})}function xm(o){return o==="ok"?u.jsx(Nf,{size:10}):o==="fail"?u.jsx("span",{style:{color:"var(--err)",fontSize:10,flex:"none"},children:"✗"}):u.jsx("span",{style:{color:"var(--t5)",fontSize:10,flex:"none",animation:"mcpulse 1.2s infinite"},children:"◌"})}function wm({item:o,onOpenChild:i}){const s=o.feed??[],c=s.slice(-5),f=o.title.indexOf(" "),h=f>0?o.title.slice(0,f):"",y=f>0?o.title.slice(f+1):o.title,m={display:"flex",gap:7,alignItems:"center",paddingLeft:15,font:"11px/1.7 "+Ft,color:"var(--t3)",whiteSpace:"nowrap",minWidth:0};return u.jsxs("div",{style:{...zf,display:"flex",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 Cm({text:o}){const i=Y.useMemo(()=>Tm(o),[o]);return i.some(s=>s.kind==="h")?u.jsx("div",{style:{font:"12px/1.9 "+Ft},children:i.map((s,c)=>s.kind==="h"?u.jsxs("div",{style:{display:"flex",padding:"2px 24px",background:"var(--codeBg)",color:"var(--t4)",fontSize:11},children:[u.jsx("span",{style:{width:36,flex:"none"}}),u.jsx("span",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all"},children:s.text})]},c):u.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:[u.jsx("span",{style:{width:36,color:"var(--t5)",flex:"none",opacity:.6},children:s.no}),u.jsx("span",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",minWidth:0},children:s.text||" "})]},c))}):u.jsx("pre",{style:{margin:0,padding:"10px 24px",font:"12px/1.9 "+Ft,color:"var(--t4)",whiteSpace:"pre-wrap"},children:o})}const Wo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAABRHElEQVR4nO29d5xU1fn4/z7nlukzuwtLFQSxYkM0xkqxG40dkqiJibFrNNUYUxbSjUlMMTEmxhg1FogxdmMDLBhRBBRsiIL0Xdg2O/Xee57fH3dmG7sUP7Z8fz6v192ZvXPvac9znvO08xz4GD6Gj+Fj+Bg+ho/hY/gYPoaP4WP4GDYPCkEB6sNuyHsB/0904n0BEdXANPUKu6tG6tWc2bPD+5On+53PzJhhMXVq8OE08GN4T6FBRE+cNctmVoONoPt6RgEiokTEFiScPPK/PYn+pxv/fwIRNYWZeubsJYrJ0wNAqj85QFkk8p32p7ZvtstjlwXNw7yCN369KqadwN69mUI0HkuUDqD+67fWHPMwIhqlzIfXmXcP/78iABFRk2ZPs+ZM2l1QXaw7iuY2Wbrzo+3v7P+W17Z3ixT3bglyu7T6heFByrU8BaXAIIDn+WhfMAmbnQqRpnmDT965lto2QVBKSf+1fzTB/rAb8H5DF9IxKpylvgZekw3p6S3PT1pOduIGv3jQ19bO3rc9rpyCZfADD4MPtkDZC5TliHIc8DzsnKdFI7T75NFuPpu3SSP/q0vB/5sEIKgpzNAzAaVUAPgW8IsNC4b/hxWHvynZCRMa/310wWW7ojb4vkcgHpScQEcjYumIsjxLmeYOJavXWtaKZmRFI6qtjLn4MCRp+1Yibo/Opf65XXr4BmSGVannfw7+J6m2XxBRMFNX2bsCnpa1g37ePu/YpaWWkzaUSocVE066hMGUS6C00VHXCEap5pxm2TrFS2uQRavg9bXoVa3Q3IEqeaigiLngWPyfnyymNSeDIml/urXPHhcOGr+0QURP/x+VAf7f4AAiitnTLJTygUBErCuL8ybNyq88fWrTg8e1RxmcUwWMeFCOBFYsJqioZtlazQtLtZ77Fix6B95pgVwJhYBloRwLcW0wgtl5e4IrjoZsIXAHpO2x2dRtFw0av3SKzLCmd5/9EmoHDaBeYWaoQgITZ89mTncV8iMC/9sE0BPxvoikj9l41yn7brjjslUUxrXaQjmfQ3k6IOagHNHq1XUWT7yGmv0aevEqVEsuLCvigGtDTTzUB0TAhJNaiiX8y46BVERMtqSH5q22y4bu9oPZsxrst9hBIbMUs2fDpOkBFUFwejetAmDOBzku2wD/mwTQC/E/WfNk/b322gtGbbjpvA2Ov12hWEKKgVjpRGDFUhZvrbHUYy+jHl6CWrgK2vMo24KoCzUJAJQRRAQCg5IK9iyNastjjt4TOXEvZGOHiQ6us8ZlMz86We25EmA+0wHQlcsTiZ2fe7LGb+8Y/nI0PyRdlnEron56Tz+y+IH6qTeXja/4CGkL/1sygIiaOHuaVWWl31n32OC7WXVBU1C8MB+3B5eyObTSgUrFlLQVNLNfhbsXop95A92UBdtG4g5YujLDpcc87RoMCW/7BhIu/j0XIiNqjSitx0vd3KUjv3zwDR0Lh8xh3bA3TW5ULl/cb43JDTLCnh1+eVCADPYJYioZxbc1HoZMOskRG2u+fMfAY26cOKvB/qgsB/8zHGCKzLBmKhXMAf/BNW/UX6nnXXS9WnpRNqoHeW0FrJzjW8mkJWtbLHXzXNSMeaiXV4cITkSQ2gRKBGXCWS59IV5RIQgFWkEhT/CTUzC7DEVt6FA67mCQRO3K6174WsucnXPapIJYhGIkIBDBeCZ8D4WyHKzAD1TWE6PwmrXlNPnueODGOZM+yJHbPHz0CaAi2c9UUwNZLfHPxB74+kXlpy9aF/GHltqLqED7OhWz5M2Nttz2H/RdL6DfaQbXQdJxUKCMgcB0K7Jb+b15oAKUQnUUMSftS3D6vtCcQ1lKScFjQax5b21biB8gWOCXAhxLlAIlKJX3lW4uKFnXrqxs3goOGkUAemBZ9FidnPk4MIXdZeYHMHRbAx9tApAZFkoFFgRHrPvnETs5N/1yncveHdk2tGf7Oh235I01tv7rM+i7F6KasqhYFGqTYAwqMH0vcqrPr12gFQSG4LR9kHQEVfCRuAu2g6UwlANUyVN6Q5uSVc2WWdaEfr0RtboFVrdBcwes2Uhw4WFw9C5GlQNdn+e132135Nzfi6iZfHRUxo8kATRIg54OoKYGV699ZtCNeumP5+rmcztKJXQ28O1M0pJ3Ntr87F7sO+ejNuYhEYHaBAQCftA5k3sJ40B/gk+3uyLg2Og75mP23g7KBvXSanhrIyxdr9VbG1ArN6DWZ9HZAlbJR1WWDbE1ojVqYB3mnCMwxcDE4km9k19zo1LKmyiz7DmKj8T6Dx9BITBc66cGDnD4hn+dtcg0X9XoeIODDXljZZJQ8rX+2xzUdbNgbRsqEQPHCmd8Fdeq8w99EUDf0H0oBJRCch5SEwnL35hHlT1AobRGHAscC2WpCqEREo5W0JIjOGsi5prTJWhvU0OtVMfN6aNGHZnZbiMiHykt4KPDAUQUTLNmqqn+39YuGPU76/VfP221nNzRkUWjAzUwacnjr6F/9hB6/ltQZfVBuL5vSsnbMsZ9CAJGUAkHVQiQvA9RBxJupWQBA4ggRlBIVW8ImXsignzhE0i5EFjJmF2b5bojM9tt3PGN30beVKr0rsbnfYI+/d4fNDRIg4ZpSqvp/iUts076sbvwhUV228m5xtbAiseFjoJlfe027M/9CWvRSqhNoRyN8sNZvwny36v5ZQQsULYKNYigIlcE0kOSrKA+VC87SshRY5E9hkOuqHVgJJ2uSTzZ/kb9mztfVkJQYX8/GvChLwFVlh/D4vDGu66a57Ze3phtQRsC0mmLexZgTbsLvXwjZLqMNpuFd9WrXkuA9PqtF9eWTb4QGo5a85gzD8S/4axQKC36YtVnVH2Jd3aza3/6yOMn3aCmqiCUBSZ/6LLAh0oAE2fNsudMnuzPWL94yDT94g3Lk95x+TUtgZ1KaNORV9aPH0DdNBdsGxV3QsOMIhS4+oKt7E0PUaHfh3r9qrq/2QeTka5PsRTmgklw+gHIiHpMW0cg2ljxmgxDcjx9hD/ooj+PPO5lQs4nH6ZM8KERQNUa9sN3Ht3zL9Y7d66Jm92Cja2erk878vwKrK/egbV4JZJOojDhmktV3tqSHtc/bG6kexS1BSrplwAgXB46CsjgDP6XJ8AXJ6JTWoL2fEBNzK4N7Pw4u/7Spwed9tcyFa1HTf9QVMMPhQD2feF6Z/5+53tfanxw4mx7w/1vl9uSusP3ZWDcVv94Guvyu1FFg0pFwa9yybCp7ycB9Ib+it4s8qtgayj6UCgguw5HvnMcwXF7oLLFIBBjpQcNYOecc/vz/qRz1PDh+Q+LCD5wAqiufUe/ffukBcnC/Y3FbMIKCEzCtfTP7sP69WMQj0JFyOtUsbq1WL1LAng3fLZ38X2W0d9NpUK3cr6M+AH+5Line 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 Pm=o=>o&&typeof o=="object"?Object.entries(o).map(([i,s])=>`${i}=${String(s)}`).join(`
`):"";function Dm(o){const i={};for(const s of o){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:nf(s.kv)}}else{if(!s.url.trim())continue;i[c]={url:s.url.trim(),headers:nf(s.kv)}}}return i}function Om(o){return Object.entries(o).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:Pm(f?c.env:c.headers)}})}const Mr={background:"var(--card)",border:"1px solid var(--cardBd)",borderRadius:11,padding:16,boxShadow:"var(--cardSh)"},bm={fontSize:11,fontWeight:700,letterSpacing:.5,color:"var(--t4)"},jn={width:"100%",height:30,border:"1px solid rgba(30,40,35,.13)",borderRadius:7,background:"#fdfdfc",color:"var(--t1)",padding:"0 10px",fontSize:12,fontFamily:Ft,outline:"none",minWidth:0},rf={width:"100%",height:30,border:"1px solid rgba(30,40,35,.13)",borderRadius:7,background:"#fdfdfc",color:"var(--t1)",padding:"0 6px",fontSize:12,outline:"none",cursor:"pointer"},Of={height:28,border:"1px solid rgba(30,40,35,.15)",background:"var(--card)",color:"var(--t1)",borderRadius:8,padding:"0 13px",fontSize:12,fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",gap:5,boxShadow:"var(--cardSh)",whiteSpace:"nowrap"};function sn({label:o,children:i}){return u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,flex:1,minWidth:0},children:[u.jsx("span",{style:{fontSize:11.5,color:"var(--t3)",fontWeight:600},children:o}),i]})}function zo({label:o,action:i,children:s}){return u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:9},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[u.jsx("span",{style:bm,children:o}),u.jsx("span",{style:{flex:1}}),i]}),s]})}function _m({version:o,update:i,onUpdateStatus:s}){const[c,f]=Y.useState("idle"),[h,y]=Y.useState(null),m=!!(i!=null&&i.available),S=async()=>{f("checking"),y(null);try{const H=await sf();s(H),H.available||y({text:"已是最新版本",color:"var(--ok)"})}catch(H){y({text:H instanceof Error?H.message:String(H),color:"var(--err)"})}finally{f("idle")}},k=async()=>{f("installing"),y(null);try{await Oh()}catch(H){y({text:H instanceof Error?H.message:String(H),color:"var(--err)"}),f("idle")}},j=c!=="idle",_=c==="checking"?"检查中":c==="installing"?"更新中":m?"下载更新":"检查更新",N=m&&c!=="checking";return u.jsxs("div",{style:{...Mr,padding:"14px 16px",display:"flex",alignItems:"center",gap:12},children:[u.jsx("div",{style:{width:34,height:34,borderRadius:9,background:"var(--accBg)",display:"flex",alignItems:"center",justifyContent:"center",flex:"none"},children:u.jsx("img",{src:Wo,alt:"",draggable:!1,style:{width:22,height:22,borderRadius:5}})}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:1,minWidth:0},children:[u.jsx("span",{style:{fontWeight:700,fontSize:13},children:"MonkeyCode"}),u.jsx("span",{style:{fontSize:11.5,color:"var(--t5)",fontFamily:Ft,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m?`${(i==null?void 0:i.current)??o} → ${i==null?void 0:i.latest} 可用`:o})]}),u.jsx("span",{style:{flex:1}}),h&&u.jsx("span",{style:{fontSize:12,color:h.color,flex:"none"},children:h.text}),u.jsxs("button",{className:N?"hv-acc":"hv",onClick:()=>!j&&void(N?k():S()),style:{...Of,gap:6,flex:"none",...N?{background:"var(--acc)",borderColor:"var(--acc)",color:"var(--onAcc)"}:{},opacity:j?.7:1,cursor:j?"default":"pointer"},children:[j&&u.jsx("span",{style:{width:11,height:11,border:`1.5px solid ${N?"var(--onAcc)":"var(--t1)"}`,borderTopColor:"transparent",borderRadius:"50%",animation:"mcspin .9s linear infinite",display:"inline-block"}}),_]})]})}const lf=()=>({name:"",provider:"anthropic",base_url:"",api_key:"",model:""}),Mm=()=>({name:"",type:"http",url:"",command:"",args:"",kv:""});function Fm({onClose:o,hostVersion:i,update:s,onUpdateStatus:c}){const f=mi(),[h,y]=Y.useState([]),[m,S]=Y.useState(0),[k,j]=Y.useState({}),[_,N]=Y.useState([]),[H,B]=Y.useState(!1),[K,J]=Y.useState(""),[fe,me]=Y.useState(!1);Y.useEffect(()=>{f&&Ah().then(I=>{const U=(I==null?void 0:I.models)??[];y(U.length?U:[lf()]),S(Math.max(0,U.findIndex(ne=>ne.default))),N(Om((I==null?void 0:I.mcp_servers)??{})),B(!0)}).catch(I=>J("读取配置失败: "+(I instanceof Error?I.message:String(I))))},[f]);const de=(I,U)=>y(ne=>ne.map((ye,_e)=>_e===I?{...ye,...U}:ye)),ee=(I,U)=>N(ne=>ne.map((ye,_e)=>_e===I?{...ye,...U}:ye)),G=async()=>{for(const U of h)if(!U.name.trim()||!U.base_url.trim()||!U.api_key.trim()||!U.model.trim()){J(`模型「${U.name.trim()||"未命名"}」信息不完整(需名称/接口地址/API Key/模型标识)`);return}const I=new Set;for(const U of h){if(I.has(U.name.trim())){J(`模型名称重复: ${U.name.trim()}`);return}I.add(U.name.trim())}J(""),me(!0);try{await Lh({moLine truncated
<style rel="stylesheet" crossorigin>:root{--bg: #fcfdfc;--side: #eef1ee;--line: rgba(30, 40, 35, .12);--line2: rgba(30, 40, 35, .08);--t1: #1d221f;--t2: #2a302b;--t3: #59605a;--t4: #7b827c;--t5: #8a918b;--t6: #a8afa9;--acc: #1f8a5b;--accH: #25a06b;--accBg: rgba(31, 138, 91, .12);--accBd: rgba(31, 138, 91, .2);--onAcc: #fff;--ok: #28a866;--err: #c2503e;--errBg: rgba(194, 80, 62, .09);--warn: #a16207;--warnBg: rgba(232, 193, 90, .14);--warnBd: rgba(161, 98, 7, .35);--card: #ffffff;--cardBd: rgba(30, 40, 35, .1);--cardSh: 0 1px 2px rgba(0, 0, 0, .04);--hov: rgba(120, 130, 125, .12);--hov2: rgba(120, 130, 125, .18);--hov3: rgba(120, 130, 125, .25);--pop: #fcfdfd;--shadow: 0 8px 28px rgba(30, 45, 38, .2);--codeBg: rgba(30, 40, 35, .05);--userBg: #e9f2ec;--addBg: rgba(40, 168, 102, .08);--addT: #1c7a4b;--delBg: rgba(194, 80, 62, .08);--delT: #a63d2e}*{box-sizing:border-box}html,body,#root{height:100%}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,SF Pro Text,PingFang SC,Microsoft YaHei,Helvetica Neue,sans-serif;background:var(--bg);color:var(--t1);font-size:13px;overflow:hidden}a{color:var(--acc);text-decoration:none}a:hover{color:#166b46;text-decoration:underline}input,textarea,select,button{font-family:inherit}textarea::placeholder,input::placeholder{color:var(--t6)}@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:#6e787338;border-radius:6px;border:2px solid transparent;background-clip:content-box}::-webkit-scrollbar-thumb:hover{background:#6e787361;background-clip:content-box}*{scrollbar-width:thin;scrollbar-color:rgba(110,120,115,.22) transparent}.hv:hover{background:var(--hov)!important}.hv2:hover{background:var(--hov2)!important}.hv3:hover{background:var(--hov3)!important}.hv-t1:hover{color:var(--t1)!important}.hv-err:hover{color:var(--err)!important}.hv-errbg:hover{background:var(--errBg)!important}.hv-op:hover{filter:brightness(.97)}.hv-acc:hover{background:var(--accH)!important}.hv-accbg:hover{background:#1f8a5b12!important}.hv-bd:hover{border-color:var(--acc)!important}.md{font-size:13.5px;line-height:1.8;color:var(--t2)}.md>:first-child{margin-top:0}.md>:last-child{margin-bottom:0}.md ul,.md ol{margin:0 0 10px;padding-left:20px;display:flex;flex-direction:column;gap:4px}.md p{margin:0 0 10px}.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(--codeBg);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>
`}tablecell(o){const l=this.parser.parseInline(o.tokens),s=o.header?"th":"td";return(o.align?`<${s} align="${o.align}">`:`<${s}>`)+l+`</${s}>
`}strong({tokens:o}){return`<strong>${this.parser.parseInline(o)}</strong>`}em({tokens:o}){return`<em>${this.parser.parseInline(o)}</em>`}codespan({text:o}){return`<code>${Pn(o,!0)}</code>`}br(o){return"<br>"}del({tokens:o}){return`<del>${this.parser.parseInline(o)}</del>`}link({href:o,title:l,tokens:s}){const c=this.parser.parseInline(s),f=Zd(o);if(f===null)return c;o=f;let h='<a href="'+o+'"';return l&&(h+=' title="'+Pn(l)+'"'),h+=">"+c+"</a>",h}image({href:o,title:l,text:s,tokens:c}){c&&(s=this.parser.parseInline(c,this.parser.textRenderer));const f=Zd(o);if(f===null)return Pn(s);o=f;let h=`<img src="${o}" alt="${s}"`;return l&&(h+=` title="${Pn(l)}"`),h+=">",h}text(o){return"tokens"in o&&o.tokens?this.parser.parseInline(o.tokens):"escaped"in o&&o.escaped?o.text:Pn(o.text)}},iu=class{strong({text:o}){return o}em({text:o}){return o}codespan({text:o}){return o}del({text:o}){return o}html({text:o}){return o}text({text:o}){return o}link({text:o}){return""+o}image({text:o}){return""+o}br(){return""}},Yn=class Ua{constructor(l){_e(this,"options");_e(this,"renderer");_e(this,"textRenderer");this.options=l||Ur,this.options.renderer=this.options.renderer||new _o,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new iu}static parse(l,s){return new Ua(s).parse(l)}static parseInline(l,s){return new Ua(s).parseInline(l)}parse(l,s=!0){var f,h;let c="";for(let y=0;y<l.length;y++){const m=l[y];if((h=(f=this.options.extensions)==null?void 0:f.renderers)!=null&&h[m.type]){const w=m,C=this.options.extensions.renderers[w.type].call({parser:this},w);if(C!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(w.type)){c+=C||"";continue}}const S=m;switch(S.type){case"space":{c+=this.renderer.space(S);continue}case"hr":{c+=this.renderer.hr(S);continue}case"heading":{c+=this.renderer.heading(S);continue}case"code":{c+=this.renderer.code(S);continue}case"table":{c+=this.renderer.table(S);continue}case"blockquote":{c+=this.renderer.blockquote(S);continue}case"list":{c+=this.renderer.list(S);continue}case"html":{c+=this.renderer.html(S);continue}case"paragraph":{c+=this.renderer.paragraph(S);continue}case"text":{let w=S,C=this.renderer.text(w);for(;y+1<l.length&&l[y+1].type==="text";)w=l[++y],C+=`
`+this.renderer.text(w);s?c+=this.renderer.paragraph({type:"paragraph",raw:C,text:C,tokens:[{type:"text",raw:C,text:C,escaped:!0}]}):c+=C;continue}default:{const w='Token with "'+S.type+'" type was not found.';if(this.options.silent)return console.error(w),"";throw new Error(w)}}}return c}parseInline(l,s=this.renderer){var f,h;let c="";for(let y=0;y<l.length;y++){const m=l[y];if((h=(f=this.options.extensions)==null?void 0:f.renderers)!=null&&h[m.type]){const w=this.options.extensions.renderers[m.type].call({parser:this},m);if(w!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(m.type)){c+=w||"";continue}}const S=m;switch(S.type){case"escape":{c+=s.text(S);break}case"html":{c+=s.html(S);break}case"link":{c+=s.link(S);break}case"image":{c+=s.image(S);break}case"strong":{c+=s.strong(S);break}case"em":{c+=s.em(S);break}case"codespan":{c+=s.codespan(S);break}case"br":{c+=s.br(S);break}case"del":{c+=s.del(S);break}case"text":{c+=s.text(S);break}default:{const w='Token with "'+S.type+'" type was not found.';if(this.options.silent)return console.error(w),"";throw new Error(w)}}}return c}},_a,Lo=(_a=class{constructor(o){_e(this,"options");_e(this,"block");this.options=o||Ur}preprocess(o){return o}postprocess(o){return o}processAllTokens(o){return o}provideLexer(){return this.block?Qn.lex:Qn.lexInline}provideParser(){return this.block?Yn.parse:Yn.parseInline}},_e(_a,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),_a),dm=class{constructor(...o){_e(this,"defaults",Ka());_e(this,"options",this.setOptions);_e(this,"parse",this.parseMarkdown(!0));_e(this,"parseInline",this.parseMarkdown(!1));_e(this,"Parser",Yn);_e(this,"Renderer",_o);_e(this,"TextRenderer",iu);_e(this,"Lexer",Qn);_e(this,"Tokenizer",bo);_e(this,"Hooks",Lo);this.use(...o)}walkTokens(o,l){var c,f;let s=[];for(const h of o)switch(s=s.concat(l.call(this,h)),h.type){case"table":{const y=h;for(const m of y.header)s=s.concat(this.walkTokens(m.tokens,l));for(const m of y.rows)for(const S of m)s=s.concat(this.walkTokens(S.tokens,l));break}case"list":{const y=h;s=s.concat(this.walkTokens(y.items,l));break}default:{const y=h;(f=(c=this.defaults.extensions)==null?void 0:c.childTokens)!=null&&f[y.type]?this.defaults.extensions.childTokens[y.type].forEach(m=>{const S=y[m].flat(1/0);s=s.concat(this.walkTokens(S,l))}):y.tokens&&(s=s.concat(this.walkTokens(y.tokens,l)))}}return s}use(...o){const l=this.defaults.extensions||{renderers:{},childTokens:{}};return o.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=l.renderers[f.name];h?l.renderers[f.name]=function(...y){let m=f.renderer.apply(this,y);return m===!1&&(m=h.apply(this,y)),m}:l.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=l[f.level];h?h.unshift(f.tokenizer):l[f.level]=[f.tokenizer],f.start&&(f.level==="block"?l.startBlock?l.startBlock.push(f.start):l.startBlock=[f.start]:f.level==="inline"&&(l.startInline?l.startInline.push(f.start):l.startInline=[f.start]))}"childTokens"in f&&f.childTokens&&(l.childTokens[f.name]=f.childTokens)}),c.extensions=l),s.renderer){const f=this.defaults.renderer||new _o(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 y=h,m=s.renderer[y],S=f[y];f[y]=(...w)=>{let C=m.apply(f,w);return C===!1&&(C=S.apply(f,w)),C||""}}c.renderer=f}if(s.tokenizer){const f=this.defaults.tokenizer||new bo(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 y=h,m=s.tokenizer[y],S=f[y];f[y]=(...w)=>{let C=m.apply(f,w);return C===!1&&(C=S.apply(f,w)),C}}c.tokenizer=f}if(s.hooks){const f=this.defaults.hooks||new Lo;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 y=h,m=s.hooks[y],S=f[y];Lo.passThroughHooks.has(h)?f[y]=w=>{if(this.defaults.async)return Promise.resolve(m.call(f,w)).then(O=>S.call(f,O));const C=m.call(f,w);return S.call(f,C)}:f[y]=(...w)=>{let C=m.apply(f,w);return C===!1&&(C=S.apply(f,w)),C}}c.hooks=f}if(s.walkTokens){const f=this.defaults.walkTokens,h=s.walkTokens;c.walkTokens=function(y){let m=[];return m.push(h.call(this,y)),f&&(m=m.concat(f.call(this,y))),m}}this.defaults={...this.defaults,...c}}),this}setOptions(o){return this.defaults={...this.defaults,...o},this}lexer(o,l){return Qn.lex(o,l??this.defaults)}parser(o,l){return Yn.parse(o,l??this.defaults)}parseMarkdown(o){return(s,c)=>{const f={...c},h={...this.defaults,...f},y=this.onError(!!h.silent,!!h.async);if(this.defaults.async===!0&&f.async===!1)return y(new Error("marked(): The async option was set to tLine truncated
Please report this to https://github.com/markedjs/marked.`,o){const c="<p>An error occurred:</p><pre>"+Pn(s.message+"",!0)+"</pre>";return l?Promise.resolve(c):c}if(l)return Promise.reject(s);throw s}}},Wr=new dm;function Le(o,l){return Wr.parse(o,l)}Le.options=Le.setOptions=function(o){return Wr.setOptions(o),Le.defaults=Wr.defaults,gf(Le.defaults),Le};Le.getDefaults=Ka;Le.defaults=Ur;Le.use=function(...o){return Wr.use(...o),Le.defaults=Wr.defaults,gf(Le.defaults),Le};Le.walkTokens=function(o,l){return Wr.walkTokens(o,l)};Le.parseInline=Wr.parseInline;Le.Parser=Yn;Le.parser=Yn.parse;Le.Renderer=_o;Le.TextRenderer=iu;Le.Lexer=Qn;Le.lexer=Qn.lex;Le.Tokenizer=bo;Le.Hooks=Lo;Le.parse=Le;Le.options;Le.setOptions;Le.use;Le.walkTokens;Le.parseInline;Yn.parse;Qn.lex;const lt={flex:"none",display:"block"};function Ha({size:o=13,color:l="var(--t3)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...lt,...s},children:u.jsx("path",{d:"M1.5 4a1.5 1.5 0 0 1 1.5-1.5h2.6l1.3 1.5H11A1.5 1.5 0 0 1 12.5 5.5v5A1.5 1.5 0 0 1 11 12H3a1.5 1.5 0 0 1-1.5-1.5V4z",stroke:l,strokeWidth:"1.2",strokeLinejoin:"round"})})}function Ba({size:o=14,color:l="var(--t5)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 16 16",fill:"none",style:{...lt,...s},children:u.jsx("path",{d:"M4.5 12.5a3 3 0 0 1-.4-5.97 4 4 0 0 1 7.8-.03 2.75 2.75 0 0 1-.4 6H4.5z",stroke:l,strokeWidth:"1.2",strokeLinejoin:"round"})})}function Cf({size:o=14,color:l="var(--t5)",strokeWidth:s=1.2,style:c}){return u.jsxs("svg",{width:o,height:o,viewBox:"0 0 16 16",fill:"none",style:{...lt,...c},children:[u.jsx("rect",{x:"2",y:"3.5",width:"12",height:"7.5",rx:"1.4",stroke:l,strokeWidth:s}),u.jsx("path",{d:"M5.5 13.5h5",stroke:l,strokeWidth:s,strokeLinecap:"round"})]})}function Ho({size:o=11,color:l="var(--t4)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 12 12",fill:"none",style:{...lt,...s},children:u.jsx("path",{d:"M6 2v8M2 6h8",stroke:l,strokeWidth:"1.4",strokeLinecap:"round"})})}function Rf({size:o=10,color:l="var(--t5)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 10 10",fill:"none",style:{...lt,...s},children:u.jsx("path",{d:"M3.5 2L7 5 3.5 8",stroke:l,strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function Va({size:o=8,color:l="var(--t6)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 10 10",fill:"none",style:{...lt,...s},children:u.jsx("path",{d:"M2 3.5 5 6.5 8 3.5",stroke:l,strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function Nf({size:o=12,color:l="var(--t3)",style:s}){return u.jsxs("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...lt,...s},children:[u.jsx("circle",{cx:"3",cy:"7",r:"1.1",fill:l}),u.jsx("circle",{cx:"7",cy:"7",r:"1.1",fill:l}),u.jsx("circle",{cx:"11",cy:"7",r:"1.1",fill:l})]})}function If({size:o=12,color:l="var(--t3)",style:s}){return u.jsxs("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...lt,...s},children:[u.jsx("rect",{x:"2",y:"2.5",width:"10",height:"3",rx:"1",stroke:l,strokeWidth:"1.2"}),u.jsx("path",{d:"M3 5.5v4A1.5 1.5 0 0 0 4.5 11h5A1.5 1.5 0 0 0 11 9.5v-4M5.5 7.5h3",stroke:l,strokeWidth:"1.2",strokeLinecap:"round"})]})}function Oo({size:o=12,color:l="var(--err)",style:s}){return u.jsx("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...lt,...s},children:u.jsx("path",{d:"M2.5 3.5h9M5.5 3.5v-1h3v1M4 3.5l.5 7A1.5 1.5 0 0 0 6 12h2a1.5 1.5 0 0 0 1.5-1.5l.5-7",stroke:l,strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function fm({size:o=15,color:l="var(--t3)",style:s}){return u.jsxs("svg",{width:o,height:o,viewBox:"0 0 16 16",fill:"none",style:{...lt,...s},children:[u.jsx("path",{d:"M6.8 1.8h2.4l.3 1.6c.5.2 1 .4 1.4.8l1.6-.6 1.2 2-1.3 1.1c.05.25.1.55.1.85s-.05.6-.1.85l1.3 1.1-1.2 2-1.6-.6c-.4.35-.9.6-1.4.8l-.3 1.6H6.8l-.3-1.6c-.5-.2-1-.45-1.4-.8l-1.6.6-1.2-2 1.3-1.1A4.6 4.6 0 0 1 3.5 8c0-.3.03-.6.1-.85L2.3 6l1.2-2 1.6.6c.4-.35.9-.6 1.4-.8l.3-2z",stroke:l,strokeWidth:"1.2",strokeLinejoin:"round"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.9",stroke:l,strokeWidth:"1.2"})]})}function pm({size:o=12,color:l="var(--t3)",style:s}){return u.jsxs("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...lt,...s},children:[u.jsx("path",{d:"M4 2.5v6.2a2 2 0 1 0 1.3.05V4.8",stroke:l,strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("circle",{cx:"4.6",cy:"10.7",r:"1.6",stroke:l,strokeWidth:"1.2"}),u.jsx("circle",{cx:"9.4",cy:"3.3",r:"1.6",stroke:l,strokeWidth:"1.2"}),u.jsx("path",{d:"M9.4 4.9v2.3a2 2 0 0 1-2 2h-.7",stroke:l,strokeWidth:"1.2",strokeLinecap:"round"})]})}function hm({size:o=13,color:l="var(--t5)",style:s}){return u.jsxs("svg",{width:o,height:o,viewBox:"0 0 14 14",fill:"none",style:{...lt,...s},children:[u.jsx("circle",{cx:"7",cy:"7",r:"5.5",stroke:l,strokeWidth:"1.2"}),u.jsx("path",{d:"M7 4v3.2l2.2 1.3",stroke:l,strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Mo({size:o=9,color:l="var(--t5)",style:s}){return u.jsx("svg",{Line truncated
`)[0].slice(0,160):"";f[h]={...y,status:l.status==="completed"?"ok":"fail",out:m,lastLine:void 0};break}}return{...o,items:f}}case"plan":{const f=o.items.slice();for(let h=f.length-1;h>=0;h--)if(f[h].kind==="plan")return f[h]={kind:"plan",entries:l.entries??[]},{...o,items:f,streamKind:""};return wr(o,{kind:"plan",entries:l.entries??[]})}case"llm_call_retry":return wr(o,{kind:"sys",text:`模型调用重试 #${l.attempt??"?"}: ${l.message??""}`});case"usage_update":return{...o,usage:{used:l.used??0,size:l.size??0}};case"compact_status":return wr(o,{kind:"sys",text:l.status==="started"?"⟳ 上下文接近上限,正在压缩…":"⟳ 上下文压缩完成"});case"model_update":{const f=l.model??"";return{...wr(o,{kind:"sys",text:`模型已切换为 ${f}`}),model:f}}case"permission_mode_update":{const f=l.mode??"default";return{...wr(o,{kind:"sys",text:f==="yolo"?"⚡ 已开启 YOLO 模式:所有操作不再询问,直接执行":"已恢复默认权限模式"}),permMode:f}}default:return o}}function Em(o,l){switch(l.type){case"task-started":return{...o,running:!0};case"task-ended":return{...o,running:!1,streamKind:"",turnEnded:!0,items:[...tf(o.items),{kind:"sys",text:"— 本轮结束 —"}]};case"task-error":{const s=ci(l);return{...o,running:!1,streamKind:"",items:[...tf(o.items),{kind:"sys",text:"✗ "+((s==null?void 0:s.error)||"未知错误"),error:!0}]}}case"user-input":{const s=ci(l);let c="";try{c=s!=null&&s.content?Za(s.content):""}catch{c=(s==null?void 0:s.content)??""}return wr(o,{kind:"user",text:c})}case"permission-req":{const s=ci(l);return s!=null&&s.id?wr(o,{kind:"perm",id:s.id,title:s.title??"",tool:s.tool??"",state:"open"}):o}case"permission-resolved":{const s=ci(l);return s!=null&&s.id?{...o,items:o.items.map(c=>c.kind==="perm"&&c.id===s.id&&c.state==="open"?{...c,state:s.outcome??"expired"}:c)}:o}case"task-running":if(l.kind==="acp_event"){const s=ci(l);if(s!=null&&s.update)return Sm(o,s.update)}return o;default:return o}}function Lf(o,l){let s=o;for(const c of l)s=Em(s,c);return s}function Tm(o,l,s){return{...o,items:o.items.map(c=>c.kind==="perm"&&c.id===l&&c.state==="open"?{...c,state:s?"allowed":"rejected"}:c)}}Le.setOptions({gfm:!0,breaks:!0});const Wt="ui-monospace,Menlo,monospace";function jm(o){const l=o.target.closest("a");if(!l)return;o.preventDefault();const s=l.getAttribute("href")||"";/^https?:/i.test(s)&&Gh(s)}function Cm({text:o}){const l=B.useMemo(()=>Ig.sanitize(Le.parse(o,{async:!1})),[o]);return u.jsx("div",{className:"md",onClick:jm,dangerouslySetInnerHTML:{__html:l}})}function Rm({text:o}){const[l,s]=B.useState(!1);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[u.jsxs("div",{onClick:()=>s(!l),style:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:"var(--t4)",cursor:"pointer",userSelect:"none",lineHeight:1.6,minWidth:0},children:[u.jsx(mm,{}),u.jsx("span",{style:{fontWeight:600,color:"var(--t3)",flex:"none"},children:"思考"}),!l&&u.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.trim().replace(/\s+/g," ")}),l&&u.jsx("span",{style:{flex:1}}),u.jsx(Rf,{size:9,color:"var(--t6)",style:{transform:l?"rotate(90deg)":"none",transition:"transform .15s ease"}})]}),l&&u.jsx("div",{style:{marginLeft:5,borderLeft:"2px solid var(--line)",padding:"2px 0 2px 13px",fontSize:12,color:"var(--t4)",lineHeight:1.7,whiteSpace:"pre-wrap",wordBreak:"break-word",animation:"mcin .2s ease"},children:o})]})}const Pf={background:"var(--card)",border:"1px solid var(--cardBd)",borderRadius:10,boxShadow:"var(--cardSh)",padding:"11px 14px"};function Nm({entries:o}){const l=s=>s==="completed"?"☑":s==="in_progress"?"◐":"☐";return u.jsx("div",{style:{...Pf,fontSize:12.5,display:"flex",flexDirection:"column",gap:4,animation:"mcin .25s ease"},children:o.map((s,c)=>u.jsxs("div",{style:{color:s.status==="completed"?"var(--t5)":s.status==="in_progress"?"var(--acc)":"var(--t2)",textDecoration:s.status==="completed"?"line-through":"none"},children:[u.jsx("span",{style:{display:"inline-block",width:18},children:l(s.status)})," ",s.content]},c))})}function Im({status:o}){const l=o==="run";return u.jsx("span",{style:{width:7,height:7,borderRadius:"50%",flex:"none",border:`1.5px solid ${l?"var(--acc)":o==="ok"?"var(--t5)":"var(--err)"}`,background:l?"var(--accBd)":"transparent",animation:l?"mcpulse 1.4s infinite":"none"}})}function zm(o){return o==="ok"?u.jsx(Af,{size:10}):o==="fail"?u.jsx("span",{style:{color:"var(--err)",fontSize:10,flex:"none"},children:"✗"}):u.jsx("span",{style:{color:"var(--t5)",fontSize:10,flex:"none",animation:"mcpulse 1.2s infinite"},children:"◌"})}function Am({item:o,onOpenChild:l}){const s=o.feed??[],c=s.slice(-5),f=o.title.indexOf(" "),h=f>0?o.title.slice(0,f):"",y=f>0?o.title.slice(f+1):o.title,m={display:"flex",gap:7,alignItems:"center",paddingLeft:15,font:"11px/1.7 "+Wt,color:"var(--t3)",whiteSpace:"nowrap",minWidth:0};return u.jsxs("div",{style:{...Pf,display:"flex",Line truncated
`),h=[],y=[];for(const S of f){const w=S.match(Dm);w&&l?h.push(w[1]):y.push(S)}const m=y.join(`
`).trim();return u.jsxs("div",{style:{display:"flex",justifyContent:"flex-end"},children:[u.jsxs("div",{style:{maxWidth:"70%",background:"var(--userBg)",border:"1px solid var(--accBd)",borderRadius:"12px 12px 3px 12px",padding:"9px 15px",fontSize:13.5,lineHeight:1.6,color:"var(--t1)",whiteSpace:"pre-wrap",wordBreak:"break-word",animation:"mcin .25s ease"},children:[m,h.length>0&&u.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginTop:m?8:2},children:h.map(S=>u.jsx("img",{src:l(S),alt:S,title:S,onClick:()=>c(S),style:{maxWidth:150,maxHeight:120,borderRadius:8,border:"1px solid var(--accBd)",cursor:"zoom-in",display:"block"}},S))})]}),s&&u.jsx("div",{onClick:()=>c(null),style:{position:"fixed",inset:0,background:"rgba(20,30,25,.55)",zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",cursor:"zoom-out"},children:u.jsx("img",{src:l(s),alt:s,style:{maxWidth:"90vw",maxHeight:"90vh",borderRadius:10,boxShadow:"0 24px 70px rgba(0,0,0,.4)"}})})]})}function _m({item:o,onPermAnswer:l,uploadUrl:s}){switch(o.kind){case"user":return u.jsx(bm,{text:o.text,uploadUrl:s});case"agent":return u.jsx("div",{style:{maxWidth:"92%",wordBreak:"break-word",animation:"mcin .25s ease"},children:u.jsx(Cm,{text:o.text})});case"thought":return u.jsx(Rm,{text:o.text});case"plan":return u.jsx(Nm,{entries:o.entries});case"sys":return o.text==="— 本轮结束 —"?u.jsx(Pm,{}):u.jsx("div",{style:{color:o.error?"var(--err)":"var(--t5)",fontSize:11.5,textAlign:"center"},children:o.text});case"perm":return u.jsx(Lm,{item:o,onAnswer:l})}}function Df({items:o,onPermAnswer:l,onOpenChild:s,uploadUrl:c}){const f=[];for(let h=0;h<o.length;){const y=o[h];if(y.kind==="tool"){const m=h,S=[];for(;h<o.length;){const w=o[h];if(w.kind!=="tool")break;S.push(w),h++}f.push(u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:S.map((w,C)=>u.jsx(Am,{item:w,onOpenChild:s},w.tcId||C))},"g"+m))}else f.push(u.jsx(_m,{item:y,onPermAnswer:l,uploadUrl:c},h)),h++}return u.jsx(u.Fragment,{children:f})}function Om(o){const l=[];let s=0,c=0;for(const f of o.split(`
`)){const h=f.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(h){s=+h[1],c=+h[2],l.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("+")?l.push({no:String(c++),text:f,kind:"add"}):f.startsWith("-")?l.push({no:String(s++),text:f,kind:"del"}):(l.push({no:String(c),text:f,kind:"ctx"}),s++,c++))}return l}function Mm({text:o}){const l=B.useMemo(()=>Om(o),[o]);return l.some(s=>s.kind==="h")?u.jsx("div",{style:{font:"12px/1.9 "+Wt},children:l.map((s,c)=>s.kind==="h"?u.jsxs("div",{style:{display:"flex",padding:"2px 24px",background:"var(--codeBg)",color:"var(--t4)",fontSize:11},children:[u.jsx("span",{style:{width:36,flex:"none"}}),u.jsx("span",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all"},children:s.text})]},c):u.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:[u.jsx("span",{style:{width:36,color:"var(--t5)",flex:"none",opacity:.6},children:s.no}),u.jsx("span",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",minWidth:0},children:s.text||" "})]},c))}):u.jsx("pre",{style:{margin:0,padding:"10px 24px",font:"12px/1.9 "+Wt,color:"var(--t4)",whiteSpace:"pre-wrap"},children:o})}const Bo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAABRHElEQVR4nO29d5xU1fn4/z7nlukzuwtLFQSxYkM0xkqxG40dkqiJibFrNNUYUxbSjUlMMTEmxhg1FogxdmMDLBhRBBRsiIL0Xdg2O/Xee57fH3dmG7sUP7Z8fz6v192ZvXPvac9znvO08xz4GD6Gj+Fj+Bg+ho/hY/gYPoaP4WP4GDYPCkEB6sNuyHsB/0904n0BEdXANPUKu6tG6tWc2bPD+5On+53PzJhhMXVq8OE08GN4T6FBRE+cNctmVoONoPt6RgEiokTEFiScPPK/PYn+pxv/fwIRNYWZeubsJYrJ0wNAqj85QFkk8p32p7ZvtstjlwXNw7yCN369KqadwN69mUI0HkuUDqD+67fWHPMwIhqlzIfXmXcP/78iABFRk2ZPs+ZM2l1QXaw7iuY2Wbrzo+3v7P+W17Z3ixT3bglyu7T6heFByrU8BaXAIIDn+WhfMAmbnQqRpnmDT965lto2QVBKSf+1fzTB/rAb8H5DF9IxKpylvgZekw3p6S3PT1pOduIGv3jQ19bO3rc9rpyCZfADD4MPtkDZC5TliHIc8DzsnKdFI7T75NFuPpu3SSP/q0vB/5sEIKgpzNAzAaVUAPgW8IsNC4b/hxWHvynZCRMa/310wWW7ojb4vkcgHpScQEcjYumIsjxLmeYOJavXWtaKZmRFI6qtjLn4MCRp+1Yibo/Opf65XXr4BmSGVannfw7+J6m2XxBRMFNX2bsCnpa1g37ePu/YpaWWkzaUSocVE066hMGUS6C00VHXCEap5pxm2TrFS2uQRavg9bXoVa3Q3IEqeaigiLngWPyfnyymNSeDIml/urXPHhcOGr+0QURP/x+VAf7f4AAiitnTLJTygUBErCuL8ybNyq88fWrTg8e1RxmcUwWMeFCOBFYsJqioZtlazQtLtZ77Fix6B95pgVwJhYBloRwLcW0wgtl5e4IrjoZsIXAHpO2x2dRtFw0av3SKzLCmd5/9EmoHDaBeYWaoQgITZ89mTncV8iMC/9sE0BPxvoikj9l41yn7brjjslUUxrXaQjmfQ3k6IOagHNHq1XUWT7yGmv0aevEqVEsuLCvigGtDTTzUB0TAhJNaiiX8y46BVERMtqSH5q22y4bu9oPZsxrst9hBIbMUs2fDpOkBFUFwejetAmDOBzku2wD/mwTQC/E/WfNk/b322gtGbbjpvA2Ov12hWEKKgVjpRGDFUhZvrbHUYy+jHl6CWrgK2vMo24KoCzUJAJQRRAQCg5IK9iyNastjjt4TOXEvZGOHiQ6us8ZlMz86We25EmA+0wHQlcsTiZ2fe7LGb+8Y/nI0PyRdlnEron56Tz+y+IH6qTeXja/4CGkL/1sygIiaOHuaVWWl31n32OC7WXVBU1C8MB+3B5eyObTSgUrFlLQVNLNfhbsXop95A92UBdtG4g5YujLDpcc87RoMCW/7BhIu/j0XIiNqjSitx0vd3KUjv3zwDR0Lh8xh3bA3TW5ULl/cb43JDTLCnh1+eVCADPYJYioZxbc1HoZMOskRG2u+fMfAY26cOKvB/qgsB/8zHGCKzLBmKhXMAf/BNW/UX6nnXXS9WnpRNqoHeW0FrJzjW8mkJWtbLHXzXNSMeaiXV4cITkSQ2gRKBGXCWS59IV5RIQgFWkEhT/CTUzC7DEVt6FA67mCQRO3K6174WsucnXPapIJYhGIkIBDBeCZ8D4WyHKzAD1TWE6PwmrXlNPnueODGOZM+yJHbPHz0CaAi2c9UUwNZLfHPxB74+kXlpy9aF/GHltqLqED7OhWz5M2Nttz2H/RdL6DfaQbXQdJxUKCMgcB0K7Jb+b15oAKUQnUUMSftS3D6vtCcQ1lKScFjQax5b21biB8gWOCXAhxLlAIlKJX3lW4uKFnXrqxs3goOGkUAemBZ9FidnPk4MIXdZeYHMHRbAx9tApAZFkoFFgRHrPvnETs5N/1yncveHdk2tGf7Oh235I01tv7rM+i7F6KasqhYFGqTYAwqMH0vcqrPr12gFQSG4LR9kHQEVfCRuAu2g6UwlANUyVN6Q5uSVc2WWdaEfr0RtboFVrdBcwes2Uhw4WFw9C5GlQNdn+e132135Nzfi6iZfHRUxo8kATRIg54OoKYGV699ZtCNeumP5+rmcztKJXQ28O1M0pJ3Ntr87F7sO+ejNuYhEYHaBAQCftA5k3sJ40B/gk+3uyLg2Og75mP23g7KBvXSanhrIyxdr9VbG1ArN6DWZ9HZAlbJR1WWDbE1ojVqYB3mnCMwxcDE4km9k19zo1LKmyiz7DmKj8T6Dx9BITBc66cGDnD4hn+dtcg0X9XoeIODDXljZZJQ8rX+2xzUdbNgbRsqEQPHCmd8Fdeq8w99EUDf0H0oBJRCch5SEwnL35hHlT1AobRGHAscC2WpCqEREo5W0JIjOGsi5prTJWhvU0OtVMfN6aNGHZnZbiMiHykt4KPDAUQUTLNmqqn+39YuGPU76/VfP221nNzRkUWjAzUwacnjr6F/9hB6/ltQZfVBuL5vSsnbMsZ9CAJGUAkHVQiQvA9RBxJupWQBA4ggRlBIVW8ImXsignzhE0i5EFjJmF2b5bojM9tt3PGN30beVKr0rsbnfYI+/d4fNDRIg4ZpSqvp/iUts076sbvwhUV228m5xtbAiseFjoJlfe027M/9CWvRSqhNoRyN8sNZvwny36v5ZQQsULYKNYigIlcE0kOSrKA+VC87SshRY5E9hkOuqHVgJJ2uSTzZ/kb9mztfVkJQYX8/GvChLwFVlh/D4vDGu66a57Ze3phtQRsC0mmLexZgTbsLvXwjZLqMNpuFd9WrXkuA9PqtF9eWTb4QGo5a85gzD8S/4axQKC36YtVnVH2Jd3aza3/6yOMn3aCmqiCUBSZ/6LLAh0oAE2fNsudMnuzPWL94yDT94g3Lk95x+TUtgZ1KaNORV9aPH0DdNBdsGxV3QsOMIhS4+oKt7E0PUaHfh3r9qrq/2QeTka5PsRTmgklw+gHIiHpMW0cg2ljxmgxDcjx9hD/ooj+PPO5lQs4nH6ZM8KERQNUa9sN3Ht3zL9Y7d66Jm92Cja2erk878vwKrK/egbV4JZJOojDhmktV3tqSHtc/bG6kexS1BSrplwAgXB46CsjgDP6XJ8AXJ6JTWoL2fEBNzK4N7Pw4u/7Spwed9tcyFa1HTf9QVMMPhQD2feF6Z/5+53tfanxw4mx7w/1vl9uSusP3ZWDcVv94Guvyu1FFg0pFwa9yybCp7ycB9Ib+it4s8qtgayj6UCgguw5HvnMcwXF7oLLFIBBjpQcNYOecc/vz/qRz1PDh+Q+LCD5wAqiufUe/ffukBcnC/Y3FbMIKCEzCtfTP7sP69WMQj0JFyOtUsbq1WL1LAng3fLZ38X2W0d9NpUK3cr6M+AH+5Line truncated
`)){const f=c.indexOf("=");if(f<=0)continue;const h=c.slice(0,f).trim();h&&(l[h]=c.slice(f+1).trim(),s++)}return s?l:void 0}const Ym=o=>o&&typeof o=="object"?Object.entries(o).map(([l,s])=>`${l}=${String(s)}`).join(`
`):"";function Gm(o){const l={};for(const s of o){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;l[c]={command:s.command.trim(),args:f,env:sf(s.kv)}}else{if(!s.url.trim())continue;l[c]={url:s.url.trim(),headers:sf(s.kv)}}}return l}function qm(o){return Object.entries(o).map(([l,s])=>{const c=s??{},f=typeof c.command=="string"&&c.command!=="";return{name:l,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:Ym(f?c.env:c.headers)}})}const Fr={background:"var(--card)",border:"1px solid var(--cardBd)",borderRadius:11,padding:16,boxShadow:"var(--cardSh)"},Xm={fontSize:11,fontWeight:700,letterSpacing:.5,color:"var(--t4)"},An={width:"100%",height:30,border:"1px solid rgba(30,40,35,.13)",borderRadius:7,background:"#fdfdfc",color:"var(--t1)",padding:"0 10px",fontSize:12,fontFamily:Wt,outline:"none",minWidth:0},af={width:"100%",height:30,border:"1px solid rgba(30,40,35,.13)",borderRadius:7,background:"#fdfdfc",color:"var(--t1)",padding:"0 6px",fontSize:12,outline:"none",cursor:"pointer"},Mf={height:28,border:"1px solid rgba(30,40,35,.15)",background:"var(--card)",color:"var(--t1)",borderRadius:8,padding:"0 13px",fontSize:12,fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",gap:5,boxShadow:"var(--cardSh)",whiteSpace:"nowrap"};function an({label:o,children:l}){return u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,flex:1,minWidth:0},children:[u.jsx("span",{style:{fontSize:11.5,color:"var(--t3)",fontWeight:600},children:o}),l]})}function zo({label:o,action:l,children:s}){return u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:9},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[u.jsx("span",{style:Xm,children:o}),u.jsx("span",{style:{flex:1}}),l]}),s]})}function Zm({version:o,update:l,onUpdateStatus:s}){const[c,f]=B.useState("idle"),[h,y]=B.useState(null),m=!!(l!=null&&l.available),S=async()=>{f("checking"),y(null);try{const V=await cf();s(V),V.available||y({text:"已是最新版本",color:"var(--ok)"})}catch(V){y({text:V instanceof Error?V.message:String(V),color:"var(--err)"})}finally{f("idle")}},w=async()=>{f("installing"),y(null);try{await Yh()}catch(V){y({text:V instanceof Error?V.message:String(V),color:"var(--err)"}),f("idle")}},C=c!=="idle",O=c==="checking"?"检查中":c==="installing"?"更新中":m?"下载更新":"检查更新",N=m&&c!=="checking";return u.jsxs("div",{style:{...Fr,padding:"14px 16px",display:"flex",alignItems:"center",gap:12},children:[u.jsx("div",{style:{width:34,height:34,borderRadius:9,background:"var(--accBg)",display:"flex",alignItems:"center",justifyContent:"center",flex:"none"},children:u.jsx("img",{src:Bo,alt:"",draggable:!1,style:{width:22,height:22,borderRadius:5}})}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:1,minWidth:0},children:[u.jsx("span",{style:{fontWeight:700,fontSize:13},children:"MonkeyCode"}),u.jsx("span",{style:{fontSize:11.5,color:"var(--t5)",fontFamily:Wt,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m?`${(l==null?void 0:l.current)??o} → ${l==null?void 0:l.latest} 可用`:o})]}),u.jsx("span",{style:{flex:1}}),h&&u.jsx("span",{style:{fontSize:12,color:h.color,flex:"none"},children:h.text}),u.jsxs("button",{className:N?"hv-acc":"hv",onClick:()=>!C&&void(N?w():S()),style:{...Mf,gap:6,flex:"none",...N?{background:"var(--acc)",borderColor:"var(--acc)",color:"var(--onAcc)"}:{},opacity:C?.7:1,cursor:C?"default":"pointer"},children:[C&&u.jsx("span",{style:{width:11,height:11,border:`1.5px solid ${N?"var(--onAcc)":"var(--t1)"}`,borderTopColor:"transparent",borderRadius:"50%",animation:"mcspin .9s linear infinite",display:"inline-block"}}),O]})]})}const uf=()=>({name:"",provider:"anthropic",base_url:"",api_key:"",model:""}),Km=()=>({name:"",type:"http",url:"",command:"",args:"",kv:""});function Jm({onClose:o,hostVersion:l,update:s,onUpdateStatus:c}){const f=wl(),[h,y]=B.useState([]),[m,S]=B.useState(0),[w,C]=B.useState({}),[O,N]=B.useState([]),[V,Q]=B.useState(!1),[J,$]=B.useState(""),[he,xe]=B.useState(!1);B.useEffect(()=>{f&&_h().then(z=>{const W=(z==null?void 0:z.models)??[];y(W.length?W:[uf()]),S(Math.max(0,W.findIndex(te=>te.default))),N(qm((z==null?void 0:z.mcp_servers)??{})),Q(!0)}).catch(z=>$("读取配置失败: "+(z instanceof Error?z.message:String(z))))},[f]);const ge=(z,W)=>y(te=>te.map((we,Ie)=>Ie===z?{...we,...W}:we)),re=(z,W)=>N(te=>te.map((we,Ie)=>Ie===z?{...we,...W}:we)),q=async()=>{for(const W of h)if(!W.name.trim()||!W.base_url.trim()||!W.api_key.trim()||!W.model.trim()){$(`模型「${W.name.trim()||"未命名"}」信息不完整(需名称/接口地址/API Key/模型标识)`);return}const z=new Set;for(const W of h){if(z.has(W.name.trim())){$(`模型名称重复: ${W.name.trim()}`);return}z.add(W.name.trim())}$(""),xe(!0);try{await Oh({moLine truncated
`);if(!(!b||!pe.current)){if(y.running){q(b),ge(""),yt([]);return}pe.current.send("user-input",{content:mi(b)})&&(ge(""),yt([]))}},jt=(I,b)=>{var be;const le=b!=="deny";(be=pe.current)!=null&&be.send("permission-resp",{id:I,approved:le,remember:b==="always"||b==="persist",persist:b==="persist"})&&m(Ze=>Tm(Ze,I,le))},Kt=async I=>{if(!(!pe.current||!I||I===we))try{const b=await pe.current.call("session_set_model",{model:I});if(b.error){w("⚠ 切换模型失败: "+b.error);return}Ie(I),je()}catch(b){w("⚠ 切换模型失败: "+(b instanceof Error?b.message:b))}},Dn=async()=>{if(!pe.current)return;const I=Xe,b=I?"default":"yolo";Oe(!I);try{const le=await pe.current.call("session_set_mode",{mode:b});le.error&&(Oe(I),w("⚠ 切换权限模式失败: "+le.error))}catch(le){Oe(I),w("⚠ 切换权限模式失败: "+(le instanceof Error?le.message:le))}},wn=async I=>{var b;he({path:I,text:"加载中…"});try{const le=await pe.current.call("repo_file_diff",{path:I});he({path:I,text:le.error?"✗ "+le.error:((b=le.result)==null?void 0:b.diff)||"(无差异)"})}catch(le){he({path:I,text:"✗ "+(le instanceof Error?le.message:le)})}},kn=()=>{J(!0),Xt().then(I=>{I.length?wn(I[0].path):he(null)})},qn=async(I=!1)=>{const b=U.trim();if(!(!b||ye)){H(!0),ve(""),Ee(!1);try{const le=await zh(b,Y,I||b===ba),be=A.trim();be&&(Te.current=be),fe(""),await je(),yn(le.id,le.model,le.mode)}catch(le){const be=le instanceof Error?le.message:String(le);ve("创建失败: "+be),be.includes("目录不存在")&&Ee(!0)}finally{H(!1)}}},at=o.find(I=>I.id===s),Jt=we||((Tn=W.find(I=>I.default))==null?void 0:Tn.name)||"",Xn=we&&!W.some(I=>I.name===we)?[...W,{name:we,default:!1}]:W,Sn=[...y.items].reverse().find(I=>I.kind==="perm"&&I.state==="open"),Zn=f==="new"||s===null,Hr=(()=>{const I=Of(o.filter(b=>!b.archived)).map(b=>b.dir);return I.includes(U)||I.unshift(U),I.slice(0,6)})();return B.useEffect(()=>{const I=b=>{if(b.key==="Tab"&&b.shiftKey&&f==="session"&&s){b.preventDefault(),Dn();return}if(b.key==="Escape"){if(oe)return z(null);if(Q)return J(!1);if(f==="settings")return h(s?"session":"new");Sn&&jt(Sn.id,"deny");return}if(b.key==="Enter"&&!b.isComposing&&Sn&&!Zn){const le=b.target;if(le&&(le.tagName==="TEXTAREA"||le.tagName==="INPUT")&&xe.trim())return;b.preventDefault(),jt(Sn.id,"allow")}};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",background:"var(--bg)",color:"var(--t1)",fontSize:13,overflow:"hidden"},children:[Fh()&&u.jsx($m,{}),u.jsxs("div",{style:{flex:1,display:"flex",minHeight:0,position:"relative"},children:[u.jsx(Qm,{sessions:o,currentId:s,sessionActive:f==="session",connected:xn,status:S,settingsActive:f==="settings",updateAvailable:!!(Fe!=null&&Fe.available),onSelect:I=>yn(I.id,I.model,I.mode),onNewTask:I=>{I&&(qt.current=!0,ie(I)),ve(""),Ee(!1),h("new")},onOpenSettings:()=>h("settings"),onArchive:I=>void De(I),onDelete:I=>void un(I)}),u.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0,minHeight:0},children:f==="settings"?u.jsx(Jm,{onClose:()=>h(s?"session":"new"),hostVersion:$e,update:Fe,onUpdateStatus:ze}):Zn?u.jsx(Hm,{dir:U,recentDirs:Hr,text:A,models:W,model:Y,busy:ye,err:me,offerCreate:ke,onDirChange:I=>{qt.current=!0,ie(I),ve(""),Ee(!1)},onTextChange:fe,onModelChange:x,onCreate:I=>void qn(I)}):u.jsx(Um,{meta:at,chat:y,changesCount:(C==null?void 0:C.length)??0,input:xe,setInput:ge,queued:re,models:Xn,currentModel:Jt,yolo:Xe,atts:Zt,onAddImages:I=>void Gn(I),onRemoveAtt:I=>yt(b=>b.filter((le,be)=>be!==I)),uploadUrl:s?I=>Dh(s,I):void 0,onSend:Ut,onStop:()=>{var I;return(I=pe.current)==null?void 0:I.send("user-cancel",{})},onClearQueued:()=>q(null),onToggleYolo:()=>void Dn(),onSwitchModel:I=>void Kt(I),onOpenDrawer:kn,onPermAnswer:jt,onOpenChild:z,onArchive:()=>at&&void De(at),onDelete:()=>at&&void un(at)})}),Q&&u.jsxs(u.Fragment,{children:[u.jsx("div",{onClick:()=>J(!1),style:{position:"absolute",inset:0,background:"rgba(20,30,25,.25)",zIndex:35}}),u.jsxs("div",{style:{position:"absolute",top:0,right:0,bottom:0,width:600,maxWidth:"80vw",background:"var(--pop)",borderLeft:"1px solid var(--line)",boxShadow:"var(--shadow)",zIndex:36,display:"flex",flexDirection:"column",animation:"mcslide .22s ease"},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"16px 20px 12px",flex:"none",whiteSpace:"nowrap"},children:[u.jsxs("span",{style:{fontSize:13.5,fontWeight:700},children:["改动",C&&C.length>0?` · ${C.length} 个文件`:""]}),u.jsx("button",{className:"hv2",onClick:()=>J(!1),style:{marginLeft:"auto",width:24,height:24,border:"none",background:"transparent",cursor:"pointer",padding:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:6},children:u.jsx(Mo,{size:11,color:"var(--t4)"})})]}),N&&u.jsx("div",{style:{padding:"10px 20px",fontSize:12,color:"var(--err)"},children:N}),C&&C.length===0&&!N&&u.jsx("div",{style:{padding:Line truncated
<style rel="stylesheet" crossorigin>:root{--bg: #fcfdfc;--side: #eef1ee;--line: rgba(30, 40, 35, .12);--line2: rgba(30, 40, 35, .08);--t1: #1d221f;--t2: #2a302b;--t3: #59605a;--t4: #7b827c;--t5: #8a918b;--t6: #a8afa9;--acc: #1f8a5b;--accH: #25a06b;--accBg: rgba(31, 138, 91, .12);--accBd: rgba(31, 138, 91, .2);--onAcc: #fff;--ok: #28a866;--err: #c2503e;--errBg: rgba(194, 80, 62, .09);--warn: #a16207;--warnBg: rgba(232, 193, 90, .14);--warnBd: rgba(161, 98, 7, .35);--card: #ffffff;--cardBd: rgba(30, 40, 35, .1);--cardSh: 0 1px 2px rgba(0, 0, 0, .04);--hov: rgba(120, 130, 125, .12);--hov2: rgba(120, 130, 125, .18);--hov3: rgba(120, 130, 125, .25);--pop: #fcfdfd;--shadow: 0 8px 28px rgba(30, 45, 38, .2);--codeBg: rgba(30, 40, 35, .05);--userBg: #e9f2ec;--addBg: rgba(40, 168, 102, .08);--addT: #1c7a4b;--delBg: rgba(194, 80, 62, .08);--delT: #a63d2e}*{box-sizing:border-box}html,body,#root{height:100%}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,SF Pro Text,PingFang SC,Microsoft YaHei,Helvetica Neue,sans-serif;background:var(--bg);color:var(--t1);font-size:13px;overflow:hidden}a{color:var(--acc);text-decoration:none}a:hover{color:#166b46;text-decoration:underline}input,textarea,select,button{font-family:inherit}textarea::placeholder,input::placeholder{color:var(--t6)}@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:#6e787338;border-radius:6px;border:2px solid transparent;background-clip:content-box}::-webkit-scrollbar-thumb:hover{background:#6e787361;background-clip:content-box}*{scrollbar-width:thin;scrollbar-color:rgba(110,120,115,.22) transparent}.hv:hover{background:var(--hov)!important}.hv2:hover{background:var(--hov2)!important}.hv3:hover{background:var(--hov3)!important}.hv-t1:hover{color:var(--t1)!important}.hv-err:hover{color:var(--err)!important}.hv-errbg:hover{background:var(--errBg)!important}.hv-op:hover{filter:brightness(.97)}.hv-acc:hover{background:var(--accH)!important}.hv-accbg:hover{background:#1f8a5b12!important}.hv-bd:hover{border-color:var(--acc)!important}.hv-caption-close:hover{background:#e81123!important;color:#fff!important}.md{font-size:13.5px;line-height:1.8;color:var(--t2)}.md>:first-child{margin-top:0}.md>:last-child{margin-bottom:0}.md ul,.md ol{margin:0 0 10px;padding-left:20px;display:flex;flex-direction:column;gap:4px}.md p{margin:0 0 10px}.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(--codeBg);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>
<div id="root"></div>
+2 -1
View File
@@ -7,6 +7,8 @@ require (
github.com/coder/websocket v1.8.15
github.com/modelcontextprotocol/go-sdk v1.6.1
github.com/spf13/cobra v1.10.2
golang.org/x/image v0.44.0
golang.org/x/term v0.45.0
)
require (
@@ -18,5 +20,4 @@ require (
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
golang.org/x/oauth2 v0.35.0 // indirect
golang.org/x/sys v0.47.0 // indirect
golang.org/x/term v0.45.0 // indirect
)
+2 -2
View File
@@ -25,10 +25,10 @@ github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4=
github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/image v0.44.0 h1:+tDekMZED9+LrtB3G5xzRggpVh9CARjZqROla3R3R+I=
golang.org/x/image v0.44.0/go.mod h1:V8K3KE9KKKE+pLpQDOeN18w9oacNSvy1tDOirTu4xtY=
golang.org/x/oauth2 v0.35.0 h1:Mv2mzuHuZuY2+bkyWXIHMfhNdJAdwW3FuWeCPYN5GVQ=
golang.org/x/oauth2 v0.35.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0=
+18 -1
View File
@@ -82,7 +82,24 @@ func renderTranscript(msgs []provider.Message) string {
if blk.IsError {
status = "(失败)"
}
fmt.Fprintf(&b, "[工具结果%s] %s\n", status, clip(blk.Content, 600))
content := blk.Content
// 富内容结果:文本部分照录,图片以占位符入摘要(不可静默丢弃,
// 否则压缩后模型不知道曾看过图;文件路径仍在文本里,可重新读)
if len(blk.Blocks) > 0 {
var parts []string
for _, ib := range blk.Blocks {
switch ib.Type {
case provider.BlockText:
parts = append(parts, ib.Text)
case provider.BlockImage:
parts = append(parts, "[图片]")
}
}
content = strings.Join(parts, " ")
}
fmt.Fprintf(&b, "[工具结果%s] %s\n", status, clip(content, 600))
case provider.BlockImage:
b.WriteString("[图片]\n")
}
// thinking 块不进摘要
}
+19
View File
@@ -302,6 +302,25 @@ func (e *Engine) execToolUse(ctx context.Context, tu provider.ContentBlock) prov
},
}
// 富内容工具(BlocksTool,如 read_file 读图)结果为块列表;单文本块压平回
// 普通字符串结果,保持历史形状简单
if bt, ok := tool.(tools.BlocksTool); ok {
blocks, display, err := bt.ExecuteBlocks(ctx, env, tu.Input)
if err != nil {
if ctx.Err() != nil {
finish("failed", "已中断")
return result("工具执行被中断", true)
}
finish("failed", err.Error())
return result(err.Error(), true)
}
finish("completed", display)
if len(blocks) == 1 && blocks[0].Type == provider.BlockText {
return result(blocks[0].Text, false)
}
return provider.ContentBlock{Type: provider.BlockToolResult, ToolUseID: tu.ID, Blocks: blocks}
}
out, err := tool.Execute(ctx, env, tu.Input)
if err != nil {
if ctx.Err() != nil {
+58 -7
View File
@@ -38,12 +38,63 @@ func NewAnthropic(baseURL, apiKey, model string) *AnthropicClient {
func (c *AnthropicClient) Model() string { return c.model }
type anthropicReq struct {
Model string `json:"model"`
MaxTokens int `json:"max_tokens"`
System string `json:"system,omitempty"`
Messages []Message `json:"messages"`
Tools []ToolDef `json:"tools,omitempty"`
Stream bool `json:"stream"`
Model string `json:"model"`
MaxTokens int `json:"max_tokens"`
System string `json:"system,omitempty"`
Messages []awMessage `json:"messages"`
Tools []ToolDef `json:"tools,omitempty"`
Stream bool `json:"stream"`
}
// awBlock Anthropic 线上内容块。与内部 ContentBlock 的差异:tool_result 的
// content 在线上可为字符串或块数组(富内容结果,如图片),内部模型用
// Content/Blocks 两个字段表达,发送前在此归一。
type awBlock struct {
Type BlockType `json:"type"`
Text string `json:"text,omitempty"`
Thinking string `json:"thinking,omitempty"`
Signature string `json:"signature,omitempty"`
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Input json.RawMessage `json:"input,omitempty"`
ToolUseID string `json:"tool_use_id,omitempty"`
Content any `json:"content,omitempty"`
IsError bool `json:"is_error,omitempty"`
Source *ImageSource `json:"source,omitempty"`
}
type awMessage struct {
Role Role `json:"role"`
Content []awBlock `json:"content"`
}
func toAnthropicWire(msgs []Message) []awMessage {
out := make([]awMessage, len(msgs))
for i, m := range msgs {
blocks := make([]awBlock, len(m.Content))
for j, b := range m.Content {
w := awBlock{
Type: b.Type, Text: b.Text,
Thinking: b.Thinking, Signature: b.Signature,
ID: b.ID, Name: b.Name, Input: b.Input,
ToolUseID: b.ToolUseID, IsError: b.IsError, Source: b.Source,
}
if b.Type == BlockToolResult {
if len(b.Blocks) > 0 {
inner := make([]awBlock, len(b.Blocks))
for k, ib := range b.Blocks {
inner[k] = awBlock{Type: ib.Type, Text: ib.Text, Source: ib.Source}
}
w.Content = inner
} else if b.Content != "" {
w.Content = b.Content
}
}
blocks[j] = w
}
out[i] = awMessage{Role: m.Role, Content: blocks}
}
return out
}
// HTTPError 非 2xx 响应。
@@ -78,7 +129,7 @@ func (c *AnthropicClient) Stream(ctx context.Context, req Request, h *StreamHand
Model: c.model,
MaxTokens: maxTokens,
System: req.System,
Messages: req.Messages,
Messages: toAnthropicWire(req.Messages),
Tools: req.Tools,
Stream: true,
})
+103
View File
@@ -0,0 +1,103 @@
package provider
import (
"encoding/json"
"strings"
"testing"
)
func imageToolResultMsg() Message {
return Message{Role: RoleUser, Content: []ContentBlock{
{Type: BlockToolResult, ToolUseID: "t1", Blocks: []ContentBlock{
{Type: BlockImage, Source: &ImageSource{Type: "base64", MediaType: "image/png", Data: "AAAA"}},
{Type: BlockText, Text: "图片 a.png(10×10)"},
}},
}}
}
// ==================== Anthropic:tool_result 富内容转 content 块数组 ====================
func TestAnthropicWire_ImageToolResult(t *testing.T) {
wire := toAnthropicWire([]Message{imageToolResultMsg()})
data, err := json.Marshal(wire)
if err != nil {
t.Fatal(err)
}
s := string(data)
for _, want := range []string{
`"type":"tool_result"`, `"tool_use_id":"t1"`,
`"type":"image"`, `"media_type":"image/png"`, `"data":"AAAA"`,
`"type":"text"`,
} {
if !strings.Contains(s, want) {
t.Fatalf("线上载荷缺少 %s: %s", want, s)
}
}
if strings.Contains(s, `"blocks"`) {
t.Fatalf("内部 blocks 字段不应出现在线上载荷: %s", s)
}
}
// 纯文本 tool_result 保持字符串 content(回归)
func TestAnthropicWire_PlainToolResult(t *testing.T) {
wire := toAnthropicWire([]Message{{Role: RoleUser, Content: []ContentBlock{
{Type: BlockToolResult, ToolUseID: "t1", Content: "ok"},
}}})
data, _ := json.Marshal(wire)
if !strings.Contains(string(data), `"content":"ok"`) {
t.Fatalf("纯文本结果应保持字符串 content: %s", data)
}
}
// ==================== OpenAI Chat:占位文本 + 合成 user 图片消息 ====================
func TestOpenAIConvert_ImageToolResult(t *testing.T) {
out := convertMessages("", []Message{imageToolResultMsg()})
if len(out) != 2 {
t.Fatalf("应产出 tool + 合成 user 两条消息,实际 %d 条: %+v", len(out), out)
}
if out[0].Role != "tool" || out[0].ToolCallID != "t1" {
t.Fatalf("第一条应为 tool 消息: %+v", out[0])
}
toolText, _ := out[0].Content.(string)
if !strings.Contains(toolText, "图片内容见下一条消息") {
t.Fatalf("tool 消息应含占位说明: %q", toolText)
}
if out[1].Role != "user" {
t.Fatalf("第二条应为合成 user 消息: %+v", out[1])
}
parts, ok := out[1].Content.([]oaiPart)
if !ok {
t.Fatalf("合成消息 content 应为 parts 数组: %T", out[1].Content)
}
var hasImage bool
for _, p := range parts {
if p.Type == "image_url" && p.ImageURL != nil && strings.HasPrefix(p.ImageURL.URL, "data:image/png;base64,") {
hasImage = true
}
}
if !hasImage {
t.Fatalf("合成消息缺少 image_url 分片: %+v", parts)
}
}
// ==================== OpenAI Responses:function_call_output + input_image ====================
func TestResponsesConvert_ImageToolResult(t *testing.T) {
out := convertResponsesInput([]Message{imageToolResultMsg()})
if len(out) != 2 {
t.Fatalf("应产出 function_call_output + 合成 user 两项,实际 %d: %+v", len(out), out)
}
if out[0].Type != "function_call_output" || !strings.Contains(out[0].Output, "图片内容见下一条消息") {
t.Fatalf("第一项应为带占位说明的 function_call_output: %+v", out[0])
}
var hasImage bool
for _, c := range out[1].Content {
if c.Type == "input_image" && strings.HasPrefix(c.ImageURL, "data:image/png;base64,") {
hasImage = true
}
}
if out[1].Role != "user" || !hasImage {
t.Fatalf("第二项应为携带 input_image 的 user 消息: %+v", out[1])
}
}
+83 -6
View File
@@ -38,12 +38,31 @@ func NewOpenAI(baseURL, apiKey, model string) *OpenAIClient {
func (c *OpenAIClient) Model() string { return c.model }
type oaiMessage struct {
// Content 通常为 string;带图片的 user 消息为 []oaiPart(多模态 parts 数组)
Role string `json:"role"`
Content string `json:"content,omitempty"`
Content any `json:"content,omitempty"`
ToolCalls []oaiToolCall `json:"tool_calls,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
}
// oaiPart 多模态内容分片(user 消息携带图片时使用)。
type oaiPart struct {
Type string `json:"type"` // text | image_url
Text string `json:"text,omitempty"`
ImageURL *struct {
URL string `json:"url"`
} `json:"image_url,omitempty"`
}
func oaiImagePart(src *ImageSource) oaiPart {
return oaiPart{
Type: "image_url",
ImageURL: &struct {
URL string `json:"url"`
}{URL: "data:" + src.MediaType + ";base64," + src.Data},
}
}
type oaiToolCall struct {
Index *int `json:"index,omitempty"`
ID string `json:"id,omitempty"`
@@ -84,10 +103,11 @@ func convertMessages(system string, msgs []Message) []oaiMessage {
switch m.Role {
case RoleAssistant:
om := oaiMessage{Role: "assistant"}
var text string
for _, b := range m.Content {
switch b.Type {
case BlockText:
om.Content += b.Text
text += b.Text
case BlockToolUse:
tc := oaiToolCall{ID: b.ID, Type: "function"}
tc.Function.Name = b.Name
@@ -97,6 +117,9 @@ func convertMessages(system string, msgs []Message) []oaiMessage {
// OpenAI 协议不回传推理内容
}
}
if text != "" {
om.Content = text
}
out = append(out, om)
case RoleUser:
var texts []string
@@ -104,15 +127,45 @@ func convertMessages(system string, msgs []Message) []oaiMessage {
switch b.Type {
case BlockText:
texts = append(texts, b.Text)
case BlockImage:
// 顶层图片块(合成消息等):转 parts 数组,与文本一起发
// 实际组装在下方统一处理,这里先收集
case BlockToolResult:
content := b.Content
text, images := flattenToolResult(b)
if b.IsError {
content = "[错误] " + content
text = "[错误] " + text
}
out = append(out, oaiMessage{Role: "tool", ToolCallID: b.ToolUseID, Content: text})
// OpenAI 协议的 tool 消息不支持图片:紧跟一条合成 user
// 消息携带图片,模型实际可见,效果对齐 Anthropic 的
// tool_result 图片块
if len(images) > 0 {
parts := []oaiPart{{Type: "text", Text: "以下是上一条工具结果中的图片:"}}
for _, src := range images {
parts = append(parts, oaiImagePart(src))
}
out = append(out, oaiMessage{Role: "user", Content: parts})
}
out = append(out, oaiMessage{Role: "tool", ToolCallID: b.ToolUseID, Content: content})
}
}
if len(texts) > 0 {
// 用户消息本体:纯文本为 string;携带顶层图片块时转 parts 数组
var images []*ImageSource
for _, b := range m.Content {
if b.Type == BlockImage && b.Source != nil {
images = append(images, b.Source)
}
}
switch {
case len(images) > 0:
var parts []oaiPart
if len(texts) > 0 {
parts = append(parts, oaiPart{Type: "text", Text: strings.Join(texts, "\n")})
}
for _, src := range images {
parts = append(parts, oaiImagePart(src))
}
out = append(out, oaiMessage{Role: "user", Content: parts})
case len(texts) > 0:
out = append(out, oaiMessage{Role: "user", Content: strings.Join(texts, "\n")})
}
}
@@ -120,6 +173,30 @@ func convertMessages(system string, msgs []Message) []oaiMessage {
return out
}
// flattenToolResult 拆解工具结果:文本部分(纯 Content 或 Blocks 里的 text 块)
// 与图片块分离,供不支持富工具结果的协议(OpenAI 系)降级处理。
func flattenToolResult(b ContentBlock) (string, []*ImageSource) {
if len(b.Blocks) == 0 {
return b.Content, nil
}
var texts []string
var images []*ImageSource
for _, ib := range b.Blocks {
switch ib.Type {
case BlockText:
texts = append(texts, ib.Text)
case BlockImage:
if ib.Source != nil {
images = append(images, ib.Source)
}
}
}
if len(images) > 0 {
texts = append(texts, "(图片内容见下一条消息)")
}
return strings.Join(texts, "\n"), images
}
// Stream 实现 Provider。
func (c *OpenAIClient) Stream(ctx context.Context, req Request, h *StreamHandler) (*Result, error) {
oreq := oaiReq{
+32 -8
View File
@@ -40,8 +40,10 @@ func (c *OpenAIResponsesClient) Model() string { return c.model }
// respContent message 项内的内容块。
type respContent struct {
Type string `json:"type"` // input_text | output_text
Text string `json:"text"`
Type string `json:"type"` // input_text | output_text | input_image
Text string `json:"text,omitempty"` // input_text / output_text
// input_image(data URL)
ImageURL string `json:"image_url,omitempty"`
}
// respItem Responses input/output 的一项。
@@ -104,23 +106,45 @@ func convertResponsesInput(msgs []Message) []respItem {
}
case RoleUser:
var texts []string
var images []*ImageSource
for _, b := range m.Content {
switch b.Type {
case BlockText:
texts = append(texts, b.Text)
case BlockImage:
if b.Source != nil {
images = append(images, b.Source)
}
case BlockToolResult:
content := b.Content
content, imgs := flattenToolResult(b)
if b.IsError {
content = "[错误] " + content
}
out = append(out, respItem{Type: "function_call_output", CallID: b.ToolUseID, Output: content})
// Responses 的 function_call_output 只收字符串:图片经合成
// user 消息补发,模型实际可见(对齐 Anthropic 行为)
if len(imgs) > 0 {
content := []respContent{{Type: "input_text", Text: "以下是上一条工具结果中的图片:"}}
for _, src := range imgs {
content = append(content, respContent{
Type: "input_image", ImageURL: "data:" + src.MediaType + ";base64," + src.Data,
})
}
out = append(out, respItem{Type: "message", Role: "user", Content: content})
}
}
}
if len(texts) > 0 {
out = append(out, respItem{
Type: "message", Role: "user",
Content: []respContent{{Type: "input_text", Text: strings.Join(texts, "\n")}},
})
if len(texts) > 0 || len(images) > 0 {
content := []respContent{}
if len(texts) > 0 {
content = append(content, respContent{Type: "input_text", Text: strings.Join(texts, "\n")})
}
for _, src := range images {
content = append(content, respContent{
Type: "input_image", ImageURL: "data:" + src.MediaType + ";base64," + src.Data,
})
}
out = append(out, respItem{Type: "message", Role: "user", Content: content})
}
}
}
+16 -1
View File
@@ -22,8 +22,16 @@ const (
BlockThinking BlockType = "thinking"
BlockToolUse BlockType = "tool_use"
BlockToolResult BlockType = "tool_result"
BlockImage BlockType = "image"
)
// ImageSource 图片数据(形状对齐 Anthropic 的 source 对象)。
type ImageSource struct {
Type string `json:"type"` // 固定 base64
MediaType string `json:"media_type"` // image/png 等
Data string `json:"data"` // base64 编码的图片字节
}
// ContentBlock 消息内容块。
type ContentBlock struct {
Type BlockType `json:"type"`
@@ -43,7 +51,14 @@ type ContentBlock struct {
// tool_result
ToolUseID string `json:"tool_use_id,omitempty"`
Content string `json:"content,omitempty"`
IsError bool `json:"is_error,omitempty"`
// Blocks 富内容工具结果(如 read_file 读图):非空时 Content 忽略,
// 序列化交由各 provider 客户端(Anthropic 转 content 块数组;OpenAI 系
// 协议的工具结果不支持图片,转为占位文本 + 合成 user 图片消息)。
Blocks []ContentBlock `json:"blocks,omitempty"`
IsError bool `json:"is_error,omitempty"`
// image(source 对齐 Anthropic base64 形状)
Source *ImageSource `json:"source,omitempty"`
}
// Message 一条对话消息。
+92
View File
@@ -20,10 +20,12 @@ import (
"context"
"crypto/rand"
"crypto/subtle"
"encoding/base64"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"io"
"log/slog"
"net"
"net/http"
@@ -141,6 +143,8 @@ func (s *Server) Handler() http.Handler {
mux.HandleFunc("DELETE /api/sessions/{id}", s.auth(s.handleDeleteSession))
mux.HandleFunc("PATCH /api/sessions/{id}", s.auth(s.handlePatchSession))
mux.HandleFunc("GET /api/models", s.auth(s.handleListModels))
mux.HandleFunc("POST /api/sessions/{id}/uploads", s.auth(s.handleUpload))
mux.HandleFunc("GET /api/sessions/{id}/uploads/{name}", s.auth(s.handleGetUpload))
mux.HandleFunc("GET /ws", s.auth(s.handleWS))
if s.opts.UI != nil {
mux.HandleFunc("GET /", func(w http.ResponseWriter, r *http.Request) {
@@ -450,6 +454,94 @@ func (s *Server) handlePatchSession(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, meta)
}
// ==================== 图片上传(对话粘贴/拖拽) ====================
// uploadExts 允许上传的图片 MIME → 扩展名。
var uploadExts = map[string]string{
"image/png": ".png",
"image/jpeg": ".jpg",
"image/gif": ".gif",
"image/webp": ".webp",
}
const uploadMaxBytes = 20 * 1024 * 1024
// handleUpload 保存对话里粘贴/拖入的图片到工作区 .mc-agent/uploads/,返回
// 工作区相对路径。对话文本携带该路径,模型经 read_file 查看,或用工具按
// 路径处理(裁剪/移动/当测试素材等)。
func (s *Server) handleUpload(w http.ResponseWriter, r *http.Request) {
meta, err := session.ReadMeta(s.opts.SessionRoot, r.PathValue("id"))
if err != nil {
writeJSON(w, http.StatusNotFound, map[string]string{"error": "会话不存在"})
return
}
var req struct {
MediaType string `json:"media_type"`
Data string `json:"data"` // base64 图片字节
}
if err := json.NewDecoder(io.LimitReader(r.Body, uploadMaxBytes*2)).Decode(&req); err != nil {
writeJSON(w, http.StatusBadRequest, map[string]string{"error": "请求体解析失败: " + err.Error()})
return
}
ext, ok := uploadExts[req.MediaType]
if !ok {
writeJSON(w, http.StatusBadRequest, map[string]string{"error": "不支持的图片类型: " + req.MediaType})
return
}
raw, err := base64.StdEncoding.DecodeString(req.Data)
if err != nil || len(raw) == 0 {
writeJSON(w, http.StatusBadRequest, map[string]string{"error": "图片数据无效"})
return
}
if len(raw) > uploadMaxBytes {
writeJSON(w, http.StatusBadRequest, map[string]string{"error": fmt.Sprintf("图片过大(%d 字节,上限 %d)", len(raw), uploadMaxBytes)})
return
}
dir := filepath.Join(meta.Workdir, ".mc-agent", "uploads")
if err := os.MkdirAll(dir, 0o755); err != nil {
writeJSON(w, http.StatusInternalServerError, map[string]string{"error": "创建上传目录失败: " + err.Error()})
return
}
// uploads 不入库:目录内放自免疫的 .gitignore(仅首次创建)
gi := filepath.Join(dir, ".gitignore")
if _, err := os.Stat(gi); os.IsNotExist(err) {
_ = os.WriteFile(gi, []byte("*\n"), 0o644)
}
base := "img-" + time.Now().Format("20060102-150405")
name := base + ext
for i := 2; ; i++ {
if _, err := os.Stat(filepath.Join(dir, name)); os.IsNotExist(err) {
break
}
name = fmt.Sprintf("%s-%d%s", base, i, ext)
}
if err := os.WriteFile(filepath.Join(dir, name), raw, 0o644); err != nil {
writeJSON(w, http.StatusInternalServerError, map[string]string{"error": "写入图片失败: " + err.Error()})
return
}
writeJSON(w, http.StatusOK, map[string]string{
"path": ".mc-agent/uploads/" + name,
})
}
// handleGetUpload 回读已上传图片(UI 气泡缩略图用;<img> 无法带请求头,
// 鉴权走 ?token= 查询参数,s.auth 已支持)。
func (s *Server) handleGetUpload(w http.ResponseWriter, r *http.Request) {
name := r.PathValue("name")
if name == "" || strings.ContainsAny(name, "/\\") || strings.Contains(name, "..") {
writeJSON(w, http.StatusBadRequest, map[string]string{"error": "非法文件名"})
return
}
meta, err := session.ReadMeta(s.opts.SessionRoot, r.PathValue("id"))
if err != nil {
writeJSON(w, http.StatusNotFound, map[string]string{"error": "会话不存在"})
return
}
http.ServeFile(w, r, filepath.Join(meta.Workdir, ".mc-agent", "uploads", name))
}
// ==================== WS ====================
func (s *Server) handleWS(w http.ResponseWriter, r *http.Request) {
+126
View File
@@ -2,6 +2,7 @@ package server
import (
"context"
"encoding/base64"
"encoding/json"
"fmt"
"io"
@@ -1212,3 +1213,128 @@ func TestArchiveSession(t *testing.T) {
t.Fatalf("轮次收尾后归档标记应保留: %+v err=%v", meta, err)
}
}
// ==================== 图片上传(对话粘贴/拖拽) ====================
func TestUploadAndFetchImage(t *testing.T) {
_, ts := newTestServer(t, &stubProvider{})
workdir := t.TempDir()
id := createSession(t, ts, workdir)
// 1x1 PNG
pngB64 := "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="
resp, body := apiReq(t, ts, "POST", "/api/sessions/"+id+"/uploads", "test-token",
fmt.Sprintf(`{"media_type":"image/png","data":%q}`, pngB64))
if resp.StatusCode != http.StatusOK {
t.Fatalf("upload status = %d: %s", resp.StatusCode, body)
}
var up struct {
Path string `json:"path"`
}
if err := json.Unmarshal(body, &up); err != nil || !strings.HasPrefix(up.Path, ".mc-agent/uploads/img-") {
t.Fatalf("返回路径不对: %s", body)
}
// 文件落在工作区 + gitignore 自免疫
if _, err := os.Stat(filepath.Join(workdir, up.Path)); err != nil {
t.Fatalf("上传文件不存在: %v", err)
}
if _, err := os.Stat(filepath.Join(workdir, ".mc-agent", "uploads", ".gitignore")); err != nil {
t.Fatalf("uploads/.gitignore 缺失: %v", err)
}
// 回读(气泡缩略图路径)
name := strings.TrimPrefix(up.Path, ".mc-agent/uploads/")
resp, body = apiReq(t, ts, "GET", "/api/sessions/"+id+"/uploads/"+name, "test-token", "")
if resp.StatusCode != http.StatusOK || len(body) == 0 {
t.Fatalf("回读失败: %d", resp.StatusCode)
}
// 非法类型/文件名
resp, _ = apiReq(t, ts, "POST", "/api/sessions/"+id+"/uploads", "test-token",
`{"media_type":"application/pdf","data":"AAAA"}`)
if resp.StatusCode != http.StatusBadRequest {
t.Fatalf("非白名单类型应 400,实际 %d", resp.StatusCode)
}
resp, _ = apiReq(t, ts, "GET", "/api/sessions/"+id+"/uploads/..%2Fsecret", "test-token", "")
if resp.StatusCode == http.StatusOK {
t.Fatal("路径穿越应被拒绝")
}
}
// captureStub 记录每次请求的 provider stub(验证图片块进入下一次请求历史)。
type captureStub struct {
results []*provider.Result
idx int
mu sync.Mutex
reqs []provider.Request
}
func (s *captureStub) Model() string { return "stub" }
func (s *captureStub) Stream(_ context.Context, req provider.Request, _ *provider.StreamHandler) (*provider.Result, error) {
s.mu.Lock()
defer s.mu.Unlock()
s.reqs = append(s.reqs, req)
if s.idx >= len(s.results) {
return nil, fmt.Errorf("stub 脚本耗尽")
}
res := s.results[s.idx]
s.idx++
return res, nil
}
// TestReadImageToolResultReachesNextRequest read_file 读图后,图片块必须作为
// tool_result 富内容进入消息历史,并出现在下一次 LLM 请求里(模型真正"看到"图)。
func TestReadImageToolResultReachesNextRequest(t *testing.T) {
workdir := t.TempDir()
// 1x1 PNG
png, _ := base64.StdEncoding.DecodeString(
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==")
if err := os.WriteFile(filepath.Join(workdir, "shot.png"), png, 0o644); err != nil {
t.Fatal(err)
}
stub := &captureStub{results: []*provider.Result{
toolUseResult("read_file", `{"path":"shot.png"}`),
textResult("这张图是一个像素"),
}}
srv, err := New(Options{
Token: "test-token",
SessionRoot: t.TempDir(),
Model: "stub",
NewProvider: func(string) (provider.Provider, error) { return stub, nil },
AskTimeout: 5 * time.Second,
})
if err != nil {
t.Fatal(err)
}
ts := httptest.NewServer(srv.Handler())
t.Cleanup(ts.Close)
id := createSession(t, ts, workdir)
conn := dialWS(t, ts, id)
sendFrame(t, conn, frame.TypeUserInput, map[string][]byte{"content": []byte("看看 shot.png")})
wsCollect(t, conn, func(fs []frame.Frame) bool { return hasType(fs, frame.TypeTaskEnded) })
stub.mu.Lock()
defer stub.mu.Unlock()
if len(stub.reqs) != 2 {
t.Fatalf("应有两次 LLM 请求,实际 %d", len(stub.reqs))
}
var found bool
for _, m := range stub.reqs[1].Messages {
for _, b := range m.Content {
if b.Type != provider.BlockToolResult {
continue
}
for _, ib := range b.Blocks {
if ib.Type == provider.BlockImage && ib.Source != nil && ib.Source.MediaType == "image/png" && ib.Source.Data != "" {
found = true
}
}
}
}
if !found {
t.Fatalf("第二次请求的历史中缺少 tool_result 图片块: %+v", stub.reqs[1].Messages)
}
}
+142
View File
@@ -0,0 +1,142 @@
// 图片文件读取:read_file 的图片分支。解码 → 超限缩放 → 重编码为
// tool_result 图片块,供模型直接查看(Anthropic 原生;OpenAI 系协议由
// provider 层降级为合成 user 消息)。
package tools
import (
"bytes"
"encoding/base64"
"fmt"
"image"
"image/gif"
"image/jpeg"
"image/png"
"os"
"path/filepath"
"strings"
"golang.org/x/image/draw"
_ "golang.org/x/image/webp" // 注册 webp 解码
"github.com/chaitin/MonkeyCode/agent/internal/provider"
)
// imageMediaTypes 支持读取的图片扩展名 → MIME。
var imageMediaTypes = map[string]string{
".png": "image/png",
".jpg": "image/jpeg",
".jpeg": "image/jpeg",
".gif": "image/gif",
".webp": "image/webp",
}
const (
imageMaxSrcBytes = 20 * 1024 * 1024 // 源文件上限
imageMaxEdge = 1568 // 超过则等比缩放(Anthropic 推荐的最优上限)
imageMaxOutBytes = 4 * 1024 * 1024 // 编码后上限(留足 base64 膨胀余量)
)
// IsImagePath 路径是否为受支持的图片文件。
func IsImagePath(path string) bool {
_, ok := imageMediaTypes[strings.ToLower(filepath.Ext(path))]
return ok
}
// ReadImageBlocks 读取图片文件为 tool_result 内容块(图片块在前、说明文本在后)。
func ReadImageBlocks(path, displayPath string) ([]provider.ContentBlock, string, error) {
data, err := os.ReadFile(path)
if err != nil {
return nil, "", err
}
if len(data) > imageMaxSrcBytes {
return nil, "", fmt.Errorf("图片 %s 过大(%d 字节,上限 %d)", displayPath, len(data), imageMaxSrcBytes)
}
img, format, err := image.Decode(bytes.NewReader(data))
if err != nil {
return nil, "", fmt.Errorf("解码图片 %s 失败: %w", displayPath, err)
}
w, h := img.Bounds().Dx(), img.Bounds().Dy()
// 尺寸合规且体积可接受:原始字节直传,零损
scaled := false
out := data
mediaType := imageMediaTypes[strings.ToLower(filepath.Ext(path))]
if max(w, h) > imageMaxEdge || len(data) > imageMaxOutBytes {
img = scaleDown(img, imageMaxEdge)
w, h = img.Bounds().Dx(), img.Bounds().Dy()
out, mediaType, err = encodeImage(img, format)
if err != nil {
return nil, "", fmt.Errorf("编码图片 %s 失败: %w", displayPath, err)
}
scaled = true
}
note := fmt.Sprintf("图片 %s(%d×%d", displayPath, w, h)
if scaled {
note += ",已缩放以适配模型"
}
note += ")"
blocks := []provider.ContentBlock{
{Type: provider.BlockImage, Source: &provider.ImageSource{
Type: "base64", MediaType: mediaType, Data: base64.StdEncoding.EncodeToString(out),
}},
{Type: provider.BlockText, Text: note},
}
return blocks, note, nil
}
// scaleDown 等比缩放到最长边 ≤ maxEdge(CatmullRom,质量优先)。
func scaleDown(img image.Image, maxEdge int) image.Image {
b := img.Bounds()
w, h := b.Dx(), b.Dy()
if max(w, h) <= maxEdge {
return img
}
var nw, nh int
if w >= h {
nw = maxEdge
nh = h * maxEdge / w
} else {
nh = maxEdge
nw = w * maxEdge / h
}
dst := image.NewRGBA(image.Rect(0, 0, max(nw, 1), max(nh, 1)))
draw.CatmullRom.Scale(dst, dst.Bounds(), img, b, draw.Over, nil)
return dst
}
// encodeImage 重编码:jpeg 源保持 jpeg;其余(png/gif/webp,可能含透明)先试
// png,超限再降级 jpeg。返回 (字节, mediaType)。
func encodeImage(img image.Image, srcFormat string) ([]byte, string, error) {
var buf bytes.Buffer
if srcFormat == "jpeg" {
if err := jpeg.Encode(&buf, img, &jpeg.Options{Quality: 85}); err != nil {
return nil, "", err
}
return buf.Bytes(), "image/jpeg", nil
}
if err := png.Encode(&buf, img); err != nil {
return nil, "", err
}
if buf.Len() <= imageMaxOutBytes {
return buf.Bytes(), "image/png", nil
}
buf.Reset()
if err := jpeg.Encode(&buf, flattenAlpha(img), &jpeg.Options{Quality: 82}); err != nil {
return nil, "", err
}
return buf.Bytes(), "image/jpeg", nil
}
// flattenAlpha 把可能含透明的图像平铺到白底(jpeg 无 alpha 通道)。
func flattenAlpha(img image.Image) image.Image {
b := img.Bounds()
dst := image.NewRGBA(b)
draw.Copy(dst, b.Min, image.White, b, draw.Src, nil)
draw.Copy(dst, b.Min, img, b, draw.Over, nil)
return dst
}
// 保持 gif 解码注册(image.Decode 取首帧)。
var _ = gif.Decode
+113
View File
@@ -0,0 +1,113 @@
package tools
import (
"bytes"
"context"
"encoding/base64"
"encoding/json"
"image"
"image/color"
"image/png"
"os"
"path/filepath"
"testing"
"github.com/chaitin/MonkeyCode/agent/internal/provider"
)
func writeTestPNG(t *testing.T, path string, w, h int) {
t.Helper()
img := image.NewRGBA(image.Rect(0, 0, w, h))
for y := 0; y < h; y += 10 {
for x := 0; x < w; x++ {
img.Set(x, y, color.RGBA{R: 200, G: 40, B: 40, A: 255})
}
}
f, err := os.Create(path)
if err != nil {
t.Fatal(err)
}
defer f.Close()
if err := png.Encode(f, img); err != nil {
t.Fatal(err)
}
}
// ==================== read_file 图片分支:返回图片块 + 超限缩放 ====================
func TestReadFile_ImageBlocks(t *testing.T) {
dir := t.TempDir()
writeTestPNG(t, filepath.Join(dir, "big.png"), 2000, 1000)
rf := &ReadFile{}
env := &Env{Workdir: dir}
blocks, display, err := rf.ExecuteBlocks(context.Background(), env, json.RawMessage(`{"path":"big.png"}`))
if err != nil {
t.Fatal(err)
}
if len(blocks) != 2 || blocks[0].Type != provider.BlockImage || blocks[1].Type != provider.BlockText {
t.Fatalf("应为 [image, text] 两块,实际: %+v", blocks)
}
src := blocks[0].Source
if src == nil || src.Type != "base64" || src.MediaType != "image/png" {
t.Fatalf("图片 source 形状不对: %+v", src)
}
raw, err := base64.StdEncoding.DecodeString(src.Data)
if err != nil {
t.Fatal(err)
}
img, _, err := image.Decode(bytes.NewReader(raw))
if err != nil {
t.Fatal(err)
}
if img.Bounds().Dx() != 1568 || img.Bounds().Dy() != 784 {
t.Fatalf("应等比缩放到 1568×784,实际 %dx%d", img.Bounds().Dx(), img.Bounds().Dy())
}
if display == "" || blocks[1].Text == "" {
t.Fatalf("缺少展示说明: display=%q text=%q", display, blocks[1].Text)
}
}
// 小图不缩放:原始字节直传
func TestReadFile_SmallImagePassthrough(t *testing.T) {
dir := t.TempDir()
p := filepath.Join(dir, "small.png")
writeTestPNG(t, p, 100, 60)
orig, _ := os.ReadFile(p)
rf := &ReadFile{}
blocks, _, err := rf.ExecuteBlocks(context.Background(), &Env{Workdir: dir}, json.RawMessage(`{"path":"small.png"}`))
if err != nil {
t.Fatal(err)
}
got, _ := base64.StdEncoding.DecodeString(blocks[0].Source.Data)
if string(got) != string(orig) {
t.Fatal("尺寸合规的小图应原始字节直传")
}
}
// 非图片文件仍走文本路径(单文本块)
func TestReadFile_TextUnaffected(t *testing.T) {
dir := t.TempDir()
if err := os.WriteFile(filepath.Join(dir, "a.txt"), []byte("hello"), 0o644); err != nil {
t.Fatal(err)
}
rf := &ReadFile{}
blocks, _, err := rf.ExecuteBlocks(context.Background(), &Env{Workdir: dir}, json.RawMessage(`{"path":"a.txt"}`))
if err != nil {
t.Fatal(err)
}
if len(blocks) != 1 || blocks[0].Type != provider.BlockText {
t.Fatalf("文本文件应为单文本块: %+v", blocks)
}
}
// 图片扩展名但文件不存在:报错口径与文本路径一致
func TestReadFile_MissingImage(t *testing.T) {
rf := &ReadFile{}
_, _, err := rf.ExecuteBlocks(context.Background(), &Env{Workdir: t.TempDir()}, json.RawMessage(`{"path":"no.png"}`))
if err == nil {
t.Fatal("不存在的图片应报错")
}
}
+28 -1
View File
@@ -6,6 +6,8 @@ import (
"fmt"
"os"
"strings"
"github.com/chaitin/MonkeyCode/agent/internal/provider"
)
const (
@@ -26,7 +28,8 @@ type readFileInput struct {
func (t *ReadFile) Name() string { return "read_file" }
func (t *ReadFile) Description() string {
return "读取工作区内的文件内容,输出带行号。大文件可用 offset/limit 分页读取。"
return "读取工作区内的文件内容,输出带行号。大文件可用 offset/limit 分页读取。" +
"也支持读取图片文件(png/jpg/gif/webp),将返回图片内容供查看。"
}
func (t *ReadFile) InputSchema() map[string]any {
@@ -47,6 +50,30 @@ func (t *ReadFile) Title(input json.RawMessage) string {
return "读取 " + in.Path
}
// ExecuteBlocks 实现 BlocksTool:图片文件返回图片块,其余走文本路径。
func (t *ReadFile) ExecuteBlocks(ctx context.Context, env *Env, input json.RawMessage) ([]provider.ContentBlock, string, error) {
var in readFileInput
if err := unmarshalInput(input, &in); err != nil {
return nil, "", err
}
if IsImagePath(in.Path) {
p, err := ResolveForRead(env, in.Path)
if err != nil {
return nil, "", err
}
if st, serr := os.Stat(p); serr != nil || st.IsDir() {
// 不存在/是目录等按文本路径的报错口径处理
} else {
return ReadImageBlocks(p, in.Path)
}
}
out, err := t.Execute(ctx, env, input)
if err != nil {
return nil, "", err
}
return []provider.ContentBlock{{Type: provider.BlockText, Text: out}}, out, nil
}
func (t *ReadFile) Execute(_ context.Context, env *Env, input json.RawMessage) (string, error) {
var in readFileInput
if err := unmarshalInput(input, &in); err != nil {
+7
View File
@@ -61,6 +61,13 @@ type Parallelizable interface {
Parallelizable() bool
}
// BlocksTool 可选接口:结果可为富内容块(如图片)的工具。实现者的结果
// 一律经 ExecuteBlocks 返回(loop 不再调 Execute);display 为 UI 工具卡
// 展示用的一行文本。
type BlocksTool interface {
ExecuteBlocks(ctx context.Context, env *Env, input json.RawMessage) (blocks []provider.ContentBlock, display string, err error)
}
// Registry 工具注册表。
type Registry struct {
tools map[string]Tool
+50 -3
View File
@@ -7,12 +7,15 @@ import {
createSession,
deleteSession,
inDesktopShell,
isWindowsShell,
getHostInfo,
listModels,
listSessions,
onHostEvent,
setSessionArchived,
updateCheck,
uploadImage,
uploadImageURL,
type Conn,
type UpdateStatus,
} from "./client";
@@ -23,6 +26,7 @@ import { NewTaskView } from "./newtask";
import { answerPerm, initialChat, reduceBatch, type ChatState } from "./reduce";
import { groupByProject, Sidebar } from "./sidebar";
import { SettingsView } from "./settings";
import TitleBar from "./titlebar";
import type { FileChange, Frame, LogItem, ModelInfo, SessionMeta } from "./types";
/** 首启默认工作目录(内核解析 ~,不存在时自动创建);老用户默认沿用最近会话的目录 */
@@ -114,6 +118,7 @@ export default function App() {
setDrawerOpen(false);
setDiff(null);
setQueued(null);
setAtts([]);
setSessionModel("");
setYolo(false);
setStatus("未连接");
@@ -133,6 +138,7 @@ export default function App() {
setDrawerOpen(false);
setDiff(null);
setQueued(null);
setAtts([]);
setSessionModel(model ?? "");
setYolo(mode === "yolo");
localStorage.setItem("mc.lastSession", id);
@@ -213,16 +219,48 @@ export default function App() {
if (connRef.current?.send("user-input", { content: b64encode(queued) })) setQueued(null);
}, [chat.running, queued]);
// 待发送的图片附件(已上传到工作区,发送时以 [图片] 路径行拼进消息文本)
const [atts, setAtts] = useState<{ path: string; preview: string }[]>([]);
const addImages = async (files: File[]) => {
if (!currentId) return;
for (const f of files) {
if (!f.type.startsWith("image/")) continue;
if (f.size > 20 * 1024 * 1024) {
setStatus(`⚠ 图片 ${f.name} 过大(上限 20MB)`);
continue;
}
try {
const dataURL = await new Promise<string>((resolve, reject) => {
const r = new FileReader();
r.onload = () => resolve(r.result as string);
r.onerror = () => reject(new Error("读取文件失败"));
r.readAsDataURL(f);
});
const b64 = dataURL.slice(dataURL.indexOf(",") + 1);
const { path } = await uploadImage(currentId, f.type, b64);
setAtts((a) => [...a, { path, preview: dataURL }]);
} catch (e) {
setStatus("⚠ 图片上传失败: " + (e instanceof Error ? e.message : String(e)));
}
}
};
const send = () => {
const text = input.trim();
const lines = atts.map((a) => `[图片] ${a.path}`);
const text = [input.trim(), ...lines].filter(Boolean).join("\n");
if (!text || !connRef.current) return;
if (chat.running) {
// 运行中先排队,本轮结束自动发送(可点 ✕ 取消)
setQueued(text);
setInput("");
setAtts([]);
return;
}
if (connRef.current.send("user-input", { content: b64encode(text) })) setInput("");
if (connRef.current.send("user-input", { content: b64encode(text) })) {
setInput("");
setAtts([]);
}
};
const onPermAnswer = (id: string, action: "allow" | "always" | "persist" | "deny") => {
@@ -368,15 +406,19 @@ export default function App() {
<div
style={{
display: "flex",
flexDirection: "column",
width: "100vw",
height: "100vh",
background: "var(--bg)",
color: "var(--t1)",
fontSize: 13,
overflow: "hidden",
position: "relative",
}}
>
{/* Windows 壳:装饰栏已去除,自绘 36px 标题栏(拖拽 + 窗口按钮) */}
{isWindowsShell() && <TitleBar />}
{/* 原根容器降级为内容行:改动抽屉的 absolute 以此为锚,始终盖在标题栏之下 */}
<div style={{ flex: 1, display: "flex", minHeight: 0, position: "relative" }}>
<Sidebar
sessions={sessions}
currentId={currentId}
@@ -440,6 +482,10 @@ export default function App() {
models={menuModels}
currentModel={currentModel}
yolo={yolo}
atts={atts}
onAddImages={(files) => void addImages(files)}
onRemoveAtt={(i) => setAtts((a) => a.filter((_, j) => j !== i))}
uploadUrl={currentId ? (p) => uploadImageURL(currentId, p) : undefined}
onSend={send}
onStop={() => connRef.current?.send("user-cancel", {})}
onClearQueued={() => setQueued(null)}
@@ -579,6 +625,7 @@ export default function App() {
</div>
</div>
)}
</div>
</div>
);
}
+125 -5
View File
@@ -1,6 +1,14 @@
// 会话视图:标题栏 / 对话流 / 运行条 / 排队 chip / composer。
// 布局与数值取自设计稿 Chat 屏;协议交互(发送/审批/切模型等)经 props 回调 App。
import { useEffect, useRef, useState, type CSSProperties, type KeyboardEvent } from "react";
import {
useEffect,
useRef,
useState,
type ClipboardEvent,
type CSSProperties,
type DragEvent,
type KeyboardEvent,
} from "react";
import { LogList, MONO } from "./components";
import {
IconArchive,
@@ -198,6 +206,10 @@ export function ChatView({
models,
currentModel,
yolo,
atts,
onAddImages,
onRemoveAtt,
uploadUrl,
onSend,
onStop,
onClearQueued,
@@ -218,6 +230,11 @@ export function ChatView({
models: ModelInfo[];
currentModel: string;
yolo: boolean;
/** 待发送图片附件(已上传到工作区) */
atts: { path: string; preview: string }[];
onAddImages: (files: File[]) => void;
onRemoveAtt: (i: number) => void;
uploadUrl?: (path: string) => string;
onSend: () => void;
onStop: () => void;
onClearQueued: () => void;
@@ -233,6 +250,8 @@ export function ChatView({
const taRef = useRef<HTMLTextAreaElement>(null);
const pinnedRef = useRef(true); // 用户是否停留在底部(自动跟随滚动)
const [menu, setMenu] = useState<"closed" | "open" | "confirm">("closed");
const [dragging, setDragging] = useState(false);
const dragDepth = useRef(0); // dragenter/leave 在子元素间反复触发,计数配对
// 自动滚动(仅当用户停留在底部)
useEffect(() => {
@@ -261,6 +280,43 @@ export function ChatView({
}
};
// 粘贴图片:剪贴板里的 image item 上传为附件(文本粘贴不受影响)
const onPaste = (e: ClipboardEvent<HTMLTextAreaElement>) => {
const files: File[] = [];
for (const item of e.clipboardData.items) {
if (item.kind === "file" && item.type.startsWith("image/")) {
const f = item.getAsFile();
if (f) files.push(f);
}
}
if (files.length) {
e.preventDefault();
onAddImages(files);
}
};
// 拖拽图片进对话区
const onDragEnter = (e: DragEvent<HTMLDivElement>) => {
if (![...e.dataTransfer.items].some((i) => i.kind === "file")) return;
e.preventDefault();
dragDepth.current++;
setDragging(true);
};
const onDragLeave = (e: DragEvent<HTMLDivElement>) => {
e.preventDefault();
if (--dragDepth.current <= 0) {
dragDepth.current = 0;
setDragging(false);
}
};
const onDrop = (e: DragEvent<HTMLDivElement>) => {
e.preventDefault();
dragDepth.current = 0;
setDragging(false);
const files = [...e.dataTransfer.files].filter((f) => f.type.startsWith("image/"));
if (files.length) onAddImages(files);
};
const workdir = meta?.workdir ?? "";
const empty = chat.items.length === 0 && !chat.running;
const openPerm = [...chat.items].reverse().find((it) => it.kind === "perm" && it.state === "open") as
@@ -287,7 +343,34 @@ export function ChatView({
};
return (
<div style={{ flex: 1, display: "flex", flexDirection: "column", minHeight: 0 }}>
<div
style={{ flex: 1, display: "flex", flexDirection: "column", minHeight: 0, position: "relative" }}
onDragEnter={onDragEnter}
onDragOver={(e) => e.preventDefault()}
onDragLeave={onDragLeave}
onDrop={onDrop}
>
{dragging && (
<div
style={{
position: "absolute",
inset: 8,
zIndex: 20,
border: "2px dashed var(--acc)",
borderRadius: 14,
background: "rgba(31,138,91,.06)",
display: "flex",
alignItems: "center",
justifyContent: "center",
pointerEvents: "none",
fontSize: 14,
fontWeight: 700,
color: "var(--acc)",
}}
>
松开以添加图片
</div>
)}
{/* ==== 标题栏(空白区可拖拽窗口,macOS 常规行为)==== */}
<div data-tauri-drag-region="" style={{ height: 56, flex: "none", display: "flex", alignItems: "center", gap: 12, padding: "0 24px", borderBottom: "1px solid var(--line2)" }}>
<div style={{ display: "flex", flexDirection: "column", gap: 2, minWidth: 0 }}>
@@ -455,7 +538,7 @@ export function ChatView({
) : (
<div ref={logRef} onScroll={onLogScroll} style={{ flex: 1, overflowY: "auto", overflowX: "hidden", minHeight: 0 }}>
<div style={{ maxWidth: COL_MAX, margin: "0 auto", padding: "26px 36px 16px", display: "flex", flexDirection: "column", gap: 18 }}>
<LogList items={chat.items} onPermAnswer={onPermAnswer} onOpenChild={onOpenChild} />
<LogList items={chat.items} onPermAnswer={onPermAnswer} onOpenChild={onOpenChild} uploadUrl={uploadUrl} />
</div>
</div>
)}
@@ -537,14 +620,51 @@ export function ChatView({
flexDirection: "column",
}}
>
{atts.length > 0 && (
<div style={{ display: "flex", flexWrap: "wrap", gap: 8, padding: "10px 12px 0" }}>
{atts.map((a, i) => (
<span key={a.path} style={{ position: "relative", display: "flex" }}>
<img
src={a.preview}
alt={a.path}
title={a.path}
style={{ width: 52, height: 52, objectFit: "cover", borderRadius: 8, border: "1px solid var(--cardBd)" }}
/>
<button
title="移除"
onClick={() => onRemoveAtt(i)}
style={{
position: "absolute",
top: -5,
right: -5,
width: 17,
height: 17,
border: "1px solid var(--line)",
borderRadius: "50%",
background: "var(--card)",
boxShadow: "var(--cardSh)",
cursor: "pointer",
padding: 0,
display: "flex",
alignItems: "center",
justifyContent: "center",
}}
>
<IconX size={8} color="var(--t3)" />
</button>
</span>
))}
</div>
)}
<textarea
ref={taRef}
rows={2}
value={input}
placeholder={chat.running ? "补充说明…运行中发送会排队" : "输入任务…"}
placeholder={chat.running ? "补充说明…运行中发送会排队" : "输入任务…粘贴或拖入图片可作为附件"}
onChange={(e) => setInput(e.target.value)}
onCompositionEnd={markImeEnd}
onKeyDown={onKey}
onPaste={onPaste}
style={{
border: "none",
outline: "none",
@@ -579,7 +699,7 @@ export function ChatView({
alignItems: "center",
justifyContent: "center",
flex: "none",
opacity: input.trim() ? 1 : 0.45,
opacity: input.trim() || atts.length > 0 ? 1 : 0.45,
}}
>
<IconSend />
+46
View File
@@ -67,6 +67,19 @@ export const setSessionArchived = (id: string, archived: boolean) =>
body: JSON.stringify({ archived }),
});
/** 上传对话里粘贴/拖入的图片到会话工作区 .mc-agent/uploads/,返回工作区相对路径。 */
export const uploadImage = (sessionId: string, mediaType: string, dataB64: string) =>
api<{ path: string }>(`/api/sessions/${sessionId}/uploads`, {
method: "POST",
body: JSON.stringify({ media_type: mediaType, data: dataB64 }),
});
/** 已上传图片的回读 URL(<img> 无法带请求头,token 走查询参数)。 */
export function uploadImageURL(sessionId: string, path: string): string {
const name = path.split("/").pop() ?? "";
return `/api/sessions/${sessionId}/uploads/${encodeURIComponent(name)}?token=${encodeURIComponent(token)}`;
}
// ==================== 宿主(桌面壳)集成 ====================
interface TauriGlobal {
@@ -112,6 +125,39 @@ export function isMacShell(): boolean {
return inDesktopShell() && /Mac/.test(navigator.userAgent);
}
/** 是否 Windows 桌面壳(壳去掉了原生装饰栏,UI 须自绘 36px 标题栏)。 */
export function isWindowsShell(): boolean {
return inDesktopShell() && /Windows/.test(navigator.userAgent);
}
// 窗口控制(自绘标题栏按钮用):core window 命令不带 label 即作用于调用方窗口。
// 关闭走壳的 CloseRequested 拦截 → 隐藏到托盘,与原生关闭按钮行为一致。
function windowCmd(cmd: string): Promise<unknown> {
const tauri = (window as { __TAURI__?: TauriGlobal }).__TAURI__;
if (!tauri?.core?.invoke) return Promise.reject(new Error("非桌面壳环境"));
return tauri.core.invoke(`plugin:window|${cmd}`);
}
export const windowMinimize = () => windowCmd("minimize").catch(console.error);
export const windowToggleMaximize = () => windowCmd("toggle_maximize").catch(console.error);
export const windowClose = () => windowCmd("close").catch(console.error);
export async function windowIsMaximized(): Promise<boolean> {
try {
return (await windowCmd("is_maximized")) as boolean;
} catch {
return false;
}
}
/** 监听窗口尺寸变化(最大化/还原图标切换用);返回解除监听函数。 */
export function onWindowResized(cb: () => void): () => void {
const tauri = (window as { __TAURI__?: TauriGlobal }).__TAURI__;
const unlisten = tauri?.event?.listen?.("tauri://resize", cb);
return () => void unlisten?.then((f) => f());
}
/** 宿主信息(应用版本等);非壳环境返回 null。 */
export async function getHostInfo(): Promise<{ version: string } | null> {
const tauri = (window as { __TAURI__?: TauriGlobal }).__TAURI__;
+87 -22
View File
@@ -330,36 +330,98 @@ function TurnDivider() {
);
}
/** 用户消息里的图片行:`[图片] <工作区相对路径>`(composer 发送时拼接的约定格式) */
const IMAGE_LINE = /^\[图片\] (\S+)$/;
/** 用户气泡:文本 + 附图缩略图(点击看大图) */
function UserBubble({ text, uploadUrl }: { text: string; uploadUrl?: (path: string) => string }) {
const [zoom, setZoom] = useState<string | null>(null);
const lines = text.split("\n");
const images: string[] = [];
const rest: string[] = [];
for (const line of lines) {
const m = line.match(IMAGE_LINE);
if (m && uploadUrl) images.push(m[1]);
else rest.push(line);
}
const body = rest.join("\n").trim();
return (
<div style={{ display: "flex", justifyContent: "flex-end" }}>
<div
style={{
maxWidth: "70%",
background: "var(--userBg)",
border: "1px solid var(--accBd)",
borderRadius: "12px 12px 3px 12px",
padding: "9px 15px",
fontSize: 13.5,
lineHeight: 1.6,
color: "var(--t1)",
whiteSpace: "pre-wrap",
wordBreak: "break-word",
animation: "mcin .25s ease",
}}
>
{body}
{images.length > 0 && (
<div style={{ display: "flex", flexWrap: "wrap", gap: 6, marginTop: body ? 8 : 2 }}>
{images.map((p) => (
<img
key={p}
src={uploadUrl!(p)}
alt={p}
title={p}
onClick={() => setZoom(p)}
style={{
maxWidth: 150,
maxHeight: 120,
borderRadius: 8,
border: "1px solid var(--accBd)",
cursor: "zoom-in",
display: "block",
}}
/>
))}
</div>
)}
</div>
{zoom && (
<div
onClick={() => setZoom(null)}
style={{
position: "fixed",
inset: 0,
background: "rgba(20,30,25,.55)",
zIndex: 50,
display: "flex",
alignItems: "center",
justifyContent: "center",
cursor: "zoom-out",
}}
>
<img
src={uploadUrl!(zoom)}
alt={zoom}
style={{ maxWidth: "90vw", maxHeight: "90vh", borderRadius: 10, boxShadow: "0 24px 70px rgba(0,0,0,.4)" }}
/>
</div>
)}
</div>
);
}
function ItemView({
item,
onPermAnswer,
uploadUrl,
}: {
item: Exclude<LogItem, { kind: "tool" }>;
onPermAnswer: (id: string, action: "allow" | "always" | "persist" | "deny") => void;
uploadUrl?: (path: string) => string;
}) {
switch (item.kind) {
case "user":
return (
<div style={{ display: "flex", justifyContent: "flex-end" }}>
<div
style={{
maxWidth: "70%",
background: "var(--userBg)",
border: "1px solid var(--accBd)",
borderRadius: "12px 12px 3px 12px",
padding: "9px 15px",
fontSize: 13.5,
lineHeight: 1.6,
color: "var(--t1)",
whiteSpace: "pre-wrap",
wordBreak: "break-word",
animation: "mcin .25s ease",
}}
>
{item.text}
</div>
</div>
);
return <UserBubble text={item.text} uploadUrl={uploadUrl} />;
case "agent":
return (
<div style={{ maxWidth: "92%", wordBreak: "break-word", animation: "mcin .25s ease" }}>
@@ -387,10 +449,13 @@ export function LogList({
items,
onPermAnswer,
onOpenChild,
uploadUrl,
}: {
items: LogItem[];
onPermAnswer: (id: string, action: "allow" | "always" | "persist" | "deny") => void;
onOpenChild?: (id: string) => void;
/** 已上传图片路径 → 可渲染 URL(气泡缩略图;不传则图片行按纯文本展示) */
uploadUrl?: (path: string) => string;
}) {
const out: ReactElement[] = [];
for (let i = 0; i < items.length; ) {
@@ -412,7 +477,7 @@ export function LogList({
</div>,
);
} else {
out.push(<ItemView key={i} item={it} onPermAnswer={onPermAnswer} />);
out.push(<ItemView key={i} item={it} onPermAnswer={onPermAnswer} uploadUrl={uploadUrl} />);
i++;
}
}
+2
View File
@@ -84,6 +84,8 @@ textarea::placeholder, input::placeholder { color: var(--t6); }
.hv-acc:hover { background: var(--accH) !important; }
.hv-accbg:hover { background: rgba(31, 138, 91, 0.07) !important; }
.hv-bd:hover { border-color: var(--acc) !important; }
/* Windows 自绘标题栏的关闭按钮:hover 红底白字(系统惯例,明暗主题同色) */
.hv-caption-close:hover { background: #e81123 !important; color: #fff !important; }
/* markdown 渲染产物(无法内联) */
.md { font-size: 13.5px; line-height: 1.8; color: var(--t2); }
+86
View File
@@ -0,0 +1,86 @@
// Windows 壳的自绘标题栏:壳去掉了原生装饰栏(decorations=false),这里补回
// 36px 的拖拽区 + 最小化/最大化/关闭按钮(跟随应用明暗主题,与界面同色融合)。
// 仅 isWindowsShell() 时由 App 渲染;mac 壳走 Overlay 红绿灯,浏览器模式无此栏。
import { useEffect, useState, type CSSProperties } from "react";
import {
onWindowResized,
windowClose,
windowIsMaximized,
windowMinimize,
windowToggleMaximize,
} from "./client";
const btn: CSSProperties = {
width: 46,
height: "100%",
border: "none",
background: "transparent",
display: "flex",
alignItems: "center",
justifyContent: "center",
color: "var(--t3)",
cursor: "default", // Windows 惯例:窗口按钮不是手型
padding: 0,
flex: "none",
};
/** 窗口按钮图标(Windows 10/11 caption 字形,1px 细线,currentColor 随 hover 变色) */
function Glyph({ d }: { d: string }) {
return (
<svg width={10} height={10} viewBox="0 0 10 10" fill="none" style={{ display: "block" }}>
<path d={d} stroke="currentColor" strokeWidth="1" />
</svg>
);
}
export default function TitleBar() {
const [maximized, setMaximized] = useState(false);
useEffect(() => {
const sync = () => void windowIsMaximized().then(setMaximized);
sync();
return onWindowResized(sync);
}, []);
return (
<div
data-tauri-drag-region=""
style={{
height: 36,
flex: "none",
display: "flex",
alignItems: "center",
background: "var(--bg)",
borderBottom: "1px solid var(--line2)",
userSelect: "none",
}}
>
<span
data-tauri-drag-region=""
style={{ fontSize: 12, fontWeight: 700, letterSpacing: 0.2, color: "var(--t4)", padding: "0 14px" }}
>
MonkeyCode
</span>
<span data-tauri-drag-region="" style={{ flex: 1, alignSelf: "stretch" }} />
<button className="hv" title="最小化" onClick={() => void windowMinimize()} style={btn}>
<Glyph d="M0 5h10" />
</button>
<button
className="hv"
title={maximized ? "向下还原" : "最大化"}
onClick={() => void windowToggleMaximize()}
style={btn}
>
{maximized ? (
// 还原:前后两个错位方框
<Glyph d="M.5 2.5h7v7h-7zM2.5 2.5v-2h7v7h-2" />
) : (
<Glyph d="M.5 .5h9v9h-9z" />
)}
</button>
<button className="hv-caption-close" title="关闭" onClick={() => void windowClose()} style={btn}>
<Glyph d="M0 0l10 10M10 0L0 10" />
</button>
</div>
);
}
+71
View File
@@ -610,3 +610,74 @@
- [x] 全程无 pageerror/console error
- [ ] macOS 红绿灯 Overlay 与桌面壳内 关于/检查更新 卡片待真机回归(本机无 mac/无显示)
# 2026-07-16:Windows 自绘标题栏 + Windows 自动更新
> 计划:~/.claude/plans/cozy-enchanting-crescent.md(已批准)
> 取向:36px 细自绘标题栏;更新清单拆分端点(latest-windows.json / latest-win7.json)
## A. Windows 无边框 + 自绘标题栏
- [x] main.rs:主窗口 Windows 分支 decorations(false)
- [x] tauri.conf.json:kernel-ui 加 window 权限(已对照 gen/schemas 核实名字)
- [x] client.ts:isWindowsShell + 窗口控制封装
- [x] titlebar.tsx(新):36px 标题栏(拖拽区 + 最小化/最大化/关闭)
- [x] App.tsx:根布局改 column + 条件渲染 TitleBar
## B. Windows 自动更新
- [x] tauri.windows.conf.json:updater 端点 → latest-windows.json
- [x] main.rs:build_updater 加 on_before_exit 回收内核(防 NSIS 文件占用)
- [x] gen-latest-json.py:平台模式 macos/windows/win7
- [x] Makefile:windows-release 目标
- [x] desktop-windows.yml / desktop-win7.yml:secret + release 构建 + 清单 + artifact
- [x] README:发布流程文档
## 验证
- [x] agent/ui npm run build 过;mc-desktop cargo check 过
- [x] gen-latest-json.py 三模式假产物 dry-run
- [ ] 推 CI 核对产物(exe + .sig + 清单)
- [ ] Windows 实机人工验证(标题栏 + 更新全链路)
## Review
- 标题栏:壳 Windows 分支 decorations(false);UI 新增 titlebar.tsx(36px,拖拽区 +
最小化/最大化-还原/关闭,close hover 红底白字),App 根布局改 column 条件渲染;
窗口命令走 core.invoke("plugin:window|…")(与 dialog/opener 惯例一致),权限名
已对照 gen/schemas 核实。关闭按钮走壳的 CloseRequested 拦截 → 隐藏到托盘。
- 自动更新:根因 = Windows 构建无签名 updater 产物 + latest.json 无 windows 条目。
端点拆分(latest-windows.json / latest-win7.json),gen-latest-json.py 平台模式化,
两条 Windows CI 加 secret 发布构建(无 secret 降级不红),Makefile 加 windows-release。
关键坑修复:updater 在 Windows 硬退进程不走 RunEvent::Exit,build_updater 加
on_before_exit 先 stop_kernel,否则 mc-agent.exe 锁文件 NSIS 安装必败。
- 验证:tsc+vite 过;cargo check 过;清单脚本三模式假产物 dry-run 结构正确;
无头 Chromium 截图(mock Windows 壳)标题栏渲染正确,浏览器模式无标题栏。
- 遗留:现存 Windows 安装端点烧的是 latest.json,需手动重装一次进新通道(已确认接受);
Win11 无边框失去最大化按钮 hover 的 Snap Layouts 弹层。
# 功能:会话支持粘贴/拖拽图片(2026-07-16)
> 方案(与用户对齐):图片落成工作区文件 + 对话文本附路径,模型经 read_file
> 查看——不动 RunTurn/帧协议/压缩,图片可被工具二次处理(裁剪/OCR/素材)。
> 三协议对齐:Anthropic 原生 tool_result 图片块;OpenAI Chat/Responses 的
> 工具结果不支持图片(协议限制),序列化层转"占位文本 + 合成 user 图片消息",
> 归一化历史仍是标准 tool_result 块,跨协议切模型一致。
- [x] provider:BlockImage/ImageSource/tool_result Blocks;anthropic 线格式转换;
openai/openai_responses 降级转换(flattenToolResult)
- [x] tools:BlocksTool 接口;read_file 图片分支(解码/1568px 缩放/重编码,
x/image 依赖;小图原字节直传);工具描述更新
- [x] loop:execToolUse 走 BlocksTool,单文本块压平;compact 摘要图片占位 [图片]
- [x] server:POST/GET /api/sessions/{id}/uploads(白名单/20MB 上限/防穿越/
uploads/.gitignore 自免疫)
- [x] UI:composer 粘贴/拖拽(蒙层)→ 上传 → 缩略 chips(可移除)→ 发送拼
[图片] 路径行;用户气泡缩略图 + 点击大图;排队兼容
## 验证
- [x] Go 单测:三协议 wire 形状 ×3、read_file 图片分支 ×4、上传路由(含防穿越)、
集成(read_file 读图 → 图片块进入下一次 LLM 请求历史);全量 go test 通过
- [x] UI 端到端(无头 Chromium):拖入 PNG → chip → 发送 → 气泡缩略图加载成功
(naturalWidth=100)→ 文件落盘 .mc-agent/uploads/ + .gitignore;无 console 错误
- [ ] 真实视觉模型冒烟(本机无可用 vision key,待网关 key 后补)