@fgbg/mdocs 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/agent-skills/changelog/SKILL.md +15 -0
  2. package/agent-skills/usage-knowledge-graph/SKILL.md +0 -2
  3. package/dist/server/agent/Agent/run.js.map +1 -1
  4. package/dist/server/agent/Agent/system-prompt.js +13 -6
  5. package/dist/server/agent/Agent/system-prompt.js.map +1 -1
  6. package/dist/server/agent/Agent/tools-overwrite.js +10 -0
  7. package/dist/server/agent/Agent/tools-overwrite.js.map +1 -1
  8. package/dist/server/documents/document.service.js +16 -4
  9. package/dist/server/documents/document.service.js.map +1 -1
  10. package/dist/server/routes/agent.routes.js +3 -0
  11. package/dist/server/routes/agent.routes.js.map +1 -1
  12. package/dist/shared/file-type-policy.js +120 -0
  13. package/dist/shared/file-type-policy.js.map +1 -0
  14. package/dist/shared/file-types.js +4 -2
  15. package/dist/shared/file-types.js.map +1 -1
  16. package/dist/web/assets/AgentChatPanel-Dd8Xnyia.js +27 -0
  17. package/dist/web/assets/{AgentSkillFormCard-CtfWIf7Y.js → AgentSkillFormCard-dsAy12lL.js} +1 -1
  18. package/dist/web/assets/{AiWriteWorkbench-Boie5E_-.js → AiWriteWorkbench-i9ZoyX3p.js} +1 -1
  19. package/dist/web/assets/{DiagramEditor-NtNY3sZL-CZy-tmEe.js → DiagramEditor-NtNY3sZL-CAQtZY2E.js} +1 -1
  20. package/dist/web/assets/{DocumentEditor-1A6lpvV-.js → DocumentEditor-oFGmAxnV.js} +2 -2
  21. package/dist/web/assets/{MergeView-Dip0aW7s.js → MergeView-DgEbzTVh.js} +1 -1
  22. package/dist/web/assets/PlaygroundPage-BLEC6-Uf.js +8 -0
  23. package/dist/web/assets/{SettingsPage-nlnmzNZK.js → SettingsPage-BcCvamXH.js} +1 -1
  24. package/dist/web/assets/{Toolbar-BHLX-ug4.js → Toolbar-Dz9Cn_hv.js} +24 -29
  25. package/dist/web/assets/{VisitorPickerModal-BPyEWlQo.js → VisitorPickerModal-eagVdEZA.js} +1 -1
  26. package/dist/web/assets/code-xml-CZsyEkCa.js +6 -0
  27. package/dist/web/assets/{copy-BE64wQqi.js → copy-BUUKT-QO.js} +1 -1
  28. package/dist/web/assets/{diagram-CT58wBdU.js → diagram-DtU2xxz3.js} +1081 -1081
  29. package/dist/web/assets/index-DI_31upJ.js +248 -0
  30. package/dist/web/assets/index-YRgNGXBI.css +1 -0
  31. package/dist/web/assets/{meta2dEngine-BD2XbzaV-z-eR7E_V.js → meta2dEngine-BD2XbzaV-nAmL0RaW.js} +1 -1
  32. package/dist/web/assets/{motion-DX3HNq_4.js → motion-BgtuAqBE.js} +1 -1
  33. package/dist/web/assets/{plus-ECzYbQfA.js → plus-BkiPFt2u.js} +1 -1
  34. package/dist/web/assets/{react-GP8hKHRA.js → react--aHzEjEz.js} +3 -3
  35. package/dist/web/assets/{ui-BQStT3dY.js → ui-RahDNce8.js} +4 -4
  36. package/dist/web/index.html +5 -5
  37. package/package.json +2 -1
  38. package/dist/web/assets/AgentChatPanel-Bt38gm3b.js +0 -6
  39. package/dist/web/assets/PlaygroundPage-C4X6Lj-Q.js +0 -8
  40. package/dist/web/assets/index-BkKvQv2F.js +0 -248
  41. package/dist/web/assets/index-DKshvHIN.css +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diagram-CT58wBdU.js","assets/react-vendor-BuABiQkA.js"])))=>i.map(i=>d[i]);
2
- var gS=Object.defineProperty;var bS=(e,t,r)=>t in e?gS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var he=(e,t,r)=>bS(e,typeof t!="symbol"?t+"":t,r);import{r as u,j as N,R as q,a as vS,b as Eo,c as yS,m as Rl,T as su,d as T5,e as j5,f as A5,g as R5,h as z5,i as xb,k as xS,M as wS,l as CS,n as SS,o as wb,p as kS,q as $S,s as DS,t as _S,u as B5,S as ES,v as MS,w as IS,x as FS,y as ad,z as TS,_ as Nh,A as jS,B as Oh,C as cl,P as AS,D as lu,E as RS,F as zS,G as BS,H as PS,I as NS,J as OS,K as LS,L as Cb,N as Lh,O as HS,Q as qS,U as WS,V as VS,W as GS,X as US,Y as XS,Z as YS,$ as KS,a0 as Sb,a1 as kb,a2 as $b,a3 as ba,a4 as ZS,a5 as QS,a6 as JS,a7 as ek}from"./react-vendor-BuABiQkA.js";import{c as tk,r as rk,g as nk,s as Hh,G as ok,m as ul,u as ik,C as qn,M as ak,a as sk,b as P5,d as qh,T as lk,e as ck}from"./motion-DX3HNq_4.js";const Wh=u.createContext(null);u.memo(({children:e,motion:t})=>N.jsx(Wh,{value:t,children:e}));const dte=()=>{const e=u.use(Wh);if(!e)throw new Error("Please wrap your app with <ConfigProvider> (or <MotionProvider>) and pass the motion component");return e};function uk(e){var t=[];if(e.length===0)return"";if(typeof e[0]!="string")throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var r=e.shift();e[0]=r+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var n=0;n<e.length;n++){var o=e[n];if(typeof o!="string")throw new TypeError("Url must be a string. Received "+o);o!==""&&(n>0&&(o=o.replace(/^[\/]+/,"")),n<e.length-1?o=o.replace(/[\/]+$/,""):o=o.replace(/[\/]+$/,"/"),t.push(o))}var i=t.join("/");i=i.replace(/\/(\?|&|#[^!])/g,"$1");var a=i.split("?");return i=a.shift()+(a.length>0?"?":"")+a.join("&"),i}function Db(){var e;return typeof arguments[0]=="object"?e=arguments[0]:e=[].slice.call(arguments),uk(e)}const dk="https://unpkg.com",fk="https://registry.npmmirror.com",N5=({pkg:e,version:t="latest",path:r,proxy:n})=>{switch(n){case"unpkg":return Db(dk,`${e}@${t}`,r);default:return Db(fk,e,t,"files",r)}},Vh=u.createContext(null),O5=u.createContext({locale:"en",t:e=>e}),fc=e=>typeof(e==null?void 0:e.then)=="function",fte=u.memo(({children:e,config:t,locale:r,resources:n,motion:o})=>{const i=r??"en",[a,s]=u.useState(()=>n&&!fc(n)?n:void 0),[l,c]=u.useState(i),d=u.useRef(0);u.useEffect(()=>{const m=++d.current;if(!n){s(void 0),c(i);return}if(fc(n)){const h=i;n.then(g=>{d.current===m&&(s(g),c(h))}).catch(()=>{d.current});return}s(n),c(i)},[i,n]);const f=fc(n)?a:n,p=fc(n)?l:i;return N.jsx(O5,{value:u.useMemo(()=>{const m=Array.isArray(f)?f:f?Object.values(f):[],h=Object.assign({},...m);return{locale:p,t:y=>h[y]||y}},[p,f]),children:N.jsx(Vh,{value:t??null,children:N.jsx(Wh,{value:o,children:e})})})}),_b=({pkg:e,version:t,path:r})=>N5({path:r,pkg:e,proxy:"aliyun",version:t}),Gh=()=>{const e=u.use(Vh);return e?(e==null?void 0:e.proxy)!=="custom"?({pkg:t,version:r,path:n})=>N5({path:n,pkg:t,proxy:e.proxy,version:r}):(e==null?void 0:e.customCdnFn)||_b:_b},pk=()=>u.use(O5);function L5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mo(e){"@babel/helpers - typeof";return Mo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mo(e)}function mk(e,t){if(Mo(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Mo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function H5(e){var t=mk(e,"string");return Mo(t)=="symbol"?t:t+""}function hk(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,H5(n.key),n)}}function q5(e,t,r){return t&&hk(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function W5(e,t,r){return(t=H5(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var gk=function(){function e(){L5(this,e),W5(this,"_cacheList",[tk])}return q5(e,[{key:"add",value:function(r){var n=this.getCache(r.key);return n||(this._cacheList.push(r),r)}},{key:"delete",value:function(r){this._cacheList=this._cacheList.filter(function(n){return n.key!==r.key})}},{key:"hasCache",value:function(r){return this._cacheList.some(function(n){return n.key===r.key})}},{key:"getCache",value:function(r){return this._cacheList.find(function(n){return n.key===r})}},{key:"getCacheList",value:function(){return this._cacheList}}]),e}(),Eb=typeof document<"u",V5=function(t,r){return"".concat(t,"-").concat(r)},bk=function(t,r,n,o){var i=o.hashPriority;rk(t,r,n);var a=".".concat(V5(t.key,r.name)),s=i==="low"?":where(".concat(a,")"):a;if(t.inserted[r.name]===void 0){var l="",c=r;do{var d=t.insert(r===c?s:"",c,t.sheet,!0);!Eb&&d!==void 0&&(l+=d),c=c.next}while(c!==void 0);if(!Eb&&l.length!==0)return l}},Uh=function(t){return Mo(t)==="object"&&"styles"in t&&"name"in t&&"toString"in t},vk=function e(t){for(var r="",n=0;n<t.length;n++){var o=t[n];if(o!==null){var i=void 0;switch(Mo(o)){case"boolean":break;case"object":{if(Array.isArray(o))i=e(o);else{i="";for(var a in o)o[a]&&a&&(i&&(i+=" "),i+=a)}break}default:i=o}i&&(r&&(r+=" "),r+=i)}}return r},yk=function(t,r,n){var o=[],i=nk(t,o,n);return o.length<2?n:i+r(o)},xk=function(t,r){return function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];var a=Hh(o,t.registered,void 0);return bk(t,a,!1,r),V5(t.key,a.name)}},wk=function(t,r){return function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];var a=o.map(function(s){return Uh(s)?r(s):s});return yk(t.registered,r,vk(a))}},Xh=function(t,r){var n=xk(t,{hashPriority:r.hashPriority||"high",label:r.label}),o=wk(t,n);return{css:n,cx:o}},zl=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Hh(r)},G5="acss";function Mb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ot(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Mb(Object(r),!0).forEach(function(n){W5(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mb(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Ck=function(t){return u.createContext(t)},Sk=function(t){return function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return u.memo(function(i){var a=t();return N.jsx(ok,{styles:Hh(n,void 0,Ot(Ot({},i),{},{theme:a}))})})}};const ut=e=>{const t=u.useRef(e);return t.current=e,u.useCallback((...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])};function uo(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}const Ib=uo()?u.useLayoutEffect:u.useEffect,Vt=(e,t)=>{const r=u.useRef(!0);Ib(()=>e(r.current),t),Ib(()=>(r.current=!1,()=>{r.current=!0}),[])},x0=(e,t)=>{Vt(r=>{if(!r)return e()},t)},kk=e=>{const t=u.useRef(!1),[r,n]=u.useState(e);u.useEffect(()=>(t.current=!1,()=>{t.current=!0}),[]);function o(i,a){a&&t.current||n(i)}return[r,o]};function Jt(e,t){const[r,n]=u.useState(e),o=t!==void 0?t:r;return Vt(i=>{i||n(t)},[t]),[o,n]}var U5={exports:{}},Kt={};/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diagram-DtU2xxz3.js","assets/react-vendor-BuABiQkA.js"])))=>i.map(i=>d[i]);
2
+ var gS=Object.defineProperty;var bS=(e,t,r)=>t in e?gS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var he=(e,t,r)=>bS(e,typeof t!="symbol"?t+"":t,r);import{r as u,j as N,R as q,a as vS,b as Eo,c as yS,m as Rl,T as su,d as T5,e as j5,f as A5,g as R5,h as z5,i as xb,k as xS,M as wS,l as CS,n as SS,o as wb,p as kS,q as $S,s as DS,t as _S,u as B5,S as ES,v as MS,w as IS,x as FS,y as ad,z as TS,_ as Nh,A as jS,B as Oh,C as cl,P as AS,D as lu,E as RS,F as zS,G as BS,H as PS,I as NS,J as OS,K as LS,L as Cb,N as Lh,O as HS,Q as qS,U as WS,V as VS,W as GS,X as US,Y as XS,Z as YS,$ as KS,a0 as Sb,a1 as kb,a2 as $b,a3 as ba,a4 as ZS,a5 as QS,a6 as JS,a7 as ek}from"./react-vendor-BuABiQkA.js";import{c as tk,r as rk,g as nk,s as Hh,G as ok,m as ul,u as ik,C as qn,M as ak,a as sk,b as P5,d as qh,T as lk,e as ck}from"./motion-BgtuAqBE.js";const Wh=u.createContext(null);u.memo(({children:e,motion:t})=>N.jsx(Wh,{value:t,children:e}));const dte=()=>{const e=u.use(Wh);if(!e)throw new Error("Please wrap your app with <ConfigProvider> (or <MotionProvider>) and pass the motion component");return e};function uk(e){var t=[];if(e.length===0)return"";if(typeof e[0]!="string")throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var r=e.shift();e[0]=r+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var n=0;n<e.length;n++){var o=e[n];if(typeof o!="string")throw new TypeError("Url must be a string. Received "+o);o!==""&&(n>0&&(o=o.replace(/^[\/]+/,"")),n<e.length-1?o=o.replace(/[\/]+$/,""):o=o.replace(/[\/]+$/,"/"),t.push(o))}var i=t.join("/");i=i.replace(/\/(\?|&|#[^!])/g,"$1");var a=i.split("?");return i=a.shift()+(a.length>0?"?":"")+a.join("&"),i}function Db(){var e;return typeof arguments[0]=="object"?e=arguments[0]:e=[].slice.call(arguments),uk(e)}const dk="https://unpkg.com",fk="https://registry.npmmirror.com",N5=({pkg:e,version:t="latest",path:r,proxy:n})=>{switch(n){case"unpkg":return Db(dk,`${e}@${t}`,r);default:return Db(fk,e,t,"files",r)}},Vh=u.createContext(null),O5=u.createContext({locale:"en",t:e=>e}),fc=e=>typeof(e==null?void 0:e.then)=="function",fte=u.memo(({children:e,config:t,locale:r,resources:n,motion:o})=>{const i=r??"en",[a,s]=u.useState(()=>n&&!fc(n)?n:void 0),[l,c]=u.useState(i),d=u.useRef(0);u.useEffect(()=>{const m=++d.current;if(!n){s(void 0),c(i);return}if(fc(n)){const h=i;n.then(g=>{d.current===m&&(s(g),c(h))}).catch(()=>{d.current});return}s(n),c(i)},[i,n]);const f=fc(n)?a:n,p=fc(n)?l:i;return N.jsx(O5,{value:u.useMemo(()=>{const m=Array.isArray(f)?f:f?Object.values(f):[],h=Object.assign({},...m);return{locale:p,t:y=>h[y]||y}},[p,f]),children:N.jsx(Vh,{value:t??null,children:N.jsx(Wh,{value:o,children:e})})})}),_b=({pkg:e,version:t,path:r})=>N5({path:r,pkg:e,proxy:"aliyun",version:t}),Gh=()=>{const e=u.use(Vh);return e?(e==null?void 0:e.proxy)!=="custom"?({pkg:t,version:r,path:n})=>N5({path:n,pkg:t,proxy:e.proxy,version:r}):(e==null?void 0:e.customCdnFn)||_b:_b},pk=()=>u.use(O5);function L5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mo(e){"@babel/helpers - typeof";return Mo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mo(e)}function mk(e,t){if(Mo(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Mo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function H5(e){var t=mk(e,"string");return Mo(t)=="symbol"?t:t+""}function hk(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,H5(n.key),n)}}function q5(e,t,r){return t&&hk(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function W5(e,t,r){return(t=H5(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var gk=function(){function e(){L5(this,e),W5(this,"_cacheList",[tk])}return q5(e,[{key:"add",value:function(r){var n=this.getCache(r.key);return n||(this._cacheList.push(r),r)}},{key:"delete",value:function(r){this._cacheList=this._cacheList.filter(function(n){return n.key!==r.key})}},{key:"hasCache",value:function(r){return this._cacheList.some(function(n){return n.key===r.key})}},{key:"getCache",value:function(r){return this._cacheList.find(function(n){return n.key===r})}},{key:"getCacheList",value:function(){return this._cacheList}}]),e}(),Eb=typeof document<"u",V5=function(t,r){return"".concat(t,"-").concat(r)},bk=function(t,r,n,o){var i=o.hashPriority;rk(t,r,n);var a=".".concat(V5(t.key,r.name)),s=i==="low"?":where(".concat(a,")"):a;if(t.inserted[r.name]===void 0){var l="",c=r;do{var d=t.insert(r===c?s:"",c,t.sheet,!0);!Eb&&d!==void 0&&(l+=d),c=c.next}while(c!==void 0);if(!Eb&&l.length!==0)return l}},Uh=function(t){return Mo(t)==="object"&&"styles"in t&&"name"in t&&"toString"in t},vk=function e(t){for(var r="",n=0;n<t.length;n++){var o=t[n];if(o!==null){var i=void 0;switch(Mo(o)){case"boolean":break;case"object":{if(Array.isArray(o))i=e(o);else{i="";for(var a in o)o[a]&&a&&(i&&(i+=" "),i+=a)}break}default:i=o}i&&(r&&(r+=" "),r+=i)}}return r},yk=function(t,r,n){var o=[],i=nk(t,o,n);return o.length<2?n:i+r(o)},xk=function(t,r){return function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];var a=Hh(o,t.registered,void 0);return bk(t,a,!1,r),V5(t.key,a.name)}},wk=function(t,r){return function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];var a=o.map(function(s){return Uh(s)?r(s):s});return yk(t.registered,r,vk(a))}},Xh=function(t,r){var n=xk(t,{hashPriority:r.hashPriority||"high",label:r.label}),o=wk(t,n);return{css:n,cx:o}},zl=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Hh(r)},G5="acss";function Mb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ot(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Mb(Object(r),!0).forEach(function(n){W5(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mb(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Ck=function(t){return u.createContext(t)},Sk=function(t){return function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return u.memo(function(i){var a=t();return N.jsx(ok,{styles:Hh(n,void 0,Ot(Ot({},i),{},{theme:a}))})})}};const ut=e=>{const t=u.useRef(e);return t.current=e,u.useCallback((...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])};function uo(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}const Ib=uo()?u.useLayoutEffect:u.useEffect,Vt=(e,t)=>{const r=u.useRef(!0);Ib(()=>e(r.current),t),Ib(()=>(r.current=!1,()=>{r.current=!0}),[])},x0=(e,t)=>{Vt(r=>{if(!r)return e()},t)},kk=e=>{const t=u.useRef(!1),[r,n]=u.useState(e);u.useEffect(()=>(t.current=!1,()=>{t.current=!0}),[]);function o(i,a){a&&t.current||n(i)}return[r,o]};function Jt(e,t){const[r,n]=u.useState(e),o=t!==void 0?t:r;return Vt(i=>{i||n(t)},[t]),[o,n]}var U5={exports:{}},Kt={};/**
3
3
  * @license React
4
4
  * react-is.production.min.js
5
5
  *
@@ -2444,7 +2444,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
2444
2444
  overflow: hidden;
2445
2445
  max-width: 100%;
2446
2446
  height: auto;
2447
- `})),RV=ur(Cn.root,{defaultVariants:{variant:"filled"},variants:{variant:{filled:Cn.filled,outlined:Cn.outlined,borderless:Cn.borderless}}}),zV="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjU2IiBoZWlnaHQ9IjI1NiIgdmlld0JveD0iMCAwIDI1NiAyNTYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIyNTYiIGhlaWdodD0iMjU2IiBmaWxsPSIjM0IzQjNCIi8+CjxwYXRoIGQ9Ik0xNTYuODg4IDkxLjAwMkgxMDAuMTEyQzk1LjYzMjkgOTEuMDAyIDkyLjAwMTUgOTQuNjMzNCA5Mi4wMDE1IDk5LjExMjdWMTU1Ljg4OEM5Mi4wMDE1IDE2MC4zNjcgOTUuNjMyOSAxNjMuOTk5IDEwMC4xMTIgMTYzLjk5OUgxNTYuODg4QzE2MS4zNjcgMTYzLjk5OSAxNjQuOTk4IDE2MC4zNjcgMTY0Ljk5OCAxNTUuODg4Vjk5LjExMjdDMTY0Ljk5OCA5NC42MzM0IDE2MS4zNjcgOTEuMDAyIDE1Ni44ODggOTEuMDAyWiIgc3Ryb2tlPSIjNjI2MjYyIiBzdHJva2Utd2lkdGg9IjguMTEwNzciIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8cGF0aCBkPSJNMTY0Ljk5OCAxMzkuNjY4TDE1Mi40ODQgMTI3LjE1M0MxNTAuOTYyIDEyNS42MzIgMTQ4LjkgMTI0Ljc3OCAxNDYuNzQ5IDEyNC43NzhDMTQ0LjU5OSAxMjQuNzc4IDE0Mi41MzYgMTI1LjYzMiAxNDEuMDE1IDEyNy4xNTNMMTA0LjE2OCAxNjRNMTE2LjMzNCAxMjMuNDQ1QzEyMC44MTMgMTIzLjQ0NSAxMjQuNDQ1IDExOS44MTQgMTI0LjQ0NSAxMTUuMzM0QzEyNC40NDUgMTEwLjg1NSAxMjAuODEzIDEwNy4yMjQgMTE2LjMzNCAxMDcuMjI0QzExMS44NTUgMTA3LjIyNCAxMDguMjIzIDExMC44NTUgMTA4LjIyMyAxMTUuMzM0QzEwOC4yMjMgMTE5LjgxNCAxMTEuODU1IDEyMy40NDUgMTE2LjMzNCAxMjMuNDQ1WiIgc3Ryb2tlPSIjNjI2MjYyIiBzdHJva2Utd2lkdGg9IjguMTEwNzciIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4K",BV="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjU2IiBoZWlnaHQ9IjI1NiIgdmlld0JveD0iMCAwIDI1NiAyNTYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIyNTYiIGhlaWdodD0iMjU2IiBmaWxsPSIjRUNFQ0VDIi8+CjxwYXRoIGQ9Ik0xNTYuODg4IDkxLjAwMkgxMDAuMTEyQzk1LjYzMjkgOTEuMDAyIDkyLjAwMTUgOTQuNjMzNCA5Mi4wMDE1IDk5LjExMjdWMTU1Ljg4OEM5Mi4wMDE1IDE2MC4zNjcgOTUuNjMyOSAxNjMuOTk5IDEwMC4xMTIgMTYzLjk5OUgxNTYuODg4QzE2MS4zNjcgMTYzLjk5OSAxNjQuOTk4IDE2MC4zNjcgMTY0Ljk5OCAxNTUuODg4Vjk5LjExMjdDMTY0Ljk5OCA5NC42MzM0IDE2MS4zNjcgOTEuMDAyIDE1Ni44ODggOTEuMDAyWiIgc3Ryb2tlPSIjRDdEN0Q3IiBzdHJva2Utd2lkdGg9IjguMTEwNzciIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8cGF0aCBkPSJNMTY0Ljk5OCAxMzkuNjY4TDE1Mi40ODQgMTI3LjE1M0MxNTAuOTYyIDEyNS42MzIgMTQ4LjkgMTI0Ljc3OCAxNDYuNzQ5IDEyNC43NzhDMTQ0LjU5OSAxMjQuNzc4IDE0Mi41MzYgMTI1LjYzMiAxNDEuMDE1IDEyNy4xNTNMMTA0LjE2OCAxNjRNMTE2LjMzNCAxMjMuNDQ1QzEyMC44MTMgMTIzLjQ0NSAxMjQuNDQ1IDExOS44MTQgMTI0LjQ0NSAxMTUuMzM0QzEyNC40NDUgMTEwLjg1NSAxMjAuODEzIDEwNy4yMjQgMTE2LjMzNCAxMDcuMjI0QzExMS44NTUgMTA3LjIyNCAxMDguMjIzIDExMC44NTUgMTA4LjIyMyAxMTUuMzM0QzEwOC4yMjMgMTE5LjgxNCAxMTEuODU1IDEyMy40NDUgMTE2LjMzNCAxMjMuNDQ1WiIgc3Ryb2tlPSIjRDdEN0Q3IiBzdHJva2Utd2lkdGg9IjguMTEwNzciIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4K",r9=u.memo(({children:e,visible:t})=>{const r=u.useRef(null);return u.useEffect(()=>{if(!r.current)return;const n=o=>{o.preventDefault()};t?r.current.addEventListener("wheel",n,{passive:!1}):r.current.removeEventListener("wheel",n)},[t]),N.jsx("div",{ref:r,children:e})});var PV={"image.copy":"Copy","image.copyFailed":"Copy Failed","image.copySuccess":"Copy Success","image.download":"Download","image.downloadFailed":"Download Failed","image.downloadSuccess":"Download Success","image.flipHorizontal":"Flip Horizontal","image.flipVertical":"Flip Vertical","image.rotateLeft":"Rotate Left","image.rotateRight":"Rotate Right","image.zoomIn":"Zoom In","image.zoomOut":"Zoom Out"};const NV=e=>new Promise((t,r)=>{const n=new Image,o=URL.createObjectURL(e);n.onload=()=>{URL.revokeObjectURL(o);const i=document.createElement("canvas");i.width=n.naturalWidth,i.height=n.naturalHeight;const a=i.getContext("2d");if(!a){r(new Error("Canvas context not available"));return}a.drawImage(n,0,0),i.toBlob(s=>{s?t(s):r(new Error("Failed to convert to PNG"))},"image/png",1)},n.onerror=()=>{URL.revokeObjectURL(o),r(new Error("Failed to load image"))},n.src=o}),OV=async e=>{const t=(e.type||"").toLowerCase();return t==="image/png"||t==="image/svg+xml"?{[t]:e}:{"image/png":await NV(e)}},LV=e=>{try{const t=new URL(e).pathname.match(/\/([^/]+)$/);return t?decodeURIComponent(t[1]):"image"}catch{return"image"}},HV=e=>{var t;return{"image/svg+xml":"svg","image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/webp":"webp","image/gif":"gif"}[e==null?void 0:e.toLowerCase()]||((t=e==null?void 0:e.split("/")[1])==null?void 0:t.split("+")[0])||"png"},n9=u.memo(({children:e,info:t,minScale:r,maxScale:n})=>{const{t:o}=IW(PV),[i,a]=u.useState(null),[s,l]=u.useState(!1),[c,d]=u.useState(!1),{transform:{scale:f},actions:{onFlipY:p,onFlipX:m,onRotateLeft:h,onRotateRight:g,onZoomOut:y,onZoomIn:b},image:{url:v}}=t,x=u.useCallback(async()=>{d(!0);try{const S=await(await fetch(v,{mode:"cors"})).blob(),C=URL.createObjectURL(S);let k=LV(v);const D=HV(S.type);k.includes(".")?k.endsWith(".svg+xml")&&(k=k.replace(/\.svg\+xml$/i,".svg")):k=`${k}.${D}`,await jW(C,k),URL.revokeObjectURL(C),Wa.success(o("image.downloadSuccess"))}catch{Wa.error(o("image.downloadFailed"))}finally{d(!1)}},[v,o]),w=u.useCallback(async()=>{l(!0);try{const S=await OV(await(await fetch(v,{mode:"cors"})).blob());await navigator.clipboard.write([new ClipboardItem(S)]),Wa.success(o("image.copySuccess"))}catch{Wa.error(o("image.copyFailed"))}finally{l(!1)}},[v,o]);return N.jsx(E1,{popupContainer:i??void 0,children:N.jsxs(or,{horizontal:!0,className:Cn.toolbar,gap:4,ref:a,children:[N.jsx(dn,{icon:XH,title:o("image.flipHorizontal"),onClick:m}),N.jsx(dn,{icon:GH,title:o("image.flipVertical"),onClick:p}),N.jsx(dn,{icon:OH,title:o("image.rotateLeft"),onClick:h}),N.jsx(dn,{icon:HH,title:o("image.rotateRight"),onClick:g}),N.jsx(dn,{disabled:f===r,icon:tq,title:o("image.zoomOut"),onClick:y}),N.jsx(dn,{disabled:f===n,icon:JH,title:o("image.zoomIn"),onClick:b}),N.jsx(dn,{icon:Zw,loading:s,title:o("image.copy"),onClick:w}),N.jsx(dn,{icon:EH,loading:c,title:o("image.download"),onClick:x}),e]})})}),qV=e=>{const[t,r]=u.useState(!1);return u.useMemo(()=>{if(e===!1)return e;const{onVisibleChange:n,onOpenChange:o,minScale:i=.32,maxScale:a=32,toolbarAddon:s,rootClassName:l,imageRender:c,toolbarRender:d,...f}=e===!0?{}:e||{};return{actionsRender:(p,m)=>{const h=N.jsx(n9,{info:m,maxScale:a,minScale:i,children:s});return d?d(h,m):h},closeIcon:N.jsx(jt,{color:"#fff",icon:Wu}),imageRender:(p,m)=>{const h=N.jsx(r9,{visible:t,children:p});return c?c(h,m):h},maxScale:a,minScale:i,onOpenChange:(p,m)=>{r(p),o==null||o(p,m),n==null||n(p,!p,m.current)},rootClassName:Fe(Cn.preview,l),...f}},[e,t,Cn])},{PreviewGroup:WV}=l1,o9=u.memo(({items:e,children:t,enable:r=!0,preview:n})=>{const o=qV(n);return r?N.jsx(WV,{items:e,preview:o,children:t}):t});o9.displayName="PreviewGroup";const VV=e=>{const[t,r]=u.useState(!1);return u.useMemo(()=>{if(e===!1)return e;const{onVisibleChange:n,onOpenChange:o,minScale:i=.32,maxScale:a=32,toolbarAddon:s,rootClassName:l,imageRender:c,toolbarRender:d,actionsRender:f,...p}=e===!0?{}:e||{};return{actionsRender:f||((m,h)=>{const g=N.jsx(n9,{info:h,maxScale:a,minScale:i,children:s});return d?d(g,h):g}),closeIcon:N.jsx(jt,{color:"#fff",icon:Wu}),imageRender:(m,h)=>{const g=N.jsx(r9,{visible:t,children:m});return c?c(g,h):g},maxScale:a,minScale:i,onOpenChange:m=>{r(m),o==null||o(m),n==null||n(m,!m)},rootClassName:Fe(Cn.preview,l),styles:{mask:{backdropFilter:"blur(8px)"}},...p}},[e,t,Cn])},i9=u.memo(({ref:e,style:t,preview:r,isLoading:n,maxHeight:o="100%",maxWidth:i="100%",minHeight:a,minWidth:s,actions:l,className:c,alwaysShowActions:d,variant:f="filled",objectFit:p="cover",classNames:m,styles:h,onClick:g,width:y,height:b,...v})=>{const{isDarkMode:x}=En(),w=d?Cn.actionsVisible:Cn.actionsHidden,S=VV(r);return n?N.jsx("div",{onClick:g,children:N.jsx(la.Avatar,{active:!0,style:{borderRadius:Ce.borderRadius,height:b,maxHeight:o,maxWidth:i,minHeight:a,minWidth:s,width:y}})}):N.jsxs(or,{className:Fe(RV({variant:f}),c),ref:e,style:t,children:[l&&N.jsx("div",{className:Fe(w,d?"":"actions-hidden"),children:l}),N.jsx(l1,{className:Fe(Cn.image,m==null?void 0:m.image),fallback:x?zV:BV,height:b,loading:"lazy",preview:r===!1?!1:S,width:y,classNames:{root:Fe(Cn.wrapper,m==null?void 0:m.wrapper)},style:{maxHeight:o,maxWidth:i,minHeight:a,minWidth:s,objectFit:p||"cover",...h==null?void 0:h.image},styles:{root:h==null?void 0:h.wrapper},onClick:g,...v})]})});i9.displayName="Image";const B1=i9;B1.PreviewGroup=o9;const a9=[{displayName:"Lobe Theme",id:"lobe-theme"},{background:"#fbf9ff",displayName:"Mermaid Default",id:"default"},{background:"#fffcf8",displayName:"Mermaid Base",id:"base"},{background:"#000",displayName:"Mermaid Dark",id:"dark"},{background:"#f9ffeb",displayName:"Mermaid Forest",id:"forest"},{background:"#fff",displayName:"Mermaid Neutral",id:"neutral"}],Zo=new Map,Jy=500,GV=()=>{if(Zo.size>Jy){const e=Math.floor(Jy*.2),t=Array.from(Zo.keys()).slice(0,e);for(const r of t)Zo.delete(r)}};let Sf=null;const s9=()=>typeof window>"u"?Promise.resolve(null):(Sf||(Sf=Nh(()=>import("./diagram-CT58wBdU.js").then(e=>e.z),__vite__mapDeps([0,1])).then(e=>e.default)),Sf),l9=(e,t,r="strict")=>({fontFamily:e.fontFamilyCode,gantt:{useWidth:1920},securityLevel:r,startOnLoad:!1,theme:t||(e.isDarkMode?"dark":"neutral"),themeVariables:t?void 0:{errorBkgColor:e.colorTextDescription,errorTextColor:e.colorTextDescription,fontFamily:e.fontFamily,lineColor:e.colorTextSecondary,mainBkg:e.colorBgContainer,noteBkgColor:e.colorInfoBg,noteTextColor:e.colorInfoText,pie1:e.geekblue,pie2:e.colorWarning,pie3:e.colorSuccess,pie4:e.colorError,primaryBorderColor:e.colorBorder,primaryColor:e.colorBgContainer,primaryTextColor:e.colorText,secondaryBorderColor:e.colorInfoBorder,secondaryColor:e.colorInfoBg,secondaryTextColor:e.colorInfoText,tertiaryBorderColor:e.colorSuccessBorder,tertiaryColor:e.colorSuccessBg,tertiaryTextColor:e.colorSuccessText,textColor:e.colorText}}),UV=(e,{id:t,theme:r,securityLevel:n})=>{const o=m1(),[i,a]=u.useState(""),s=u.useMemo(()=>l9(o,r,n),[o.fontFamilyCode,o.isDarkMode,o.colorTextDescription,o.fontFamily,o.colorTextSecondary,o.colorBgContainer,o.colorInfoBg,o.colorInfoText,o.geekblue,o.colorWarning,o.colorSuccess,o.colorError,o.colorBorder,o.colorInfoBorder,o.colorSuccessBorder,o.colorSuccessBg,o.colorSuccessText,o.colorText,r,n]),l=u.useMemo(()=>{const c=e.length<1e4?e:Il.hashStr(e);return[t,r||(o.isDarkMode?"d":"l"),c].filter(Boolean).join("-")},[e,t,o.isDarkMode,r]);return u.useEffect(()=>{const c=Zo.get(l);if(c){c.then(f=>{a(f)}).catch(()=>{});return}const d=(async()=>{try{const f=await s9();if(!f)return"";if(await f.parse(e)){f.initialize(s);const{svg:p}=await f.render(t,e);return p}else throw new Error("Mermaid 语法无效")}catch(f){return console.error("Mermaid 解析错误:",f),""}})();Zo.set(l,d),GV(),d.then(f=>{Zo.get(l)===d&&a(f)}).catch(()=>{Zo.get(l)===d&&Zo.delete(l)})},[l,e,t,s]),i},c9=u.memo(({children:e,className:t,fallbackClassName:r,ref:n,style:o,theme:i,variant:a})=>{const s=e??"",l=i==="lobe-theme"||!i,c=u.useMemo(()=>{var g;if(!l)return(g=a9.find(y=>y.id===i))==null?void 0:g.background},[l,i]),d=UV(s,{id:Lw(`mermaid-${u.useId()}`),theme:l?void 0:i}),f=!d,[p,m]=u.useState();u.useEffect(()=>()=>{p&&URL.revokeObjectURL(p)},[p]),u.useEffect(()=>{if(f||!d)return;let g=d;if(typeof window<"u"&&typeof navigator<"u"&&navigator.userAgent.includes("Firefox")){const b=new DOMParser().parseFromString(d,"image/svg+xml"),v=b.documentElement;if(v&&v.hasAttribute("viewBox")){const x=v.getAttribute("viewBox").split(" ");Array.isArray(x)&&x.length===4&&(v.setAttribute("width",x[2]),v.setAttribute("height",x[3])),g=new XMLSerializer().serializeToString(b)}}const y=new Blob([g],{type:"image/svg+xml"});m(URL.createObjectURL(y))},[f,d]);const h={background:a==="filled"?c:void 0,margin:0,minWidth:300,padding:a==="borderless"?0:16,position:"relative",width:"100%",...o};return p?N.jsx(B1,{alt:"mermaid",className:t,maxHeight:480,minWidth:300,objectFit:"contain",ref:n,src:p,style:h,variant:"borderless",width:"100%"}):N.jsx("div",{className:r,style:o,children:N.jsx("div",{style:{padding:16},children:"Loading..."})})});c9.displayName="StaticMermaid";const XV=(e,{enabled:t=!0,id:r,theme:n})=>{const o=m1(),[i,a]=u.useState(""),s=u.useRef(""),l=u.useRef(e),c=u.useRef(void 0),d=u.useMemo(()=>l9(o,n),[o.fontFamilyCode,o.isDarkMode,o.colorTextDescription,o.fontFamily,o.colorTextSecondary,o.colorBgContainer,o.colorInfoBg,o.colorInfoText,o.geekblue,o.colorWarning,o.colorSuccess,o.colorError,o.colorBorder,o.colorInfoBorder,o.colorSuccessBorder,o.colorSuccessBg,o.colorSuccessText,o.colorText,n]);return u.useEffect(()=>{l.current=e},[e]),u.useEffect(()=>{if(!t){a(""),s.current="";const m=c.current;m&&clearTimeout(m);return}const f=l.current;if(f===s.current&&i)return;const p=c.current;return p&&clearTimeout(p),c.current=setTimeout(async()=>{const m=l.current;if(m===f)try{const h=await s9();if(!h)return;if(await h.parse(m)){h.initialize(d);const{svg:g}=await h.render(r,m);l.current===m&&(a(g),s.current=m)}}catch(h){m===l.current&&console.error("Mermaid 解析错误:",h)}},300),()=>{const m=c.current;m&&clearTimeout(m)}},[t,e,r,d,i]),i},u9=u.memo(({children:e,className:t,fallbackClassName:r,ref:n,style:o,theme:i,variant:a})=>{const s=e??"",l=i==="lobe-theme"||!i,c=u.useMemo(()=>{var g;if(!l)return(g=a9.find(y=>y.id===i))==null?void 0:g.background},[l,i]),d=XV(s,{enabled:!0,id:Lw(`mermaid-${u.useId()}`),theme:l?void 0:i}),f=!d,[p,m]=u.useState();u.useEffect(()=>()=>{p&&URL.revokeObjectURL(p)},[p]),u.useEffect(()=>{if(f||!d){m(void 0);return}let g=d;if(typeof window<"u"&&typeof navigator<"u"&&navigator.userAgent.includes("Firefox")){const b=new DOMParser().parseFromString(d,"image/svg+xml"),v=b.documentElement;if(v&&v.hasAttribute("viewBox")){const x=v.getAttribute("viewBox").split(" ");Array.isArray(x)&&x.length===4&&(v.setAttribute("width",x[2]),v.setAttribute("height",x[3])),g=new XMLSerializer().serializeToString(b)}}const y=new Blob([g],{type:"image/svg+xml"});m(URL.createObjectURL(y))},[f,d]);const h={background:a==="filled"?c:void 0,margin:0,minWidth:300,padding:a==="borderless"?0:16,position:"relative",width:"100%",...o};return p?N.jsx(B1,{alt:"mermaid",className:t,maxHeight:480,minWidth:300,objectFit:"contain",ref:n,src:p,style:h,variant:"borderless",width:"100%"}):N.jsx("div",{className:r,style:o,children:N.jsx("div",{style:{padding:16},children:"Rendering..."})})});u9.displayName="StreamMermaid";const YV=tc`
2447
+ `})),RV=ur(Cn.root,{defaultVariants:{variant:"filled"},variants:{variant:{filled:Cn.filled,outlined:Cn.outlined,borderless:Cn.borderless}}}),zV="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjU2IiBoZWlnaHQ9IjI1NiIgdmlld0JveD0iMCAwIDI1NiAyNTYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIyNTYiIGhlaWdodD0iMjU2IiBmaWxsPSIjM0IzQjNCIi8+CjxwYXRoIGQ9Ik0xNTYuODg4IDkxLjAwMkgxMDAuMTEyQzk1LjYzMjkgOTEuMDAyIDkyLjAwMTUgOTQuNjMzNCA5Mi4wMDE1IDk5LjExMjdWMTU1Ljg4OEM5Mi4wMDE1IDE2MC4zNjcgOTUuNjMyOSAxNjMuOTk5IDEwMC4xMTIgMTYzLjk5OUgxNTYuODg4QzE2MS4zNjcgMTYzLjk5OSAxNjQuOTk4IDE2MC4zNjcgMTY0Ljk5OCAxNTUuODg4Vjk5LjExMjdDMTY0Ljk5OCA5NC42MzM0IDE2MS4zNjcgOTEuMDAyIDE1Ni44ODggOTEuMDAyWiIgc3Ryb2tlPSIjNjI2MjYyIiBzdHJva2Utd2lkdGg9IjguMTEwNzciIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8cGF0aCBkPSJNMTY0Ljk5OCAxMzkuNjY4TDE1Mi40ODQgMTI3LjE1M0MxNTAuOTYyIDEyNS42MzIgMTQ4LjkgMTI0Ljc3OCAxNDYuNzQ5IDEyNC43NzhDMTQ0LjU5OSAxMjQuNzc4IDE0Mi41MzYgMTI1LjYzMiAxNDEuMDE1IDEyNy4xNTNMMTA0LjE2OCAxNjRNMTE2LjMzNCAxMjMuNDQ1QzEyMC44MTMgMTIzLjQ0NSAxMjQuNDQ1IDExOS44MTQgMTI0LjQ0NSAxMTUuMzM0QzEyNC40NDUgMTEwLjg1NSAxMjAuODEzIDEwNy4yMjQgMTE2LjMzNCAxMDcuMjI0QzExMS44NTUgMTA3LjIyNCAxMDguMjIzIDExMC44NTUgMTA4LjIyMyAxMTUuMzM0QzEwOC4yMjMgMTE5LjgxNCAxMTEuODU1IDEyMy40NDUgMTE2LjMzNCAxMjMuNDQ1WiIgc3Ryb2tlPSIjNjI2MjYyIiBzdHJva2Utd2lkdGg9IjguMTEwNzciIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4K",BV="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjU2IiBoZWlnaHQ9IjI1NiIgdmlld0JveD0iMCAwIDI1NiAyNTYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIyNTYiIGhlaWdodD0iMjU2IiBmaWxsPSIjRUNFQ0VDIi8+CjxwYXRoIGQ9Ik0xNTYuODg4IDkxLjAwMkgxMDAuMTEyQzk1LjYzMjkgOTEuMDAyIDkyLjAwMTUgOTQuNjMzNCA5Mi4wMDE1IDk5LjExMjdWMTU1Ljg4OEM5Mi4wMDE1IDE2MC4zNjcgOTUuNjMyOSAxNjMuOTk5IDEwMC4xMTIgMTYzLjk5OUgxNTYuODg4QzE2MS4zNjcgMTYzLjk5OSAxNjQuOTk4IDE2MC4zNjcgMTY0Ljk5OCAxNTUuODg4Vjk5LjExMjdDMTY0Ljk5OCA5NC42MzM0IDE2MS4zNjcgOTEuMDAyIDE1Ni44ODggOTEuMDAyWiIgc3Ryb2tlPSIjRDdEN0Q3IiBzdHJva2Utd2lkdGg9IjguMTEwNzciIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8cGF0aCBkPSJNMTY0Ljk5OCAxMzkuNjY4TDE1Mi40ODQgMTI3LjE1M0MxNTAuOTYyIDEyNS42MzIgMTQ4LjkgMTI0Ljc3OCAxNDYuNzQ5IDEyNC43NzhDMTQ0LjU5OSAxMjQuNzc4IDE0Mi41MzYgMTI1LjYzMiAxNDEuMDE1IDEyNy4xNTNMMTA0LjE2OCAxNjRNMTE2LjMzNCAxMjMuNDQ1QzEyMC44MTMgMTIzLjQ0NSAxMjQuNDQ1IDExOS44MTQgMTI0LjQ0NSAxMTUuMzM0QzEyNC40NDUgMTEwLjg1NSAxMjAuODEzIDEwNy4yMjQgMTE2LjMzNCAxMDcuMjI0QzExMS44NTUgMTA3LjIyNCAxMDguMjIzIDExMC44NTUgMTA4LjIyMyAxMTUuMzM0QzEwOC4yMjMgMTE5LjgxNCAxMTEuODU1IDEyMy40NDUgMTE2LjMzNCAxMjMuNDQ1WiIgc3Ryb2tlPSIjRDdEN0Q3IiBzdHJva2Utd2lkdGg9IjguMTEwNzciIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4K",r9=u.memo(({children:e,visible:t})=>{const r=u.useRef(null);return u.useEffect(()=>{if(!r.current)return;const n=o=>{o.preventDefault()};t?r.current.addEventListener("wheel",n,{passive:!1}):r.current.removeEventListener("wheel",n)},[t]),N.jsx("div",{ref:r,children:e})});var PV={"image.copy":"Copy","image.copyFailed":"Copy Failed","image.copySuccess":"Copy Success","image.download":"Download","image.downloadFailed":"Download Failed","image.downloadSuccess":"Download Success","image.flipHorizontal":"Flip Horizontal","image.flipVertical":"Flip Vertical","image.rotateLeft":"Rotate Left","image.rotateRight":"Rotate Right","image.zoomIn":"Zoom In","image.zoomOut":"Zoom Out"};const NV=e=>new Promise((t,r)=>{const n=new Image,o=URL.createObjectURL(e);n.onload=()=>{URL.revokeObjectURL(o);const i=document.createElement("canvas");i.width=n.naturalWidth,i.height=n.naturalHeight;const a=i.getContext("2d");if(!a){r(new Error("Canvas context not available"));return}a.drawImage(n,0,0),i.toBlob(s=>{s?t(s):r(new Error("Failed to convert to PNG"))},"image/png",1)},n.onerror=()=>{URL.revokeObjectURL(o),r(new Error("Failed to load image"))},n.src=o}),OV=async e=>{const t=(e.type||"").toLowerCase();return t==="image/png"||t==="image/svg+xml"?{[t]:e}:{"image/png":await NV(e)}},LV=e=>{try{const t=new URL(e).pathname.match(/\/([^/]+)$/);return t?decodeURIComponent(t[1]):"image"}catch{return"image"}},HV=e=>{var t;return{"image/svg+xml":"svg","image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/webp":"webp","image/gif":"gif"}[e==null?void 0:e.toLowerCase()]||((t=e==null?void 0:e.split("/")[1])==null?void 0:t.split("+")[0])||"png"},n9=u.memo(({children:e,info:t,minScale:r,maxScale:n})=>{const{t:o}=IW(PV),[i,a]=u.useState(null),[s,l]=u.useState(!1),[c,d]=u.useState(!1),{transform:{scale:f},actions:{onFlipY:p,onFlipX:m,onRotateLeft:h,onRotateRight:g,onZoomOut:y,onZoomIn:b},image:{url:v}}=t,x=u.useCallback(async()=>{d(!0);try{const S=await(await fetch(v,{mode:"cors"})).blob(),C=URL.createObjectURL(S);let k=LV(v);const D=HV(S.type);k.includes(".")?k.endsWith(".svg+xml")&&(k=k.replace(/\.svg\+xml$/i,".svg")):k=`${k}.${D}`,await jW(C,k),URL.revokeObjectURL(C),Wa.success(o("image.downloadSuccess"))}catch{Wa.error(o("image.downloadFailed"))}finally{d(!1)}},[v,o]),w=u.useCallback(async()=>{l(!0);try{const S=await OV(await(await fetch(v,{mode:"cors"})).blob());await navigator.clipboard.write([new ClipboardItem(S)]),Wa.success(o("image.copySuccess"))}catch{Wa.error(o("image.copyFailed"))}finally{l(!1)}},[v,o]);return N.jsx(E1,{popupContainer:i??void 0,children:N.jsxs(or,{horizontal:!0,className:Cn.toolbar,gap:4,ref:a,children:[N.jsx(dn,{icon:XH,title:o("image.flipHorizontal"),onClick:m}),N.jsx(dn,{icon:GH,title:o("image.flipVertical"),onClick:p}),N.jsx(dn,{icon:OH,title:o("image.rotateLeft"),onClick:h}),N.jsx(dn,{icon:HH,title:o("image.rotateRight"),onClick:g}),N.jsx(dn,{disabled:f===r,icon:tq,title:o("image.zoomOut"),onClick:y}),N.jsx(dn,{disabled:f===n,icon:JH,title:o("image.zoomIn"),onClick:b}),N.jsx(dn,{icon:Zw,loading:s,title:o("image.copy"),onClick:w}),N.jsx(dn,{icon:EH,loading:c,title:o("image.download"),onClick:x}),e]})})}),qV=e=>{const[t,r]=u.useState(!1);return u.useMemo(()=>{if(e===!1)return e;const{onVisibleChange:n,onOpenChange:o,minScale:i=.32,maxScale:a=32,toolbarAddon:s,rootClassName:l,imageRender:c,toolbarRender:d,...f}=e===!0?{}:e||{};return{actionsRender:(p,m)=>{const h=N.jsx(n9,{info:m,maxScale:a,minScale:i,children:s});return d?d(h,m):h},closeIcon:N.jsx(jt,{color:"#fff",icon:Wu}),imageRender:(p,m)=>{const h=N.jsx(r9,{visible:t,children:p});return c?c(h,m):h},maxScale:a,minScale:i,onOpenChange:(p,m)=>{r(p),o==null||o(p,m),n==null||n(p,!p,m.current)},rootClassName:Fe(Cn.preview,l),...f}},[e,t,Cn])},{PreviewGroup:WV}=l1,o9=u.memo(({items:e,children:t,enable:r=!0,preview:n})=>{const o=qV(n);return r?N.jsx(WV,{items:e,preview:o,children:t}):t});o9.displayName="PreviewGroup";const VV=e=>{const[t,r]=u.useState(!1);return u.useMemo(()=>{if(e===!1)return e;const{onVisibleChange:n,onOpenChange:o,minScale:i=.32,maxScale:a=32,toolbarAddon:s,rootClassName:l,imageRender:c,toolbarRender:d,actionsRender:f,...p}=e===!0?{}:e||{};return{actionsRender:f||((m,h)=>{const g=N.jsx(n9,{info:h,maxScale:a,minScale:i,children:s});return d?d(g,h):g}),closeIcon:N.jsx(jt,{color:"#fff",icon:Wu}),imageRender:(m,h)=>{const g=N.jsx(r9,{visible:t,children:m});return c?c(g,h):g},maxScale:a,minScale:i,onOpenChange:m=>{r(m),o==null||o(m),n==null||n(m,!m)},rootClassName:Fe(Cn.preview,l),styles:{mask:{backdropFilter:"blur(8px)"}},...p}},[e,t,Cn])},i9=u.memo(({ref:e,style:t,preview:r,isLoading:n,maxHeight:o="100%",maxWidth:i="100%",minHeight:a,minWidth:s,actions:l,className:c,alwaysShowActions:d,variant:f="filled",objectFit:p="cover",classNames:m,styles:h,onClick:g,width:y,height:b,...v})=>{const{isDarkMode:x}=En(),w=d?Cn.actionsVisible:Cn.actionsHidden,S=VV(r);return n?N.jsx("div",{onClick:g,children:N.jsx(la.Avatar,{active:!0,style:{borderRadius:Ce.borderRadius,height:b,maxHeight:o,maxWidth:i,minHeight:a,minWidth:s,width:y}})}):N.jsxs(or,{className:Fe(RV({variant:f}),c),ref:e,style:t,children:[l&&N.jsx("div",{className:Fe(w,d?"":"actions-hidden"),children:l}),N.jsx(l1,{className:Fe(Cn.image,m==null?void 0:m.image),fallback:x?zV:BV,height:b,loading:"lazy",preview:r===!1?!1:S,width:y,classNames:{root:Fe(Cn.wrapper,m==null?void 0:m.wrapper)},style:{maxHeight:o,maxWidth:i,minHeight:a,minWidth:s,objectFit:p||"cover",...h==null?void 0:h.image},styles:{root:h==null?void 0:h.wrapper},onClick:g,...v})]})});i9.displayName="Image";const B1=i9;B1.PreviewGroup=o9;const a9=[{displayName:"Lobe Theme",id:"lobe-theme"},{background:"#fbf9ff",displayName:"Mermaid Default",id:"default"},{background:"#fffcf8",displayName:"Mermaid Base",id:"base"},{background:"#000",displayName:"Mermaid Dark",id:"dark"},{background:"#f9ffeb",displayName:"Mermaid Forest",id:"forest"},{background:"#fff",displayName:"Mermaid Neutral",id:"neutral"}],Zo=new Map,Jy=500,GV=()=>{if(Zo.size>Jy){const e=Math.floor(Jy*.2),t=Array.from(Zo.keys()).slice(0,e);for(const r of t)Zo.delete(r)}};let Sf=null;const s9=()=>typeof window>"u"?Promise.resolve(null):(Sf||(Sf=Nh(()=>import("./diagram-DtU2xxz3.js").then(e=>e.z),__vite__mapDeps([0,1])).then(e=>e.default)),Sf),l9=(e,t,r="strict")=>({fontFamily:e.fontFamilyCode,gantt:{useWidth:1920},securityLevel:r,startOnLoad:!1,theme:t||(e.isDarkMode?"dark":"neutral"),themeVariables:t?void 0:{errorBkgColor:e.colorTextDescription,errorTextColor:e.colorTextDescription,fontFamily:e.fontFamily,lineColor:e.colorTextSecondary,mainBkg:e.colorBgContainer,noteBkgColor:e.colorInfoBg,noteTextColor:e.colorInfoText,pie1:e.geekblue,pie2:e.colorWarning,pie3:e.colorSuccess,pie4:e.colorError,primaryBorderColor:e.colorBorder,primaryColor:e.colorBgContainer,primaryTextColor:e.colorText,secondaryBorderColor:e.colorInfoBorder,secondaryColor:e.colorInfoBg,secondaryTextColor:e.colorInfoText,tertiaryBorderColor:e.colorSuccessBorder,tertiaryColor:e.colorSuccessBg,tertiaryTextColor:e.colorSuccessText,textColor:e.colorText}}),UV=(e,{id:t,theme:r,securityLevel:n})=>{const o=m1(),[i,a]=u.useState(""),s=u.useMemo(()=>l9(o,r,n),[o.fontFamilyCode,o.isDarkMode,o.colorTextDescription,o.fontFamily,o.colorTextSecondary,o.colorBgContainer,o.colorInfoBg,o.colorInfoText,o.geekblue,o.colorWarning,o.colorSuccess,o.colorError,o.colorBorder,o.colorInfoBorder,o.colorSuccessBorder,o.colorSuccessBg,o.colorSuccessText,o.colorText,r,n]),l=u.useMemo(()=>{const c=e.length<1e4?e:Il.hashStr(e);return[t,r||(o.isDarkMode?"d":"l"),c].filter(Boolean).join("-")},[e,t,o.isDarkMode,r]);return u.useEffect(()=>{const c=Zo.get(l);if(c){c.then(f=>{a(f)}).catch(()=>{});return}const d=(async()=>{try{const f=await s9();if(!f)return"";if(await f.parse(e)){f.initialize(s);const{svg:p}=await f.render(t,e);return p}else throw new Error("Mermaid 语法无效")}catch(f){return console.error("Mermaid 解析错误:",f),""}})();Zo.set(l,d),GV(),d.then(f=>{Zo.get(l)===d&&a(f)}).catch(()=>{Zo.get(l)===d&&Zo.delete(l)})},[l,e,t,s]),i},c9=u.memo(({children:e,className:t,fallbackClassName:r,ref:n,style:o,theme:i,variant:a})=>{const s=e??"",l=i==="lobe-theme"||!i,c=u.useMemo(()=>{var g;if(!l)return(g=a9.find(y=>y.id===i))==null?void 0:g.background},[l,i]),d=UV(s,{id:Lw(`mermaid-${u.useId()}`),theme:l?void 0:i}),f=!d,[p,m]=u.useState();u.useEffect(()=>()=>{p&&URL.revokeObjectURL(p)},[p]),u.useEffect(()=>{if(f||!d)return;let g=d;if(typeof window<"u"&&typeof navigator<"u"&&navigator.userAgent.includes("Firefox")){const b=new DOMParser().parseFromString(d,"image/svg+xml"),v=b.documentElement;if(v&&v.hasAttribute("viewBox")){const x=v.getAttribute("viewBox").split(" ");Array.isArray(x)&&x.length===4&&(v.setAttribute("width",x[2]),v.setAttribute("height",x[3])),g=new XMLSerializer().serializeToString(b)}}const y=new Blob([g],{type:"image/svg+xml"});m(URL.createObjectURL(y))},[f,d]);const h={background:a==="filled"?c:void 0,margin:0,minWidth:300,padding:a==="borderless"?0:16,position:"relative",width:"100%",...o};return p?N.jsx(B1,{alt:"mermaid",className:t,maxHeight:480,minWidth:300,objectFit:"contain",ref:n,src:p,style:h,variant:"borderless",width:"100%"}):N.jsx("div",{className:r,style:o,children:N.jsx("div",{style:{padding:16},children:"Loading..."})})});c9.displayName="StaticMermaid";const XV=(e,{enabled:t=!0,id:r,theme:n})=>{const o=m1(),[i,a]=u.useState(""),s=u.useRef(""),l=u.useRef(e),c=u.useRef(void 0),d=u.useMemo(()=>l9(o,n),[o.fontFamilyCode,o.isDarkMode,o.colorTextDescription,o.fontFamily,o.colorTextSecondary,o.colorBgContainer,o.colorInfoBg,o.colorInfoText,o.geekblue,o.colorWarning,o.colorSuccess,o.colorError,o.colorBorder,o.colorInfoBorder,o.colorSuccessBorder,o.colorSuccessBg,o.colorSuccessText,o.colorText,n]);return u.useEffect(()=>{l.current=e},[e]),u.useEffect(()=>{if(!t){a(""),s.current="";const m=c.current;m&&clearTimeout(m);return}const f=l.current;if(f===s.current&&i)return;const p=c.current;return p&&clearTimeout(p),c.current=setTimeout(async()=>{const m=l.current;if(m===f)try{const h=await s9();if(!h)return;if(await h.parse(m)){h.initialize(d);const{svg:g}=await h.render(r,m);l.current===m&&(a(g),s.current=m)}}catch(h){m===l.current&&console.error("Mermaid 解析错误:",h)}},300),()=>{const m=c.current;m&&clearTimeout(m)}},[t,e,r,d,i]),i},u9=u.memo(({children:e,className:t,fallbackClassName:r,ref:n,style:o,theme:i,variant:a})=>{const s=e??"",l=i==="lobe-theme"||!i,c=u.useMemo(()=>{var g;if(!l)return(g=a9.find(y=>y.id===i))==null?void 0:g.background},[l,i]),d=XV(s,{enabled:!0,id:Lw(`mermaid-${u.useId()}`),theme:l?void 0:i}),f=!d,[p,m]=u.useState();u.useEffect(()=>()=>{p&&URL.revokeObjectURL(p)},[p]),u.useEffect(()=>{if(f||!d){m(void 0);return}let g=d;if(typeof window<"u"&&typeof navigator<"u"&&navigator.userAgent.includes("Firefox")){const b=new DOMParser().parseFromString(d,"image/svg+xml"),v=b.documentElement;if(v&&v.hasAttribute("viewBox")){const x=v.getAttribute("viewBox").split(" ");Array.isArray(x)&&x.length===4&&(v.setAttribute("width",x[2]),v.setAttribute("height",x[3])),g=new XMLSerializer().serializeToString(b)}}const y=new Blob([g],{type:"image/svg+xml"});m(URL.createObjectURL(y))},[f,d]);const h={background:a==="filled"?c:void 0,margin:0,minWidth:300,padding:a==="borderless"?0:16,position:"relative",width:"100%",...o};return p?N.jsx(B1,{alt:"mermaid",className:t,maxHeight:480,minWidth:300,objectFit:"contain",ref:n,src:p,style:h,variant:"borderless",width:"100%"}):N.jsx("div",{className:r,style:o,children:N.jsx("div",{style:{padding:16},children:"Rendering..."})})});u9.displayName="StreamMermaid";const YV=tc`
2448
2448
  0% {
2449
2449
  opacity: 0;
2450
2450
  }
@@ -3113,4 +3113,4 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
3113
3113
  `,viewportTopRight:e`
3114
3114
  inset-block-start: 16px;
3115
3115
  inset-inline-end: 16px;
3116
- `})),Uee=ur(Nt.viewport,{defaultVariants:{position:"bottom-right"},variants:{position:{bottom:Nt.viewportBottom,"bottom-left":Nt.viewportBottomLeft,"bottom-right":Nt.viewportBottomRight,top:Nt.viewportTop,"top-left":Nt.viewportTopLeft,"top-right":Nt.viewportTopRight}}}),Xee=ur(Nt.root,{defaultVariants:{position:"bottom-right"},variants:{position:{bottom:Nt.rootBottom,"bottom-left":Nt.rootBottom,"bottom-right":Nt.rootBottom,top:Nt.rootTop,"top-left":Nt.rootTop,"top-right":Nt.rootTop}}}),F5=ur(Nt.action,{defaultVariants:{variant:"primary"},variants:{variant:{danger:Nt.actionDanger,ghost:Nt.actionGhost,primary:Nt.actionPrimary,secondary:Nt.actionSecondary,text:Nt.actionText}}}),Yee={default:Iy,error:xH,info:Iy,loading:Vd,success:vH,warning:KH},Kee={default:Ce.colorText,error:Ce.colorError,info:Ce.colorInfo,loading:Ce.colorPrimary,success:Ce.colorSuccess,warning:Ce.colorWarning},pS=u.memo(({toast:e,classNames:t,styles:r})=>{const{position:n,swipeDirection:o}=Gee(),i=e.data,a=(i==null?void 0:i.type)??"default",s=(i==null?void 0:i.closable)??!0,l=(i==null?void 0:i.hideCloseButton)??!1,c=s&&!l,d=i==null?void 0:i.icon,f=e.title??(i==null?void 0:i.title),p=e.description??(i==null?void 0:i.description),m=e.actionProps??(i==null?void 0:i.actionProps),h=i==null?void 0:i.actions,g=Kee[a],y=d??Yee[a],b=a==="loading",v=()=>y?N.jsx("div",{className:Fe(Nt.icon,t==null?void 0:t.icon),style:r==null?void 0:r.icon,children:N.jsx(jt,{color:g,icon:y,size:18,spin:b})}):null,x=()=>h&&h.length>0?N.jsx("div",{className:Fe(Nt.actions,t==null?void 0:t.actions),style:r==null?void 0:r.actions,children:h.map((w,S)=>N.jsx($b,{style:r==null?void 0:r.action,className:Fe(F5({variant:w.variant??"primary"}),t==null?void 0:t.action),onClick:w.onClick,...w.props,children:w.label},S))}):m?N.jsx($b,{className:Fe(F5({variant:"primary"}),t==null?void 0:t.action),style:r==null?void 0:r.action,...m}):null;return N.jsx(XS,{className:Fe(Xee({position:n}),t==null?void 0:t.root),swipeDirection:o,toast:e,style:{...r==null?void 0:r.root,...i==null?void 0:i.style},children:N.jsx(YS,{className:Fe(Nt.content,t==null?void 0:t.content),style:r==null?void 0:r.content,children:N.jsxs("div",{className:f?Nt.toastBody:Nt.toastBodyCenter,children:[v(),N.jsxs("div",{className:Nt.contentArea,children:[f?N.jsxs(N.Fragment,{children:[N.jsxs("div",{className:Nt.titleRow,children:[N.jsx(KS,{className:Fe(Nt.title,t==null?void 0:t.title),style:r==null?void 0:r.title,children:f}),c&&N.jsx(Sb,{"aria-label":"Close",className:Fe(Nt.close,t==null?void 0:t.close),style:r==null?void 0:r.close,children:N.jsx(Wu,{size:14})})]}),p&&N.jsx(kb,{className:Fe(Nt.description,t==null?void 0:t.description),style:{marginBlockStart:4,...r==null?void 0:r.description},children:p})]}):p&&N.jsxs("div",{className:Nt.titleRow,children:[N.jsx(kb,{className:Fe(Nt.description,t==null?void 0:t.description),style:r==null?void 0:r.description,children:p}),c&&N.jsx(Sb,{"aria-label":"Close",className:Fe(Nt.close,t==null?void 0:t.close),style:r==null?void 0:r.close,children:N.jsx(Wu,{size:14})})]}),x()]})]})})})});pS.displayName="ToastItem";const Zee=["top","top-left","top-right","bottom","bottom-left","bottom-right"];let Bh={duration:5e3,position:"bottom-right"};const Ph={bottom:ba(),"bottom-left":ba(),"bottom-right":ba(),top:ba(),"top-left":ba(),"top-right":ba()},ll={bottom:new Set,"bottom-left":new Set,"bottom-right":new Set,top:new Set,"top-left":new Set,"top-right":new Set},id=e=>Ph[e],uc=(e,t)=>typeof e=="string"?{description:e,type:t}:{...e,type:t},Qee=(e,t)=>({close:()=>id(t).close(e),id:e,update:r=>{id(t).update(e,{data:r,description:r.description,title:r.title})}}),_o=e=>{const t=e.placement??Bh.position,r=id(t),n=e.onRemove,o=r.add({data:e,description:e.description,onClose:e.onClose,onRemove:()=>{ll[t].delete(o),n==null||n()},timeout:e.duration??Bh.duration,title:e.title});return ll[t].add(o),Qee(o,t)},Jee=e=>{if(e)for(const[t,r]of Object.entries(Ph))ll[t].delete(e),r.close(e);else for(const[t,r]of Object.entries(Ph)){const n=Array.from(ll[t]);for(const o of n)r.close(o);ll[t].clear()}},ete=e=>_o(uc(e,"success")),tte=e=>_o(uc(e,"error")),rte=e=>_o(uc(e,"info")),nte=e=>_o(uc(e,"warning")),ote=e=>_o({duration:0,...uc(e,"loading")});async function ite(e,t){const r=_o({closable:!1,duration:0,type:"loading",...typeof t.loading=="string"?{description:t.loading}:t.loading});try{const n=await e;return r.close(),_o({type:"success",...typeof t.success=="string"?{description:t.success}:typeof t.success=="function"?{description:t.success(n)}:t.success}),n}catch(n){throw r.close(),_o({type:"error",...typeof t.error=="string"?{description:t.error}:typeof t.error=="function"?{description:t.error(n)}:t.error}),n}}const ate=e=>_o({type:"default",...e}),Lte=Object.assign(ate,{dismiss:Jee,error:tte,info:rte,loading:ote,promise:ite,success:ete,warning:nte}),mS=u.memo(()=>{const{toasts:e}=ek();return e.map(t=>N.jsx(pS,{toast:t},t.id))});mS.displayName="ToastList";const ste=u.memo(({root:e,className:t,duration:r=5e3,limit:n=5,position:o="bottom-right",swipeDirection:i=["down","right"]})=>{const a=_1(),s=nc();if(u.useEffect(()=>{Bh={duration:r,limit:n,position:o,swipeDirection:i}},[r,n,o,i]),!a)return null;const l=e??s??document.body;return Zee.map(c=>N.jsx(fS,{value:{position:c,swipeDirection:i},children:N.jsx(ZS,{limit:n,timeout:r,toastManager:id(c),children:N.jsx(QS,{container:l,children:N.jsx(JS,{className:Fe(Uee({position:c}),t),children:N.jsx(mS,{})})})})},c))});ste.displayName="ToastHost";u.createContext(null);export{m3 as $,_te as A,CV as B,wV as C,xV as D,yV as E,dV as F,mV as G,aV as H,bV as I,pV as J,$V as K,kV as L,SV as M,_V as N,DV as O,fV as P,vV as Q,gV as R,hV as S,Fte as T,kte as U,oV as V,nV as W,Ete as X,Ste as Y,Tte as Z,B$ as _,kk as a,mte as a0,hte as a1,k$ as a2,gte as a3,p3 as a4,fte as a5,PL as a6,ste as a7,MW as a8,AV as a9,jt as aA,Ce as aB,yte as aC,r7 as aD,Wa as aE,dn as aF,cX as aG,vL as aH,l1 as aI,QW as aJ,qW as aK,ci as aL,Ml as aM,Vee as aN,VW as aO,uw as aP,uC as aQ,GW as aR,Qm as aS,E1 as aT,vte as aU,dte as aV,TR as aW,Y8 as aX,Ate as aY,_W as aa,Nq as ab,_l as ac,bL as ad,Ote as ae,Nte as af,ir as ag,Fe as ah,tc as ai,Rte as aj,rr as ak,zte as al,Pte as am,Bte as an,Pn as ao,jte as ap,m0 as aq,kn as ar,Lte as as,Cq as at,T7 as au,QV as av,En as aw,Dq as ax,or as ay,WW as az,V as b,uo as c,Xr as d,es as e,wte as f,ia as g,ml as h,qb as i,Ob as j,Ite as k,Dte as l,$te as m,iV as n,Ho as o,uV as p,cV as q,sV as r,Tk as s,lV as t,ut as u,Mte as v,_t as w,J7 as x,Cte as y,Q7 as z};
3116
+ `})),Uee=ur(Nt.viewport,{defaultVariants:{position:"bottom-right"},variants:{position:{bottom:Nt.viewportBottom,"bottom-left":Nt.viewportBottomLeft,"bottom-right":Nt.viewportBottomRight,top:Nt.viewportTop,"top-left":Nt.viewportTopLeft,"top-right":Nt.viewportTopRight}}}),Xee=ur(Nt.root,{defaultVariants:{position:"bottom-right"},variants:{position:{bottom:Nt.rootBottom,"bottom-left":Nt.rootBottom,"bottom-right":Nt.rootBottom,top:Nt.rootTop,"top-left":Nt.rootTop,"top-right":Nt.rootTop}}}),F5=ur(Nt.action,{defaultVariants:{variant:"primary"},variants:{variant:{danger:Nt.actionDanger,ghost:Nt.actionGhost,primary:Nt.actionPrimary,secondary:Nt.actionSecondary,text:Nt.actionText}}}),Yee={default:Iy,error:xH,info:Iy,loading:Vd,success:vH,warning:KH},Kee={default:Ce.colorText,error:Ce.colorError,info:Ce.colorInfo,loading:Ce.colorPrimary,success:Ce.colorSuccess,warning:Ce.colorWarning},pS=u.memo(({toast:e,classNames:t,styles:r})=>{const{position:n,swipeDirection:o}=Gee(),i=e.data,a=(i==null?void 0:i.type)??"default",s=(i==null?void 0:i.closable)??!0,l=(i==null?void 0:i.hideCloseButton)??!1,c=s&&!l,d=i==null?void 0:i.icon,f=e.title??(i==null?void 0:i.title),p=e.description??(i==null?void 0:i.description),m=e.actionProps??(i==null?void 0:i.actionProps),h=i==null?void 0:i.actions,g=Kee[a],y=d??Yee[a],b=a==="loading",v=()=>y?N.jsx("div",{className:Fe(Nt.icon,t==null?void 0:t.icon),style:r==null?void 0:r.icon,children:N.jsx(jt,{color:g,icon:y,size:18,spin:b})}):null,x=()=>h&&h.length>0?N.jsx("div",{className:Fe(Nt.actions,t==null?void 0:t.actions),style:r==null?void 0:r.actions,children:h.map((w,S)=>N.jsx($b,{style:r==null?void 0:r.action,className:Fe(F5({variant:w.variant??"primary"}),t==null?void 0:t.action),onClick:w.onClick,...w.props,children:w.label},S))}):m?N.jsx($b,{className:Fe(F5({variant:"primary"}),t==null?void 0:t.action),style:r==null?void 0:r.action,...m}):null;return N.jsx(XS,{className:Fe(Xee({position:n}),t==null?void 0:t.root),swipeDirection:o,toast:e,style:{...r==null?void 0:r.root,...i==null?void 0:i.style},children:N.jsx(YS,{className:Fe(Nt.content,t==null?void 0:t.content),style:r==null?void 0:r.content,children:N.jsxs("div",{className:f?Nt.toastBody:Nt.toastBodyCenter,children:[v(),N.jsxs("div",{className:Nt.contentArea,children:[f?N.jsxs(N.Fragment,{children:[N.jsxs("div",{className:Nt.titleRow,children:[N.jsx(KS,{className:Fe(Nt.title,t==null?void 0:t.title),style:r==null?void 0:r.title,children:f}),c&&N.jsx(Sb,{"aria-label":"Close",className:Fe(Nt.close,t==null?void 0:t.close),style:r==null?void 0:r.close,children:N.jsx(Wu,{size:14})})]}),p&&N.jsx(kb,{className:Fe(Nt.description,t==null?void 0:t.description),style:{marginBlockStart:4,...r==null?void 0:r.description},children:p})]}):p&&N.jsxs("div",{className:Nt.titleRow,children:[N.jsx(kb,{className:Fe(Nt.description,t==null?void 0:t.description),style:r==null?void 0:r.description,children:p}),c&&N.jsx(Sb,{"aria-label":"Close",className:Fe(Nt.close,t==null?void 0:t.close),style:r==null?void 0:r.close,children:N.jsx(Wu,{size:14})})]}),x()]})]})})})});pS.displayName="ToastItem";const Zee=["top","top-left","top-right","bottom","bottom-left","bottom-right"];let Bh={duration:5e3,position:"bottom-right"};const Ph={bottom:ba(),"bottom-left":ba(),"bottom-right":ba(),top:ba(),"top-left":ba(),"top-right":ba()},ll={bottom:new Set,"bottom-left":new Set,"bottom-right":new Set,top:new Set,"top-left":new Set,"top-right":new Set},id=e=>Ph[e],uc=(e,t)=>typeof e=="string"?{description:e,type:t}:{...e,type:t},Qee=(e,t)=>({close:()=>id(t).close(e),id:e,update:r=>{id(t).update(e,{data:r,description:r.description,title:r.title})}}),_o=e=>{const t=e.placement??Bh.position,r=id(t),n=e.onRemove,o=r.add({data:e,description:e.description,onClose:e.onClose,onRemove:()=>{ll[t].delete(o),n==null||n()},timeout:e.duration??Bh.duration,title:e.title});return ll[t].add(o),Qee(o,t)},Jee=e=>{if(e)for(const[t,r]of Object.entries(Ph))ll[t].delete(e),r.close(e);else for(const[t,r]of Object.entries(Ph)){const n=Array.from(ll[t]);for(const o of n)r.close(o);ll[t].clear()}},ete=e=>_o(uc(e,"success")),tte=e=>_o(uc(e,"error")),rte=e=>_o(uc(e,"info")),nte=e=>_o(uc(e,"warning")),ote=e=>_o({duration:0,...uc(e,"loading")});async function ite(e,t){const r=_o({closable:!1,duration:0,type:"loading",...typeof t.loading=="string"?{description:t.loading}:t.loading});try{const n=await e;return r.close(),_o({type:"success",...typeof t.success=="string"?{description:t.success}:typeof t.success=="function"?{description:t.success(n)}:t.success}),n}catch(n){throw r.close(),_o({type:"error",...typeof t.error=="string"?{description:t.error}:typeof t.error=="function"?{description:t.error(n)}:t.error}),n}}const ate=e=>_o({type:"default",...e}),Lte=Object.assign(ate,{dismiss:Jee,error:tte,info:rte,loading:ote,promise:ite,success:ete,warning:nte}),mS=u.memo(()=>{const{toasts:e}=ek();return e.map(t=>N.jsx(pS,{toast:t},t.id))});mS.displayName="ToastList";const ste=u.memo(({root:e,className:t,duration:r=5e3,limit:n=5,position:o="bottom-right",swipeDirection:i=["down","right"]})=>{const a=_1(),s=nc();if(u.useEffect(()=>{Bh={duration:r,limit:n,position:o,swipeDirection:i}},[r,n,o,i]),!a)return null;const l=e??s??document.body;return Zee.map(c=>N.jsx(fS,{value:{position:c,swipeDirection:i},children:N.jsx(ZS,{limit:n,timeout:r,toastManager:id(c),children:N.jsx(QS,{container:l,children:N.jsx(JS,{className:Fe(Uee({position:c}),t),children:N.jsx(mS,{})})})})},c))});ste.displayName="ToastHost";u.createContext(null);export{m3 as $,xV as A,yV as B,dV as C,mV as D,aV as E,bV as F,pV as G,$V as H,kV as I,SV as J,_V as K,DV as L,fV as M,vV as N,gV as O,hV as P,Fte as Q,kte as R,oV as S,nV as T,Ete as U,Ste as V,Tte as W,ml as X,B$ as Y,Ob as Z,qb as _,kk as a,mte as a0,hte as a1,k$ as a2,gte as a3,p3 as a4,fte as a5,PL as a6,ste as a7,MW as a8,AV as a9,jt as aA,Ce as aB,yte as aC,r7 as aD,Wa as aE,dn as aF,cX as aG,vL as aH,l1 as aI,QW as aJ,qW as aK,ci as aL,Ml as aM,Vee as aN,VW as aO,uw as aP,uC as aQ,GW as aR,Qm as aS,E1 as aT,vte as aU,dte as aV,TR as aW,Y8 as aX,Ate as aY,_W as aa,Nq as ab,_l as ac,bL as ad,Ote as ae,Nte as af,ir as ag,Fe as ah,tc as ai,Rte as aj,rr as ak,zte as al,Pte as am,Bte as an,Pn as ao,jte as ap,m0 as aq,kn as ar,Lte as as,Cq as at,T7 as au,QV as av,En as aw,Dq as ax,or as ay,WW as az,V as b,uo as c,Xr as d,es as e,wte as f,ia as g,Dte as h,Ite as i,$te as j,iV as k,Ho as l,uV as m,cV as n,sV as o,lV as p,Mte as q,J7 as r,Tk as s,Cte as t,ut as u,Q7 as v,_t as w,_te as x,CV as y,wV as z};
@@ -27,12 +27,12 @@
27
27
  opacity: 0.65;
28
28
  }
29
29
  </style>
30
- <script type="module" crossorigin src="/assets/index-BkKvQv2F.js"></script>
30
+ <script type="module" crossorigin src="/assets/index-DI_31upJ.js"></script>
31
31
  <link rel="modulepreload" crossorigin href="/assets/react-vendor-BuABiQkA.js">
32
- <link rel="modulepreload" crossorigin href="/assets/motion-DX3HNq_4.js">
33
- <link rel="modulepreload" crossorigin href="/assets/ui-BQStT3dY.js">
34
- <link rel="modulepreload" crossorigin href="/assets/diagram-CT58wBdU.js">
35
- <link rel="stylesheet" crossorigin href="/assets/index-DKshvHIN.css">
32
+ <link rel="modulepreload" crossorigin href="/assets/motion-BgtuAqBE.js">
33
+ <link rel="modulepreload" crossorigin href="/assets/ui-RahDNce8.js">
34
+ <link rel="modulepreload" crossorigin href="/assets/diagram-DtU2xxz3.js">
35
+ <link rel="stylesheet" crossorigin href="/assets/index-YRgNGXBI.css">
36
36
  </head>
37
37
  <body>
38
38
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fgbg/mdocs",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "A Markdown knowledge base for small teams",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -56,6 +56,7 @@
56
56
  "express": "^4.21.0",
57
57
  "lexical": "0.42.0",
58
58
  "lucide-react": "^0.562.0",
59
+ "mermaid": "11.14.0",
59
60
  "motion": "^12.0.0",
60
61
  "multer": "^2.1.1",
61
62
  "node-diff3": "^3.2.0",
@@ -1,6 +0,0 @@
1
- import{r as o,j as e}from"./react-vendor-BuABiQkA.js";import{c as Le,ag as be,ah as Ke,i as ve,ai as Se,aj as Oe,ak as Ue,al as We,am as Ge,an as Xe,ao as Re,ap as Ye,aq as Ve,ar as Je}from"./index-BkKvQv2F.js";import{H as Qe,A as we,S as Ze,a as es}from"./AgentSkillFormCard-CtfWIf7Y.js";import{P as ss}from"./plus-ECzYbQfA.js";import{ae as ts,af as ns}from"./ui-BQStT3dY.js";import{C as as,a as is}from"./copy-BE64wQqi.js";import"./diagram-CT58wBdU.js";import"./motion-DX3HNq_4.js";/**
2
- * @license lucide-react v0.562.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const rs=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],ls=Le("file-text",rs);function le(r){var n;return r==null||typeof r=="boolean"?"":typeof r=="string"||typeof r=="number"?String(r):Array.isArray(r)?r.map(le).join(""):typeof r=="object"&&"props"in r?le((n=r.props)==null?void 0:n.children):""}function cs(r){const[n,c]=o.useState(!1),d=o.useRef(null),v=le(r.children).replace(/\n$/,"");o.useEffect(()=>()=>{d.current!=null&&window.clearTimeout(d.current)},[]);async function x(){if(v)try{await navigator.clipboard.writeText(v),c(!0),d.current!=null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>c(!1),1500)}catch{}}return e.jsxs("div",{className:"mdocs-agent-panel-md-pre-wrap",children:[e.jsx("button",{type:"button",className:"mdocs-agent-panel-md-copy",onClick:()=>void x(),"aria-label":n?"已复制":"复制代码",title:n?"已复制":"复制",children:n?e.jsx(as,{size:14,"aria-hidden":!0}):e.jsx(is,{size:14,"aria-hidden":!0})}),e.jsx("pre",{children:r.children})]})}function Ae(r){return e.jsx("div",{className:"mdocs-agent-panel-md",children:e.jsx(ts,{remarkPlugins:[ns],components:{pre:({children:n})=>e.jsx(cs,{children:n})},children:r.children})})}const os=["如何发布文档?","草稿是什么?","如何创建域?"];function Ce(r,n){return n.map((c,d)=>{const v=c.skillNames&&c.skillNames.length>0?c.skillNames:c.skillIds&&c.skillIds.length>0?c.skillIds:void 0;return{id:`h-${r}-${d}-${c.role}`,role:c.role,content:c.content,skillNames:v}})}function ds(r,n){const c=r.slice(),d=c[c.length-1];return(d==null?void 0:d.type)==="text"?c[c.length-1]={type:"text",text:d.text+n}:c.push({type:"text",text:n}),c}function us(r,n){const c=r.slice(),d=c[c.length-1];return(d==null?void 0:d.type)==="thinking"?c[c.length-1]={type:"thinking",text:d.text+n}:c.push({type:"thinking",text:n}),c}function Ie(r){return r!=null&&r.length?r.filter(n=>n.type==="text").map(n=>n.text).join(""):""}function ms(r){return!!(r!=null&&r.some(n=>n.type==="thinking"&&n.text.length>0))}function ps(r){const n=new Date(r);if(Number.isNaN(n.getTime()))return"";const c=new Date;return n.getFullYear()===c.getFullYear()&&n.getMonth()===c.getMonth()&&n.getDate()===c.getDate()?n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):n.toLocaleDateString(void 0,{month:"2-digit",day:"2-digit"})}function _e(r){if(r>=1e3){const n=r/1e3;return`${n>=10?Math.round(n):Math.round(n*10)/10}K`}return String(r)}function hs(r){const{block:n,onResolved:c}=r,[d,v]=o.useState(""),[x,$]=o.useState(!1),[_,R]=o.useState(1),A=o.useRef(!1),F=o.useRef(c);F.current=c;const S=n.status==="open",B=o.useRef(0);o.useEffect(()=>{if(!S)return;A.current=!1;const k=new Date(n.expiresAt).getTime(),N=Date.now(),w=Math.max(k-N,1);B.current=w,R(1);const u=()=>{const U=k-Date.now(),P=Math.max(0,Math.min(1,U/w));R(P),U<=0&&!A.current&&(A.current=!0,Ve(n.requestId).catch(()=>{}).finally(()=>{F.current(n.requestId,"","expired")}))};u();const T=window.setInterval(u,100);return()=>window.clearInterval(T)},[S,n.expiresAt,n.requestId]);async function D(k){const N=k.trim();if(!(!N||x||!S)){$(!0);try{await Je(n.requestId,N),c(n.requestId,N,"selected")}catch{c(n.requestId,N,"failed")}finally{$(!1)}}}async function H(){if(!(x||!S)){$(!0),A.current=!0;try{await Re(n.requestId),c(n.requestId,"","cancelled")}catch{c(n.requestId,"","failed")}finally{$(!1)}}}const L=Math.max(0,Math.ceil(_*B.current/1e3));return e.jsxs("div",{className:"mdocs-agent-choice-card"+(S?"":" mdocs-agent-choice-card-done"),children:[e.jsxs("div",{className:"mdocs-agent-choice-head",children:[e.jsx("p",{className:"mdocs-agent-choice-title",children:n.title}),S?e.jsxs("span",{className:"mdocs-agent-choice-timer","aria-live":"polite",children:[L,"s"]}):null]}),S?e.jsx("div",{className:"mdocs-agent-choice-progress",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(_*100),children:e.jsx("div",{className:"mdocs-agent-choice-progress-bar",style:{transform:`scaleX(${_})`}})}):null,n.status==="selected"&&n.selected?e.jsxs("p",{className:"mdocs-agent-choice-result",children:["已选择:",n.selected]}):null,n.status==="cancelled"?e.jsx("p",{className:"mdocs-agent-choice-result muted",children:"已取消"}):null,n.status==="expired"?e.jsx("p",{className:"mdocs-agent-choice-result muted",children:"已超时,选择已失效"}):null,n.status==="failed"?e.jsx("p",{className:"mdocs-agent-choice-result muted",children:"提交失败或已失效"}):null,S?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mdocs-agent-choice-options",children:n.options.map(k=>e.jsx("button",{type:"button",className:"mdocs-agent-choice-option",disabled:x,onClick:()=>void D(k),children:k},k))}),e.jsxs("div",{className:"mdocs-agent-choice-custom",children:[e.jsx("input",{value:d,disabled:x,placeholder:"或输入自己的内容…",onChange:k=>v(k.target.value),onKeyDown:k=>{k.key==="Enter"&&(k.preventDefault(),D(d))}}),e.jsx("button",{type:"button",disabled:x||!d.trim(),onClick:()=>void D(d),children:"提交"})]}),e.jsx("div",{className:"mdocs-agent-choice-footer",children:e.jsx("button",{type:"button",className:"mdocs-agent-choice-cancel",disabled:x,onClick:()=>void H(),children:"取消"})})]}):null]})}function fs(r){const v=2*Math.PI*8.75,x=Math.min(100,Math.max(0,r.percent)),$=v*(1-x/100),_=x>=90?"danger":x>=70?"warn":"ok",R=`上下文 ${x}% · 已用 ${_e(r.used)} / ${_e(r.limit)} tokens`;return e.jsx("span",{className:"mdocs-agent-panel-context mdocs-agent-panel-context-"+_,"data-tooltip":R,"aria-label":R,role:"img",tabIndex:0,children:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 20 20","aria-hidden":!0,children:[e.jsx("circle",{className:"mdocs-agent-panel-context-track",cx:20/2,cy:20/2,r:8.75,fill:"none",strokeWidth:2.5}),e.jsx("circle",{className:"mdocs-agent-panel-context-value",cx:20/2,cy:20/2,r:8.75,fill:"none",strokeWidth:2.5,strokeLinecap:"round",strokeDasharray:v,strokeDashoffset:$,transform:`rotate(-90 ${20/2} ${20/2})`})]})})}function gs(r){var n;for(const c of r)if(!(c.role!=="assistant"||!((n=c.blocks)!=null&&n.length))){for(const d of c.blocks)if((d.type==="choice_card"||d.type==="skill_form_card")&&d.status==="open")return!0}return!1}const ws=o.forwardRef(function(n,c){const{open:d,onClose:v,visitorName:x,anchorStyle:$,fullscreen:_,domainId:R,documentId:A,documentTitle:F,documentPath:S,onOpenDocument:B,onTreeChanged:D,onDocumentOverwritten:H,onOpenCoding:L}=n,k=((x==null?void 0:x.trim().charAt(0))||"我").toUpperCase(),[N,w]=o.useState(!1),[u,T]=o.useState(null),[U,P]=o.useState(null),[q,y]=o.useState([]),[J,W]=o.useState(null),[ce,qe]=o.useState([]),[$e,oe]=o.useState(!1),[G,X]=o.useState(""),[K,de]=o.useState([]),[Ee,ue]=o.useState(!1),[g,Y]=o.useState(!1),[me,E]=o.useState(null),[V,pe]=o.useState(null),[Q,z]=o.useState(!1),[M,he]=o.useState(!1),Me=o.useRef(null),Z=o.useRef(null),C=o.useRef(null),fe=o.useRef(0),O=o.useRef(!0),ee=o.useRef(q);ee.current=q;const ge=!!(A!=null&&A.trim())&&!Ee,De=(F==null?void 0:F.trim())||"当前文档",xe=(S==null?void 0:S.trim())||"";o.useEffect(()=>{ue(!1)},[A]);function ye(s){return fe.current+=1,`${s}-${fe.current}`}function ze(s,m=48){return s.scrollHeight-s.scrollTop-s.clientHeight<=m}function I(){const s=Z.current;!s||!O.current||(s.scrollTop=s.scrollHeight)}function Fe(){const s=Z.current;s&&(O.current=ze(s))}async function Te(){oe(!0);try{const s=await Ue();qe(s.sessions),J||W(s.lastOpenedSessionId)}catch{}finally{oe(!1)}}async function se(){try{const s=await Oe();pe(s)}catch{}}async function je(){try{const s=await be();T(s),P(null)}catch(s){T(null),P(s instanceof Error?s.message:String(s))}}o.useEffect(()=>{var m;if(!d){w(!1),(m=C.current)==null||m.abort(),C.current=null,Y(!1);return}let s=!1;return(async()=>{try{const a=await be();s||(T(a),P(null))}catch(a){s||(T(null),P(a instanceof Error?a.message:String(a)))}})(),se(),()=>{s=!0}},[d]),o.useEffect(()=>{if(!d)return;let s=!1;return(async()=>{try{const m=await Ke();if(s)return;W(m.sessionId),y(a=>a.length>0?a:Ce(m.sessionId,m.messages))}catch{}})(),()=>{s=!0}},[d]),o.useEffect(()=>{!d||!N||Te()},[d,N]);function te(){if(!M){if(gs(ee.current)){z(!0);return}z(!1),v()}}async function Pe(){var a;if(M)return;he(!0);const s=ee.current,m=[];for(const j of s)if(!(j.role!=="assistant"||!j.blocks))for(const p of j.blocks)p.type==="choice_card"&&p.status==="open"&&m.push(Re(p.requestId).catch(()=>{})),p.type==="skill_form_card"&&p.status==="open"&&m.push(Ye(p.requestId).catch(()=>{}));await Promise.all(m),(a=C.current)==null||a.abort(),y(j=>j.map(p=>p.role!=="assistant"||!p.blocks?p:{...p,blocks:p.blocks.map(h=>h.type==="choice_card"&&h.status==="open"?{...h,status:"cancelled"}:h.type==="skill_form_card"&&h.status==="open"?{...h,status:"cancelled"}:h)})),z(!1),he(!1),v()}const ne=o.useRef(te);ne.current=te,o.useImperativeHandle(c,()=>({requestClose:()=>ne.current()}),[]),o.useEffect(()=>{if(!d){z(!1);return}const s=m=>{if(m.key==="Escape"){if(Q){M||z(!1);return}if(N){w(!1);return}ne.current()}};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[d,N,Q,M]);async function ae(s){var h;const m=s.trim();if(!m||g)return;if(!(u!=null&&u.enabled)){E((u==null?void 0:u.reason)==="missing_api_key"?"请先配置 API Key":(u==null?void 0:u.reason)==="skills_missing"?"手册 skills 未就绪,请确认已构建 agent-skills":"助手暂不可用");return}(h=C.current)==null||h.abort();const a=new AbortController;C.current=a;const j={id:ye("u"),role:"user",content:m,skillNames:K.length>0?[...K]:void 0},p=ye("a");O.current=!0,y(b=>[...b,j,{id:p,role:"assistant",content:""}]),X(""),Y(!0),E(null),w(!1),requestAnimationFrame(()=>I());try{let b=!1;await Xe(m,{skillNames:K.length>0?K:void 0,references:{domainId:(R==null?void 0:R.trim())||void 0,documentId:ge?A.trim():void 0},signal:a.signal,onEvent:i=>{i.type==="text_delta"?(y(f=>f.map(t=>{if(t.id!==p)return t;const l=ds(t.blocks??[],i.text);return{...t,blocks:l,content:Ie(l)}})),requestAnimationFrame(()=>I())):i.type==="thinking_delta"?(y(f=>f.map(t=>{if(t.id!==p)return t;const l=us(t.blocks??[],i.text);return{...t,blocks:l}})),requestAnimationFrame(()=>I())):i.type==="sources"?(y(f=>f.map(t=>{if(t.id!==p)return t;const l=(t.blocks??[]).slice(),re=l[l.length-1];return(re==null?void 0:re.type)==="sources"?l[l.length-1]={type:"sources",items:i.items}:l.push({type:"sources",items:i.items}),{...t,blocks:l}})),requestAnimationFrame(()=>I())):i.type==="document_table"?(y(f=>f.map(t=>{if(t.id!==p)return t;const l=[...t.blocks??[],{type:"document_table",title:i.title,rows:i.rows}];return{...t,blocks:l}})),requestAnimationFrame(()=>I())):i.type==="document_card"?(y(f=>f.map(t=>{if(t.id!==p)return t;const l=[...t.blocks??[],{type:"document_card",documentId:i.documentId,title:i.title,path:i.path,preview:i.preview}];return{...t,blocks:l}})),requestAnimationFrame(()=>I())):i.type==="tool_notice"?(y(f=>f.map(t=>{if(t.id!==p)return t;const l=[...t.blocks??[],{type:"tool_notice",toolName:i.toolName,text:i.text}];return{...t,blocks:l}})),requestAnimationFrame(()=>I())):i.type==="choice_card"?(y(f=>f.map(t=>{if(t.id!==p)return t;const l=[...t.blocks??[],{type:"choice_card",requestId:i.requestId,title:i.title,options:i.options,expiresAt:i.expiresAt,status:"open"}];return{...t,blocks:l}})),requestAnimationFrame(()=>I())):i.type==="choice_expired"?y(f=>f.map(t=>t.id!==p||!t.blocks?t:{...t,blocks:t.blocks.map(l=>l.type==="choice_card"&&l.requestId===i.requestId&&l.status==="open"?{...l,status:"expired"}:l)})):i.type==="skill_form_card"?(y(f=>f.map(t=>{if(t.id!==p)return t;const l=[...t.blocks??[],{type:"skill_form_card",requestId:i.requestId,mode:i.mode,title:i.title,currentName:i.currentName,initialName:i.initialName,initialDescription:i.initialDescription,initialBody:i.initialBody,expiresAt:i.expiresAt,status:"open"}];return{...t,blocks:l}})),requestAnimationFrame(()=>I())):i.type==="skill_form_expired"?y(f=>f.map(t=>t.id!==p||!t.blocks?t:{...t,blocks:t.blocks.map(l=>l.type==="skill_form_card"&&l.requestId===i.requestId&&l.status==="open"?{...l,status:"expired"}:l)})):i.type==="tree_changed"?D==null||D():i.type==="document_overwritten"?H==null||H({documentId:i.documentId,headCommitId:i.headCommitId}):i.type==="open_coding"?L==null||L({documentId:i.documentId,displayName:i.displayName}):i.type==="context_usage"?pe({percent:i.percent,used:i.used,limit:i.limit}):i.type==="error"&&(b=!0,E(i.message))}}),!a.signal.aborted&&!b&&de([])}catch(b){if(a.signal.aborted)return;E(b instanceof Error?b.message:String(b))}finally{C.current===a&&(C.current=null),Y(!1)}}async function Be(){var s;if(!g){(s=C.current)==null||s.abort(),E(null),w(!1),Y(!1);try{const m=await We();W(m.sessionId),y([]),X(""),O.current=!0,se()}catch(m){E(m instanceof Error?m.message:String(m))}}}async function He(s){var m;if(!g){if(s===J){w(!1);return}(m=C.current)==null||m.abort(),E(null);try{const a=await Ge(s);W(a.sessionId),y(Ce(a.sessionId,a.messages)),X(""),w(!1),O.current=!0,requestAnimationFrame(()=>I()),se()}catch(a){E(a instanceof Error?a.message:String(a))}}}function ke(s){!s||!B||B(s)}if(!d)return null;const ie=(u==null?void 0:u.reason)==="missing_api_key",Ne=U??(u&&!u.enabled&&!ie?u.reason==="skills_missing"?"skills 未就绪":"助手暂不可用":null);return e.jsxs("div",{ref:Me,className:"mdocs-agent-panel"+(_?" mdocs-agent-panel--fullscreen":""),role:"dialog","aria-label":"mdocs 智能助手","aria-modal":_?!0:void 0,style:_?void 0:$,children:[e.jsxs("header",{className:"mdocs-agent-panel-header",children:[e.jsxs("div",{className:"mdocs-agent-panel-title",children:[e.jsx("img",{src:ve,alt:"",className:"mdocs-agent-panel-title-logo"}),e.jsx("span",{children:"mdocs 智能助手"})]}),e.jsxs("div",{className:"mdocs-agent-panel-actions",children:[e.jsx("button",{type:"button",className:"mdocs-agent-panel-icon-btn",title:"新会话","aria-label":"新会话",disabled:g,onClick:()=>void Be(),children:e.jsx(ss,{size:16,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"mdocs-agent-panel-icon-btn"+(N?" active":""),title:"历史会话","aria-label":"历史会话",onClick:()=>w(s=>!s),children:e.jsx(Qe,{size:16,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"mdocs-agent-panel-icon-btn",title:"关闭","aria-label":"关闭",onClick:te,children:e.jsx(Se,{size:16,strokeWidth:1.8})})]})]}),N?e.jsxs("div",{className:"mdocs-agent-panel-history",children:[e.jsxs("div",{className:"mdocs-agent-panel-history-head",children:[e.jsx("span",{children:"历史会话"}),e.jsx("button",{type:"button",className:"mdocs-agent-panel-history-back",onClick:()=>w(!1),children:"返回对话"})]}),$e?e.jsx("p",{className:"mdocs-agent-panel-history-hint",children:"加载中…"}):ce.length===0?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mdocs-agent-panel-history-empty",children:"暂无历史会话"}),e.jsx("p",{className:"mdocs-agent-panel-history-hint",children:"发一条消息后会出现在这里"})]}):e.jsx("ul",{className:"mdocs-agent-panel-history-list",children:ce.map(s=>e.jsx("li",{children:e.jsxs("button",{type:"button",className:"mdocs-agent-panel-history-item"+(s.id===J?" active":""),disabled:g,onClick:()=>void He(s.id),children:[e.jsx("span",{className:"mdocs-agent-panel-history-title",children:s.title}),e.jsx("span",{className:"mdocs-agent-panel-history-time",children:ps(s.updatedAt)})]})},s.id))})]}):e.jsxs("div",{className:"mdocs-agent-panel-body",children:[e.jsx("div",{className:"mdocs-agent-panel-welcome",ref:Z,onScroll:Fe,children:q.length===0?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mdocs-agent-panel-hello",children:"你好,我是 mdocs 智能助手"}),e.jsx("p",{className:"mdocs-agent-panel-desc",children:"我能答疑、搜文档、整理结构,也能帮你写全文;需要精细改稿请点文档顶栏「帮写」。"}),ie?e.jsx(we,{onConfigured:je}):Ne?e.jsx("p",{className:"mdocs-agent-panel-status-warn",children:Ne}):e.jsx("div",{className:"mdocs-agent-panel-chips",children:os.map(s=>e.jsx("button",{type:"button",className:"mdocs-agent-panel-chip",onClick:()=>void ae(s),disabled:g||!(u!=null&&u.enabled),children:s},s))})]}):e.jsx("div",{className:"mdocs-agent-panel-messages",children:q.map(s=>{var m;return e.jsxs("div",{className:"mdocs-agent-panel-msg"+(s.role==="user"?" mdocs-agent-panel-msg-user":" mdocs-agent-panel-msg-assistant"),children:[s.role==="assistant"?e.jsx("div",{className:"mdocs-agent-panel-avatar mdocs-agent-panel-avatar-ai","aria-hidden":!0,children:e.jsx("img",{src:ve,alt:""})}):null,e.jsxs("div",{className:"mdocs-agent-panel-msg-bubble",children:[s.role==="user"&&s.skillNames&&s.skillNames.length>0?e.jsxs("div",{className:"mdocs-agent-msg-skills",children:["Skill ×",s.skillNames.length]}):null,s.role==="assistant"?s.blocks&&s.blocks.length>0?e.jsxs("div",{className:"mdocs-agent-panel-timeline",children:[s.blocks.map((a,j)=>{var p;return a.type==="thinking"?a.text?e.jsxs("details",{className:"mdocs-agent-panel-think-fold",open:g&&s.id===((p=q[q.length-1])==null?void 0:p.id),children:[e.jsx("summary",{children:"思考中"}),e.jsx("pre",{className:"mdocs-agent-panel-think-body",children:a.text})]},`${s.id}-th-${j}`):null:a.type==="text"?a.text?e.jsx("div",{className:"mdocs-agent-panel-block",children:e.jsx(Ae,{children:a.text})},`${s.id}-t-${j}`):null:a.type==="sources"?a.items.length===0?null:e.jsx("div",{className:"mdocs-agent-panel-block",children:e.jsxs("details",{className:"mdocs-agent-panel-tool-fold",children:[e.jsxs("summary",{children:["已阅读 ",a.items.length," 个页面"]}),e.jsx("ol",{className:"mdocs-agent-panel-sources-list",children:a.items.map(h=>e.jsx("li",{children:e.jsx("a",{href:h.url,target:"_blank",rel:"noreferrer",children:h.name})},h.id))})]})},`${s.id}-s-${j}`):a.type==="tool_notice"?e.jsx("div",{className:"mdocs-agent-panel-block",children:e.jsx("p",{className:"mdocs-agent-panel-tool-notice",children:a.text})},`${s.id}-n-${j}`):a.type==="choice_card"?e.jsx("div",{className:"mdocs-agent-panel-block",children:e.jsx(hs,{block:a,onResolved:(h,b,i)=>{y(f=>f.map(t=>t.id!==s.id||!t.blocks?t:{...t,blocks:t.blocks.map(l=>l.type==="choice_card"&&l.requestId===h?{...l,status:i,selected:i==="selected"?b:l.selected}:l)}))}})},`${s.id}-ch-${j}`):a.type==="skill_form_card"?e.jsx("div",{className:"mdocs-agent-panel-block",children:e.jsx(Ze,{block:a,onResolved:(h,b,i)=>{y(f=>f.map(t=>t.id!==s.id||!t.blocks?t:{...t,blocks:t.blocks.map(l=>l.type==="skill_form_card"&&l.requestId===h?{...l,status:b,submittedName:b==="submitted"?i:l.submittedName}:l)}))}})},`${s.id}-sf-${j}`):a.type==="document_card"?e.jsx("div",{className:"mdocs-agent-panel-block",children:e.jsxs("details",{className:"mdocs-agent-panel-tool-fold",children:[e.jsxs("summary",{children:[e.jsxs("button",{type:"button",className:"mdocs-agent-panel-doc-link",onClick:h=>{h.preventDefault(),h.stopPropagation(),ke(a.documentId)},children:["《",a.title,"》"]}),e.jsx("span",{className:"mdocs-agent-panel-tool-fold-hint",children:"文档预览"})]}),e.jsxs("div",{className:"mdocs-agent-panel-doc-card-body",children:[a.path?e.jsx("p",{className:"mdocs-agent-panel-doc-card-path",children:a.path}):null,a.preview?e.jsx("p",{className:"mdocs-agent-panel-doc-card-preview",children:a.preview}):e.jsx("p",{className:"mdocs-agent-panel-doc-card-preview muted",children:"(无正文预览)"})]})]})},`${s.id}-c-${j}`):e.jsx("div",{className:"mdocs-agent-panel-block",children:e.jsxs("details",{className:"mdocs-agent-panel-tool-fold",children:[e.jsxs("summary",{children:[a.title,e.jsx("span",{className:"mdocs-agent-panel-tool-fold-hint",children:a.rows.length===0?"无结果":`${a.rows.length} 条`})]}),e.jsx("div",{className:"mdocs-agent-panel-doc-table-wrap",children:a.rows.length===0?e.jsx("p",{className:"mdocs-agent-panel-doc-table-empty",children:"无结果"}):e.jsxs("table",{className:"mdocs-agent-panel-doc-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"文章名字"}),e.jsx("th",{children:"文章内容"})]})}),e.jsx("tbody",{children:a.rows.map(h=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("button",{type:"button",className:"mdocs-agent-panel-doc-link",onClick:()=>ke(h.documentId),children:h.title})}),e.jsx("td",{children:h.summary||"-"})]},h.documentId))})]})})]})},`${s.id}-d-${j}`)}),g&&s.id===((m=q[q.length-1])==null?void 0:m.id)&&!Ie(s.blocks)&&!ms(s.blocks)?e.jsxs("span",{className:"mdocs-agent-panel-thinking","aria-label":"思考中",children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]}):null]}):s.content?e.jsx(Ae,{children:s.content}):g?e.jsxs("span",{className:"mdocs-agent-panel-thinking","aria-label":"思考中",children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]}):null:s.content]}),s.role==="user"?e.jsx("div",{className:"mdocs-agent-panel-avatar mdocs-agent-panel-avatar-user","aria-hidden":!0,children:k}):null]},s.id)})})}),me?e.jsx("p",{className:"mdocs-agent-panel-status-warn",children:me}):null,ie&&q.length>0?e.jsx(we,{onConfigured:je}):null,e.jsx(es,{selectedNames:K,onChange:de,disabled:g||!(u!=null&&u.enabled)}),e.jsxs("div",{className:"mdocs-agent-panel-input-wrap",children:[ge?e.jsxs("div",{className:"mdocs-agent-doc-ref",children:[e.jsx(ls,{size:15,strokeWidth:1.75,className:"mdocs-agent-doc-ref-icon","aria-hidden":!0}),e.jsxs("div",{className:"mdocs-agent-doc-ref-text",children:[e.jsx("span",{className:"mdocs-agent-doc-ref-title",children:De}),xe?e.jsx("span",{className:"mdocs-agent-doc-ref-path",children:xe}):null]}),e.jsx("button",{type:"button",className:"mdocs-agent-doc-ref-unlink",title:"取消引用","aria-label":"取消引用当前文档",disabled:g,onClick:()=>ue(!0),children:e.jsx(Se,{size:14,strokeWidth:2,"aria-hidden":!0})})]}):null,e.jsxs("div",{className:"mdocs-agent-panel-input-body",children:[e.jsx("textarea",{className:"mdocs-agent-panel-input",rows:2,placeholder:u!=null&&u.enabled?"把你的问题告诉我…":"请先配置 API Key",value:G,disabled:g||!(u!=null&&u.enabled),onChange:s=>X(s.target.value),onKeyDown:s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),ae(G))}}),V?e.jsx(fs,{percent:V.percent,used:V.used,limit:V.limit}):null,e.jsx("button",{type:"button",className:g?"mdocs-agent-panel-send mdocs-agent-panel-send-stop":"mdocs-agent-panel-send",disabled:g?!1:!(u!=null&&u.enabled)||!G.trim(),onClick:()=>{var s;if(g){(s=C.current)==null||s.abort();return}ae(G)},title:g?"停止":"发送","aria-label":g?"停止":"发送",children:g?"■":"↑"})]})]}),e.jsx("p",{className:"mdocs-agent-panel-footnote",children:"内容由 AI 生成,仅供参考"})]}),Q?e.jsx("div",{className:"mdocs-agent-close-confirm-backdrop",role:"presentation",onClick:()=>{M||z(!1)},children:e.jsxs("div",{className:"mdocs-message-dialog mdocs-agent-close-confirm",role:"dialog","aria-modal":"true","aria-labelledby":"mdocs-agent-close-confirm-title",onClick:s=>s.stopPropagation(),children:[e.jsx("h3",{id:"mdocs-agent-close-confirm-title",className:"mdocs-message-dialog-title",children:"有待处理的倒计时"}),e.jsx("p",{className:"mdocs-message-dialog-body",children:"当前还有选择卡或 Skill 表单在倒计时。强制关闭会取消这些操作并退出助手;也可以继续等待完成后再关。"}),e.jsxs("div",{className:"mdocs-message-dialog-actions mdocs-agent-close-confirm-actions",children:[e.jsx("button",{type:"button",className:"secondary",disabled:M,onClick:()=>z(!1),children:"继续等待"}),e.jsx("button",{type:"button",disabled:M,onClick:()=>void Pe(),children:M?"关闭中…":"强制关闭并退出"})]})]})}):null]})});export{ws as AgentChatPanel};
@@ -1,8 +0,0 @@
1
- import{r as n,j as o,ad as C}from"./react-vendor-BuABiQkA.js";import{u as N,E as T,R as I,a as E,b as M,c as j,d as O,e as P,f as A,g as _,h as D,i as L,w as f,j as H,k as F,l as q,I as U,m as b,n as V,o as J,p as W,q as z,r as B,s as $,t as K,v as Y,x as G,y as Z}from"./react-GP8hKHRA.js";import{a7 as Q,a8 as X,a9 as ee,aa as te,ab as k,ac as oe}from"./ui-BQStT3dY.js";import{H as re,a as ae,b as ne,M as le,T as ie,S as se,W as de,c as R,o as ce}from"./Toolbar-BHLX-ug4.js";import{N as me}from"./index-BkKvQv2F.js";import"./editor-CL03se2B.js";import"./diagram-CT58wBdU.js";import"./plus-ECzYbQfA.js";import"./copy-BE64wQqi.js";import"./motion-DX3HNq_4.js";const ue=({children:h,json:r,markdown:a,collapsible:m=!1,defaultActiveKey:y=["editor","text","json"],onJSONChange:p})=>{const[g,c]=n.useState(r),s=n.useRef(r);n.useEffect(()=>{r!==s.current&&(c(r),s.current=r)},[r]);const x=n.useCallback(d=>{s.current=d,c(d)},[]);return o.jsxs(o.Fragment,{children:[o.jsx(Q,{}),o.jsx(X,{collapsible:m,defaultActiveKey:y,items:[{children:h,key:"editor",label:"Playground"},{children:o.jsx(ee,{language:"markdown",style:{fontSize:12,padding:16},variant:"borderless",children:a}),key:"text",label:"Text Output"},{children:o.jsx(te,{language:"json",onBlur:()=>{if(r!==s.current)try{const d=JSON.parse(s.current||"");p==null||p(d)}catch(d){console.error("Invalid JSON:",d)}},onValueChange:x,value:g,variant:"borderless"}),key:"json",label:"JSON Output"}],padding:{body:0},style:{border:"none",borderRadius:0,width:"100%"},variant:"outlined"})]})},he={children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"Welcome to the Lobe Editor Demo!",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"heading",version:1,tag:"h1"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"In case you were wondering what the black box at the bottom is – it's the debug view, showing the current state of the editor. You can disable it by pressing on the settings control in the bottom-left of your screen and toggling the debug view setting.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"quote",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"The playground is a demo environment built with ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1},{detail:0,format:0,mode:"normal",style:"",text:"@lobehub/editor",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"codeInline",version:1},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1},{detail:0,format:0,mode:"normal",style:"",text:". Try typing in ",type:"text",version:1},{detail:0,format:1,mode:"normal",style:"",text:"some text",type:"text",version:1},{detail:0,format:0,mode:"normal",style:"",text:" with ",type:"text",version:1},{detail:0,format:2,mode:"normal",style:"",text:"different formats",type:"text",version:1},{detail:0,format:0,mode:"normal",style:"",text:".",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:""},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"Visit the ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Lobe Editor website",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"link",version:1,rel:"noreferrer",target:null,title:null,url:"https://editor.lobehub.com"},{detail:0,format:0,mode:"normal",style:"",text:" for documentation and more information.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"listitem",version:1,value:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Check out the code on our ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"GitHub repository",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"link",version:1,rel:null,target:null,title:"https://github.com/lobehub/lobe-editor",url:"https://github.com/lobehub/lobe-editor"},{detail:0,format:0,mode:"normal",style:"",text:".",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"listitem",version:1,value:2},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Playground code ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Playground code",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"link",version:1,rel:"noreferrer",target:null,title:null,url:"https://github.com/lobehub/lobe-editor/blob/master/src/react/Editor/demos/index.tsx"},{detail:0,format:0,mode:"normal",style:"",text:" can be found here.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"listitem",version:1,value:3},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Join our ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Discover Server",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"link",version:1,rel:null,target:null,title:"https://discord.gg/AYFPHvv2jT",url:"https://discord.gg/AYFPHvv2jT"},{detail:0,format:0,mode:"normal",style:"",text:" and chat with the team.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"listitem",version:1,value:4}],direction:"ltr",format:"",indent:0,type:"list",version:1,listType:"bullet",start:1,tag:"ul"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Lastly, we're constantly adding cool new features to this playground. So make sure you check back here when you next get a chance 🙂.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:""},{children:[{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"import",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-text);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"{",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-error);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-text);",text:"Editor",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-error);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"}",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-text);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"from",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-text);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"'",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-success);",text:"@lobehub/editor",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"'",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:";",type:"code-highlight",version:1}],direction:null,format:"",indent:0,type:"code",version:1,language:"typescript",theme:"lobe-theme"},{children:[],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:""}],direction:"ltr",format:"",indent:0,type:"root",version:1},ye={root:he};function S(h,r){let a;const m=(...y)=>{a!==void 0&&clearTimeout(a),a=setTimeout(()=>h(...y),r)};return m.cancel=()=>{a!==void 0&&(clearTimeout(a),a=void 0)},m}window.__scrollIntoView=Z;const pe=h=>{const r=N(),a=n.useRef([]),[m,y]=n.useState(""),[p,g]=n.useState(""),c=n.useMemo(()=>S(t=>{const e=t.getDocument("markdown"),l=t.getDocument("json");g(e||""),y(JSON.stringify(l||{},null,2))},200),[]),s=n.useMemo(()=>S(t=>{r&&(console.info("handleJSONChange",t),r.setDocument("json",t))},200),[r]),x=t=>{window.editor=t,c(t)};n.useEffect(()=>()=>{for(const t of a.current)URL.revokeObjectURL(t);a.current=[],c.cancel(),s.cancel(),delete window.editor,delete window.__scrollIntoView},[c,s]);const d=n.useMemo(()=>[{icon:o.jsx(k,{avatar:"💻",size:24}),key:"bot1",label:"前端研发专家",metadata:{id:"bot1"}},{icon:o.jsx(k,{avatar:"🌍",size:24}),key:"bot2",label:"中英文互译助手",metadata:{id:"bot2"}},{icon:o.jsx(k,{avatar:"📖",size:24}),key:"bot3",label:"学术写作增强专家",metadata:{id:"bot3"}}],[]),w=n.useMemo(()=>[{icon:re,key:"h1",label:"Heading 1",onSelect:e=>{e.dispatchCommand(b,{tag:"h1"})}},{icon:ae,key:"h2",label:"Heading 2",onSelect:e=>{e.dispatchCommand(b,{tag:"h2"})}},{icon:ne,key:"h3",label:"Heading 3",onSelect:e=>{e.dispatchCommand(b,{tag:"h3"})}},{type:"divider"},{icon:le,key:"hr",label:"Hr",onSelect:e=>{e.dispatchCommand(V,{})}},{icon:ie,key:"table",label:"Table",onSelect:e=>{e.dispatchCommand(J,{columns:"3",rows:"3"})}},{icon:se,key:"tex",label:"Tex",onSelect:e=>{e.dispatchCommand(W,{code:"x^2 + y^2 = z^2"}),queueMicrotask(()=>{e.focus()})}},{type:"divider"},{key:"file",label:"File",onSelect:e=>{ce(l=>{for(const u of l)e.dispatchCommand(z,{file:u})})}},{key:"set-text-content",label:"SetTextContent",onSelect:e=>{e.setDocument("text",`123
2
- 123`),queueMicrotask(()=>{e.focus()})}},{key:"insert-link",label:"InsertLink",onSelect:e=>{e.dispatchCommand(B,{url:"https://example.com"}),queueMicrotask(()=>{e.focus()})}},{key:"insert-codeInline",label:"InsertCodeInline",onSelect:e=>{e.dispatchCommand($,void 0),queueMicrotask(()=>{e.focus()})}},{key:"insert-codeBlock",label:"InsertCodeBlock",onSelect:e=>{e.dispatchCommand(K,void 0),queueMicrotask(()=>{e.focus()})}},{icon:de,key:"meta2d",label:"Meta2d",onSelect:e=>{e.dispatchCommand(Y,void 0),queueMicrotask(()=>{e.focus()})}},{icon:me,key:"markmap",label:"Markmap",onSelect:e=>{e.dispatchCommand(G,void 0),queueMicrotask(()=>{e.focus()})}}].map(e=>e.type==="divider"?e:{...e,extra:o.jsx(oe,{code:!0,fontSize:12,type:"secondary",children:e.key})}),[]);return o.jsxs(ue,{json:m,markdown:p,onJSONChange:s,...h,children:[o.jsx(R,{editor:r}),o.jsx(T,{className:"mdocs-playground-editor",content:ye,editor:r,lineEmptyPlaceholder:"Start typing here...",mentionOption:{items:d,markdownWriter:t=>{var e;return`
3
- <mention>${t.label}[${((e=t.metadata)==null?void 0:e.id)||t.label}]</mention>
4
- `},onSelect:(t,e)=>{t.dispatchCommand(U,{label:String(e.label),metadata:{id:e.key}})},searchKeys:["label"]},onInit:x,onTextChange:c,pasteVSCodeAsCodeBlock:!0,placeholder:"Type something...",plugins:[I,E,M,j,O,P,A,_,D,L,f(H,{children:o.jsx(R,{editor:r,floating:!0})}),f(F,{delay:1e3,onAutoComplete:async({input:t,afterText:e,selectionType:l,abortSignal:u})=>{console.log("Auto-complete triggered:",{afterText:e,input:t,selectionType:l});try{const v=await fetch(`${location.origin}/nodeserver/completion`,{body:JSON.stringify({prompt:`Please complete the following text:
5
-
6
- ${t}`}),headers:{"Content-Type":"application/json"},method:"POST",signal:u});if(u.aborted)return console.log("Auto-complete aborted"),null;const i=await v.json();if(i)return typeof i.content=="string"&&i.content.startsWith(t)?i.content.replace(t,""):i.content}catch{}return null}}),f(M,{defaultBlockImage:!0,handleRehost:async t=>{const l=await(await fetch(t)).blob();return await new Promise((u,v)=>{const i=new FileReader;i.onloadend=()=>u({url:i.result}),i.onerror=v,i.readAsDataURL(l)})},needRehost:t=>(console.debug("needRehost",t),t.startsWith("blob:"))}),f(q,{handleUpload:async t=>(console.debug("Files uploaded:",t),new Promise(e=>{setTimeout(()=>{const l=URL.createObjectURL(t);a.current.push(l),e({url:l})},1e3)})),markdownWriter:t=>`
7
- <file>${t.fileUrl}</file>
8
- `})],slashOption:{items:w}})]})};function Ce(){return o.jsxs("div",{className:"mdocs-playground-page",children:[o.jsx("header",{className:"mdocs-playground-header",children:o.jsx(C,{className:"mdocs-playground-back",to:"/",children:"← mdocs"})}),o.jsx(pe,{})]})}export{Ce as PlaygroundPage};