filecat 7.17.4 → 7.18.2

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 (30) hide show
  1. package/build/dist/1075.5bb46386465b67572742.js +1 -0
  2. package/build/dist/1448.02d5acc29275651cc58a.js +1 -0
  3. package/build/dist/2674.eabb4e196084174156bf.js +1 -0
  4. package/build/dist/394.c24b7a7b1f61cf8a50e2.js +1 -0
  5. package/build/dist/4091.bcaf80eb4aa0c7cc2afe.js +1 -0
  6. package/build/dist/5272.165b9433ff4ddd0a1e23.js +1 -0
  7. package/build/dist/6104.51c95c10504157874164.js +1 -0
  8. package/build/dist/676.830837051bc5a24c3371.js +1 -0
  9. package/build/dist/7181.4a2a55b9951c128ed625.js +1 -0
  10. package/build/dist/735.fbde74013a5afe5e8ffe.js +1 -0
  11. package/build/dist/8302.2abcf81d682a064d4265.js +1 -0
  12. package/build/dist/{8358.2daf6c1a2648131280f5.js → 8358.bcf87cc963a6c45e2a5b.js} +1 -1
  13. package/build/dist/index.html +1 -1
  14. package/build/dist/main.7f2845ed77d9e7478d7d.js +2 -0
  15. package/build/main.js +1 -1
  16. package/build/main.js.LICENSE.txt +2 -0
  17. package/package.json +6 -4
  18. package/build/dist/1075.68438aa42e20e5b2d39b.js +0 -1
  19. package/build/dist/1448.41c53710be767688dc3b.js +0 -1
  20. package/build/dist/2674.7cf072e7b6b1ea494153.js +0 -1
  21. package/build/dist/394.c8dd8740abe9c8e966be.js +0 -1
  22. package/build/dist/4091.dc27d7fa32cf3807783c.js +0 -1
  23. package/build/dist/5272.35849826a8ff93db0667.js +0 -1
  24. package/build/dist/6104.a098b61bfbb6b760a05c.js +0 -1
  25. package/build/dist/676.03c97aecffee77868254.js +0 -1
  26. package/build/dist/7181.6cc06f9660ea357c95d9.js +0 -1
  27. package/build/dist/735.542ce0a03ec2ab236b79.js +0 -1
  28. package/build/dist/8302.515d5862923682052f9c.js +0 -1
  29. package/build/dist/main.893570e7db920ac5bb71.js +0 -2
  30. /package/build/dist/{main.893570e7db920ac5bb71.js.LICENSE.txt → main.7f2845ed77d9e7478d7d.js.LICENSE.txt} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1075,4877],{69918(t,e,n){n.d(e,{Ce:()=>i,FG:()=>r.FG,fy:()=>c,gC:()=>a});var r=n(18840),o=n(14284),s=n(53459);async function a(){try{const t=await o.XO.get("md_editor_setting/get");return{...r.FG,...t?.data??{}}}catch(t){return{...r.FG}}}async function c(t){const e=await o.XO.post("md_editor_setting/save",t);return e?.code!==s.m.Success?null:{...r.FG,...e.data??t}}function i(t,e){t&&(t.style.setProperty("--md-editor-max-width",e.content_max_width),t.style.setProperty("--md-editor-padding",e.content_padding),t.style.setProperty("--md-editor-font-size",e.font_size),t.style.setProperty("--md-editor-line-height",e.line_height))}},64877(t,e,n){n.r(e),n.d(e,{default:()=>a});var r=n(96540),o=n(22022),s=n(74848);function a(t){const{t:e}=(0,o.Bd)(),[n,a]=(0,r.useState)(new Set),c=(0,r.useMemo)(()=>function(t){const e=[],n=[];for(const r of t){const t={...r,children:[]};for(;n.length>0&&n[n.length-1].level>=t.level;)n.pop();0===n.length?e.push(t):n[n.length-1].children.push(t),n.push(t)}return e}(t.items),[t.items]),i=(r,o)=>r.map(r=>{const c=r.children.length>0,l=n.has(r.pos),d=r.pos===t.active_pos;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:`md-outline-item md-outline-item--h${r.level}${d?" md-outline-item--active":""}`,style:{paddingLeft:.4+.75*o+"em"},title:r.text,onClick:()=>t.on_click(r),children:[(0,s.jsx)("i",{className:"material-icons md-outline-arrow"+(c?"":" md-outline-arrow--empty"),onClick:c?t=>{return e=r.pos,t.stopPropagation(),void a(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});var e}:void 0,children:c?l?"arrow_right":"arrow_drop_down":""}),(0,s.jsx)("span",{className:"md-outline-text",children:r.text||e("未命名标题")})]}),c&&!l&&i(r.children,o+1)]},r.pos)});return 0===t.items.length?(0,s.jsx)("div",{className:"md-outline md-outline--empty",children:(0,s.jsx)("div",{className:"md-outline-tip",children:e("no_head")})}):(0,s.jsx)("div",{className:"md-outline",children:(0,s.jsx)("div",{className:"md-outline-list",children:i(c,0)})})}},76118(t,e,n){n.d(e,{A:()=>mt});var r=n(96540),o=n(22022),s=n(34843),a=n(82893),c=n(42845),i=n(1575),l=n(58903),d=n(89781),u=n(61396),h=n(46762),m=n(73337),p=n(89552),f=n(86059),g=n(5091),_=n(23802),b=n(41105),k=n(89334);const v=new _.A({html:!0,linkify:!0,breaks:!1,typographer:!1});function y(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}v.renderer.rules.html_block=(t,e)=>`<div data-html-block="${(0,b.pC)(t[e].content)}"></div>`,v.renderer.rules.html_inline=(t,e)=>`<span data-html-inline="${(0,b.pC)(t[e].content)}"></span>`,v.renderer.rules.fence=(t,e)=>{const n=t[e],r=n.info?n.info.trim().split(/\s+/)[0]:"",o=n.content.replace(/\n$/,""),s=v.utils.escapeHtml(o),a=r?` class="language-${y(r)}"`:"";return`<pre${r?` data-language="${y(r)}"`:""}><code${a}>${s}</code></pre>\n`},v.inline.ruler.before("escape","math_inline",function(t,e){const n=t.pos,r=t.src,o=[{open:"\\(",close:"\\)"},{open:"$",close:"$"}];if(r.startsWith("$$",n))return!1;for(const s of o){if(!r.startsWith(s.open,n))continue;const o=n+s.open.length,a=r.indexOf(s.close,o);if(a<0)continue;const c=r.slice(o,a);if(c.trim()){if("$"===s.open){const t=r[a+1];if(void 0!==t&&/\d/.test(t))continue}if(!e){const e=t.push("math_inline","span",0);e.content=c,e.markup=s.open,e.meta={raw:r.slice(n,a+s.close.length)}}return t.pos=a+s.close.length,!0}}return!1}),v.block.ruler.before("fence","math_block",function(t,e,n,r){const o=t.bMarks[e]+t.tShift[e],s=t.eMarks[e],a=t.src.slice(o,s).trim(),c=[{open:"\\[",close:"\\]"},{open:"$$",close:"$$"}];for(const s of c){if(!a.startsWith(s.open))continue;if(a.endsWith(s.close)&&a.length>s.open.length+s.close.length){if(r)return!0;const n=a.slice(s.open.length,a.length-s.close.length),o=t.push("math_block","div",0);return o.content=n,o.markup=s.open,o.meta={raw:a},o.map=[e,e+1],t.line=e+1,!0}const c=a.slice(s.open.length);for(let a=e+1;a<n;a++){const n=t.bMarks[a]+t.tShift[a],i=t.eMarks[a],l=t.src.slice(n,i);if(!l.trimEnd().endsWith(s.close))continue;if(r)return!0;const d=[c,...t.getLines(e+1,a,t.tShift[e],!1).split("\n")].filter((t,e)=>!(0===e&&!t.trim())),u=l.trimEnd().slice(0,-s.close.length);d.push(u);const h=t.push("math_block","div",0);return h.content=d.join("\n").trim(),h.markup=s.open,h.map=[e,a+1],h.meta={raw:t.src.slice(o,t.eMarks[a]).trimEnd()},t.line=a+1,!0}}return!1},{alt:["paragraph","reference","blockquote","list"]}),v.renderer.rules.math_inline=(t,e)=>`<span data-math-inline="${(0,b.pC)(t[e].meta.raw)}"></span>`,v.renderer.rules.math_block=(t,e)=>`<div data-math-block="${(0,b.pC)(t[e].meta.raw)}"></div>`;const w=v.renderer.rules.fence;function $(t){const e=v.render(t??""),n=(new DOMParser).parseFromString(e,"text/html");return l.S4.fromSchema(g.Y).parse(n.body)}function M(t){let e="";return t.forEach(t=>{if(t.isText){let n=t.marks.some(t=>"code"===t.type.name)?t.text??"":function(t){return t.replace(/([\\`*_<>])/g,"\\$1")}(t.text??"");for(const e of t.marks)switch(e.type.name){case"code":n=`\`${t.text??""}\``;break;case"strong":n=`**${n}**`;break;case"em":n=`*${n}*`;break;case"strike":n=`~~${n}~~`;break;case"link":n=`[${n}](${e.attrs.href}${e.attrs.title?` "${e.attrs.title}"`:""})`}e+=n}else if("image"===t.type.name){const{src:n,alt:r,title:o}=t.attrs;e+=`![${r??""}](${n}${o?` "${o}"`:""})`}else"hard_break"===t.type.name?e+=" \n":"html_inline"===t.type.name?e+=t.attrs.value:"math_inline"===t.type.name&&(e+=t.attrs.raw)}),e}function x(t){const e=[];if(t.forEach(t=>{const n=[],r=[];t.forEach(t=>{var e;n.push((e=t.textContent,e.replace(/\|/g,"\\|").replace(/\n/g," ")).trim()),r.push("table_header"===t.type.name)}),e.push({cells:n,header_flags:r})}),0===e.length)return"";const n=Math.max(...e.map(t=>t.cells.length)),r=e[0].header_flags.some(t=>t),o=Array.from({length:n},(t,n)=>Math.max(3,...e.map(t=>A(t.cells[n]??"")))),s=t=>`| ${Array.from({length:n},(e,n)=>{return r=t[n]??"",s=o[n],r+" ".repeat(Math.max(0,s-A(r)));var r,s}).join(" | ")} |`,a=[];if(r){a.push(s(e[0].cells)),a.push(`| ${o.map(t=>"-".repeat(t)).join(" | ")} |`);for(let t=1;t<e.length;t++)a.push(s(e[t].cells))}else{a.push(s(new Array(n).fill(""))),a.push(`| ${o.map(t=>"-".repeat(t)).join(" | ")} |`);for(const t of e)a.push(s(t.cells))}return a.join("\n")}function A(t){let e=0;for(const n of t){const t=n.codePointAt(0)??0;e+=t>=4352&&t<=4447||t>=11904&&t<=42191||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65072&&t<=65135||t>=65280&&t<=65376||t>=65504&&t<=65510?2:1}return e}function E(t,e=""){switch(t.type.name){case"paragraph":default:return e+M(t);case"heading":return`${e}${"#".repeat(t.attrs.level)} ${M(t)}`;case"blockquote":return O(t,"").split("\n").map(t=>`${e}> ${t}`).join("\n");case"code_block":{const n=t.attrs.language??"",r=t.textContent;let o=3;for(const t of r.match(/`+/g)??[])o=Math.max(o,t.length+1);const s="`".repeat(o),a=r.split("\n").map(t=>e+t).join("\n");return`${e}${s}${n}\n${a}\n${e}${s}`}case"horizontal_rule":return`${e}---`;case"html_block":return t.attrs.value.replace(/\n+$/,"").split("\n").map(t=>e+t).join("\n");case"math_block":return t.attrs.raw.replace(/\n+$/,"").split("\n").map(t=>e+t).join("\n");case"bullet_list":{const n=[];return t.forEach((t,r,o)=>{n.push(S(t,e,`${e}- `,`${e} `,o))}),n.join("\n")}case"ordered_list":{const n=[],r=t.attrs.order??1;return t.forEach((t,o,s)=>{n.push(S(t,e,`${e}${r+s}. `,`${e} `,s))}),n.join("\n")}case"table":return x(t).split("\n").map(t=>e+t).join("\n")}}function S(t,e,n,r,o){const s=t.attrs.checked,a=null===s?"":s?"[x] ":"[ ] ",c=[];t.forEach((t,e,n)=>{c.push(E(t,0===n?"":r))});const i=c.join("\n").split("\n");return n+a+i[0]+(i.length>1?"\n"+i.slice(1).join("\n"):"")}function O(t,e=""){const n=[];return t.forEach(t=>{n.push(E(t,e))}),n.join("\n\n")}function D(t){return O(t).trim()+"\n"}function C(t){const e=[];if(t.content.forEach(t=>e.push(t)),1===e.length&&"code_block"===e[0].type.name&&"markdown"===e[0].attrs.language)return e[0].textContent;const n=t.openStart??0,r=t.openEnd??0;return 1===e.length&&1===n&&1===r?N(t.content):O(t.content)}function N(t){const e=[];t.forEach(t=>{["ordered_list","bullet_list","list_item","blockquote"].includes(t.type.name)?e.push(N(t)):e.push(E(t,""))});const n=t.type&&("ordered_list"===t.type.name||"bullet_list"===t.type.name);return e.join(n?"\n":"\n\n")}v.renderer.rules.fence=(t,e,n,r,o)=>{const s=t[e],a=s.info.trim().toLowerCase();return(0,k.lG)(a)?`<div data-math-block="${(0,b.pC)(`$$\n${s.content.trim()}\n$$`)}"></div>`:w(t,e,n,r,o)};n(64877);var L=n(19878);const z=new c.hs("md_source_highlight");function j(t,e,n){let r=e;for(const e of t){if("string"==typeof e){r+=e.length;continue}const t=r;Array.isArray(e.children)&&(r=j(e.children,r,n)),e.scope&&n.push({from:t,to:r,cls:`hljs-${e.scope}`})}return r}function T(t,e){const n=t.textContent;if(!n)return[];const r=t.attrs.language??"";if(!r||!L.A.getLanguage(r))return[];let o;try{o=L.A.highlight(n,{language:r,ignoreIllegals:!0})}catch{return[]}const s=[],a=o._emitter?.rootNode;a?.children&&j(a.children,0,s);const c=e+1,l=[];for(const t of s){const e=Math.min(t.from,n.length),r=Math.min(t.to,n.length);e>=r||l.push(i.NZ.inline(c+e,c+r,{class:t.cls}))}return l}function R(){return new c.k_({key:z,props:{decorations(t){const e=function(t){const e=[];return t.descendants((t,n)=>"code_block"!==t.type.name||(e.push(...T(t,n)),!1)),i.zF.create(t,e)}(t.doc);return e.find().length?e:null}}})}var V=n(89117),P=n(86063),G=n(52388);const I=new c.hs("md-graph"),q=new Map,F=new Map,W=new Map,H=new Map;function B(t,e){return`${t}\0${e}`}function K(t,e,n){return(r,o)=>{const s=B(r,o),a=t.get(s);if(a)return Promise.resolve(a);let c=e.get(s);return c||(c=n(r,o).then(n=>(t.set(s,n),e.delete(s),n)),e.set(s,c)),c}}const U=K(q,F,(t,e)=>(0,V.U6)(t,e)),J=K(W,H,(t,e)=>(0,P.Hn)(e));function X(t,e){const n=document.createElement("button");return n.className="md-graph__edit",n.type="button",n.textContent=G.A.t("clk_edt"),n.addEventListener("click",n=>{n.stopPropagation(),function(t,e){if(!t)return;const n=Math.min(e+1,t.state.doc.content.size);t.dispatch(t.state.tr.setSelection(c.U3.near(t.state.doc.resolve(n),1))),t.focus()}(t(),e)}),n}function Y(t,e){if(e.error)return t.className="md-graph__body",void(t.textContent=e.error);t.className="md-graph__body",t.innerHTML=e.svg}function Z(t,e,n,r){const o=document.createElement("div");o.className="md-graph",o.setAttribute("contenteditable","false");const s=document.createElement("div");s.className="md-graph__body",s.addEventListener("click",()=>{const n=q.get(B(e,t));n&&!n.error&&n.svg&&function(t){const e=document.createElement("div");e.className="md-graph-zoom";const n=document.createElement("div");let r;n.className="md-graph-zoom__body";const o=document.createElement("button");o.className="md-graph-zoom__close",o.type="button",o.title=G.A.t("取消"),o.innerHTML='<i class="material-icons">close</i>';const s=t=>{"Escape"===t.key&&a()};function a(){"function"==typeof r&&r(),document.removeEventListener("keydown",s),e.remove()}e.addEventListener("click",t=>{t.target===e&&a()}),o.addEventListener("click",a),document.addEventListener("keydown",s),e.append(n,o),document.body.appendChild(e),r=t(n)}(t=>{t.innerHTML=n.svg})}),o.append(s,X(r,n));const a=q.get(B(e,t));return a?(a.error&&o.classList.add("md-graph--error"),Y(s,a),o):(o.classList.add("md-graph--loading"),s.textContent=G.A.t("rendering"),U(e,t).then(t=>{o.isConnected&&(o.classList.remove("md-graph--loading"),t.error&&o.classList.add("md-graph--error"),Y(s,t))}),o)}function Q(t,e,n){const r=[],{from:o,to:s}=t.selection;return t.doc.descendants((t,a)=>{if("code_block"!==t.type.name)return;const c=t.attrs.language,l=(0,V.Hm)(c),d=(0,P.hj)(c);if(!l&&!d)return;const u=a,h=a+t.nodeSize;if(function(t,e,n,r){return t<=r&&e>=n}(o,s,u,h))return;const m=t.textContent;if(!m.trim())return;r.push(i.NZ.node(u,h,{class:"md-graph-hidden"}));const p=`graph-${c}-${u}-${m}`;d?r.push(i.NZ.widget(h,()=>function(t,e,n,r,o){const s=document.createElement("div");s.className="md-graph md-graph--mind",s.setAttribute("contenteditable","false"),s.textContent=G.A.t("rendering");const a=X(r,n);let c=null;return s.__unmount=()=>{c?.destroy(),c=null},J(e,t).then(t=>{s.isConnected&&(s.textContent="",s.append(a),t.mount(s).then(t=>{s.isConnected?c=t:t.destroy()}).catch(t=>{console.error("[mind] mount failed",t)}))}),s.addEventListener("click",()=>{o?.(t,e=>function(t,e,n,r){if(!t||r===n)return;const o=t.state.doc;let s=null;const a=o.nodeAt(e);if(a&&"code_block"===a.type.name&&a.textContent===n?s={from:e+1,to:e+a.nodeSize-1}:o.descendants((t,e)=>!(s||"code_block"===t.type.name&&"smm-mind"===t.attrs.language&&t.textContent===n&&(s={from:e+1,to:e+t.nodeSize-1},1))),!s)return;const c=t.state.tr.replaceWith(s.from,s.to,t.state.schema.text(r));t.dispatch(c)}(r(),n,t,e))}),s}(m,c,u,e,n),{side:-1,ignoreSelection:!0,key:p,destroy:t=>t.__unmount?.()})):r.push(i.NZ.widget(h,()=>Z(m,c,u,e),{side:-1,ignoreSelection:!0,key:p}))}),i.zF.create(t.doc,r)}function tt(t){let e=null;return new c.k_({key:I,props:{decorations(n){const r=Q(n,()=>e,t);return r.find().length?r:null}},view:t=>(e=t,{destroy(){e=null}})})}const et=new Map;class nt{dom;node;view;get_pos;render_box;source_input;editing=!1;draft=null;painted_raw="";constructor(t,e,n){this.node=t,this.view=e,this.get_pos=n;const r="math_block"===t.type.name;this.dom=document.createElement(r?"div":"span"),this.dom.className=r?"md-math md-math--block":"md-math md-math--inline",this.dom.setAttribute("contenteditable","false"),this.render_box=document.createElement("span"),this.render_box.className="md-math__render",this.source_input=document.createElement("textarea"),this.source_input.className="md-math__source",this.source_input.setAttribute("spellcheck","false"),this.source_input.setAttribute("wrap","off"),this.source_input.setAttribute("rows","1"),this.dom.append(this.render_box,this.source_input),function(t,e){et.set(t,e)}(n(),this),this.source_input.addEventListener("input",()=>{this.draft=this.source_input.value,this.auto_size()}),this.source_input.addEventListener("blur",()=>this.commit()),this.source_input.addEventListener("keydown",t=>{t.stopPropagation(),"Escape"===t.key&&(t.preventDefault(),this.draft=null,this.set_editing(!1))});for(const t of["beforeinput","paste","input","keyup","keypress"])this.source_input.addEventListener(t,t=>t.stopPropagation());this.render_box.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation(),this.focus_source()}),this.paint(t)}paint(t){const e=t.attrs.raw;if(this.editing)return this.dom.setAttribute("data-mode","source"),null===this.draft&&(this.source_input.value=e),void this.auto_size();if(this.dom.setAttribute("data-mode","preview"),this.painted_raw===e)return;this.painted_raw=e;const n=this.render_box;n.classList.add("md-math--loading"),n.textContent="",n.textContent=e,(0,k.z$)(n,t.attrs.tex,"math_block"===t.type.name?"block":"inline",e)}auto_size(){const t=this.source_input;t.style.height="0px",t.style.height=`${t.scrollHeight}px`}focus_source(){this.editing||(this.set_editing(!0),this.source_input.focus(),this.source_input.setSelectionRange(this.source_input.value.length,this.source_input.value.length))}set_editing(t){this.editing!==t&&(this.editing=t,this.paint(this.node))}set_selected(t){t?this.focus_source():this.editing&&(this.commit(),this.set_editing(!1))}commit(){if(null===this.draft)return;const t=this.draft;if(this.draft=null,t===this.node.attrs.raw)return;const e=this.get_pos(),n=this.view.state.doc.nodeAt(e);if(!n)return;const r=(0,k.V)(t),o=r?.tex??t;this.view.dispatch(this.view.state.tr.setNodeMarkup(e,void 0,{...n.attrs,raw:t,tex:o})),this.painted_raw=""}update(t){if(t.type!==this.node.type)return!1;const e=t.attrs.raw!==this.node.attrs.raw;return this.node=t,e&&(this.draft=null,this.painted_raw=""),this.paint(t),!0}stopEvent(t){return this.dom.contains(t.target)}ignoreMutation(){return!0}destroy(){this.draft=null,function(t){for(const[e,n]of et)if(n===t)return void et.delete(e)}(this)}}function rt(t){const e=t.state.selection,n=e.from,r=e.to;for(const[t,e]of et){const o=r>t&&n<=t+1;e.set_selected(o)}}var ot=n(67951),st=(n(41631),n(50576),n(70432),n(74848));function at(t){return 0===t?(0,ot.uf)("paragraph"):(0,ot.uf)("heading",{level:t})}function ct(t){return!(!t.ctrlKey&&!t.metaKey)}function it(t,e){let n=null;try{const r=t.domAtPos(e).node,o=1===r.nodeType?r:r.parentElement;n=o?o.closest(".md-filecat-content > *")??o:null}catch{}if(!n)return;const r=n.closest(".md-editor-scroll");if(!r)return;const o=parseFloat(getComputedStyle(n).scrollMarginTop)||0,s=r.scrollTop+n.getBoundingClientRect().top-r.getBoundingClientRect().top-o,a=r.scrollHeight-r.clientHeight;!function(t,e){const n=t.scrollTop,r=e-n;if(Math.abs(r)<1)return;const o=performance.now(),s=e=>{const a=Math.min(1,(e-o)/500);t.scrollTop=n+r*(1-Math.pow(1-a,3)),a<1&&requestAnimationFrame(s)};requestAnimationFrame(s)}(r,Math.max(0,Math.min(s,a)))}function lt(t,e){return(0,f.D8)(1)(t,e)}const dt=r.forwardRef(function(t,e){const{t:n}=(0,o.Bd)(),_=(0,r.useRef)(null),k=(0,r.useRef)(null),[,v]=(0,s.fp)(a.AG.mind_editor),y=(0,r.useRef)(t.on_change),w=(0,r.useRef)(t.on_save),M=(0,r.useRef)(t.on_selection_change),x=(0,r.useRef)(t.on_source_mode_change),A=(0,r.useRef)();return A.current=(t,e)=>{v({name:n("思维导图"),code_source:t,on_save_code:t=>e(t)})},(0,r.useEffect)(()=>{y.current=t.on_change,w.current=t.on_save,M.current=t.on_selection_change,x.current=t.on_source_mode_change}),(0,r.useEffect)(()=>{if(!_.current)return;g.Y;(0,b.sL)(t.doc_path?t.doc_path.replace(/[^/]*$/,""):"");const n=c.$t.create({doc:$(t.value??""),plugins:[(0,d.b6)(),R(),tt((t,e)=>A.current?.(t,e)),new c.k_({view:t=>(rt(t),{update:(t,e)=>{t.state.selection===e.selection&&t.state.doc===e.doc||rt(t)}})}),(0,ot.k5)(),(0,u.w)({"Mod-a":ot.Rx,"Mod-z":d.tN,"Mod-y":d.ZS,"Mod-Shift-z":d.ZS,"Mod-b":(0,ot.NH)("strong"),"Mod-i":(0,ot.NH)("em"),"Mod-Shift-x":(0,ot.NH)("strike"),"Mod-`":(0,ot.NH)("code"),"Mod-1":(t,e)=>at(1)(t,e),"Mod-2":(t,e)=>at(2)(t,e),"Mod-3":(t,e)=>at(3)(t,e),"Mod-0":(t,e)=>at(0)(t,e),"Mod-Shift-8":ot.fK,"Mod-Shift-9":ot.oB,"Mod-Shift-.":ot.Vu,Tab:ot.G8.sink,"Shift-Tab":ot.G8.lift,"Mod-Enter":lt,"Mod-s":()=>(w.current?.(),!0)}),(0,f.LF)({allowTableNodeSelection:!0}),(0,f.AL)(),(0,m.A)({color:"var(--primary, #1a73e8)",width:2}),(0,p.z)(),(0,u.w)({Enter:(0,h.st)(ot.x0,h.pC,ot.G8.split,h.Z1,h.iz,h.aw),"Shift-Enter":(t,e)=>{const{hard_break:n}=t.schema.nodes;return e&&e(t.tr.replaceSelectionWith(n.create()).scrollIntoView()),!0},"Mod-Enter":h.I$}),(0,u.w)(h.RV)]}),r=t=>t.setAttribute("data-img-error",""),o=t=>"IMG"===t.tagName&&!t.classList.contains("ProseMirror-separator"),s=t=>{const e=t.target;"IMG"===e?.tagName&&o(e)&&r(e)},a=t=>{const e=t.target;"IMG"===e?.tagName&&o(e)&&(t=>{t.removeAttribute("data-img-error")})(e)},v=_.current;v.addEventListener("error",s,!0),v.addEventListener("load",a,!0);const E=()=>{v.querySelectorAll("img").forEach(t=>{if(!o(t))return;const e=t;e.dataset.imgSeen||(e.dataset.imgSeen="1",e.complete?0===e.naturalWidth&&r(e):r(e))})},S=new MutationObserver(()=>{requestAnimationFrame(E)});S.observe(v,{childList:!0,subtree:!0}),E();let O=null;if(O=new i.Lz(_.current,{state:n,editable:()=>!1!==t.editable,nodeViews:{...(0,b.op)(),math_block:(t,e,n)=>new nt(t,e,n),math_inline:(t,e,n)=>new nt(t,e,n)},handleClickOn(t,e,n,r,o){if(!ct(o))return!1;const s=function(t){if(!(t instanceof Element))return null;const e=t.closest("a[href]"),n=e?.getAttribute("href");return n||null}(o.target)??function(t,e){const n=t.doc.content.size,r=Math.max(0,Math.min(e,n));let o;try{o=t.doc.resolve(r)}catch{return null}for(const e of[1,-1]){const o=1===e?r:r-1;if(!(o<0||o>=n))try{const e=t.doc.resolve(o).marks().find(t=>"link"===t.type.name);if(e?.attrs?.href)return e.attrs.href}catch{}}try{const t=o.parent.marks.find(t=>"link"===t.type.name);if(t?.attrs?.href)return t.attrs.href}catch{}return null}(t.state,e);return!!s&&(window.open(s,"_blank","noopener,noreferrer"),!0)},clipboardTextSerializer:t=>C(t),handlePaste(t,e){const n=e.clipboardData?.getData("text/plain");if(!n)return!1;const{from:r,to:o}=t.state.selection;if(ht(t.state.doc,r)&&ht(t.state.doc,o))return t.dispatch(t.state.tr.insertText(n.replace(/\r\n?/g,"\n"),r,o).scrollIntoView()),!0;const s=e.clipboardData?.getData("text/html");if(s&&function(t){if(!t)return!1;try{const e=(new DOMParser).parseFromString(t,"text/html"),n=Array.from(e.body.children);return 1===n.length&&"PRE"===n[0].tagName}catch{return!1}}(s)){const e=$(n);return t.dispatch(t.state.tr.replaceSelection(new l.Ji(e.content,0,0)).scrollIntoView()),!0}return!1},handleDOMEvents:{keydown:(t,e)=>{if(ct(e)&&t.dom.classList.add("md-ctrl-down"),ut(t.state.doc)&&"Enter"===e.key&&!e.ctrlKey&&!e.metaKey&&!e.altKey){e.preventDefault();const{from:n,to:r}=t.state.selection;return t.dispatch(t.state.tr.insertText("\n",n,r).scrollIntoView()),!0}return!1},keyup:(t,e)=>(ct(e)||t.dom.classList.remove("md-ctrl-down"),!1),blur:t=>(t.dom.classList.remove("md-ctrl-down"),!1),beforeinput:(t,e)=>{if(!ut(t.state.doc))return!1;const n=e;if("insertText"!==n.inputType)return!1;const r=n.data;if(null==r)return!1;n.preventDefault();const{from:o,to:s}=t.state.selection;return t.dispatch(t.state.tr.insertText(r.replace(/\r\n?/g,"\n"),o,s).scrollIntoView()),!0}},dispatchTransaction(t){const e=O.state.apply(t);O.updateState(e);const n=ut(e.doc);n?O.dom.classList.add("md-source-mode"):O.dom.classList.remove("md-source-mode"),n!==ut(t.before)&&x.current?.(n),t.docChanged&&y.current?.(n?e.doc.textContent:D(e.doc)),(t.selectionSet||t.docChanged)&&M.current?.()},attributes:{class:"md-filecat-content",spellcheck:"false"}}),k.current=O,t.initial_source_mode&&!ut(O.state.doc)){const t=D(O.state.doc),e=O.state.schema.nodes.code_block.create({language:"markdown"},t?O.state.schema.text(t):null),n=O.state.tr;n.replaceWith(0,O.state.doc.content.size,e),n.setMeta("addToHistory",!1),O.dispatch(n)}const N={get_markdown:()=>ut(O.state.doc)?O.state.doc.textContent:D(O.state.doc),set_markdown:t=>{const e=$(t);O.dispatch(O.state.tr.replaceWith(0,O.state.doc.content.size,e.content))},focus:()=>O.focus(),get_view:()=>k.current,in_table:()=>function(t){const{$from:e}=t.selection;for(let t=e.depth;t>0;t--){if("table"===e.node(t).type.name)return!0}return!1}(O.state),active_marks:()=>(O.state.storedMarks??O.state.selection.$from.marks()).map(t=>t.type.name),active_block:()=>{const{$from:t}=O.state.selection;for(let e=t.depth;e>0;e--){const n=t.node(e);if("heading"===n.type.name)return{name:"heading",level:n.attrs.level};if("paragraph"===n.type.name)return{name:"paragraph"}}return{name:"paragraph"}},insert_table:(t=3,e=3)=>{const n=function(t,e,n){const r=(0,f.e)(t),o=r.table,s=r.row,a=r.cell,c=r.header_cell??r.cell;if(!o||!s||!a)return null;const i=t=>s.create(null,Array.from({length:e},()=>t.createAndFill())),l=i(c),d=Array.from({length:n},()=>i(a));return o.create(null,[l,...d])}(O.state.schema,t,e);if(!n)return;const{from:r}=O.state.selection,o=O.state.doc.resolve(r);let s=r;for(let t=o.depth;t>0;t--)if("table"===o.node(t).type.name){s=o.after(t);break}const a=O.state.tr;s===r?a.replaceSelectionWith(n):a.insert(s,n),O.dispatch(a.scrollIntoView());const c=O.state.doc.resolve(Math.min(s+3,O.state.doc.content.size));try{O.dispatch(O.state.tr.setSelection(O.state.selection.constructor.near(c)))}catch{}},get_headings:()=>function(t){const e=[];return t.doc.descendants((t,n)=>("heading"!==t.type.name||e.push({level:t.attrs.level,text:t.textContent,pos:n}),!0)),e}(O.state),scroll_to_pos:t=>{const e=O.state.doc.content.size,n=Math.max(0,Math.min(t,e)),r=O.state.doc.nodeAt(n);let o;try{o=r?c.U3.near(O.state.doc.resolve(n+1),1):c.U3.near(O.state.doc.resolve(n),1)}catch{o=c.U3.near(O.state.doc.resolve(0),1)}O.dispatch(O.state.tr.setSelection(o)),it(O,o.from),O.focus()},is_source_mode:()=>ut(O.state.doc),enter_source_mode:()=>{if(ut(O.state.doc))return;const t=D(O.state.doc),e=O.state.schema.nodes.code_block.create({language:"markdown"},t?O.state.schema.text(t):null),n=O.state.tr;n.replaceWith(0,O.state.doc.content.size,e),O.dispatch(n),O.dom.classList.add("md-source-mode")},exit_source_mode:()=>{if(!ut(O.state.doc))return;const t=$(O.state.doc.textContent),e=O.state.tr;e.replaceWith(0,O.state.doc.content.size,t.content),O.dispatch(e),O.dom.classList.remove("md-source-mode")}};return"function"==typeof e?e(N):e&&(e.current=N),t.on_ready?.(N),()=>{S.disconnect(),v.removeEventListener("error",s,!0),v.removeEventListener("load",a,!0),O.destroy(),k.current=null}},[]),(0,st.jsx)("div",{className:"md-filecat",ref:_})});function ut(t){if(1!==t.childCount)return!1;const e=t.firstChild;return!!e&&"code_block"===e.type.name&&"markdown"===e.attrs.language}function ht(t,e){const n=t.resolve(e);for(let t=n.depth;t>0;t--)if("code_block"===n.node(t).type.name)return!0;return!1}const mt=dt},67951(t,e,n){n.d(e,{NH:()=>d,k5:()=>l,uf:()=>u});var r=n(38341),o=n(5091),s=n(42845),a=n(46762),c=n(3772);function i(t,e){return new r.fV(t,(t,n,r,o)=>{const s=t.schema.marks[e],a=n[1];if(!s||!a)return null;const c=n[0].indexOf(a);if(c<0)return null;const i=r+c,l=i+a.length,d=t.tr;return d.delete(l,o),d.delete(r,i),d.addMark(r,r+a.length,s.create()),d.removeStoredMark(s),d})}function l(){const t=o.Y;return(0,r.sM)({rules:[(0,r.JJ)(/^(#{1,6})\s$/,t.nodes.heading,t=>({level:t[1].length})),(0,r.JJ)(/^#([1-6])\s$/,t.nodes.heading,t=>({level:Number(t[1])})),(0,r.JJ)(/^```([\w-]*)\s$/,t.nodes.code_block,t=>({language:t[1]??""})),(0,r.tG)(/^\s*>\s$/,t.nodes.blockquote),(0,r.tG)(/^\s*([-+*])\s$/,t.nodes.bullet_list),(0,r.tG)(/^(\d+)\.\s$/,t.nodes.ordered_list,t=>({order:Number(t[1])})),i(/(?:\*\*)([^*]+)(?:\*\*)$/,"strong"),i(/(?:__)([^_]+)(?:__)$/,"strong"),i(/(?<![*])\*([^*]+)\*$/,"em"),i(/(?<![_])_([^_]+)_$/,"em"),i(/(?:~~)([^~]+)(?:~~)$/,"strike"),i(/(?:`)([^`]+)(?:`)$/,"code"),new r.fV(/!\[([^\]]*)\]\(([^)\s]+)\)$/,(t,e,n,r)=>{const o=e[1]??"",s=e[2];return s?t.tr.replaceWith(n,r,t.schema.nodes.image.create({src:s,alt:o})):null}),...r.Fr,r.gO]})}function d(t){return(e,n)=>{const r=e.schema.marks[t];return!!r&&(0,a.wh)(r)(e,n)}}function u(t,e={}){return(n,r)=>{const o=n.schema.nodes[t];if(!o)return!1;const{$from:s,$to:a}=n.selection,c=s.blockRange(a);if(!c)return!1;const i=s.parent,l=i.type===o&&Object.entries(e).every(([t,e])=>i.attrs[t]===e),d=l?n.schema.nodes.paragraph:o,u=l?{}:e;return r&&r(n.tr.setBlockType(c.start,c.end,d,u)),!0}}const h=(t,e)=>(0,c.Sd)(t.schema.nodes.bullet_list)(t,e),m=(t,e)=>(0,c.Sd)(t.schema.nodes.ordered_list)(t,e),p={sink:(0,c.$B)(o.Y.nodes.list_item),lift:(0,c.T2)(o.Y.nodes.list_item),split:(0,c.wn)(o.Y.nodes.list_item),wrap_bullet:h,wrap_ordered:m};n.d(e,["G8",0,p,"Rx",0,(t,e)=>{const{$from:n}=t.selection;return"code_block"===n.parent.type.name&&(e&&e(t.tr.setSelection(s.U3.create(t.doc,n.start(),n.end())).scrollIntoView()),!0)},"Vu",0,(t,e)=>{const{blockquote:n}=t.schema.nodes,{$from:r,$to:o}=t.selection,s=r.blockRange(o);if(!s)return!1;if(s.parent.type===n&&s.depth>0){const n=r.before(s.depth),o=t.tr.doc.nodeAt(n);if(o&&1===o.childCount)return e&&e(t.tr.replaceWith(n,n+o.nodeSize,o.child(0)).scrollIntoView()),!0;if(e){const n=t.tr,o=r.parent,a=r.after(s.depth);n.delete(s.start,s.end),n.insert(a,o),e(n.scrollIntoView())}return!0}return e&&e(t.tr.wrap(s,[{type:n}]).scrollIntoView()),!0},"fK",0,h,"oB",0,m,"x0",0,(t,e)=>{const{$from:n,empty:r}=t.selection;if(!r||"paragraph"!==n.parent.type.name)return!1;const o=n.parent.textContent;if(!o.trim())return!1;const a=function(t){const e=t.trim(),n=/^#([1-6])$/.exec(e);if(n)return{type:"heading",attrs:{level:Number(n[1])}};const r=/^(#{1,6})$/.exec(e);if(r)return{type:"heading",attrs:{level:r[1].length}};const o=/^```([\w-]*)$/.exec(e);return o?{type:"code_block",attrs:{language:o[1]??""}}:/^(?:-{3,}|\*{3,}|_{3,})$/.test(e.replace(/\s+/g,""))?{type:"horizontal_rule"}:/^>\s*$/.test(e)?{type:"blockquote"}:/^[-+*]\s*$/.test(e)?{type:"bullet_list"}:/^\d+[.)]$/.test(e)?{type:"ordered_list"}:null}(o);if(!a)return!1;if("blockquote"===a.type&&n.depth>1)return!1;const c=t.schema.nodes[a.type];if(!c)return!1;const i=n.before(n.depth),l=n.after(n.depth);if(e){const n=t.tr,r=c.createAndFill(a.attrs)??c.create(a.attrs);n.replaceWith(i,l,r);const o=Math.min(i+1,n.doc.content.size);try{n.setSelection(s.U3.near(n.doc.resolve(o),1))}catch{}n.scrollIntoView(),e(n)}return!0}])},96763(t,e,n){n.d(e,{Kz:()=>a,P7:()=>l,_8:()=>h,_D:()=>u,bN:()=>s,sO:()=>d});var r=n(14284),o=n(53459);function s(t,e){const n="md-theme-style-"+t,r=document.getElementById(n);if(!e)return void r?.remove();let o=r;o||(o=document.createElement("style"),o.id=n,document.head.appendChild(o)),o.textContent=e}async function a(){try{const t=await r.XO.get("md_theme/list");return t?.code===o.m.Success?t.data??[]:[]}catch(t){return[]}}const c="md-theme-change";function i(){window.dispatchEvent(new Event(c))}async function l(t){try{const e=await r.XO.get(`md_theme/get?id=${encodeURIComponent(t)}`);return e?.code===o.m.Success?e.data??"":""}catch(t){return""}}async function d(){try{const t=await r.XO.get("md_theme/active");return t?.code===o.m.Success?t.data??"":""}catch(t){return""}}async function u(t){const e=await r.XO.post("md_theme/save",t);return e?.code!==o.m.Success?null:(i(),e.data)}async function h(t){const e=await r.XO.post("md_theme/del",{id:t});return e?.code===o.m.Success&&(i(),!0)}n.d(e,["o3",0,c])},5091(t,e,n){var r=n(58903),o=n(86059),s=n(41105),a=n(89334);const c=(0,o.of)({tableGroup:"block",cellContent:"block+",cellAttributes:{}}),i={align:{default:null}},l={doc:{content:"block+"},paragraph:{content:"inline*",group:"block",attrs:i,parseDOM:[{tag:"p"}],toDOM:t=>["p",t.attrs.align?{style:`text-align:${t.attrs.align}`}:{},0]},heading:{content:"inline*",group:"block",attrs:{level:{default:1},...i},defining:!0,parseDOM:[1,2,3,4,5,6].map(t=>({tag:`h${t}`,attrs:{level:t}})),toDOM(t){const e=t.attrs.align?{style:`text-align:${t.attrs.align}`}:{};return[`h${t.attrs.level}`,e,0]}},bullet_list:{group:"block",content:"list_item+",parseDOM:[{tag:"ul"}],toDOM:()=>["ul",0]},ordered_list:{group:"block",content:"list_item+",attrs:{order:{default:1}},parseDOM:[{tag:"ol",getAttrs:t=>({order:Number(t.getAttribute("start")??1)})}],toDOM:t=>1===t.attrs.order?["ol",0]:["ol",{start:t.attrs.order},0]},list_item:{content:"paragraph block*",defining:!0,attrs:{checked:{default:null}},parseDOM:[{tag:"li",getAttrs:t=>{const e=t,n=e.querySelector("input[type=checkbox]");if(n)return{checked:n.checked};const r=e.getAttribute("data-checked");return{checked:null===r?null:"true"===r}}}],toDOM:t=>null!==t.attrs.checked?["li",{"data-checked":String(t.attrs.checked)},0]:["li",0]},blockquote:{content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]},code_block:{content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>{const e=t.querySelector("code"),n=/language-([\w-]+)/.exec(e?.className??"");return{language:n?n[1]:""}}}],toDOM:t=>["pre",{"data-language":t.attrs.language},["code",0]]},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:()=>["hr"]},html_block:{group:"block",atom:!0,code:!0,attrs:{value:{default:""}},parseDOM:[{tag:"div[data-html-block]",getAttrs:t=>({value:(0,s.Ne)(t.getAttribute("data-html-block")??"")})}],toDOM:t=>["div",{"data-html-block":t.attrs.value}]},html_inline:{inline:!0,group:"inline",atom:!0,code:!0,attrs:{value:{default:""}},parseDOM:[{tag:"span[data-html-inline]",getAttrs:t=>({value:(0,s.Ne)(t.getAttribute("data-html-inline")??"")})}],toDOM:t=>["span",{"data-html-inline":t.attrs.value}]},math_inline:{inline:!0,group:"inline",atom:!0,attrs:{raw:{default:""},tex:{default:""}},parseDOM:[{tag:"span[data-math-inline]",getAttrs:t=>{const e=t,n=(0,s.Ne)(e.getAttribute("data-math-inline")??"");return{raw:n,tex:(0,a.V)(n)?.tex??""}}}],toDOM:t=>["span",{"data-math-inline":t.attrs.raw}]},math_block:{group:"block",atom:!0,code:!0,attrs:{raw:{default:""},tex:{default:""}},parseDOM:[{tag:"div[data-math-block]",getAttrs:t=>{const e=t,n=(0,s.Ne)(e.getAttribute("data-math-block")??"");return{raw:n,tex:(0,a.V)(n)?.tex??""}}}],toDOM:t=>["div",{"data-math-block":t.attrs.raw}]},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:()=>["br"]},image:{inline:!0,group:"inline",draggable:!0,attrs:{src:{},alt:{default:null},title:{default:null}},parseDOM:[{tag:"img[src]",getAttrs:t=>{const e=t;return{src:e.getAttribute("src"),alt:e.getAttribute("alt"),title:e.getAttribute("title")}}}],toDOM(t){const{src:e,alt:n,title:r}=t.attrs,o={src:(0,s.KR)(e)};return n&&(o.alt=n),r&&(o.title=r),["img",o]}},text:{group:"inline"},...c},d={strong:{parseDOM:[{tag:"strong"},{tag:"b"},{style:"font-weight=bold"}],toDOM:()=>["strong",0]},em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"}],toDOM:()=>["em",0]},strike:{parseDOM:[{tag:"s"},{tag:"del"},{tag:"strike"}],toDOM:()=>["s",0]},code:{parseDOM:[{tag:"code",getAttrs:t=>"PRE"!==t.parentElement?.tagName&&null}],toDOM:()=>["code",0]},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:t=>{const e=t;return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM(t){const{href:e,title:n}=t.attrs;return["a",{href:e,title:n,rel:"noopener noreferrer",target:"_blank"},0]}}},u=new r.Sj({nodes:l,marks:d});n.d(e,["Y",0,u])}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1448],{83277(e,t,n){n.d(t,{$j:()=>s,Lv:()=>l});class l{token;open=!1;note;index;url;model;request_type;json_params;sys_prompt;dotenv="";yaml_env="";tool_mode=!1;show_options;static get_label_by_v(e,t){if(!e||!t?.length)return e;for(const n of t)if(n.value===e)return n.label;return e}static have_label_by_v(e,t){if(!e||!t?.length)return!1;for(const n of t)if(n.value===e)return!0;return!1}}const i=JSON.stringify({stream:!0,thinking:{type:"disabled"}});function s(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"text"===e.type?e.text:"[图片]").join("\n"):""}n.d(t,["CP",0,"\n# 聊天循环最大次数\ntool_call_max: 500\n\n# 是否允许AI直接执行命令而不需要用户确认。\n# 默认为 false,需要用户手动确认;使用 workflow 时等价于 true。\nallow_exec_cmd_directly: false\n\n# 可选的大模型请求代理地址\n# proxy_url: http://127.0.0.1:7890\n\n# 可选的多个 url\n# options_agent_url_list:\n# - value: http://...\n# label: openai\n\n# 可选的多个 key\n# options_agent_key_list:\n# - value: sk-aaa\n# label: option1\n\n# 可选的多个 model\n# options_agent_model_list:\n# - value: gpt-5.5\n# label: gpt\n\n# 本地 prompt 文件列表,每次聊天时自动读取并加载\n# options_local_file_path_prompt_list:\n# - /prompt/a.txt\n\n# 开启切换模型,AI 可以根据 prompt 自己决定下一步调用哪个模型\n# open_pick_model: false\n\n# 历史消息裁剪相关\nmax_recent_messages: 12\ncompress_message_count: 16\nmax_tool_content_chars: 200\n\n# ===== 模型类型(request_type)=====\n# 默认 completions,可选值:\n# completions 标准对话/聊天补全 (chat/completions)\n# images 图片生成 (images/generations)\n# audio_speech 文本转语音 (audio/speech)\n# audio_transcription 语音转文字 (audio/transcriptions)\n# audio_translation 语音翻译 (audio/translations)\n# embeddings 向量嵌入 (embeddings)\n# request_type: completions\n\n# ===== 成为 tool(tool_mode)=====\n# 开启后该模型会作为一个工具被加载,供 AI agent 动态调用。\n# 注意:不能与「是否开启」(open) 同时为 true。\n# tool_mode: false\n\n# ===== 图片理解(image_understanding)=====\n# 开启后注册 read_image 工具,工具读到的图片会以 image_url 多模态格式随消息发给模型。\nimage_understanding: true\n\n# ===== 命令环境变量(command_env)=====\n# AI 调用内置命令工具(exec_cmd / exec_cmd_background)执行命令时,\n# 这里配置的变量会覆盖到子进程的环境变量上。\n# command_env:\n# NODE_ENV: production\n# HTTP_PROXY: http://127.0.0.1:7890\n\n# 是否允许 AI 通过 set_command_env 工具修改上面的 command_env\ncommand_env_tool: false\n","cL",0,i])},11448(e,t,n){n.r(t),n.d(t,{RebotCardContainer:()=>f,default:()=>y});var l=n(22022),i=n(96540),s=n(85997),a=n(4412),o=n(75725),r=n(61443),c=n(70447),d=n(14284),p=n(53459),_=n(62042),h=n(78247),m=n(23430),x=n(61973),u=(n(83277),n(92350)),j=n(74848);const b={qq:{key:"qq",label:"QQ 机器人",icon:"QQ",color:"#12B7F5",fields:[{key:"appId",label:"AppId",type:"text",placeholder:"请输入机器人 AppId",required:!0},{key:"clientSecret",label:"密钥",type:"password",placeholder:"请输入机器人密钥",required:!0}]},dingtalk:{key:"dingtalk",label:"钉钉机器人",icon:"钉钉",color:"#0089FF",fields:[{key:"appId",label:"ClientId (AppKey)",type:"text",placeholder:"请输入应用 ClientId",required:!0},{key:"clientSecret",label:"ClientSecret (AppSecret)",type:"password",placeholder:"请输入应用 ClientSecret",required:!0}]},wecom:{key:"wecom",label:"企业微信机器人",icon:"企业微信",color:"#07C160",fields:[{key:"appId",label:"botId",type:"text",placeholder:"请输入机器人 botId",required:!0},{key:"clientSecret",label:"Secret",type:"password",placeholder:"请输入机器人 Secret",required:!0}]},lark:{key:"lark",label:"飞书机器人",icon:"飞书",color:"#3370FF",fields:[{key:"appId",label:"App ID",type:"text",placeholder:"请输入应用 App ID",required:!0},{key:"clientSecret",label:"App Secret",type:"password",placeholder:"请输入应用 App Secret",required:!0}]}},g=Object.entries(b).map(([e,t])=>({value:e,title:t.label,color:t.color}));function f(e){const{t}=(0,l.Bd)(),[n,a]=(0,i.useState)(!1),[o,c]=(0,i.useState)(!1),d=(t,n)=>{const l=[...e.items];l[t]={...l[t],...n},e.setItems(l)},p=t=>{const n=[...e.items];n.splice(t,1),e.setItems(n)},_=t=>{e.setItems([...e.items,{...e.items[t],open:!1,name:(e.items[t].name||"")+" (副本)"}])};return(0,j.jsxs)(i.Fragment,{children:[(0,j.jsx)("div",{className:"airebot-setting__toolbar",children:!1!==e.have_auth_edit&&(0,j.jsxs)(j.Fragment,{children:[n?(0,j.jsxs)("div",{className:"airebot-setting__add-select",children:[(0,j.jsx)(r.l6,{options:g,defaultValue:"qq",onChange:t=>{return n=t,e.setItems([...e.items,{platform:n,name:"",open:!1,appId:"",clientSecret:"",note:""}]),void a(!1);var n},width:"180px"}),(0,j.jsx)(s.rA,{icon:"cancel",title:t("取消"),onClick:()=>a(!1)})]}):(0,j.jsx)(s.rA,{icon:"add",title:t("添加机器人"),onClick:()=>a(!0)}),(0,j.jsx)(s.rA,{icon:"save",title:t(o?"保存中...":"保存"),onClick:()=>{o||(async()=>{c(!0),await e.save(),c(!1)})()}})]})}),0===e.items.length?(0,j.jsxs)("div",{className:"airebot-setting__empty",children:[(0,j.jsx)("span",{className:"material-symbols-outlined airebot-setting__empty-icon",children:"smart_toy"}),(0,j.jsx)("p",{children:t("还没有配置任何机器人")}),(0,j.jsx)("p",{className:"airebot-setting__empty-hint",children:t("点击上方「添加机器人」按钮来开始配置")})]}):(0,j.jsx)("div",{className:"airebot-setting__grid",children:e.items.map((e,t)=>(0,j.jsx)(v,{item:e,index:t,onChange:d,onDelete:p,onCopy:_},t))})]})}const v=({item:e,index:t,onChange:n,onDelete:i,onCopy:a})=>{const{t:o}=(0,l.Bd)(),d=b[e.platform]??b.qq,p=e._status||"disconnected";e.open;return(0,j.jsx)(c.Zp,{self_title:(0,j.jsx)("div",{className:"airebot-setting__card-header",children:(0,j.jsx)("span",{className:"material-symbols-outlined airebot-setting__card-icon",style:{color:d.color},children:d.icon})}),rightTopCom:(0,j.jsxs)("div",{className:"airebot-setting__card-actions",children:[(0,j.jsx)(s.Ay,{checked:!!e.open,onChange:e=>n(t,{open:e})}),(0,j.jsx)(s.rA,{icon:"content_copy",title:o("复制"),onClick:()=>a(t)}),(0,j.jsx)(s.rA,{icon:"delete",title:o("删除"),onClick:()=>i(t)})]}),children:(0,j.jsxs)("div",{className:"airebot-setting__card-fields",children:[(0,j.jsxs)("div",{className:"airebot-setting__field",children:[(0,j.jsx)("label",{className:"airebot-setting__field-label",children:o("平台")}),(0,j.jsx)(r.l6,{options:g,value:e.platform,onChange:e=>n(t,{platform:e}),width:"100%"})]}),(0,j.jsxs)("div",{className:"airebot-setting__field",children:[(0,j.jsx)("label",{className:"airebot-setting__field-label",children:o("名称")}),(0,j.jsx)(r.Sm,{value:e.name||"",handleInputChange:e=>n(t,{name:e}),placeholder:o("给机器人起个名字")})]}),d.fields.map(l=>{const i=e[l.key]??"";return(0,j.jsxs)("div",{className:"airebot-setting__field",children:[(0,j.jsxs)("label",{className:"airebot-setting__field-label",children:[l.label,l.required&&(0,j.jsx)("span",{className:"airebot-setting__field-required",children:"*"})]}),(0,j.jsx)(r.Sm,{type:l.type,value:i,handleInputChange:e=>n(t,{[l.key]:e}),placeholder:l.placeholder})]},l.key)}),(0,j.jsxs)("div",{className:"airebot-setting__field ",children:[(0,j.jsx)("label",{className:"airebot-setting__field-label",children:o("模型编号")}),(0,j.jsx)(r.Sm,{value:e.model_index,handleInputChange:e=>n(t,{model_index:e}),placeholder:o("使用指定模型(可选)")})]}),(0,j.jsxs)("div",{className:"airebot-setting__field ",children:[(0,j.jsx)("label",{className:"airebot-setting__field-label",children:o("用户id")}),(0,j.jsx)(r.Sm,{value:e.user_id||"",handleInputChange:e=>n(t,{user_id:e}),placeholder:o("默认使用root账户(继承权限,可选)")})]}),(0,j.jsxs)("div",{className:"airebot-setting__field airebot-setting__field-full",children:[(0,j.jsx)("label",{className:"airebot-setting__field-label",children:o("备注")}),(0,j.jsx)(r.Sm,{value:e.note||"",handleInputChange:e=>n(t,{note:e}),placeholder:o("备注信息(可选)")})]})]})})};function y(){const{t:e}=(0,l.Bd)(),t=(0,x.Zp)(),{check_user_auth:n}=(0,h.MH)(),[r,c]=(0,i.useState)([]),b=(0,u.Q)(),g=async()=>{const e=await d.XO.get("ai_rebot_setting");e.code===p.m.Success&&c(e.data?.list??[])};(0,i.useEffect)(()=>{g()},[]);return(0,j.jsxs)("div",{className:"airebot-setting",children:[(0,j.jsx)(a.aZ,{position:"right",children:n(m.oV.ai_agent_setting)&&(0,j.jsx)(s.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>t(-1)})}),(0,j.jsx)(o.fI,{children:(0,j.jsxs)(o.VP,{widthPer:100,children:[(0,j.jsxs)("div",{className:"airebot-setting__page-title",children:[(0,j.jsx)("h2",{children:e("机器人配置")}),(0,j.jsx)(s.rA,{icon:"info",onClick:()=>{b("机器人配置")},title:"信息"})]}),(0,j.jsx)(f,{items:r,setItems:c,save:async()=>{const t={list:r.map((e,t)=>({...e,index:t}))};(await d.XO.post("ai_rebot_setting/save",t)).code===p.m.Success&&((0,_.SK)(e("保存成功")),await g())},have_auth_edit:n(m.oV.ai_agent_setting)})]})})]})}n.d(t,["PLATFORM_META",0,b,"RebotCard",0,v])},92350(e,t,n){n.d(t,{Q:()=>p,o:()=>h});var l=n(34843),i=n(82893),s=n(74777),a=n(96540),o=n(22022),r=n(23430),c=n(14284),d=n(74848);function p(){const[e,t]=(0,l.fp)(i.AG.prompt_card),{t:n,i18n:a}=(0,o.Bd)();return e=>{let l;e===s.jk.ffmpeg?l=(0,d.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===s.jk.smartmontools?l=(0,d.jsx)("div",{children:"磁盘检查需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置。"}):"保护目录"===e?l=(0,d.jsxs)("div",{children:["在删除的时候保护目录会拒绝删除。",(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"可以使用 /* 来表达该目录下所有文件都禁止删除"}),(0,d.jsx)("li",{children:"可以使用 /** 来表达该目录下所有子目录文件都禁止删除"})]})]}):"文件夹路径"===e?l=(0,d.jsx)("div",{children:"用于在文件夹下切换根目录"}):"环境路径"===e?l=(0,d.jsx)("div",{children:"当在不同用户环境下运行的时候由于没有执行终端去加载PATH,这里可以添加额外的PATH路径,点击这里的保存还会更新系统上的path路径"}):"pty"===e?l=(0,d.jsx)("div",{children:"一些需要Pty环境的命令"}):"文件上传"===e?l=(0,d.jsx)("div",{children:(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"对于不同的目录(包括所有子目录),可能是机械或者固态硬盘,机械硬盘在处理多个小文件的时候会做随机i/o,由于一般只有一个盘头所以会影响整体效率,特别是写操作,这里提供了上传时候的最大数量限制,对于下载数量目前不做限制."}),(0,d.jsx)("li",{children:"大文件支持断点和分块并发传输,建议并发数量设置为2,分块大小设置为10MB,大文件判断为500MB,设置过大的话会上传的时候会占据较大内存"})]})}):"目录快捷命令"===e?l=(0,d.jsx)("div",{children:"右键文件夹空白处用于,打开终端快捷执行命令"}):"文件快捷命令"===e?l=(0,d.jsx)("div",{children:"用于右键特定后缀的文件,执行一些快捷命令,文件后缀可以是多个,用空格分割"}):"Workflow"===e?l=(0,d.jsx)("div",{children:(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"在特定的时间启动系统中的workflow任务"}),(0,d.jsx)("li",{children:"cron表达式是定时器 格式为: 秒 分 时 日 月 星期"}),(0,d.jsxs)("li",{children:[(0,d.jsx)("li",{children:'1. "*"(通配符,所有值)'}),(0,d.jsx)("li",{children:'2. "," 是枚举: 0 0 1,15 * * *'}),(0,d.jsx)("li",{children:'3. "-" 是范围: 0 0 1-5 * * *'}),(0,d.jsx)("li",{children:'4. "/" 是步长,标识每隔n执行 */3 * * * * * 每隔三秒,必须配合 * 使用 ,/ 只能写一次 ,有了/就成了定时器,而不是指定时间执行'})]})]})}):"插件配置"===e?l=(0,d.jsx)("div",{children:n("路径可以是一个 js 文件也可以是一个node 项目目录")}):"机器人配置"===e&&(l=(0,d.jsxs)("div",{children:[(0,d.jsx)("dv",{children:"机器人功能用于开通各种第三方支持的机器人,让第三方机器人接入本地的 AI 模型。"}),(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:" 1. qq 机器人需要先在手机 app 中添加,然后在https://q.qq.com/qqbot/ 登录机器人配置页面,在开发管理中复制机器人的 appId,appSecret 到这里就完成了配置了。目前 qq 机器人不稳定,且创建后无法删除(2026.07.05)"}),(0,d.jsx)("li",{children:" 2. https://opensource.dingtalk.com/developerpedia/docs/explore/tutorials/stream/bot/nodejs/create-bot 这个是钉钉机器人开通教程,注意复制钉钉的 clientId 的是时候不要复制成appId 了。"}),(0,d.jsx)("li",{children:" 3. 企业微信机器人的开通甚至不需要 pc 操作,在通讯录中点击智能机器人,选择 api 模式,就创建完成了,手机上直接复制 id 和密钥。"}),(0,d.jsx)("li",{children:" 4. 飞书https://open.feishu.cn/document/develop-an-echo-bot/introduction?from=banner 登录这个开发者后台,按照这个地址教程创建机器人,使用的时候这个机器人是作为一个应用,可以在工作台内搜索你的这个机器人的名字。"})]})]})),t({open:!0,title:"信息",context_div:(0,d.jsx)("div",{children:l})})}}let _=r.Ky;function h(){const[e,t]=(0,a.useState)([]);return(0,a.useEffect)(()=>{(async()=>{try{const e=await c.XO.get("themes");if(0===e.code){const n=e.data||[];_=[...r.Ky,...n],t(_)}else console.warn("获取主题列表失败,使用默认列表"),t(_)}catch(e){t(_)}})()},[]),e}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2674],{92674(e,t,n){n.r(t),n.d(t,{default:()=>P});var a=n(96540),i=n(82893),s=n(34843),o=n(85997),l=n(57952),r=n(47022),c=n(34251),d=n(74848);function u(e){{const[t,n]=(0,a.useState)(!1),[i,s]=(0,a.useState)([]),l=e=>{s(e)},p=async()=>{"folder"===e.type?(t||!e.click||i||await e.click(e,l,e.pre_path),n(!t)):e.click&&await e.click(e,l,e.pre_path)},h=async(t=!1)=>{"folder"!==e.type||t?e.fatherNowToggleExpansion&&e.fatherNowToggleExpansion():await e.click(e,l,e.pre_path)};return(0,a.useEffect)(()=>{s(e.children)},[e.children]),(0,d.jsxs)("div",{className:"studio-item",children:[(0,d.jsxs)("div",{onClick:p,onContextMenu:t=>{t.stopPropagation(),t.nativeEvent.stopImmediatePropagation(),e.handleContextMenu&&e.handleContextMenu(t,e.name,e.pre_path,e.type===r.Iw.folder,h)},className:"studio-item-title"+(e.active_path===e.pre_path?" studio-item-title--active":""),children:[(0,d.jsx)("i",{className:"material-icons studio-item-title-tag","data-icon":t?"arrow_drop_down":"arrow_right",children:"file"==e.type?"":t?"arrow_drop_down":"arrow_right"}),(0,d.jsx)("span",{className:"file-icons",children:(0,d.jsx)("span",{"data-type":(0,c.uL)(e.name),"data-dir":"folder"===e.type,"aria-label":e.name,children:(0,d.jsx)(o.In,{icon:"",aria_label:e.name})})}),(0,d.jsx)("span",{className:"studio-item-name",children:e.name})]}),t&&i&&(0,d.jsx)("div",{style:{marginLeft:20},children:i.map((t,n)=>(0,d.jsx)(a.Fragment,{children:(0,d.jsx)(u,{type:t.type,size:t.size,click:e.click,name:t.name,children:t.children,pre_path:`${e.pre_path}${t.name}${t.type===r.Iw.folder?"/":""}`,handleContextMenu:e.handleContextMenu,active_path:e.active_path,fatherNowToggleExpansion:h},n)},n))})]})}}n(61443);function p(e){return(0,d.jsx)("div",{children:e.list.map((t,n)=>(0,d.jsx)(u,{pre_path:`${e.pre_path}${t.name}${t.type===r.Iw.folder?"/":""}`,name:t.name,type:t.type,handleContextMenu:e.handleContextMenu,fatherNowToggleExpansion:e.fatherNowToggleExpansion,active_path:e.active_path,children:t.children,click:e.click,size:t.size},n))})}var h=n(14284),m=n(34289),f=n(53459),v=n(78247),_=n(62042),x=n(2543),y=n(89824),w=n(22022),j=n(88815),g=n(61973),k=n(23430),C=n(99214);const S=a.lazy(()=>Promise.all([n.e(2543),n.e(4091)]).then(n.bind(n,84091))),b=a.lazy(()=>Promise.all([n.e(4946),n.e(1384),n.e(892),n.e(9334),n.e(1075),n.e(1142)]).then(n.bind(n,71142))),N=a.lazy(()=>n.e(4877).then(n.bind(n,64877))),E=a.lazy(()=>Promise.all([n.e(4946),n.e(2626),n.e(892),n.e(9334),n.e(6104)]).then(n.bind(n,69857))),A=a.lazy(()=>Promise.all([n.e(8090),n.e(5744)]).then(n.bind(n,16575))),M=a.lazy(()=>Promise.all([n.e(8725),n.e(2728),n.e(2130),n.e(5602),n.e(8781),n.e(6404)]).then(n.bind(n,35304))),I=a.lazy(()=>n.e(892).then(n.bind(n,20892))),$=a.lazy(()=>Promise.all([n.e(1922),n.e(4935)]).then(n.bind(n,24935)));function R(e){return(0,c.uL)(e)===r.Iw.excel}function P(e){const[t,n]=(0,a.useState)([]),[u,P]=(0,a.useState)(""),[z,U]=(0,a.useState)(""),[G,D]=(0,a.useState)(!1),[F,L]=(0,a.useState)({path:"",name:""}),[T,B]=(0,a.useState)(""),[K,X]=(0,s.fp)(i.AG.confirm),[H,V]=(0,a.useState)(!1),[W,Y]=(0,s.fp)(i.AG.fileShellShow),[Z,q]=(0,s.fp)(i.AG.file_shell_hidden),J=(0,a.useRef)(null),O=(0,a.useRef)(null),[Q,ee]=(0,a.useState)(!1),[te,ne]=(0,a.useState)(16),[ae,ie]=(0,s.fp)(i.AG.showPrompt),{t:se}=(0,w.Bd)(),oe=(0,g.Zp)(),le=(re=F.name,(0,c.uL)(re)===r.Iw.md);var re;const ce=function(e){return(0,c.uL)(e)===r.Iw.excalidraw}(F.name),de=function(e){return(0,c.uL)(e)===r.Iw.mind}(F.name),ue=function(e){return(0,c.uL)(e)===r.Iw.timeline}(F.name),pe=R(F.name),he=(0,a.useRef)(null),me=(0,a.useRef)(null),fe=(0,a.useRef)(null),ve=(0,a.useRef)(null),_e=(0,a.useRef)(null),xe=(0,a.useRef)(null),[ye,we]=(0,a.useState)([]),[je,ge]=(0,a.useState)(-1),[ke,Ce]=(0,a.useState)("folder"),[Se,be]=(0,a.useState)(!0),[Ne,Ee]=(0,a.useState)(!1),Ae=(0,C.oT)(),[Me]=(0,g.ok)(),Ie="1"===Me.get("chat_open"),[$e,Re]=(0,s.fp)(i.AG.studio_chat_width),Pe=(0,a.useRef)(null),[ze,Ue]=(0,a.useState)(!1),[Ge,De]=(0,a.useState)(void 0),[Fe,Le]=(0,s.fp)(i.AG.ai_chat_session_by_cwd);let Te=(0,g.zy)().pathname.split("/").filter(Boolean).pop();Te=decodeURIComponent(Te);const{check_user_auth:Be}=(0,v.MH)(),[Ke]=(0,s.fp)(i.AG.user_base_info),Xe=Be(k.oV.ai_agent_page);(0,a.useEffect)(()=>{Ke?.user_data&&Ie&&!Xe&&Ae("chat_open",null)},[Ie,Xe,Ke]);const He=(0,m.GG)("file",Te);const Ve=async()=>{const e=(0,m.GG)("file",Te);P(e),L({path:e,name:(0,m.mH)(e)});const t=await h.$M.post("studio/get/item",{path:e});if(t.code===f.m.Success){const e=[],a=[];for(const n of t.data.list)"folder"===n.type?e.push(n):"file"===n.type&&a.push(n);n([...e,...a])}};(0,a.useEffect)(()=>{U(""),V(!1),Ve()},[]);const We=async(e,t)=>{if(!R(e)){const e=await h.$M.get(`${encodeURIComponent(t)}`);U(e.data),v.xK.set_value_temp(e.data)}L({path:t,name:e}),B(t),Ce("folder"),Ee(!1)},Ye=(e,t)=>{e.size>j.o5?X({open:!0,handle:()=>{We(e.name,t),X({open:!1,handle:null}),V(!1)},title:"超过20MB了还要打开吗?"}):We(e.name,t)};function Ze(){me.current?.save()}const qe=e=>{if(e.ctrlKey&&"s"===e.key){if(e.preventDefault(),le||ce||de||ue||pe)return;H&&Ze()}};(0,a.useEffect)(()=>(document.addEventListener("keydown",qe),()=>{document.removeEventListener("keydown",qe)}),[H,le,ce,de,ue,pe]);const Je=(0,a.useCallback)(x.throttle(e=>{const t=parseFloat(getComputedStyle(O.current).fontSize),n=window.innerWidth/t-4,a=e.clientX/t,i=2.25+J.current.offsetWidth/t;a<=n&&a>=i&&ne(parseFloat(a.toFixed(2)))},32),[]),Oe=()=>{ee(!1),O.current.removeEventListener("pointermove",Je)},Qe=(0,a.useCallback)(x.throttle(e=>{const t=Pe.current;if(!t)return;const n=parseFloat(getComputedStyle(t).fontSize),a=t.parentElement.getBoundingClientRect().right-e.clientX,i=.7*t.parentElement.getBoundingClientRect().width,s=Math.min(Math.max(a,320),i);Re(parseFloat((s/n).toFixed(2)))},32),[]),et=()=>{Ue(!1),document.removeEventListener("pointermove",Qe)},tt=[{r:se("创建文件"),v:"创建文件"},{r:se("创建目录"),v:"创建目录"},{r:se("重命名"),v:"重命名"},{r:se("删除"),v:"删除"}],nt=[{r:se("重命名"),v:"重命名"},{r:se("删除"),v:"删除"}],at=(e,t,n,a,i)=>{e.preventDefault();const s=new c.ik;s.path=n,s.filename=t,s.x=e.clientX,s.y=e.clientY,s.items=a?tt:nt,i===Ve&&(s.items=s.items.slice(0,2)),s.type=a?r.Iw.studio_folder:r.Iw.studio_file;const o=e=>{i(e)};s.textClick=e=>{switch(e){case"创建文件":ie({show:!0,type:y.PromptEnum.FileNew,overlay:!0,data:{dir:n,call:o}});break;case"创建目录":ie({show:!0,type:y.PromptEnum.DirNew,overlay:!0,data:{dir:n,call:o}});break;case"删除":if(H&&(F.path===n||F.path.includes(n))){const e=()=>{o(a),V(!1),L({}),U(""),v.xK.set_value_temp("")};ie({show:!0,type:y.PromptEnum.FilesDelete,overlay:!0,data:{path:n,call:e,filename:t}});break}ie({show:!0,type:y.PromptEnum.FilesDelete,overlay:!0,data:{path:n,filename:t,call:a?()=>{o(!0)}:o}});break;case"重命名":ie({show:!0,type:y.PromptEnum.FileRename,overlay:!0,data:{path:n,dir:(0,m.Yp)(n),call:()=>{o(!0)},filename:t}})}},ie({show:!0,type:y.PromptEnum.FileMenu,overlay:!1,data:s})};const it=le&&"outline"===ke;return(0,d.jsxs)("div",{className:"studio studio--file",children:[(0,d.jsxs)(l.A,{ignore_tags:!0,left_children:[(0,d.jsx)(o.rA,{title:"取消",icon:"close",onClick:()=>{Y({show:!1,path:""}),q(void 0),oe(-1)}},1),(0,d.jsx)("div",{children:F.name},2)],children:[(0,d.jsx)("title",{children:F.name}),(0,d.jsx)(o.rA,{title:"侧边栏",icon:"list",onClick:()=>be(e=>!e),selected:Se}),le&&[Ne?(0,d.jsx)(o.rA,{title:se("保存"),icon:"save",onClick:()=>he.current?.save()},"save"):null,(0,d.jsx)(o.rA,{icon:"source"===he.current?.mode()?"edit":"code",title:"source"===he.current?.mode()?se("实时编辑模式"):se("源码模式"),onClick:()=>he.current?.toggle_mode()},"mode"),(0,d.jsx)(o.rA,{title:se("导出PDF"),icon:"print",onClick:()=>he.current?.export_pdf()},"pdf")],!le&&(0,c.zr)(F.name)&&(0,d.jsx)(o.rA,{title:"格式化",icon:"data_object",onClick:function(){v.xK.get_editor()?.formatCode()}}),(0,d.jsx)(o.rA,{icon:"terminal",title:"shell",onClick:function(){!0!==Z&&!1!==Z?W.show?Y({show:!1,path:""}):(Y({show:!0,path:(0,m.GG)("file",Te)}),q(!1)):q(!Z)}}),Be(k.oV.ai_agent_page)&&(0,d.jsx)(o.rA,{title:se("AI 聊天"),icon:"smart_toy",selected:Ie,onClick:()=>Ae("chat_open",!Ie?"1":null)}),le?Ne?(0,d.jsx)(o.rA,{title:se("保存"),icon:"save",onClick:()=>he.current?.save()}):null:ce?(0,d.jsx)(o.rA,{title:se("保存"),icon:"save",onClick:()=>fe.current?.save()}):de?(0,d.jsx)(o.rA,{title:se("保存"),icon:"save",onClick:()=>ve.current?.save()}):ue?(0,d.jsx)(o.rA,{title:se("保存"),icon:"save",onClick:()=>_e.current?.save()}):pe?(0,d.jsx)(o.rA,{title:se("保存"),icon:"save",onClick:()=>xe.current?.save()}):H?(0,d.jsx)(o.rA,{title:"保存",icon:"save",onClick:Ze}):null]}),(0,d.jsxs)("div",{className:"studio-body",ref:O,children:[(0,d.jsxs)("div",{className:"studio-nav",style:{display:Se?void 0:"none",width:te-1+"em"},onContextMenu:e=>{at(e,F.name,(0,m.GG)("file",Te),!0,Ve)},children:[(0,d.jsx)("div",{className:"studio-nav-outline",style:{display:it?void 0:"none"},children:(0,d.jsx)(N,{items:ye,active_pos:je,on_click:e=>he.current?.goto_heading(e)})}),(0,d.jsx)("div",{className:"studio-nav-folder",style:{display:it?"none":void 0},children:(0,d.jsx)(p,{pre_path:u,list:t,click:async(e,t,n)=>{if("folder"===e.type){const e=await h.$M.post("studio/get/item",{path:`${n}`});if(e.code===f.m.Success){const n=[],a=[];for(const t of e.data.list)"folder"===t.type?n.push(t):"file"===t.type&&a.push(t);t([...n,...a])}}else{if(H)return void X({open:!0,handle:()=>{X({open:!1,handle:null}),V(!1),Ye(e,n)},title:"确定不保存就切换吗?"});Ye(e,n)}},active_path:T,handleContextMenu:at,fatherNowToggleExpansion:Ve})}),le&&(0,d.jsx)("div",{className:"studio-nav-switch",children:(0,d.jsx)(o.rA,{icon:it?"folder":"list",title:se(it?"文件目录":"大纲"),onClick:()=>Ce(it?"folder":"outline")})})]}),Se&&(0,d.jsx)("div",{className:"studio__divider",ref:J,onPointerDown:()=>{ee(!0),O.current.addEventListener("pointermove",Je)},onPointerUp:Oe}),Q&&(0,d.jsx)("div",{className:"shell__overlay",onPointerUp:Oe}),le?(0,d.jsx)("div",{className:"studio-editor studio-editor--md",children:(0,d.jsx)(a.Suspense,{fallback:null,children:(0,d.jsx)(b,{pane:{path:T,url:h.$M.getDownloadUrl(encodeURIComponent(T)),name:F.name,on_dirty:Ee,on_outline:(e,t)=>{we(e),ge(t)},register:e=>{he.current=e}}})})},T):ce?(0,d.jsx)("div",{className:"studio-editor studio-editor--draw",children:(0,d.jsx)(a.Suspense,{fallback:null,children:(0,d.jsx)(A,{reset_key:T,url:h.$M.getDownloadUrl(encodeURIComponent(T)),save_path:T,on_dirty:V,on_saved:()=>V(!1),register:e=>{fe.current=e}})})},T):de?(0,d.jsx)("div",{className:"studio-editor studio-editor--mind",children:(0,d.jsx)(a.Suspense,{fallback:null,children:(0,d.jsx)(M,{reset_key:T,url:h.$M.getDownloadUrl(encodeURIComponent(T)),on_dirty:V,on_saved:()=>V(!1),register:e=>{ve.current=e},on_save:async e=>(await h.$M.post(`save/${encodeURIComponent(T)}`,{context:e})).code===f.m.Success})})},T):ue?(0,d.jsx)("div",{className:"studio-editor studio-editor--timeline",children:(0,d.jsx)(a.Suspense,{fallback:null,children:(0,d.jsx)(I,{reset_key:T,url:h.$M.getDownloadUrl(encodeURIComponent(T)),on_dirty:V,register:e=>{_e.current=e},on_save:async e=>(await h.$M.post(`save/${encodeURIComponent(T)}`,{context:e})).code===f.m.Success})})},T):pe?(0,d.jsx)("div",{className:"studio-editor studio-editor--excel",children:(0,d.jsx)(a.Suspense,{fallback:null,children:(0,d.jsx)($,{url:h.$M.getDownloadUrl(encodeURIComponent(T)),save_path:T,on_dirty:V,bind_save:e=>{xe.current={save:e}}})})},T):(0,d.jsx)("div",{className:"studio-editor",children:F.name&&(0,d.jsx)(a.Suspense,{fallback:null,children:(0,d.jsx)(S,{name:F.name,on_dirty:V,register:e=>{me.current=e},save:async e=>{const t={context:v.xK.get_editor_value()},n=await h.$M.post(`save/${encodeURIComponent(T)}`,t);return n.code===f.m.Success||e||(0,_.zN)(se("保存失败")),n.code===f.m.Success}})})},T),Ie&&(0,d.jsxs)(a.Fragment,{children:[(0,d.jsx)("div",{className:"studio__divider studio__divider--chat",ref:Pe,onPointerDown:e=>{e.preventDefault(),Ue(!0),document.addEventListener("pointermove",Qe),document.addEventListener("pointerup",et,{once:!0})}}),(0,d.jsx)("div",{className:"studio-chat-panel",style:{width:`${$e}em`},children:(0,d.jsx)(a.Suspense,{fallback:null,children:(0,d.jsx)(E,{inline_header:!0,sync_url:!1,file_cwd_path:He,session_id:Ge??(st=He,i.AG.get_ai_chat_session(Fe,st)),on_session_change:e=>{De(e),((e,t)=>{Le({...Fe,[e]:t})})(He,e)}})})})]})]})]});var st}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[394],{30394(e,n,t){t.r(n),t.d(n,{default:()=>b});var a=t(96540),i=t(34843),s=t(82893),r=t(14284),l=t(62042),c=t(53459),o=t(34289),u=t(22022),d=t(20892),m=t(93245),f=t(23430),p=t(45907),_=t(74848);function b(){const[e,n]=(0,i.fp)(s.AG.timeline_editor),[t,b]=(0,a.useState)(!1),{t:v}=(0,u.Bd)(),x=(0,p.y)(),h=(0,a.useRef)(null),E=()=>{n({}),e?.close?.()},j=()=>{t?x({sub_title:v("有未保存的修改,确定要关闭吗?"),confirm_fun:E}):E()},y=async(e=!1)=>{await(h.current?.save(e))},k=(0,a.useRef)(t);if(k.current=t,(0,m.a)(f.nE.timeline,()=>k.current,e=>y(e)),(0,a.useEffect)(()=>{if(void 0===e.url)return;const n=e=>{"Escape"===e.key&&(e.stopPropagation(),j())};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[e.url,t]),void 0===e.url)return null;const[N,w]=(0,a.useState)(!1);return(0,_.jsx)("div",{id:"timeline-container",children:(0,_.jsx)("div",{className:"timeline-context",children:(0,_.jsx)(d.default,{fullscreen:!0,reset_key:e.url??e.name,url:e.url,on_dirty:b,on_edit_mode_change:w,register:e=>{h.current=e,w(e.is_edit_mode())},header:(0,_.jsxs)("div",{className:"timeline-topbar",children:[(0,_.jsx)("span",{className:"material-icons timeline-topbar__icon",children:"timeline"}),(0,_.jsx)("span",{className:"timeline-topbar__name",children:e.name}),t&&(0,_.jsx)("span",{className:"timeline-topbar__dirty",children:"*"}),(0,_.jsx)("span",{className:"timeline-topbar__gap"}),N&&(0,_.jsx)("button",{type:"button",className:"timeline-btn",title:v("保存")+" (Ctrl+S)",onClick:y,children:(0,_.jsx)("span",{className:"material-icons",children:"save"})}),(0,_.jsx)("button",{type:"button",className:"timeline-btn",title:v("关闭"),onClick:j,children:(0,_.jsx)("span",{className:"material-icons",children:"close"})})]}),on_save:async(n,t)=>(await r.$M.post(`save/${encodeURIComponent((0,o.GG)("file",(0,o.vX)()))}${e.name}`,{context:n})).code===c.m.Success&&(t||(0,l.SK)(v("保存成功")),!0)})})})}},93245(e,n,t){t.d(n,{a:()=>c});var a=t(96540),i=t(34843),s=t(82893),r=t(23430);const l=[{id:r.nE.ace,label:"文本编辑器(ace)"},{id:r.nE.md,label:"md编辑器"},{id:r.nE.mind,label:"思维导图编辑器"},{id:r.nE.draw,label:"draw编辑器"},{id:r.nE.timeline,label:"时间线编辑器"},{id:r.nE.image,label:"图片编辑器"},{id:r.nE.excel,label:"excel编辑器"}];function c(e,n,t,r=!1){const[l]=(0,i.fp)(s.AG.user_base_info),c=l?.user_data?.editor_auto_save,o=(0,a.useRef)(c);o.current=c;const u=(0,a.useRef)(n);u.current=n;const d=(0,a.useRef)(t);d.current=t,(0,a.useEffect)(()=>{if(r)return;const n=o.current;if(!n?.enable||n.interval<=0||!n.editors?.includes(e))return;const t=setInterval(()=>{u.current()&&d.current(!0)},1e3*n.interval);return()=>clearInterval(t)},[c,e,r])}t.d(n,["d",0,l])}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4091],{48890(e,t,r){r.d(t,{Kw:()=>n,Tt:()=>c});var n=r(80952),c=(r(82327),r(1766),r(24854),r(90008),r(90846),r(40975),r(44286),r(30766),r(14973),r(69687),r(1234),r(47507),r(87268),r(34678),r(24522));const s=`https://gcore.jsdelivr.net/npm/ace-builds@${n.version}/src-min-noconflict/`;n.config.set("basePath",s),n.config.set("modePath",s),n.config.set("themePath",s),n.config.set("workerPath",s)},84091(e,t,r){r.r(t),r.d(t,{default:()=>f});var n=r(96540),c=(r(80952),r(48890)),s=r(34843),i=r(82893),a=r(78247),u=r(93245),o=r(23430),d=r(74848);function f(e){const t=(0,n.useRef)(null),[r,f]=(0,s.fp)(i.AG.user_base_info),[l,h]=(0,n.useState)(!1),_=(0,n.useRef)(l);_.current=l;const m=(0,n.useRef)(e.save);m.current=e.save;const v=(0,n.useRef)(e.on_dirty);v.current=e.on_dirty,(0,n.useEffect)(()=>{v.current?.(l)},[l]);const g=async e=>{if(!m.current||!_.current)return;!1!==await m.current(e)&&h(!1)},b=(0,n.useRef)(g);b.current=g;const p=(0,n.useRef)(e.register);p.current=e.register,(0,n.useEffect)(()=>{p.current?.({save:e=>b.current(e)})},[]),(0,u.a)(o.nE.ace,()=>!!m.current&&_.current,g);const w=r.user_data.theme?.includes("dark")?"cloud_editor_dark":"cloud9_day";return(0,n.useEffect)(()=>{const r=c.Kw.edit(t.current,{value:a.xK.get_value_temp(e.editor_id),showPrintMargin:!1,theme:`ace/theme/${w}`,mode:e.model??c.Tt.getModeForPath(e.name??"").mode,wrap:!1,highlightActiveLine:!1,fontSize:14,...e.options});return r.setOptions({}),r.container.addEventListener("wheel",function(e){e.preventDefault()}),r.focus(),r.on("change",function(t){h(!0),e.on_change&&e.on_change()}),t.current=r,r.formatCode=()=>{const e=c.Kw.require("ace/ext/beautify"),r=t.current;r&&e.beautify(r.session)},a.xK.set_editor_temp(r,e.editor_id),()=>{a.xK.delete_editor_temp(e.editor_id),r.destroy()}},[]),(0,d.jsx)("div",{ref:t,style:{height:"100%",width:"100%"}})}},93245(e,t,r){r.d(t,{a:()=>u});var n=r(96540),c=r(34843),s=r(82893),i=r(23430);const a=[{id:i.nE.ace,label:"文本编辑器(ace)"},{id:i.nE.md,label:"md编辑器"},{id:i.nE.mind,label:"思维导图编辑器"},{id:i.nE.draw,label:"draw编辑器"},{id:i.nE.timeline,label:"时间线编辑器"},{id:i.nE.image,label:"图片编辑器"},{id:i.nE.excel,label:"excel编辑器"}];function u(e,t,r,i=!1){const[a]=(0,c.fp)(s.AG.user_base_info),u=a?.user_data?.editor_auto_save,o=(0,n.useRef)(u);o.current=u;const d=(0,n.useRef)(t);d.current=t;const f=(0,n.useRef)(r);f.current=r,(0,n.useEffect)(()=>{if(i)return;const t=o.current;if(!t?.enable||t.interval<=0||!t.editors?.includes(e))return;const r=setInterval(()=>{d.current()&&f.current(!0)},1e3*t.interval);return()=>clearInterval(r)},[u,e,i])}r.d(t,["d",0,a])}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4091,5272],{48890(e,n,t){t.d(n,{Kw:()=>r,Tt:()=>i});var r=t(80952),i=(t(82327),t(1766),t(24854),t(90008),t(90846),t(40975),t(44286),t(30766),t(14973),t(69687),t(1234),t(47507),t(87268),t(34678),t(24522));const o=`https://gcore.jsdelivr.net/npm/ace-builds@${r.version}/src-min-noconflict/`;r.config.set("basePath",o),r.config.set("modePath",o),r.config.set("themePath",o),r.config.set("workerPath",o)},84091(e,n,t){t.r(n),t.d(n,{default:()=>l});var r=t(96540),i=(t(80952),t(48890)),o=t(34843),d=t(82893),s=t(78247),a=t(93245),c=t(23430),m=t(74848);function l(e){const n=(0,r.useRef)(null),[t,l]=(0,o.fp)(d.AG.user_base_info),[h,u]=(0,r.useState)(!1),f=(0,r.useRef)(h);f.current=h;const g=(0,r.useRef)(e.save);g.current=e.save;const p=(0,r.useRef)(e.on_dirty);p.current=e.on_dirty,(0,r.useEffect)(()=>{p.current?.(h)},[h]);const _=async e=>{if(!g.current||!f.current)return;!1!==await g.current(e)&&u(!1)},b=(0,r.useRef)(_);b.current=_;const x=(0,r.useRef)(e.register);x.current=e.register,(0,r.useEffect)(()=>{x.current?.({save:e=>b.current(e)})},[]),(0,a.a)(c.nE.ace,()=>!!g.current&&f.current,_);const v=t.user_data.theme?.includes("dark")?"cloud_editor_dark":"cloud9_day";return(0,r.useEffect)(()=>{const t=i.Kw.edit(n.current,{value:s.xK.get_value_temp(e.editor_id),showPrintMargin:!1,theme:`ace/theme/${v}`,mode:e.model??i.Tt.getModeForPath(e.name??"").mode,wrap:!1,highlightActiveLine:!1,fontSize:14,...e.options});return t.setOptions({}),t.container.addEventListener("wheel",function(e){e.preventDefault()}),t.focus(),t.on("change",function(n){u(!0),e.on_change&&e.on_change()}),n.current=t,t.formatCode=()=>{const e=i.Kw.require("ace/ext/beautify"),t=n.current;t&&e.beautify(t.session)},s.xK.set_editor_temp(t,e.editor_id),()=>{s.xK.delete_editor_temp(e.editor_id),t.destroy()}},[]),(0,m.jsx)("div",{ref:n,style:{height:"100%",width:"100%"}})}},26559(e,n,t){var r=t(96540),i=t(34843),o=t(82893),d=t(76118),s=t(69918),a=t(8332),c=t(74848);const m=r.memo(function(e){const[n]=(0,i.fp)(o.AG.md_editor_last_context),[t]=(0,r.useState)(n?.trim()?n:a.$);return(0,c.jsx)("div",{className:e.className,ref:n=>e.setting&&(0,s.Ce)(n,e.setting),children:(0,c.jsx)("div",{className:"md-editor-scroll",children:(0,c.jsx)("div",{className:"md-editor-sheet",children:(0,c.jsx)(d.A,{value:t})})})})});t.d(n,["A",0,m])},8332(e,n,t){t.d(n,["$",0,'# 一级标题 Heading 1\n\n## 二级标题 Heading 2\n\n### 三级标题 Heading 3\n\n#### 四级标题 Heading 4\n\n##### 五级标题 Heading 5\n\n###### 六级标题 Heading 6\n\n这是一段普通正文,用来观察字体、字号、行高和文字颜色。中间可以包含 **加粗文字**、*斜体文字*、~~删除线~~、`行内代码` 以及 [一个链接](https://github.com/xiaobaidadada/filecat)。\n\n> 这是一段引用文字。\n> 引用通常用来强调摘录的内容,左侧一般会有一条竖线。\n\n- 无序列表第一项\n- 无序列表第二项\n - 嵌套的子项\n- 无序列表第三项\n\n1. 有序列表第一项\n2. 有序列表第二项\n3. 有序列表第三项\n\n```javascript\n// 代码块\nfunction greet(name) {\n console.log(`Hello, ${name}!`);\n}\ngreet("filecat");\n```\n\n| 列一 | 列二 | 列三 |\n| --- | --- | --- |\n| 内容 A | 内容 B | 内容 C |\n| 内容 D | 内容 E | 内容 F |\n\n---\n\n最后一段正文,用于观察段落之间的间距。\n',"V",0,'/* ===== md 主题 =====\n 选择器请从 .md-editor-sheet 开始写 —— 它是正文容器的类名,\n 编辑器与右侧预览用的是同一个类名,一处书写、两处生效。\n\n 注意:css 原样注入页面,不做任何改写。\n 写成 body、h1 这种全局选择器会真的作用到整个后台界面,不要这么写。\n\n 下面每一组都可以直接改,不需要的整段删掉即可。\n ============================================ */\n\n/* ---------- 正文 ---------- */\n.md-editor-sheet {\n font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; /* 字体 */\n font-size: 16px; /* 字号 */\n line-height: 1.7; /* 行高:1.7 约为字号的 1.7 倍 */\n color: #333333; /* 文字颜色 */\n}\n\n/* ---------- 整页底色 ----------\n 底色必须写在 .md-editor-scroll(滚动容器)上,不要写在 .md-editor-sheet。\n 纸张高度只有一屏,写在纸张上的底色长文档一滚就露底(上半截有色、下半截变回灰)。\n 深色主题尤其要注意:这一条不写,滚动时就会白一半黑一半。 */\n.md-editor-scroll {\n background: #ffffff;\n}\n\n/* ---------- 标题 h1 ~ h6 ---------- */\n.md-editor-sheet h1 {\n font-size: 2em; /* 相对正文字号的倍数 */\n font-weight: 600; /* 字重:400 常规 / 600 半粗 / 700 粗 */\n color: #1a1a1a;\n margin-top: 1.4em;\n margin-bottom: 0.6em;\n padding-bottom: 0.3em;\n border-bottom: 1px solid #eaecef; /* 标题下划线,不需要就删掉这行 */\n}\n.md-editor-sheet h2 { font-size: 1.5em; font-weight: 600; margin-top: 1.3em; margin-bottom: 0.6em; }\n.md-editor-sheet h3 { font-size: 1.25em; font-weight: 600; margin-top: 1.2em; margin-bottom: 0.5em; }\n.md-editor-sheet h4 { font-size: 1em; font-weight: 600; margin-top: 1.1em; margin-bottom: 0.5em; }\n.md-editor-sheet h5 { font-size: 0.9em; font-weight: 600; margin-top: 1em; margin-bottom: 0.5em; }\n.md-editor-sheet h6 { font-size: 0.85em; font-weight: 600; color: #6a737d; margin-top: 1em; margin-bottom: 0.5em; }\n\n/* ---------- 段落与行内元素 ---------- */\n.md-editor-sheet p {\n margin: 0 0 1em; /* 段落间距:上 右 下 左,下边距控制段与段的距离 */\n}\n.md-editor-sheet strong { font-weight: 600; } /* 加粗文字 */\n.md-editor-sheet em { font-style: italic; } /* 斜体文字 */\n.md-editor-sheet a { color: #0366d6; text-decoration: none; } /* 链接颜色;加下划线写 underline */\n.md-editor-sheet a:hover { text-decoration: underline; } /* 鼠标悬停时的链接样式 */\n.md-editor-sheet del { color: #999999; } /* 删除线文字 */\n\n/* ---------- 引用 ---------- */\n.md-editor-sheet blockquote {\n margin: 0 0 1em;\n padding: 0.4em 1em;\n color: #6a737d; /* 引用文字颜色 */\n border-left: 4px solid #dfe2e5; /* 左侧竖线,这是引用最明显的特征 */\n background: #f6f8fa; /* 引用底色,不需要就删掉 */\n}\n\n/* ---------- 代码 ---------- */\n.md-editor-sheet code {\n font-family: Consolas, Monaco, "Courier New", monospace; /* 等宽字体 */\n font-size: 0.88em;\n color: #476582; /* 行内代码文字色 */\n background: rgba(27, 31, 35, 0.05); /* 行内代码底色 */\n padding: 0.2em 0.4em;\n border-radius: 3px; /* 圆角 */\n}\n.md-editor-sheet pre {\n padding: 1em;\n overflow: auto; /* 内容太宽时出现横向滚动条 */\n background: #f6f8fa; /* 代码块底色 */\n border-radius: 6px;\n margin: 0 0 1em;\n}\n.md-editor-sheet pre code {\n background: transparent; /* 代码块里的 code 不要再叠一层底色 */\n padding: 0;\n}\n\n/* ---------- 列表 ---------- */\n.md-editor-sheet ul, .md-editor-sheet ol {\n padding-left: 2em; /* 缩进 */\n margin: 0 0 1em;\n}\n.md-editor-sheet li { margin: 0.25em 0; } /* 列表项之间的间距 */\n\n/* ---------- 表格 ---------- */\n.md-editor-sheet table {\n width: 100%;\n border-collapse: collapse; /* 相邻边框合并成一条线 */\n margin: 0 0 1em;\n}\n.md-editor-sheet table th, .md-editor-sheet table td {\n padding: 6px 13px;\n border: 1px solid #dfe2e5; /* 单元格边框 */\n}\n.md-editor-sheet table th {\n font-weight: 600;\n background: #f6f8fa; /* 表头底色 */\n}\n\n/* ---------- 分割线 ---------- */\n.md-editor-sheet hr {\n height: 1px; /* 线的粗细 */\n border: 0;\n background: #e1e4e8; /* 线的颜色 */\n margin: 1.6em 0;\n}\n\n/* ---------- 图片 ---------- */\n.md-editor-sheet img {\n max-width: 100%; /* 防止大图撑破版面 */\n border-radius: 4px;\n}\n'])},35272(e,n,t){t.r(n),t.d(n,{default:()=>x});var r=t(96540),i=t(22022),o=t(61973),d=t(85997),s=t(4412),a=t(70447),c=t(75725),m=t(61443),l=t(62042),h=t(23430),u=t(78247),f=t(84091),g=t(26559),p=t(96763),_=t(8332),b=t(74848);function x(){const{t:e}=(0,i.Bd)(),n=(0,o.Zp)(),[t]=(0,o.ok)(),{check_user_auth:x}=(0,u.MH)(),v=x(h.oV.md_theme),w=t.get("id")??"",j=!w,[k,y]=(0,r.useState)(""),[E,N]=(0,r.useState)(_.V),[C,K]=(0,r.useState)(!0),[z,S]=(0,r.useState)(!1),A=88;(0,r.useEffect)(()=>{if(!w){const e=_.V;return u.xK.set_value_temp(e,A),y(""),N(e),void K(!1)}Promise.all([(0,p.Kz)(),(0,p.P7)(w)]).then(([e,n])=>{const t=e.find(e=>e.id===w),r=n||_.V;u.xK.set_value_temp(r,A),y(t?.id??""),N(r)}).finally(()=>K(!1))},[w]),(0,r.useEffect)(()=>{if(C)return;const e=u.xK.get_editor(A);e&&(e.setValue(u.xK.get_value_temp(A)??"",-1),e.clearSelection())},[C]),(0,r.useEffect)(()=>{C||(0,p.bN)("theme_preview",E)},[E,C]);return(0,b.jsxs)("div",{children:[(0,b.jsx)(s.aZ,{position:"right",children:(0,b.jsx)(d.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>n(-1)})}),(0,b.jsx)(c.jW,{isFull:!0,more:!0,children:(0,b.jsx)(c.NN,{children:(0,b.jsxs)("div",{className:"md-theme-editor",children:[(0,b.jsx)("div",{className:"md-theme-editor__left",children:(0,b.jsxs)(a.Zp,{title:e(j?"新建主题":"编辑主题"),rightTopCom:(0,b.jsx)(b.Fragment,{children:v&&(0,b.jsx)(d.C3,{text:e(z?"保存中":"保存"),clickFun:()=>{z||(async()=>{const t=k.trim();if(t){S(!0);try{await(0,p._D)({id:j?void 0:w,name:t,css:u.xK.get_editor_value(A)??E})?((0,l.SK)(e("保存成功")),n(-1)):(0,l.zN)(e("保存失败"))}finally{S(!1)}}else(0,l.zN)(e("请输入主题名称"))})()}})}),children:[(0,b.jsx)(m.BC,{label:e("主题名称"),label_width:"6rem",children:(0,b.jsx)(m.Sm,{value:k,disabled:!v,placeholder:e("请输入主题名称"),handleInputChange:e=>y(e)})}),(0,b.jsx)("div",{className:"md-theme-editor__ace",children:(0,b.jsx)(f.default,{name:"theme.css",editor_id:A,model:"ace/mode/css",on_change:()=>{const e=u.xK.get_editor_value(A);void 0!==e&&N(e)},options:{showPrintMargin:!1,highlightActiveLine:!0,wrap:!0}})})]})}),(0,b.jsx)("div",{className:"md-theme-editor__right",children:(0,b.jsx)(a.Zp,{title:e("预览"),rightTopCom:(0,b.jsx)("span",{className:"md-theme-editor__tip",children:e("主题实时预览")}),children:(0,b.jsx)(g.A,{className:"md-theme-preview"})})})]})})})]})}},93245(e,n,t){t.d(n,{a:()=>a});var r=t(96540),i=t(34843),o=t(82893),d=t(23430);const s=[{id:d.nE.ace,label:"文本编辑器(ace)"},{id:d.nE.md,label:"md编辑器"},{id:d.nE.mind,label:"思维导图编辑器"},{id:d.nE.draw,label:"draw编辑器"},{id:d.nE.timeline,label:"时间线编辑器"},{id:d.nE.image,label:"图片编辑器"},{id:d.nE.excel,label:"excel编辑器"}];function a(e,n,t,d=!1){const[s]=(0,i.fp)(o.AG.user_base_info),a=s?.user_data?.editor_auto_save,c=(0,r.useRef)(a);c.current=a;const m=(0,r.useRef)(n);m.current=n;const l=(0,r.useRef)(t);l.current=t,(0,r.useEffect)(()=>{if(d)return;const n=c.current;if(!n?.enable||n.interval<=0||!n.editors?.includes(e))return;const t=setInterval(()=>{m.current()&&l.current(!0)},1e3*n.interval);return()=>clearInterval(t)},[a,e,d])}t.d(n,["d",0,s])}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6010,6104],{83277(e,s,t){t.d(s,{$j:()=>i,Lv:()=>n});class n{token;open=!1;note;index;url;model;request_type;json_params;sys_prompt;dotenv="";yaml_env="";tool_mode=!1;show_options;static get_label_by_v(e,s){if(!e||!s?.length)return e;for(const t of s)if(t.value===e)return t.label;return e}static have_label_by_v(e,s){if(!e||!s?.length)return!1;for(const t of s)if(t.value===e)return!0;return!1}}const a=JSON.stringify({stream:!0,thinking:{type:"disabled"}});function i(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"text"===e.type?e.text:"[图片]").join("\n"):""}t.d(s,["CP",0,"\n# 聊天循环最大次数\ntool_call_max: 500\n\n# 是否允许AI直接执行命令而不需要用户确认。\n# 默认为 false,需要用户手动确认;使用 workflow 时等价于 true。\nallow_exec_cmd_directly: false\n\n# 可选的大模型请求代理地址\n# proxy_url: http://127.0.0.1:7890\n\n# 可选的多个 url\n# options_agent_url_list:\n# - value: http://...\n# label: openai\n\n# 可选的多个 key\n# options_agent_key_list:\n# - value: sk-aaa\n# label: option1\n\n# 可选的多个 model\n# options_agent_model_list:\n# - value: gpt-5.5\n# label: gpt\n\n# 本地 prompt 文件列表,每次聊天时自动读取并加载\n# options_local_file_path_prompt_list:\n# - /prompt/a.txt\n\n# 开启切换模型,AI 可以根据 prompt 自己决定下一步调用哪个模型\n# open_pick_model: false\n\n# 历史消息裁剪相关\nmax_recent_messages: 12\ncompress_message_count: 16\nmax_tool_content_chars: 200\n\n# ===== 模型类型(request_type)=====\n# 默认 completions,可选值:\n# completions 标准对话/聊天补全 (chat/completions)\n# images 图片生成 (images/generations)\n# audio_speech 文本转语音 (audio/speech)\n# audio_transcription 语音转文字 (audio/transcriptions)\n# audio_translation 语音翻译 (audio/translations)\n# embeddings 向量嵌入 (embeddings)\n# request_type: completions\n\n# ===== 成为 tool(tool_mode)=====\n# 开启后该模型会作为一个工具被加载,供 AI agent 动态调用。\n# 注意:不能与「是否开启」(open) 同时为 true。\n# tool_mode: false\n\n# ===== 图片理解(image_understanding)=====\n# 开启后注册 read_image 工具,工具读到的图片会以 image_url 多模态格式随消息发给模型。\nimage_understanding: true\n\n# ===== 命令环境变量(command_env)=====\n# AI 调用内置命令工具(exec_cmd / exec_cmd_background)执行命令时,\n# 这里配置的变量会覆盖到子进程的环境变量上。\n# command_env:\n# NODE_ENV: production\n# HTTP_PROXY: http://127.0.0.1:7890\n\n# 是否允许 AI 通过 set_command_env 工具修改上面的 command_env\ncommand_env_tool: false\n","cL",0,a])},69857(e,s,t){t.r(s),t.d(s,{default:()=>le});var n=t(96540),a=t(34843),i=t(22022),o=t(61973),c=t(14284),r=t(7463),l=t(78247),d=t(53459),u=t(72693),m=t(82893),g=t(61443),h=t(83277);function _(e){return null==e||e<0?"0":e.toLocaleString()}var p=t(14944),f=t(92275),x=t(62042);function v(e){const s=[];if(e.attachments?.length&&s.push(e.attachments.map(e=>`[附件] ${e.name}`).join("\n")),e.content_list?.length)for(const t of e.content_list){const e=(0,h.$j)(t.content);if(e&&s.push(e),t.tool_call_ends?.length){const e=t.tool_call_ends.map(e=>{const s=e.tool_display_name||e.tool_name;return e.success?`[工具] ${s} 成功`:`[工具] ${s} 失败`});s.push(e.join("\n"))}}return e.text&&!s.length&&s.push(e.text),e.images?.length&&s.push(`[生成图片 ${e.images.length} 张]`),e.audio&&s.push("[音频]"),s.join("\n\n")}function j(e){const s=(0,h.$j)(e.content);if(s)return s;const t=e.content_list??[];return t.length?t.map(e=>(0,h.$j)(e.content)).filter(Boolean).join("\n\n"):""}let b=0;function w(){return-++b}function y(e=[]){let s=0;return e.filter(e=>"user"===e.role||"assistant"===e.role).map(e=>({id:++s,sender:"assistant"===e.role?"bot":"user",text:j(e),attachments:e.attachments??[],content_list:e.content_list??(e.tool_call_ends?.length?[{tool_call_ends:e.tool_call_ends,content:j(e),role:"assistant"}]:void 0),images:e.images,audio:e.audio,embeddings:e.embeddings,elapsed_ms:e.elapsed_ms}))}const S=/\.(md|txt|json|js|jsx|ts|tsx|css|html?|xml|ya?ml|py|java|go|rs|c|cpp|h|hpp|sh|bat|cmd|ini|toml|csv|log|sql|env|gitignore|dockerfile)$/i;function N(e){return e.type?.startsWith("image/")?"image":e.type?.startsWith("text/")||S.test(e.name)?"text":"binary"}function k(e){return e.text()}function C(e){return new Promise((s,t)=>{const n=new FileReader;n.onload=()=>s(n.result),n.onerror=t,n.readAsDataURL(e)})}async function A(e){const s=[];for(const t of e){const e=N(t);let n="";if("text"===e)try{const e=await k(t),s=12e4;n=e.length>s?`${e.slice(0,s)}\n\n[内容已截断,原始长度 ${e.length} 字符]`:e}catch{n="[文本读取失败]"}else if("image"===e)try{n=await C(t)}catch{n=`[图片文件: ${t.name}]`}else n=`[二进制文件: ${t.name}]`;s.push({name:t.name,mime_type:t.type,size:t.size,kind:e,content:n})}return s}function M(e){return"bot"!==e.sender||!!(e.text||e.content_list?.length||e.attachments?.length)}var I=t(21499),$=t(64694),R=t(45907),B=t(74848);var T=t(40505);function D(e){const{active_session_id_ref:s,local_owner_ref:t,subscribed_ref:a,set_messages:i,scroll_to_bottom:o,follow_ref:c,mark_session_running:r,refresh_sessions:l,reload_session:d,set_active_session_running:u}=e,m=(0,n.useRef)(new Map);return(0,n.useEffect)(()=>{const e=()=>s.current,n=(s,n)=>{if(r(s,!1),e()&&e()===s){if(m.current.clear(),u(!1),a.current===s&&(p.ws.sendData(f.HK.ai_chat_subscribe,{session_id:s,subscribe:!1}),a.current=null),t.current===s)return void(t.current=null);n?.length?i(e=>{let s=e.length;for(;s>0&&"bot"===e[s-1].sender;)s--;return[...e.slice(0,s),...y(n)].map((e,s)=>({...e,id:s+1}))}):d(s).catch(()=>{})}l()},g=s=>{const n=s?.context||{};n.session_id&&(((s,n,a,r,l=0)=>{e()&&e()===s&&t.current!==s&&i(e=>{const s=m.current,t=r?-(l+1):l;let i=e;if(!r){const e=-(l+1),t=s.get(e);void 0!==t&&(i=i.filter(e=>e.id!==t),s.delete(e))}const d=s.get(t),u=void 0===d?-1:i.findIndex(e=>e.id===d),g=-1===u?{id:w(),sender:"bot",text:""}:{...i[u]};if(-1===u&&s.set(t,g.id),r)g.text=n,g.is_loading=!0;else if(n){g.text=g.text+n;const e=g.content_list?.[0];e&&(e.content=g.text),g.is_loading=!1}if(a&&(g.content_list=[{tool_call_ends:a,content:g.text,role:"assistant"}],g.is_loading=!1),c.current&&requestAnimationFrame(()=>o()),-1===u)return[...i,g];const h=i.slice();return h[u]=g,h})})(n.session_id,n.text||"",n.tool_call_ends,n.notice,n.chunk_index),r(n.session_id,!0))},h=e=>{const s=e?.context||{};s.session_id&&n(s.session_id,s.once_messages_list)},_=e=>{const s=e?.context||{};s.session_id&&n(s.session_id,s.once_messages_list)};return p.ws.addMsg(f.HK.ai_chat_msg,g),p.ws.addMsg(f.HK.ai_chat_end,h),p.ws.addMsg(f.HK.ai_chat_error,_),()=>{p.ws.off_message(`message_${f.HK.ai_chat_msg}`,g),p.ws.off_message(`message_${f.HK.ai_chat_end}`,h),p.ws.off_message(`message_${f.HK.ai_chat_error}`,_),a.current&&(p.ws.sendData(f.HK.ai_chat_subscribe,{session_id:a.current,subscribe:!1}),a.current=null)}},[]),{chunkBubbleRef:m,bind_live_bubbles:(e,s)=>{m.current.clear();for(let t=0;t<s;t++){const n=e[e.length-s+t];n&&m.current.set(t,n.id)}},clear_bubbles:()=>m.current.clear()}}var H=t(85997),E=t(34299);function V(e){const s=e.attachments&&e.attachments.length>0?(0,B.jsx)("div",{className:"chat-message-attachments",children:e.attachments.map((e,s)=>(0,B.jsxs)("div",{className:"chat-message-attachment",children:[(0,B.jsx)(H.In,{icon:"attach_file"}),(0,B.jsx)("span",{children:e.name}),(0,B.jsxs)("small",{children:[e.size," B"]})]},`${e.name}_${s}`))}):null,t=[];e.images&&"bot"===e.sender&&t.push((0,B.jsx)(n.Fragment,{children:(0,B.jsx)(P,{images:e.images,text:e.text})},"images")),e.audio&&"bot"===e.sender&&t.push((0,B.jsx)(n.Fragment,{children:(0,B.jsx)(L,{audio:e.audio,text:e.text})},"audio")),e.embeddings&&"bot"===e.sender&&t.push((0,B.jsx)(n.Fragment,{children:(0,B.jsx)(F,{embeddings:e.embeddings,text:e.text})},"embeddings"));const a=function(e){if("bot"!==e.sender||!e.content_list?.length)return e.text?(0,B.jsx)(E.default,{context:e.text}):null;return(0,B.jsxs)(B.Fragment,{children:[e.content_list.map((e,s)=>{const t=[],a=(0,h.$j)(e.content);return a&&t.push((0,B.jsx)(n.Fragment,{children:(0,B.jsx)(E.default,{context:a})},`content-${s}`)),e.tool_call_ends?.length&&t.push((0,B.jsx)(n.Fragment,{children:(0,B.jsx)(K,{callList:e.tool_call_ends})},`tool-${s}`)),(0,B.jsx)(n.Fragment,{children:t},`part-${s}`)}),!e.content_list.some(e=>e.content)&&e.text?(0,B.jsx)(E.default,{context:e.text}):null]})}(e);return 0===t.length?(0,B.jsxs)(B.Fragment,{children:[s,a]}):(0,B.jsxs)(B.Fragment,{children:[t,s,a]})}function K({callList:e}){const[s,t]=n.useState(!1);if(!e?.length)return null;e.filter(e=>e.success).length;const a=e.filter(e=>!e.success).length;return(0,B.jsxs)("div",{className:"chat-message-call-list",children:[(0,B.jsxs)("div",{className:"call-list-header",onClick:()=>t(!s),children:[(0,B.jsx)(H.In,{icon:s?"expand_less":"expand_more"}),(0,B.jsxs)("span",{className:"call-list-summary",children:["工具调用 (",e.length,")",a>0&&(0,B.jsx)("span",{className:"call-list-fail",children:" 失败 "})]})]}),s&&(0,B.jsx)("div",{className:"call-list-body",children:e.map((e,s)=>(0,B.jsxs)("div",{className:"call-list-item "+(e.success?"call-success":"call-fail"),children:[(0,B.jsxs)("div",{className:"call-list-item-header",children:[(0,B.jsx)(H.In,{icon:e.success?"check_circle":"error"}),(0,B.jsx)("span",{className:"call-list-tool-name",children:e.tool_display_name||e.tool_name}),(0,B.jsxs)("span",{className:"call-list-duration",children:[e.duration_ms,"ms"]})]}),e.tool_args&&(0,B.jsxs)("details",{className:"call-list-details",children:[(0,B.jsx)("summary",{children:"参数"}),(0,B.jsx)("pre",{className:"call-list-pre",children:JSON.stringify(e.tool_args,null,2)})]}),!e.success&&e.error&&(0,B.jsxs)("details",{className:"call-list-details",children:[(0,B.jsx)("summary",{children:"错误"}),(0,B.jsx)("pre",{className:"call-list-pre call-list-error-text",children:e.error})]}),e.success&&e.tool_result&&(0,B.jsxs)("details",{className:"call-list-details",children:[(0,B.jsx)("summary",{children:"结果"}),(0,B.jsx)("pre",{className:"call-list-pre",children:e.tool_result.length>500?e.tool_result.slice(0,500)+"...":e.tool_result})]})]},s))})]})}function P({images:e,text:s}){let t=e||[];if(!t.length&&s)try{t=JSON.parse(s).data||[]}catch{}return t.length?(0,B.jsxs)("div",{className:"image-generation-result",children:[t.map((e,s)=>(0,B.jsxs)("div",{className:"image-generation-item",children:[e.url&&(0,B.jsx)("div",{className:"image-generation-image-wrapper",children:(0,B.jsx)("img",{src:e.url,alt:e.revised_prompt||`生成的图片 ${s+1}`,loading:"lazy"})}),e.b64_json&&(0,B.jsx)("div",{className:"image-generation-image-wrapper",children:(0,B.jsx)("img",{src:`data:image/png;base64,${e.b64_json}`,alt:`生成的图片 ${s+1}`})}),e.revised_prompt&&(0,B.jsx)("p",{className:"image-generation-prompt",children:(0,B.jsx)("small",{children:e.revised_prompt})})]},s)),s&&!e&&(0,B.jsx)(E.default,{context:s})]}):(0,B.jsx)(E.default,{context:s||""})}function L({audio:e,text:s}){if(e){if(e.url)return(0,B.jsx)("div",{className:"audio-result",children:(0,B.jsx)("audio",{controls:!0,src:e.url,children:"您的浏览器不支持音频播放"})});if(e.data){const s=e.mime_type||"audio/mpeg";return(0,B.jsx)("div",{className:"audio-result",children:(0,B.jsx)("audio",{controls:!0,src:`data:${s};base64,${e.data}`,children:"您的浏览器不支持音频播放"})})}}const t=s||"";if(t.startsWith("http://")||t.startsWith("https://"))return(0,B.jsx)("div",{className:"audio-result",children:(0,B.jsx)("audio",{controls:!0,src:t,children:"您的浏览器不支持音频播放"})});try{const e=JSON.parse(t);if(e?.data||e?.audio_data){const s=e.data||e.audio_data;return(0,B.jsx)("div",{className:"audio-result",children:(0,B.jsx)("audio",{controls:!0,src:`data:audio/mpeg;base64,${s}`,children:"您的浏览器不支持音频播放"})})}}catch{}return(0,B.jsx)(E.default,{context:t})}function z({content:e,label:s}){const[t,a]=n.useState(!1);return(0,B.jsxs)("button",{className:"embeddings-copy-btn",onClick:()=>{(0,T.lW)(e),a(!0),setTimeout(()=>a(!1),1500)},children:[(0,B.jsx)(H.In,{icon:t?"check":"content_copy"}),t?"已复制":s||"复制"]})}function F({embeddings:e,text:s}){let t=e||null;if(!t&&s)try{t=JSON.parse(s)}catch{return(0,B.jsx)(E.default,{context:s})}if(!t)return(0,B.jsx)(E.default,{context:s||""});const n=t?.data||[],a=t?.usage,i=JSON.stringify(t,null,2);return(0,B.jsxs)("div",{className:"embeddings-result",children:[(0,B.jsxs)("div",{className:"embeddings-summary",children:[(0,B.jsx)("strong",{children:"向量嵌入结果"}),(0,B.jsxs)("span",{children:["维度: ",n[0]?.embedding?.length??"N/A"]}),(0,B.jsxs)("span",{children:["数量: ",n.length]}),a&&(0,B.jsxs)("span",{children:["使用 tokens: ",a.total_tokens??"N/A"]})]}),(0,B.jsxs)("div",{className:"embeddings-toolbar",children:[(0,B.jsx)(z,{content:i,label:"复制全部结果"}),n.length>0&&n[0]?.embedding&&(0,B.jsx)(z,{content:JSON.stringify(n[0].embedding,null,2),label:"复制第一条向量"}),n.length>0&&(0,B.jsx)(z,{content:JSON.stringify(n.map(e=>e.embedding),null,2),label:"复制所有向量数据"})]}),n.length>0&&n[0]?.embedding&&(0,B.jsx)("div",{className:"embeddings-preview",children:(0,B.jsxs)("span",{children:["向量预览: [",n[0].embedding.slice(0,5).join(", "),n[0].embedding.length>5?", ...":"","]"]})}),n.length>0&&(0,B.jsxs)("details",{children:[(0,B.jsx)("summary",{children:"查看详细数据"}),(0,B.jsx)("pre",{className:"embeddings-raw",children:i})]})]})}async function O(e,s,t,n){try{switch(e){case"images":{const e=await async function(e,s){const t={prompt:e,session_id:s},n=await c.jV.post("images/generations",t);if(0!==n.code)throw new Error(n.message||"图片生成失败");const a=n.data||{},i=(a.data||[]).map(e=>({url:e.url,b64_json:e.b64_json,revised_prompt:e.revised_prompt})),o=i.map((e,s)=>`![生成图片${s+1}](${e.url||`data:image/png;base64,${e.b64_json}`})${e.revised_prompt?`\n> ${e.revised_prompt}`:""}`).join("\n\n");return{session_id:a.session_id||s,images:i,text:o||`生成了 ${i.length} 张图片`}}(s,t);return e&&n(e.text,{images:e.images}),!0}case"audio_speech":{const e=await async function(e,s){const t={input:e,session_id:s};try{const e=localStorage.getItem("ai_audio_extra_params");if(e){const s=JSON.parse(e);s.voice&&(t.voice=s.voice),s.speed&&(t.speed=parseFloat(s.speed))}}catch{}const n=localStorage.getItem("token")||"",a=await fetch("/api/ai_agent/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:n},body:JSON.stringify(t)});if(!a.ok)throw new Error(`语音合成失败: ${a.statusText}`);const i=a.headers.get("X-Session-Id")||s,o=await a.arrayBuffer();return{session_id:i,audio:{data:btoa(String.fromCharCode(...Array.from(new Uint8Array(o)))),mime_type:a.headers.get("content-type")||"audio/mpeg"},text:`[音频文件: ${e.slice(0,50)}...]`}}(s,t);return e&&n(e.text,{audio:e.audio}),!0}case"embeddings":{const e=await async function(e,s){const t=await c.jV.post("embeddings",{input:e,session_id:s});if(0!==t.code)throw new Error(t.message||"Embeddings 请求失败");const n=t.data||{},a=n?.data??[],i=`向量维度: ${a[0]?.embedding?.length??0}, 数量: ${a.length}`;return{session_id:n.session_id||s,embeddings:n,text:`✅ Embeddings 结果 - ${i}\n\`\`\`json\n${JSON.stringify(n,null,2).slice(0,2e3)}\n\`\`\``}}(s,t);return e&&n(e.text,{embeddings:e.embeddings}),!0}default:return!1}}catch(e){return n(`请求失败: ${e?.message||JSON.stringify(e)}`),!0}}var q=t(4412),U=t(23430),G=t(87361),J=t(80389),W=t(7523),Q=t(23496);const X=({currentModelName:e,setCurrentModelName:s,modelGroups:t,onModelChanged:r,batchMode:u,selectedMsgCount:h,sessionVisible:_,onToggleSessionPanel:p,onCreateSession:f,onToggleBatchMode:v,onBatchDeleteMessages:j,bgProcessVisible:b,bgProcessCount:w,onToggleBgProcess:y,inline:S})=>{const{t:N}=(0,i.Bd)(),k=(0,o.Zp)(),{check_user_auth:C}=(0,l.MH)(),[,A]=(0,a.fp)(m.AG.ai_session_collapsed),{open:M}=function(){const{t:e}=(0,i.Bd)(),[,s]=(0,a.fp)(m.AG.prompt_card),[t,o]=(0,a.fp)(m.AG.ai_chat_zoom),{initUserInfo:r}=(0,n.useContext)(W.F);return{open:()=>{const n=t,a=()=>s({open:!1});s({open:!0,title:e("缩放调整"),context_div:(0,B.jsx)(J.p,{defaultValue:t,onChange:o,min:30,max:200}),cancel:()=>{o(n),a()},confirm:async()=>{let s=100;o(e=>(s=e<30||e>200?100:e,s)),await c.wm.post(Q.s.user_save_private_attr,{is_ai_chat_zoom:!0,ai_chat_zoom:s}),(0,x.SK)(e("缩放调整成功")),r(),a()}})}}}(),I=C(U.oV.ai_model_switch)||C(U.oV.ai_agent_setting),$=[];for(const e of t)for(const s of e.models)$.push({title:s.label||s.value,value:`${e.index}::${s.value}`,group:e.note});const R=t.find(e=>e.active),T=R?`${R.index}::${e}`:"",D=(0,B.jsxs)(n.Fragment,{children:[(0,B.jsx)(H.rA,{icon:"menu",title:N("会话"),onClick:p,selected:_}),(0,B.jsx)(H.rA,{icon:"add",title:N("新会话"),onClick:()=>f()}),I&&$.length>0&&(0,B.jsx)(g.l6,{value:T,options:[{title:N("选择模型"),value:""},...$],margin:"0 0 0 1em",onChange:e=>{const t=String(e??"");if(!t.includes("::"))return;const[n,...a]=t.split("::"),i=a.join("::");i&&(s(i),c.jV.post("set_active_model",{index:Number(n),model_name:i}).then(e=>{e?.code===d.m.Success?((0,x.SK)("success"),r()):(0,x.zN)(e?.message||"fail")}).catch(console.error))},no_border:!0,width:"auto"}),u&&(0,B.jsx)(H.rA,{icon:"done",title:N("完成"),onClick:v}),u&&h>0&&(0,B.jsx)(H.rA,{icon:"delete",title:N("删除选中消息"),onClick:j}),(0,B.jsx)(H.rA,{icon:"zoom_in",title:N("缩放调整"),onClick:M}),(0,B.jsx)(H.rA,{icon:"terminal",title:N("后台进程"),onClick:y,selected:b,tip:w||null}),C(U.oV.ai_agent_setting)&&(0,B.jsx)(H.rA,{icon:"smart_toy",title:"机器人配置",onClick:()=>{k(G.o.ai_rebot_setting_page)}}),C(U.oV.ai_agent_setting)&&(0,B.jsx)(H.rA,{icon:"settings",title:"ai setting",onClick:()=>{k(G.o.ai_agent_setting_page)}})]});return S?(0,B.jsx)("div",{className:"chat-inline-header",children:D}):(0,B.jsx)(q.aZ,{position:"right",children:D})};var Y=t(75725);function Z({items:e}){const s=e.filter(e=>!!e.text);return 0===s.length?null:(0,B.jsx)("div",{className:"chat-session-meta",children:s.map((e,s)=>(0,B.jsx)("small",{className:e.className,title:e.title,children:e.text},s))})}function ee(e){return e||"新会话"}function se({sessions:e,activeSessionId:s,onSelectSession:t,onReorderSessions:a,onRenameSession:o,onDeleteSession:c,onToggleCmdAuto:r,onShowUsageStats:l,onShowSessionSetting:d,batchMode:u,selectedSessionIds:m,onToggleSessionSelect:g,onToggleBatchMode:h,onBatchDeleteSessions:_,onClearAllSessions:p,allUsersMode:f,onToggleAllUsersMode:x,showAllUsersEntry:v,sysPromptList:j,onChangeSysPrompt:b}){const{t:w}=(0,i.Bd)(),[y,S]=(0,n.useState)(""),N=(0,n.useRef)(null),[k,C]=(0,n.useState)(null),[A,M]=(0,n.useState)(null),[I,$]=(0,n.useState)(null),R=!!a&&!f,T=e=>{if(!e)return"";const s=j?.find(s=>String(s.index)===String(e));return s?s.note||s.prompt.slice(0,20):""},D=e=>[{text:String(e.message_count??""),className:"chat-session-meta__count",title:w("消息数")},{text:T(e.sys_prompt_id),className:"chat-session-meta__prompt",title:w("系统提示词")},{text:"web"!==e.source?e.source:"",className:"chat-session-meta__source",title:w("来源")},{text:f&&e.owner_name||"",className:"chat-session-meta__owner",title:e.owner_name}],E=y.trim()?e.filter(e=>(e.title||"").toLowerCase().includes(y.toLowerCase())||(e.summary||"").toLowerCase().includes(y.toLowerCase())||(e.long_term_memory||"").toLowerCase().includes(y.toLowerCase())||f&&(e.owner_name||"").toLowerCase().includes(y.toLowerCase())):e,V=e.find(e=>e.id===s);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)("aside",{className:"chat-session-list",children:[(0,B.jsxs)("div",{className:"chat-session-search",children:[(0,B.jsx)("input",{type:"text",className:"chat-session-search-input",placeholder:w("搜索会话"),value:y,onChange:e=>S(e.target.value)}),V&&(0,B.jsx)("button",{className:"chat-session-current",title:ee(V.title),onClick:()=>(e=>{const s=()=>{const s=N.current,t=s?.querySelector(`[data-session-id="${e}"]`);t&&t.scrollIntoView({block:"center",behavior:"smooth"})};if(!E.some(s=>s.id===e))return S(""),void requestAnimationFrame(()=>requestAnimationFrame(s));s()})(V.id),children:(0,B.jsx)("span",{children:ee(V.title)})})]}),(0,B.jsx)("div",{className:"chat-session-items-wrap",ref:N,children:E.map((e,n)=>(0,B.jsx)("div",{"data-session-id":e.id,children:(0,B.jsxs)("button",{className:`chat-session-item ${s===e.id?"active":""} ${u?"batch-mode":""} ${e.running?"is-running":""} ${k===n?"row-dragging":""} ${A===n&&null!==k&&k!==n?"row-drop-target":""}`,draggable:R,onDragStart:()=>C(n),onDragOver:e=>{null!==k&&(e.preventDefault(),A!==n&&M(n))},onDragEnd:()=>{C(null),M(null)},onDrop:e=>{e.preventDefault(),(e=>{const s=k;if(C(null),M(null),null===s||s===e||!a)return;const t=E[s]?.id,n=E[e]?.id;t&&n&&a(t,n)})(n)},onClick:()=>{u&&g?g(e.id):t(e.id)},title:e.summary||e.long_term_memory||e.title,children:[u&&(0,B.jsx)("input",{type:"checkbox",className:"chat-session-checkbox",checked:m?.has(e.id)??!1,onChange:()=>g?.(e.id),onClick:e=>e.stopPropagation()}),(0,B.jsx)("span",{children:ee(e.title)}),e.running&&(0,B.jsx)("span",{className:"chat-session-running",title:w("正在执行中")}),(0,B.jsx)(Z,{items:D(e)}),!u&&(0,B.jsx)("i",{className:"chat-session-more material-icons",title:w("更多操作"),onClick:s=>{s.stopPropagation();const t=s.currentTarget.getBoundingClientRect();$({x:t.right,y:t.bottom,session:e})},children:"more_horiz"})]})},e.id))}),(0,B.jsxs)("div",{className:"chat-session-actions",children:[(0,B.jsx)(H.rA,{icon:u?"check_circle":"checklist",title:w(u?"取消批量选择":"批量选择"),onClick:h}),v&&!u&&(0,B.jsx)(H.rA,{icon:f?"person":"groups",title:w(f?"仅看我的会话":"查看所有用户会话"),onClick:x}),u&&(m?.size??0)>0&&(0,B.jsx)(H.rA,{icon:"delete",title:w("删除选中会话"),onClick:_}),!u&&p&&(0,B.jsx)(H.rA,{icon:"delete_sweep",title:w("删除全部会话"),onClick:p})]})]}),I&&(0,B.jsx)(Y.rY,{click:()=>$(null),children:(0,B.jsx)(Y.sw,{x:I.x,y:I.y,items:(e=>{const s=[{r:w("重命名"),v:"rename",run:()=>o(e.id,e.title)},...f?[]:[{r:w("移动到最上"),v:"to_top",run:()=>{const s=E[0];s&&s.id!==e.id&&a?.(e.id,s.id)}},{r:w("移动到最下"),v:"to_bottom",run:()=>{const s=E[E.length-1];s&&s.id!==e.id&&a?.(e.id,s.id)}}],{r:e.cmd_auto_allow?w("命令检测关闭"):w("命令检测开启"),v:"cmd_auto",run:()=>r?.(e.id,!e.cmd_auto_allow)}];return j?.length&&s.push({r:w("系统提示词"),items:[{r:w("不使用"),v:"",run:()=>b?.(e.id,"")},...j.map(s=>({r:T(String(s.index)),v:String(s.index),run:()=>b?.(e.id,String(s.index))}))]}),s.push({r:w("字符消耗统计"),v:"usage",run:()=>l(e.id)},{r:w("设置"),v:"setting",run:()=>d?.(e.id)},{r:w("删除"),v:"delete",run:()=>c(e.id)}),s})(I.session),pre_value:I.session.sys_prompt_id?String(I.session.sys_prompt_id):"",click:(e,s)=>{$(null),s?.run?.()}})})]})}function te(e){const s=(e.text||"").split("\n").map(e=>e.trim()).find(Boolean)||"";return s.length>80?s.slice(0,80)+"…":s}const ne=({messages:e,batchMode:s,selectedMsgIds:t,sending:a,chatContainerRef:i,messagesEndRef:o,onToggleMsgSelect:c,onDelete:r,onCopy:l,onCopyAll:d,onToggleBatchMode:u,onBatchCopy:m,onBatchDelete:g,showBatchBar:h,t:_})=>{const[p,f]=(0,n.useState)(new Set),x=(0,n.useMemo)(()=>e.filter(e=>!e.is_loading).map(e=>e.id),[e]),v=e=>{f(s=>{const t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},j=()=>{f(e=>e.size>0&&x.every(s=>e.has(s))?new Set:new Set(x))};return(0,B.jsxs)("div",{className:"chat-messages",ref:i,"data-sending":a?"true":"false",children:[h&&(0,B.jsxs)("div",{className:"chat-message-batch-bar",children:[(0,B.jsxs)("span",{className:"batch-bar-count",children:[_("已选")," ",t.size]}),(0,B.jsx)("button",{onClick:m,children:_("复制所选")}),(0,B.jsx)("button",{onClick:g,className:"danger",children:_("删除所选")}),(0,B.jsx)("button",{onClick:u,children:_("取消")})]}),e.map(e=>{const n=p.has(e.id);return(0,B.jsxs)("div",{className:`chat-message ${e.sender} ${s?"batch-mode":""} ${e.is_loading?"is-loading":""} ${n?"collapsed":""}`,children:[s&&(0,B.jsx)("input",{type:"checkbox",className:"chat-message-checkbox",checked:t.has(e.id),onChange:()=>c(e.id)}),e.is_loading?(0,B.jsxs)("div",{className:"ai-loading-bubble",children:[(0,B.jsxs)("div",{className:"ai-loading-dots",children:[(0,B.jsx)("span",{className:"ai-loading-dot"}),(0,B.jsx)("span",{className:"ai-loading-dot"}),(0,B.jsx)("span",{className:"ai-loading-dot"})]}),(0,B.jsx)("span",{className:"ai-loading-text",children:e.text})]}):(0,B.jsxs)(B.Fragment,{children:[n?(0,B.jsxs)("div",{className:"chat-message-summary",title:e.text,onClick:()=>v(e.id),children:[(0,B.jsx)("span",{className:"chat-message-summary-icon",children:"▸"}),(0,B.jsx)("span",{className:"chat-message-summary-text",children:te(e)||_("(无内容)")})]}):(0,B.jsx)("div",{className:"chat-message-body",children:V(e)}),(0,B.jsxs)("div",{className:"message-actions",children:[(0,B.jsx)("button",{onClick:()=>r(e.id),children:_("删除")}),(0,B.jsx)("button",{onClick:()=>l(e),children:_("复制")}),(0,B.jsx)("button",{onClick:d,children:_("全部复制")}),(0,B.jsx)("button",{onClick:u,children:_("多选")})]}),(0,B.jsxs)("div",{className:"message-collapse-bar",children:[(0,B.jsx)("button",{onClick:()=>v(e.id),children:_(n?"展开":"折叠")}),(0,B.jsx)("button",{onClick:j,children:_("全部折叠")}),"bot"===e.sender&&null!=e.elapsed_ms&&(0,B.jsx)("span",{className:"message-elapsed",children:(0,I.kf)(e.elapsed_ms)})]})]})]},e.id)}),(0,B.jsx)("div",{ref:o})]})},ae=(0,n.forwardRef)(function({placeholder:e="",disabled:s=!1,className:t,style:a,onEnter:i,onPaste:o,onChange:c},r){const l=(0,n.useRef)(null),[d,u]=(0,n.useState)(!0),[m,g]=(0,n.useState)(!1),h=(0,n.useCallback)(()=>{const e=l.current;return e?(e.textContent??"").replace(/\u00A0/g," ").trimEnd():""},[]);(0,n.useImperativeHandle)(r,()=>({getValue:()=>h(),setValue:e=>{const s=l.current;if(!s)return;s.textContent=e,u(!e);const t=document.createRange();t.selectNodeContents(s),t.collapse(!1);const n=window.getSelection();n?.removeAllRanges(),n?.addRange(t)},clear:()=>{const e=l.current;e&&(e.textContent="",u(!0))},focus:()=>l.current?.focus()})),(0,n.useEffect)(()=>{const e=l.current;if(!e)return;const s=()=>u(!e.textContent);return e.addEventListener("input",s),()=>e.removeEventListener("input",s)},[]);return(0,B.jsx)("div",{ref:l,contentEditable:!s,suppressContentEditableWarning:!0,className:"rich-textarea"+(t?" "+t:""),style:a,onKeyDown:e=>{m||"Enter"!==e.key||e.shiftKey||e.ctrlKey||e.metaKey||e.altKey||(e.preventDefault(),i?.())},onPaste:o,onInput:()=>c?.(h()),onCompositionStart:()=>g(!0),onCompositionEnd:()=>g(!1),"data-placeholder":d?e:void 0})});var ie=t(84369);function oe({pendingAttachments:e,onRemove:s}){return 0===e.length?null:(0,B.jsx)("div",{className:"chat-attachment-strip",children:e.map((e,t)=>(0,B.jsxs)("div",{className:"chat-attachment-chip",children:[(0,B.jsx)(H.In,{icon:"attach_file"}),(0,B.jsx)("span",{title:e.name,children:e.name}),(0,B.jsx)("button",{type:"button",onClick:()=>s(t),children:(0,B.jsx)(H.In,{icon:"close"})})]},`${e.name}_${t}`))})}const ce=(0,n.forwardRef)(({onSend:e,sending:s,onAbort:t,pendingAttachments:o,onRemoveAttachment:c,onOpenFilePicker:r,onAddFiles:l,onDrop:d,onDragOver:u,fileInputRef:g,readonly:h=!1},_)=>{const{t:p}=(0,i.Bd)(),f=(0,n.useRef)(null),x=(0,n.useRef)(null),[v,j]=(0,a.fp)(m.AG.ai_chat_input_height);(0,n.useImperativeHandle)(_,()=>({getValue:()=>f.current?.getValue()??"",setValue:e=>f.current?.setValue(e),clear:()=>f.current?.clear()}));const{dragging:b,on_pointer_down:w,on_pointer_up:y}=(0,ie.y)({direction:"vertical",get_start_size:()=>v,px_to_unit:e=>e/(()=>{const e=x.current;return e&&parseFloat(getComputedStyle(e).fontSize)||16})(),min:2,on_change:e=>j(e)}),S={minHeight:`${v}em`,maxHeight:`${v}em`};return(0,B.jsxs)("div",{ref:x,className:"chat-input-area"+(h?" readonly":""),onDrop:h?void 0:d,onDragOver:h?void 0:u,children:[!h&&(0,B.jsx)("div",{className:"chat-input-resize-handle"+(b?" dragging":""),onPointerDown:w}),(0,B.jsx)("input",{ref:g,type:"file",multiple:!0,style:{display:"none"},onChange:e=>{e.target.files?.length&&(l(e.target.files),e.currentTarget.value="")}}),(0,B.jsxs)("div",{className:"chat-input-shell",children:[(0,B.jsx)(oe,{pendingAttachments:o,onRemove:c}),(0,B.jsx)(ae,{ref:f,placeholder:p(h?"查看全部会话时不可发送消息":"输入消息"),disabled:h,onEnter:()=>e(),onPaste:e=>{const s=e.clipboardData?.files;s&&s.length>0&&(e.preventDefault(),l(s))},className:"chat-input",style:S})]}),!h&&(0,B.jsx)(H.rA,{title:p("添加文件"),icon:"attach_file",onClick:r}),h?(0,B.jsx)("button",{className:"little-button button",disabled:!0,children:p("发送")}):s?(0,B.jsx)(H.Vi,{color:"var( --icon-red)",text:p("暂停"),clickFun:t}):(0,B.jsx)(H.Vi,{text:p("发送"),clickFun:e}),b&&(0,B.jsx)("div",{className:"chat-input-overlay",onPointerUp:y})]})}),re=function(e){const{t:s}=(0,i.Bd)(),[t,o]=(0,n.useState)([]),[c,r]=(0,n.useState)(!1),[l,d]=(0,n.useState)(null),[u,g]=(0,n.useState)(null),[h,_]=(0,n.useState)(!1),[v,j]=(0,a.fp)(m.AG.ai_bg_expanded),[,b]=(0,a.fp)(m.AG.ai_session_collapsed),w=()=>{j(!1)},y=(0,n.useCallback)(async()=>{r(!0);try{const s=new f.hf(f.HK.ai_bg_process_list_req);s.context={};const t=await p.ws.send(s);t?.context?.processes&&(o(t.context.processes),e.panelRef?.current?.onCountChange?.(t.context.processes.length))}catch(e){console.error("获取后台进程列表失败",e)}finally{r(!1)}},[]);e.panelRef&&(e.panelRef.current.refresh=y);const S=(0,n.useCallback)(async e=>{_(!0),d(e);try{const s=new f.hf(f.HK.ai_bg_process_output_req);s.context={pid:e};const t=await p.ws.send(s);g(t.context)}catch(e){console.error("获取进程输出失败",e),(0,x.zN)("获取进程输出失败")}finally{_(!1)}},[]),N=(0,n.useCallback)(async e=>{try{const s=new f.hf(f.HK.ai_bg_process_kill_req);s.context={pid:e};const t=await p.ws.send(s);t?.context?.success?((0,x.SK)("进程已终止"),y(),l===e&&(d(null),g(null))):(0,x.zN)(t?.context?.message||"终止失败")}catch(e){console.error("终止进程失败",e),(0,x.zN)("终止进程失败")}},[y,l]);(0,n.useEffect)(()=>{y();const e=setInterval(y,5e3);return()=>clearInterval(e)},[y]);const k=t.filter(e=>e.running),C=t.filter(e=>!e.running);return(0,B.jsxs)(B.Fragment,{children:[v&&(0,B.jsx)("div",{className:"chat-session-overlay",onClick:w}),(0,B.jsxs)("aside",{className:"chat-bg-process-panel "+(v?"expanded":""),children:[(0,B.jsxs)("div",{className:"chat-bg-process-header",children:[(0,B.jsx)("span",{className:"chat-bg-process-title",children:s("后台进程")}),(0,B.jsx)(H.rA,{icon:"close",title:s("关闭"),onClick:w})]}),(0,B.jsxs)("div",{className:"chat-bg-process-toolbar",children:[(0,B.jsx)(H.rA,{icon:"refresh",title:s("刷新"),onClick:y}),(0,B.jsxs)("span",{className:"chat-bg-process-count",children:[k.length," ",s("个运行中"),C.length>0&&` / ${C.length} ${s("个已退出")}`]})]}),(0,B.jsxs)("div",{className:"chat-bg-process-list",children:[c&&0===t.length&&(0,B.jsx)("div",{className:"chat-bg-process-empty",children:s("加载中...")}),!c&&0===t.length&&(0,B.jsx)("div",{className:"chat-bg-process-empty",children:s("暂无后台进程")}),k.map(e=>(0,B.jsxs)("div",{className:`chat-bg-process-item ${l===e.pid?"active":""} running`,children:[(0,B.jsxs)("div",{className:"chat-bg-process-item-main",onClick:()=>S(e.pid),children:[(0,B.jsxs)("span",{className:"chat-bg-process-pid",children:["PID: ",e.pid]}),(0,B.jsx)("span",{className:"chat-bg-process-cmd",title:e.cmd,children:e.cmd.length>40?e.cmd.slice(0,40)+"...":e.cmd}),(0,B.jsx)("span",{className:"chat-bg-process-time",children:new Date(e.start_time).toLocaleTimeString()}),(0,B.jsx)("span",{className:"chat-bg-process-status running-dot",title:s("运行中"),children:"●"})]}),(0,B.jsxs)("div",{className:"chat-bg-process-item-actions",children:[(0,B.jsx)(H.rA,{icon:"terminal",title:s("查看输出"),onClick:()=>S(e.pid)}),(0,B.jsx)(H.rA,{icon:"stop",title:s("终止进程"),onClick:()=>N(e.pid)})]})]},e.pid)),C.map(e=>(0,B.jsx)("div",{className:`chat-bg-process-item ${l===e.pid?"active":""} finished`,children:(0,B.jsxs)("div",{className:"chat-bg-process-item-main",onClick:()=>S(e.pid),children:[(0,B.jsxs)("span",{className:"chat-bg-process-pid",children:["PID: ",e.pid]}),(0,B.jsx)("span",{className:"chat-bg-process-cmd",title:e.cmd,children:e.cmd.length>30?e.cmd.slice(0,30)+"...":e.cmd}),(0,B.jsx)("span",{className:"chat-bg-process-time",children:new Date(e.start_time).toLocaleTimeString()}),(0,B.jsxs)("span",{className:"chat-bg-process-exit-code",children:["exit: ",e.exit_code]})]})},e.pid))]}),null!==l&&(0,B.jsxs)("div",{className:"chat-bg-process-output",children:[(0,B.jsxs)("div",{className:"chat-bg-process-output-header",children:[(0,B.jsxs)("span",{children:["PID: ",l," ",s("输出")]}),(0,B.jsx)(H.rA,{icon:"close",title:s("关闭"),onClick:()=>{d(null),g(null)}})]}),(0,B.jsx)("div",{className:"chat-bg-process-output-content",children:h?(0,B.jsx)("div",{className:"chat-bg-process-empty",children:s("加载中...")}):u?(0,B.jsx)("pre",{className:"chat-bg-process-output-pre",children:u.output||s("(无输出)")}):null})]})]})]})};function le(e={}){const{inline_header:s=!1,session_id:t,file_cwd_path:h,sync_url:j=!0,on_session_change:b}=e,{t:S}=(0,i.Bd)(),[N,k]=(0,o.ok)(),C=j&&N.get("session")||"",{check_user_auth:H}=(0,l.MH)();(0,u.w)();const[E]=(0,a.fp)(m.AG.user_base_info),V=!!E?.user_data?.is_root,[K,P]=(0,a.fp)(m.AG.ai_session_collapsed),[L,z]=(0,a.fp)(m.AG.ai_bg_expanded),[F,q]=(0,a.fp)(m.AG.prompt_card),[U]=(0,a.fp)(m.AG.ai_chat_zoom),[G,J]=(0,n.useState)(null),[W,Q]=(0,n.useState)([]),[Y,Z]=(0,n.useState)(new Set),[ee,te]=(0,n.useState)([]),[ae,ie]=(0,n.useState)(""),[oe,le]=(0,n.useState)([]),[de,ue]=(0,n.useState)(0),me=(0,n.useRef)(null),ge=(0,n.useRef)(null),he=(0,n.useRef)(null),_e=(0,n.useRef)({}),pe=(0,n.useRef)({}),fe=(0,n.useRef)(null);(0,n.useEffect)(()=>{fe.current=G},[G]);const xe=(0,n.useRef)(null),ve=(0,n.useRef)([]),je=(0,n.useRef)(""),be=(0,n.useRef)(!1),we=(0,n.useRef)(null),ye=(0,n.useRef)(()=>{}),Se=(0,n.useRef)(null),Ne=function(e){const{admin_call:s,owner_of_session:t,get_sessions:a,activeSessionId:o,admin_mode_ref:r}=e,{t:l}=(0,i.Bd)(),u=(0,R.y)(),[m,g]=(0,n.useState)([]),[h,_]=(0,n.useState)(!1),[p,f]=(0,n.useState)(new Set),j=(0,n.useRef)(null),b=(0,n.useRef)(!0),w=(0,n.useRef)(!1),S=(e=!1)=>{const s=j.current;if(!s||!b.current)return;s.scrollTo({top:s.scrollHeight,behavior:e?"smooth":"auto"});let t=0;const n=()=>{const s=j.current;s&&b.current&&(s.scrollTo({top:s.scrollHeight,behavior:e&&0===t?"smooth":"auto"}),++t<6&&requestAnimationFrame(n))};requestAnimationFrame(n)},N=()=>{w.current=!0};return(0,n.useLayoutEffect)(()=>{w.current&&(w.current=!1,b.current=!0),b.current&&S(!1)},[m]),(0,n.useEffect)(()=>{const e=j.current;if(!e)return;const s=s=>{s.deltaY<0?b.current=!1:e.scrollHeight-(e.scrollTop+e.clientHeight)<4&&(b.current=!0)},t=()=>{e.scrollHeight-(e.scrollTop+e.clientHeight)<4&&(b.current=!0)},n=()=>{b.current&&(e.scrollTop=e.scrollHeight)};e.addEventListener("wheel",s,{passive:!0}),e.addEventListener("scroll",t);const a=new ResizeObserver(n),i=()=>[...e.children].forEach(e=>a.observe(e));i();const o=new MutationObserver(()=>{i(),n()});return o.observe(e,{childList:!0}),()=>{e.removeEventListener("wheel",s),e.removeEventListener("scroll",t),a.disconnect(),o.disconnect()}},[]),{messages:m,setMessages:g,batchMode:h,setBatchMode:_,selectedMsgIds:p,setSelectedMsgIds:f,chatContainerRef:j,followRef:b,isNearBottom:(e,s=120)=>{const{scrollTop:t,scrollHeight:n,clientHeight:a}=e;return n-(t+a)<s},scrollToBottom:S,request_scroll_bottom:N,apply_session:e=>{if(!e)return g([]),void N();let s=e.messages??[];e.live_messages?.length&&(s=[...s,...e.live_messages]),g(y(s)),N()},handleDelete:e=>{u({sub_title:l("cf_one"),confirm_fun:async()=>{const n=m.findIndex(s=>s.id===e);if(n<0)return;if(g(m.filter(s=>s.id!==e)),!o)return;const a=t(o);a?s("message_delete",{session_id:o,user_id:a,indices:[n]}).catch(console.error):c.jV.post("session/message/delete",{session_id:o,indices:[n]}).catch(console.error)}})},handleCopy:async e=>{(0,T.lW)(v(e)),(0,x.SK)("复制成功")},handleCopyAll:async()=>{const e=a();if(!e.length)return void(0,x.SK)("暂无聊天记录");const t=[];for(const n of e){const e=n.user_id?await s("get",{session_id:n.id,user_id:n.user_id}):await c.jV.post("session/get",{session_id:n.id});if(e.code!==d.m.Success||!e.data)continue;const a=e.data,i=y([...a.messages??[],...a.live_messages??[]]).map(v).filter(Boolean).join("\n\n\n");i&&t.push(i)}t.length?((0,T.lW)(t.join("\n\n\n")),(0,x.SK)("复制成功")):(0,x.SK)("暂无聊天记录")},handleBatchCopy:()=>{const e=m.filter(e=>p.has(e.id)).map(v).filter(Boolean).join("\n\n\n");e?((0,T.lW)(e),(0,x.SK)("复制成功")):(0,x.SK)("暂无内容")},toggleBatchMode:()=>{h&&f(new Set),_(e=>!e)},toggleMsgSelect:e=>{f(s=>{const t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},batchDeleteMessages:()=>{0!==p.size&&u({sub_title:l("cf_msgs"),confirm_fun:async()=>{const e=[];if(m.forEach((s,t)=>{p.has(s.id)&&e.push(t)}),g(m.filter(e=>!p.has(e.id))),f(new Set),_(!1),!o||0===e.length)return;const n=t(o);n?s("message_delete",{session_id:o,user_id:n,indices:e}).catch(console.error):c.jV.post("session/message/delete",{session_id:o,indices:e}).catch(console.error)}})}}}({admin_call:(e,s)=>c.jV.post("admin/session",{action:e,...s||{}}),owner_of_session:e=>be.current?ve.current.find(s=>s.id===e)?.user_id:void 0,get_sessions:()=>ve.current,activeSessionId:je.current,admin_mode_ref:be});ye.current=Ne.apply_session;const ke=function(e){const{on_session_loaded:s,set_session_panel_open:t,on_session_change:o,init_cwd:r,write_url_session:l,url_session_id:u,init_session_id:h}=e,{t:_}=(0,i.Bd)(),p=(0,R.y)(),[f,v]=(0,a.fp)(m.AG.ai_last_session_id),[j,b]=(0,n.useState)([]),[w,y]=(0,n.useState)(""),[S,N]=(0,n.useState)(""),[k,C]=(0,n.useState)(!1),[A,M]=(0,n.useState)(!1),[T,D]=(0,n.useState)(!1),H=(0,n.useRef)(!1),E=(0,n.useRef)([]);(0,n.useEffect)(()=>{H.current=k},[k]),(0,n.useEffect)(()=>{E.current=j},[j]);const V=(e,s={})=>c.jV.post("admin/session",{action:e,...s}),K=e=>{if(H.current)return E.current.find(s=>s.id===e)?.user_id},P=async(e,n=!1,a)=>{const i=a??E.current.find(s=>s.id===e)?.user_id,r=H.current&&i?await V("get",{session_id:e,user_id:i}):await c.jV.post("session/get",{session_id:e});if(r.code!==d.m.Success||!r.data)return!1;const m=r.data;return y(m.id),v(m.id),u!==m.id&&l(m.id),o?.(m.id),M(!!m.running),N(m.sys_prompt_id??""),n&&t(!0),s(m),!0},L=async e=>{const t=H.current?await V("list_all_sessions"):await c.jV.get("sessions");if(t.code!==d.m.Success)return!1;const n=t.data??[];b(n);const a=null===e?n[0]?.id??"":e||w||n[0]?.id||"";if(!a)return y(""),l(null),s(null),!1;if(e&&!n.some(s=>s.id===e))return!1;const i=n.find(e=>e.id===a)?.user_id;return await P(a,!1,i)},z=async e=>{if(!e)return null;const s=await c.jV.get("sessions");if(s.code!==d.m.Success)return null;const t=s.data??[],n=(0,I.ed)(e),a=t.find(e=>(0,I.ed)(e.file_cwd_path)===n);if(a)return a.id;const i=await c.jV.post("session",{file_cwd_path:n});return i.code!==d.m.Success?null:i.data.id};return{sessions:j,setSessions:b,sessions_ref:E,activeSessionId:w,setActiveSessionId:y,selectedSysPromptId:S,setSelectedSysPromptId:N,admin_all_mode:k,admin_mode_ref:H,readonly:T,activeSessionRunning:A,setActiveSessionRunning:M,admin_call:V,call:(e,s,t)=>H.current?V(e,s):t(),owner_of_session:K,refreshSessions:async()=>{const e=H.current?await V("list_all_sessions"):await c.jV.get("sessions");e.code===d.m.Success&&b(e.data??[])},markSessionRunning:(e,s)=>{b(t=>{const n=t.find(s=>s.id===e);return n&&!!n.running!==s?t.map(t=>t.id===e?{...t,running:s}:t):t})},loadSession:P,loadSessions:L,createSession:async e=>{const n=await c.jV.post("session",{sys_prompt_id:e||void 0,file_cwd_path:r||void 0});if(n.code!==d.m.Success)return;const a=n.data;y(a.id),N(a.sys_prompt_id??""),t(!0),s(null),await L(a.id),requestAnimationFrame(()=>{const e=document.querySelector(".chat-input");e&&(e.style.height="auto",e.style.height=Math.min(e.scrollHeight,200)+"px")})},locate_session_by_cwd:z,init_active_session:async()=>{if(r){const e=await z(r);e&&await L(e)||await L()}else h?await L(h)||await L():u?await L(u)||await L():f&&await L(f)||await L()},reorderSessions:(e,s)=>{if(H.current)return;const t=E.current.findIndex(s=>s.id===e),n=E.current.findIndex(e=>e.id===s);if(t<0||n<0||t===n)return;const a=(0,$.TI)(E.current,t,n);b(a),c.jV.post("sessions/update/sort",{session_ids:a.map(e=>e.id)}).catch(()=>{})},deleteSession:e=>{p({sub_title:"确认删除这个会话吗?",confirm_fun:async()=>{const s=K(e);s?await V("delete",{session_id:e,user_id:s}):await c.jV.post("session/delete",{session_id:e}),w===e?(y(""),await L(null)):await L(w)}})},renameSession:(e,s)=>{let t=s;p({confirm_fun:async()=>{const s=K(e);s?await V("rename",{session_id:e,user_id:s,title:t}):await c.jV.post("sessions/update/meta",{id:e,title:t}),await L(w)},context_div:(0,B.jsx)("div",{className:"card-content",children:(0,B.jsx)(g.Sm,{value:t,handleInputChange:e=>{t=e}})})})},toggleCmdAuto:async(e,s)=>{const t=K(e);t?await V("cmd_auto",{session_id:e,user_id:t,allow:s}):await c.jV.post("session/cmd_auto_allow",{session_id:e,allow:s}),(0,x.SK)(_(s?"命令检测已开启":"命令检测已关闭")),await L(w)},batchDeleteSessions:(e,s)=>{0!==e.size&&p({sub_title:_("cf_ses"),confirm_fun:async()=>{if(H.current)await V("batch_delete",{session_ids:Array.from(e)});else for(const s of e)await c.jV.post("session/delete",{session_id:s});s(),e.has(w)?(y(""),await L(null)):await L(w)}})},clearAllSessions:()=>{p({sub_title:_("cf_all"),confirm_fun:async()=>{await c.jV.post("sessions/clear",{}),y(""),s(null),await L(null)}})},toggleAllUsersMode:async()=>{const e=!k;C(e),H.current=e,D(e),y(""),s(null);const t=e?await V("list_all_sessions"):await c.jV.get("sessions"),n=t.code===d.m.Success?t.data??[]:[];b(n),n[0]?.id&&await P(n[0].id,!1,n[0].user_id)},changeSystemPrompt:(e,s)=>{const t=s||w;if(!t)return;b(s=>s.map(s=>s.id===t?{...s,sys_prompt_id:e||void 0}:s)),t===w&&N(e);const n=K(t);n?V("sys_prompt",{session_id:t,user_id:n,sys_prompt_id:e||void 0}).catch(console.error):c.jV.post("session/sys_prompt",{session_id:t,sys_prompt_id:e||void 0}).catch(console.error)}}}({on_session_loaded:e=>{if(e&&(e.running&&(p.ws.sendData(f.HK.ai_chat_subscribe,{session_id:e.id,subscribe:!0}),we.current=e.id),ye.current(e),e.live_messages?.length)){const s=y([...e.messages??[],...e.live_messages]);Se.current?.bind_live_bubbles(s,e.live_messages.length)}},set_session_panel_open:e=>P(!e),on_session_change:b,init_cwd:h,write_url_session:e=>{j&&k(s=>{const t=new URLSearchParams(s);return e?t.set("session",e):t.delete("session"),t},{replace:!0})},url_session_id:C,init_session_id:t});(0,n.useEffect)(()=>{je.current=ke.activeSessionId,be.current=ke.admin_all_mode,ve.current=ke.sessions},[ke.activeSessionId,ke.admin_all_mode,ke.sessions]);const Ce=D({active_session_id_ref:je,local_owner_ref:xe,subscribed_ref:we,set_messages:Ne.setMessages,scroll_to_bottom:()=>Ne.scrollToBottom(!1),follow_ref:Ne.followRef,mark_session_running:ke.markSessionRunning,refresh_sessions:ke.refreshSessions,reload_session:e=>ke.loadSession(e),set_active_session_running:ke.setActiveSessionRunning});Se.current=Ce;const Ae=(0,n.useRef)((0,r.nF)(e=>{Ne.setMessages(e),Ne.followRef.current&&Ne.scrollToBottom(!1)},50)).current,Me=function(e){const{getMessages:s,setMessages:t,setMessagesDebounced:a,setSending:i,getActiveSessionId:o,setActiveSessionId:c,refreshSessions:r,scrollToBottom:l,buildRequestMessages:d,getSelectedSysPromptId:u,setLocalOwner:m}=e,g=(0,n.useRef)([]),h=(0,n.useRef)(null),_=(e,n,c)=>{const g=s(),_=g.length+1,x={...n,id:_},v=[...g,x];t(v),i(e),m(e),h.current={abort:()=>{}};const j={id:-1,sender:"bot",text:"AI thinking ...",is_loading:!0};v.push(j),t([...v]);const b=new Map,w=()=>{o()===e&&a([...v])},S=()=>{const e=v.indexOf(j);-1!==e&&v.splice(e,1)},N=s=>{const t=s.context||{};if(t.session_id!==e)return;const n=t.text||"",a=t.tool_call_ends,i=t.chunk_index??0;if(t.notice)return j.id=-1,j.text=n,j.is_loading=!0,v.includes(j)||v.push(j),void w();if("[DONE]"===n)return;if(!n&&!a)return;S();let o=b.get(i);if(o||(o={id:_+1+i,sender:"bot",text:"",is_loading:!0},v.push(o),b.set(i,o)),n){o.text=o.text+n;const e=o.content_list?.[0];e&&(e.content=o.text),o.is_loading=!1}a&&(o.content_list=[{tool_call_ends:a,content:o.text,role:"assistant"}],o.is_loading=!1),w()},k=s=>{const n=s.context||{};n.session_id===e&&(A(),h.current=null,m(null),i(s=>s===e?null:s),o()===e&&t(e=>{const s=e.filter(M);let t=s;if(n.once_messages_list?.length){let e=-1;for(let t=s.length-1;t>=0;t--)if("user"===s[t].sender){e=t;break}const a=e>=0?e+1:s.length;t=[...s.slice(0,a),...y(n.once_messages_list)]}return t.map((e,s)=>({...e,id:s+1}))}),r(),l(!0),c())},C=s=>{const n=s.context||{};if(n.session_id!==e)return;A(),h.current=null,i(s=>s===e?null:s);const a="AI request error: "+(n.message||"未知错误");S();const r=[...v].reverse().find(e=>"bot"===e.sender);r?(r.text=r.text?`${r.text}\n\n${a}`:a,r.is_loading=!1):v.push({id:_+1,sender:"bot",text:a}),o()===e&&t([...v].map((e,s)=>({...e,id:s+1}))),c()},A=()=>{p.ws.off_message(`message_${f.HK.ai_chat_msg}`,N),p.ws.off_message(`message_${f.HK.ai_chat_end}`,k),p.ws.off_message(`message_${f.HK.ai_chat_error}`,C)};p.ws.addMsg(f.HK.ai_chat_msg,N),p.ws.addMsg(f.HK.ai_chat_end,k),p.ws.addMsg(f.HK.ai_chat_error,C),p.ws.sendData(f.HK.ai_chat_req,{messages:d(n),session_id:e,sys_prompt_id:u()})},x=()=>{const e=g.current;if(0===e.length)return;const s=e.shift();if(!s)return;t(e=>e.map(e=>"user"===e.sender&&e.text.includes("⏳(排队中...)")?{...e,text:e.text.replace(" ⏳(排队中...)","")}:e));const n={id:w(),sender:"user",text:s.text,attachments:s.attachments};_(o(),n,x)};return{startChatStream:_,processPendingQueue:x,enqueueMessage:(e,s)=>{g.current.push({text:e,attachments:s})},getQueueLength:()=>g.current.length,abort:()=>{const e=o();e&&(p.ws.sendData(f.HK.ai_chat_abort,{session_id:e}),h.current&&(h.current=null,i(s=>s===e?null:s)))}}}({getMessages:()=>Ne.messages,setMessages:Ne.setMessages,setMessagesDebounced:Ae,setSending:J,getActiveSessionId:()=>je.current,setActiveSessionId:ke.setActiveSessionId,refreshSessions:ke.refreshSessions,scrollToBottom:Ne.scrollToBottom,buildRequestMessages:e=>{const s=(e.attachments??[]).filter(e=>"image"===e.kind);if(s.length>0){const t=[];e.text&&t.push({type:"text",text:e.text});for(const e of s)t.push({type:"image_url",image_url:{url:e.content}});return[{content:t,role:"user",attachments:e.attachments??[]}]}return[{content:e.text,role:"bot"===e.sender?"assistant":"user",attachments:e.attachments??[]}]},getSelectedSysPromptId:()=>ke.selectedSysPromptId,setLocalOwner:e=>{xe.current=e}}),Ie=e=>{ie(e?.ai_config?.model??"")},$e=async()=>{try{const e=await c.jV.get("public_models");e.code===d.m.Success&&le(e.data?.groups??[])}catch{le([])}},Re=e=>{const s=Array.from(e??[]).filter(Boolean);s.length&&Q(e=>[...e,...s])},Be=e=>ke.owner_of_session(e),Te=()=>{Ne.batchMode&&(Ne.setSelectedMsgIds(new Set),Z(new Set)),Ne.setBatchMode(e=>!e)};(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("ai_agent_setting/env");e.code===d.m.Success&&(pe.current=e.data,Ie(e.data)),await $e(),await ke.init_active_session();const s=await c.jV.get("system_prompts");s.code===d.m.Success&&te(s.data??[])})(),requestAnimationFrame(()=>Ne.scrollToBottom(!1)),_e.current.onCountChange=ue,_e.current.refresh?.();const e=e=>{const s=e?.context?.count;"number"==typeof s&&ue(s)};return p.ws.addMsg(f.HK.ai_bg_process_count_notify,e),()=>{p.ws.off_message(`message_${f.HK.ai_bg_process_count_notify}`,e)}},[]);const De=G===ke.activeSessionId||ke.activeSessionRunning;return(0,B.jsxs)(n.Fragment,{children:[(0,B.jsx)(X,{inline:s,currentModelName:ae,setCurrentModelName:ie,modelGroups:oe,onModelChanged:async()=>{await $e();const e=await c.XO.get("ai_agent_setting/env");e.code===d.m.Success&&(pe.current=e.data,Ie(e.data))},batchMode:Ne.batchMode,selectedMsgCount:Ne.selectedMsgIds.size,sessionVisible:!K,onToggleSessionPanel:()=>P(e=>!e),onCreateSession:ke.createSession,onBatchDeleteMessages:Ne.batchDeleteMessages,onToggleBatchMode:Te,bgProcessVisible:L,bgProcessCount:de,onToggleBgProcess:()=>z(e=>!e)}),(0,B.jsxs)("div",{className:"chat-page"+(s?" chat-page--embedded":" chat-page-with-sessions"),style:{"--ai-chat-zoom":U},children:[!K&&(0,B.jsx)("div",{className:"chat-session-overlay",onClick:()=>P(!0)}),!K&&(0,B.jsx)(se,{sessions:ke.sessions,activeSessionId:ke.activeSessionId,onSelectSession:e=>ke.loadSession(e,!1),onReorderSessions:ke.reorderSessions,onRenameSession:ke.renameSession,onDeleteSession:ke.deleteSession,onToggleCmdAuto:ke.toggleCmdAuto,onShowUsageStats:async e=>{q({open:!0,title:S("Token消耗统计"),context_div:(0,B.jsx)("div",{className:"usage-stats-loading",children:S("加载中...")}),cancel:()=>q({open:!1})});try{const s=Be(e),t=s?await ke.admin_call("usage_stats",{session_id:e,user_id:s}):await c.jV.post("session/usage_stats",{session_id:e});if(t.code===d.m.Success&&t.data){const e=t.data;q({open:!0,title:S("Token消耗统计"),context_div:(0,B.jsxs)("div",{className:"usage-stats-panel",children:[[{l:S("对话轮次"),v:(e.turns??0).toString()},{l:S("AI输入Token"),v:_(e.input_tokens)},{l:S("AI输出Token"),v:_(e.output_tokens)},{l:S("AI输入Token(最近一轮)"),v:_(e.recent_input_tokens)},{l:S("AI输出Token(最近一轮)"),v:_(e.recent_output_tokens)}].map((e,s)=>(0,B.jsxs)("div",{className:"usage-stats-row",children:[(0,B.jsx)("span",{className:"usage-stats-label",children:e.l}),(0,B.jsx)("span",{className:"usage-stats-value",children:e.v})]},s)),(0,B.jsxs)("div",{className:"usage-stats-row usage-stats-total",children:[(0,B.jsx)("span",{className:"usage-stats-label",children:S("AI Token总计消耗")}),(0,B.jsx)("span",{className:"usage-stats-value",children:_((e.input_tokens||0)+(e.output_tokens||0))})]})]}),cancel:()=>q({open:!1})})}else q({open:!0,title:S("Token消耗统计"),context_div:(0,B.jsx)("div",{className:"usage-stats-empty",children:S("暂无统计数据")}),cancel:()=>q({open:!1})})}catch{q({open:!0,title:S("Token消耗统计"),context_div:(0,B.jsx)("div",{className:"usage-stats-empty",children:S("暂无统计数据")}),cancel:()=>q({open:!1})})}},onShowSessionSetting:e=>{let s=ke.sessions.find(s=>s.id===e)?.file_cwd_path??"";q({open:!0,title:S("会话设置"),context_div:(0,B.jsxs)("div",{className:"session-setting",children:[(0,B.jsx)("div",{className:"session-setting__label",children:S("服务器工作目录")}),(0,B.jsx)(g.Sm,{value:s,placeholder:S("服务器工作目录提示"),handleInputChange:e=>{s=e}})]}),confirm:async()=>{try{const t=Be(e);(t?await ke.admin_call("setting",{session_id:e,user_id:t,file_cwd_path:s.trim()}):await c.jV.post("session/setting",{session_id:e,file_cwd_path:s.trim()})).code===d.m.Success&&(0,x.SK)(S("保存成功"))}catch{}q({open:!1}),await ke.loadSessions(ke.activeSessionId)},cancel:()=>q({open:!1})})},batchMode:Ne.batchMode,selectedSessionIds:Y,onToggleSessionSelect:e=>{Z(s=>{const t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},onToggleBatchMode:Te,onBatchDeleteSessions:()=>ke.batchDeleteSessions(Y,()=>{Z(new Set),Ne.setBatchMode(!1)}),onClearAllSessions:ke.admin_all_mode?void 0:ke.clearAllSessions,allUsersMode:ke.admin_all_mode,onToggleAllUsersMode:ke.toggleAllUsersMode,showAllUsersEntry:V,sysPromptList:ee,onChangeSysPrompt:(e,s)=>ke.changeSystemPrompt(s,e)}),(0,B.jsx)(re,{panelRef:_e}),(0,B.jsxs)("section",{className:"chat-main",children:[0===Ne.messages?.length&&(0,B.jsx)("div",{className:"chat-header",children:(0,B.jsx)("div",{children:S("ai_ask")})}),(0,B.jsx)(ne,{messages:Ne.messages,batchMode:Ne.batchMode,selectedMsgIds:Ne.selectedMsgIds,sending:De,chatContainerRef:Ne.chatContainerRef,messagesEndRef:he,onToggleMsgSelect:Ne.toggleMsgSelect,onDelete:Ne.handleDelete,onCopy:Ne.handleCopy,onCopyAll:Ne.handleCopyAll,onToggleBatchMode:Te,onBatchCopy:Ne.handleBatchCopy,onBatchDelete:Ne.batchDeleteMessages,showBatchBar:Ne.batchMode&&Ne.selectedMsgIds.size>0&&0===Y.size,t:S}),(0,B.jsx)(ce,{ref:me,onSend:async()=>{if(ke.admin_all_mode)return;const e=(me.current?.getValue()??"").trim();if(!e&&0===W.length)return;if(G===ke.activeSessionId){const s=await A(W);Me.enqueueMessage(e,s),me.current?.clear(),Q([]);const t={id:w(),sender:"user",text:e+(Me.getQueueLength()>1?" ⏳(排队中...)":""),attachments:s};return void Ne.setMessages(e=>[...e,t])}let s=ke.activeSessionId;if(!s){const t=await c.jV.post("session",{title:(e||W[0]?.name).slice(0,28),sys_prompt_id:void 0,file_cwd_path:h||void 0});if(t.code!==d.m.Success)return;s=t.data.id,ke.setActiveSessionId(s),b?.(s),await ke.loadSessions(s)}const t=await A(W),n={id:w(),sender:"user",text:e,attachments:t};me.current?.clear(),Q([]);const a=pe.current?.ai_config?.request_type||"completions";if("completions"!==a){const t={id:Ne.messages.length+2,sender:"bot",text:"处理中...",is_loading:!0},i={...n,id:Ne.messages.length+1},o=[...Ne.messages,i,t];Ne.setMessages(o),J(s);return void(await O(a,e,s,async(e,s)=>{t.text=e,t.is_loading=!1,s?.images&&(t.images=s.images),s?.audio&&(t.audio=s.audio),s?.embeddings&&(t.embeddings=s.embeddings),Ne.setMessages([...o]),J(null),ke.refreshSessions(),Ne.scrollToBottom(!0),Me.processPendingQueue()})||(t.text=`请求类型 "${a}" 的专用处理器尚未实现,请使用 completions 类型。`,t.is_loading=!1,Ne.setMessages([...o]),J(null),Me.processPendingQueue()))}Me.startChatStream(s,n,()=>Me.processPendingQueue())},readonly:ke.admin_all_mode,sending:De,onAbort:Me.abort,pendingAttachments:W,onRemoveAttachment:e=>{Q(s=>s.filter((s,t)=>t!==e))},onOpenFilePicker:()=>{ge.current?.click()},onAddFiles:Re,onDrop:e=>{const s=e.dataTransfer?.files;s&&s.length>0&&(e.preventDefault(),Re(s))},onDragOver:e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},fileInputRef:ge})]})]})]})}},72693(e,s,t){t.d(s,{w:()=>g});var n=t(96540),a=t(22022),i=t(14944),o=t(92275),c=t(34843),r=t(82893),l=t(85997),d=t(14284),u=t(74848);function m(e){const{t:s}=(0,a.Bd)(),[t,i]=(0,n.useState)(!1),o=!!e.sessionId;return(0,u.jsxs)("div",{children:[(0,u.jsx)("div",{style:{maxHeight:"60vh",overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",background:"var(--surfaceSecondary)",padding:"0.75em",borderRadius:"0.5em",marginBottom:"0.75em",fontFamily:"monospace",fontSize:"0.9em",lineHeight:"1.5"},children:e.cmd}),o&&(0,u.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5em",marginBottom:"0.75em",color:t?"var(--icon-blue)":"var(--textSecondary)"},children:[(0,u.jsx)(l.Ay,{checked:t,onChange:s=>{i(s),s&&e.onAutoAllow()},title:s("此会话不再询问")}),(0,u.jsx)("span",{children:s("此会话不再询问")})]}),(0,u.jsxs)("div",{style:{display:"flex",gap:"0.5em",justifyContent:"flex-end"},children:[(0,u.jsx)(l.$n,{text:s("拒绝"),color:"var(--red)",clickFun:e.onDeny}),(0,u.jsx)(l.$n,{text:s("允许"),clickFun:e.onAllow})]})]})}function g(){const[e,s]=(0,c.fp)(r.AG.prompt_card),{t}=(0,a.Bd)(),l=(0,n.useRef)([]),g=(0,n.useRef)(!1),h=(0,n.useRef)(null),_=(0,n.useRef)(void 0),p=(0,n.useRef)(()=>{}),f=(0,n.useCallback)(e=>{s({open:!1}),g.current=!1,h.current&&(i.ws.sendData(o.HK.ai_confirm_cmd,{askId:h.current,approved:e}),h.current=null),p.current()},[s]),x=(0,n.useCallback)(()=>{if(g.current)return;if(0===l.current.length)return g.current=!1,void s({open:!1});g.current=!0;const e=l.current.shift();e?(h.current=e.askId,_.current=e.session_id,s({open:!0,title:t("命令确认"),cancel:()=>f(!1),context_div:(0,u.jsx)(m,{cmd:e.cmd,sessionId:e.session_id,onDeny:()=>f(!1),onAllow:()=>f(!0),onAutoAllow:async()=>{if(_.current)try{await d.jV.post("session/cmd_auto_allow",{session_id:_.current,allow:!0})}catch(e){console.error("设置会话命令免确认失败",e)}f(!0)}})})):g.current=!1},[t,f,s]);p.current=x;const v=(0,n.useCallback)(e=>{l.current.push(e),x()},[x]);(0,n.useEffect)(()=>{const e=e=>{const t=e.context||{};if(t.dismiss&&t.askId)return l.current=l.current.filter(e=>e.askId!==t.askId),void(g.current&&h.current===t.askId&&(h.current=null,g.current=!1,s({open:!1}),x()));t.askId&&t.cmd&&v({askId:t.askId,cmd:t.cmd,session_id:t.session_id})};return i.ws.addMsg(o.HK.ai_confirm_cmd,e),()=>{i.ws.off_message(`message_${o.HK.ai_confirm_cmd}`,e)}},[v]),(0,n.useEffect)(()=>()=>{l.current=[],g.current=!1,h.current=null},[])}},34299(e,s,t){t.r(s),t.d(s,{default:()=>y});var n=t(96540),a=t(23802),i=t(53995),o=t(18569),c=t(77979),r=t(8263),l=t(69428),d=t.n(l),u=(t(3775),t(21499)),m=t(99214),g=t(89117),h=t(86063),_=t(89334),p=t(41105),f=t(52388),x=t(19878),v=(t(72411),t(74848));const j=new a.A({html:!0,highlight:function(e,s){if(s&&x.A.getLanguage(s))try{return`<pre class="hljs code-block-with-copy"><code class="hljs language-${s}">${x.A.highlight(e,{language:s}).value}</code></pre>`}catch(e){}try{return`<pre class="hljs code-block-with-copy"><code class="hljs">${x.A.highlightAuto(e).value}</code></pre>`}catch(e){}return`<pre class="hljs code-block-with-copy"><code>${j.utils.escapeHtml(e)}</code></pre>`}});async function b(e,s){e.className="md-graph md-graph--mind md-graph--loading",e.textContent=f.A.t("rendering");const t=await(0,h.Hn)(s);e.isConnected&&(e.className="md-graph md-graph--mind",e.textContent="",await t.mount(e))}function w(e){const s=e.className.match(/language-([\w-]+)/);return s?s[1]:""}function y(e){const s=(0,n.useRef)(null);return(0,m.VD)(),(0,n.useEffect)(()=>{s.current&&(s.current.innerHTML=j.render(e.context??""),async function(e){const s=e.querySelectorAll("pre > code[class*='language-']");for(const e of Array.from(s)){const s=w(e),t=(0,g.Hm)(s),n=(0,h.hj)(s);if(!t&&!n)continue;const a=e.closest(".code-block-with-copy")??e.parentElement;if(!a)continue;const i=e.textContent??"",o=document.createElement("div");if(a.replaceWith(o),n){try{await b(o,i)}catch(e){console.error("[mind] render failed",e),o.className="md-graph md-graph--mind",o.textContent=String(e)}continue}o.className="md-graph md-graph--loading",o.textContent=f.A.t("rendering");const c=await(0,g.U6)(s,i);o.isConnected&&(c.error?(o.className="md-graph md-graph--error",o.textContent=c.error):(o.className="md-graph",o.innerHTML=c.svg))}}(s.current),(0,_.rg)(s.current))},[e.context]),(0,v.jsx)("div",{ref:s})}j.use(i.A).use(o.A).use(c.A).use(r.A).use(d()).use(e=>{e.renderer.rules.fence;e.renderer.rules.fence=(s,t,n,a,i)=>{const o=s[t],c=o.content.trim(),r=o.info.trim();let l="";if(r&&x.A.getLanguage(r))try{l=x.A.highlight(c,{language:r}).value}catch(s){l=e.utils.escapeHtml(c)}else try{l=x.A.highlightAuto(c).value}catch(s){l=e.utils.escapeHtml(c)}return`\n <div class="code-block-with-copy">\n <div class="code-header">\n <span class="code-language">${r||"code"}</span>\n <button class="copy-btn" data-code="${e.utils.escapeHtml(c)}">复制</button>\n </div>\n <pre><code class="hljs ${r?`language-${r}`:""}">${l}</code></pre>\n </div>`}}).use(e=>{const s=e.renderer.rules.link_open||function(e,s,t,n,a){return a.renderToken(e,s,t)};e.renderer.rules.link_open=(e,t,n,a,i)=>{const o=e[t],c=o.attrIndex("href");if(c>=0){const e=o.attrs[c][1];o.attrs[c][1]=(0,u.bi)(window.location.href,e)}return s(e,t,n,a,i)}}),(0,_.Rh)(j,p.pC)},84369(e,s,t){t.d(s,{y:()=>o});var n=t(96540),a=t(2543);function i(e){if(void 0!==e)return"function"==typeof e?e():e}function o(e){const{direction:s="vertical",target_ref:t,get_start_size:o,px_to_unit:c,min:r,max:l,throttle:d,on_change:u,on_drag_end:m}=e,[g,h]=(0,n.useState)(!1),_=(0,n.useRef)(null),p=(0,n.useRef)(u);p.current=u;const f=e=>"vertical"===s?e.clientY:e.clientX,x=(0,n.useRef)({direction:s,get_start_size:o,px_to_unit:c,min:r,max:l,get_pos:f});x.current={direction:s,get_start_size:o,px_to_unit:c,min:r,max:l,get_pos:f};const v=(0,n.useCallback)(e=>{const s=_.current;if(!s)return;const{px_to_unit:t,min:n,max:a,get_pos:o}=x.current,c=s.pos-o(e);let r=s.size+t(c);const l=i(n),d=i(a);void 0!==l&&(r=Math.max(l,r)),void 0!==d&&(r=Math.min(d,r)),p.current(r)},[]),j=n.useMemo(()=>void 0===d?v:a.throttle(e=>v(e),d),[d,v]),b=(0,n.useCallback)(()=>{_.current=null,h(!1);const e=j;"function"==typeof e.cancel&&e.cancel(),m?.()},[j,m]),w=(0,n.useCallback)(e=>{const{get_start_size:s,get_pos:t}=x.current;_.current={pos:t(e),size:s()},h(!0)},[]);return(0,n.useEffect)(()=>{if(!g)return;const e=t?.current??window;return e.addEventListener("pointermove",j),e.addEventListener("pointerup",b),()=>{e.removeEventListener("pointermove",j),e.removeEventListener("pointerup",b)}},[g,j,b,t]),(0,n.useEffect)(()=>{const e=j;return()=>{"function"==typeof e.cancel&&e.cancel()}},[j]),{dragging:g,on_pointer_down:w,on_pointer_up:b}}},60840(e){e.exports="data:image/svg+xml,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27 version=%271.1%27 aria-hidden=%27true%27><path fill-rule=%27evenodd%27 d=%27M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z%27></path></svg>"}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[676,4091,8319],{77481(e,t,n){n.d(t,{S:()=>l,X:()=>i});var s=n(96540),r=n(61443),a=n(74848);function i(e){const[t,n]=s.useState([]),i=(0,s.useRef)(-1),[l,c]=(0,s.useState)(-1),[o,u]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const d=()=>{i.current=-1,c(-1),u(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((t,n)=>{const s=!!e.filter&&(e.filter.column??0)===n;let i=t;if(s){const n=e.filter,s=n.options.find(e=>e.value===n.value);null!=n.value&&s&&(i=`${t} (${s.label})`)}return(0,a.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,a.jsx)(r.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:i}):t},n)})})}),(0,a.jsx)("tbody",{children:t.map((t,n)=>{const s=!!e.onRowDrag;return(0,a.jsx)("tr",{className:s?(l===n?"row-dragging":"")+(o===n?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{s&&(i.current=n,c(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||i.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",u(n))},onDrop:t=>{s&&(t.preventDefault(),(()=>{const t=i.current,n=o;d(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:d,children:t.map((n,s)=>{const r=s===t.length-1?"small":"";return(0,a.jsx)("td",{className:r,style:{width:e.width??"auto"},children:n},s)})},n)})})]})}function l(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,a.jsx)("div",{children:e},t))})}},48890(e,t,n){n.d(t,{Kw:()=>s,Tt:()=>r});var s=n(80952),r=(n(82327),n(1766),n(24854),n(90008),n(90846),n(40975),n(44286),n(30766),n(14973),n(69687),n(1234),n(47507),n(87268),n(34678),n(24522));const a=`https://gcore.jsdelivr.net/npm/ace-builds@${s.version}/src-min-noconflict/`;s.config.set("basePath",a),s.config.set("modePath",a),s.config.set("themePath",a),s.config.set("workerPath",a)},84091(e,t,n){n.r(t),n.d(t,{default:()=>d});var s=n(96540),r=(n(80952),n(48890)),a=n(34843),i=n(82893),l=n(78247),c=n(93245),o=n(23430),u=n(74848);function d(e){const t=(0,s.useRef)(null),[n,d]=(0,a.fp)(i.AG.user_base_info),[f,p]=(0,s.useState)(!1),h=(0,s.useRef)(f);h.current=f;const _=(0,s.useRef)(e.save);_.current=e.save;const x=(0,s.useRef)(e.on_dirty);x.current=e.on_dirty,(0,s.useEffect)(()=>{x.current?.(f)},[f]);const m=async e=>{if(!_.current||!h.current)return;!1!==await _.current(e)&&p(!1)},v=(0,s.useRef)(m);v.current=m;const g=(0,s.useRef)(e.register);g.current=e.register,(0,s.useEffect)(()=>{g.current?.({save:e=>v.current(e)})},[]),(0,c.a)(o.nE.ace,()=>!!_.current&&h.current,m);const j=n.user_data.theme?.includes("dark")?"cloud_editor_dark":"cloud9_day";return(0,s.useEffect)(()=>{const n=r.Kw.edit(t.current,{value:l.xK.get_value_temp(e.editor_id),showPrintMargin:!1,theme:`ace/theme/${j}`,mode:e.model??r.Tt.getModeForPath(e.name??"").mode,wrap:!1,highlightActiveLine:!1,fontSize:14,...e.options});return n.setOptions({}),n.container.addEventListener("wheel",function(e){e.preventDefault()}),n.focus(),n.on("change",function(t){p(!0),e.on_change&&e.on_change()}),t.current=n,n.formatCode=()=>{const e=r.Kw.require("ace/ext/beautify"),n=t.current;n&&e.beautify(n.session)},l.xK.set_editor_temp(n,e.editor_id),()=>{l.xK.delete_editor_temp(e.editor_id),n.destroy()}},[]),(0,u.jsx)("div",{ref:t,style:{height:"100%",width:"100%"}})}},60676(e,t,n){n.r(t),n.d(t,{default:()=>C});var s=n(96540),r=n(57952),a=n(85997),i=n(14284),l=n(61973),c=n(77481),o=n(70447),u=n(34843),d=n(82893),f=n(84091),p=n(78247),h=n(61443),_=n(23496),x=n(62042),m=n(22022),v=n(53459),g=n(7523),j=n(74848);function b(e,t="auto"){return"s"===t||"auto"===t&&e>=1e3?`${(e/1e3).toFixed(2)} s`:`${Math.round(e)} ms`}function S(e){const{running:t=!1,resetKey:n=0,format:r="auto",prefix:a="",onTick:i,className:l}=e,[c,o]=(0,s.useState)(0),u=(0,s.useRef)(0),d=(0,s.useRef)(null),f=(0,s.useRef)(t);f.current=t;const p=(0,s.useCallback)(()=>{null!==d.current&&(cancelAnimationFrame(d.current),d.current=null)},[]),h=(0,s.useCallback)(()=>{p();const e=()=>{const t=performance.now()-u.current;o(t),i?.(t),f.current&&(d.current=requestAnimationFrame(e))};e()},[i,p]);return(0,s.useEffect)(()=>{u.current=performance.now(),o(0),i?.(0),f.current&&h()},[n]),(0,s.useEffect)(()=>{t?h():p()},[t,h,p]),(0,s.useEffect)(()=>()=>p(),[p]),(0,j.jsxs)("span",{className:l,children:[a,b(c,r)]})}var w=n(87361),q=n(28319);function y(e){const[t,n]=(0,s.useState)("");return(0,j.jsxs)("div",{className:"db-query-preset-input",children:[(0,j.jsx)(h.Sm,{placeholder:e.placeholder,value:t,handleInputChange:n}),(0,j.jsx)("div",{className:"db-query-preset-input__actions",children:(0,j.jsx)(a.C3,{text:e.confirmText,clickFun:()=>e.onConfirm(t.trim())})})]})}function C(){const e=(0,l.Zp)(),{t}=(0,m.Bd)(),{initUserInfo:n}=(0,s.useContext)(g.F),[b]=(0,u.fp)(d.AG.sqlite_query_context),[C]=(0,u.fp)(d.AG.user_base_info),[,E]=(0,u.fp)(d.AG.prompt_card),k=(0,s.useMemo)(()=>b?.path??"",[b?.path]),N=(0,s.useMemo)(()=>b?.path?`${b?.name||"数据库"} | ${b.path}`:"未选择数据库",[b?.name,b?.path]),A=97,[R,K]=(0,s.useState)(""),[F,L]=(0,s.useState)("table"),[$,M]=(0,s.useState)(!1),[T,O]=(0,s.useState)(""),[Q,D]=(0,s.useState)(null),[P,I]=(0,s.useState)(!1),[G,J]=(0,s.useState)(0),[Z,W]=(0,s.useState)(!1),[B,H]=(0,s.useState)([]),[V,X]=(0,s.useState)(-1);(0,s.useEffect)(()=>{const e=C?.user_data?.sql_preset_list;e&&e.length?H([...e]):H([{index:0,note:t("查询全部表"),sql:"SELECT name, type FROM sqlite_master WHERE type='table';"}])},[C?.user_data?.sql_preset_list]);const U=async e=>{const t=e.map((e,t)=>({...e,index:t})),s=await i.wm.post(_.s.user_save_private_attr,{is_sql_preset:!0,sql_preset_list:t});return s?.code===v.m.Success&&(await n(),H(t),!0)},z=async(e,n)=>{const s=[...B,{note:n||t("SQL 预设"),sql:e,env:q.sqlEnvDefault}];await U(s)&&(E({open:!1}),(0,x.SK)(t("创建成功")),X(s.length-1))},Y=(e,t)=>{if(!e)return"";for(const n of e.split("\n")){const e=n.indexOf("=");if(!(e<0)&&n.slice(0,e).trim()===t)return n.slice(e+1).trim()}return""},[ee,te]=(0,s.useState)(""),[ne,se]=(0,s.useState)("");(0,s.useEffect)(()=>{p.xK.set_value_temp(R,A)},[R]),(0,s.useEffect)(()=>{K(""),O(""),D(null),L("table"),I(!1),W(!1),J(0),te(""),se(""),p.xK.set_value_temp("",A),k||O("请先从文件右键打开一个数据库")},[k,b?.open]);const re=async()=>{const e=(p.xK.get_editor_value(A)??R).trim();if(!k)return O("请先从文件右键打开一个数据库"),void D(null);if(!e)return O("请输入 SQL 语句"),void D(null);M(!0),O(""),W(!0),J(e=>e+1),I(!0);try{const n=(t=e,ee?t.split(ee).join(ne):t),s=await i.$M.post("sqlite/query",{path:k,sql:n});D(s.data),L("table")}catch(e){O(e?.message??`${e}`),D(null)}finally{I(!1),M(!1)}var t},ae=Q?.columns?.length?Q.columns:Object.keys(Q?.rows?.[0]??{}),ie=(Q?.rows??[]).map(e=>ae.map(t=>{return null==(n=e[t])?"":"object"==typeof n?JSON.stringify(n):`${n}`;var n}));return(0,j.jsxs)("div",{className:"db-query-page",children:[(0,j.jsx)(r.A,{ignore_tags:!0,left_children:[(0,j.jsx)(a.rA,{icon:"arrow_back",title:"返回",onClick:()=>e(-1)},"back"),(0,j.jsx)(a.rA,{icon:"play_arrow",title:"执行",onClick:re},"run"),(0,j.jsx)(a.rA,{icon:"table_chart",title:"表格视图",onClick:()=>L("table")},"table"),(0,j.jsx)(a.rA,{icon:"data_object",title:"原 JSON",onClick:()=>L("json")},"json"),(0,j.jsx)(a.rA,{icon:"settings",title:t("SQL预设设置"),onClick:()=>{e(w.o.sql_preset_setting_page)}},"preset-setting")],children:(0,j.jsx)(o.xP,{context:N,tip_context:"点击复制数据库信息"})}),(0,j.jsxs)("div",{className:"db-query-page__content",children:[(0,j.jsxs)(o.Zp,{title:"SQL 查询",rightTopCom:(0,j.jsxs)("div",{className:"db-query-page__preset-bar",children:[ee&&(0,j.jsx)(h.Sm,{placeholder:`${t("替换")}: ${ee}`,value:ne,handleInputChange:se,width:"12rem"}),B.length>0&&(0,j.jsx)(h.l6,{width:"16rem",tip:t("SQL预设"),value:V,onChange:e=>{const t=B[e];t&&(X(e),(e=>{p.xK.set_value_temp(e,A);const t=p.xK.get_editor(A);t&&t.setValue(e,-1),K(e)})(t.sql),te(Y(t.env??"","find")),se(""),O(""))},options:B.map((e,t)=>({value:t,title:`${e.note||e.sql.slice(0,24)}`}))}),(0,j.jsx)(a.C3,{text:t(V>=0?"更新保存":"创建新预选项"),clickFun:async()=>{const e=(p.xK.get_editor_value(A)??R).trim();if(!e)return void O(t("sql_in"));const n=[...B];if(V>=0&&n[V]){n[V].sql=e,n[V].note||(n[V].note=t("SQL 预设"));await U(n)&&(0,x.SK)(t("更新成功"))}else E({open:!0,title:t("创建新预选项"),context_div:(0,j.jsx)(y,{placeholder:t("请输入备注"),confirmText:t("确认"),onConfirm:t=>z(e,t)}),cancel:()=>E({open:!1})})}})]}),rightBottomCom:(0,j.jsxs)("div",{className:"db-query-page__actions",children:[(0,j.jsx)(a.C3,{text:$?"查询中...":"执行查询",clickFun:re}),(0,j.jsx)(a.C3,{text:"清空",clickFun:()=>{p.xK.set_value_temp("",A);const e=p.xK.get_editor(A);e&&e.setValue("",-1),K("")}}),(0,j.jsx)(a.C3,{text:"table"===F?"表格视图":"切换到表格",clickFun:()=>L("table")}),(0,j.jsx)(a.C3,{text:"json"===F?"原 JSON":"切换到 JSON",clickFun:()=>L("json")})]}),children:[(0,j.jsx)("div",{className:"db-query-page__editor",children:(0,j.jsx)(f.default,{name:"sqlite.sql",editor_id:A,model:"ace/mode/sql",on_change:()=>{const e=p.xK.get_editor_value(A)??"";K(e)},options:{showPrintMargin:!1,highlightActiveLine:!0,wrap:!0}})}),T&&(0,j.jsx)("div",{className:"db-query-page__error",children:T})]}),(0,j.jsxs)(o.Zp,{title:"查询结果",rightTopCom:(0,j.jsxs)("span",{className:"db-query-page__result-meta",children:[Q?`${Q.row_count} 行`:"暂无结果",Z&&(0,j.jsx)("span",{className:"db-query-page__elapsed",children:(0,j.jsx)(S,{running:P,resetKey:G,prefix:`${t("耗时")}: `,format:"auto"})})]}),children:[Q&&"table"===F&&(0,j.jsx)(c.X,{headers:ae,rows:ie}),Q&&"json"===F&&(0,j.jsx)("pre",{className:"db-query-page__result-json",children:JSON.stringify(Q.rows,null,2)}),!Q&&!T&&(0,j.jsx)("div",{className:"db-query-page__hint",children:"先输入查询语句,再执行。支持 `select`、`with`、`pragma`、`explain`。"}),!Q&&T&&(0,j.jsx)("div",{className:"db-query-page__hint",children:T})]})]})]})}},28319(e,t,n){n.r(t),n.d(t,{default:()=>S,defaultSqlPreset:()=>j});var s=n(96540),r=n(22022),a=n(4412),i=n(85997),l=n(75725),c=n(77481),o=n(70447),u=n(61443),d=n(34843),f=n(82893),p=n(14284),h=n(23496),_=n(53459),x=(n(62042),n(7523)),m=n(78247),v=n(61973),g=n(74848);function j(e){return{index:0,note:e("查询全部表"),sql:"SELECT name, type FROM sqlite_master WHERE type='table';"}}const b='# 可选:设置 SQL 中的"替换词"(在查询页选中该预设后,会显示输入框)\n# 例子:SQL 为 SELECT * FROM t WHERE id = 123456 ,请填写下面的 find=123456\n# 这样查询页输入新值即可把 SQL 中的 123456 替换掉后再查询\nfind=';function S(){const{t:e}=(0,r.Bd)(),{initUserInfo:t}=(0,s.useContext)(x.F),[,n]=(0,d.fp)(f.AG.editorSetting),[S]=(0,d.fp)(f.AG.user_base_info),w=(0,v.Zp)(),q=s.useRef(-1),[y,C]=(0,s.useState)([]);(0,s.useEffect)(()=>{const t=S?.user_data?.sql_preset_list;C(t?.length?[...t]:[j(e)])},[e,S?.user_data?.sql_preset_list]);const E=async()=>{const e=y.map((e,t)=>({...e,index:t})),n=await p.wm.post(h.s.user_save_private_attr,{is_sql_preset:!0,sql_preset_list:e});n?.code===_.m.Success&&await t()},k=(e,t)=>{q.current=e;const s=y[e][t]??"";m.xK.set_value_temp(s),n({model:"sql"===t?"ace/mode/sql":"ace/mode/ini",open:!0,fileName:"",save:async e=>{y[q.current][t]=e,C([...y]),m.xK.set_value_temp(""),E()}})},N=[e("编号"),e("备注"),e("SQL代码"),e("env编辑"),e("操作")];return(0,g.jsxs)("div",{children:[(0,g.jsx)(a.aZ,{position:"right",children:(0,g.jsx)(i.rA,{icon:"arrow_back",title:e("返回"),onClick:()=>w(-1)})}),(0,g.jsx)(l.jW,{isFull:!0,more:!0,children:(0,g.jsx)(l.NN,{children:(0,g.jsx)(l.xh,{children:(0,g.jsx)(l.fI,{children:(0,g.jsx)(l.VP,{widthPer:60,children:(0,g.jsx)(o.uF,{self_title:(0,g.jsx)("span",{className:"div-row",children:(0,g.jsx)("h2",{children:e("SQL 预设")})}),rightTopCom:(0,g.jsxs)("div",{className:"db-query-setting__toolbar",children:[(0,g.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>C([...y,{note:"",sql:"",env:b}])}),(0,g.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:()=>E()})]}),children:(0,g.jsx)(c.X,{headers:N,rows:y.map((t,n)=>[(0,g.jsx)("div",{children:n+1}),(0,g.jsx)(u.Sm,{value:t.note,no_border:!0,placeholder:e("备注"),handleInputChange:e=>{t.note=e,C([...y])}}),(0,g.jsx)("div",{children:(0,g.jsx)(i.rA,{icon:"short_text",title:e("编辑SQL"),onClick:()=>k(n,"sql")})}),(0,g.jsx)("div",{children:(0,g.jsx)(i.rA,{icon:"settings",title:e("env编辑"),onClick:()=>k(n,"env")})}),(0,g.jsx)("div",{children:(0,g.jsx)(i.rA,{icon:"delete",title:e("删除"),onClick:()=>{y.splice(n,1),C([...y])}})})]),width:"8rem"})})})})})})})]})}n.d(t,["sqlEnvDefault",0,b])},93245(e,t,n){n.d(t,{a:()=>c});var s=n(96540),r=n(34843),a=n(82893),i=n(23430);const l=[{id:i.nE.ace,label:"文本编辑器(ace)"},{id:i.nE.md,label:"md编辑器"},{id:i.nE.mind,label:"思维导图编辑器"},{id:i.nE.draw,label:"draw编辑器"},{id:i.nE.timeline,label:"时间线编辑器"},{id:i.nE.image,label:"图片编辑器"},{id:i.nE.excel,label:"excel编辑器"}];function c(e,t,n,i=!1){const[l]=(0,r.fp)(a.AG.user_base_info),c=l?.user_data?.editor_auto_save,o=(0,s.useRef)(c);o.current=c;const u=(0,s.useRef)(t);u.current=t;const d=(0,s.useRef)(n);d.current=n,(0,s.useEffect)(()=>{if(i)return;const t=o.current;if(!t?.enable||t.interval<=0||!t.editors?.includes(e))return;const n=setInterval(()=>{u.current()&&d.current(!0)},1e3*t.interval);return()=>clearInterval(n)},[c,e,i])}n.d(t,["d",0,l])}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4091,7181],{48890(e,t,n){n.d(t,{Kw:()=>r,Tt:()=>i});var r=n(80952),i=(n(82327),n(1766),n(24854),n(90008),n(90846),n(40975),n(44286),n(30766),n(14973),n(69687),n(1234),n(47507),n(87268),n(34678),n(24522));const c=`https://gcore.jsdelivr.net/npm/ace-builds@${r.version}/src-min-noconflict/`;r.config.set("basePath",c),r.config.set("modePath",c),r.config.set("themePath",c),r.config.set("workerPath",c)},84091(e,t,n){n.r(t),n.d(t,{default:()=>d});var r=n(96540),i=(n(80952),n(48890)),c=n(34843),s=n(82893),a=n(78247),o=n(93245),u=n(23430),l=n(74848);function d(e){const t=(0,r.useRef)(null),[n,d]=(0,c.fp)(s.AG.user_base_info),[f,_]=(0,r.useState)(!1),m=(0,r.useRef)(f);m.current=f;const h=(0,r.useRef)(e.save);h.current=e.save;const v=(0,r.useRef)(e.on_dirty);v.current=e.on_dirty,(0,r.useEffect)(()=>{v.current?.(f)},[f]);const p=async e=>{if(!h.current||!m.current)return;!1!==await h.current(e)&&_(!1)},g=(0,r.useRef)(p);g.current=p;const x=(0,r.useRef)(e.register);x.current=e.register,(0,r.useEffect)(()=>{x.current?.({save:e=>g.current(e)})},[]),(0,o.a)(u.nE.ace,()=>!!h.current&&m.current,p);const w=n.user_data.theme?.includes("dark")?"cloud_editor_dark":"cloud9_day";return(0,r.useEffect)(()=>{const n=i.Kw.edit(t.current,{value:a.xK.get_value_temp(e.editor_id),showPrintMargin:!1,theme:`ace/theme/${w}`,mode:e.model??i.Tt.getModeForPath(e.name??"").mode,wrap:!1,highlightActiveLine:!1,fontSize:14,...e.options});return n.setOptions({}),n.container.addEventListener("wheel",function(e){e.preventDefault()}),n.focus(),n.on("change",function(t){_(!0),e.on_change&&e.on_change()}),t.current=n,n.formatCode=()=>{const e=i.Kw.require("ace/ext/beautify"),n=t.current;n&&e.beautify(n.session)},a.xK.set_editor_temp(n,e.editor_id),()=>{a.xK.delete_editor_temp(e.editor_id),n.destroy()}},[]),(0,l.jsx)("div",{ref:t,style:{height:"100%",width:"100%"}})}},57181(e,t,n){n.r(t),n.d(t,{default:()=>h});var r=n(96540),i=n(85997),c=n(57952),s=n(34843),a=n(82893),o=n(78247),u=(n(62042),n(84091)),l=n(34289),d=n(34251),f=n(93245),_=n(23430),m=n(74848);function h(){const[e,t]=(0,s.fp)(a.AG.editorSetting),[n,h]=(0,r.useState)(!1),v=(0,r.useRef)(n);v.current=n;const[p,g]=(0,s.fp)(a.AG.fileShellShow),[x,w]=(0,s.fp)(a.AG.file_shell_hidden);async function E(){e.save&&n&&(await e.save(o.xK.get_editor_value()),o.xK.set_value_temp(""),h(!1))}const b=t=>{(t.ctrlKey||t.metaKey)&&"s"===t.key&&(t.preventDefault(),e.save&&n&&E())};return(0,r.useEffect)(()=>()=>{h(!1)},[e]),(0,r.useEffect)(()=>(document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b)}),[n,e]),(0,f.a)(_.nE.ace,()=>!!e.save&&v.current,()=>E(),e.not_auto_save),e.open&&(0,m.jsxs)("div",{id:"editor-container",children:[(0,m.jsxs)(c.A,{ignore_tags:!0,left_children:[(0,m.jsx)(i.rA,{title:"取消",icon:"close",onClick:function(){o.xK.set_value_temp(""),t({open:!1,model:"",fileName:"",save:null}),e?.close?.()}},1),(0,m.jsx)("div",{children:e.fileName},2)],children:[e.menu_list&&e.menu_list,(e.can_format||(0,d.zr)(e.fileName))&&(0,m.jsx)(i.rA,{title:"格式化",icon:"data_object",onClick:function(){o.xK.get_editor()?.formatCode()}}),e.opt_shell&&(0,m.jsx)(i.rA,{icon:"terminal",title:"shell",onClick:function(){p.show?w(!x):g({show:!0,path:(0,l.GG)("file",(0,l.vX)())})}}),n&&(0,m.jsx)(i.rA,{title:"保存",icon:"save",onClick:E}),(0,m.jsx)("title",{children:e.fileName})]}),(0,m.jsx)(u.default,{name:e.fileName,model:e.model,on_change:function(){n||h(!0)}})]})}},93245(e,t,n){n.d(t,{a:()=>o});var r=n(96540),i=n(34843),c=n(82893),s=n(23430);const a=[{id:s.nE.ace,label:"文本编辑器(ace)"},{id:s.nE.md,label:"md编辑器"},{id:s.nE.mind,label:"思维导图编辑器"},{id:s.nE.draw,label:"draw编辑器"},{id:s.nE.timeline,label:"时间线编辑器"},{id:s.nE.image,label:"图片编辑器"},{id:s.nE.excel,label:"excel编辑器"}];function o(e,t,n,s=!1){const[a]=(0,i.fp)(c.AG.user_base_info),o=a?.user_data?.editor_auto_save,u=(0,r.useRef)(o);u.current=o;const l=(0,r.useRef)(t);l.current=t;const d=(0,r.useRef)(n);d.current=n,(0,r.useEffect)(()=>{if(s)return;const t=u.current;if(!t?.enable||t.interval<=0||!t.editors?.includes(e))return;const n=setInterval(()=>{l.current()&&d.current(!0)},1e3*t.interval);return()=>clearInterval(n)},[o,e,s])}n.d(t,["d",0,a])}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[735,6404,8277],{87943(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>_});var a=n(96540),r=n(34843),l=n(82893),o=n(14284),i=n(62042),c=n(53459),d=n(34289),s=n(22022),u=n(35304),m=n(93245),f=n(23430),p=n(45907),b=n(74848);function _(){const[e,t]=(0,r.fp)(l.AG.mind_editor),[n,_]=(0,a.useState)(!1),{t:E}=(0,s.Bd)(),h=(0,p.y)(),N=(0,a.useRef)(null),v=void 0!==e.code_source,g=()=>{t({}),e?.close?.()},x=()=>{n?h({sub_title:E("有未保存的修改,确定要关闭吗?"),confirm_fun:g}):g()},C=async(e=!1)=>{await(N.current?.save(e))},y=(0,a.useRef)(n);return y.current=n,(0,m.a)(f.nE.mind,()=>!v&&y.current,e=>C(e),v),(0,a.useEffect)(()=>{if(void 0===e.url&&void 0===e.code_source)return;const t=e=>{"Escape"===e.key&&(e.stopPropagation(),x())};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e.url,e.code_source,n]),void 0!==e.url||v?(0,b.jsx)("div",{id:"mind-container",className:v?"mind-container--over":void 0,children:(0,b.jsx)("div",{className:"mind-context",children:(0,b.jsx)(u.default,{fullscreen:!0,reset_key:e.url??e.name,url:v?void 0:e.url,data:v?e.code_source:void 0,on_dirty:_,register:e=>{N.current=e},header:(0,b.jsxs)("div",{className:"mind-topbar",children:[(0,b.jsx)("span",{className:"material-icons mind-topbar__icon",children:"account_tree"}),(0,b.jsx)("span",{className:"mind-topbar__name",children:e.name}),(0,b.jsx)("span",{style:{flex:1}}),(0,b.jsx)("button",{type:"button",className:"mind-btn",title:E("保存")+" (Ctrl+S)",onClick:C,children:(0,b.jsx)("span",{className:"material-icons",children:"save"})}),(0,b.jsx)("button",{type:"button",className:"mind-btn",title:E("关闭"),onClick:x,children:(0,b.jsx)("span",{className:"material-icons",children:"close"})})]}),on_save:async(n,a)=>{if(v)return e.on_save_code?.(n),a||(0,i.SK)(E("保存成功")),t({}),!0;return(await o.$M.post(`save/${encodeURIComponent((0,d.GG)("file",(0,d.vX)()))}${e.name}`,{context:n})).code===c.m.Success&&(a||(0,i.SK)(E("保存成功")),!0)}})})}):null}},35304(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>C});var a=n(96540),r=n(57889),l=(n(14284),n(62042)),o=n(22022),i=n(45602),c=(n(88781),n(86063));const d={classic:{backgroundColor:"#fafafa",lineColor:"#4d8f7f",lineWidth:2,root:{fillColor:"#4d8f7f",color:"#fff",borderRadius:6,paddingX:18,paddingY:8},second:{fillColor:"#fff",color:"#2f4f47",borderRadius:5,borderColor:"#4d8f7f",borderWidth:1,paddingX:14,paddingY:6},node:{fillColor:"#fff",color:"#3c3c3c",borderRadius:5,borderColor:"#a8d5c8",borderWidth:1,paddingX:12,paddingY:5}},dark:{backgroundColor:"#1f2226",lineColor:"#6b7c8c",lineWidth:1,root:{fillColor:"#3a4654",color:"#f2f4f6",borderRadius:6,paddingX:18,paddingY:8},second:{fillColor:"#2b323a",color:"#e6eaef",borderRadius:5,borderColor:"#4c5866",borderWidth:1,paddingX:14,paddingY:6},node:{fillColor:"#242a31",color:"#ccd3da",borderRadius:5,borderColor:"#3c454f",borderWidth:1,paddingX:12,paddingY:5}},simple:{backgroundColor:"#fff",lineColor:"#c8ccd0",lineWidth:1,root:{fillColor:"transparent",color:"#202124",borderRadius:0,borderWidth:0,paddingX:10,paddingY:4},second:{fillColor:"transparent",color:"#202124",borderRadius:0,borderWidth:0,paddingX:8,paddingY:3},node:{fillColor:"transparent",color:"#5f6368",borderRadius:0,borderWidth:0,paddingX:8,paddingY:3}},colorful:{backgroundColor:"#fffdf6",lineColor:"#f2a65a",lineWidth:2,root:{fillColor:"#f2854a",color:"#fff",borderRadius:24,paddingX:20,paddingY:9},second:{fillColor:"#ffd66b",color:"#6b4a12",borderRadius:16,borderWidth:0,paddingX:14,paddingY:6},node:{fillColor:"#a8d8ea",color:"#1e3f4d",borderRadius:12,borderWidth:0,paddingX:12,paddingY:5}}};var s=n(34843),u=n(82893),m=n(61443),f=n(74848);function p(e){const[t,n]=(0,a.useState)(e.initValue||""),r=t=>{n(t),e.onChange(t)};return e.multiline?(0,f.jsx)("div",{className:"prompt-input",children:(0,f.jsx)(m.Z2,{placeholder:e.placeholder||"",rows:e.rows??5,value:t,handleInputChange:r})}):(0,f.jsx)("div",{className:"prompt-input",children:(0,f.jsx)(m.Sm,{placeholder:e.placeholder||"",value:t,handleInputChange:r})})}var b,_=n(75725),E=n(85997);n(30576);b=i.default,Object.entries(d).forEach(([e,t])=>{b.defineTheme?.(e,t)});const h=[{cmd:"INSERT_CHILD_NODE",icon:"account_tree",label:"添加子节点"},{cmd:"INSERT_NODE",icon:"subdirectory_arrow_right",label:"添加同级节点"},{cmd:"INSERT_PARENT_NODE",icon:"arrow_upward",label:"插入父节点"},{cmd:"CUT_NODE",icon:"content_cut",label:"剪切"},{cmd:"PASTE_NODE",icon:"content_paste",label:"粘贴"},{cmd:"REMOVE_NODE",icon:"delete",label:"删除节点"},{cmd:"INSERT_GROUP",icon:"add_circle_outline",label:"插入",children:[{cmd:"SET_NODE_ICON",icon:"emoji_emotions",label:"插入图标"},{cmd:"REMOVE_NODE_ICON",icon:"format_clear",label:"删除图标"},{cmd:"SET_NODE_NOTE",icon:"sticky_note_2",label:"节点备注"},{cmd:"REMOVE_NODE_NOTE",icon:"speaker_notes_off",label:"删除备注"},{cmd:"SET_NODE_TAG",icon:"sell",label:"节点标签"},{cmd:"REMOVE_NODE_TAG",icon:"label_off",label:"删除标签"},{cmd:"SET_NODE_HYPERLINK",icon:"link",label:"插入超链接"},{cmd:"REMOVE_NODE_HYPERLINK",icon:"link_off",label:"删除超链接"}]},{cmd:"ADD_GENERALIZATION",icon:"call_merge",label:"添加概要"},{cmd:"REMOVE_GENERALIZATION",icon:"call_split",label:"删除概要"}],N=[{value:"logicalStructure",label:"逻辑结构图"},{value:"mindMap",label:"思维导图"},{value:"organizationStructure",label:"组织结构图"},{value:"catalogOrganization",label:"目录组织图"},{value:"timeline",label:"时间轴(左)"},{value:"timeline2",label:"时间轴(下)"},{value:"timeline3",label:"时间轴(上)"},{value:"verticalTimeline",label:"时间轴(竖)"},{value:"fishbone",label:"鱼骨图"},{value:"rightFishbone",label:"鱼骨图(右)"}],v=[{value:"curve",label:"曲线"},{value:"straight",label:"直线"},{value:"direct",label:"直连"}],g=[{value:"default",label:"默认主题"},{value:"classic",label:"经典"},{value:"dark",label:"暗色"},{value:"simple",label:"极简"},{value:"colorful",label:"缤纷"}],x=i.default.iconList||[];function C(e){const{t}=(0,o.Bd)(),[n,d]=(0,a.useState)(!0),[m,b]=(0,a.useState)(""),[C,O]=(0,a.useState)(100),[j,w]=(0,a.useState)("default"),[,D]=(0,s.fp)(u.AG.prompt_card),[R,T]=(0,a.useState)("mindMap"),[S,k]=(0,a.useState)(null),I=(0,a.useRef)(null),L=(0,a.useRef)(null),A=(0,a.useRef)(null),M=(0,a.useRef)(!1),Y=(0,a.useRef)({props:e});Y.current={props:e};const W=()=>{M.current||(M.current=!0,Y.current.props.on_dirty?.(!0))},P=async(e=!1)=>{if(!A.current)return e||(0,l.zN)(t("编辑器尚未就绪")),!1;const n=await Y.current.props.on_save((()=>{const e=A.current;return e?JSON.stringify(e.getData(!0)):""})(),e);return n&&(M.current=!1,Y.current.props.on_dirty?.(!1),Y.current.props.on_saved?.()),n};(0,a.useEffect)(()=>{e.register?.({save:P,is_dirty:()=>M.current})},[e.register]),(0,a.useEffect)(()=>{if(!I.current)return;if(!e.url&&void 0===e.data)return;let n=!1;const a=[];A.current?.destroy?.(),A.current=null,M.current=!1,d(!0),b("");const o=async e=>{if(n||!I.current)return;const r=e&&e.root?e:null,l=r?r.root:e??{data:{text:t("中心主题")}},o=new i.default({el:I.current,data:l,fit:!0,enableDblclickBackToRootNode:!0,enableShortcutOnlyWhenMouseInSvg:!0,autoMoveWhenMouseInEdgeOnDrag:!0,...c.k$});A.current=o,r&&o.setFullData(r),d(!1),w(o.getTheme?.()||"default"),T(o.getLayout?.()||"mindMap");window.requestAnimationFrame(()=>{n||(()=>{let e=!1;const t=window.setTimeout(()=>{n||(e=!0)},400);a.push(t),o.on("data_change",()=>{e&&(W(),O(y(o)))}),o.on("view_data_change",()=>{O(y(o))}),o.on("error",(e,t)=>{console.error("[mind]",e,t)}),O(y(o))})()})};return(async()=>{try{let t=null;if(void 0!==e.data)t=e.data;else{const a=await r.l.get(e.url);if(n)return;t=a}let a=null;if("string"==typeof t&&t.trim())try{a=JSON.parse(t)}catch{a=null}else t&&"object"==typeof t&&(a=t);a=(0,c.tW)(a),await o(a)}catch(e){n||(d(!1),b(t("加载思维导图失败")),(0,l.zN)(t("加载思维导图失败")))}})(),()=>{n=!0,a.forEach(e=>window.clearTimeout(e)),A.current?.destroy?.(),A.current=null}},[e.url,e.data]),(0,a.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&("s"===e.key||"S"===e.key||83===e.keyCode)&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),P())};return window.addEventListener("keydown",e,!0),document.addEventListener("keydown",e,!0),()=>{window.removeEventListener("keydown",e,!0),document.removeEventListener("keydown",e,!0)}},[]);const G=e=>{const t=A.current;if(!t)return;const n=Math.min(4,Math.max(.25,e));t.view.setScale(n),O(Math.round(100*n))},V={SET_NODE_NOTE:{title:"节点备注",placeholder:"请输入节点备注",get:e=>e.getData("note")||""},SET_NODE_TAG:{title:"节点标签",placeholder:"请输入节点标签,多个用逗号分隔",get:e=>(e.getData("tag")||[]).join(",")},SET_NODE_HYPERLINK:{title:"插入超链接",placeholder:"请输入链接地址",get:e=>e.getData("hyperlink")||""}};(0,a.useEffect)(()=>{if(!S)return;const e=()=>k(null),t=window.setTimeout(()=>{window.addEventListener("click",e),window.addEventListener("blur",e)},0);return()=>{window.clearTimeout(t),window.removeEventListener("click",e),window.removeEventListener("blur",e)}},[S]),(0,a.useEffect)(()=>{const e=L.current;if(!e)return;const t=e=>{const t=A.current?.renderer?.activeNodeList?.[0];t&&(e.preventDefault(),e.stopPropagation(),k({x:e.clientX,y:e.clientY,node:t}))};return e.addEventListener("contextmenu",t,!0),()=>e.removeEventListener("contextmenu",t,!0)},[]);const X=e=>e.map(e=>({v:e.cmd,r:(0,f.jsxs)("div",{className:"common-tag-center mind-menu-row",children:[(0,f.jsx)(E.In,{icon:e.icon,not_use_icon_style:!0}),(0,f.jsx)("span",{children:t(e.label)})]}),items:e.children?X(e.children):void 0})),H=e=>{const n=A.current,a=S;if(n&&a){if(k(null),"ADD_GENERALIZATION"===e||"REMOVE_GENERALIZATION"===e)return n.execCommand(e),void W();"SET_NODE_NOTE"!==e&&"SET_NODE_TAG"!==e&&"SET_NODE_HYPERLINK"!==e?"SET_NODE_ICON"!==e?e.startsWith("REMOVE_NODE_")?((e,t)=>{e&&("REMOVE_NODE_ICON"===t?A.current.execCommand("SET_NODE_ICON",e,[]):"REMOVE_NODE_NOTE"===t?A.current.execCommand("SET_NODE_NOTE",e,""):"REMOVE_NODE_TAG"===t?A.current.execCommand("SET_NODE_TAG",e,[]):"REMOVE_NODE_HYPERLINK"===t&&A.current.execCommand("SET_NODE_HYPERLINK",e,"",""),W())})(a.node,e):(n.execCommand(e,a.node),W()):(e=>{if(!e)return;const n=Array.isArray(e.getData("icon"))?e.getData("icon"):[];D({open:!0,title:t("插入图标"),context_div:(0,f.jsx)("div",{className:"prompt-icon-list",children:x.flatMap(t=>(t.list||[]).map((a,r)=>(0,f.jsx)("button",{type:"button",className:"prompt-icon-list__item",title:a.name,dangerouslySetInnerHTML:{__html:a.icon},onClick:()=>{A.current.execCommand("SET_NODE_ICON",e,[...n,`${t.type}_${a.name}`]),D({open:!1}),W()}},t.type+r)))}),cancel:()=>D({open:!1})})})(a.node):((e,n)=>{if(!e)return;const a=V[n],r=a.get(e);let l=r;D({open:!0,title:t(a.title),context_div:(0,f.jsx)(p,{initValue:r,placeholder:t(a.placeholder),multiline:!0,onChange:e=>l=e}),confirm:()=>{const t=l.trim();"SET_NODE_TAG"===n?A.current.execCommand(n,e,t.split(/[,,]/).map(e=>e.trim()).filter(Boolean)):"SET_NODE_HYPERLINK"===n?A.current.execCommand(n,e,t,t):A.current.execCommand(n,e,t),D({open:!1}),W()},cancel:()=>D({open:!1})})})(a.node,e)}};return(0,f.jsxs)("div",{className:"mind-wrap"+(e.fullscreen?" mind-wrap--full":""),children:[e.header,(0,f.jsxs)("div",{className:"mind-toolbar",children:[(0,f.jsx)("button",{type:"button",className:"mind-btn",title:t("添加子节点")+" (Tab)",onClick:()=>A.current?.execCommand?.("INSERT_CHILD_NODE"),children:(0,f.jsx)("span",{className:"material-icons",children:"account_tree"})}),(0,f.jsx)("button",{type:"button",className:"mind-btn",title:t("添加同级节点")+" (Enter)",onClick:()=>A.current?.execCommand?.("INSERT_NODE"),children:(0,f.jsx)("span",{className:"material-icons",children:"subdirectory_arrow_right"})}),(0,f.jsx)("button",{type:"button",className:"mind-btn",title:t("删除节点")+" (Delete)",onClick:()=>A.current?.execCommand?.("REMOVE_NODE"),children:(0,f.jsx)("span",{className:"material-icons",children:"delete"})}),(0,f.jsx)("span",{className:"mind-toolbar__sep"}),(0,f.jsx)("button",{type:"button",className:"mind-btn",title:t("撤销")+" (Ctrl+Z)",onClick:()=>A.current?.execCommand?.("BACK"),children:(0,f.jsx)("span",{className:"material-icons",children:"undo"})}),(0,f.jsx)("button",{type:"button",className:"mind-btn",title:t("重做")+" (Ctrl+Y)",onClick:()=>A.current?.execCommand?.("FORWARD"),children:(0,f.jsx)("span",{className:"material-icons",children:"redo"})}),(0,f.jsx)("span",{className:"mind-toolbar__sep"}),(0,f.jsxs)("span",{className:"mind-toolbar__zoom",children:[C,"%"]}),(0,f.jsx)("button",{type:"button",className:"mind-btn",title:t("缩小"),onClick:()=>G(y(A.current)/100-.2),children:(0,f.jsx)("span",{className:"material-icons",children:"remove"})}),(0,f.jsx)("button",{type:"button",className:"mind-btn",title:t("放大"),onClick:()=>G(y(A.current)/100+.2),children:(0,f.jsx)("span",{className:"material-icons",children:"add"})}),(0,f.jsx)("button",{type:"button",className:"mind-btn",title:t("适应窗口"),onClick:()=>{A.current?.view?.fit?.(),O(y(A.current))},children:(0,f.jsx)("span",{className:"material-icons",children:"fit_screen"})})]}),(0,f.jsxs)("div",{className:"mind-toolbar mind-toolbar--sub",children:[(0,f.jsx)("select",{className:"mind-select",title:t("结构"),value:R,onChange:e=>{const t=e.target.value;A.current?.setLayout?.(t),T(t),W()},children:N.map(e=>(0,f.jsx)("option",{value:e.value,children:t(e.label)},e.value))}),(0,f.jsxs)("select",{className:"mind-select",title:t("连线风格"),defaultValue:"",onChange:e=>{const t=e.target.value;if(t){const e=A.current?.getCustomThemeConfig?.()||{};A.current?.setThemeConfig?.({...e,lineStyle:t}),W()}e.target.value=""},children:[(0,f.jsx)("option",{value:"",children:t("连线风格")}),v.map(e=>(0,f.jsx)("option",{value:e.value,children:t(e.label)},e.value))]}),(0,f.jsx)("select",{className:"mind-select",title:t("主题"),value:j,onChange:e=>{const t=e.target.value;w(t),A.current?.setTheme?.(t),W()},children:g.map(e=>(0,f.jsx)("option",{value:e.value,children:t(e.label)},e.value))}),(0,f.jsx)("span",{className:"mind-toolbar__gap"})]}),(0,f.jsxs)("div",{className:"mind-canvas",ref:L,children:[(0,f.jsx)("div",{className:"mind-mount",ref:I}),n&&(0,f.jsx)("div",{className:"mind-mask",children:"Loading..."}),m&&(0,f.jsx)("div",{className:"mind-mask",children:m}),S&&(0,f.jsx)(_.rY,{click:()=>k(null),children:(0,f.jsx)(_.sw,{x:S.x,y:S.y,items:X(h),click:e=>H(e)})})]})]})}function y(e){const t=e?.view?.getTransformData?.()?.state?.scale;return"number"==typeof t&&t>0?Math.round(100*t):100}},86063(e,t,n){"use strict";function a(e){return"smm-mind"===e}n.d(t,{Hn:()=>s,hj:()=>a,tW:()=>o});const r={mousewheelMoveStep:35,scaleRatio:.08};let l=null;function o(e){return e&&"object"==typeof e?e.data?.nodeData?i(e.data.nodeData):e.root&&"object"==typeof e.root?e.root.data?e:{...e,root:c(e.root)}:e.data&&"object"==typeof e.data?e:c(e):null}function i(e){return{data:{text:"string"==typeof e?.topic?e.topic:"string"==typeof e?.data?.text?e.data.text:""},children:Array.isArray(e?.children)?e.children.map(i):[]}}function c(e){return{data:{text:"string"==typeof e?.text?e.text:"",...e?.note?{note:e.note}:{}},children:Array.isArray(e?.children)?e.children.map(c):[]}}function d(e){e.stopPropagation()}async function s(e){const t=function(e){const t=e.trim();if(!t)return null;let n=null;try{n=JSON.parse(t)}catch{return null}return o(n)}(e),a=await(l||(l=Promise.all([Promise.all([n.e(8725),n.e(2728),n.e(2130),n.e(5602),n.e(8277)]).then(n.bind(n,45602)),n.e(8781).then(n.bind(n,88781))]).then(([e])=>e.default)),l);return{data:t,async mount(e,n){let l=!1;const o=await function(e,t){return new Promise(n=>{const a=()=>{t()?n(!1):e.isConnected&&e.clientWidth&&e.clientHeight?n(!0):window.setTimeout(a,16)};a()})}(e,()=>l);if(!o)return{destroy:()=>{},get_data:()=>null};const i=document.createElement("div");i.className="md-graph__mind-host",!1!==n?.release_wheel&&e.addEventListener("wheel",d,{capture:!0,passive:!0}),e.append(i);const c=new a({el:i,data:t?.root??t??{data:{text:""}},readonly:!n?.editable,fit:!0,...r});return t?.root&&c.setFullData(t),{destroy:()=>{l=!0,e.removeEventListener("wheel",d,{capture:!0}),c?.destroy?.()},get_data:()=>c?.getData?.(!1)}}}}n.d(t,["k$",0,r])},93245(e,t,n){"use strict";n.d(t,{a:()=>c});var a=n(96540),r=n(34843),l=n(82893),o=n(23430);const i=[{id:o.nE.ace,label:"文本编辑器(ace)"},{id:o.nE.md,label:"md编辑器"},{id:o.nE.mind,label:"思维导图编辑器"},{id:o.nE.draw,label:"draw编辑器"},{id:o.nE.timeline,label:"时间线编辑器"},{id:o.nE.image,label:"图片编辑器"},{id:o.nE.excel,label:"excel编辑器"}];function c(e,t,n,o=!1){const[i]=(0,r.fp)(l.AG.user_base_info),c=i?.user_data?.editor_auto_save,d=(0,a.useRef)(c);d.current=c;const s=(0,a.useRef)(t);s.current=t;const u=(0,a.useRef)(n);u.current=n,(0,a.useEffect)(()=>{if(o)return;const t=d.current;if(!t?.enable||t.interval<=0||!t.editors?.includes(e))return;const n=setInterval(()=>{s.current()&&u.current(!0)},1e3*t.interval);return()=>clearInterval(n)},[c,e,o])}n.d(t,["d",0,i])},28277(){}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6010,8302],{83277(e,t,n){n.d(t,{$j:()=>a,Lv:()=>s});class s{token;open=!1;note;index;url;model;request_type;json_params;sys_prompt;dotenv="";yaml_env="";tool_mode=!1;show_options;static get_label_by_v(e,t){if(!e||!t?.length)return e;for(const n of t)if(n.value===e)return n.label;return e}static have_label_by_v(e,t){if(!e||!t?.length)return!1;for(const n of t)if(n.value===e)return!0;return!1}}const o=JSON.stringify({stream:!0,thinking:{type:"disabled"}});function a(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"text"===e.type?e.text:"[图片]").join("\n"):""}n.d(t,["CP",0,"\n# 聊天循环最大次数\ntool_call_max: 500\n\n# 是否允许AI直接执行命令而不需要用户确认。\n# 默认为 false,需要用户手动确认;使用 workflow 时等价于 true。\nallow_exec_cmd_directly: false\n\n# 可选的大模型请求代理地址\n# proxy_url: http://127.0.0.1:7890\n\n# 可选的多个 url\n# options_agent_url_list:\n# - value: http://...\n# label: openai\n\n# 可选的多个 key\n# options_agent_key_list:\n# - value: sk-aaa\n# label: option1\n\n# 可选的多个 model\n# options_agent_model_list:\n# - value: gpt-5.5\n# label: gpt\n\n# 本地 prompt 文件列表,每次聊天时自动读取并加载\n# options_local_file_path_prompt_list:\n# - /prompt/a.txt\n\n# 开启切换模型,AI 可以根据 prompt 自己决定下一步调用哪个模型\n# open_pick_model: false\n\n# 历史消息裁剪相关\nmax_recent_messages: 12\ncompress_message_count: 16\nmax_tool_content_chars: 200\n\n# ===== 模型类型(request_type)=====\n# 默认 completions,可选值:\n# completions 标准对话/聊天补全 (chat/completions)\n# images 图片生成 (images/generations)\n# audio_speech 文本转语音 (audio/speech)\n# audio_transcription 语音转文字 (audio/transcriptions)\n# audio_translation 语音翻译 (audio/translations)\n# embeddings 向量嵌入 (embeddings)\n# request_type: completions\n\n# ===== 成为 tool(tool_mode)=====\n# 开启后该模型会作为一个工具被加载,供 AI agent 动态调用。\n# 注意:不能与「是否开启」(open) 同时为 true。\n# tool_mode: false\n\n# ===== 图片理解(image_understanding)=====\n# 开启后注册 read_image 工具,工具读到的图片会以 image_url 多模态格式随消息发给模型。\nimage_understanding: true\n\n# ===== 命令环境变量(command_env)=====\n# AI 调用内置命令工具(exec_cmd / exec_cmd_background)执行命令时,\n# 这里配置的变量会覆盖到子进程的环境变量上。\n# command_env:\n# NODE_ENV: production\n# HTTP_PROXY: http://127.0.0.1:7890\n\n# 是否允许 AI 通过 set_command_env 工具修改上面的 command_env\ncommand_env_tool: false\n","cL",0,o])},77481(e,t,n){n.d(t,{S:()=>i,X:()=>r});var s=n(96540),o=n(61443),a=n(74848);function r(e){const[t,n]=s.useState([]),r=(0,s.useRef)(-1),[i,l]=(0,s.useState)(-1),[c,d]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const m=()=>{r.current=-1,l(-1),d(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((t,n)=>{const s=!!e.filter&&(e.filter.column??0)===n;let r=t;if(s){const n=e.filter,s=n.options.find(e=>e.value===n.value);null!=n.value&&s&&(r=`${t} (${s.label})`)}return(0,a.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,a.jsx)(o.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:r}):t},n)})})}),(0,a.jsx)("tbody",{children:t.map((t,n)=>{const s=!!e.onRowDrag;return(0,a.jsx)("tr",{className:s?(i===n?"row-dragging":"")+(c===n?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{s&&(r.current=n,l(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||r.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{s&&(t.preventDefault(),(()=>{const t=r.current,n=c;m(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:m,children:t.map((n,s)=>{const o=s===t.length-1?"small":"";return(0,a.jsx)("td",{className:o,style:{width:e.width??"auto"},children:n},s)})},n)})})]})}function i(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,a.jsx)("div",{children:e},t))})}},29591(e,t,n){n.r(t),n.d(t,{default:()=>K});var s=n(22022),o=n(96540),a=n(85997),r=n(4412),i=n(34843),l=n(82893),c=n(75725),d=n(77481),m=n(61443),p=n(70447),u=n(34299),_=n(74848);var h=n(14284),x=n(53459),g=n(62042),v=n(7523),j=n(78247),f=n(23430),y=n(61973),w=n(14944),b=n(92275),C=n(88815),A=n(64694),k=n(45907),S=n(12721),I=n(24659),N=n(83277);function K(){const{t:e}=(0,s.Bd)(),{initUserInfo:t}=(0,o.useContext)(v.F),n=[e("编号"),e("url"),e("是否开启"),e("key"),e("默认model"),e("更多属性"),e("备注")],K=[e("编号"),e("本地目录"),e("自动加载"),e("备注")],[O,$]=(0,o.useState)([]),[L,M]=(0,o.useState)({}),[P,T]=(0,o.useState)([]),[X,D]=(0,o.useState)([]),[H,R]=(0,o.useState)(null),q=(0,o.useRef)(),E=(0,o.useRef)(!1),V=(0,o.useRef)(!1),[F,Y]=(0,o.useState)([]),[W,B]=(0,o.useState)(!1),[G,J]=(0,o.useState)({}),[z,U]=(0,i.fp)(l.AG.prompt_card),[Z,Q]=(0,i.fp)(l.AG.user_base_info),[ee,te]=(0,o.useState)(!1),ne=X.filter(e=>"http"!==(e.transport??"stdio")),se=X.filter(e=>"http"===e.transport),oe=[e("编号"),e("名称"),e("是否开启"),e("状态"),"command","args","cwd",e("tools|env"),e("备注")],ae=[e("编号"),e("名称"),e("是否开启"),e("状态"),e("endpoint"),e("tools|headers"),e("备注")],re=[e("编号"),e("提示词"),e("LLM编辑开关"),e("llm_pmt"),e("编辑规则"),e("备注")],[ie,le]=(0,o.useState)([]),[ce,de]=(0,o.useState)(!1),me=function(){const[e,t]=(0,i.fp)(l.AG.prompt_card);return e=>{t({open:!0,title:"信息",context_div:(0,_.jsx)("div",{children:(0,_.jsx)(u.default,{context:e})})})}}(),{check_user_auth:pe}=(0,j.MH)(),[ue,_e]=(0,i.fp)(l.AG.editorSetting),he=(0,y.Zp)(),xe=(0,k.y)(),ge=(0,I.K)(),ve=async()=>{const e=await h.jV.get("docs_on_get");e.code===x.m.Success&&te(e.data)};(0,o.useEffect)(()=>{(async()=>{const e=await h.XO.get("ai_agent_setting");e.code===x.m.Success&&$(e.data.models);const t=await h.XO.get("ai_agent_global_setting");t.code===x.m.Success&&M(t.data??{}),await w.ws.addMsg(b.HK.ai_load_info,e=>{R(e.context)});const n=await w.ws.sendData(b.HK.ai_load_info,{});n?.context&&R(n.context);const s=await h.XO.get("ai_docs_setting");s.code===x.m.Success&&(q.current=s.data.param,s.data.list?.length&&T(s.data.list));const o=await h.XO.get("ai_mcp_setting");o.code===x.m.Success&&D(o.data.list??[]),await Ae(),ve();const a=await h.XO.get("ai_system_prompts");a.code===x.m.Success&&le(a.data??[]);const r=await h.XO.get("ai_long_term_memory_setting");r.code===x.m.Success&&de(r.data?.open??!1)})()},[]),(0,o.useEffect)(()=>{w.ws.addMsg(b.HK.mcp_status,e=>{const t=e.context??{},n={};for(const e of t.status??[])n[e.index]={state:e.state,error:e.error,tool_count:e.tool_count};J(n),t.done&&Ae()})},[]);const je=(e="stdio")=>{const t="http"===e?{name:"",open:!1,note:"",transport:"http",endpoint:"",headers:"",stream:!1,timeout_ms:1e4}:{name:"",open:!1,command:"",args:"",cwd:"",env:"",note:"",transport:"stdio",timeout_ms:1e4};D([...X,t]),E.current=!0},fe=e=>{const t=X.indexOf(e);t<0||(X.splice(t,1),D([...X]),E.current=!0)},ye=e=>{D([...X,{...e,open:!1}]),E.current=!0},we=async e=>{for(let e=0;e<O.length;e++)O[e].index=e;(await h.XO.post("ai_agent_setting/save",{models:e??O})).code===x.m.Success&&(0,g.SK)("保存成功")},be=async e=>{(await h.XO.post("ai_agent_global_setting/save",e??L)).code===x.m.Success&&(0,g.SK)("保存成功")},Ce=async e=>{for(let e=0;e<X.length;e++)X[e].index=e;(await h.XO.post("ai_mcp_setting/save",{list:e??X})).code===x.m.Success&&((0,g.SK)("保存成功"),E.current=!1,w.ws.sendData(b.HK.mcp_reload,{}))},Ae=async()=>{const e=await h.XO.get("ai_mcp_tools");return e.code===x.m.Success?(Y(e.data??[]),e.data??[]):[]},ke=async e=>{B(!0);try{const t=await h.XO.post("ai_mcp_tools/reload",{index:e});if(t.code===x.m.Success)return await Ae(),(0,g.SK)("MCP工具加载成功"),t.data??null}finally{B(!1)}return null},Se=async(t,n,s,o)=>{const a=o??F.find(e=>e.index===n)??{index:n,key:`${n}`,name:t.name??"",note:t.note,transport:t.transport??"stdio",open:!!t.open,loaded:!1,tool_count:0,tools:[]},r=(a.tools??[]).map(t=>({id:t.runtime_name,title:t.tool_name,subtitle:t.description||e("无描述"),detail:t.display_name,meta:t.runtime_name}));U({open:!0,title:`${t.name||t.note||n} MCP工具`,context_div:(0,_.jsx)(S.O,{title:`${t.name||t.note||n} MCP工具`,subtitle:`${a.transport??"stdio"} | ${a.open?e("是"):e("否")} | ${a.loaded?"loaded":"idle"} | ${a.tool_count} tools`,pages:r,initialPageId:s,onRefresh:async()=>{const e=await ke(n);e&&await Se(t,n,s,e)},renderPage:t=>{if(!t)return(0,_.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")});const n=a.tools?.find(e=>e.runtime_name===t.id);return n?(0,_.jsxs)("div",{className:"prompt-switch-page__detail",children:[(0,_.jsx)("div",{className:"prompt-switch-page__detail-title",children:n.display_name}),(0,_.jsx)("div",{className:"prompt-switch-page__detail-desc",children:n.description||e("无描述")}),(0,_.jsxs)("div",{className:"prompt-switch-page__detail-row",children:[(0,_.jsx)("strong",{children:"runtime:"})," ",n.runtime_name]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("strong",{children:"schema:"}),(0,_.jsx)("pre",{className:"prompt-switch-page__schema",children:JSON.stringify(n.input_schema??{},null,2)})]})]}):(0,_.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")})}}),cancel:()=>U({open:!1})})},Ie=t=>{const n=G[t];let s=n?.state,o=n?.error,a=n?.tool_count;if(!s){const e=F.find(e=>e.index===t);s=e?.state,o=e?.error,a=e?.tool_count}switch(s){case"loading":return(0,_.jsx)(p.fq,{loading:!0,text:e("加载中")});case"success":return(0,_.jsx)(p.fq,{success:!0,text:`${a??0} ${e("个工具")}`});case"failed":return(0,_.jsx)("span",{title:o??e("加载失败"),children:(0,_.jsx)(p.fq,{success:!1,text:e("加载失败")})});default:return(0,_.jsx)(p.fq,{text:e("未加载")})}},Ne=async e=>{for(let e=0;e<O.length;e++)O[e].index=e;let t={list:P,docs_update_tag:V.current};null!=e&&(t={param:e}),V.current=!1;(await h.XO.post("ai_docs_setting_save",t)).code===x.m.Success&&(0,g.SK)("保存成功")},Ke=async()=>{for(let e=0;e<ie.length;e++)ie[e].index=e;(await h.XO.post("ai_system_prompts/save",{list:ie})).code===x.m.Success&&(0,g.SK)("保存成功")};return(0,_.jsxs)("div",{children:[(0,_.jsx)(r.aZ,{position:"right",children:pe(f.oV.ai_agent_setting)&&(0,_.jsx)(a.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>{he(-1)}})}),(0,_.jsx)(c.jW,{isFull:!0,more:!0,children:(0,_.jsx)(c.NN,{children:(0,_.jsxs)(c.xh,{children:[(0,_.jsx)(c.fI,{children:(0,_.jsx)(c.VP,{widthPer:100,maxWidth:"130rem",children:(0,_.jsx)(p.uF,{self_title:(0,_.jsxs)("span",{className:" div-row ",children:[(0,_.jsx)("h2",{children:e("供应商设置")})," ",(0,_.jsx)(a.rA,{icon:"info",onClick:()=>{me('\n1. Only OpenAI-style AI APIs are supported. Fill in the FULL endpoint path (not just the domain), e.g. https://ark.cn-beijing.volces.com/api/v3/chat/completions\n2. The longer the conversation history, the more expensive the LLM token cost. Currently, there is no long-term memory simplification capability. You can set the system prompt to make the AI answer more concisely to save tokens\n3. When writing the model request parameter JSON, you can only write JSON in it, to configure the attributes supported by OpenAI-style AI, such as temperature, thinking (Doubao\'s deep thinking toggle), etc.\n4. You can enable "stream": true in the model request parameters to improve response speed.\n5. Deep thinking currently affects output speed. It is recommended to set { "thinking" : { "type":"disabled" } } to disable it (Doubao example).\n6. To use the AI feature to query server information, the AI needs to be able to know some commands. You need to first set command permissions for the user in user settings. It is recommended to set * to allow all commands, and then set the dangerous commands that are not allowed to be executed in the settings\n7. The model type and Become Tool are now both configured in "More Attributes → Extra Parameter Settings" using request_type / tool_mode (comments are already provided in the editor).\n8. After becoming a tool, the model will be loaded as a tool, enabling different models to serve as different roles; please do not set both it and "Enabled" to true at the same time.\n')},title:"信息"})]}),rightTopCom:(0,_.jsxs)("div",{children:[(0,_.jsx)(a.rA,{icon:"short_text",title:e("全局prompt"),onClick:()=>{_e({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{L.sys_prompt=e,M({...L}),j.xK.set_value_temp(""),await be({...L,sys_prompt:e})}}),j.xK.set_value_temp(L.sys_prompt??"")}}),(0,_.jsx)(a.rA,{icon:"edit_attributes",title:e("全局")+" "+e("model请求参数json编写"),onClick:()=>{_e({model:"ace/mode/json",open:!0,fileName:"",save:async e=>{L.json_params=e,M({...L}),j.xK.set_value_temp(""),await be({...L,json_params:e})},can_format:!0}),j.xK.set_value_temp(L.json_params??"")}}),(0,_.jsx)(a.rA,{icon:"settings",title:e("全局")+" "+e("额外参数设置"),onClick:()=>{_e({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{L.yaml_env=e,M({...L}),j.xK.set_value_temp(""),await be({...L,yaml_env:e})}}),j.xK.set_value_temp(L.yaml_env??"")}}),(0,_.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{$([...O,{note:"",open:!1,path:"",yaml_env:N.CP,json_params:N.cL}])}}),(0,_.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{await we()}})]}),children:(0,_.jsx)(d.X,{headers:n,onRowDrag:(e,t)=>{$((0,A.TI)(O,e,t))},rows:O.map((t,n)=>{const s=[(0,_.jsx)("div",{children:n}),(0,_.jsx)(m.Sm,{value:N.Lv.get_label_by_v(t.url,t.show_options?.options_agent_url_list),options:t.show_options?.options_agent_url_list,handleInputChange:e=>{t.url=e},no_border:!0}),(0,_.jsx)(m.l6,{value:t.open,onChange:e=>{((e,t,n)=>{const s=[];for(let e=0;e<O.length;e++)O[e].open=e===n&&t,s.push(O[e]);$(s)})(0,e,n)},options:ge,no_border:!0}),(0,_.jsx)(m.Sm,{type:N.Lv.have_label_by_v(t.token,t.show_options?.options_agent_key_list)?null:"password",value:N.Lv.get_label_by_v(t.token,t.show_options?.options_agent_key_list),options:t.show_options?.options_agent_key_list,handleInputChange:e=>{t.token=e},no_border:!0}),(0,_.jsx)(m.Sm,{value:N.Lv.get_label_by_v(t.model,t.show_options?.options_agent_model_list),options:t.show_options?.options_agent_model_list,handleInputChange:e=>{t.model=e},no_border:!0}),(0,_.jsxs)("div",{children:[(0,_.jsx)(a.rA,{icon:"short_text",title:"prompt",onClick:()=>{j.xK.set_value_temp(O[n].sys_prompt??""),_e({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{O[n].sys_prompt=e,$(O),j.xK.set_value_temp(""),we(O)}})}}),(0,_.jsx)(a.rA,{icon:"edit_attributes",title:"model请求参数json编写",onClick:()=>{j.xK.set_value_temp(O[n].json_params),_e({model:"ace/mode/json",open:!0,fileName:"",save:async e=>{O[n].json_params=e,$(O),j.xK.set_value_temp(""),we(O)},can_format:!0})}}),(0,_.jsx)(a.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{j.xK.set_value_temp(O[n].yaml_env),_e({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{O[n].yaml_env=e,$(O),j.xK.set_value_temp(""),we(O)}})}})]}),(0,_.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,_.jsxs)("div",{children:[(0,_.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{O.splice(e,1),$([...O])})(n)}),(0,_.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>(e=>{$([...O,{...O[e],open:!1}])})(n)})]})];return s}),width:"10rem"})})})}),(0,_.jsx)(c.fI,{children:(0,_.jsx)(c.VP,{widthPer:70,maxWidth:"100rem",children:(0,_.jsx)(p.uF,{self_title:(0,_.jsxs)("span",{className:" div-row ",children:[(0,_.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - stdio"]})," ",(0,_.jsx)(a.rA,{icon:"info",onClick:()=>{me("\n1. 这里配置的是 MCP Client 启动参数,当前实现的是 stdio 模式,也就是通过 command + args 启动本地 MCP Server\n2. 例如可以填 npx / uvx / python 等命令,再配合对应的 MCP server 包参数\n3. 保存后会自动重新加载 MCP 工具,agent 聊天时会把这些工具一起带给模型\n4. 建议把 cwd 配到具体项目目录,避免 server 在错误目录里运行\n")},title:"信息"})]}),rightTopCom:(0,_.jsxs)("div",{children:[(0,_.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>je("stdio")}),(0,_.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{Ce()}})]}),children:(0,_.jsx)(d.X,{headers:oe,onRowDrag:(e,t)=>{D((0,A.TI)(X,X.indexOf(ne[e]),X.indexOf(ne[t]))),E.current=!0},rows:ne.map((t,n)=>{const s=X.indexOf(t);return[(0,_.jsx)("div",{children:n}),(0,_.jsx)(m.Sm,{value:t.name,handleInputChange:e=>{t.name=e,E.current=!0},no_border:!0}),(0,_.jsx)(m.l6,{value:t.open,onChange:e=>{t.open=e,D([...X]),E.current=!0},options:ge,no_border:!0}),Ie(X.indexOf(t)),(0,_.jsx)(m.Sm,{value:t.command,handleInputChange:e=>{t.command=e,E.current=!0},no_border:!0}),(0,_.jsx)(m.Sm,{value:t.args,handleInputChange:e=>{t.args=e,E.current=!0},no_border:!0}),(0,_.jsx)(m.Sm,{value:t.cwd,handleInputChange:e=>{t.cwd=e,E.current=!0},no_border:!0}),(0,_.jsxs)("div",{children:[(0,_.jsx)(a.rA,{icon:"visibility",title:"查看工具",onClick:()=>{Se(t,s)}}),(0,_.jsx)(a.rA,{icon:"settings",title:"env",onClick:()=>{j.xK.set_value_temp(t.env??""),_e({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{t.env=e,D([...X]),j.xK.set_value_temp(""),E.current=!0,Ce()}})}})]}),(0,_.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e,E.current=!0},no_border:!0}),(0,_.jsxs)("div",{children:[(0,_.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>fe(t)}),(0,_.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>ye(t)})]})]}),width:"10rem"})})})}),(0,_.jsx)(c.fI,{children:(0,_.jsxs)(c.VP,{widthPer:70,maxWidth:"100rem",children:[(0,_.jsx)(p.uF,{self_title:(0,_.jsxs)("span",{className:" div-row ",children:[(0,_.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - HTTP"]})," "]}),rightTopCom:(0,_.jsxs)("div",{children:[(0,_.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>je("http")}),(0,_.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{Ce()}})]}),children:(0,_.jsx)(d.X,{headers:ae,onRowDrag:(e,t)=>{D((0,A.TI)(X,X.indexOf(se[e]),X.indexOf(se[t]))),E.current=!0},rows:se.map((t,n)=>{const s=X.indexOf(t);return[(0,_.jsx)("div",{children:n}),(0,_.jsx)(m.Sm,{value:t.name,handleInputChange:e=>{t.name=e,E.current=!0},no_border:!0}),(0,_.jsx)(m.l6,{value:t.open,onChange:e=>{t.open=e,D([...X]),E.current=!0},options:ge,no_border:!0}),Ie(X.indexOf(t)),(0,_.jsx)(m.Sm,{value:t.endpoint,handleInputChange:e=>{t.endpoint=e,E.current=!0},no_border:!0}),(0,_.jsxs)("div",{children:[(0,_.jsx)(a.rA,{icon:"visibility",title:"查看工具",onClick:()=>{Se(t,s)}}),(0,_.jsx)(a.rA,{icon:"settings",title:"headers",onClick:()=>{j.xK.set_value_temp(t.headers??""),_e({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{t.headers=e,D([...X]),j.xK.set_value_temp(""),E.current=!0,Ce()}})}})]}),(0,_.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e,E.current=!0},no_border:!0}),(0,_.jsxs)("div",{children:[(0,_.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>fe(t)}),(0,_.jsx)(a.rA,{icon:"copy_all",title:e("复制"),onClick:()=>ye(t)})]})]}),width:"10rem"})}),(0,_.jsx)(p.uF,{self_title:(0,_.jsxs)("span",{className:" div-row ",children:[(0,_.jsx)("h2",{children:e("系统会话提示词")})," ",(0,_.jsx)(a.rA,{icon:"info",onClick:()=>{me('\n1. 系统会话提示词,在 AI 聊天页创建会话时可以选择,选中的提示词会自动填入聊天框作为第一条系统消息\n2. 适用于预先设定常用的会话场景模板,如"代码审查"、"翻译助手"、"运维诊断"等\n3. "LLM编辑开关":开启后,当用户选择了该系统提示词发起对话时,AI 将会获得一个"更新会话提示词"工具,允许 AI 在对话中对当前会话进行总结,并写入到本提示词的"LLM编辑提示词"字段(全局保存,供之后的新会话沿用),使 AI 能自我维护长期上下文。\n4. "LLM编辑提示词":可选。AI 编辑后写回的内容(可预填初始方向)。仅在"LLM编辑开关"开启时生效。\n5. "编辑规则":可选。给 LLM 的编辑要求,例如"总结时不要超过 300 token"、"用简洁的项目要点记录"等。仅在"LLM编辑开关"开启时生效。\n')},title:"信息"})]}),rightTopCom:(0,_.jsxs)("div",{children:[(0,_.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{le([...ie,{prompt:"",note:"",llm_prompt_enable:!1}])}}),(0,_.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{Ke()}})]}),children:(0,_.jsx)(d.X,{headers:re,onRowDrag:(e,t)=>{le((0,A.TI)(ie,e,t))},rows:ie.map((t,n)=>{const s=[(0,_.jsx)("div",{children:n}),(0,_.jsx)("div",{children:(0,_.jsx)(a.rA,{icon:"short_text",title:e("提示词"),onClick:()=>{j.xK.set_value_temp(t.prompt??""),_e({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.prompt=e,le([...ie]),j.xK.set_value_temp(""),Ke()}})}})}),(0,_.jsx)(a.Ay,{checked:!!t.llm_prompt_enable,onChange:e=>{t.llm_prompt_enable=e,le([...ie])},title:e("LLM编辑开关")}),(0,_.jsx)("div",{children:(0,_.jsx)(a.rA,{icon:"edit_note",title:e("llm_pmt"),onClick:()=>{j.xK.set_value_temp(t.llm_prompt??""),_e({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt=e,le([...ie]),j.xK.set_value_temp(""),Ke()}})}})}),(0,_.jsx)("div",{children:(0,_.jsx)(a.rA,{icon:"rule",title:e("编辑规则"),onClick:()=>{j.xK.set_value_temp(t.llm_prompt_tip??""),_e({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt_tip=e,le([...ie]),j.xK.set_value_temp(""),Ke()}})}})}),(0,_.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,_.jsx)("div",{children:(0,_.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{ie.splice(e,1),le([...ie])})(n)})})];return s}),width:"10rem"})}),(0,_.jsx)(p.uF,{self_title:(0,_.jsxs)("span",{className:" div-row ",children:[(0,_.jsx)("h2",{children:e("长期记忆")})," ",(0,_.jsx)(a.rA,{icon:"info",onClick:()=>{me(e("开启后跨会话保存记忆。四个固定文件:周/月/年/永久。每周结束自动压缩周→月,每月结束自动压缩月→年,每年结束自动压缩年→永久。编辑按钮可手动查看和修改。"))},title:"信息"})]}),rightTopCom:(0,_.jsx)("div",{children:(0,_.jsx)(a.Ay,{checked:ce,onChange:async t=>{de(t),await h.XO.post("ai_long_term_memory_setting/save",{open:t}),(0,g.SK)(e("长期记忆设置已保存"))},title:e("开关")})}),children:(0,_.jsx)("div",{style:{display:"flex",gap:"0.5rem",padding:"0.5rem 0",flexWrap:"wrap"},children:[{type:"week",label:e("周记忆"),tip:e("上限3000字")},{type:"month",label:e("月记忆"),tip:e("上限6000字")},{type:"year",label:e("年记忆"),tip:e("上限9000字")},{type:"forever",label:e("永久记忆"),tip:e("上限12000字")}].map(({type:t,label:n,tip:s})=>(0,_.jsx)(a.rA,{icon:"edit",title:`${e("编辑")} ${n} (${s})`,onClick:async()=>{const e=await h.XO.get(`ai_long_term_memory_bucket/${t}`),n=e.code===x.m.Success?e.data??"":"";j.xK.set_value_temp(n),_e({model:"ace/mode/text",open:!0,fileName:`long_term_memory_${t}.txt`,save:async e=>{await h.XO.post(`ai_long_term_memory_bucket/${t}/save`,{data:e}),j.xK.set_value_temp("")}})}},t))})})]})}),(0,_.jsxs)(c.fI,{children:[(0,_.jsx)(c.VP,{widthPer:50,maxWidth:"80rem",children:(0,_.jsx)(p.uF,{self_title:(0,_.jsxs)("span",{className:" div-row ",children:[(0,_.jsx)("h2",{children:e("本地知识库")})," ",(0,_.jsx)(a.rA,{icon:"info",onClick:()=>{me("\n1. 本地知识库用于为AI增强理解能力,或者分析本地文件,原理读取本地的文件,对文件在内存中建立全文索引,为AI提供额外数据(需要有模型开启才能使用)\n2. 该功能只能用于小型知识库,作为本地小型或者公司内部资料使用还是没有问题的\n3. 每次保存都会重新加载知识库中的文件,不会全部重新加载,而是检测哪些文件有变更\n")},title:"信息"})]}),rightTopCom:(0,_.jsxs)("div",{children:[(0,_.jsx)(a.Ay,{checked:ee,onChange:async e=>{await h.jV.post("docs_on_set",{status:e}),ve(),t()},title:e("知识库开关")}),(0,_.jsx)(a.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{j.xK.set_value_temp(q.current),_e({model:"ace/mode/yaml",open:!0,fileName:"",save:async e=>{q.current=e,j.xK.set_value_temp(""),Ne(q.current)}})}}),(0,_.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{T([...P,{note:"",auto_load:!1,dir:""}]),V.current=!0}}),(0,_.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>{Ne()}})]}),children:(0,_.jsx)(d.X,{headers:K,onRowDrag:(e,t)=>{T((0,A.TI)(P,e,t)),V.current=!0},rows:P.map((t,n)=>{const s=[(0,_.jsx)("div",{children:n}),(0,_.jsx)(m.Sm,{value:t.dir,handleInputChange:e=>{t.dir=e,V.current=!0},no_border:!0}),(0,_.jsx)(m.l6,{value:t.auto_load,onChange:e=>{t.auto_load=e,T([...P]),V.current=!0},options:ge,no_border:!0}),(0,_.jsx)(m.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,_.jsxs)("div",{children:[(0,_.jsx)(a.rA,{icon:"delete",title:e("删除记录"),onClick:()=>(e=>{P.splice(e,1),T([...P]),V.current=!0})(n)}),(0,_.jsx)(a.rA,{icon:"restore",title:e("手动加载"),onClick:()=>{xe({sub_title:"手动加载",confirm_fun:()=>{h.jV.post("docs_load_file",{param_path:t.dir}),(0,g.SK)("ok")}})}}),(0,_.jsx)(a.rA,{icon:"delete_forever",title:e("从索引删除"),onClick:()=>{xe({sub_title:"从索引删除",confirm_fun:()=>{h.jV.post("docs_del",{param_path:t.dir}),(0,g.SK)("ok")}})}})]})];return s}),width:"10rem"})})}),H&&(0,_.jsx)(c.VP,{widthPer:50,maxWidth:"80rem",children:(0,_.jsxs)(p.Zp,{title:e("知识库加载信息"),children:[(0,_.jsx)(c.Yh,{left:e("最近一次加载")+","+e("加载进度"),right:H?.progress}),(0,_.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件数量")}`,right:H?.num}),(0,_.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件字符数量")}`,right:H?.char_num}),(0,_.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件大小")}`,right:(0,C.v7)(H?.size)}),(0,_.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总耗时")}`,right:(0,C.a3)(H?.consume_time_ms_len)}),(0,_.jsx)(c.Yh,{left:`${e("总文件数量")}`,right:H?.total_num})]})})]})]})})})]})}},34299(e,t,n){n.r(t),n.d(t,{default:()=>b});var s=n(96540),o=n(23802),a=n(53995),r=n(18569),i=n(77979),l=n(8263),c=n(69428),d=n.n(c),m=(n(3775),n(21499)),p=n(99214),u=n(89117),_=n(86063),h=n(89334),x=n(41105),g=n(52388),v=n(19878),j=(n(72411),n(74848));const f=new o.A({html:!0,highlight:function(e,t){if(t&&v.A.getLanguage(t))try{return`<pre class="hljs code-block-with-copy"><code class="hljs language-${t}">${v.A.highlight(e,{language:t}).value}</code></pre>`}catch(e){}try{return`<pre class="hljs code-block-with-copy"><code class="hljs">${v.A.highlightAuto(e).value}</code></pre>`}catch(e){}return`<pre class="hljs code-block-with-copy"><code>${f.utils.escapeHtml(e)}</code></pre>`}});async function y(e,t){e.className="md-graph md-graph--mind md-graph--loading",e.textContent=g.A.t("rendering");const n=await(0,_.Hn)(t);e.isConnected&&(e.className="md-graph md-graph--mind",e.textContent="",await n.mount(e))}function w(e){const t=e.className.match(/language-([\w-]+)/);return t?t[1]:""}function b(e){const t=(0,s.useRef)(null);return(0,p.VD)(),(0,s.useEffect)(()=>{t.current&&(t.current.innerHTML=f.render(e.context??""),async function(e){const t=e.querySelectorAll("pre > code[class*='language-']");for(const e of Array.from(t)){const t=w(e),n=(0,u.Hm)(t),s=(0,_.hj)(t);if(!n&&!s)continue;const o=e.closest(".code-block-with-copy")??e.parentElement;if(!o)continue;const a=e.textContent??"",r=document.createElement("div");if(o.replaceWith(r),s){try{await y(r,a)}catch(e){console.error("[mind] render failed",e),r.className="md-graph md-graph--mind",r.textContent=String(e)}continue}r.className="md-graph md-graph--loading",r.textContent=g.A.t("rendering");const i=await(0,u.U6)(t,a);r.isConnected&&(i.error?(r.className="md-graph md-graph--error",r.textContent=i.error):(r.className="md-graph",r.innerHTML=i.svg))}}(t.current),(0,h.rg)(t.current))},[e.context]),(0,j.jsx)("div",{ref:t})}f.use(a.A).use(r.A).use(i.A).use(l.A).use(d()).use(e=>{e.renderer.rules.fence;e.renderer.rules.fence=(t,n,s,o,a)=>{const r=t[n],i=r.content.trim(),l=r.info.trim();let c="";if(l&&v.A.getLanguage(l))try{c=v.A.highlight(i,{language:l}).value}catch(t){c=e.utils.escapeHtml(i)}else try{c=v.A.highlightAuto(i).value}catch(t){c=e.utils.escapeHtml(i)}return`\n <div class="code-block-with-copy">\n <div class="code-header">\n <span class="code-language">${l||"code"}</span>\n <button class="copy-btn" data-code="${e.utils.escapeHtml(i)}">复制</button>\n </div>\n <pre><code class="hljs ${l?`language-${l}`:""}">${c}</code></pre>\n </div>`}}).use(e=>{const t=e.renderer.rules.link_open||function(e,t,n,s,o){return o.renderToken(e,t,n)};e.renderer.rules.link_open=(e,n,s,o,a)=>{const r=e[n],i=r.attrIndex("href");if(i>=0){const e=r.attrs[i][1];r.attrs[i][1]=(0,m.bi)(window.location.href,e)}return t(e,n,s,o,a)}}),(0,h.Rh)(f,x.pC)},24659(e,t,n){var s=n(22022);n.d(t,["K",0,()=>{const{t:e}=(0,s.Bd)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])},60840(e){e.exports="data:image/svg+xml,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27 version=%271.1%27 aria-hidden=%27true%27><path fill-rule=%27evenodd%27 d=%27M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z%27></path></svg>"}}]);