tianxincode 1.0.52 → 1.0.53
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.
- package/dist/config/tx.config.js +1 -1
- package/dist/config/tx.config.js.map +1 -1
- package/dist/core/ai/agents/plan/plan.agent.d.ts.map +1 -1
- package/dist/core/ai/agents/plan/plan.agent.js +5 -27
- package/dist/core/ai/agents/plan/plan.agent.js.map +1 -1
- package/dist/core/ai/agents/plan/rewrite_user_message.d.ts +23 -0
- package/dist/core/ai/agents/plan/rewrite_user_message.d.ts.map +1 -0
- package/dist/core/ai/agents/plan/rewrite_user_message.js +54 -0
- package/dist/core/ai/agents/plan/rewrite_user_message.js.map +1 -0
- package/dist/gateway/api/project/delete_project.d.ts +3 -0
- package/dist/gateway/api/project/delete_project.d.ts.map +1 -0
- package/dist/gateway/api/project/delete_project.js +9 -0
- package/dist/gateway/api/project/delete_project.js.map +1 -0
- package/dist/gateway/api/project/project_routes.d.ts.map +1 -1
- package/dist/gateway/api/project/project_routes.js +2 -0
- package/dist/gateway/api/project/project_routes.js.map +1 -1
- package/package.json +1 -1
- package/web/dist/assets/PcLayout-ZXjT7WP9.js +1 -0
- package/web/dist/assets/{aiLogsView-i3_vXGdn.js → aiLogsView-B1Xv86FO.js} +1 -1
- package/web/dist/assets/{cssMode-tnR9zH52.js → cssMode-BFNigYrU.js} +1 -1
- package/web/dist/assets/{customActionsView-IPBMHLn5.js → customActionsView-BFZzvWXk.js} +1 -1
- package/web/dist/assets/{deployView-6_rjjo9r.js → deployView-BV8JVWE5.js} +1 -1
- package/web/dist/assets/{designView-cX2Hqfh8.js → designView-_qXRJlPw.js} +1 -1
- package/web/dist/assets/{devWorkflowView-U4v8ICoZ.js → devWorkflowView-CPJuckoU.js} +1 -1
- package/web/dist/assets/{devWorkflowViewApp-CKSoqveu.js → devWorkflowViewApp-394d9AlG.js} +1 -1
- package/web/dist/assets/{fileZihao-0UKigAgL.js → fileZihao-Chayeahb.js} +1 -1
- package/web/dist/assets/{freemarker2-BNOihskA.js → freemarker2-ByywVFhB.js} +1 -1
- package/web/dist/assets/{gitChanges-B9i4hT7g.js → gitChanges-Bcc9Ioc7.js} +1 -1
- package/web/dist/assets/{gitChangesApp-o1xUwMZ_.js → gitChangesApp-CRVkFMef.js} +1 -1
- package/web/dist/assets/{handlebars-Cb8pQLEG.js → handlebars-D-MvnLHF.js} +1 -1
- package/web/dist/assets/{html-dz4hh4wm.js → html-D5CJVQpa.js} +1 -1
- package/web/dist/assets/{htmlMode-3xfUPWXI.js → htmlMode-DaRvRPXz.js} +1 -1
- package/web/dist/assets/{index-D4gPOTeQ.js → index-BXyZNXwi.js} +8 -8
- package/web/dist/assets/{index-CGjQrgUT.css → index-BkRJ6vX6.css} +1 -1
- package/web/dist/assets/{javascript-uj2_iR-i.js → javascript-qiZQrKCd.js} +1 -1
- package/web/dist/assets/{jsonMode-BDztKq2p.js → jsonMode-BNOK_Lb2.js} +1 -1
- package/web/dist/assets/{liquid-DUnpHSIz.js → liquid-Cn4Vm_pv.js} +1 -1
- package/web/dist/assets/{mdx-WsmL_lUc.js → mdx-BZzvCzBz.js} +1 -1
- package/web/dist/assets/{mediaChat-D2KhvNIU.js → mediaChat-Cb8y-RVH.js} +1 -1
- package/web/dist/assets/{python-Wb66FUL_.js → python-BLKhgdt7.js} +1 -1
- package/web/dist/assets/{razor-BwputI7B.js → razor-DAh-8Vt3.js} +1 -1
- package/web/dist/assets/{taskView-BlSL_Dow.js → taskView-CJ1d1bfR.js} +1 -1
- package/web/dist/assets/{terminalView-D9LlaS3g.js → terminalView-0Gixm1yH.js} +1 -1
- package/web/dist/assets/{tsMode-uciq4wdD.js → tsMode-Ctez2MnL.js} +1 -1
- package/web/dist/assets/{typescript-wGuBgZrd.js → typescript-uKzlDE9T.js} +1 -1
- package/web/dist/assets/{wikiView-DDMiaAjr.js → wikiView-BAnnCorX.js} +1 -1
- package/web/dist/assets/{xml-D11j9Yzn.js → xml-1Z_L4vw8.js} +1 -1
- package/web/dist/assets/{yaml-2oQqXFU-.js → yaml-Cf9kIOyW.js} +1 -1
- package/web/dist/index.html +2 -2
- package/txcode/release/release-zihao/node-zihao.js +0 -291
- package/txcode/release/release-zihao/package.json +0 -3
- package/txcode/skills/llm-wiki/validate-menu.js +0 -148
- package/web/dist/assets/PcLayout-DEP-5oVL.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/javascript-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/javascript-qiZQrKCd.js","assets/typescript-uKzlDE9T.js","assets/gitChangesApp-CRVkFMef.js","assets/gitChangesApp-Bjn-MCmr.css","assets/devWorkflowViewApp-394d9AlG.js","assets/devWorkflowViewApp-CErbhC2s.css","assets/PcLayout-ZXjT7WP9.js","assets/PcLayout-CYW3zqcs.css","assets/terminalView-0Gixm1yH.js","assets/terminalView-eZ0agsPP.css","assets/devWorkflowView-CPJuckoU.js","assets/mediaChat-Cb8y-RVH.js","assets/devWorkflowView-TXy6mQ6E.css","assets/wikiView-BAnnCorX.js","assets/wikiView-B-OhVpHv.css","assets/deployView-BV8JVWE5.js","assets/deployView-CD7ji9IS.css","assets/designView-_qXRJlPw.js","assets/designView-BjjT_eB5.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
var ADe=Object.defineProperty;var FDe=(s,e,t)=>e in s?ADe(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var ui=(s,e,t)=>FDe(s,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const r of n)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(n){const r={};return n.integrity&&(r.integrity=n.integrity),n.referrerPolicy&&(r.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?r.credentials="include":n.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(n){if(n.ep)return;n.ep=!0;const r=t(n);fetch(n.href,r)}})();var BDe={};/*!
|
|
3
3
|
* Vue.js v2.7.16
|
|
4
4
|
* (c) 2014-2023 Evan You
|
|
@@ -803,27 +803,27 @@ ${e.toString()}`}}class O5{constructor(e=new Ux,t=!1,i,n=uqe){this._services=e,t
|
|
|
803
803
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
804
804
|
* Released under the MIT license
|
|
805
805
|
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
806
|
-
*-----------------------------------------------------------------------------*/var pJe=Object.defineProperty,mJe=Object.getOwnPropertyDescriptor,_Je=Object.getOwnPropertyNames,vJe=Object.prototype.hasOwnProperty,bJe=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of _Je(e))!vJe.call(s,n)&&n!==t&&pJe(s,n,{get:()=>e[n],enumerable:!(i=mJe(e,n))||i.enumerable});return s},CJe=(s,e,t)=>(bJe(s,e,"default"),t),GD={};CJe(GD,jN);var Q1e={},mj={},yJe=class J1e{static getOrCreate(e){return mj[e]||(mj[e]=new J1e(e)),mj[e]}constructor(e){this._languageId=e,this._loadingTriggered=!1,this._lazyLoadPromise=new Promise((t,i)=>{this._lazyLoadPromiseResolve=t,this._lazyLoadPromiseReject=i})}load(){return this._loadingTriggered||(this._loadingTriggered=!0,Q1e[this._languageId].loader().then(e=>this._lazyLoadPromiseResolve(e),e=>this._lazyLoadPromiseReject(e))),this._lazyLoadPromise}};function vt(s){const e=s.id;Q1e[e]=s,GD.languages.register(s);const t=yJe.getOrCreate(e);GD.languages.registerTokensProviderFactory(e,{create:async()=>(await t.load()).language}),GD.languages.onLanguageEncountered(e,async()=>{const i=await t.load();GD.languages.setLanguageConfiguration(e,i.conf)})}vt({id:"abap",extensions:[".abap"],aliases:["abap","ABAP"],loader:()=>rt(()=>import("./abap-BrgZPUOV.js"),[])});vt({id:"apex",extensions:[".cls"],aliases:["Apex","apex"],mimetypes:["text/x-apex-source","text/x-apex"],loader:()=>rt(()=>import("./apex-DyP6w7ZV.js"),[])});vt({id:"azcli",extensions:[".azcli"],aliases:["Azure CLI","azcli"],loader:()=>rt(()=>import("./azcli-BaLxmfj-.js"),[])});vt({id:"bat",extensions:[".bat",".cmd"],aliases:["Batch","bat"],loader:()=>rt(()=>import("./bat-CFOPXBzS.js"),[])});vt({id:"bicep",extensions:[".bicep"],aliases:["Bicep"],loader:()=>rt(()=>import("./bicep-BfEKNvv3.js"),[])});vt({id:"cameligo",extensions:[".mligo"],aliases:["Cameligo"],loader:()=>rt(()=>import("./cameligo-BFG1Mk7z.js"),[])});vt({id:"clojure",extensions:[".clj",".cljs",".cljc",".edn"],aliases:["clojure","Clojure"],loader:()=>rt(()=>import("./clojure-DTECt2xU.js"),[])});vt({id:"coffeescript",extensions:[".coffee"],aliases:["CoffeeScript","coffeescript","coffee"],mimetypes:["text/x-coffeescript","text/coffeescript"],loader:()=>rt(()=>import("./coffee-CDGzqUPQ.js"),[])});vt({id:"c",extensions:[".c",".h"],aliases:["C","c"],loader:()=>rt(()=>import("./cpp-CLLBncYj.js"),[])});vt({id:"cpp",extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx"],aliases:["C++","Cpp","cpp"],loader:()=>rt(()=>import("./cpp-CLLBncYj.js"),[])});vt({id:"csharp",extensions:[".cs",".csx",".cake"],aliases:["C#","csharp"],loader:()=>rt(()=>import("./csharp-dUCx_-0o.js"),[])});vt({id:"csp",extensions:[".csp"],aliases:["CSP","csp"],loader:()=>rt(()=>import("./csp-5Rap-vPy.js"),[])});vt({id:"css",extensions:[".css"],aliases:["CSS","css"],mimetypes:["text/css"],loader:()=>rt(()=>import("./css-D3h14YRZ.js"),[])});vt({id:"cypher",extensions:[".cypher",".cyp"],aliases:["Cypher","OpenCypher"],loader:()=>rt(()=>import("./cypher-DrQuvNYM.js"),[])});vt({id:"dart",extensions:[".dart"],aliases:["Dart","dart"],mimetypes:["text/x-dart-source","text/x-dart"],loader:()=>rt(()=>import("./dart-CFKIUWau.js"),[])});vt({id:"dockerfile",extensions:[".dockerfile"],filenames:["Dockerfile"],aliases:["Dockerfile"],loader:()=>rt(()=>import("./dockerfile-Zznr-cwX.js"),[])});vt({id:"ecl",extensions:[".ecl"],aliases:["ECL","Ecl","ecl"],loader:()=>rt(()=>import("./ecl-Ce3n6wWz.js"),[])});vt({id:"elixir",extensions:[".ex",".exs"],aliases:["Elixir","elixir","ex"],loader:()=>rt(()=>import("./elixir-deUWdS0T.js"),[])});vt({id:"flow9",extensions:[".flow"],aliases:["Flow9","Flow","flow9","flow"],loader:()=>rt(()=>import("./flow9-i9-g7ZhI.js"),[])});vt({id:"fsharp",extensions:[".fs",".fsi",".ml",".mli",".fsx",".fsscript"],aliases:["F#","FSharp","fsharp"],loader:()=>rt(()=>import("./fsharp-CzKuDChf.js"),[])});vt({id:"freemarker2",extensions:[".ftl",".ftlh",".ftlx"],aliases:["FreeMarker2","Apache FreeMarker2"],loader:()=>rt(()=>import("./freemarker2-BNOihskA.js"),[]).then(s=>s.TagAutoInterpolationDollar)});vt({id:"freemarker2.tag-angle.interpolation-dollar",aliases:["FreeMarker2 (Angle/Dollar)","Apache FreeMarker2 (Angle/Dollar)"],loader:()=>rt(()=>import("./freemarker2-BNOihskA.js"),[]).then(s=>s.TagAngleInterpolationDollar)});vt({id:"freemarker2.tag-bracket.interpolation-dollar",aliases:["FreeMarker2 (Bracket/Dollar)","Apache FreeMarker2 (Bracket/Dollar)"],loader:()=>rt(()=>import("./freemarker2-BNOihskA.js"),[]).then(s=>s.TagBracketInterpolationDollar)});vt({id:"freemarker2.tag-angle.interpolation-bracket",aliases:["FreeMarker2 (Angle/Bracket)","Apache FreeMarker2 (Angle/Bracket)"],loader:()=>rt(()=>import("./freemarker2-BNOihskA.js"),[]).then(s=>s.TagAngleInterpolationBracket)});vt({id:"freemarker2.tag-bracket.interpolation-bracket",aliases:["FreeMarker2 (Bracket/Bracket)","Apache FreeMarker2 (Bracket/Bracket)"],loader:()=>rt(()=>import("./freemarker2-BNOihskA.js"),[]).then(s=>s.TagBracketInterpolationBracket)});vt({id:"freemarker2.tag-auto.interpolation-dollar",aliases:["FreeMarker2 (Auto/Dollar)","Apache FreeMarker2 (Auto/Dollar)"],loader:()=>rt(()=>import("./freemarker2-BNOihskA.js"),[]).then(s=>s.TagAutoInterpolationDollar)});vt({id:"freemarker2.tag-auto.interpolation-bracket",aliases:["FreeMarker2 (Auto/Bracket)","Apache FreeMarker2 (Auto/Bracket)"],loader:()=>rt(()=>import("./freemarker2-BNOihskA.js"),[]).then(s=>s.TagAutoInterpolationBracket)});vt({id:"go",extensions:[".go"],aliases:["Go"],loader:()=>rt(()=>import("./go-Cphgjts3.js"),[])});vt({id:"graphql",extensions:[".graphql",".gql"],aliases:["GraphQL","graphql","gql"],mimetypes:["application/graphql"],loader:()=>rt(()=>import("./graphql-Cg7bfA9N.js"),[])});vt({id:"handlebars",extensions:[".handlebars",".hbs"],aliases:["Handlebars","handlebars","hbs"],mimetypes:["text/x-handlebars-template"],loader:()=>rt(()=>import("./handlebars-Cb8pQLEG.js"),[])});vt({id:"hcl",extensions:[".tf",".tfvars",".hcl"],aliases:["Terraform","tf","HCL","hcl"],loader:()=>rt(()=>import("./hcl-0cvrggvQ.js"),[])});vt({id:"html",extensions:[".html",".htm",".shtml",".xhtml",".mdoc",".jsp",".asp",".aspx",".jshtm"],aliases:["HTML","htm","html","xhtml"],mimetypes:["text/html","text/x-jshtm","text/template","text/ng-template"],loader:()=>rt(()=>import("./html-dz4hh4wm.js"),[])});vt({id:"ini",extensions:[".ini",".properties",".gitconfig"],filenames:["config",".gitattributes",".gitconfig",".editorconfig"],aliases:["Ini","ini"],loader:()=>rt(()=>import("./ini-Drc7WvVn.js"),[])});vt({id:"java",extensions:[".java",".jav"],aliases:["Java","java"],mimetypes:["text/x-java-source","text/x-java"],loader:()=>rt(()=>import("./java-B_fMsGYe.js"),[])});vt({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>rt(()=>import("./javascript-uj2_iR-i.js"),__vite__mapDeps([0,1]))});vt({id:"julia",extensions:[".jl"],aliases:["julia","Julia"],loader:()=>rt(()=>import("./julia-Bqgm2twL.js"),[])});vt({id:"kotlin",extensions:[".kt",".kts"],aliases:["Kotlin","kotlin"],mimetypes:["text/x-kotlin-source","text/x-kotlin"],loader:()=>rt(()=>import("./kotlin-BSkB5QuD.js"),[])});vt({id:"less",extensions:[".less"],aliases:["Less","less"],mimetypes:["text/x-less","text/less"],loader:()=>rt(()=>import("./less-BsTHnhdd.js"),[])});vt({id:"lexon",extensions:[".lex"],aliases:["Lexon"],loader:()=>rt(()=>import("./lexon-YWi4-JPR.js"),[])});vt({id:"lua",extensions:[".lua"],aliases:["Lua","lua"],loader:()=>rt(()=>import("./lua-nf6ki56Z.js"),[])});vt({id:"liquid",extensions:[".liquid",".html.liquid"],aliases:["Liquid","liquid"],mimetypes:["application/liquid"],loader:()=>rt(()=>import("./liquid-DUnpHSIz.js"),[])});vt({id:"m3",extensions:[".m3",".i3",".mg",".ig"],aliases:["Modula-3","Modula3","modula3","m3"],loader:()=>rt(()=>import("./m3-Cpb6xl2v.js"),[])});vt({id:"markdown",extensions:[".md",".markdown",".mdown",".mkdn",".mkd",".mdwn",".mdtxt",".mdtext"],aliases:["Markdown","markdown"],loader:()=>rt(()=>import("./markdown-DSZPf7rp.js"),[])});vt({id:"mdx",extensions:[".mdx"],aliases:["MDX","mdx"],loader:()=>rt(()=>import("./mdx-WsmL_lUc.js"),[])});vt({id:"mips",extensions:[".s"],aliases:["MIPS","MIPS-V"],mimetypes:["text/x-mips","text/mips","text/plaintext"],loader:()=>rt(()=>import("./mips-B_c3zf-v.js"),[])});vt({id:"msdax",extensions:[".dax",".msdax"],aliases:["DAX","MSDAX"],loader:()=>rt(()=>import("./msdax-rUNN04Wq.js"),[])});vt({id:"mysql",extensions:[],aliases:["MySQL","mysql"],loader:()=>rt(()=>import("./mysql-DDwshQtU.js"),[])});vt({id:"objective-c",extensions:[".m"],aliases:["Objective-C"],loader:()=>rt(()=>import("./objective-c-B5zXfXm9.js"),[])});vt({id:"pascal",extensions:[".pas",".p",".pp"],aliases:["Pascal","pas"],mimetypes:["text/x-pascal-source","text/x-pascal"],loader:()=>rt(()=>import("./pascal-CXOwvkN_.js"),[])});vt({id:"pascaligo",extensions:[".ligo"],aliases:["Pascaligo","ligo"],loader:()=>rt(()=>import("./pascaligo-Bc-ZgV77.js"),[])});vt({id:"perl",extensions:[".pl",".pm"],aliases:["Perl","pl"],loader:()=>rt(()=>import("./perl-CwNk8-XU.js"),[])});vt({id:"pgsql",extensions:[],aliases:["PostgreSQL","postgres","pg","postgre"],loader:()=>rt(()=>import("./pgsql-tGk8EFnU.js"),[])});vt({id:"php",extensions:[".php",".php4",".php5",".phtml",".ctp"],aliases:["PHP","php"],mimetypes:["application/x-php"],loader:()=>rt(()=>import("./php-CpIb_Oan.js"),[])});vt({id:"pla",extensions:[".pla"],loader:()=>rt(()=>import("./pla-B03wrqEc.js"),[])});vt({id:"postiats",extensions:[".dats",".sats",".hats"],aliases:["ATS","ATS/Postiats"],loader:()=>rt(()=>import("./postiats-BKlk5iyT.js"),[])});vt({id:"powerquery",extensions:[".pq",".pqm"],aliases:["PQ","M","Power Query","Power Query M"],loader:()=>rt(()=>import("./powerquery-Bhzvs7bI.js"),[])});vt({id:"powershell",extensions:[".ps1",".psm1",".psd1"],aliases:["PowerShell","powershell","ps","ps1"],loader:()=>rt(()=>import("./powershell-Dd3NCNK9.js"),[])});vt({id:"proto",extensions:[".proto"],aliases:["protobuf","Protocol Buffers"],loader:()=>rt(()=>import("./protobuf-COyEY5Pt.js"),[])});vt({id:"pug",extensions:[".jade",".pug"],aliases:["Pug","Jade","jade"],loader:()=>rt(()=>import("./pug-BaJupSGV.js"),[])});vt({id:"python",extensions:[".py",".rpy",".pyw",".cpy",".gyp",".gypi"],aliases:["Python","py"],firstLine:"^#!/.*\\bpython[0-9.-]*\\b",loader:()=>rt(()=>import("./python-Wb66FUL_.js"),[])});vt({id:"qsharp",extensions:[".qs"],aliases:["Q#","qsharp"],loader:()=>rt(()=>import("./qsharp-DXyYeYxl.js"),[])});vt({id:"r",extensions:[".r",".rhistory",".rmd",".rprofile",".rt"],aliases:["R","r"],loader:()=>rt(()=>import("./r-CdQndTaG.js"),[])});vt({id:"razor",extensions:[".cshtml"],aliases:["Razor","razor"],mimetypes:["text/x-cshtml"],loader:()=>rt(()=>import("./razor-BwputI7B.js"),[])});vt({id:"redis",extensions:[".redis"],aliases:["redis"],loader:()=>rt(()=>import("./redis-CVwtpugi.js"),[])});vt({id:"redshift",extensions:[],aliases:["Redshift","redshift"],loader:()=>rt(()=>import("./redshift-25W9uPmb.js"),[])});vt({id:"restructuredtext",extensions:[".rst"],aliases:["reStructuredText","restructuredtext"],loader:()=>rt(()=>import("./restructuredtext-DfzH4Xui.js"),[])});vt({id:"ruby",extensions:[".rb",".rbx",".rjs",".gemspec",".pp"],filenames:["rakefile","Gemfile"],aliases:["Ruby","rb"],loader:()=>rt(()=>import("./ruby-Cp1zYvxS.js"),[])});vt({id:"rust",extensions:[".rs",".rlib"],aliases:["Rust","rust"],loader:()=>rt(()=>import("./rust-D5C2fndG.js"),[])});vt({id:"sb",extensions:[".sb"],aliases:["Small Basic","sb"],loader:()=>rt(()=>import("./sb-CDntyWJ8.js"),[])});vt({id:"scala",extensions:[".scala",".sc",".sbt"],aliases:["Scala","scala","SBT","Sbt","sbt","Dotty","dotty"],mimetypes:["text/x-scala-source","text/x-scala","text/x-sbt","text/x-dotty"],loader:()=>rt(()=>import("./scala-BoFRg7Ot.js"),[])});vt({id:"scheme",extensions:[".scm",".ss",".sch",".rkt"],aliases:["scheme","Scheme"],loader:()=>rt(()=>import("./scheme-Bio4gycK.js"),[])});vt({id:"scss",extensions:[".scss"],aliases:["Sass","sass","scss"],mimetypes:["text/x-scss","text/scss"],loader:()=>rt(()=>import("./scss-4Ik7cdeQ.js"),[])});vt({id:"shell",extensions:[".sh",".bash"],aliases:["Shell","sh"],loader:()=>rt(()=>import("./shell-CX-rkNHf.js"),[])});vt({id:"sol",extensions:[".sol"],aliases:["sol","solidity","Solidity"],loader:()=>rt(()=>import("./solidity-Tw7wswEv.js"),[])});vt({id:"aes",extensions:[".aes"],aliases:["aes","sophia","Sophia"],loader:()=>rt(()=>import("./sophia-C5WLch3f.js"),[])});vt({id:"sparql",extensions:[".rq"],aliases:["sparql","SPARQL"],loader:()=>rt(()=>import("./sparql-DHaeiCBh.js"),[])});vt({id:"sql",extensions:[".sql"],aliases:["SQL"],loader:()=>rt(()=>import("./sql-CCSDG5nI.js"),[])});vt({id:"st",extensions:[".st",".iecst",".iecplc",".lc3lib",".TcPOU",".TcDUT",".TcGVL",".TcIO"],aliases:["StructuredText","scl","stl"],loader:()=>rt(()=>import("./st-pnP8ivHi.js"),[])});vt({id:"swift",aliases:["Swift","swift"],extensions:[".swift"],mimetypes:["text/swift"],loader:()=>rt(()=>import("./swift-DwJ7jVG9.js"),[])});vt({id:"systemverilog",extensions:[".sv",".svh"],aliases:["SV","sv","SystemVerilog","systemverilog"],loader:()=>rt(()=>import("./systemverilog-B9Xyijhd.js"),[])});vt({id:"verilog",extensions:[".v",".vh"],aliases:["V","v","Verilog","verilog"],loader:()=>rt(()=>import("./systemverilog-B9Xyijhd.js"),[])});vt({id:"tcl",extensions:[".tcl"],aliases:["tcl","Tcl","tcltk","TclTk","tcl/tk","Tcl/Tk"],loader:()=>rt(()=>import("./tcl-DnHyzjbg.js"),[])});vt({id:"twig",extensions:[".twig"],aliases:["Twig","twig"],mimetypes:["text/x-twig"],loader:()=>rt(()=>import("./twig-CPajHgWi.js"),[])});vt({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>rt(()=>import("./typescript-wGuBgZrd.js"),[])});vt({id:"typespec",extensions:[".tsp"],aliases:["TypeSpec"],loader:()=>rt(()=>import("./typespec-D-MeaMDU.js"),[])});vt({id:"vb",extensions:[".vb"],aliases:["Visual Basic","vb"],loader:()=>rt(()=>import("./vb-DgyLZaXg.js"),[])});vt({id:"wgsl",extensions:[".wgsl"],aliases:["WebGPU Shading Language","WGSL","wgsl"],loader:()=>rt(()=>import("./wgsl-BIv9DU6q.js"),[])});vt({id:"xml",extensions:[".xml",".xsd",".dtd",".ascx",".csproj",".config",".props",".targets",".wxi",".wxl",".wxs",".xaml",".svg",".svgz",".opf",".xslt",".xsl"],firstLine:"(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)",aliases:["XML","xml"],mimetypes:["text/xml","application/xml","application/xaml+xml","application/xml-dtd"],loader:()=>rt(()=>import("./xml-D11j9Yzn.js"),[])});vt({id:"yaml",extensions:[".yaml",".yml"],aliases:["YAML","yaml","YML","yml"],mimetypes:["application/x-yaml","text/x-yaml"],loader:()=>rt(()=>import("./yaml-2oQqXFU-.js"),[])});/*!-----------------------------------------------------------------------------
|
|
806
|
+
*-----------------------------------------------------------------------------*/var pJe=Object.defineProperty,mJe=Object.getOwnPropertyDescriptor,_Je=Object.getOwnPropertyNames,vJe=Object.prototype.hasOwnProperty,bJe=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of _Je(e))!vJe.call(s,n)&&n!==t&&pJe(s,n,{get:()=>e[n],enumerable:!(i=mJe(e,n))||i.enumerable});return s},CJe=(s,e,t)=>(bJe(s,e,"default"),t),GD={};CJe(GD,jN);var Q1e={},mj={},yJe=class J1e{static getOrCreate(e){return mj[e]||(mj[e]=new J1e(e)),mj[e]}constructor(e){this._languageId=e,this._loadingTriggered=!1,this._lazyLoadPromise=new Promise((t,i)=>{this._lazyLoadPromiseResolve=t,this._lazyLoadPromiseReject=i})}load(){return this._loadingTriggered||(this._loadingTriggered=!0,Q1e[this._languageId].loader().then(e=>this._lazyLoadPromiseResolve(e),e=>this._lazyLoadPromiseReject(e))),this._lazyLoadPromise}};function vt(s){const e=s.id;Q1e[e]=s,GD.languages.register(s);const t=yJe.getOrCreate(e);GD.languages.registerTokensProviderFactory(e,{create:async()=>(await t.load()).language}),GD.languages.onLanguageEncountered(e,async()=>{const i=await t.load();GD.languages.setLanguageConfiguration(e,i.conf)})}vt({id:"abap",extensions:[".abap"],aliases:["abap","ABAP"],loader:()=>rt(()=>import("./abap-BrgZPUOV.js"),[])});vt({id:"apex",extensions:[".cls"],aliases:["Apex","apex"],mimetypes:["text/x-apex-source","text/x-apex"],loader:()=>rt(()=>import("./apex-DyP6w7ZV.js"),[])});vt({id:"azcli",extensions:[".azcli"],aliases:["Azure CLI","azcli"],loader:()=>rt(()=>import("./azcli-BaLxmfj-.js"),[])});vt({id:"bat",extensions:[".bat",".cmd"],aliases:["Batch","bat"],loader:()=>rt(()=>import("./bat-CFOPXBzS.js"),[])});vt({id:"bicep",extensions:[".bicep"],aliases:["Bicep"],loader:()=>rt(()=>import("./bicep-BfEKNvv3.js"),[])});vt({id:"cameligo",extensions:[".mligo"],aliases:["Cameligo"],loader:()=>rt(()=>import("./cameligo-BFG1Mk7z.js"),[])});vt({id:"clojure",extensions:[".clj",".cljs",".cljc",".edn"],aliases:["clojure","Clojure"],loader:()=>rt(()=>import("./clojure-DTECt2xU.js"),[])});vt({id:"coffeescript",extensions:[".coffee"],aliases:["CoffeeScript","coffeescript","coffee"],mimetypes:["text/x-coffeescript","text/coffeescript"],loader:()=>rt(()=>import("./coffee-CDGzqUPQ.js"),[])});vt({id:"c",extensions:[".c",".h"],aliases:["C","c"],loader:()=>rt(()=>import("./cpp-CLLBncYj.js"),[])});vt({id:"cpp",extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx"],aliases:["C++","Cpp","cpp"],loader:()=>rt(()=>import("./cpp-CLLBncYj.js"),[])});vt({id:"csharp",extensions:[".cs",".csx",".cake"],aliases:["C#","csharp"],loader:()=>rt(()=>import("./csharp-dUCx_-0o.js"),[])});vt({id:"csp",extensions:[".csp"],aliases:["CSP","csp"],loader:()=>rt(()=>import("./csp-5Rap-vPy.js"),[])});vt({id:"css",extensions:[".css"],aliases:["CSS","css"],mimetypes:["text/css"],loader:()=>rt(()=>import("./css-D3h14YRZ.js"),[])});vt({id:"cypher",extensions:[".cypher",".cyp"],aliases:["Cypher","OpenCypher"],loader:()=>rt(()=>import("./cypher-DrQuvNYM.js"),[])});vt({id:"dart",extensions:[".dart"],aliases:["Dart","dart"],mimetypes:["text/x-dart-source","text/x-dart"],loader:()=>rt(()=>import("./dart-CFKIUWau.js"),[])});vt({id:"dockerfile",extensions:[".dockerfile"],filenames:["Dockerfile"],aliases:["Dockerfile"],loader:()=>rt(()=>import("./dockerfile-Zznr-cwX.js"),[])});vt({id:"ecl",extensions:[".ecl"],aliases:["ECL","Ecl","ecl"],loader:()=>rt(()=>import("./ecl-Ce3n6wWz.js"),[])});vt({id:"elixir",extensions:[".ex",".exs"],aliases:["Elixir","elixir","ex"],loader:()=>rt(()=>import("./elixir-deUWdS0T.js"),[])});vt({id:"flow9",extensions:[".flow"],aliases:["Flow9","Flow","flow9","flow"],loader:()=>rt(()=>import("./flow9-i9-g7ZhI.js"),[])});vt({id:"fsharp",extensions:[".fs",".fsi",".ml",".mli",".fsx",".fsscript"],aliases:["F#","FSharp","fsharp"],loader:()=>rt(()=>import("./fsharp-CzKuDChf.js"),[])});vt({id:"freemarker2",extensions:[".ftl",".ftlh",".ftlx"],aliases:["FreeMarker2","Apache FreeMarker2"],loader:()=>rt(()=>import("./freemarker2-ByywVFhB.js"),[]).then(s=>s.TagAutoInterpolationDollar)});vt({id:"freemarker2.tag-angle.interpolation-dollar",aliases:["FreeMarker2 (Angle/Dollar)","Apache FreeMarker2 (Angle/Dollar)"],loader:()=>rt(()=>import("./freemarker2-ByywVFhB.js"),[]).then(s=>s.TagAngleInterpolationDollar)});vt({id:"freemarker2.tag-bracket.interpolation-dollar",aliases:["FreeMarker2 (Bracket/Dollar)","Apache FreeMarker2 (Bracket/Dollar)"],loader:()=>rt(()=>import("./freemarker2-ByywVFhB.js"),[]).then(s=>s.TagBracketInterpolationDollar)});vt({id:"freemarker2.tag-angle.interpolation-bracket",aliases:["FreeMarker2 (Angle/Bracket)","Apache FreeMarker2 (Angle/Bracket)"],loader:()=>rt(()=>import("./freemarker2-ByywVFhB.js"),[]).then(s=>s.TagAngleInterpolationBracket)});vt({id:"freemarker2.tag-bracket.interpolation-bracket",aliases:["FreeMarker2 (Bracket/Bracket)","Apache FreeMarker2 (Bracket/Bracket)"],loader:()=>rt(()=>import("./freemarker2-ByywVFhB.js"),[]).then(s=>s.TagBracketInterpolationBracket)});vt({id:"freemarker2.tag-auto.interpolation-dollar",aliases:["FreeMarker2 (Auto/Dollar)","Apache FreeMarker2 (Auto/Dollar)"],loader:()=>rt(()=>import("./freemarker2-ByywVFhB.js"),[]).then(s=>s.TagAutoInterpolationDollar)});vt({id:"freemarker2.tag-auto.interpolation-bracket",aliases:["FreeMarker2 (Auto/Bracket)","Apache FreeMarker2 (Auto/Bracket)"],loader:()=>rt(()=>import("./freemarker2-ByywVFhB.js"),[]).then(s=>s.TagAutoInterpolationBracket)});vt({id:"go",extensions:[".go"],aliases:["Go"],loader:()=>rt(()=>import("./go-Cphgjts3.js"),[])});vt({id:"graphql",extensions:[".graphql",".gql"],aliases:["GraphQL","graphql","gql"],mimetypes:["application/graphql"],loader:()=>rt(()=>import("./graphql-Cg7bfA9N.js"),[])});vt({id:"handlebars",extensions:[".handlebars",".hbs"],aliases:["Handlebars","handlebars","hbs"],mimetypes:["text/x-handlebars-template"],loader:()=>rt(()=>import("./handlebars-D-MvnLHF.js"),[])});vt({id:"hcl",extensions:[".tf",".tfvars",".hcl"],aliases:["Terraform","tf","HCL","hcl"],loader:()=>rt(()=>import("./hcl-0cvrggvQ.js"),[])});vt({id:"html",extensions:[".html",".htm",".shtml",".xhtml",".mdoc",".jsp",".asp",".aspx",".jshtm"],aliases:["HTML","htm","html","xhtml"],mimetypes:["text/html","text/x-jshtm","text/template","text/ng-template"],loader:()=>rt(()=>import("./html-D5CJVQpa.js"),[])});vt({id:"ini",extensions:[".ini",".properties",".gitconfig"],filenames:["config",".gitattributes",".gitconfig",".editorconfig"],aliases:["Ini","ini"],loader:()=>rt(()=>import("./ini-Drc7WvVn.js"),[])});vt({id:"java",extensions:[".java",".jav"],aliases:["Java","java"],mimetypes:["text/x-java-source","text/x-java"],loader:()=>rt(()=>import("./java-B_fMsGYe.js"),[])});vt({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>rt(()=>import("./javascript-qiZQrKCd.js"),__vite__mapDeps([0,1]))});vt({id:"julia",extensions:[".jl"],aliases:["julia","Julia"],loader:()=>rt(()=>import("./julia-Bqgm2twL.js"),[])});vt({id:"kotlin",extensions:[".kt",".kts"],aliases:["Kotlin","kotlin"],mimetypes:["text/x-kotlin-source","text/x-kotlin"],loader:()=>rt(()=>import("./kotlin-BSkB5QuD.js"),[])});vt({id:"less",extensions:[".less"],aliases:["Less","less"],mimetypes:["text/x-less","text/less"],loader:()=>rt(()=>import("./less-BsTHnhdd.js"),[])});vt({id:"lexon",extensions:[".lex"],aliases:["Lexon"],loader:()=>rt(()=>import("./lexon-YWi4-JPR.js"),[])});vt({id:"lua",extensions:[".lua"],aliases:["Lua","lua"],loader:()=>rt(()=>import("./lua-nf6ki56Z.js"),[])});vt({id:"liquid",extensions:[".liquid",".html.liquid"],aliases:["Liquid","liquid"],mimetypes:["application/liquid"],loader:()=>rt(()=>import("./liquid-Cn4Vm_pv.js"),[])});vt({id:"m3",extensions:[".m3",".i3",".mg",".ig"],aliases:["Modula-3","Modula3","modula3","m3"],loader:()=>rt(()=>import("./m3-Cpb6xl2v.js"),[])});vt({id:"markdown",extensions:[".md",".markdown",".mdown",".mkdn",".mkd",".mdwn",".mdtxt",".mdtext"],aliases:["Markdown","markdown"],loader:()=>rt(()=>import("./markdown-DSZPf7rp.js"),[])});vt({id:"mdx",extensions:[".mdx"],aliases:["MDX","mdx"],loader:()=>rt(()=>import("./mdx-BZzvCzBz.js"),[])});vt({id:"mips",extensions:[".s"],aliases:["MIPS","MIPS-V"],mimetypes:["text/x-mips","text/mips","text/plaintext"],loader:()=>rt(()=>import("./mips-B_c3zf-v.js"),[])});vt({id:"msdax",extensions:[".dax",".msdax"],aliases:["DAX","MSDAX"],loader:()=>rt(()=>import("./msdax-rUNN04Wq.js"),[])});vt({id:"mysql",extensions:[],aliases:["MySQL","mysql"],loader:()=>rt(()=>import("./mysql-DDwshQtU.js"),[])});vt({id:"objective-c",extensions:[".m"],aliases:["Objective-C"],loader:()=>rt(()=>import("./objective-c-B5zXfXm9.js"),[])});vt({id:"pascal",extensions:[".pas",".p",".pp"],aliases:["Pascal","pas"],mimetypes:["text/x-pascal-source","text/x-pascal"],loader:()=>rt(()=>import("./pascal-CXOwvkN_.js"),[])});vt({id:"pascaligo",extensions:[".ligo"],aliases:["Pascaligo","ligo"],loader:()=>rt(()=>import("./pascaligo-Bc-ZgV77.js"),[])});vt({id:"perl",extensions:[".pl",".pm"],aliases:["Perl","pl"],loader:()=>rt(()=>import("./perl-CwNk8-XU.js"),[])});vt({id:"pgsql",extensions:[],aliases:["PostgreSQL","postgres","pg","postgre"],loader:()=>rt(()=>import("./pgsql-tGk8EFnU.js"),[])});vt({id:"php",extensions:[".php",".php4",".php5",".phtml",".ctp"],aliases:["PHP","php"],mimetypes:["application/x-php"],loader:()=>rt(()=>import("./php-CpIb_Oan.js"),[])});vt({id:"pla",extensions:[".pla"],loader:()=>rt(()=>import("./pla-B03wrqEc.js"),[])});vt({id:"postiats",extensions:[".dats",".sats",".hats"],aliases:["ATS","ATS/Postiats"],loader:()=>rt(()=>import("./postiats-BKlk5iyT.js"),[])});vt({id:"powerquery",extensions:[".pq",".pqm"],aliases:["PQ","M","Power Query","Power Query M"],loader:()=>rt(()=>import("./powerquery-Bhzvs7bI.js"),[])});vt({id:"powershell",extensions:[".ps1",".psm1",".psd1"],aliases:["PowerShell","powershell","ps","ps1"],loader:()=>rt(()=>import("./powershell-Dd3NCNK9.js"),[])});vt({id:"proto",extensions:[".proto"],aliases:["protobuf","Protocol Buffers"],loader:()=>rt(()=>import("./protobuf-COyEY5Pt.js"),[])});vt({id:"pug",extensions:[".jade",".pug"],aliases:["Pug","Jade","jade"],loader:()=>rt(()=>import("./pug-BaJupSGV.js"),[])});vt({id:"python",extensions:[".py",".rpy",".pyw",".cpy",".gyp",".gypi"],aliases:["Python","py"],firstLine:"^#!/.*\\bpython[0-9.-]*\\b",loader:()=>rt(()=>import("./python-BLKhgdt7.js"),[])});vt({id:"qsharp",extensions:[".qs"],aliases:["Q#","qsharp"],loader:()=>rt(()=>import("./qsharp-DXyYeYxl.js"),[])});vt({id:"r",extensions:[".r",".rhistory",".rmd",".rprofile",".rt"],aliases:["R","r"],loader:()=>rt(()=>import("./r-CdQndTaG.js"),[])});vt({id:"razor",extensions:[".cshtml"],aliases:["Razor","razor"],mimetypes:["text/x-cshtml"],loader:()=>rt(()=>import("./razor-DAh-8Vt3.js"),[])});vt({id:"redis",extensions:[".redis"],aliases:["redis"],loader:()=>rt(()=>import("./redis-CVwtpugi.js"),[])});vt({id:"redshift",extensions:[],aliases:["Redshift","redshift"],loader:()=>rt(()=>import("./redshift-25W9uPmb.js"),[])});vt({id:"restructuredtext",extensions:[".rst"],aliases:["reStructuredText","restructuredtext"],loader:()=>rt(()=>import("./restructuredtext-DfzH4Xui.js"),[])});vt({id:"ruby",extensions:[".rb",".rbx",".rjs",".gemspec",".pp"],filenames:["rakefile","Gemfile"],aliases:["Ruby","rb"],loader:()=>rt(()=>import("./ruby-Cp1zYvxS.js"),[])});vt({id:"rust",extensions:[".rs",".rlib"],aliases:["Rust","rust"],loader:()=>rt(()=>import("./rust-D5C2fndG.js"),[])});vt({id:"sb",extensions:[".sb"],aliases:["Small Basic","sb"],loader:()=>rt(()=>import("./sb-CDntyWJ8.js"),[])});vt({id:"scala",extensions:[".scala",".sc",".sbt"],aliases:["Scala","scala","SBT","Sbt","sbt","Dotty","dotty"],mimetypes:["text/x-scala-source","text/x-scala","text/x-sbt","text/x-dotty"],loader:()=>rt(()=>import("./scala-BoFRg7Ot.js"),[])});vt({id:"scheme",extensions:[".scm",".ss",".sch",".rkt"],aliases:["scheme","Scheme"],loader:()=>rt(()=>import("./scheme-Bio4gycK.js"),[])});vt({id:"scss",extensions:[".scss"],aliases:["Sass","sass","scss"],mimetypes:["text/x-scss","text/scss"],loader:()=>rt(()=>import("./scss-4Ik7cdeQ.js"),[])});vt({id:"shell",extensions:[".sh",".bash"],aliases:["Shell","sh"],loader:()=>rt(()=>import("./shell-CX-rkNHf.js"),[])});vt({id:"sol",extensions:[".sol"],aliases:["sol","solidity","Solidity"],loader:()=>rt(()=>import("./solidity-Tw7wswEv.js"),[])});vt({id:"aes",extensions:[".aes"],aliases:["aes","sophia","Sophia"],loader:()=>rt(()=>import("./sophia-C5WLch3f.js"),[])});vt({id:"sparql",extensions:[".rq"],aliases:["sparql","SPARQL"],loader:()=>rt(()=>import("./sparql-DHaeiCBh.js"),[])});vt({id:"sql",extensions:[".sql"],aliases:["SQL"],loader:()=>rt(()=>import("./sql-CCSDG5nI.js"),[])});vt({id:"st",extensions:[".st",".iecst",".iecplc",".lc3lib",".TcPOU",".TcDUT",".TcGVL",".TcIO"],aliases:["StructuredText","scl","stl"],loader:()=>rt(()=>import("./st-pnP8ivHi.js"),[])});vt({id:"swift",aliases:["Swift","swift"],extensions:[".swift"],mimetypes:["text/swift"],loader:()=>rt(()=>import("./swift-DwJ7jVG9.js"),[])});vt({id:"systemverilog",extensions:[".sv",".svh"],aliases:["SV","sv","SystemVerilog","systemverilog"],loader:()=>rt(()=>import("./systemverilog-B9Xyijhd.js"),[])});vt({id:"verilog",extensions:[".v",".vh"],aliases:["V","v","Verilog","verilog"],loader:()=>rt(()=>import("./systemverilog-B9Xyijhd.js"),[])});vt({id:"tcl",extensions:[".tcl"],aliases:["tcl","Tcl","tcltk","TclTk","tcl/tk","Tcl/Tk"],loader:()=>rt(()=>import("./tcl-DnHyzjbg.js"),[])});vt({id:"twig",extensions:[".twig"],aliases:["Twig","twig"],mimetypes:["text/x-twig"],loader:()=>rt(()=>import("./twig-CPajHgWi.js"),[])});vt({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>rt(()=>import("./typescript-uKzlDE9T.js"),[])});vt({id:"typespec",extensions:[".tsp"],aliases:["TypeSpec"],loader:()=>rt(()=>import("./typespec-D-MeaMDU.js"),[])});vt({id:"vb",extensions:[".vb"],aliases:["Visual Basic","vb"],loader:()=>rt(()=>import("./vb-DgyLZaXg.js"),[])});vt({id:"wgsl",extensions:[".wgsl"],aliases:["WebGPU Shading Language","WGSL","wgsl"],loader:()=>rt(()=>import("./wgsl-BIv9DU6q.js"),[])});vt({id:"xml",extensions:[".xml",".xsd",".dtd",".ascx",".csproj",".config",".props",".targets",".wxi",".wxl",".wxs",".xaml",".svg",".svgz",".opf",".xslt",".xsl"],firstLine:"(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)",aliases:["XML","xml"],mimetypes:["text/xml","application/xml","application/xaml+xml","application/xml-dtd"],loader:()=>rt(()=>import("./xml-1Z_L4vw8.js"),[])});vt({id:"yaml",extensions:[".yaml",".yml"],aliases:["YAML","yaml","YML","yml"],mimetypes:["application/x-yaml","text/x-yaml"],loader:()=>rt(()=>import("./yaml-Cf9kIOyW.js"),[])});/*!-----------------------------------------------------------------------------
|
|
807
807
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
808
808
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
809
809
|
* Released under the MIT license
|
|
810
810
|
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
811
|
-
*-----------------------------------------------------------------------------*/var wJe=Object.defineProperty,SJe=Object.getOwnPropertyDescriptor,xJe=Object.getOwnPropertyNames,kJe=Object.prototype.hasOwnProperty,LJe=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xJe(e))!kJe.call(s,n)&&n!==t&&wJe(s,n,{get:()=>e[n],enumerable:!(i=SJe(e,n))||i.enumerable});return s},DJe=(s,e,t)=>(LJe(s,e,"default"),t),Gx={};DJe(Gx,jN);var ine=class{constructor(e,t,i){this._onDidChange=new Gx.Emitter,this._languageId=e,this.setOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this.options}get options(){return this._options}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setDiagnosticsOptions(e){this.setOptions(e)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}},nne={validate:!0,lint:{compatibleVendorPrefixes:"ignore",vendorPrefix:"warning",duplicateProperties:"warning",emptyRules:"warning",importStatement:"ignore",boxModel:"ignore",universalSelector:"ignore",zeroUnits:"ignore",fontFaceProperties:"warning",hexColorLength:"error",argumentsInColorFunction:"error",unknownProperties:"warning",ieHack:"ignore",unknownVendorSpecificProperties:"ignore",propertyIgnoredDueToDisplay:"warning",important:"ignore",float:"ignore",idSelector:"ignore"},data:{useDefaultDataProvider:!0},format:{newlineBetweenSelectors:!0,newlineBetweenRules:!0,spaceAroundSelectorSeparator:!1,braceStyle:"collapse",maxPreserveNewLines:void 0,preserveNewLines:!0}},sne={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0,documentFormattingEdits:!0,documentRangeFormattingEdits:!0},e0e=new ine("css",nne,sne),t0e=new ine("scss",nne,sne),i0e=new ine("less",nne,sne);Gx.languages.css={cssDefaults:e0e,lessDefaults:i0e,scssDefaults:t0e};function rne(){return rt(()=>import("./cssMode-
|
|
811
|
+
*-----------------------------------------------------------------------------*/var wJe=Object.defineProperty,SJe=Object.getOwnPropertyDescriptor,xJe=Object.getOwnPropertyNames,kJe=Object.prototype.hasOwnProperty,LJe=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xJe(e))!kJe.call(s,n)&&n!==t&&wJe(s,n,{get:()=>e[n],enumerable:!(i=SJe(e,n))||i.enumerable});return s},DJe=(s,e,t)=>(LJe(s,e,"default"),t),Gx={};DJe(Gx,jN);var ine=class{constructor(e,t,i){this._onDidChange=new Gx.Emitter,this._languageId=e,this.setOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this.options}get options(){return this._options}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setDiagnosticsOptions(e){this.setOptions(e)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}},nne={validate:!0,lint:{compatibleVendorPrefixes:"ignore",vendorPrefix:"warning",duplicateProperties:"warning",emptyRules:"warning",importStatement:"ignore",boxModel:"ignore",universalSelector:"ignore",zeroUnits:"ignore",fontFaceProperties:"warning",hexColorLength:"error",argumentsInColorFunction:"error",unknownProperties:"warning",ieHack:"ignore",unknownVendorSpecificProperties:"ignore",propertyIgnoredDueToDisplay:"warning",important:"ignore",float:"ignore",idSelector:"ignore"},data:{useDefaultDataProvider:!0},format:{newlineBetweenSelectors:!0,newlineBetweenRules:!0,spaceAroundSelectorSeparator:!1,braceStyle:"collapse",maxPreserveNewLines:void 0,preserveNewLines:!0}},sne={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0,documentFormattingEdits:!0,documentRangeFormattingEdits:!0},e0e=new ine("css",nne,sne),t0e=new ine("scss",nne,sne),i0e=new ine("less",nne,sne);Gx.languages.css={cssDefaults:e0e,lessDefaults:i0e,scssDefaults:t0e};function rne(){return rt(()=>import("./cssMode-BFNigYrU.js"),[])}Gx.languages.onLanguage("less",()=>{rne().then(s=>s.setupMode(i0e))});Gx.languages.onLanguage("scss",()=>{rne().then(s=>s.setupMode(t0e))});Gx.languages.onLanguage("css",()=>{rne().then(s=>s.setupMode(e0e))});/*!-----------------------------------------------------------------------------
|
|
812
812
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
813
813
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
814
814
|
* Released under the MIT license
|
|
815
815
|
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
816
|
-
*-----------------------------------------------------------------------------*/var IJe=Object.defineProperty,EJe=Object.getOwnPropertyDescriptor,TJe=Object.getOwnPropertyNames,NJe=Object.prototype.hasOwnProperty,PJe=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of TJe(e))!NJe.call(s,n)&&n!==t&&IJe(s,n,{get:()=>e[n],enumerable:!(i=EJe(e,n))||i.enumerable});return s},MJe=(s,e,t)=>(PJe(s,e,"default"),t),MH={};MJe(MH,jN);var RJe=class{constructor(e,t,i){this._onDidChange=new MH.Emitter,this._languageId=e,this.setOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get options(){return this._options}get modeConfiguration(){return this._modeConfiguration}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}},OJe={tabSize:4,insertSpaces:!1,wrapLineLength:120,unformatted:'default": "a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, q, samp, select, small, span, strong, sub, sup, textarea, tt, var',contentUnformatted:"pre",indentInnerHtml:!1,preserveNewLines:!0,maxPreserveNewLines:void 0,indentHandlebars:!1,endWithNewline:!1,extraLiners:"head, body, /html",wrapAttributes:"auto"},RH={format:OJe,suggest:{},data:{useDefaultDataProvider:!0}};function OH(s){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:s===AI,documentFormattingEdits:s===AI,documentRangeFormattingEdits:s===AI}}var AI="html",qfe="handlebars",Kfe="razor",n0e=AH(AI,RH,OH(AI)),AJe=n0e.defaults,s0e=AH(qfe,RH,OH(qfe)),FJe=s0e.defaults,r0e=AH(Kfe,RH,OH(Kfe)),BJe=r0e.defaults;MH.languages.html={htmlDefaults:AJe,razorDefaults:BJe,handlebarDefaults:FJe,htmlLanguageService:n0e,handlebarLanguageService:s0e,razorLanguageService:r0e,registerHTMLLanguageService:AH};function WJe(){return rt(()=>import("./htmlMode-
|
|
816
|
+
*-----------------------------------------------------------------------------*/var IJe=Object.defineProperty,EJe=Object.getOwnPropertyDescriptor,TJe=Object.getOwnPropertyNames,NJe=Object.prototype.hasOwnProperty,PJe=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of TJe(e))!NJe.call(s,n)&&n!==t&&IJe(s,n,{get:()=>e[n],enumerable:!(i=EJe(e,n))||i.enumerable});return s},MJe=(s,e,t)=>(PJe(s,e,"default"),t),MH={};MJe(MH,jN);var RJe=class{constructor(e,t,i){this._onDidChange=new MH.Emitter,this._languageId=e,this.setOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get options(){return this._options}get modeConfiguration(){return this._modeConfiguration}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}},OJe={tabSize:4,insertSpaces:!1,wrapLineLength:120,unformatted:'default": "a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, q, samp, select, small, span, strong, sub, sup, textarea, tt, var',contentUnformatted:"pre",indentInnerHtml:!1,preserveNewLines:!0,maxPreserveNewLines:void 0,indentHandlebars:!1,endWithNewline:!1,extraLiners:"head, body, /html",wrapAttributes:"auto"},RH={format:OJe,suggest:{},data:{useDefaultDataProvider:!0}};function OH(s){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:s===AI,documentFormattingEdits:s===AI,documentRangeFormattingEdits:s===AI}}var AI="html",qfe="handlebars",Kfe="razor",n0e=AH(AI,RH,OH(AI)),AJe=n0e.defaults,s0e=AH(qfe,RH,OH(qfe)),FJe=s0e.defaults,r0e=AH(Kfe,RH,OH(Kfe)),BJe=r0e.defaults;MH.languages.html={htmlDefaults:AJe,razorDefaults:BJe,handlebarDefaults:FJe,htmlLanguageService:n0e,handlebarLanguageService:s0e,razorLanguageService:r0e,registerHTMLLanguageService:AH};function WJe(){return rt(()=>import("./htmlMode-DaRvRPXz.js"),[])}function AH(s,e=RH,t=OH(s)){const i=new RJe(s,e,t);let n;const r=MH.languages.onLanguage(s,async()=>{n=(await WJe()).setupMode(i)});return{defaults:i,dispose(){r.dispose(),n==null||n.dispose(),n=void 0}}}/*!-----------------------------------------------------------------------------
|
|
817
817
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
818
818
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
819
819
|
* Released under the MIT license
|
|
820
820
|
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
821
|
-
*-----------------------------------------------------------------------------*/var VJe=Object.defineProperty,HJe=Object.getOwnPropertyDescriptor,$Je=Object.getOwnPropertyNames,zJe=Object.prototype.hasOwnProperty,jJe=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of $Je(e))!zJe.call(s,n)&&n!==t&&VJe(s,n,{get:()=>e[n],enumerable:!(i=HJe(e,n))||i.enumerable});return s},UJe=(s,e,t)=>(jJe(s,e,"default"),t),UN={};UJe(UN,jN);var qJe=class{constructor(e,t,i){this._onDidChange=new UN.Emitter,this._languageId=e,this.setDiagnosticsOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}},KJe={validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},GJe={documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0},o0e=new qJe("json",KJe,GJe),YJe=()=>a0e().then(s=>s.getWorker());UN.languages.json={jsonDefaults:o0e,getWorker:YJe};function a0e(){return rt(()=>import("./jsonMode-
|
|
821
|
+
*-----------------------------------------------------------------------------*/var VJe=Object.defineProperty,HJe=Object.getOwnPropertyDescriptor,$Je=Object.getOwnPropertyNames,zJe=Object.prototype.hasOwnProperty,jJe=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of $Je(e))!zJe.call(s,n)&&n!==t&&VJe(s,n,{get:()=>e[n],enumerable:!(i=HJe(e,n))||i.enumerable});return s},UJe=(s,e,t)=>(jJe(s,e,"default"),t),UN={};UJe(UN,jN);var qJe=class{constructor(e,t,i){this._onDidChange=new UN.Emitter,this._languageId=e,this.setDiagnosticsOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}},KJe={validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},GJe={documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0},o0e=new qJe("json",KJe,GJe),YJe=()=>a0e().then(s=>s.getWorker());UN.languages.json={jsonDefaults:o0e,getWorker:YJe};function a0e(){return rt(()=>import("./jsonMode-BNOK_Lb2.js"),[])}UN.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]});UN.languages.onLanguage("json",()=>{a0e().then(s=>s.setupMode(o0e))});/*!-----------------------------------------------------------------------------
|
|
822
822
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
823
823
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
824
824
|
* Released under the MIT license
|
|
825
825
|
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
826
|
-
*-----------------------------------------------------------------------------*/var ZJe=Object.defineProperty,XJe=Object.getOwnPropertyDescriptor,QJe=Object.getOwnPropertyNames,JJe=Object.prototype.hasOwnProperty,eet=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of QJe(e))!JJe.call(s,n)&&n!==t&&ZJe(s,n,{get:()=>e[n],enumerable:!(i=XJe(e,n))||i.enumerable});return s},tet=(s,e,t)=>(eet(s,e,"default"),t),iet="5.4.5",nx={};tet(nx,jN);var l0e=(s=>(s[s.None=0]="None",s[s.CommonJS=1]="CommonJS",s[s.AMD=2]="AMD",s[s.UMD=3]="UMD",s[s.System=4]="System",s[s.ES2015=5]="ES2015",s[s.ESNext=99]="ESNext",s))(l0e||{}),c0e=(s=>(s[s.None=0]="None",s[s.Preserve=1]="Preserve",s[s.React=2]="React",s[s.ReactNative=3]="ReactNative",s[s.ReactJSX=4]="ReactJSX",s[s.ReactJSXDev=5]="ReactJSXDev",s))(c0e||{}),d0e=(s=>(s[s.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",s[s.LineFeed=1]="LineFeed",s))(d0e||{}),u0e=(s=>(s[s.ES3=0]="ES3",s[s.ES5=1]="ES5",s[s.ES2015=2]="ES2015",s[s.ES2016=3]="ES2016",s[s.ES2017=4]="ES2017",s[s.ES2018=5]="ES2018",s[s.ES2019=6]="ES2019",s[s.ES2020=7]="ES2020",s[s.ESNext=99]="ESNext",s[s.JSON=100]="JSON",s[s.Latest=99]="Latest",s))(u0e||{}),h0e=(s=>(s[s.Classic=1]="Classic",s[s.NodeJs=2]="NodeJs",s))(h0e||{}),f0e=class{constructor(s,e,t,i,n){this._onDidChange=new nx.Emitter,this._onDidExtraLibsChange=new nx.Emitter,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(s),this.setDiagnosticsOptions(e),this.setWorkerOptions(t),this.setInlayHintsOptions(i),this.setModeConfiguration(n),this._onDidExtraLibsChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onDidExtraLibsChange(){return this._onDidExtraLibsChange.event}get modeConfiguration(){return this._modeConfiguration}get workerOptions(){return this._workerOptions}get inlayHintsOptions(){return this._inlayHintsOptions}getExtraLibs(){return this._extraLibs}addExtraLib(s,e){let t;if(typeof e>"u"?t=`ts:extralib-${Math.random().toString(36).substring(2,15)}`:t=e,this._extraLibs[t]&&this._extraLibs[t].content===s)return{dispose:()=>{}};let i=1;return this._removedExtraLibs[t]&&(i=this._removedExtraLibs[t]+1),this._extraLibs[t]&&(i=this._extraLibs[t].version+1),this._extraLibs[t]={content:s,version:i},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let n=this._extraLibs[t];n&&n.version===i&&(delete this._extraLibs[t],this._removedExtraLibs[t]=i,this._fireOnDidExtraLibsChangeSoon())}}}setExtraLibs(s){for(const e in this._extraLibs)this._removedExtraLibs[e]=this._extraLibs[e].version;if(this._extraLibs=Object.create(null),s&&s.length>0)for(const e of s){const t=e.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`,i=e.content;let n=1;this._removedExtraLibs[t]&&(n=this._removedExtraLibs[t]+1),this._extraLibs[t]={content:i,version:n}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){this._onDidExtraLibsChangeTimeout===-1&&(this._onDidExtraLibsChangeTimeout=window.setTimeout(()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)},0))}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(s){this._compilerOptions=s||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(s){this._diagnosticsOptions=s||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(s){this._workerOptions=s||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(s){this._inlayHintsOptions=s||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(s){}setEagerModelSync(s){this._eagerModelSync=s}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(s){this._modeConfiguration=s||Object.create(null),this._onDidChange.fire(void 0)}},net=iet,g0e={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,diagnostics:!0,documentRangeFormattingEdits:!0,signatureHelp:!0,onTypeFormattingEdits:!0,codeActions:!0,inlayHints:!0},p0e=new f0e({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},g0e),m0e=new f0e({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},g0e),set=()=>FH().then(s=>s.getTypeScriptWorker()),ret=()=>FH().then(s=>s.getJavaScriptWorker());nx.languages.typescript={ModuleKind:l0e,JsxEmit:c0e,NewLineKind:d0e,ScriptTarget:u0e,ModuleResolutionKind:h0e,typescriptVersion:net,typescriptDefaults:p0e,javascriptDefaults:m0e,getTypeScriptWorker:set,getJavaScriptWorker:ret};function FH(){return rt(()=>import("./tsMode-uciq4wdD.js"),[])}nx.languages.onLanguage("typescript",()=>FH().then(s=>s.setupTypeScript(p0e)));nx.languages.onLanguage("javascript",()=>FH().then(s=>s.setupJavaScript(m0e)));class oet extends ia{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:Lt("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),icon:Oe.map,toggled:ve.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:ve.has("isInDiffEditor"),menu:{when:ve.has("isInDiffEditor"),id:ot.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(Yt),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}class _0e extends ia{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:Lt("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),precondition:ve.has("isInDiffEditor")})}run(e,...t){const i=e.get(Yt),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}class v0e extends ia{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:Lt("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),precondition:ve.has("isInDiffEditor")})}run(e,...t){const i=e.get(Yt),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}const qN=Lt("diffEditor","Diff Editor");class aet extends qu{constructor(){super({id:"diffEditor.switchSide",title:Lt("switchSide","Switch Side"),icon:Oe.arrowSwap,precondition:ve.has("isInDiffEditor"),f1:!0,category:qN})}runEditorCommand(e,t,i){const n=Yx(e);if(n instanceof $g){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}class cet extends qu{constructor(){super({id:"diffEditor.exitCompareMove",title:Lt("exitCompareMove","Exit Compare Move"),icon:Oe.close,precondition:U.comparingMovedCode,f1:!1,category:qN,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=Yx(e);n instanceof $g&&n.exitCompareMove()}}class det extends qu{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:Lt("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),icon:Oe.fold,precondition:ve.has("isInDiffEditor"),f1:!0,category:qN})}runEditorCommand(e,t,...i){const n=Yx(e);n instanceof $g&&n.collapseAllUnchangedRegions()}}class uet extends qu{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:Lt("showAllUnchangedRegions","Show All Unchanged Regions"),icon:Oe.unfold,precondition:ve.has("isInDiffEditor"),f1:!0,category:qN})}runEditorCommand(e,t,...i){const n=Yx(e);n instanceof $g&&n.showAllUnchangedRegions()}}class _Z extends ia{constructor(){super({id:"diffEditor.revert",title:Lt("revert","Revert"),f1:!1,category:qN})}run(e,t){const i=het(e,t.originalUri,t.modifiedUri);i instanceof $g&&i.revertRangeMappings(t.mapping.innerChanges??[])}}const b0e=Lt("accessibleDiffViewer","Accessible Diff Viewer"),aW=class aW extends ia{constructor(){super({id:aW.id,title:Lt("editor.action.accessibleDiffViewer.next","Go to Next Difference"),category:b0e,precondition:ve.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){const t=Yx(e);t==null||t.accessibleDiffViewerNext()}};aW.id="editor.action.accessibleDiffViewer.next";let ET=aW;const lW=class lW extends ia{constructor(){super({id:lW.id,title:Lt("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),category:b0e,precondition:ve.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){const t=Yx(e);t==null||t.accessibleDiffViewerPrev()}};lW.id="editor.action.accessibleDiffViewer.prev";let d3=lW;function het(s,e,t){return s.get(wi).listDiffEditors().find(r=>{var l,d;const o=r.getModifiedEditor(),a=r.getOriginalEditor();return o&&((l=o.getModel())==null?void 0:l.uri.toString())===t.toString()&&a&&((d=a.getModel())==null?void 0:d.uri.toString())===e.toString()})||null}function Yx(s){const t=s.get(wi).listDiffEditors(),i=Ur();if(i)for(const n of t){const r=n.getContainerDomNode();if(fet(r,i))return n}return null}function fet(s,e){let t=e;for(;t;){if(t===s)return!0;t=t.parentElement}return!1}on(oet);on(_0e);on(v0e);cr.appendMenuItem(ot.EditorTitle,{command:{id:new v0e().desc.id,title:w("useInlineViewWhenSpaceIsLimited","Use Inline View When Space Is Limited"),toggled:ve.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:ve.has("isInDiffEditor")},order:11,group:"1_diff",when:ve.and(U.diffEditorRenderSideBySideInlineBreakpointReached,ve.has("isInDiffEditor"))});cr.appendMenuItem(ot.EditorTitle,{command:{id:new _0e().desc.id,title:w("showMoves","Show Moved Code Blocks"),icon:Oe.move,toggled:Nx.create("config.diffEditor.experimental.showMoves",!0),precondition:ve.has("isInDiffEditor")},order:10,group:"1_diff",when:ve.has("isInDiffEditor")});on(_Z);for(const s of[{icon:Oe.arrowRight,key:U.diffEditorInlineMode.toNegated()},{icon:Oe.discard,key:U.diffEditorInlineMode}])cr.appendMenuItem(ot.DiffEditorHunkToolbar,{command:{id:new _Z().desc.id,title:w("revertHunk","Revert Block"),icon:s.icon},when:ve.and(U.diffEditorModifiedWritable,s.key),order:5,group:"primary"}),cr.appendMenuItem(ot.DiffEditorSelectionToolbar,{command:{id:new _Z().desc.id,title:w("revertSelection","Revert Selection"),icon:s.icon},when:ve.and(U.diffEditorModifiedWritable,s.key),order:5,group:"primary"});on(aet);on(cet);on(det);on(uet);cr.appendMenuItem(ot.EditorTitle,{command:{id:ET.id,title:w("Open Accessible Diff Viewer","Open Accessible Diff Viewer"),precondition:ve.has("isInDiffEditor")},order:10,group:"2_diff",when:ve.and(U.accessibleDiffViewerVisible.negate(),ve.has("isInDiffEditor"))});fi.registerCommandAlias("editor.action.diffReview.next",ET.id);on(ET);fi.registerCommandAlias("editor.action.diffReview.prev",d3.id);on(d3);var get=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},pet=function(s,e){return function(t,i){e(t,i,s)}},vZ;const BH=new qe("selectionAnchorSet",!1);var iC;let b_=(iC=class{static get(e){return e.getContribution(vZ.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=BH.bindTo(t),this.modelChangeListener=e.onDidChangeModel(()=>this.selectionAnchorSetContextKey.reset())}setSelectionAnchor(){if(this.editor.hasModel()){const e=this.editor.getPosition();this.editor.changeDecorations(t=>{this.decorationId&&t.removeDecoration(this.decorationId),this.decorationId=t.addDecoration(lt.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new no().appendText(w("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),ea(w("anchorSet","Anchor set at {0}:{1}",e.lineNumber,e.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);e&&this.editor.setPosition(e.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);if(e){const t=this.editor.getPosition();this.editor.setSelection(lt.fromPositions(e.getStartPosition(),t)),this.cancelSelectionAnchor()}}}cancelSelectionAnchor(){if(this.decorationId){const e=this.decorationId;this.editor.changeDecorations(t=>{t.removeDecoration(e),this.decorationId=void 0}),this.selectionAnchorSetContextKey.set(!1)}}dispose(){this.cancelSelectionAnchor(),this.modelChangeListener.dispose()}},vZ=iC,iC.ID="editor.contrib.selectionAnchorController",iC);b_=vZ=get([pet(1,wt)],b_);class met extends Ze{constructor(){super({id:"editor.action.setSelectionAnchor",label:w("setSelectionAnchor","Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:U.editorTextFocus,primary:Ds(2089,2080),weight:100}})}async run(e,t){var i;(i=b_.get(t))==null||i.setSelectionAnchor()}}class _et extends Ze{constructor(){super({id:"editor.action.goToSelectionAnchor",label:w("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:BH})}async run(e,t){var i;(i=b_.get(t))==null||i.goToSelectionAnchor()}}class vet extends Ze{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:w("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:BH,kbOpts:{kbExpr:U.editorTextFocus,primary:Ds(2089,2089),weight:100}})}async run(e,t){var i;(i=b_.get(t))==null||i.selectFromAnchorToCursor()}}class bet extends Ze{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:w("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:BH,kbOpts:{kbExpr:U.editorTextFocus,primary:9,weight:100}})}async run(e,t){var i;(i=b_.get(t))==null||i.cancelSelectionAnchor()}}pi(b_.ID,b_,4);Re(met);Re(_et);Re(vet);Re(bet);const Cet=q("editorOverviewRuler.bracketMatchForeground","#A0A0A0",w("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class yet extends Ze{constructor(){super({id:"editor.action.jumpToBracket",label:w("smartSelect.jumpBracket","Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:U.editorTextFocus,primary:3165,weight:100}})}run(e,t){var i;(i=dy.get(t))==null||i.jumpToBracket()}}class wet extends Ze{constructor(){super({id:"editor.action.selectToBracket",label:w("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:Lt("smartSelect.selectToBracketDescription","Select the text inside and including the brackets or curly braces"),args:[{name:"args",schema:{type:"object",properties:{selectBrackets:{type:"boolean",default:!0}}}}]}})}run(e,t,i){var r;let n=!0;i&&i.selectBrackets===!1&&(n=!1),(r=dy.get(t))==null||r.selectToBracket(n)}}class xet extends Ze{constructor(){super({id:"editor.action.removeBrackets",label:w("smartSelect.removeBrackets","Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:U.editorTextFocus,primary:2561,weight:100}})}run(e,t){var i;(i=dy.get(t))==null||i.removeBrackets(this.id)}}class ket{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}const Kp=class Kp extends re{static get(e){return e.getContribution(Kp.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new qi(()=>this._updateBrackets(),50)),this._matchBrackets=this._editor.getOption(72),this._updateBracketsSoon.schedule(),this._register(e.onDidChangeCursorPosition(t=>{this._matchBrackets!=="never"&&this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelContent(t=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModel(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelLanguageConfiguration(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeConfiguration(t=>{t.hasChanged(72)&&(this._matchBrackets=this._editor.getOption(72),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())})),this._register(e.onDidBlurEditorWidget(()=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidFocusEditorWidget(()=>{this._updateBracketsSoon.schedule()}))}jumpToBracket(){if(!this._editor.hasModel())return;const e=this._editor.getModel(),t=this._editor.getSelections().map(i=>{const n=i.getStartPosition(),r=e.bracketPairs.matchBracket(n);let o=null;if(r)r[0].containsPosition(n)&&!r[1].containsPosition(n)?o=r[1].getStartPosition():r[1].containsPosition(n)&&(o=r[0].getStartPosition());else{const a=e.bracketPairs.findEnclosingBrackets(n);if(a)o=a[1].getStartPosition();else{const l=e.bracketPairs.findNextBracket(n);l&&l.range&&(o=l.range.getStartPosition())}}return o?new lt(o.lineNumber,o.column,o.lineNumber,o.column):new lt(n.lineNumber,n.column,n.lineNumber,n.column)});this._editor.setSelections(t),this._editor.revealRange(t[0])}selectToBracket(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=[];this._editor.getSelections().forEach(n=>{const r=n.getStartPosition();let o=t.bracketPairs.matchBracket(r);if(!o&&(o=t.bracketPairs.findEnclosingBrackets(r),!o)){const d=t.bracketPairs.findNextBracket(r);d&&d.range&&(o=t.bracketPairs.matchBracket(d.range.getStartPosition()))}let a=null,l=null;if(o){o.sort(W.compareRangesUsingStarts);const[d,h]=o;if(a=e?d.getStartPosition():d.getEndPosition(),l=e?h.getEndPosition():h.getStartPosition(),h.containsPosition(r)){const f=a;a=l,l=f}}a&&l&&i.push(new lt(a.lineNumber,a.column,l.lineNumber,l.column))}),i.length>0&&(this._editor.setSelections(i),this._editor.revealRange(i[0]))}removeBrackets(e){if(!this._editor.hasModel())return;const t=this._editor.getModel();this._editor.getSelections().forEach(i=>{const n=i.getPosition();let r=t.bracketPairs.matchBracket(n);r||(r=t.bracketPairs.findEnclosingBrackets(n)),r&&(this._editor.pushUndoStop(),this._editor.executeEdits(e,[{range:r[0],text:""},{range:r[1],text:""}]),this._editor.pushUndoStop())})}_updateBrackets(){if(this._matchBrackets==="never")return;this._recomputeBrackets();const e=[];let t=0;for(const i of this._lastBracketsData){const n=i.brackets;n&&(e[t++]={range:n[0],options:i.options},e[t++]={range:n[1],options:i.options})}this._decorations.set(e)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus()){this._lastBracketsData=[],this._lastVersionId=0;return}const e=this._editor.getSelections();if(e.length>100){this._lastBracketsData=[],this._lastVersionId=0;return}const t=this._editor.getModel(),i=t.getVersionId();let n=[];this._lastVersionId===i&&(n=this._lastBracketsData);const r=[];let o=0;for(let f=0,p=e.length;f<p;f++){const m=e[f];m.isEmpty()&&(r[o++]=m.getStartPosition())}r.length>1&&r.sort(ie.compare);const a=[];let l=0,d=0;const h=n.length;for(let f=0,p=r.length;f<p;f++){const m=r[f];for(;d<h&&n[d].position.isBefore(m);)d++;if(d<h&&n[d].position.equals(m))a[l++]=n[d];else{let v=t.bracketPairs.matchBracket(m,20),b=Kp._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!v&&this._matchBrackets==="always"&&(v=t.bracketPairs.findEnclosingBrackets(m,20),b=Kp._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),a[l++]=new ket(m,v,b)}}this._lastBracketsData=a,this._lastVersionId=i}};Kp.ID="editor.contrib.bracketMatchingController",Kp._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=At.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:Kn(Cet),position:Zl.Center}}),Kp._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=At.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"});let dy=Kp;pi(dy.ID,dy,1);Re(wet);Re(yet);Re(xet);cr.appendMenuItem(ot.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:w({key:"miGoToBracket",comment:["&& denotes a mnemonic"]},"Go to &&Bracket")},order:2});class Let{constructor(e,t){this._selection=e,this._isMovingLeft=t}getEditOperations(e,t){if(this._selection.startLineNumber!==this._selection.endLineNumber||this._selection.isEmpty())return;const i=this._selection.startLineNumber,n=this._selection.startColumn,r=this._selection.endColumn;if(!(this._isMovingLeft&&n===1)&&!(!this._isMovingLeft&&r===e.getLineMaxColumn(i)))if(this._isMovingLeft){const o=new W(i,n-1,i,n),a=e.getValueInRange(o);t.addEditOperation(o,null),t.addEditOperation(new W(i,r,i,r),a)}else{const o=new W(i,r,i,r+1),a=e.getValueInRange(o);t.addEditOperation(o,null),t.addEditOperation(new W(i,n,i,n),a)}}computeCursorState(e,t){return this._isMovingLeft?new lt(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new lt(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class C0e extends Ze{constructor(e,t){super(t),this.left=e}run(e,t){if(!t.hasModel())return;const i=[],n=t.getSelections();for(const r of n)i.push(new Let(r,this.left));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}}class Det extends C0e{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:w("caret.moveLeft","Move Selected Text Left"),alias:"Move Selected Text Left",precondition:U.writable})}}class Iet extends C0e{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:w("caret.moveRight","Move Selected Text Right"),alias:"Move Selected Text Right",precondition:U.writable})}}Re(Det);Re(Iet);class Eet extends Ze{constructor(){super({id:"editor.action.transposeLetters",label:w("transposeLetters.label","Transpose Letters"),alias:"Transpose Letters",precondition:U.writable,kbOpts:{kbExpr:U.textInputFocus,primary:0,mac:{primary:306},weight:100}})}run(e,t){if(!t.hasModel())return;const i=t.getModel(),n=[],r=t.getSelections();for(const o of r){if(!o.isEmpty())continue;const a=o.startLineNumber,l=o.startColumn,d=i.getLineMaxColumn(a);if(a===1&&(l===1||l===2&&d===2))continue;const h=l===d?o.getPosition():Wi.rightPosition(i,o.getPosition().lineNumber,o.getPosition().column),f=Wi.leftPosition(i,h),p=Wi.leftPosition(i,f),m=i.getValueInRange(W.fromPositions(p,f)),v=i.getValueInRange(W.fromPositions(f,h)),b=W.fromPositions(p,h);n.push(new jr(b,v+m))}n.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}Re(Eet);const WH=function(){if(typeof crypto=="object"&&typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let s;typeof crypto=="object"&&typeof crypto.getRandomValues=="function"?s=crypto.getRandomValues.bind(crypto):s=function(i){for(let n=0;n<i.length;n++)i[n]=Math.floor(Math.random()*256);return i};const e=new Uint8Array(16),t=[];for(let i=0;i<256;i++)t.push(i.toString(16).padStart(2,"0"));return function(){s(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let n=0,r="";return r+=t[e[n++]],r+=t[e[n++]],r+=t[e[n++]],r+=t[e[n++]],r+="-",r+=t[e[n++]],r+=t[e[n++]],r+="-",r+=t[e[n++]],r+=t[e[n++]],r+="-",r+=t[e[n++]],r+=t[e[n++]],r+="-",r+=t[e[n++]],r+=t[e[n++]],r+=t[e[n++]],r+=t[e[n++]],r+=t[e[n++]],r+=t[e[n++]],r}}();function one(s){return{asString:async()=>s,asFile:()=>{},value:typeof s=="string"?s:void 0}}function Tet(s,e,t){const i={id:WH(),name:s,uri:e,data:t};return{asString:async()=>"",asFile:()=>i,value:void 0}}class y0e{constructor(){this._entries=new Map}get size(){let e=0;for(const t of this._entries)e++;return e}has(e){return this._entries.has(this.toKey(e))}matches(e){const t=[...this._entries.keys()];return hi.some(this,([i,n])=>n.asFile())&&t.push("files"),S0e(u3(e),t)}get(e){var t;return(t=this._entries.get(this.toKey(e)))==null?void 0:t[0]}append(e,t){const i=this._entries.get(e);i?i.push(t):this._entries.set(this.toKey(e),[t])}replace(e,t){this._entries.set(this.toKey(e),[t])}delete(e){this._entries.delete(this.toKey(e))}*[Symbol.iterator](){for(const[e,t]of this._entries)for(const i of t)yield[e,i]}toKey(e){return u3(e)}}function u3(s){return s.toLowerCase()}function w0e(s,e){return S0e(u3(s),e.map(u3))}function S0e(s,e){if(s==="*/*")return e.length>0;if(e.includes(s))return!0;const t=s.match(/^([a-z]+)\/([a-z]+|\*)$/i);if(!t)return!1;const[i,n,r]=t;return r==="*"?e.some(o=>o.startsWith(n+"/")):!1}const VH=Object.freeze({create:s=>Rg(s.map(e=>e.toString())).join(`\r
|
|
826
|
+
*-----------------------------------------------------------------------------*/var ZJe=Object.defineProperty,XJe=Object.getOwnPropertyDescriptor,QJe=Object.getOwnPropertyNames,JJe=Object.prototype.hasOwnProperty,eet=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of QJe(e))!JJe.call(s,n)&&n!==t&&ZJe(s,n,{get:()=>e[n],enumerable:!(i=XJe(e,n))||i.enumerable});return s},tet=(s,e,t)=>(eet(s,e,"default"),t),iet="5.4.5",nx={};tet(nx,jN);var l0e=(s=>(s[s.None=0]="None",s[s.CommonJS=1]="CommonJS",s[s.AMD=2]="AMD",s[s.UMD=3]="UMD",s[s.System=4]="System",s[s.ES2015=5]="ES2015",s[s.ESNext=99]="ESNext",s))(l0e||{}),c0e=(s=>(s[s.None=0]="None",s[s.Preserve=1]="Preserve",s[s.React=2]="React",s[s.ReactNative=3]="ReactNative",s[s.ReactJSX=4]="ReactJSX",s[s.ReactJSXDev=5]="ReactJSXDev",s))(c0e||{}),d0e=(s=>(s[s.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",s[s.LineFeed=1]="LineFeed",s))(d0e||{}),u0e=(s=>(s[s.ES3=0]="ES3",s[s.ES5=1]="ES5",s[s.ES2015=2]="ES2015",s[s.ES2016=3]="ES2016",s[s.ES2017=4]="ES2017",s[s.ES2018=5]="ES2018",s[s.ES2019=6]="ES2019",s[s.ES2020=7]="ES2020",s[s.ESNext=99]="ESNext",s[s.JSON=100]="JSON",s[s.Latest=99]="Latest",s))(u0e||{}),h0e=(s=>(s[s.Classic=1]="Classic",s[s.NodeJs=2]="NodeJs",s))(h0e||{}),f0e=class{constructor(s,e,t,i,n){this._onDidChange=new nx.Emitter,this._onDidExtraLibsChange=new nx.Emitter,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(s),this.setDiagnosticsOptions(e),this.setWorkerOptions(t),this.setInlayHintsOptions(i),this.setModeConfiguration(n),this._onDidExtraLibsChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onDidExtraLibsChange(){return this._onDidExtraLibsChange.event}get modeConfiguration(){return this._modeConfiguration}get workerOptions(){return this._workerOptions}get inlayHintsOptions(){return this._inlayHintsOptions}getExtraLibs(){return this._extraLibs}addExtraLib(s,e){let t;if(typeof e>"u"?t=`ts:extralib-${Math.random().toString(36).substring(2,15)}`:t=e,this._extraLibs[t]&&this._extraLibs[t].content===s)return{dispose:()=>{}};let i=1;return this._removedExtraLibs[t]&&(i=this._removedExtraLibs[t]+1),this._extraLibs[t]&&(i=this._extraLibs[t].version+1),this._extraLibs[t]={content:s,version:i},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let n=this._extraLibs[t];n&&n.version===i&&(delete this._extraLibs[t],this._removedExtraLibs[t]=i,this._fireOnDidExtraLibsChangeSoon())}}}setExtraLibs(s){for(const e in this._extraLibs)this._removedExtraLibs[e]=this._extraLibs[e].version;if(this._extraLibs=Object.create(null),s&&s.length>0)for(const e of s){const t=e.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`,i=e.content;let n=1;this._removedExtraLibs[t]&&(n=this._removedExtraLibs[t]+1),this._extraLibs[t]={content:i,version:n}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){this._onDidExtraLibsChangeTimeout===-1&&(this._onDidExtraLibsChangeTimeout=window.setTimeout(()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)},0))}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(s){this._compilerOptions=s||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(s){this._diagnosticsOptions=s||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(s){this._workerOptions=s||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(s){this._inlayHintsOptions=s||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(s){}setEagerModelSync(s){this._eagerModelSync=s}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(s){this._modeConfiguration=s||Object.create(null),this._onDidChange.fire(void 0)}},net=iet,g0e={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,diagnostics:!0,documentRangeFormattingEdits:!0,signatureHelp:!0,onTypeFormattingEdits:!0,codeActions:!0,inlayHints:!0},p0e=new f0e({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},g0e),m0e=new f0e({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},g0e),set=()=>FH().then(s=>s.getTypeScriptWorker()),ret=()=>FH().then(s=>s.getJavaScriptWorker());nx.languages.typescript={ModuleKind:l0e,JsxEmit:c0e,NewLineKind:d0e,ScriptTarget:u0e,ModuleResolutionKind:h0e,typescriptVersion:net,typescriptDefaults:p0e,javascriptDefaults:m0e,getTypeScriptWorker:set,getJavaScriptWorker:ret};function FH(){return rt(()=>import("./tsMode-Ctez2MnL.js"),[])}nx.languages.onLanguage("typescript",()=>FH().then(s=>s.setupTypeScript(p0e)));nx.languages.onLanguage("javascript",()=>FH().then(s=>s.setupJavaScript(m0e)));class oet extends ia{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:Lt("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),icon:Oe.map,toggled:ve.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:ve.has("isInDiffEditor"),menu:{when:ve.has("isInDiffEditor"),id:ot.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(Yt),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}class _0e extends ia{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:Lt("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),precondition:ve.has("isInDiffEditor")})}run(e,...t){const i=e.get(Yt),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}class v0e extends ia{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:Lt("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),precondition:ve.has("isInDiffEditor")})}run(e,...t){const i=e.get(Yt),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}const qN=Lt("diffEditor","Diff Editor");class aet extends qu{constructor(){super({id:"diffEditor.switchSide",title:Lt("switchSide","Switch Side"),icon:Oe.arrowSwap,precondition:ve.has("isInDiffEditor"),f1:!0,category:qN})}runEditorCommand(e,t,i){const n=Yx(e);if(n instanceof $g){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}class cet extends qu{constructor(){super({id:"diffEditor.exitCompareMove",title:Lt("exitCompareMove","Exit Compare Move"),icon:Oe.close,precondition:U.comparingMovedCode,f1:!1,category:qN,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=Yx(e);n instanceof $g&&n.exitCompareMove()}}class det extends qu{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:Lt("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),icon:Oe.fold,precondition:ve.has("isInDiffEditor"),f1:!0,category:qN})}runEditorCommand(e,t,...i){const n=Yx(e);n instanceof $g&&n.collapseAllUnchangedRegions()}}class uet extends qu{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:Lt("showAllUnchangedRegions","Show All Unchanged Regions"),icon:Oe.unfold,precondition:ve.has("isInDiffEditor"),f1:!0,category:qN})}runEditorCommand(e,t,...i){const n=Yx(e);n instanceof $g&&n.showAllUnchangedRegions()}}class _Z extends ia{constructor(){super({id:"diffEditor.revert",title:Lt("revert","Revert"),f1:!1,category:qN})}run(e,t){const i=het(e,t.originalUri,t.modifiedUri);i instanceof $g&&i.revertRangeMappings(t.mapping.innerChanges??[])}}const b0e=Lt("accessibleDiffViewer","Accessible Diff Viewer"),aW=class aW extends ia{constructor(){super({id:aW.id,title:Lt("editor.action.accessibleDiffViewer.next","Go to Next Difference"),category:b0e,precondition:ve.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){const t=Yx(e);t==null||t.accessibleDiffViewerNext()}};aW.id="editor.action.accessibleDiffViewer.next";let ET=aW;const lW=class lW extends ia{constructor(){super({id:lW.id,title:Lt("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),category:b0e,precondition:ve.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){const t=Yx(e);t==null||t.accessibleDiffViewerPrev()}};lW.id="editor.action.accessibleDiffViewer.prev";let d3=lW;function het(s,e,t){return s.get(wi).listDiffEditors().find(r=>{var l,d;const o=r.getModifiedEditor(),a=r.getOriginalEditor();return o&&((l=o.getModel())==null?void 0:l.uri.toString())===t.toString()&&a&&((d=a.getModel())==null?void 0:d.uri.toString())===e.toString()})||null}function Yx(s){const t=s.get(wi).listDiffEditors(),i=Ur();if(i)for(const n of t){const r=n.getContainerDomNode();if(fet(r,i))return n}return null}function fet(s,e){let t=e;for(;t;){if(t===s)return!0;t=t.parentElement}return!1}on(oet);on(_0e);on(v0e);cr.appendMenuItem(ot.EditorTitle,{command:{id:new v0e().desc.id,title:w("useInlineViewWhenSpaceIsLimited","Use Inline View When Space Is Limited"),toggled:ve.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:ve.has("isInDiffEditor")},order:11,group:"1_diff",when:ve.and(U.diffEditorRenderSideBySideInlineBreakpointReached,ve.has("isInDiffEditor"))});cr.appendMenuItem(ot.EditorTitle,{command:{id:new _0e().desc.id,title:w("showMoves","Show Moved Code Blocks"),icon:Oe.move,toggled:Nx.create("config.diffEditor.experimental.showMoves",!0),precondition:ve.has("isInDiffEditor")},order:10,group:"1_diff",when:ve.has("isInDiffEditor")});on(_Z);for(const s of[{icon:Oe.arrowRight,key:U.diffEditorInlineMode.toNegated()},{icon:Oe.discard,key:U.diffEditorInlineMode}])cr.appendMenuItem(ot.DiffEditorHunkToolbar,{command:{id:new _Z().desc.id,title:w("revertHunk","Revert Block"),icon:s.icon},when:ve.and(U.diffEditorModifiedWritable,s.key),order:5,group:"primary"}),cr.appendMenuItem(ot.DiffEditorSelectionToolbar,{command:{id:new _Z().desc.id,title:w("revertSelection","Revert Selection"),icon:s.icon},when:ve.and(U.diffEditorModifiedWritable,s.key),order:5,group:"primary"});on(aet);on(cet);on(det);on(uet);cr.appendMenuItem(ot.EditorTitle,{command:{id:ET.id,title:w("Open Accessible Diff Viewer","Open Accessible Diff Viewer"),precondition:ve.has("isInDiffEditor")},order:10,group:"2_diff",when:ve.and(U.accessibleDiffViewerVisible.negate(),ve.has("isInDiffEditor"))});fi.registerCommandAlias("editor.action.diffReview.next",ET.id);on(ET);fi.registerCommandAlias("editor.action.diffReview.prev",d3.id);on(d3);var get=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},pet=function(s,e){return function(t,i){e(t,i,s)}},vZ;const BH=new qe("selectionAnchorSet",!1);var iC;let b_=(iC=class{static get(e){return e.getContribution(vZ.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=BH.bindTo(t),this.modelChangeListener=e.onDidChangeModel(()=>this.selectionAnchorSetContextKey.reset())}setSelectionAnchor(){if(this.editor.hasModel()){const e=this.editor.getPosition();this.editor.changeDecorations(t=>{this.decorationId&&t.removeDecoration(this.decorationId),this.decorationId=t.addDecoration(lt.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new no().appendText(w("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),ea(w("anchorSet","Anchor set at {0}:{1}",e.lineNumber,e.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);e&&this.editor.setPosition(e.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);if(e){const t=this.editor.getPosition();this.editor.setSelection(lt.fromPositions(e.getStartPosition(),t)),this.cancelSelectionAnchor()}}}cancelSelectionAnchor(){if(this.decorationId){const e=this.decorationId;this.editor.changeDecorations(t=>{t.removeDecoration(e),this.decorationId=void 0}),this.selectionAnchorSetContextKey.set(!1)}}dispose(){this.cancelSelectionAnchor(),this.modelChangeListener.dispose()}},vZ=iC,iC.ID="editor.contrib.selectionAnchorController",iC);b_=vZ=get([pet(1,wt)],b_);class met extends Ze{constructor(){super({id:"editor.action.setSelectionAnchor",label:w("setSelectionAnchor","Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:U.editorTextFocus,primary:Ds(2089,2080),weight:100}})}async run(e,t){var i;(i=b_.get(t))==null||i.setSelectionAnchor()}}class _et extends Ze{constructor(){super({id:"editor.action.goToSelectionAnchor",label:w("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:BH})}async run(e,t){var i;(i=b_.get(t))==null||i.goToSelectionAnchor()}}class vet extends Ze{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:w("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:BH,kbOpts:{kbExpr:U.editorTextFocus,primary:Ds(2089,2089),weight:100}})}async run(e,t){var i;(i=b_.get(t))==null||i.selectFromAnchorToCursor()}}class bet extends Ze{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:w("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:BH,kbOpts:{kbExpr:U.editorTextFocus,primary:9,weight:100}})}async run(e,t){var i;(i=b_.get(t))==null||i.cancelSelectionAnchor()}}pi(b_.ID,b_,4);Re(met);Re(_et);Re(vet);Re(bet);const Cet=q("editorOverviewRuler.bracketMatchForeground","#A0A0A0",w("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class yet extends Ze{constructor(){super({id:"editor.action.jumpToBracket",label:w("smartSelect.jumpBracket","Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:U.editorTextFocus,primary:3165,weight:100}})}run(e,t){var i;(i=dy.get(t))==null||i.jumpToBracket()}}class wet extends Ze{constructor(){super({id:"editor.action.selectToBracket",label:w("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:Lt("smartSelect.selectToBracketDescription","Select the text inside and including the brackets or curly braces"),args:[{name:"args",schema:{type:"object",properties:{selectBrackets:{type:"boolean",default:!0}}}}]}})}run(e,t,i){var r;let n=!0;i&&i.selectBrackets===!1&&(n=!1),(r=dy.get(t))==null||r.selectToBracket(n)}}class xet extends Ze{constructor(){super({id:"editor.action.removeBrackets",label:w("smartSelect.removeBrackets","Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:U.editorTextFocus,primary:2561,weight:100}})}run(e,t){var i;(i=dy.get(t))==null||i.removeBrackets(this.id)}}class ket{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}const Kp=class Kp extends re{static get(e){return e.getContribution(Kp.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new qi(()=>this._updateBrackets(),50)),this._matchBrackets=this._editor.getOption(72),this._updateBracketsSoon.schedule(),this._register(e.onDidChangeCursorPosition(t=>{this._matchBrackets!=="never"&&this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelContent(t=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModel(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelLanguageConfiguration(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeConfiguration(t=>{t.hasChanged(72)&&(this._matchBrackets=this._editor.getOption(72),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())})),this._register(e.onDidBlurEditorWidget(()=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidFocusEditorWidget(()=>{this._updateBracketsSoon.schedule()}))}jumpToBracket(){if(!this._editor.hasModel())return;const e=this._editor.getModel(),t=this._editor.getSelections().map(i=>{const n=i.getStartPosition(),r=e.bracketPairs.matchBracket(n);let o=null;if(r)r[0].containsPosition(n)&&!r[1].containsPosition(n)?o=r[1].getStartPosition():r[1].containsPosition(n)&&(o=r[0].getStartPosition());else{const a=e.bracketPairs.findEnclosingBrackets(n);if(a)o=a[1].getStartPosition();else{const l=e.bracketPairs.findNextBracket(n);l&&l.range&&(o=l.range.getStartPosition())}}return o?new lt(o.lineNumber,o.column,o.lineNumber,o.column):new lt(n.lineNumber,n.column,n.lineNumber,n.column)});this._editor.setSelections(t),this._editor.revealRange(t[0])}selectToBracket(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=[];this._editor.getSelections().forEach(n=>{const r=n.getStartPosition();let o=t.bracketPairs.matchBracket(r);if(!o&&(o=t.bracketPairs.findEnclosingBrackets(r),!o)){const d=t.bracketPairs.findNextBracket(r);d&&d.range&&(o=t.bracketPairs.matchBracket(d.range.getStartPosition()))}let a=null,l=null;if(o){o.sort(W.compareRangesUsingStarts);const[d,h]=o;if(a=e?d.getStartPosition():d.getEndPosition(),l=e?h.getEndPosition():h.getStartPosition(),h.containsPosition(r)){const f=a;a=l,l=f}}a&&l&&i.push(new lt(a.lineNumber,a.column,l.lineNumber,l.column))}),i.length>0&&(this._editor.setSelections(i),this._editor.revealRange(i[0]))}removeBrackets(e){if(!this._editor.hasModel())return;const t=this._editor.getModel();this._editor.getSelections().forEach(i=>{const n=i.getPosition();let r=t.bracketPairs.matchBracket(n);r||(r=t.bracketPairs.findEnclosingBrackets(n)),r&&(this._editor.pushUndoStop(),this._editor.executeEdits(e,[{range:r[0],text:""},{range:r[1],text:""}]),this._editor.pushUndoStop())})}_updateBrackets(){if(this._matchBrackets==="never")return;this._recomputeBrackets();const e=[];let t=0;for(const i of this._lastBracketsData){const n=i.brackets;n&&(e[t++]={range:n[0],options:i.options},e[t++]={range:n[1],options:i.options})}this._decorations.set(e)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus()){this._lastBracketsData=[],this._lastVersionId=0;return}const e=this._editor.getSelections();if(e.length>100){this._lastBracketsData=[],this._lastVersionId=0;return}const t=this._editor.getModel(),i=t.getVersionId();let n=[];this._lastVersionId===i&&(n=this._lastBracketsData);const r=[];let o=0;for(let f=0,p=e.length;f<p;f++){const m=e[f];m.isEmpty()&&(r[o++]=m.getStartPosition())}r.length>1&&r.sort(ie.compare);const a=[];let l=0,d=0;const h=n.length;for(let f=0,p=r.length;f<p;f++){const m=r[f];for(;d<h&&n[d].position.isBefore(m);)d++;if(d<h&&n[d].position.equals(m))a[l++]=n[d];else{let v=t.bracketPairs.matchBracket(m,20),b=Kp._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!v&&this._matchBrackets==="always"&&(v=t.bracketPairs.findEnclosingBrackets(m,20),b=Kp._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),a[l++]=new ket(m,v,b)}}this._lastBracketsData=a,this._lastVersionId=i}};Kp.ID="editor.contrib.bracketMatchingController",Kp._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=At.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:Kn(Cet),position:Zl.Center}}),Kp._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=At.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"});let dy=Kp;pi(dy.ID,dy,1);Re(wet);Re(yet);Re(xet);cr.appendMenuItem(ot.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:w({key:"miGoToBracket",comment:["&& denotes a mnemonic"]},"Go to &&Bracket")},order:2});class Let{constructor(e,t){this._selection=e,this._isMovingLeft=t}getEditOperations(e,t){if(this._selection.startLineNumber!==this._selection.endLineNumber||this._selection.isEmpty())return;const i=this._selection.startLineNumber,n=this._selection.startColumn,r=this._selection.endColumn;if(!(this._isMovingLeft&&n===1)&&!(!this._isMovingLeft&&r===e.getLineMaxColumn(i)))if(this._isMovingLeft){const o=new W(i,n-1,i,n),a=e.getValueInRange(o);t.addEditOperation(o,null),t.addEditOperation(new W(i,r,i,r),a)}else{const o=new W(i,r,i,r+1),a=e.getValueInRange(o);t.addEditOperation(o,null),t.addEditOperation(new W(i,n,i,n),a)}}computeCursorState(e,t){return this._isMovingLeft?new lt(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new lt(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class C0e extends Ze{constructor(e,t){super(t),this.left=e}run(e,t){if(!t.hasModel())return;const i=[],n=t.getSelections();for(const r of n)i.push(new Let(r,this.left));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}}class Det extends C0e{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:w("caret.moveLeft","Move Selected Text Left"),alias:"Move Selected Text Left",precondition:U.writable})}}class Iet extends C0e{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:w("caret.moveRight","Move Selected Text Right"),alias:"Move Selected Text Right",precondition:U.writable})}}Re(Det);Re(Iet);class Eet extends Ze{constructor(){super({id:"editor.action.transposeLetters",label:w("transposeLetters.label","Transpose Letters"),alias:"Transpose Letters",precondition:U.writable,kbOpts:{kbExpr:U.textInputFocus,primary:0,mac:{primary:306},weight:100}})}run(e,t){if(!t.hasModel())return;const i=t.getModel(),n=[],r=t.getSelections();for(const o of r){if(!o.isEmpty())continue;const a=o.startLineNumber,l=o.startColumn,d=i.getLineMaxColumn(a);if(a===1&&(l===1||l===2&&d===2))continue;const h=l===d?o.getPosition():Wi.rightPosition(i,o.getPosition().lineNumber,o.getPosition().column),f=Wi.leftPosition(i,h),p=Wi.leftPosition(i,f),m=i.getValueInRange(W.fromPositions(p,f)),v=i.getValueInRange(W.fromPositions(f,h)),b=W.fromPositions(p,h);n.push(new jr(b,v+m))}n.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}Re(Eet);const WH=function(){if(typeof crypto=="object"&&typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let s;typeof crypto=="object"&&typeof crypto.getRandomValues=="function"?s=crypto.getRandomValues.bind(crypto):s=function(i){for(let n=0;n<i.length;n++)i[n]=Math.floor(Math.random()*256);return i};const e=new Uint8Array(16),t=[];for(let i=0;i<256;i++)t.push(i.toString(16).padStart(2,"0"));return function(){s(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let n=0,r="";return r+=t[e[n++]],r+=t[e[n++]],r+=t[e[n++]],r+=t[e[n++]],r+="-",r+=t[e[n++]],r+=t[e[n++]],r+="-",r+=t[e[n++]],r+=t[e[n++]],r+="-",r+=t[e[n++]],r+=t[e[n++]],r+="-",r+=t[e[n++]],r+=t[e[n++]],r+=t[e[n++]],r+=t[e[n++]],r+=t[e[n++]],r+=t[e[n++]],r}}();function one(s){return{asString:async()=>s,asFile:()=>{},value:typeof s=="string"?s:void 0}}function Tet(s,e,t){const i={id:WH(),name:s,uri:e,data:t};return{asString:async()=>"",asFile:()=>i,value:void 0}}class y0e{constructor(){this._entries=new Map}get size(){let e=0;for(const t of this._entries)e++;return e}has(e){return this._entries.has(this.toKey(e))}matches(e){const t=[...this._entries.keys()];return hi.some(this,([i,n])=>n.asFile())&&t.push("files"),S0e(u3(e),t)}get(e){var t;return(t=this._entries.get(this.toKey(e)))==null?void 0:t[0]}append(e,t){const i=this._entries.get(e);i?i.push(t):this._entries.set(this.toKey(e),[t])}replace(e,t){this._entries.set(this.toKey(e),[t])}delete(e){this._entries.delete(this.toKey(e))}*[Symbol.iterator](){for(const[e,t]of this._entries)for(const i of t)yield[e,i]}toKey(e){return u3(e)}}function u3(s){return s.toLowerCase()}function w0e(s,e){return S0e(u3(s),e.map(u3))}function S0e(s,e){if(s==="*/*")return e.length>0;if(e.includes(s))return!0;const t=s.match(/^([a-z]+)\/([a-z]+|\*)$/i);if(!t)return!1;const[i,n,r]=t;return r==="*"?e.some(o=>o.startsWith(n+"/")):!1}const VH=Object.freeze({create:s=>Rg(s.map(e=>e.toString())).join(`\r
|
|
827
827
|
`),split:s=>s.split(`\r
|
|
828
828
|
`),parse:s=>VH.split(s).filter(e=>!e.startsWith("#"))}),kh=class kh{constructor(e){this.value=e}equals(e){return this.value===e.value}contains(e){return this.equals(e)||this.value===""||e.value.startsWith(this.value+kh.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(...e){return new kh((this.value?[this.value,...e]:e).join(kh.sep))}};kh.sep=".",kh.None=new kh("@@none@@"),kh.Empty=new kh("");let Nn=kh;const Gfe={EDITORS:"CodeEditors",FILES:"CodeFiles"};class Net{}const Pet={DragAndDropContribution:"workbench.contributions.dragAndDrop"};Wn.add(Pet.DragAndDropContribution,new Net);const cE=class cE{constructor(){}static getInstance(){return cE.INSTANCE}hasData(e){return e&&e===this.proto}getData(e){if(this.hasData(e))return this.data}};cE.INSTANCE=new cE;let bZ=cE;function x0e(s){const e=new y0e;for(const t of s.items){const i=t.type;if(t.kind==="string"){const n=new Promise(r=>t.getAsString(r));e.append(i,one(n))}else if(t.kind==="file"){const n=t.getAsFile();n&&e.append(i,Met(n))}}return e}function Met(s){const e=s.path?pt.parse(s.path):void 0;return Tet(s.name,e,async()=>new Uint8Array(await s.arrayBuffer()))}const Ret=Object.freeze([Gfe.EDITORS,Gfe.FILES,tT.RESOURCES,tT.INTERNAL_URI_LIST]);function k0e(s,e=!1){const t=x0e(s),i=t.get(tT.INTERNAL_URI_LIST);if(i)t.replace(ts.uriList,i);else if(e||!t.has(ts.uriList)){const n=[];for(const r of s.items){const o=r.getAsFile();if(o){const a=o.path;try{a?n.push(pt.file(a).toString()):n.push(pt.parse(o.name,!0).toString())}catch{}}}n.length&&t.replace(ts.uriList,one(VH.create(n)))}for(const n of Ret)t.delete(n);return t}var ane=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},TT=function(s,e){return function(t,i){e(t,i,s)}};class lne{async provideDocumentPasteEdits(e,t,i,n,r){const o=await this.getEdit(i,r);if(o)return{edits:[{insertText:o.insertText,title:o.title,kind:o.kind,handledMimeType:o.handledMimeType,yieldTo:o.yieldTo}],dispose(){}}}async provideDocumentDropEdits(e,t,i,n){const r=await this.getEdit(i,n);if(r)return{edits:[{insertText:r.insertText,title:r.title,kind:r.kind,handledMimeType:r.handledMimeType,yieldTo:r.yieldTo}],dispose(){}}}}const dE=class dE extends lne{constructor(){super(...arguments),this.kind=dE.kind,this.dropMimeTypes=[ts.text],this.pasteMimeTypes=[ts.text]}async getEdit(e,t){const i=e.get(ts.text);if(!i||e.has(ts.uriList))return;const n=await i.asString();return{handledMimeType:ts.text,title:w("text.label","Insert Plain Text"),insertText:n,kind:this.kind}}};dE.id="text",dE.kind=new Nn("text.plain");let uy=dE;class L0e extends lne{constructor(){super(...arguments),this.kind=new Nn("uri.absolute"),this.dropMimeTypes=[ts.uriList],this.pasteMimeTypes=[ts.uriList]}async getEdit(e,t){const i=await D0e(e);if(!i.length||t.isCancellationRequested)return;let n=0;const r=i.map(({uri:a,originalText:l})=>a.scheme===Mt.file?a.fsPath:(n++,l)).join(" ");let o;return n>0?o=i.length>1?w("defaultDropProvider.uriList.uris","Insert Uris"):w("defaultDropProvider.uriList.uri","Insert Uri"):o=i.length>1?w("defaultDropProvider.uriList.paths","Insert Paths"):w("defaultDropProvider.uriList.path","Insert Path"),{handledMimeType:ts.uriList,insertText:r,title:o,kind:this.kind}}}let h3=class extends lne{constructor(e){super(),this._workspaceContextService=e,this.kind=new Nn("uri.relative"),this.dropMimeTypes=[ts.uriList],this.pasteMimeTypes=[ts.uriList]}async getEdit(e,t){const i=await D0e(e);if(!i.length||t.isCancellationRequested)return;const n=Ed(i.map(({uri:r})=>{const o=this._workspaceContextService.getWorkspaceFolder(r);return o?W7e(o.uri,r):void 0}));if(n.length)return{handledMimeType:ts.uriList,insertText:n.join(" "),title:i.length>1?w("defaultDropProvider.uriList.relativePaths","Insert Relative Paths"):w("defaultDropProvider.uriList.relativePath","Insert Relative Path"),kind:this.kind}}};h3=ane([TT(0,sy)],h3);class Oet{constructor(){this.kind=new Nn("html"),this.pasteMimeTypes=["text/html"],this._yieldTo=[{mimeType:ts.text}]}async provideDocumentPasteEdits(e,t,i,n,r){var l;if(n.triggerKind!==EE.PasteAs&&!((l=n.only)!=null&&l.contains(this.kind)))return;const o=i.get("text/html"),a=await(o==null?void 0:o.asString());if(!(!a||r.isCancellationRequested))return{dispose(){},edits:[{insertText:a,yieldTo:this._yieldTo,title:w("pasteHtmlLabel","Insert HTML"),kind:this.kind}]}}}async function D0e(s){const e=s.get(ts.uriList);if(!e)return[];const t=await e.asString(),i=[];for(const n of VH.parse(t))try{i.push({uri:pt.parse(n),originalText:n})}catch{}return i}let CZ=class extends re{constructor(e,t){super(),this._register(e.documentDropEditProvider.register("*",new uy)),this._register(e.documentDropEditProvider.register("*",new L0e)),this._register(e.documentDropEditProvider.register("*",new h3(t)))}};CZ=ane([TT(0,nt),TT(1,sy)],CZ);let yZ=class extends re{constructor(e,t){super(),this._register(e.documentPasteEditProvider.register("*",new uy)),this._register(e.documentPasteEditProvider.register("*",new L0e)),this._register(e.documentPasteEditProvider.register("*",new h3(t))),this._register(e.documentPasteEditProvider.register("*",new Oet))}};yZ=ane([TT(0,nt),TT(1,sy)],yZ);const gd=class gd{constructor(){this.value="",this.pos=0}static isDigitCharacter(e){return e>=48&&e<=57}static isVariableCharacter(e){return e===95||e>=97&&e<=122||e>=65&&e<=90}text(e){this.value=e,this.pos=0}tokenText(e){return this.value.substr(e.pos,e.len)}next(){if(this.pos>=this.value.length)return{type:14,pos:this.pos,len:0};const e=this.pos;let t=0,i=this.value.charCodeAt(e),n;if(n=gd._table[i],typeof n=="number")return this.pos+=1,{type:n,pos:e,len:1};if(gd.isDigitCharacter(i)){n=8;do t+=1,i=this.value.charCodeAt(e+t);while(gd.isDigitCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}if(gd.isVariableCharacter(i)){n=9;do i=this.value.charCodeAt(e+ ++t);while(gd.isVariableCharacter(i)||gd.isDigitCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}n=10;do t+=1,i=this.value.charCodeAt(e+t);while(!isNaN(i)&&typeof gd._table[i]>"u"&&!gd.isDigitCharacter(i)&&!gd.isVariableCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}};gd._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};let wZ=gd;class Zx{constructor(){this._children=[]}appendChild(e){return e instanceof $o&&this._children[this._children.length-1]instanceof $o?this._children[this._children.length-1].value+=e.value:(e.parent=this,this._children.push(e)),this}replace(e,t){const{parent:i}=e,n=i.children.indexOf(e),r=i.children.slice(0);r.splice(n,1,...t),i._children=r,function o(a,l){for(const d of a)d.parent=l,o(d.children,d)}(t,i)}get children(){return this._children}get rightMostDescendant(){return this._children.length>0?this._children[this._children.length-1].rightMostDescendant:this}get snippet(){let e=this;for(;;){if(!e)return;if(e instanceof KN)return e;e=e.parent}}toString(){return this.children.reduce((e,t)=>e+t.toString(),"")}len(){return 0}}class $o extends Zx{constructor(e){super(),this.value=e}toString(){return this.value}len(){return this.value.length}clone(){return new $o(this.value)}}class I0e extends Zx{}class Lc extends I0e{static compareByIndex(e,t){return e.index===t.index?0:e.isFinalTabstop?1:t.isFinalTabstop||e.index<t.index?-1:e.index>t.index?1:0}constructor(e){super(),this.index=e}get isFinalTabstop(){return this.index===0}get choice(){return this._children.length===1&&this._children[0]instanceof Xx?this._children[0]:void 0}clone(){const e=new Lc(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}class Xx extends Zx{constructor(){super(...arguments),this.options=[]}appendChild(e){return e instanceof $o&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const e=new Xx;return this.options.forEach(e.appendChild,e),e}}class cne extends Zx{constructor(){super(...arguments),this.regexp=new RegExp("")}resolve(e){const t=this;let i=!1,n=e.replace(this.regexp,function(){return i=!0,t._replace(Array.prototype.slice.call(arguments,0,-2))});return!i&&this._children.some(r=>r instanceof uu&&!!r.elseValue)&&(n=this._replace([])),n}_replace(e){let t="";for(const i of this._children)if(i instanceof uu){let n=e[i.index]||"";n=i.resolve(n),t+=n}else t+=i.toString();return t}toString(){return""}clone(){const e=new cne;return e.regexp=new RegExp(this.regexp.source,(this.regexp.ignoreCase?"i":"")+(this.regexp.global?"g":"")),e._children=this.children.map(t=>t.clone()),e}}class uu extends Zx{constructor(e,t,i,n){super(),this.index=e,this.shorthandName=t,this.ifValue=i,this.elseValue=n}resolve(e){return this.shorthandName==="upcase"?e?e.toLocaleUpperCase():"":this.shorthandName==="downcase"?e?e.toLocaleLowerCase():"":this.shorthandName==="capitalize"?e?e[0].toLocaleUpperCase()+e.substr(1):"":this.shorthandName==="pascalcase"?e?this._toPascalCase(e):"":this.shorthandName==="camelcase"?e?this._toCamelCase(e):"":e&&typeof this.ifValue=="string"?this.ifValue:!e&&typeof this.elseValue=="string"?this.elseValue:e||""}_toPascalCase(e){const t=e.match(/[a-z0-9]+/gi);return t?t.map(i=>i.charAt(0).toUpperCase()+i.substr(1)).join(""):e}_toCamelCase(e){const t=e.match(/[a-z0-9]+/gi);return t?t.map((i,n)=>n===0?i.charAt(0).toLowerCase()+i.substr(1):i.charAt(0).toUpperCase()+i.substr(1)).join(""):e}clone(){return new uu(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class NT extends I0e{constructor(e){super(),this.name=e}resolve(e){let t=e.resolve(this);return this.transform&&(t=this.transform.resolve(t||"")),t!==void 0?(this._children=[new $o(t)],!0):!1}clone(){const e=new NT(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}function Yfe(s,e){const t=[...s];for(;t.length>0;){const i=t.shift();if(!e(i))break;t.unshift(...i.children)}}class KN extends Zx{get placeholderInfo(){if(!this._placeholders){const e=[];let t;this.walk(function(i){return i instanceof Lc&&(e.push(i),t=!t||t.index<i.index?i:t),!0}),this._placeholders={all:e,last:t}}return this._placeholders}get placeholders(){const{all:e}=this.placeholderInfo;return e}offset(e){let t=0,i=!1;return this.walk(n=>n===e?(i=!0,!1):(t+=n.len(),!0)),i?t:-1}fullLen(e){let t=0;return Yfe([e],i=>(t+=i.len(),!0)),t}enclosingPlaceholders(e){const t=[];let{parent:i}=e;for(;i;)i instanceof Lc&&t.push(i),i=i.parent;return t}resolveVariables(e){return this.walk(t=>(t instanceof NT&&t.resolve(e)&&(this._placeholders=void 0),!0)),this}appendChild(e){return this._placeholders=void 0,super.appendChild(e)}replace(e,t){return this._placeholders=void 0,super.replace(e,t)}clone(){const e=new KN;return this._children=this.children.map(t=>t.clone()),e}walk(e){Yfe(this.children,e)}}class hy{constructor(){this._scanner=new wZ,this._token={type:14,pos:0,len:0}}static escape(e){return e.replace(/\$|}|\\/g,"\\$&")}static guessNeedsClipboard(e){return/\${?CLIPBOARD/.test(e)}parse(e,t,i){const n=new KN;return this.parseFragment(e,n),this.ensureFinalTabstop(n,i??!1,t??!1),n}parseFragment(e,t){const i=t.children.length;for(this._scanner.text(e),this._token=this._scanner.next();this._parse(t););const n=new Map,r=[];t.walk(l=>(l instanceof Lc&&(l.isFinalTabstop?n.set(0,void 0):!n.has(l.index)&&l.children.length>0?n.set(l.index,l.children):r.push(l)),!0));const o=(l,d)=>{const h=n.get(l.index);if(!h)return;const f=new Lc(l.index);f.transform=l.transform;for(const p of h){const m=p.clone();f.appendChild(m),m instanceof Lc&&n.has(m.index)&&!d.has(m.index)&&(d.add(m.index),o(m,d),d.delete(m.index))}t.replace(l,[f])},a=new Set;for(const l of r)o(l,a);return t.children.slice(i)}ensureFinalTabstop(e,t,i){(t||i&&e.placeholders.length>0)&&(e.placeholders.find(r=>r.index===0)||e.appendChild(new Lc(0)))}_accept(e,t){if(e===void 0||this._token.type===e){const i=t?this._scanner.tokenText(this._token):!0;return this._token=this._scanner.next(),i}return!1}_backTo(e){return this._scanner.pos=e.pos+e.len,this._token=e,!1}_until(e){const t=this._token;for(;this._token.type!==e;){if(this._token.type===14)return!1;if(this._token.type===5){const n=this._scanner.next();if(n.type!==0&&n.type!==4&&n.type!==5)return!1}this._token=this._scanner.next()}const i=this._scanner.value.substring(t.pos,this._token.pos).replace(/\\(\$|}|\\)/g,"$1");return this._token=this._scanner.next(),i}_parse(e){return this._parseEscaped(e)||this._parseTabstopOrVariableName(e)||this._parseComplexPlaceholder(e)||this._parseComplexVariable(e)||this._parseAnything(e)}_parseEscaped(e){let t;return(t=this._accept(5,!0))?(t=this._accept(0,!0)||this._accept(4,!0)||this._accept(5,!0)||t,e.appendChild(new $o(t)),!0):!1}_parseTabstopOrVariableName(e){let t;const i=this._token;return this._accept(0)&&(t=this._accept(9,!0)||this._accept(8,!0))?(e.appendChild(/^\d+$/.test(t)?new Lc(Number(t)):new NT(t)),!0):this._backTo(i)}_parseComplexPlaceholder(e){let t;const i=this._token;if(!(this._accept(0)&&this._accept(3)&&(t=this._accept(8,!0))))return this._backTo(i);const r=new Lc(Number(t));if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(r),!0;if(!this._parse(r))return e.appendChild(new $o("${"+t+":")),r.children.forEach(e.appendChild,e),!0}else if(r.index>0&&this._accept(7)){const o=new Xx;for(;;){if(this._parseChoiceElement(o)){if(this._accept(2))continue;if(this._accept(7)&&(r.appendChild(o),this._accept(4)))return e.appendChild(r),!0}return this._backTo(i),!1}}else return this._accept(6)?this._parseTransform(r)?(e.appendChild(r),!0):(this._backTo(i),!1):this._accept(4)?(e.appendChild(r),!0):this._backTo(i)}_parseChoiceElement(e){const t=this._token,i=[];for(;!(this._token.type===2||this._token.type===7);){let n;if((n=this._accept(5,!0))?n=this._accept(2,!0)||this._accept(7,!0)||this._accept(5,!0)||n:n=this._accept(void 0,!0),!n)return this._backTo(t),!1;i.push(n)}return i.length===0?(this._backTo(t),!1):(e.appendChild(new $o(i.join(""))),!0)}_parseComplexVariable(e){let t;const i=this._token;if(!(this._accept(0)&&this._accept(3)&&(t=this._accept(9,!0))))return this._backTo(i);const r=new NT(t);if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(r),!0;if(!this._parse(r))return e.appendChild(new $o("${"+t+":")),r.children.forEach(e.appendChild,e),!0}else return this._accept(6)?this._parseTransform(r)?(e.appendChild(r),!0):(this._backTo(i),!1):this._accept(4)?(e.appendChild(r),!0):this._backTo(i)}_parseTransform(e){const t=new cne;let i="",n="";for(;!this._accept(6);){let r;if(r=this._accept(5,!0)){r=this._accept(6,!0)||r,i+=r;continue}if(this._token.type!==14){i+=this._accept(void 0,!0);continue}return!1}for(;!this._accept(6);){let r;if(r=this._accept(5,!0)){r=this._accept(5,!0)||this._accept(6,!0)||r,t.appendChild(new $o(r));continue}if(!(this._parseFormatString(t)||this._parseAnything(t)))return!1}for(;!this._accept(4);){if(this._token.type!==14){n+=this._accept(void 0,!0);continue}return!1}try{t.regexp=new RegExp(i,n)}catch{return!1}return e.transform=t,!0}_parseFormatString(e){const t=this._token;if(!this._accept(0))return!1;let i=!1;this._accept(3)&&(i=!0);const n=this._accept(8,!0);if(n)if(i){if(this._accept(4))return e.appendChild(new uu(Number(n))),!0;if(!this._accept(1))return this._backTo(t),!1}else return e.appendChild(new uu(Number(n))),!0;else return this._backTo(t),!1;if(this._accept(6)){const r=this._accept(9,!0);return!r||!this._accept(4)?(this._backTo(t),!1):(e.appendChild(new uu(Number(n),r)),!0)}else if(this._accept(11)){const r=this._until(4);if(r)return e.appendChild(new uu(Number(n),void 0,r,void 0)),!0}else if(this._accept(12)){const r=this._until(4);if(r)return e.appendChild(new uu(Number(n),void 0,void 0,r)),!0}else if(this._accept(13)){const r=this._until(1);if(r){const o=this._until(4);if(o)return e.appendChild(new uu(Number(n),void 0,r,o)),!0}}else{const r=this._until(4);if(r)return e.appendChild(new uu(Number(n),void 0,void 0,r)),!0}return this._backTo(t),!1}_parseAnything(e){return this._token.type!==14?(e.appendChild(new $o(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}}function E0e(s,e,t){var i,n;return(typeof t.insertText=="string"?t.insertText==="":t.insertText.snippet==="")?{edits:((i=t.additionalEdit)==null?void 0:i.edits)??[]}:{edits:[...e.map(r=>new Nm(s,{range:r,text:typeof t.insertText=="string"?hy.escape(t.insertText)+"$0":t.insertText.snippet,insertAsSnippet:!0})),...((n=t.additionalEdit)==null?void 0:n.edits)??[]]}}function T0e(s){function e(o,a){return"mimeType"in o?o.mimeType===a.handledMimeType:!!a.kind&&o.kind.contains(a.kind)}const t=new Map;for(const o of s)for(const a of o.yieldTo??[])for(const l of s)if(l!==o&&e(a,l)){let d=t.get(o);d||(d=[],t.set(o,d)),d.push(l)}if(!t.size)return Array.from(s);const i=new Set,n=[];function r(o){if(!o.length)return[];const a=o[0];if(n.includes(a))return console.warn("Yield to cycle detected",a),o;if(i.has(a))return r(o.slice(1));let l=[];const d=t.get(a);return d&&(n.push(a),l=r(d),n.pop()),i.add(a),[...l,a,...r(o.slice(1))]}return r(Array.from(s))}var Aet=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},Fet=function(s,e){return function(t,i){e(t,i,s)}};const Bet=At.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:nbe,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}}),cW=class cW extends re{constructor(e,t,i,n,r){super(),this.typeId=e,this.editor=t,this.range=i,this.delegate=r,this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this.create(n),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this)}create(e){this.domNode=Fe(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;const t=Fe("span.icon");this.domNode.append(t),t.classList.add(...Ct.asClassNameArray(Oe.loading),"codicon-modifier-spin");const i=()=>{const n=this.editor.getOption(67);this.domNode.style.height=`${n}px`,this.domNode.style.width=`${Math.ceil(.8*n)}px`};i(),this._register(this.editor.onDidChangeConfiguration(n=>{(n.hasChanged(52)||n.hasChanged(67))&&i()})),this._register(ue(this.domNode,Ae.CLICK,n=>{this.delegate.cancel()}))}getId(){return cW.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:{lineNumber:this.range.startLineNumber,column:this.range.startColumn},preference:[0]}}dispose(){super.dispose(),this.editor.removeContentWidget(this)}};cW.baseId="editor.widget.inlineProgressWidget";let SZ=cW,f3=class extends re{constructor(e,t,i){super(),this.id=e,this._editor=t,this._instantiationService=i,this._showDelay=500,this._showPromise=this._register(new tr),this._currentWidget=this._register(new tr),this._operationIdPool=0,this._currentDecorations=t.createDecorationsCollection()}dispose(){super.dispose(),this._currentDecorations.clear()}async showWhile(e,t,i,n,r){const o=this._operationIdPool++;this._currentOperation=o,this.clear(),this._showPromise.value=l_(()=>{const a=W.fromPositions(e);this._currentDecorations.set([{range:a,options:Bet}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(SZ,this.id,this._editor,a,t,n))},r??this._showDelay);try{return await i}finally{this._currentOperation===o&&(this.clear(),this._currentOperation=void 0)}}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};f3=Aet([Fet(2,ht)],f3);var Wet=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},Zfe=function(s,e){return function(t,i){e(t,i,s)}},DF,Am;let ll=(Am=class{static get(e){return e.getContribution(DF.ID)}constructor(e,t,i){this._openerService=i,this._messageWidget=new tr,this._messageListeners=new me,this._mouseOverMessage=!1,this._editor=e,this._visible=DF.MESSAGE_VISIBLE.bindTo(t)}dispose(){var e;(e=this._message)==null||e.dispose(),this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(e,t){ea(Mu(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=Mu(e)?oH(e,{actionHandler:{callback:n=>{this.closeMessage(),Ite(this._openerService,n,Mu(e)?e.isTrusted:void 0)},disposables:this._messageListeners}}):void 0,this._messageWidget.value=new Xfe(this._editor,t,typeof e=="string"?e:this._message.element),this._messageListeners.add(We.debounce(this._editor.onDidBlurEditorText,(n,r)=>r,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&Xs(Ur(),this._messageWidget.value.getDomNode())||this.closeMessage()})),this._messageListeners.add(this._editor.onDidChangeCursorPosition(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidDispose(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidChangeModel(()=>this.closeMessage())),this._messageListeners.add(ue(this._messageWidget.value.getDomNode(),Ae.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(ue(this._messageWidget.value.getDomNode(),Ae.MOUSE_LEAVE,()=>this._mouseOverMessage=!1,!0));let i;this._messageListeners.add(this._editor.onMouseMove(n=>{n.target.position&&(i?i.containsPosition(n.target.position)||this.closeMessage():i=new W(t.lineNumber-3,1,n.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(Xfe.fadeOut(this._messageWidget.value))}},DF=Am,Am.ID="editor.contrib.messageController",Am.MESSAGE_VISIBLE=new qe("messageVisible",!1,w("messageVisible","Whether the editor is currently showing an inline message")),Am);ll=DF=Wet([Zfe(1,wt),Zfe(2,Na)],ll);const Vet=zs.bindToContribution(ll.get);Ue(new Vet({id:"leaveEditorMessage",precondition:ll.MESSAGE_VISIBLE,handler:s=>s.closeMessage(),kbOpts:{weight:130,primary:9}}));let Xfe=class{static fadeOut(e){const t=()=>{e.dispose(),clearTimeout(i),e.getDomNode().removeEventListener("animationend",t)},i=setTimeout(t,110);return e.getDomNode().addEventListener("animationend",t),e.getDomNode().classList.add("fadeOut"),{dispose:t}}constructor(e,{lineNumber:t,column:i},n){this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._editor=e,this._editor.revealLinesInCenterIfOutsideViewport(t,t,0),this._position={lineNumber:t,column:i},this._domNode=document.createElement("div"),this._domNode.classList.add("monaco-editor-overlaymessage"),this._domNode.style.marginLeft="-6px";const r=document.createElement("div");r.classList.add("anchor","top"),this._domNode.appendChild(r);const o=document.createElement("div");typeof n=="string"?(o.classList.add("message"),o.textContent=n):(n.classList.add("message"),o.appendChild(n)),this._domNode.appendChild(o);const a=document.createElement("div");a.classList.add("anchor","below"),this._domNode.appendChild(a),this._editor.addContentWidget(this),this._domNode.classList.add("fadeIn")}dispose(){this._editor.removeContentWidget(this)}getId(){return"messageoverlay"}getDomNode(){return this._domNode}getPosition(){return{position:this._position,preference:[1,2],positionAffinity:1}}afterRender(e){this._domNode.classList.toggle("below",e===2)}};pi(ll.ID,ll,4);function _j(s,e){return e&&(s.stack||s.stacktrace)?w("stackTrace.format","{0}: {1}",Jfe(s),Qfe(s.stack)||Qfe(s.stacktrace)):Jfe(s)}function Qfe(s){return Array.isArray(s)?s.join(`
|
|
829
829
|
`):s}function Jfe(s){return s.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${s.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof s.code=="string"&&typeof s.errno=="number"&&typeof s.syscall=="string"?w("nodeExceptionMessage","A system error occurred ({0})",s.message):s.message||w("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}function g3(s=null,e=!1){if(!s)return w("error.defaultMessage","An unknown error occurred. Please consult the log for more details.");if(Array.isArray(s)){const t=Ed(s),i=g3(t[0],e);return t.length>1?w("error.moreErrors","{0} ({1} errors in total)",i,t.length):i}if(wa(s))return s;if(s.detail){const t=s.detail;if(t.error)return _j(t.error,e);if(t.exception)return _j(t.exception,e)}return s.stack?_j(s,e):s.message?s.message:w("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}var N0e=function(s,e,t,i){var n=arguments.length,r=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(o=s[a])&&(r=(n<3?o(r):n>3?o(e,t,r):o(e,t))||r);return n>3&&r&&Object.defineProperty(e,t,r),r},uS=function(s,e){return function(t,i){e(t,i,s)}},xZ,nC;let kZ=(nC=class extends re{constructor(e,t,i,n,r,o,a,l,d,h){super(),this.typeId=e,this.editor=t,this.showCommand=n,this.range=r,this.edits=o,this.onSelectNewEdit=a,this._contextMenuService=l,this._keybindingService=h,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=i.bindTo(d),this.visibleContext.set(!0),this._register(ut(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(ut(()=>this.editor.removeContentWidget(this))),this._register(this.editor.onDidChangeCursorPosition(f=>{r.containsPosition(f.position)||this.dispose()})),this._register(We.runAndSubscribe(h.onDidUpdateKeybindings,()=>{this._updateButtonTitle()}))}_updateButtonTitle(){var t;const e=(t=this._keybindingService.lookupKeybinding(this.showCommand.id))==null?void 0:t.getLabel();this.button.element.title=this.showCommand.label+(e?` (${e})`:"")}create(){this.domNode=Fe(".post-edit-widget"),this.button=this._register(new C5(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(ue(this.domNode,Ae.CLICK,()=>this.showSelector()))}getId(){return xZ.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const e=is(this.button.element);return{x:e.left+e.width,y:e.top+e.height}},getActions:()=>this.edits.allEdits.map((e,t)=>Ab({id:"",label:e.title,checked:t===this.edits.activeEditIndex,run:()=>{if(t!==this.edits.activeEditIndex)return this.onSelectNewEdit(t)}}))})}},xZ=nC,nC.baseId="editor.widget.postEditWidget",nC);kZ=xZ=N0e([uS(7,pl),uS(8,wt),uS(9,Ri)],kZ);let p3=class extends re{constructor(e,t,i,n,r,o,a){super(),this._id=e,this._editor=t,this._visibleContext=i,this._showCommand=n,this._instantiationService=r,this._bulkEditService=o,this._notificationService=a,this._currentWidget=this._register(new tr),this._register(We.any(t.onDidChangeModel,t.onDidChangeModelContent)(()=>this.clear()))}async applyEditAndShowIfNeeded(e,t,i,n,r){const o=this._editor.getModel();if(!o||!e.length)return;const a=t.allEdits.at(t.activeEditIndex);if(!a)return;const l=async y=>{const x=this._editor.getModel();x&&(await x.undo(),this.applyEditAndShowIfNeeded(e,{activeEditIndex:y,allEdits:t.allEdits},i,n,r))},d=(y,x)=>{Uc(y)||(this._notificationService.error(x),i&&this.show(e[0],t,l))};let h;try{h=await n(a,r)}catch(y){return d(y,w("resolveError",`Error resolving edit '{0}':
|
|
@@ -946,7 +946,7 @@ ${this.parser.parse(s)}</blockquote>
|
|
|
946
946
|
${s}</tr>
|
|
947
947
|
`}tablecell(s){let e=this.parser.parseInline(s.tokens),t=s.header?"th":"td";return(s.align?`<${t} align="${s.align}">`:`<${t}>`)+e+`</${t}>
|
|
948
948
|
`}strong({tokens:s}){return`<strong>${this.parser.parseInline(s)}</strong>`}em({tokens:s}){return`<em>${this.parser.parseInline(s)}</em>`}codespan({text:s}){return`<code>${Ch(s,!0)}</code>`}br(s){return"<br>"}del({tokens:s}){return`<del>${this.parser.parseInline(s)}</del>`}link({href:s,title:e,tokens:t}){let i=this.parser.parseInline(t),n=Ape(s);if(n===null)return i;s=n;let r='<a href="'+s+'"';return e&&(r+=' title="'+Ch(e)+'"'),r+=">"+i+"</a>",r}image({href:s,title:e,text:t,tokens:i}){i&&(t=this.parser.parseInline(i,this.parser.textRenderer));let n=Ape(s);if(n===null)return Ch(t);s=n;let r=`<img src="${s}" alt="${Ch(t)}"`;return e&&(r+=` title="${Ch(e)}"`),r+=">",r}text(s){return"tokens"in s&&s.tokens?this.parser.parseInline(s.tokens):"escaped"in s&&s.escaped?s.text:Ch(s.text)}},ose=class{strong({text:s}){return s}em({text:s}){return s}codespan({text:s}){return s}del({text:s}){return s}html({text:s}){return s}text({text:s}){return s}link({text:s}){return""+s}image({text:s}){return""+s}br(){return""}checkbox({raw:s}){return s}},mu=class sJ{constructor(e){ui(this,"options");ui(this,"renderer");ui(this,"textRenderer");this.options=e||Yy,this.options.renderer=this.options.renderer||new hB,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ose}static parse(e,t){return new sJ(t).parse(e)}static parseInline(e,t){return new sJ(t).parseInline(e)}parse(e){var i,n;this.renderer.parser=this;let t="";for(let r=0;r<e.length;r++){let o=e[r];if((n=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&n[o.type]){let l=o,d=this.options.extensions.renderers[l.type].call({parser:this},l);if(d!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){t+=d||"";continue}}let a=o;switch(a.type){case"space":{t+=this.renderer.space(a);break}case"hr":{t+=this.renderer.hr(a);break}case"heading":{t+=this.renderer.heading(a);break}case"code":{t+=this.renderer.code(a);break}case"table":{t+=this.renderer.table(a);break}case"blockquote":{t+=this.renderer.blockquote(a);break}case"list":{t+=this.renderer.list(a);break}case"checkbox":{t+=this.renderer.checkbox(a);break}case"html":{t+=this.renderer.html(a);break}case"def":{t+=this.renderer.def(a);break}case"paragraph":{t+=this.renderer.paragraph(a);break}case"text":{t+=this.renderer.text(a);break}default:{let l='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return t}parseInline(e,t=this.renderer){var n,r;this.renderer.parser=this;let i="";for(let o=0;o<e.length;o++){let a=e[o];if((r=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&r[a.type]){let d=this.options.extensions.renderers[a.type].call({parser:this},a);if(d!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){i+=d||"";continue}}let l=a;switch(l.type){case"escape":{i+=t.text(l);break}case"html":{i+=t.html(l);break}case"link":{i+=t.link(l);break}case"image":{i+=t.image(l);break}case"checkbox":{i+=t.checkbox(l);break}case"strong":{i+=t.strong(l);break}case"em":{i+=t.em(l);break}case"codespan":{i+=t.codespan(l);break}case"br":{i+=t.br(l);break}case"del":{i+=t.del(l);break}case"text":{i+=t.text(l);break}default:{let d='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return i}},W2,rI=(W2=class{constructor(s){ui(this,"options");ui(this,"block");this.options=s||Yy}preprocess(s){return s}postprocess(s){return s}processAllTokens(s){return s}emStrongMask(s){return s}provideLexer(){return this.block?pu.lex:pu.lexInline}provideParser(){return this.block?mu.parse:mu.parseInline}},ui(W2,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ui(W2,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),W2),Zut=class{constructor(...s){ui(this,"defaults",Qne());ui(this,"options",this.setOptions);ui(this,"parse",this.parseMarkdown(!0));ui(this,"parseInline",this.parseMarkdown(!1));ui(this,"Parser",mu);ui(this,"Renderer",hB);ui(this,"TextRenderer",ose);ui(this,"Lexer",pu);ui(this,"Tokenizer",uB);ui(this,"Hooks",rI);this.use(...s)}walkTokens(s,e){var i,n;let t=[];for(let r of s)switch(t=t.concat(e.call(this,r)),r.type){case"table":{let o=r;for(let a of o.header)t=t.concat(this.walkTokens(a.tokens,e));for(let a of o.rows)for(let l of a)t=t.concat(this.walkTokens(l.tokens,e));break}case"list":{let o=r;t=t.concat(this.walkTokens(o.items,e));break}default:{let o=r;(n=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&n[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{let l=o[a].flat(1/0);t=t.concat(this.walkTokens(l,e))}):o.tokens&&(t=t.concat(this.walkTokens(o.tokens,e)))}}return t}use(...s){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return s.forEach(t=>{let i={...t};if(i.async=this.defaults.async||i.async||!1,t.extensions&&(t.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let r=e.renderers[n.name];r?e.renderers[n.name]=function(...o){let a=n.renderer.apply(this,o);return a===!1&&(a=r.apply(this,o)),a}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=e[n.level];r?r.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),i.extensions=e),t.renderer){let n=this.defaults.renderer||new hB(this.defaults);for(let r in t.renderer){if(!(r in n))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let o=r,a=t.renderer[o],l=n[o];n[o]=(...d)=>{let h=a.apply(n,d);return h===!1&&(h=l.apply(n,d)),h||""}}i.renderer=n}if(t.tokenizer){let n=this.defaults.tokenizer||new uB(this.defaults);for(let r in t.tokenizer){if(!(r in n))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let o=r,a=t.tokenizer[o],l=n[o];n[o]=(...d)=>{let h=a.apply(n,d);return h===!1&&(h=l.apply(n,d)),h}}i.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new rI;for(let r in t.hooks){if(!(r in n))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let o=r,a=t.hooks[o],l=n[o];rI.passThroughHooks.has(r)?n[o]=d=>{if(this.defaults.async&&rI.passThroughHooksRespectAsync.has(r))return(async()=>{let f=await a.call(n,d);return l.call(n,f)})();let h=a.call(n,d);return l.call(n,h)}:n[o]=(...d)=>{if(this.defaults.async)return(async()=>{let f=await a.apply(n,d);return f===!1&&(f=await l.apply(n,d)),f})();let h=a.apply(n,d);return h===!1&&(h=l.apply(n,d)),h}}i.hooks=n}if(t.walkTokens){let n=this.defaults.walkTokens,r=t.walkTokens;i.walkTokens=function(o){let a=[];return a.push(r.call(this,o)),n&&(a=a.concat(n.call(this,o))),a}}this.defaults={...this.defaults,...i}}),this}setOptions(s){return this.defaults={...this.defaults,...s},this}lexer(s,e){return pu.lex(s,e??this.defaults)}parser(s,e){return mu.parse(s,e??this.defaults)}parseMarkdown(s){return(e,t)=>{let i={...t},n={...this.defaults,...i},r=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&i.async===!1)return r(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return r(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=s),n.async)return(async()=>{let o=n.hooks?await n.hooks.preprocess(e):e,a=await(n.hooks?await n.hooks.provideLexer():s?pu.lex:pu.lexInline)(o,n),l=n.hooks?await n.hooks.processAllTokens(a):a;n.walkTokens&&await Promise.all(this.walkTokens(l,n.walkTokens));let d=await(n.hooks?await n.hooks.provideParser():s?mu.parse:mu.parseInline)(l,n);return n.hooks?await n.hooks.postprocess(d):d})().catch(r);try{n.hooks&&(e=n.hooks.preprocess(e));let o=(n.hooks?n.hooks.provideLexer():s?pu.lex:pu.lexInline)(e,n);n.hooks&&(o=n.hooks.processAllTokens(o)),n.walkTokens&&this.walkTokens(o,n.walkTokens);let a=(n.hooks?n.hooks.provideParser():s?mu.parse:mu.parseInline)(o,n);return n.hooks&&(a=n.hooks.postprocess(a)),a}catch(o){return r(o)}}}onError(s,e){return t=>{if(t.message+=`
|
|
949
|
-
Please report this to https://github.com/markedjs/marked.`,s){let i="<p>An error occurred:</p><pre>"+Ch(t.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(t);throw t}}},wy=new Zut;function Zn(s,e){return wy.parse(s,e)}Zn.options=Zn.setOptions=function(s){return wy.setOptions(s),Zn.defaults=wy.defaults,qxe(Zn.defaults),Zn};Zn.getDefaults=Qne;Zn.defaults=Yy;Zn.use=function(...s){return wy.use(...s),Zn.defaults=wy.defaults,qxe(Zn.defaults),Zn};Zn.walkTokens=function(s,e){return wy.walkTokens(s,e)};Zn.parseInline=wy.parseInline;Zn.Parser=mu;Zn.parser=mu.parse;Zn.Renderer=hB;Zn.TextRenderer=ose;Zn.Lexer=pu;Zn.lexer=pu.lex;Zn.Tokenizer=uB;Zn.Hooks=rI;Zn.parse=Zn;Zn.options;Zn.setOptions;Zn.use;Zn.walkTokens;Zn.parseInline;mu.parse;pu.lex;function a7(s){return{completed:"✅",in_progress:"🔄",pending:"⬜",cancelled:"❌"}[s]||"⬜"}function l7(s,e){try{const t=JSON.parse(e);return s==="bash"||s==="execute_bash"?t.command+(t.workdir?` (${t.workdir})`:""):s==="read_file"?t.file_path+(t.offset?`:${t.offset}`:""):s==="edit_file"||s==="write_file"?t.file_path:s==="glob"||s==="find_files"?t.pattern+(t.directory?` (${t.directory})`:""):s==="grep"||s==="search_content"?`"${t.pattern}" (${t.directory||""})`:e}catch{return e}}function ase(s){var e;return((e=s==null?void 0:s.function)==null?void 0:e.name)||"unknown_tool"}function lse(s){var e;return((e=s==null?void 0:s.function)==null?void 0:e.arguments)||""}function ik(s){return s?Zn(s):""}function VF(s){return{type:"think",content:s,renderedContent:ik(s)}}function rJ(s){const e=(s==null?void 0:s.thought)||"";return{type:"step",thought:e,renderedThought:ik(e),toolCalls:Array.isArray(s==null?void 0:s.toolCalls)?s.toolCalls.filter(Boolean):[],success:s==null?void 0:s.success}}function Xut(s,e){return!s||typeof s!="object"?{type:"system",content:String(s),_id:`log-${e()}`}:s._id?s:{...s,_id:`log-${e()}`}}function oJ(s){return s?{scrollTop:s.scrollTop,scrollHeight:s.scrollHeight,clientHeight:s.clientHeight}:null}function aJ(s,{force:e=!1,threshold:t=150,prevSnapshot:i=null}={}){if(!s){console.log("[scrollToBottom] container is null/undefined, skip");return}const n=s.scrollHeight-s.scrollTop-s.clientHeight;if(e){s.scrollTop=s.scrollHeight,console.log("[scrollToBottom] force scroll → scrollTop:",s.scrollHeight,"| curDist:",n);return}const r=i?i.scrollHeight-i.scrollTop-i.clientHeight:n;console.log("[scrollToBottom] force: false | scrollTop:",s.scrollTop,"| scrollHeight:",s.scrollHeight,"| clientHeight:",s.clientHeight,"| curDist:",n,"| refDist:",r,"| threshold:",t),r<=t?(s.scrollTop=s.scrollHeight,console.log("[scrollToBottom] SCROLL (refDist <= threshold)")):console.log("[scrollToBottom] SKIP (refDist > threshold, user was away from bottom)")}const Qut={name:"ResizableTextarea",props:{value:{type:String,default:""},rows:{type:Number,default:5},minRows:{type:Number,default:2},maxRows:{type:Number,default:20}},data(){return{internalValue:this.value,currentRows:this.rows,isResizing:!1,isHovering:!1,startY:0,startRows:0}},computed:{showHandle(){return!0}},watch:{value(s){this.internalValue=s},internalValue(s){this.$emit("input",s)}},mounted(){document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.stopResize),this.$nextTick(()=>{var e;const s=(e=this.$el)==null?void 0:e.querySelector("textarea");s&&s.addEventListener("paste",this.handlePaste)})},beforeDestroy(){var e;document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.stopResize);const s=(e=this.$el)==null?void 0:e.querySelector("textarea");s&&s.removeEventListener("paste",this.handlePaste)},methods:{handleMouseEnter(){this.isHovering=!0},handleMouseLeave(){this.isResizing||(this.isHovering=!1)},startResize(s){this.isResizing=!0,this.isHovering=!1,this.startY=s.clientY,this.startRows=this.currentRows,document.body.style.cursor="ns-resize",document.body.style.userSelect="none"},handleMouseMove(s){if(!this.isResizing)return;const e=this.startY-s.clientY,i=Math.round(this.startRows+e/20);this.currentRows=Math.max(this.minRows,Math.min(this.maxRows,i))},stopResize(){this.isResizing&&(this.isResizing=!1,document.body.style.cursor="",document.body.style.userSelect="")},handlePaste(s){var i;const e=(i=s.clipboardData)==null?void 0:i.items;if(!e)return;const t=[];for(const n of e)n.type.startsWith("image/")&&t.push(n.getAsFile());t.length>0&&(s.preventDefault(),this.$emit("paste-image",t))}}};var Jut=function(){var e=this,t=e._self._c;return t("div",{staticClass:"resizable-textarea-outer",class:{"resize-hand-active":e.isResizing}},[e.showHandle?t("div",{staticClass:"resize-hand",on:{mousedown:e.startResize,mouseenter:e.handleMouseEnter,mouseleave:e.handleMouseLeave}}):e._e(),t("el-input",e._b({attrs:{type:"textarea",rows:e.currentRows},model:{value:e.internalValue,callback:function(i){e.internalValue=i},expression:"internalValue"}},"el-input",e.$attrs,!1)),e.showHandle&&e.isHovering?t("div",{staticClass:"resize-indicator"}):e._e()],1)},eht=[],tht=Li(Qut,Jut,eht,!1,null,"16456784");const cse=tht.exports,iht={name:"ImagePreviewList",props:{files:{type:Array,default:()=>[]},disabled:{type:Boolean,default:!1}}};var nht=function(){var e=this,t=e._self._c;return t("div",{staticClass:"image-preview-list"},e._l(e.files,function(i){return t("div",{key:i.id,staticClass:"image-preview-item"},[t("img",{staticClass:"thumbnail",attrs:{src:i.dataUrl}}),i.uploading?t("div",{staticClass:"upload-loading"},[t("span",{staticClass:"loading-spinner"})]):t("button",{staticClass:"remove-btn",attrs:{disabled:e.disabled},on:{click:function(n){return e.$emit("remove",i.id)}}},[e._v("×")])])}),0)},sht=[],rht=Li(iht,nht,sht,!1,null,"8e2530ba");const ike=rht.exports,oht={name:"FileSelectTreeNode",props:{node:{type:Object,required:!0},level:{type:Number,default:0},selectedPath:{type:String,default:""}},data(){return{expanded:!1,loading:!1,loadedChildren:this.node.children||[]}},computed:{isSelected(){return this.selectedPath===this.node.path}},watch:{node:{immediate:!0,handler(s){s.children&&s.children.length>0&&(this.loadedChildren=s.children)}}},methods:{async toggleExpand(){if(this.node.is_directory)if(!this.expanded&&this.loadedChildren.length===0&&this.node.has_children){this.loading=!0;try{this.$emit("load-children",{path:this.node.path,callback:s=>{this.loadedChildren=s,this.expanded=!0,this.loading=!1}})}catch(s){console.error("Failed to load children:",s),this.loading=!1}}else this.expanded=!this.expanded},handleClick(){this.$emit("select",this.node),this.node.is_directory&&this.toggleExpand()},handleDblClick(){},getFileIcon(s,e){if(e)return"fa-solid fa-folder text-yellow-500";const t=s.split(".").pop().toLowerCase(),i=s.toLowerCase(),n={js:"fa-brands fa-js text-yellow-400",jsx:"fa-brands fa-react text-blue-400",ts:"fa-brands fa-js text-blue-400",tsx:"fa-brands fa-react text-blue-400",html:"fa-brands fa-html5 text-orange-500",htm:"fa-brands fa-html5 text-orange-500",css:"fa-brands fa-css3 text-blue-400",scss:"fa-brands fa-sass text-pink-400",sass:"fa-brands fa-sass text-pink-400",vue:"fa-brands fa-vuejs text-green-400",py:"fa-brands fa-python text-blue-500",pyc:"fa-brands fa-python text-gray-400",json:"fa-solid fa-file-code text-yellow-300",yaml:"fa-solid fa-file-code text-blue-300",yml:"fa-solid fa-file-code text-blue-300",xml:"fa-solid fa-file-code text-orange-300",md:"fa-solid fa-file-lines text-gray-400",markdown:"fa-solid fa-file-lines text-gray-400",sql:"fa-solid fa-database text-gray-400",sh:"fa-solid fa-terminal text-green-400",bash:"fa-solid fa-terminal text-green-400",go:"fa-brands fa-golang text-cyan-400",rs:"fa-brands fa-rust text-orange-400",java:"fa-brands fa-java text-red-400",kt:"fa-brands fa-android text-purple-400",swift:"fa-brands fa-apple text-blue-300",c:"fa-solid fa-file-code text-blue-300",cpp:"fa-solid fa-file-code text-blue-400",cc:"fa-solid fa-file-code text-blue-400",h:"fa-solid fa-file-code text-blue-300",hpp:"fa-solid fa-file-code text-blue-400",cs:"fa-brands fa-microsoft text-purple-400",rb:"fa-solid fa-gem text-red-400",php:"fa-brands fa-php text-purple-400",dockerfile:"fa-brands fa-docker text-blue-400",gitignore:"fa-brands fa-git text-red-400",gitattributes:"fa-brands fa-git text-red-400",license:"fa-solid fa-scale-balanced text-yellow-400",png:"fa-solid fa-image text-green-400",jpg:"fa-solid fa-image text-green-400",jpeg:"fa-solid fa-image text-green-400",gif:"fa-solid fa-image text-green-400",svg:"fa-solid fa-image text-green-400",ico:"fa-solid fa-image text-green-400",webp:"fa-solid fa-image text-green-400",bmp:"fa-solid fa-image text-green-400",mp4:"fa-solid fa-film text-purple-400",avi:"fa-solid fa-film text-purple-400",mov:"fa-solid fa-film text-purple-400",mkv:"fa-solid fa-film text-purple-400",mp3:"fa-solid fa-music text-pink-400",wav:"fa-solid fa-music text-pink-400",flac:"fa-solid fa-music text-pink-400",woff:"fa-solid fa-font text-blue-400",woff2:"fa-solid fa-font text-blue-400",ttf:"fa-solid fa-font text-blue-400",otf:"fa-solid fa-font text-blue-400",eot:"fa-solid fa-font text-blue-400",zip:"fa-solid fa-file-zipper text-yellow-600",rar:"fa-solid fa-file-zipper text-yellow-600","7z":"fa-solid fa-file-zipper text-yellow-600",tar:"fa-solid fa-file-zipper text-yellow-600",gz:"fa-solid fa-file-zipper text-yellow-600",pdf:"fa-solid fa-file-pdf text-red-500",doc:"fa-solid fa-file-word text-blue-600",docx:"fa-solid fa-file-word text-blue-600",xls:"fa-solid fa-file-excel text-green-600",xlsx:"fa-solid fa-file-excel text-green-600",ppt:"fa-solid fa-file-powerpoint text-orange-600",pptx:"fa-solid fa-file-powerpoint text-orange-600"};return i==="dockerfile"?n.dockerfile:i===".gitignore"?n.gitignore:i===".gitattributes"?n.gitattributes:i==="license"||i.startsWith("license")?n.license:i.startsWith("readme")?n.md:n[t]||"fa-solid fa-file text-gray-400"}}};var aht=function(){var i;var e=this,t=e._self._c;return t("div",{staticClass:"file-tree-node"},[t("div",{staticClass:"node-content",class:{selected:e.isSelected,directory:e.node.is_directory},style:{paddingLeft:e.level*16+4+"px"},on:{click:e.handleClick,dblclick:e.handleDblClick}},[e.node.is_directory?t("span",{staticClass:"expand-icon",on:{click:function(n){return n.stopPropagation(),e.toggleExpand.apply(null,arguments)}}},[e.loading?t("i",{staticClass:"fa-solid fa-spinner fa-spin"}):e.expanded?t("i",{staticClass:"fa-solid fa-chevron-down"}):e.node.has_children||e.node.children&&e.node.children.length>0?t("i",{staticClass:"fa-solid fa-chevron-right"}):t("span",{staticClass:"placeholder"})]):t("span",{staticClass:"expand-icon placeholder"}),t("span",{staticClass:"node-icon"},[t("i",{class:e.getFileIcon(e.node.name,e.node.is_directory)})]),t("span",{staticClass:"node-name"},[e._v(e._s(e.node.name))])]),e.node.is_directory&&e.expanded&&(e.loadedChildren.length>0||((i=e.node.children)==null?void 0:i.length)>0)?t("div",{staticClass:"children"},e._l(e.loadedChildren.length>0?e.loadedChildren:e.node.children,function(n){return t("file-select-tree-node",{key:n.path,attrs:{node:n,level:e.level+1,"selected-path":e.selectedPath},on:{select:function(r){return e.$emit("select",r)},"enter-dir":function(r){return e.$emit("enter-dir",r)},"load-children":function(r){return e.$emit("load-children",r)}}})}),1):e._e()])},lht=[],cht=Li(oht,aht,lht,!1,null,"1b3867a9");const dht=cht.exports,ED=new Map,nke={on(s,e){return ED.has(s)||ED.set(s,new Set),ED.get(s).add(e),()=>{var t;(t=ED.get(s))==null||t.delete(e)}},emit(s,e){const t=ED.get(s);if(t)for(const i of t)try{i(e)}catch(n){console.error(`[eventBus] ${s} listener error:`,n)}}},uht=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/code`;let or=null,Tg=null,HF=0;const hht=10,fht=1e3,KI=new Map;let B2=new Map,GI=null;const ght=5e3;function pht(s){return KI.has(s)||KI.set(s,[]),KI.get(s)}function mht(s){var i;const{type:e}=s,t=KI.get(e)||[];for(const n of t)try{n(s)}catch(r){console.error("WebSocket listener error:",r)}if(e==="step"){const r=(s.data||s).toolCalls;if(r&&Array.isArray(r))for(const o of r){const a=(i=o.function)==null?void 0:i.name;if(a==="edit_file"||a==="write_file")try{const l=JSON.parse(o.function.arguments||"{}");l.file_path&&(console.log("[WS] emit file:changed",{filePath:l.file_path,action:a}),nke.emit("file:changed",{filePath:l.file_path,action:a}))}catch(l){console.warn("[WS] parse toolCall arguments failed:",l)}}}}function lJ(){if(!(or&&or.readyState===WebSocket.OPEN))try{or=new WebSocket(uht),or.onopen=()=>{console.log("[WS] Connected"),HF=0,Tg&&(clearTimeout(Tg),Tg=null),vht()},or.onmessage=s=>{try{const e=JSON.parse(s.data);mht(e)}catch(e){console.error("[WS] Parse error:",e)}},or.onclose=()=>{console.log("[WS] Closed"),or=null,ske(),Wpe()},or.onerror=s=>{console.error("[WS] Error:",s)}}catch(s){console.error("[WS] Connection error:",s),Wpe()}}function Wpe(){if(HF>=hht){console.log("[WS] Max reconnect attempts reached");return}if(Tg)return;const s=fht*Math.pow(2,HF);HF++,Tg=setTimeout(()=>{Tg=null,lJ()},s)}function _ht(){ske(),Tg&&(clearTimeout(Tg),Tg=null),or&&(or.close(),or=null)}function Vpe(s,e){return or&&or.readyState===WebSocket.OPEN?(or.send(JSON.stringify({type:s,data:e})),!0):!1}function Hpe(){return or&&or.readyState===WebSocket.OPEN}function vht(){GI||(GI=setInterval(()=>{or&&or.readyState===WebSocket.OPEN&&or.send(JSON.stringify({type:"get_running_sessions",data:{}}))},ght),or&&or.readyState===WebSocket.OPEN&&or.send(JSON.stringify({type:"get_running_sessions",data:{}})))}function ske(){GI&&(clearInterval(GI),GI=null)}const Ks={connect:lJ,disconnect:_ht,send:Vpe,isConnected:Hpe,on(s,e){const t=pht(s);return t.push(e),()=>{const i=t.indexOf(e);i>-1&&t.splice(i,1)}},off(s,e){const t=KI.get(s)||[],i=t.indexOf(e);i>-1&&t.splice(i,1)},subscribe(s,e){console.log(`[WS] Subscribing to session ${s} with handlers:`,Object.keys(e)),B2.has(s)&&B2.get(s)();const t=[],i=["todos","session","step","compact","done","stopped","error"],n=["running_sessions"];for(const o of i){const a=e[o];a&&t.push(this.on(o,l=>{var h;(l.sessionId||((h=l.data)==null?void 0:h.sessionId))===s&&a(l.data||l,l)}))}for(const o of n){const a=e[o];a&&t.push(this.on(o,l=>{a(l.data||l,l)}))}e.running_sessions&&Hpe()&&Vpe("get_running_sessions",{});const r=()=>{t.forEach(o=>o()),B2.delete(s)};return B2.set(s,r),r},init(){lJ()}},Jv="/api";let Fp=new Map;async function Xe(s,e,t=null){const i={method:s,headers:{"Content-Type":"application/json"}};t&&s!=="GET"&&(i.body=JSON.stringify(t));const r=await(await fetch(`${Jv}${e}`,i)).json();if(r.success===!1)throw new Error(r.error||r.message||"请求失败");return r}const jt={getSessions(s=20,e=0){return Xe("GET",`/session/list_session?limit=${s}&offset=${e}`)},createSession(s="新会话",e=null){return Xe("POST","/session/create_session",{title:s,projectPath:e})},getSession(s){return Xe("GET",`/session/detail_session?id=${s}`)},updateSession(s,e){return Xe("POST","/session/update_session",{id:s,...e})},deleteSession(s){return Xe("POST","/session/delete_session",{id:s})},getSessionStatuses(s){return Xe("POST","/session/status_session",{sessionIds:s})},getMessages(s){return Xe("GET",`/chat/history_chat?sessionId=${s}`)},getProviders(){return Xe("GET","/sys_config/list_providers_config")},getProvider(s){return Xe("GET",`/sys_config/detail_provider_config?id=${s}`)},addProvider(s){return Xe("POST","/sys_config/create_provider_config",s)},updateProvider(s,e){return Xe("POST","/sys_config/update_provider_config",{id:s,...e})},deleteProvider(s){return Xe("POST","/sys_config/delete_provider_config",{id:s})},setDefaultProvider(s){return Xe("POST","/sys_config/set_default_provider_config",{id:s})},getModels(){return Xe("GET","/sys_config/list_models_config")},getModelsByProvider(s){return Xe("GET",`/sys_config/list_models_config?providerId=${s}`)},addModel(s){return Xe("POST","/sys_config/create_model_config",s)},updateModel(s,e){return Xe("POST","/sys_config/update_model_config",{id:s,...e})},deleteModel(s){return Xe("POST","/sys_config/delete_model_config",{id:s})},chat(s){return Xe("POST","/chat/send_chat",s)},chatCommand(s,e){return Xe("POST","/chat/command_chat",{message:s,sessionId:e})},uploadChatImage(s,e){const t=new FormData;return t.append("image",s),t.append("sessionId",e),fetch(`${Jv}/chat/upload_image_chat`,{method:"POST",body:t}).then(i=>i.json())},getSkills(){return Xe("GET","/skill/list_skill")},getLocalSkills(s){const e=s?`?projectPath=${encodeURIComponent(s)}`:"";return Xe("GET",`/skill/local_skill${e}`)},getSkillContent(s){return Xe("GET",`/skill/detail_skill?name=${encodeURIComponent(s)}`)},deleteLocalSkill(s){return Xe("POST","/skill/load_skill",{name:s,action:"delete"})},getSkillCategories(){return Xe("GET","/skill/categories")},getPublishedSkills(s={}){const{page:e=1,pageSize:t=20,keyword:i,categoryId:n}=s;let r=`page=${e}&page_size=${t}`;return i&&(r+=`&keyword=${encodeURIComponent(i)}`),n&&(r+=`&category_id=${n}`),Xe("GET",`/skill/published?${r}`)},installSkill(s,e){return Xe("POST","/skill/install",{skillId:s,skillName:e})},uninstallSkill(s){return Xe("POST","/skill/uninstall",{skillName:s})},getConfig(s){return Xe("GET",`/sys_config/get_config?key=${encodeURIComponent(s)}`)},setConfig(s,e){return Xe("POST","/sys_config/set_config",{key:s,value:e})},getProxyConfig(){return Xe("GET","/sys_config/proxy_config")},updateProxyConfig(s){return Xe("POST","/sys_config/proxy_config",s)},getFileTree(s="/"){return Xe("GET",`/file/tree_file?path=${encodeURIComponent(s)}`)},getFileContent(s){return Xe("GET",`/file/content_file?path=${encodeURIComponent(s)}`)},writeFile(s,e){return Xe("POST","/file/write_file",{path:s,content:e})},editFile(s,e,t){return Xe("POST","/file/edit_file",{path:s,oldString:e,newString:t})},deleteFile(s){return Xe("POST","/file/delete_file",{filePath:s})},writeFile(s,e){return Xe("POST","/file/write_file",{filePath:s,content:e})},editFile(s,e,t){return Xe("POST","/file/edit_file",{filePath:s,oldString:e,newString:t})},createDirectory(s){return Xe("POST","/file/mkdir_file",{filePath:s})},renameFile(s,e){return Xe("POST","/file/rename_file",{oldPath:s,newPath:e})},browseFilesystem(s=""){return Xe("GET",`/file/browse_file?path=${encodeURIComponent(s)}`)},async uploadFilesystem(s,e){const t=new FormData;t.append("file",e),t.append("targetDir",s),t.append("filename",encodeURIComponent(e.name));const n=await(await fetch(`${Jv}/file/upload_file`,{method:"POST",body:t})).json();if(n.success===!1)throw new Error(n.error||n.message||"上传失败");return n},uploadFilesystemWithProgress(s,e,t){const n=Math.ceil(e.size/10485760),r=Date.now()+"-"+Math.round(Math.random()*1e9);return(async()=>{for(let l=0;l<n;l++){const d=l*10485760,h=Math.min(d+10485760,e.size),f=e.slice(d,h);await this.uploadChunk(r,l,n,e.name,s,f),t&&t(Math.round((l+1)/n*95))}const a=await this.mergeChunks(r);return t&&t(100),a})()},uploadChunk(s,e,t,i,n,r){const o=new FormData;return o.append("uploadId",s),o.append("chunkIndex",String(e)),o.append("totalChunks",String(t)),o.append("fileName",encodeURIComponent(i)),o.append("targetDir",n),o.append("chunk",r),fetch(`${Jv}/file/upload_chunk_file`,{method:"POST",body:o}).then(a=>a.json()).then(a=>{if(a.success===!1)throw new Error(a.error||"上传分片失败");return a})},mergeChunks(s){return Xe("POST","/file/upload_merge_file",{uploadId:s})},downloadFilesystemWithProgress(s,e,t){const i=`${Jv}/file/download_file?path=${encodeURIComponent(s)}`;return fetch(i).then(n=>{if(!n.ok)throw new Error("下载失败: HTTP "+n.status);const r=n.headers.get("Content-Length"),o=r?parseInt(r,10):0,a=n.body.getReader(),l=[];let d=0;const h=()=>a.read().then(({done:f,value:p})=>{if(f){const m=new Blob(l),v=URL.createObjectURL(m),b=document.createElement("a");return b.href=v,b.download=e,document.body.appendChild(b),b.click(),document.body.removeChild(b),URL.revokeObjectURL(v),{success:!0}}return l.push(p),d+=p.length,o>0&&t&&t(Math.round(d/o*100)),h()});return h()})},async saveFile(s,e){return Xe("POST","/file/write_file",{filePath:s,content:Array.from(new Uint8Array(e))})},removeFile(s){return Xe("POST","/file/delete_file",{filePath:s})},moveFile(s,e){return Xe("POST","/file/rename_file",{oldPath:s,newPath:e})},getDrives(){return Xe("GET","/file/drives_file")},getCwd(){return Xe("GET","/file/browse_file?path=.")},getDbTables(){return Xe("GET","/db/tables_db")},getTableInfo(s){return Xe("GET",`/db/schema_db?name=${encodeURIComponent(s)}`)},getTableData(s,e=1,t=50){return Xe("GET",`/db/data_db?name=${encodeURIComponent(s)}&page=${e}&pageSize=${t}`)},getTableDataRaw(s,e=100){return Xe("GET",`/db/data_db?name=${encodeURIComponent(s)}&limit=${e}`)},executeSql(s){return Xe("POST","/db/data_db",{query:s})},getAiCallLogs(s=1,e=50){return Xe("GET",`/ai_log/list_ai_log?page=${s}&pageSize=${e}`)},getScheduledTasks(){return Xe("GET","/scheduler/list_scheduler")},getScheduledTask(s){return Xe("GET",`/scheduler/logs_scheduler?id=${s}`)},createScheduledTask(s){return Xe("POST","/scheduler/create_scheduler",s)},updateScheduledTask(s,e){return Xe("POST","/scheduler/update_scheduler",{id:s,...e})},deleteScheduledTask(s){return Xe("POST","/scheduler/delete_scheduler",{id:s})},startScheduledTask(s){return Xe("POST","/scheduler/start_scheduler",{id:s})},stopScheduledTask(s){return Xe("POST","/scheduler/stop_scheduler",{id:s})},runTaskNow(s){return Xe("POST","/scheduler/run_scheduler",{id:s})},getTaskLogs(s,e=50){return Xe("GET",`/scheduler/logs_scheduler?id=${s}&limit=${e}`)},ws:Ks,sessionWsSend(s,e,t){return Ks.send(e,t)},wsIsConnected(){return Ks.isConnected()},wsSubscribe(s,e){return Ks.subscribe(s,e)},getEmailConfigs(){return Xe("GET","/email/list_email")},getEmailConfig(s){return Xe("GET",`/email/detail_email?id=${s}`)},createEmailConfig(s){return Xe("POST","/email/create_email",s)},updateEmailConfig(s,e){return Xe("POST","/email/update_email",{id:s,...e})},deleteEmailConfig(s){return Xe("POST","/email/delete_email",{id:s})},setDefaultEmailConfig(s){return Xe("POST","/email/set_default_email",{id:s})},validateEmailConfig(s){return Xe("POST","/email/validate_email",{configId:s})},getDingtalkConfig(){return Xe("GET","/dingtalk/config_dingtalk")},updateDingtalkConfig(s){return Xe("POST","/dingtalk/config_dingtalk",s)},startDingtalk(){return Xe("POST","/dingtalk/start_dingtalk")},stopDingtalk(){return Xe("POST","/dingtalk/stop_dingtalk")},getGatewayStatus(){return Xe("GET","/dingtalk/status_dingtalk")},getQueueStatus(){return Xe("GET","/gateway/queue_gateway")},getWafConfig(){return Xe("GET","/gateway/waf_config_gateway")},updateWafConfig(s){return Xe("POST","/gateway/waf_update_gateway",s)},startWaf(){return Xe("POST","/gateway/waf_start_gateway")},stopWaf(){return Xe("POST","/gateway/waf_stop_gateway")},getWafStatus(){return Xe("GET","/gateway/waf_status_gateway")},getTerminalSessions(){return Xe("GET","/terminal/list_terminal")},createTerminalSession(){return Xe("POST","/terminal/create_terminal")},deleteTerminalSession(s){return Xe("POST","/terminal/delete_terminal",{id:s})},terminalWsConnect(s,e,t,i,n){if(Fp.has(s)){const l=Fp.get(s);if(l.readyState===WebSocket.OPEN)return l}const o=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal/${s}`,a=new WebSocket(o);return a.onopen=()=>{console.log(`Terminal WebSocket [${s}] connected`),t&&t()},a.onmessage=l=>{try{const d=JSON.parse(l.data);e&&e(d)}catch(d){console.error("Terminal WebSocket parse error:",d)}},a.onclose=()=>{console.log(`Terminal WebSocket [${s}] closed`),Fp.delete(s),i&&i()},a.onerror=l=>{console.error(`Terminal WebSocket [${s}] error:`,l),n&&n(l)},Fp.set(s,a),a},terminalWsDisconnect(s){const e=Fp.get(s);e&&(e.close(),Fp.delete(s))},terminalWsSend(s,e,t){const i=Fp.get(s);return i&&i.readyState===WebSocket.OPEN?(i.send(JSON.stringify({type:e,data:t})),!0):!1},terminalWsIsConnected(s){const e=Fp.get(s);return e&&e.readyState===WebSocket.OPEN},getWorkflowState(){return Xe("GET","/workflow/state_workflow")},updateWorkflowState(s,e,t){return Xe("POST","/workflow/update_workflow",{currentCategory:s,currentProject:e,currentStep:t})},gitIsRepo(){return Xe("GET","/git/is_repo_git")},gitStatus(){return Xe("GET","/git/status_git")},gitDiff(s,e){let t=`/git/diff_git?file=${encodeURIComponent(s)}`;return e&&(t+="&isNew=true"),Xe("GET",t)},gitRevert(s){return Xe("POST","/git/revert_git",{file:s})},gitRevertAll(){return Xe("POST","/git/revert_all_git")},gitDeleteFile(s){return Xe("POST","/git/delete_file_git",{file:s})},gitDiscardUntracked(){return Xe("POST","/git/discard_untracked_git")},getCustomActions(s){const e=s?`?type=${s}`:"";return Xe("GET",`/custom_action/list_custom_action${e}`)},createCustomAction(s){return Xe("POST","/custom_action/create_custom_action",s)},updateCustomAction(s,e){return Xe("POST","/custom_action/update_custom_action",{id:s,...e})},deleteCustomAction(s){return Xe("POST","/custom_action/delete_custom_action",{id:s})},getSpecCategories(){return Xe("GET","/spec/categories")},getPublishedSpecs(s={}){const{page:e=1,pageSize:t=20,keyword:i,categoryId:n,platformCategory:r}=s;let o=`page=${e}&page_size=${t}`;return i&&(o+=`&keyword=${encodeURIComponent(i)}`),n&&(o+=`&category_id=${n}`),r&&(o+=`&platform_category=${encodeURIComponent(r)}`),Xe("GET",`/spec/published?${o}`)},installSpec(s,e){return Xe("POST","/spec/install",{specId:s,specName:e})},uninstallSpec(s){return Xe("POST","/spec/uninstall",{specName:s})},getLocalSpecs(s){const e=s?`?projectPath=${encodeURIComponent(s)}`:"";return Xe("GET",`/spec/local_spec${e}`)},getSpecContent(s){return Xe("GET",`/spec/detail_spec?name=${encodeURIComponent(s)}`)},deleteLocalSpec(s){return Xe("POST","/spec/delete_spec",{name:s})},getProjectPath(){return Xe("GET","/project/current_project")},getWikiMenu(){return Xe("GET","/wiki/menu_wiki")},getWikiContent(s){return Xe("GET",`/wiki/content_wiki?path=${encodeURIComponent(s)}`)},getWikiAsset(s){return`${Jv}/wiki/asset_wiki?path=${encodeURIComponent(s)}`},getMemory(s){const e=s?`?projectPath=${encodeURIComponent(s)}`:"";return Xe("GET",`/memory/get_memory${e}`)},saveMemory(s,e){return Xe("POST","/memory/save_memory",{projectPath:s,content:e})},getProjects(){return Xe("GET","/project/list_project")},getCurrentProject(){return Xe("GET","/project/current_project")},setCurrentProject(s){return Xe("POST","/project/set_current_project",{id:s})},createProject(s,e,t=""){return Xe("POST","/project/create_project",{name:s,path:e,description:t})},exportConfig(){return fetch(`${Jv}/sys_config/export_config`,{method:"GET"}).then(s=>{if(!s.ok)throw new Error("导出失败");return s.blob()})},importConfig(s){return Xe("POST","/sys_config/import_config",{content:s})},getSongbingConfig(){return Xe("GET","/songbing/config_songbing")},saveSongbingConfig(s){return Xe("POST","/songbing/config_songbing",s)},startSongbingAuth(s){return Xe("POST","/songbing/auth_start_songbing",{platformUrl:s})},verifySongbingAuth(s){return Xe("POST","/songbing/auth_verify_songbing",{key:s})},cancelSongbingAuth(){return Xe("POST","/songbing/auth_cancel_songbing")},syncSongbingModels(){return Xe("POST","/songbing/sync_models_songbing")},getSystemInfo(){return Xe("GET","/system/info_system")},checkVersion(){return Xe("GET","/system/version_check")}},bht={name:"FileSelectDialog",components:{FileSelectTreeNode:dht},props:{visible:{type:Boolean,default:!1}},data(){return{loading:!1,currentPath:"",selectedPath:"",parentPath:null,fileTreeData:[]}},computed:{canGoUp(){return this.parentPath!==null&&this.parentPath!==""}},methods:{async loadFileTree(s=""){var e,t,i;this.loading=!0;try{const n=await jt.browseFilesystem(s);this.currentPath=((e=n.data)==null?void 0:e.current_path)||s,this.parentPath=(t=n.data)==null?void 0:t.parent_path;const r=(((i=n.data)==null?void 0:i.items)||[]).map(o=>this.transformNode(o));r.sort((o,a)=>o.is_directory===a.is_directory?o.name.localeCompare(a.name):o.is_directory?-1:1),this.fileTreeData=r}catch(n){console.error("Load file tree failed:",n),this.fileTreeData=[]}finally{this.loading=!1}},transformNode(s){return{name:s.name,path:s.path,is_directory:s.is_directory,is_drive:s.is_drive||!1,size:s.size,has_children:s.is_directory,expanded:!1,children:[]}},handleSelect(s){this.selectedPath=s.path},handleConfirm(){this.selectedPath&&(this.$emit("select",this.selectedPath),this.$emit("update:visible",!1))},async handleLoadChildren({path:s,callback:e}){var t;try{const n=(((t=(await jt.browseFilesystem(s)).data)==null?void 0:t.items)||[]).map(r=>this.transformNode(r));n.sort((r,o)=>r.is_directory===o.is_directory?r.name.localeCompare(o.name):r.is_directory?-1:1),e(n)}catch(i){console.error("Load children failed:",i),e([])}},goUp(){this.parentPath!==null&&this.loadFileTree(this.parentPath===""?"":this.parentPath)},goHome(){this.loadFileTree("")},refresh(){this.loadFileTree(this.currentPath||"")},handleClose(){this.$emit("close")},handleVisibleChange(s){this.$emit("update:visible",s)},open(){this.loadFileTree("")}},watch:{visible(s){s&&this.loadFileTree("")}}};var Cht=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{visible:e.visible,title:"选择文件",width:"500px","close-on-click-modal":!1},on:{"update:visible":e.handleVisibleChange,close:e.handleClose}},[t("div",{staticClass:"file-select-content"},[t("div",{staticClass:"file-tree-container"},[e._l(e.fileTreeData,function(i){return t("file-select-tree-node",{key:i.path,attrs:{node:i,level:0,"selected-path":e.selectedPath},on:{select:e.handleSelect,"load-children":e.handleLoadChildren}})}),e.loading?t("div",{staticClass:"empty-files"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e.fileTreeData.length===0?t("div",{staticClass:"empty-files"},[e._v(" 此目录为空 ")]):e._e()],2),t("div",{staticClass:"file-select-footer"},[t("span",{staticClass:"selected-path"},[e._v(e._s(e.selectedPath||"未选择"))]),t("button",{staticClass:"confirm-btn",attrs:{disabled:!e.selectedPath},on:{click:e.handleConfirm}},[e._v("选择")])])])])},yht=[],wht=Li(bht,Cht,yht,!1,null,"b74d32ae");const rke=wht.exports,Sht={name:"SkillSelectDialog",props:{visible:{type:Boolean,default:!1}},data(){return{loading:!1,skills:[],selectedSkill:"",searchText:""}},computed:{filteredSkills(){if(!this.searchText)return this.skills;const s=this.searchText.toLowerCase();return this.skills.filter(e=>e.name.toLowerCase().includes(s)||e.description&&e.description.toLowerCase().includes(s))}},watch:{visible(s){s&&(this.loadSkills(),this.selectedSkill="",this.searchText="")}},methods:{async loadSkills(){this.loading=!0;try{const s=await jt.getSkills();this.skills=s.data||[]}catch(s){console.error("Load skills failed:",s),this.skills=[]}finally{this.loading=!1,this.$nextTick(()=>{const s=this.$refs.searchInput;s&&s.focus()})}},handleConfirm(){this.selectedSkill&&(this.$emit("select",this.selectedSkill),this.$emit("update:visible",!1))},handleClose(){this.$emit("close")},handleVisibleChange(s){this.$emit("update:visible",s)}}};var xht=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{visible:e.visible,title:"选择 Skill",width:"420px","close-on-click-modal":!1},on:{"update:visible":e.handleVisibleChange,close:e.handleClose}},[t("div",{staticClass:"skill-select-content"},[t("div",{staticClass:"skill-search"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.searchText,expression:"searchText"}],ref:"searchInput",staticClass:"search-input",attrs:{placeholder:"搜索 Skill..."},domProps:{value:e.searchText},on:{input:function(i){i.target.composing||(e.searchText=i.target.value)}}})]),t("div",{staticClass:"skill-list-container"},[e.loading?t("div",{staticClass:"empty-state"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e.filteredSkills.length===0?t("div",{staticClass:"empty-state"},[e._v(" "+e._s(e.searchText?"无匹配 Skill":"无可用 Skill")+" ")]):e._e(),e._l(e.filteredSkills,function(i){return t("div",{key:i.name,staticClass:"skill-item",class:{"skill-selected":e.selectedSkill===i.name},on:{click:function(n){e.selectedSkill=i.name},dblclick:e.handleConfirm}},[t("div",{staticClass:"skill-name"},[e._v(e._s(i.name))]),i.description?t("div",{staticClass:"skill-desc"},[e._v(e._s(i.description))]):e._e()])})],2),t("div",{staticClass:"skill-select-footer"},[t("span",{staticClass:"selected-skill"},[e._v(e._s(e.selectedSkill||"未选择"))]),t("button",{staticClass:"confirm-btn",attrs:{disabled:!e.selectedSkill},on:{click:e.handleConfirm}},[e._v("选择")])])])])},kht=[],Lht=Li(Sht,xht,kht,!1,null,"583829c8");const oke=Lht.exports,Dht={name:"FileTreeNode",props:{node:{type:Object,required:!0},level:{type:Number,default:0},selectedPath:{type:String,default:""},expandedPaths:{type:Set,default:()=>new Set}},data(){return{expanded:!1,loading:!1,loadedChildren:this.node.children||[]}},computed:{isSelected(){return this.selectedPath===this.node.path}},watch:{node:{immediate:!0,handler(s){s.children&&s.children.length>0&&(this.loadedChildren=s.children)}},expandedPaths:{immediate:!0,handler(s){this.node.is_directory&&(s.has(this.node.path)&&!this.expanded?this.ensureExpanded():!s.has(this.node.path)&&this.expanded&&(this.expanded=!1))}}},methods:{async toggleExpand(){if(this.node.is_directory)if(!this.expanded&&this.loadedChildren.length===0&&this.node.has_children){this.loading=!0;try{this.$emit("load-children",{path:this.node.path,callback:s=>{this.loadedChildren=s,this.expanded=!0,this.loading=!1,this.$emit("expand-path",this.node.path)}})}catch(s){console.error("Failed to load children:",s),this.loading=!1}}else this.expanded=!this.expanded,this.expanded?this.$emit("expand-path",this.node.path):this.$emit("collapse-path",this.node.path)},ensureExpanded(){this.expanded||(this.loadedChildren.length===0&&this.node.has_children?(this.loading=!0,this.$emit("load-children",{path:this.node.path,callback:s=>{this.loadedChildren=s,this.expanded=!0,this.loading=!1}})):this.expanded=!0)},handleClick(){this.$emit("select",this.node),this.node.is_directory&&this.toggleExpand()},handleDblClick(){this.node.is_directory?this.toggleExpand():this.$emit("open-file",this.node)},handleContextMenu(s){s.stopPropagation(),this.$emit("contextmenu",s,this.node)},getFileIcon(s,e){if(e)return"fa-solid fa-folder text-yellow-500";const t=s.split(".").pop().toLowerCase(),i=s.toLowerCase(),n={js:"fa-brands fa-js text-yellow-400",jsx:"fa-brands fa-react text-blue-400",ts:"fa-brands fa-js text-blue-400",tsx:"fa-brands fa-react text-blue-400",html:"fa-brands fa-html5 text-orange-500",htm:"fa-brands fa-html5 text-orange-500",css:"fa-brands fa-css3 text-blue-400",scss:"fa-brands fa-sass text-pink-400",sass:"fa-brands fa-sass text-pink-400",vue:"fa-brands fa-vuejs text-green-400",py:"fa-brands fa-python text-blue-500",pyc:"fa-brands fa-python text-gray-400",json:"fa-solid fa-file-code text-yellow-300",yaml:"fa-solid fa-file-code text-blue-300",yml:"fa-solid fa-file-code text-blue-300",xml:"fa-solid fa-file-code text-orange-300",md:"fa-solid fa-file-lines text-gray-400",markdown:"fa-solid fa-file-lines text-gray-400",sql:"fa-solid fa-database text-gray-400",sh:"fa-solid fa-terminal text-green-400",bash:"fa-solid fa-terminal text-green-400",go:"fa-brands fa-golang text-cyan-400",rs:"fa-brands fa-rust text-orange-400",java:"fa-brands fa-java text-red-400",kt:"fa-brands fa-android text-purple-400",swift:"fa-brands fa-apple text-blue-300",c:"fa-solid fa-file-code text-blue-300",cpp:"fa-solid fa-file-code text-blue-400",cc:"fa-solid fa-file-code text-blue-400",h:"fa-solid fa-file-code text-blue-300",hpp:"fa-solid fa-file-code text-blue-400",cs:"fa-brands fa-microsoft text-purple-400",rb:"fa-solid fa-gem text-red-400",php:"fa-brands fa-php text-purple-400",dockerfile:"fa-brands fa-docker text-blue-400",gitignore:"fa-brands fa-git text-red-400",gitattributes:"fa-brands fa-git text-red-400",license:"fa-solid fa-scale-balanced text-yellow-400",png:"fa-solid fa-image text-green-400",jpg:"fa-solid fa-image text-green-400",jpeg:"fa-solid fa-image text-green-400",gif:"fa-solid fa-image text-green-400",svg:"fa-solid fa-image text-green-400",ico:"fa-solid fa-image text-green-400",webp:"fa-solid fa-image text-green-400",bmp:"fa-solid fa-image text-green-400",mp4:"fa-solid fa-film text-purple-400",avi:"fa-solid fa-film text-purple-400",mov:"fa-solid fa-film text-purple-400",mkv:"fa-solid fa-film text-purple-400",mp3:"fa-solid fa-music text-pink-400",wav:"fa-solid fa-music text-pink-400",flac:"fa-solid fa-music text-pink-400",woff:"fa-solid fa-font text-blue-400",woff2:"fa-solid fa-font text-blue-400",ttf:"fa-solid fa-font text-blue-400",otf:"fa-solid fa-font text-blue-400",eot:"fa-solid fa-font text-blue-400",zip:"fa-solid fa-file-zipper text-yellow-600",rar:"fa-solid fa-file-zipper text-yellow-600","7z":"fa-solid fa-file-zipper text-yellow-600",tar:"fa-solid fa-file-zipper text-yellow-600",gz:"fa-solid fa-file-zipper text-yellow-600",pdf:"fa-solid fa-file-pdf text-red-500",doc:"fa-solid fa-file-word text-blue-600",docx:"fa-solid fa-file-word text-blue-600",xls:"fa-solid fa-file-excel text-green-600",xlsx:"fa-solid fa-file-excel text-green-600",ppt:"fa-solid fa-file-powerpoint text-orange-600",pptx:"fa-solid fa-file-powerpoint text-orange-600"};return i==="dockerfile"?n.dockerfile:i===".gitignore"?n.gitignore:i===".gitattributes"?n.gitattributes:i==="license"||i.startsWith("license")?n.license:i.startsWith("readme")?n.md:n[t]||"fa-solid fa-file text-gray-400"}}};var Iht=function(){var i;var e=this,t=e._self._c;return t("div",{staticClass:"file-tree-node"},[t("div",{staticClass:"node-content",class:{selected:e.isSelected,directory:e.node.is_directory},style:{paddingLeft:e.level*16+4+"px"},on:{click:e.handleClick,dblclick:e.handleDblClick,contextmenu:function(n){return n.preventDefault(),e.handleContextMenu.apply(null,arguments)}}},[e.node.is_directory?t("span",{staticClass:"expand-icon",on:{click:function(n){return n.stopPropagation(),e.toggleExpand.apply(null,arguments)}}},[e.loading?t("i",{staticClass:"fa-solid fa-spinner fa-spin"}):e.expanded?t("i",{staticClass:"fa-solid fa-chevron-down"}):e.node.has_children||e.node.children&&e.node.children.length>0?t("i",{staticClass:"fa-solid fa-chevron-right"}):t("span",{staticClass:"placeholder"})]):t("span",{staticClass:"expand-icon placeholder"}),t("span",{staticClass:"node-icon"},[t("i",{class:e.getFileIcon(e.node.name,e.node.is_directory)})]),t("span",{staticClass:"node-name"},[e._v(e._s(e.node.name))])]),e.node.is_directory&&e.expanded&&(e.loadedChildren.length>0||((i=e.node.children)==null?void 0:i.length)>0)?t("div",{staticClass:"children"},e._l(e.loadedChildren.length>0?e.loadedChildren:e.node.children,function(n){return t("file-tree-node",{key:n.path,attrs:{node:n,level:e.level+1,"selected-path":e.selectedPath,"expanded-paths":e.expandedPaths},on:{select:function(r){return e.$emit("select",r)},"open-file":function(r){return e.$emit("open-file",r)},"load-children":function(r){return e.$emit("load-children",r)},contextmenu:(r,o)=>e.$emit("contextmenu",r,o),"expand-path":function(r){return e.$emit("expand-path",r)},"collapse-path":function(r){return e.$emit("collapse-path",r)}}})}),1):e._e()])},Eht=[],Tht=Li(Dht,Iht,Eht,!1,null,"19d1205f");const ake=Tht.exports,Nht={name:"DesignSelectDialog",components:{FileTreeNode:ake},props:{visible:{type:Boolean,default:!1}},data(){return{loading:!1,browseResult:{current_path:"",parent_path:null,items:[]},selectedPath:"",selectedPageName:"",selectedPagePath:"",selectedRelativePath:"",expandedPaths:new Set,currentDevice:"web",previewSrc:"",designBasePath:".txcode/design",nodeMap:{}}},computed:{fileTreeData(){return this.browseResult.items.filter(e=>e.name==="session.json"?!1:e.is_directory?!0:e.name.endsWith(".html")).map(e=>({name:e.name,path:e.path,is_directory:e.is_directory,is_drive:!1,size:e.size,has_children:e.is_directory,expanded:!1,children:[]})).sort((e,t)=>e.is_directory===t.is_directory?e.name.localeCompare(t.name):e.is_directory?-1:1)}},watch:{visible(s){s&&(this.initBrowse(),this.selectedPath="",this.selectedPageName="",this.selectedPagePath="",this.selectedRelativePath="",this.previewSrc="",this.expandedPaths=new Set,this.nodeMap={},this.currentDevice="web")}},methods:{async initBrowse(){this.loading=!0;try{const s=await jt.browseFilesystem(this.designBasePath);this.browseResult=s.data,this.nodeMap={};for(const e of s.data.items)e.name!=="session.json"&&(e.is_directory||e.name.endsWith(".html"))&&(this.nodeMap[this.toRelativeDesignPath(e.path.replace(/\\/g,"/"))]=e)}catch(s){console.error("Browse design dir failed:",s),this.browseResult={current_path:this.designBasePath,parent_path:"",items:[]}}finally{this.loading=!1}},getRelativePath(s){const e=s.replace(/\\/g,"/"),i=e.indexOf(".txcode/design/");return i===-1?s:e.substring(i)},handleSelect(s){s.is_directory||(this.selectedPath=s.path,this.selectedPagePath=s.path,this.selectedPageName=s.name.replace(".html",""),this.selectedRelativePath=this.getRelativePath(s.path),this.loadPreview(s.path))},handleOpenFile(s){this.handleSelect(s)},async handleLoadChildren({path:s,callback:e}){try{const i=((await jt.browseFilesystem(s)).data.items||[]).filter(n=>n.name==="session.json"?!1:n.is_directory?!0:n.name.endsWith(".html")).map(n=>{const r=n.path.replace(/\\/g,"/");return this.nodeMap[this.toRelativeDesignPath(r)]=n,{name:n.name,path:n.path,is_directory:n.is_directory,is_drive:!1,size:n.size,has_children:n.is_directory,expanded:!1,children:[]}});e(i.sort((n,r)=>n.is_directory===r.is_directory?n.name.localeCompare(r.name):n.is_directory?-1:1))}catch(t){console.error("Load children failed:",t),e([])}},onExpandPath(s){const e=new Set(this.expandedPaths);e.add(s),this.expandedPaths=e},onCollapsePath(s){const e=new Set(this.expandedPaths);e.delete(s),this.expandedPaths=e},loadPreview(s){const e=this.getRelativePath(s).replace(/^\.txcode\/design\//,"").replace(/\\/g,"/");this.previewSrc=`/design_html/${encodeURI(e)}?_t=${Date.now()}`,console.log("[DesignSelect] loadPreview previewSrc:",this.previewSrc)},onIframeNav(){var s,e;try{const t=(e=(s=this.$el)==null?void 0:s.querySelector)==null?void 0:e.call(s,".preview-content");if(!t||!t.contentWindow){console.log("[DesignSelect] onIframeNav: iframe not ready");return}const i=t.contentWindow.location.pathname;console.log("[DesignSelect] onIframeNav pathname:",i);const n=".txcode/design"+decodeURIComponent(i.replace(/^\/design_html/,""));console.log("[DesignSelect] onIframeNav filePath:",n);const r=this.toRelativeDesignPath(n.replace(/\\/g,"/"));console.log("[DesignSelect] onIframeNav filePathRel:",r),console.log("[DesignSelect] nodeMap keys:",Object.keys(this.nodeMap));const o=this.nodeMap[r];if(console.log("[DesignSelect] onIframeNav item:",o),!o)return;if(this.selectedPath===o.path){console.log("[DesignSelect] onIframeNav: already selected, skip");return}console.log("[DesignSelect] onIframeNav: selecting",o.path),this.handleSelectFileItem(o),this.expandAncestors(n)}catch(t){console.log("[DesignSelect] onIframeNav error:",t)}},handleSelectFileItem(s){s.is_directory||(this.selectedPath=s.path,this.selectedPagePath=s.path,this.selectedPageName=s.name.replace(".html",""),this.selectedRelativePath=this.getRelativePath(s.path),this.loadPreview(s.path))},findNodeByPath(s,e){if(!s||!s.length)return null;const t=e.replace(/\\/g,"/");for(const i of s){const n=(i.path||"").replace(/\\/g,"/"),r=this.toRelativeDesignPath(n),o=this.toRelativeDesignPath(t);if(r===o)return i;if(i.children&&i.children.length){const a=this.findNodeByPath(i.children,t);if(a)return a}}return null},toRelativeDesignPath(s){const t=s.indexOf(".txcode/design/");return t!==-1?s.substring(t):s},expandAncestors(s){const e=s.replace(/\\/g,"/").split("/");let t="";const i=new Set(this.expandedPaths);for(let n=0;n<e.length-1;n++)t+=(n===0?"":"/")+e[n],i.add(t);console.log("[DesignSelect] expandAncestors:",[...i]),this.expandedPaths=i},setDevice(s){this.currentDevice=s,this.selectedPagePath&&this.loadPreview(this.selectedPagePath)},refreshPreview(){this.selectedPagePath&&this.loadPreview(this.selectedPagePath)},handleConfirm(){this.selectedPath&&(this.$emit("select",{id:this.selectedPath,name:this.selectedPageName,path:this.selectedRelativePath,absPath:this.selectedPagePath}),this.$emit("update:visible",!1))},handleClose(){this.$emit("close")},handleVisibleChange(s){this.$emit("update:visible",s)}}};var Pht=function(){var e=this,t=e._self._c;return t("el-dialog",{staticClass:"design-select-dialog",attrs:{visible:e.visible,title:"选择设计",width:"1200px",top:"3vh","close-on-click-modal":!1},on:{"update:visible":e.handleVisibleChange,close:e.handleClose}},[t("div",{staticClass:"dialog-body"},[t("div",{staticClass:"design-left"},[t("div",{staticClass:"page-tree"},[e.loading?t("div",{staticClass:"flex items-center justify-center py-8 text-textMuted text-sm"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e.fileTreeData.length===0?t("div",{staticClass:"empty-state"},[e._v(" 暂无设计页面,请在 .txcode/design/ 目录下添加 HTML 文件 ")]):e._l(e.fileTreeData,function(i){return t("file-tree-node",{key:i.path,attrs:{node:i,level:0,"selected-path":e.selectedPath,"expanded-paths":e.expandedPaths},on:{select:e.handleSelect,"open-file":e.handleOpenFile,"load-children":e.handleLoadChildren,"expand-path":e.onExpandPath,"collapse-path":e.onCollapsePath}})})],2),t("div",{staticClass:"footer"},[t("span",{staticClass:"selected-info"},[e._v(e._s(e.selectedRelativePath||"未选择"))]),t("button",{staticClass:"btn-confirm",attrs:{disabled:!e.selectedPath},on:{click:e.handleConfirm}},[e._v("确认选择")])])]),t("div",{staticClass:"design-right"},[t("div",{staticClass:"preview-toolbar"},[t("div",{staticClass:"device-btns"},[t("button",{class:{active:e.currentDevice==="web"},on:{click:function(i){return e.setDevice("web")}}},[e._v("💻 Web")]),t("button",{class:{active:e.currentDevice==="pad"},on:{click:function(i){return e.setDevice("pad")}}},[e._v("📱 Pad")]),t("button",{class:{active:e.currentDevice==="app"},on:{click:function(i){return e.setDevice("app")}}},[e._v("📱 App")])]),t("div",{staticClass:"preview-actions"},[t("button",{attrs:{title:"刷新预览"},on:{click:e.refreshPreview}},[t("svg",{attrs:{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"}},[t("polyline",{attrs:{points:"23 4 23 10 17 10"}}),t("polyline",{attrs:{points:"1 20 1 14 7 14"}}),t("path",{attrs:{d:"M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"}})])])]),t("span",{staticClass:"page-indicator"},[e._v("当前:"+e._s(e.selectedPageName||"—"))])]),t("div",{staticClass:"preview-frame"},[t("div",{staticClass:"device-frame",class:"device-frame-"+e.currentDevice,attrs:{id:"previewWrapper"}},[e.currentDevice==="web"||e.currentDevice==="pad"?t("div",{staticClass:"browser-toolbar"},[t("div",{staticClass:"browser-dots"},[t("span",{staticClass:"red"}),t("span",{staticClass:"yellow"}),t("span",{staticClass:"green"})]),t("span",{staticClass:"browser-url"},[e._v(e._s(e.selectedRelativePath||"/"))])]):e._e(),e.previewSrc?t("div",{staticClass:"preview-content-wrapper"},[e.previewSrc?t("iframe",{staticClass:"preview-content",attrs:{src:e.previewSrc,sandbox:"allow-scripts allow-same-origin"},on:{load:e.onIframeNav}}):e._e()]):t("div",{staticClass:"preview-empty"},[e._v(" 请选择左侧页面预览 ")])])])])])])},Mht=[],Rht=Li(Nht,Pht,Mht,!1,null,"2366d6f7");const lke=Rht.exports,Oht={name:"CommandDialog",props:{visible:{type:Boolean,default:!1}},data(){return{loading:!1,selectedCommand:"",commands:[{name:"/compact",description:"压缩当前会话上下文"}]}},methods:{open(){},handleExecute(s){this.$emit("execute",s.name),this.$emit("update:visible",!1)},handleClose(){this.$emit("close")},handleVisibleChange(s){this.$emit("update:visible",s)}}};var Aht=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{visible:e.visible,title:"命令",width:"500px","close-on-click-modal":!1},on:{"update:visible":e.handleVisibleChange,close:e.handleClose}},[t("div",{staticClass:"command-list"},[e._l(e.commands,function(i){return t("div",{key:i.name,staticClass:"command-item",class:{selected:e.selectedCommand===i.name},attrs:{title:"双击执行: "+i.name},on:{click:function(n){e.selectedCommand=i.name},dblclick:function(n){return e.handleExecute(i)}}},[t("span",{staticClass:"command-name"},[e._v(e._s(i.name))]),t("span",{staticClass:"command-desc"},[e._v(e._s(i.description))])])}),e.loading?t("div",{staticClass:"empty-commands"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e._e()],2)])},Fht=[],Bht=Li(Oht,Aht,Fht,!1,null,"439b4563");const cke=Bht.exports,Wht="/api";async function Vht(s){const e=new FormData;e.append("file",s);const i=await(await fetch(`${Wht}/chat/upload_image_chat`,{method:"POST",body:e})).json();if(i.success===!1)throw new Error(i.error||"上传失败");return i}function Hht(s){var n;const t=s.input.trim(),i=(s.mediaFiles||[]).filter(r=>!r.uploading&&r.filePath);return{message:t,sessionId:(n=s.session)==null?void 0:n.id,modelName:s.modelName||void 0,enableDevLog:s.enableDevLog,mediaFiles:i.map(r=>({filePath:r.filePath,type:r.type}))}}async function dke(s){const e=await new Promise((i,n)=>{const r=new FileReader;r.onload=()=>i(r.result),r.onerror=n,r.readAsDataURL(s)}),t=await Vht(s);return{dataUrl:e,filePath:t.data.filePath,type:t.data.filePath.endsWith(".png")?"image/png":s.type||"image/jpeg"}}const $ht={name:"PlanAssistant",components:{ResizableTextarea:cse,ImagePreviewList:ike,FileSelectDialog:rke,SkillSelectDialog:oke,DesignSelectDialog:lke,CommandDialog:cke},props:{visible:{type:Boolean,default:!1},width:{type:Number,default:420},designPanel:{type:Object,required:!0},discussPanel:{type:Object,required:!0},discussSessions:{type:Array,default:()=>[]},currentDiscuss:{type:Object,default:null},planFilePath:{type:String,default:""}},data(){return{activeTab:"design",dropdownOpen:!1,menuId:null,renameVisible:!1,renameValue:"",renameTarget:null,deleteVisible:!1,deleteTarget:null,fileSelectVisible:!1,skillSelectVisible:!1,designSelectVisible:!1,commandDialogVisible:!1,previewImage:null}},watch:{visible(s){s&&this.scrollAllToBottom()}},mounted(){document.addEventListener("mousedown",this.onMouseDown)},beforeDestroy(){document.removeEventListener("mousedown",this.onMouseDown)},methods:{getTodoStatusIcon:a7,getToolCallName:ase,getToolCallArguments:lse,formatInput:l7,renderMarkdown:ik,onMouseDown(s){this.menuId&&!s.target.closest(".item-actions")&&(this.menuId=null),this.dropdownOpen&&!s.target.closest(".discuss-dropdown")&&(this.dropdownOpen=!1)},switchDiscuss(s){this.dropdownOpen=!1,this.$emit("switchDiscuss",s)},createDiscuss(){this.dropdownOpen=!1,this.$emit("createDiscuss")},startRename(s){this.menuId=null,this.renameTarget=s,this.renameValue=s.title,this.renameVisible=!0},doRename(){!this.renameValue.trim()||!this.renameTarget||(this.$emit("renameDiscuss",this.renameTarget,this.renameValue.trim()),this.renameVisible=!1,this.renameTarget=null)},confirmDelete(s){this.menuId=null,this.deleteTarget=s,this.deleteVisible=!0},doDelete(){this.deleteTarget&&(this.$emit("deleteDiscuss",this.deleteTarget),this.deleteVisible=!1,this.deleteTarget=null)},scrollDesignToBottom(s=!1){const e=oJ(this.$refs.designMsgs);this.$nextTick(()=>{const t=this.$refs.designMsgs;t&&aJ(t,{force:s,prevSnapshot:e})})},scrollDiscussToBottom(s=!1){const e=oJ(this.$refs.discussMsgs);this.$nextTick(()=>{const t=this.$refs.discussMsgs;t&&aJ(t,{force:s,prevSnapshot:e})})},scrollAllToBottom(){this.scrollDesignToBottom(),this.scrollDiscussToBottom()},handleDesignKeydown(s){if(s.key==="Enter")if(s.ctrlKey){const e=s.target,t=e.selectionStart,i=e.selectionEnd;this.designPanel.input=this.designPanel.input.substring(0,t)+`
|
|
949
|
+
Please report this to https://github.com/markedjs/marked.`,s){let i="<p>An error occurred:</p><pre>"+Ch(t.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(t);throw t}}},wy=new Zut;function Zn(s,e){return wy.parse(s,e)}Zn.options=Zn.setOptions=function(s){return wy.setOptions(s),Zn.defaults=wy.defaults,qxe(Zn.defaults),Zn};Zn.getDefaults=Qne;Zn.defaults=Yy;Zn.use=function(...s){return wy.use(...s),Zn.defaults=wy.defaults,qxe(Zn.defaults),Zn};Zn.walkTokens=function(s,e){return wy.walkTokens(s,e)};Zn.parseInline=wy.parseInline;Zn.Parser=mu;Zn.parser=mu.parse;Zn.Renderer=hB;Zn.TextRenderer=ose;Zn.Lexer=pu;Zn.lexer=pu.lex;Zn.Tokenizer=uB;Zn.Hooks=rI;Zn.parse=Zn;Zn.options;Zn.setOptions;Zn.use;Zn.walkTokens;Zn.parseInline;mu.parse;pu.lex;function a7(s){return{completed:"✅",in_progress:"🔄",pending:"⬜",cancelled:"❌"}[s]||"⬜"}function l7(s,e){try{const t=JSON.parse(e);return s==="bash"||s==="execute_bash"?t.command+(t.workdir?` (${t.workdir})`:""):s==="read_file"?t.file_path+(t.offset?`:${t.offset}`:""):s==="edit_file"||s==="write_file"?t.file_path:s==="glob"||s==="find_files"?t.pattern+(t.directory?` (${t.directory})`:""):s==="grep"||s==="search_content"?`"${t.pattern}" (${t.directory||""})`:e}catch{return e}}function ase(s){var e;return((e=s==null?void 0:s.function)==null?void 0:e.name)||"unknown_tool"}function lse(s){var e;return((e=s==null?void 0:s.function)==null?void 0:e.arguments)||""}function ik(s){return s?Zn(s):""}function VF(s){return{type:"think",content:s,renderedContent:ik(s)}}function rJ(s){const e=(s==null?void 0:s.thought)||"";return{type:"step",thought:e,renderedThought:ik(e),toolCalls:Array.isArray(s==null?void 0:s.toolCalls)?s.toolCalls.filter(Boolean):[],success:s==null?void 0:s.success}}function Xut(s,e){return!s||typeof s!="object"?{type:"system",content:String(s),_id:`log-${e()}`}:s._id?s:{...s,_id:`log-${e()}`}}function oJ(s){return s?{scrollTop:s.scrollTop,scrollHeight:s.scrollHeight,clientHeight:s.clientHeight}:null}function aJ(s,{force:e=!1,threshold:t=150,prevSnapshot:i=null}={}){if(!s){console.log("[scrollToBottom] container is null/undefined, skip");return}const n=s.scrollHeight-s.scrollTop-s.clientHeight;if(e){s.scrollTop=s.scrollHeight,console.log("[scrollToBottom] force scroll → scrollTop:",s.scrollHeight,"| curDist:",n);return}const r=i?i.scrollHeight-i.scrollTop-i.clientHeight:n;console.log("[scrollToBottom] force: false | scrollTop:",s.scrollTop,"| scrollHeight:",s.scrollHeight,"| clientHeight:",s.clientHeight,"| curDist:",n,"| refDist:",r,"| threshold:",t),r<=t?(s.scrollTop=s.scrollHeight,console.log("[scrollToBottom] SCROLL (refDist <= threshold)")):console.log("[scrollToBottom] SKIP (refDist > threshold, user was away from bottom)")}const Qut={name:"ResizableTextarea",props:{value:{type:String,default:""},rows:{type:Number,default:5},minRows:{type:Number,default:2},maxRows:{type:Number,default:20}},data(){return{internalValue:this.value,currentRows:this.rows,isResizing:!1,isHovering:!1,startY:0,startRows:0}},computed:{showHandle(){return!0}},watch:{value(s){this.internalValue=s},internalValue(s){this.$emit("input",s)}},mounted(){document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.stopResize),this.$nextTick(()=>{var e;const s=(e=this.$el)==null?void 0:e.querySelector("textarea");s&&s.addEventListener("paste",this.handlePaste)})},beforeDestroy(){var e;document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.stopResize);const s=(e=this.$el)==null?void 0:e.querySelector("textarea");s&&s.removeEventListener("paste",this.handlePaste)},methods:{handleMouseEnter(){this.isHovering=!0},handleMouseLeave(){this.isResizing||(this.isHovering=!1)},startResize(s){this.isResizing=!0,this.isHovering=!1,this.startY=s.clientY,this.startRows=this.currentRows,document.body.style.cursor="ns-resize",document.body.style.userSelect="none"},handleMouseMove(s){if(!this.isResizing)return;const e=this.startY-s.clientY,i=Math.round(this.startRows+e/20);this.currentRows=Math.max(this.minRows,Math.min(this.maxRows,i))},stopResize(){this.isResizing&&(this.isResizing=!1,document.body.style.cursor="",document.body.style.userSelect="")},handlePaste(s){var i;const e=(i=s.clipboardData)==null?void 0:i.items;if(!e)return;const t=[];for(const n of e)n.type.startsWith("image/")&&t.push(n.getAsFile());t.length>0&&(s.preventDefault(),this.$emit("paste-image",t))}}};var Jut=function(){var e=this,t=e._self._c;return t("div",{staticClass:"resizable-textarea-outer",class:{"resize-hand-active":e.isResizing}},[e.showHandle?t("div",{staticClass:"resize-hand",on:{mousedown:e.startResize,mouseenter:e.handleMouseEnter,mouseleave:e.handleMouseLeave}}):e._e(),t("el-input",e._b({attrs:{type:"textarea",rows:e.currentRows},model:{value:e.internalValue,callback:function(i){e.internalValue=i},expression:"internalValue"}},"el-input",e.$attrs,!1)),e.showHandle&&e.isHovering?t("div",{staticClass:"resize-indicator"}):e._e()],1)},eht=[],tht=Li(Qut,Jut,eht,!1,null,"16456784");const cse=tht.exports,iht={name:"ImagePreviewList",props:{files:{type:Array,default:()=>[]},disabled:{type:Boolean,default:!1}}};var nht=function(){var e=this,t=e._self._c;return t("div",{staticClass:"image-preview-list"},e._l(e.files,function(i){return t("div",{key:i.id,staticClass:"image-preview-item"},[t("img",{staticClass:"thumbnail",attrs:{src:i.dataUrl}}),i.uploading?t("div",{staticClass:"upload-loading"},[t("span",{staticClass:"loading-spinner"})]):t("button",{staticClass:"remove-btn",attrs:{disabled:e.disabled},on:{click:function(n){return e.$emit("remove",i.id)}}},[e._v("×")])])}),0)},sht=[],rht=Li(iht,nht,sht,!1,null,"8e2530ba");const ike=rht.exports,oht={name:"FileSelectTreeNode",props:{node:{type:Object,required:!0},level:{type:Number,default:0},selectedPath:{type:String,default:""}},data(){return{expanded:!1,loading:!1,loadedChildren:this.node.children||[]}},computed:{isSelected(){return this.selectedPath===this.node.path}},watch:{node:{immediate:!0,handler(s){s.children&&s.children.length>0&&(this.loadedChildren=s.children)}}},methods:{async toggleExpand(){if(this.node.is_directory)if(!this.expanded&&this.loadedChildren.length===0&&this.node.has_children){this.loading=!0;try{this.$emit("load-children",{path:this.node.path,callback:s=>{this.loadedChildren=s,this.expanded=!0,this.loading=!1}})}catch(s){console.error("Failed to load children:",s),this.loading=!1}}else this.expanded=!this.expanded},handleClick(){this.$emit("select",this.node),this.node.is_directory&&this.toggleExpand()},handleDblClick(){},getFileIcon(s,e){if(e)return"fa-solid fa-folder text-yellow-500";const t=s.split(".").pop().toLowerCase(),i=s.toLowerCase(),n={js:"fa-brands fa-js text-yellow-400",jsx:"fa-brands fa-react text-blue-400",ts:"fa-brands fa-js text-blue-400",tsx:"fa-brands fa-react text-blue-400",html:"fa-brands fa-html5 text-orange-500",htm:"fa-brands fa-html5 text-orange-500",css:"fa-brands fa-css3 text-blue-400",scss:"fa-brands fa-sass text-pink-400",sass:"fa-brands fa-sass text-pink-400",vue:"fa-brands fa-vuejs text-green-400",py:"fa-brands fa-python text-blue-500",pyc:"fa-brands fa-python text-gray-400",json:"fa-solid fa-file-code text-yellow-300",yaml:"fa-solid fa-file-code text-blue-300",yml:"fa-solid fa-file-code text-blue-300",xml:"fa-solid fa-file-code text-orange-300",md:"fa-solid fa-file-lines text-gray-400",markdown:"fa-solid fa-file-lines text-gray-400",sql:"fa-solid fa-database text-gray-400",sh:"fa-solid fa-terminal text-green-400",bash:"fa-solid fa-terminal text-green-400",go:"fa-brands fa-golang text-cyan-400",rs:"fa-brands fa-rust text-orange-400",java:"fa-brands fa-java text-red-400",kt:"fa-brands fa-android text-purple-400",swift:"fa-brands fa-apple text-blue-300",c:"fa-solid fa-file-code text-blue-300",cpp:"fa-solid fa-file-code text-blue-400",cc:"fa-solid fa-file-code text-blue-400",h:"fa-solid fa-file-code text-blue-300",hpp:"fa-solid fa-file-code text-blue-400",cs:"fa-brands fa-microsoft text-purple-400",rb:"fa-solid fa-gem text-red-400",php:"fa-brands fa-php text-purple-400",dockerfile:"fa-brands fa-docker text-blue-400",gitignore:"fa-brands fa-git text-red-400",gitattributes:"fa-brands fa-git text-red-400",license:"fa-solid fa-scale-balanced text-yellow-400",png:"fa-solid fa-image text-green-400",jpg:"fa-solid fa-image text-green-400",jpeg:"fa-solid fa-image text-green-400",gif:"fa-solid fa-image text-green-400",svg:"fa-solid fa-image text-green-400",ico:"fa-solid fa-image text-green-400",webp:"fa-solid fa-image text-green-400",bmp:"fa-solid fa-image text-green-400",mp4:"fa-solid fa-film text-purple-400",avi:"fa-solid fa-film text-purple-400",mov:"fa-solid fa-film text-purple-400",mkv:"fa-solid fa-film text-purple-400",mp3:"fa-solid fa-music text-pink-400",wav:"fa-solid fa-music text-pink-400",flac:"fa-solid fa-music text-pink-400",woff:"fa-solid fa-font text-blue-400",woff2:"fa-solid fa-font text-blue-400",ttf:"fa-solid fa-font text-blue-400",otf:"fa-solid fa-font text-blue-400",eot:"fa-solid fa-font text-blue-400",zip:"fa-solid fa-file-zipper text-yellow-600",rar:"fa-solid fa-file-zipper text-yellow-600","7z":"fa-solid fa-file-zipper text-yellow-600",tar:"fa-solid fa-file-zipper text-yellow-600",gz:"fa-solid fa-file-zipper text-yellow-600",pdf:"fa-solid fa-file-pdf text-red-500",doc:"fa-solid fa-file-word text-blue-600",docx:"fa-solid fa-file-word text-blue-600",xls:"fa-solid fa-file-excel text-green-600",xlsx:"fa-solid fa-file-excel text-green-600",ppt:"fa-solid fa-file-powerpoint text-orange-600",pptx:"fa-solid fa-file-powerpoint text-orange-600"};return i==="dockerfile"?n.dockerfile:i===".gitignore"?n.gitignore:i===".gitattributes"?n.gitattributes:i==="license"||i.startsWith("license")?n.license:i.startsWith("readme")?n.md:n[t]||"fa-solid fa-file text-gray-400"}}};var aht=function(){var i;var e=this,t=e._self._c;return t("div",{staticClass:"file-tree-node"},[t("div",{staticClass:"node-content",class:{selected:e.isSelected,directory:e.node.is_directory},style:{paddingLeft:e.level*16+4+"px"},on:{click:e.handleClick,dblclick:e.handleDblClick}},[e.node.is_directory?t("span",{staticClass:"expand-icon",on:{click:function(n){return n.stopPropagation(),e.toggleExpand.apply(null,arguments)}}},[e.loading?t("i",{staticClass:"fa-solid fa-spinner fa-spin"}):e.expanded?t("i",{staticClass:"fa-solid fa-chevron-down"}):e.node.has_children||e.node.children&&e.node.children.length>0?t("i",{staticClass:"fa-solid fa-chevron-right"}):t("span",{staticClass:"placeholder"})]):t("span",{staticClass:"expand-icon placeholder"}),t("span",{staticClass:"node-icon"},[t("i",{class:e.getFileIcon(e.node.name,e.node.is_directory)})]),t("span",{staticClass:"node-name"},[e._v(e._s(e.node.name))])]),e.node.is_directory&&e.expanded&&(e.loadedChildren.length>0||((i=e.node.children)==null?void 0:i.length)>0)?t("div",{staticClass:"children"},e._l(e.loadedChildren.length>0?e.loadedChildren:e.node.children,function(n){return t("file-select-tree-node",{key:n.path,attrs:{node:n,level:e.level+1,"selected-path":e.selectedPath},on:{select:function(r){return e.$emit("select",r)},"enter-dir":function(r){return e.$emit("enter-dir",r)},"load-children":function(r){return e.$emit("load-children",r)}}})}),1):e._e()])},lht=[],cht=Li(oht,aht,lht,!1,null,"1b3867a9");const dht=cht.exports,ED=new Map,nke={on(s,e){return ED.has(s)||ED.set(s,new Set),ED.get(s).add(e),()=>{var t;(t=ED.get(s))==null||t.delete(e)}},emit(s,e){const t=ED.get(s);if(t)for(const i of t)try{i(e)}catch(n){console.error(`[eventBus] ${s} listener error:`,n)}}},uht=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/code`;let or=null,Tg=null,HF=0;const hht=10,fht=1e3,KI=new Map;let B2=new Map,GI=null;const ght=5e3;function pht(s){return KI.has(s)||KI.set(s,[]),KI.get(s)}function mht(s){var i;const{type:e}=s,t=KI.get(e)||[];for(const n of t)try{n(s)}catch(r){console.error("WebSocket listener error:",r)}if(e==="step"){const r=(s.data||s).toolCalls;if(r&&Array.isArray(r))for(const o of r){const a=(i=o.function)==null?void 0:i.name;if(a==="edit_file"||a==="write_file")try{const l=JSON.parse(o.function.arguments||"{}");l.file_path&&(console.log("[WS] emit file:changed",{filePath:l.file_path,action:a}),nke.emit("file:changed",{filePath:l.file_path,action:a}))}catch(l){console.warn("[WS] parse toolCall arguments failed:",l)}}}}function lJ(){if(!(or&&or.readyState===WebSocket.OPEN))try{or=new WebSocket(uht),or.onopen=()=>{console.log("[WS] Connected"),HF=0,Tg&&(clearTimeout(Tg),Tg=null),vht()},or.onmessage=s=>{try{const e=JSON.parse(s.data);mht(e)}catch(e){console.error("[WS] Parse error:",e)}},or.onclose=()=>{console.log("[WS] Closed"),or=null,ske(),Wpe()},or.onerror=s=>{console.error("[WS] Error:",s)}}catch(s){console.error("[WS] Connection error:",s),Wpe()}}function Wpe(){if(HF>=hht){console.log("[WS] Max reconnect attempts reached");return}if(Tg)return;const s=fht*Math.pow(2,HF);HF++,Tg=setTimeout(()=>{Tg=null,lJ()},s)}function _ht(){ske(),Tg&&(clearTimeout(Tg),Tg=null),or&&(or.close(),or=null)}function Vpe(s,e){return or&&or.readyState===WebSocket.OPEN?(or.send(JSON.stringify({type:s,data:e})),!0):!1}function Hpe(){return or&&or.readyState===WebSocket.OPEN}function vht(){GI||(GI=setInterval(()=>{or&&or.readyState===WebSocket.OPEN&&or.send(JSON.stringify({type:"get_running_sessions",data:{}}))},ght),or&&or.readyState===WebSocket.OPEN&&or.send(JSON.stringify({type:"get_running_sessions",data:{}})))}function ske(){GI&&(clearInterval(GI),GI=null)}const Ks={connect:lJ,disconnect:_ht,send:Vpe,isConnected:Hpe,on(s,e){const t=pht(s);return t.push(e),()=>{const i=t.indexOf(e);i>-1&&t.splice(i,1)}},off(s,e){const t=KI.get(s)||[],i=t.indexOf(e);i>-1&&t.splice(i,1)},subscribe(s,e){console.log(`[WS] Subscribing to session ${s} with handlers:`,Object.keys(e)),B2.has(s)&&B2.get(s)();const t=[],i=["todos","session","step","compact","done","stopped","error"],n=["running_sessions"];for(const o of i){const a=e[o];a&&t.push(this.on(o,l=>{var h;(l.sessionId||((h=l.data)==null?void 0:h.sessionId))===s&&a(l.data||l,l)}))}for(const o of n){const a=e[o];a&&t.push(this.on(o,l=>{a(l.data||l,l)}))}e.running_sessions&&Hpe()&&Vpe("get_running_sessions",{});const r=()=>{t.forEach(o=>o()),B2.delete(s)};return B2.set(s,r),r},init(){lJ()}},Jv="/api";let Fp=new Map;async function Xe(s,e,t=null){const i={method:s,headers:{"Content-Type":"application/json"}};t&&s!=="GET"&&(i.body=JSON.stringify(t));const r=await(await fetch(`${Jv}${e}`,i)).json();if(r.success===!1)throw new Error(r.error||r.message||"请求失败");return r}const jt={getSessions(s=20,e=0){return Xe("GET",`/session/list_session?limit=${s}&offset=${e}`)},createSession(s="新会话",e=null){return Xe("POST","/session/create_session",{title:s,projectPath:e})},getSession(s){return Xe("GET",`/session/detail_session?id=${s}`)},updateSession(s,e){return Xe("POST","/session/update_session",{id:s,...e})},deleteSession(s){return Xe("POST","/session/delete_session",{id:s})},getSessionStatuses(s){return Xe("POST","/session/status_session",{sessionIds:s})},getMessages(s){return Xe("GET",`/chat/history_chat?sessionId=${s}`)},getProviders(){return Xe("GET","/sys_config/list_providers_config")},getProvider(s){return Xe("GET",`/sys_config/detail_provider_config?id=${s}`)},addProvider(s){return Xe("POST","/sys_config/create_provider_config",s)},updateProvider(s,e){return Xe("POST","/sys_config/update_provider_config",{id:s,...e})},deleteProvider(s){return Xe("POST","/sys_config/delete_provider_config",{id:s})},setDefaultProvider(s){return Xe("POST","/sys_config/set_default_provider_config",{id:s})},getModels(){return Xe("GET","/sys_config/list_models_config")},getModelsByProvider(s){return Xe("GET",`/sys_config/list_models_config?providerId=${s}`)},addModel(s){return Xe("POST","/sys_config/create_model_config",s)},updateModel(s,e){return Xe("POST","/sys_config/update_model_config",{id:s,...e})},deleteModel(s){return Xe("POST","/sys_config/delete_model_config",{id:s})},chat(s){return Xe("POST","/chat/send_chat",s)},chatCommand(s,e){return Xe("POST","/chat/command_chat",{message:s,sessionId:e})},uploadChatImage(s,e){const t=new FormData;return t.append("image",s),t.append("sessionId",e),fetch(`${Jv}/chat/upload_image_chat`,{method:"POST",body:t}).then(i=>i.json())},getSkills(){return Xe("GET","/skill/list_skill")},getLocalSkills(s){const e=s?`?projectPath=${encodeURIComponent(s)}`:"";return Xe("GET",`/skill/local_skill${e}`)},getSkillContent(s){return Xe("GET",`/skill/detail_skill?name=${encodeURIComponent(s)}`)},deleteLocalSkill(s){return Xe("POST","/skill/load_skill",{name:s,action:"delete"})},getSkillCategories(){return Xe("GET","/skill/categories")},getPublishedSkills(s={}){const{page:e=1,pageSize:t=20,keyword:i,categoryId:n}=s;let r=`page=${e}&page_size=${t}`;return i&&(r+=`&keyword=${encodeURIComponent(i)}`),n&&(r+=`&category_id=${n}`),Xe("GET",`/skill/published?${r}`)},installSkill(s,e){return Xe("POST","/skill/install",{skillId:s,skillName:e})},uninstallSkill(s){return Xe("POST","/skill/uninstall",{skillName:s})},getConfig(s){return Xe("GET",`/sys_config/get_config?key=${encodeURIComponent(s)}`)},setConfig(s,e){return Xe("POST","/sys_config/set_config",{key:s,value:e})},getProxyConfig(){return Xe("GET","/sys_config/proxy_config")},updateProxyConfig(s){return Xe("POST","/sys_config/proxy_config",s)},getFileTree(s="/"){return Xe("GET",`/file/tree_file?path=${encodeURIComponent(s)}`)},getFileContent(s){return Xe("GET",`/file/content_file?path=${encodeURIComponent(s)}`)},writeFile(s,e){return Xe("POST","/file/write_file",{path:s,content:e})},editFile(s,e,t){return Xe("POST","/file/edit_file",{path:s,oldString:e,newString:t})},deleteFile(s){return Xe("POST","/file/delete_file",{filePath:s})},writeFile(s,e){return Xe("POST","/file/write_file",{filePath:s,content:e})},editFile(s,e,t){return Xe("POST","/file/edit_file",{filePath:s,oldString:e,newString:t})},createDirectory(s){return Xe("POST","/file/mkdir_file",{filePath:s})},renameFile(s,e){return Xe("POST","/file/rename_file",{oldPath:s,newPath:e})},browseFilesystem(s=""){return Xe("GET",`/file/browse_file?path=${encodeURIComponent(s)}`)},async uploadFilesystem(s,e){const t=new FormData;t.append("file",e),t.append("targetDir",s),t.append("filename",encodeURIComponent(e.name));const n=await(await fetch(`${Jv}/file/upload_file`,{method:"POST",body:t})).json();if(n.success===!1)throw new Error(n.error||n.message||"上传失败");return n},uploadFilesystemWithProgress(s,e,t){const n=Math.ceil(e.size/10485760),r=Date.now()+"-"+Math.round(Math.random()*1e9);return(async()=>{for(let l=0;l<n;l++){const d=l*10485760,h=Math.min(d+10485760,e.size),f=e.slice(d,h);await this.uploadChunk(r,l,n,e.name,s,f),t&&t(Math.round((l+1)/n*95))}const a=await this.mergeChunks(r);return t&&t(100),a})()},uploadChunk(s,e,t,i,n,r){const o=new FormData;return o.append("uploadId",s),o.append("chunkIndex",String(e)),o.append("totalChunks",String(t)),o.append("fileName",encodeURIComponent(i)),o.append("targetDir",n),o.append("chunk",r),fetch(`${Jv}/file/upload_chunk_file`,{method:"POST",body:o}).then(a=>a.json()).then(a=>{if(a.success===!1)throw new Error(a.error||"上传分片失败");return a})},mergeChunks(s){return Xe("POST","/file/upload_merge_file",{uploadId:s})},downloadFilesystemWithProgress(s,e,t){const i=`${Jv}/file/download_file?path=${encodeURIComponent(s)}`;return fetch(i).then(n=>{if(!n.ok)throw new Error("下载失败: HTTP "+n.status);const r=n.headers.get("Content-Length"),o=r?parseInt(r,10):0,a=n.body.getReader(),l=[];let d=0;const h=()=>a.read().then(({done:f,value:p})=>{if(f){const m=new Blob(l),v=URL.createObjectURL(m),b=document.createElement("a");return b.href=v,b.download=e,document.body.appendChild(b),b.click(),document.body.removeChild(b),URL.revokeObjectURL(v),{success:!0}}return l.push(p),d+=p.length,o>0&&t&&t(Math.round(d/o*100)),h()});return h()})},async saveFile(s,e){return Xe("POST","/file/write_file",{filePath:s,content:Array.from(new Uint8Array(e))})},removeFile(s){return Xe("POST","/file/delete_file",{filePath:s})},moveFile(s,e){return Xe("POST","/file/rename_file",{oldPath:s,newPath:e})},getDrives(){return Xe("GET","/file/drives_file")},getCwd(){return Xe("GET","/file/browse_file?path=.")},getDbTables(){return Xe("GET","/db/tables_db")},getTableInfo(s){return Xe("GET",`/db/schema_db?name=${encodeURIComponent(s)}`)},getTableData(s,e=1,t=50){return Xe("GET",`/db/data_db?name=${encodeURIComponent(s)}&page=${e}&pageSize=${t}`)},getTableDataRaw(s,e=100){return Xe("GET",`/db/data_db?name=${encodeURIComponent(s)}&limit=${e}`)},executeSql(s){return Xe("POST","/db/data_db",{query:s})},getAiCallLogs(s=1,e=50){return Xe("GET",`/ai_log/list_ai_log?page=${s}&pageSize=${e}`)},getScheduledTasks(){return Xe("GET","/scheduler/list_scheduler")},getScheduledTask(s){return Xe("GET",`/scheduler/logs_scheduler?id=${s}`)},createScheduledTask(s){return Xe("POST","/scheduler/create_scheduler",s)},updateScheduledTask(s,e){return Xe("POST","/scheduler/update_scheduler",{id:s,...e})},deleteScheduledTask(s){return Xe("POST","/scheduler/delete_scheduler",{id:s})},startScheduledTask(s){return Xe("POST","/scheduler/start_scheduler",{id:s})},stopScheduledTask(s){return Xe("POST","/scheduler/stop_scheduler",{id:s})},runTaskNow(s){return Xe("POST","/scheduler/run_scheduler",{id:s})},getTaskLogs(s,e=50){return Xe("GET",`/scheduler/logs_scheduler?id=${s}&limit=${e}`)},ws:Ks,sessionWsSend(s,e,t){return Ks.send(e,t)},wsIsConnected(){return Ks.isConnected()},wsSubscribe(s,e){return Ks.subscribe(s,e)},getEmailConfigs(){return Xe("GET","/email/list_email")},getEmailConfig(s){return Xe("GET",`/email/detail_email?id=${s}`)},createEmailConfig(s){return Xe("POST","/email/create_email",s)},updateEmailConfig(s,e){return Xe("POST","/email/update_email",{id:s,...e})},deleteEmailConfig(s){return Xe("POST","/email/delete_email",{id:s})},setDefaultEmailConfig(s){return Xe("POST","/email/set_default_email",{id:s})},validateEmailConfig(s){return Xe("POST","/email/validate_email",{configId:s})},getDingtalkConfig(){return Xe("GET","/dingtalk/config_dingtalk")},updateDingtalkConfig(s){return Xe("POST","/dingtalk/config_dingtalk",s)},startDingtalk(){return Xe("POST","/dingtalk/start_dingtalk")},stopDingtalk(){return Xe("POST","/dingtalk/stop_dingtalk")},getGatewayStatus(){return Xe("GET","/dingtalk/status_dingtalk")},getQueueStatus(){return Xe("GET","/gateway/queue_gateway")},getWafConfig(){return Xe("GET","/gateway/waf_config_gateway")},updateWafConfig(s){return Xe("POST","/gateway/waf_update_gateway",s)},startWaf(){return Xe("POST","/gateway/waf_start_gateway")},stopWaf(){return Xe("POST","/gateway/waf_stop_gateway")},getWafStatus(){return Xe("GET","/gateway/waf_status_gateway")},getTerminalSessions(){return Xe("GET","/terminal/list_terminal")},createTerminalSession(){return Xe("POST","/terminal/create_terminal")},deleteTerminalSession(s){return Xe("POST","/terminal/delete_terminal",{id:s})},terminalWsConnect(s,e,t,i,n){if(Fp.has(s)){const l=Fp.get(s);if(l.readyState===WebSocket.OPEN)return l}const o=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal/${s}`,a=new WebSocket(o);return a.onopen=()=>{console.log(`Terminal WebSocket [${s}] connected`),t&&t()},a.onmessage=l=>{try{const d=JSON.parse(l.data);e&&e(d)}catch(d){console.error("Terminal WebSocket parse error:",d)}},a.onclose=()=>{console.log(`Terminal WebSocket [${s}] closed`),Fp.delete(s),i&&i()},a.onerror=l=>{console.error(`Terminal WebSocket [${s}] error:`,l),n&&n(l)},Fp.set(s,a),a},terminalWsDisconnect(s){const e=Fp.get(s);e&&(e.close(),Fp.delete(s))},terminalWsSend(s,e,t){const i=Fp.get(s);return i&&i.readyState===WebSocket.OPEN?(i.send(JSON.stringify({type:e,data:t})),!0):!1},terminalWsIsConnected(s){const e=Fp.get(s);return e&&e.readyState===WebSocket.OPEN},getWorkflowState(){return Xe("GET","/workflow/state_workflow")},updateWorkflowState(s,e,t){return Xe("POST","/workflow/update_workflow",{currentCategory:s,currentProject:e,currentStep:t})},gitIsRepo(){return Xe("GET","/git/is_repo_git")},gitStatus(){return Xe("GET","/git/status_git")},gitDiff(s,e){let t=`/git/diff_git?file=${encodeURIComponent(s)}`;return e&&(t+="&isNew=true"),Xe("GET",t)},gitRevert(s){return Xe("POST","/git/revert_git",{file:s})},gitRevertAll(){return Xe("POST","/git/revert_all_git")},gitDeleteFile(s){return Xe("POST","/git/delete_file_git",{file:s})},gitDiscardUntracked(){return Xe("POST","/git/discard_untracked_git")},getCustomActions(s){const e=s?`?type=${s}`:"";return Xe("GET",`/custom_action/list_custom_action${e}`)},createCustomAction(s){return Xe("POST","/custom_action/create_custom_action",s)},updateCustomAction(s,e){return Xe("POST","/custom_action/update_custom_action",{id:s,...e})},deleteCustomAction(s){return Xe("POST","/custom_action/delete_custom_action",{id:s})},getSpecCategories(){return Xe("GET","/spec/categories")},getPublishedSpecs(s={}){const{page:e=1,pageSize:t=20,keyword:i,categoryId:n,platformCategory:r}=s;let o=`page=${e}&page_size=${t}`;return i&&(o+=`&keyword=${encodeURIComponent(i)}`),n&&(o+=`&category_id=${n}`),r&&(o+=`&platform_category=${encodeURIComponent(r)}`),Xe("GET",`/spec/published?${o}`)},installSpec(s,e){return Xe("POST","/spec/install",{specId:s,specName:e})},uninstallSpec(s){return Xe("POST","/spec/uninstall",{specName:s})},getLocalSpecs(s){const e=s?`?projectPath=${encodeURIComponent(s)}`:"";return Xe("GET",`/spec/local_spec${e}`)},getSpecContent(s){return Xe("GET",`/spec/detail_spec?name=${encodeURIComponent(s)}`)},deleteLocalSpec(s){return Xe("POST","/spec/delete_spec",{name:s})},getProjectPath(){return Xe("GET","/project/current_project")},getWikiMenu(){return Xe("GET","/wiki/menu_wiki")},getWikiContent(s){return Xe("GET",`/wiki/content_wiki?path=${encodeURIComponent(s)}`)},getWikiAsset(s){return`${Jv}/wiki/asset_wiki?path=${encodeURIComponent(s)}`},getMemory(s){const e=s?`?projectPath=${encodeURIComponent(s)}`:"";return Xe("GET",`/memory/get_memory${e}`)},saveMemory(s,e){return Xe("POST","/memory/save_memory",{projectPath:s,content:e})},getProjects(){return Xe("GET","/project/list_project")},getCurrentProject(){return Xe("GET","/project/current_project")},setCurrentProject(s){return Xe("POST","/project/set_current_project",{id:s})},createProject(s,e,t=""){return Xe("POST","/project/create_project",{name:s,path:e,description:t})},deleteProject(s){return Xe("POST","/project/delete_project",{id:s})},exportConfig(){return fetch(`${Jv}/sys_config/export_config`,{method:"GET"}).then(s=>{if(!s.ok)throw new Error("导出失败");return s.blob()})},importConfig(s){return Xe("POST","/sys_config/import_config",{content:s})},getSongbingConfig(){return Xe("GET","/songbing/config_songbing")},saveSongbingConfig(s){return Xe("POST","/songbing/config_songbing",s)},startSongbingAuth(s){return Xe("POST","/songbing/auth_start_songbing",{platformUrl:s})},verifySongbingAuth(s){return Xe("POST","/songbing/auth_verify_songbing",{key:s})},cancelSongbingAuth(){return Xe("POST","/songbing/auth_cancel_songbing")},syncSongbingModels(){return Xe("POST","/songbing/sync_models_songbing")},getSystemInfo(){return Xe("GET","/system/info_system")},checkVersion(){return Xe("GET","/system/version_check")}},bht={name:"FileSelectDialog",components:{FileSelectTreeNode:dht},props:{visible:{type:Boolean,default:!1}},data(){return{loading:!1,currentPath:"",selectedPath:"",parentPath:null,fileTreeData:[]}},computed:{canGoUp(){return this.parentPath!==null&&this.parentPath!==""}},methods:{async loadFileTree(s=""){var e,t,i;this.loading=!0;try{const n=await jt.browseFilesystem(s);this.currentPath=((e=n.data)==null?void 0:e.current_path)||s,this.parentPath=(t=n.data)==null?void 0:t.parent_path;const r=(((i=n.data)==null?void 0:i.items)||[]).map(o=>this.transformNode(o));r.sort((o,a)=>o.is_directory===a.is_directory?o.name.localeCompare(a.name):o.is_directory?-1:1),this.fileTreeData=r}catch(n){console.error("Load file tree failed:",n),this.fileTreeData=[]}finally{this.loading=!1}},transformNode(s){return{name:s.name,path:s.path,is_directory:s.is_directory,is_drive:s.is_drive||!1,size:s.size,has_children:s.is_directory,expanded:!1,children:[]}},handleSelect(s){this.selectedPath=s.path},handleConfirm(){this.selectedPath&&(this.$emit("select",this.selectedPath),this.$emit("update:visible",!1))},async handleLoadChildren({path:s,callback:e}){var t;try{const n=(((t=(await jt.browseFilesystem(s)).data)==null?void 0:t.items)||[]).map(r=>this.transformNode(r));n.sort((r,o)=>r.is_directory===o.is_directory?r.name.localeCompare(o.name):r.is_directory?-1:1),e(n)}catch(i){console.error("Load children failed:",i),e([])}},goUp(){this.parentPath!==null&&this.loadFileTree(this.parentPath===""?"":this.parentPath)},goHome(){this.loadFileTree("")},refresh(){this.loadFileTree(this.currentPath||"")},handleClose(){this.$emit("close")},handleVisibleChange(s){this.$emit("update:visible",s)},open(){this.loadFileTree("")}},watch:{visible(s){s&&this.loadFileTree("")}}};var Cht=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{visible:e.visible,title:"选择文件",width:"500px","close-on-click-modal":!1},on:{"update:visible":e.handleVisibleChange,close:e.handleClose}},[t("div",{staticClass:"file-select-content"},[t("div",{staticClass:"file-tree-container"},[e._l(e.fileTreeData,function(i){return t("file-select-tree-node",{key:i.path,attrs:{node:i,level:0,"selected-path":e.selectedPath},on:{select:e.handleSelect,"load-children":e.handleLoadChildren}})}),e.loading?t("div",{staticClass:"empty-files"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e.fileTreeData.length===0?t("div",{staticClass:"empty-files"},[e._v(" 此目录为空 ")]):e._e()],2),t("div",{staticClass:"file-select-footer"},[t("span",{staticClass:"selected-path"},[e._v(e._s(e.selectedPath||"未选择"))]),t("button",{staticClass:"confirm-btn",attrs:{disabled:!e.selectedPath},on:{click:e.handleConfirm}},[e._v("选择")])])])])},yht=[],wht=Li(bht,Cht,yht,!1,null,"b74d32ae");const rke=wht.exports,Sht={name:"SkillSelectDialog",props:{visible:{type:Boolean,default:!1}},data(){return{loading:!1,skills:[],selectedSkill:"",searchText:""}},computed:{filteredSkills(){if(!this.searchText)return this.skills;const s=this.searchText.toLowerCase();return this.skills.filter(e=>e.name.toLowerCase().includes(s)||e.description&&e.description.toLowerCase().includes(s))}},watch:{visible(s){s&&(this.loadSkills(),this.selectedSkill="",this.searchText="")}},methods:{async loadSkills(){this.loading=!0;try{const s=await jt.getSkills();this.skills=s.data||[]}catch(s){console.error("Load skills failed:",s),this.skills=[]}finally{this.loading=!1,this.$nextTick(()=>{const s=this.$refs.searchInput;s&&s.focus()})}},handleConfirm(){this.selectedSkill&&(this.$emit("select",this.selectedSkill),this.$emit("update:visible",!1))},handleClose(){this.$emit("close")},handleVisibleChange(s){this.$emit("update:visible",s)}}};var xht=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{visible:e.visible,title:"选择 Skill",width:"420px","close-on-click-modal":!1},on:{"update:visible":e.handleVisibleChange,close:e.handleClose}},[t("div",{staticClass:"skill-select-content"},[t("div",{staticClass:"skill-search"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.searchText,expression:"searchText"}],ref:"searchInput",staticClass:"search-input",attrs:{placeholder:"搜索 Skill..."},domProps:{value:e.searchText},on:{input:function(i){i.target.composing||(e.searchText=i.target.value)}}})]),t("div",{staticClass:"skill-list-container"},[e.loading?t("div",{staticClass:"empty-state"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e.filteredSkills.length===0?t("div",{staticClass:"empty-state"},[e._v(" "+e._s(e.searchText?"无匹配 Skill":"无可用 Skill")+" ")]):e._e(),e._l(e.filteredSkills,function(i){return t("div",{key:i.name,staticClass:"skill-item",class:{"skill-selected":e.selectedSkill===i.name},on:{click:function(n){e.selectedSkill=i.name},dblclick:e.handleConfirm}},[t("div",{staticClass:"skill-name"},[e._v(e._s(i.name))]),i.description?t("div",{staticClass:"skill-desc"},[e._v(e._s(i.description))]):e._e()])})],2),t("div",{staticClass:"skill-select-footer"},[t("span",{staticClass:"selected-skill"},[e._v(e._s(e.selectedSkill||"未选择"))]),t("button",{staticClass:"confirm-btn",attrs:{disabled:!e.selectedSkill},on:{click:e.handleConfirm}},[e._v("选择")])])])])},kht=[],Lht=Li(Sht,xht,kht,!1,null,"583829c8");const oke=Lht.exports,Dht={name:"FileTreeNode",props:{node:{type:Object,required:!0},level:{type:Number,default:0},selectedPath:{type:String,default:""},expandedPaths:{type:Set,default:()=>new Set}},data(){return{expanded:!1,loading:!1,loadedChildren:this.node.children||[]}},computed:{isSelected(){return this.selectedPath===this.node.path}},watch:{node:{immediate:!0,handler(s){s.children&&s.children.length>0&&(this.loadedChildren=s.children)}},expandedPaths:{immediate:!0,handler(s){this.node.is_directory&&(s.has(this.node.path)&&!this.expanded?this.ensureExpanded():!s.has(this.node.path)&&this.expanded&&(this.expanded=!1))}}},methods:{async toggleExpand(){if(this.node.is_directory)if(!this.expanded&&this.loadedChildren.length===0&&this.node.has_children){this.loading=!0;try{this.$emit("load-children",{path:this.node.path,callback:s=>{this.loadedChildren=s,this.expanded=!0,this.loading=!1,this.$emit("expand-path",this.node.path)}})}catch(s){console.error("Failed to load children:",s),this.loading=!1}}else this.expanded=!this.expanded,this.expanded?this.$emit("expand-path",this.node.path):this.$emit("collapse-path",this.node.path)},ensureExpanded(){this.expanded||(this.loadedChildren.length===0&&this.node.has_children?(this.loading=!0,this.$emit("load-children",{path:this.node.path,callback:s=>{this.loadedChildren=s,this.expanded=!0,this.loading=!1}})):this.expanded=!0)},handleClick(){this.$emit("select",this.node),this.node.is_directory&&this.toggleExpand()},handleDblClick(){this.node.is_directory?this.toggleExpand():this.$emit("open-file",this.node)},handleContextMenu(s){s.stopPropagation(),this.$emit("contextmenu",s,this.node)},getFileIcon(s,e){if(e)return"fa-solid fa-folder text-yellow-500";const t=s.split(".").pop().toLowerCase(),i=s.toLowerCase(),n={js:"fa-brands fa-js text-yellow-400",jsx:"fa-brands fa-react text-blue-400",ts:"fa-brands fa-js text-blue-400",tsx:"fa-brands fa-react text-blue-400",html:"fa-brands fa-html5 text-orange-500",htm:"fa-brands fa-html5 text-orange-500",css:"fa-brands fa-css3 text-blue-400",scss:"fa-brands fa-sass text-pink-400",sass:"fa-brands fa-sass text-pink-400",vue:"fa-brands fa-vuejs text-green-400",py:"fa-brands fa-python text-blue-500",pyc:"fa-brands fa-python text-gray-400",json:"fa-solid fa-file-code text-yellow-300",yaml:"fa-solid fa-file-code text-blue-300",yml:"fa-solid fa-file-code text-blue-300",xml:"fa-solid fa-file-code text-orange-300",md:"fa-solid fa-file-lines text-gray-400",markdown:"fa-solid fa-file-lines text-gray-400",sql:"fa-solid fa-database text-gray-400",sh:"fa-solid fa-terminal text-green-400",bash:"fa-solid fa-terminal text-green-400",go:"fa-brands fa-golang text-cyan-400",rs:"fa-brands fa-rust text-orange-400",java:"fa-brands fa-java text-red-400",kt:"fa-brands fa-android text-purple-400",swift:"fa-brands fa-apple text-blue-300",c:"fa-solid fa-file-code text-blue-300",cpp:"fa-solid fa-file-code text-blue-400",cc:"fa-solid fa-file-code text-blue-400",h:"fa-solid fa-file-code text-blue-300",hpp:"fa-solid fa-file-code text-blue-400",cs:"fa-brands fa-microsoft text-purple-400",rb:"fa-solid fa-gem text-red-400",php:"fa-brands fa-php text-purple-400",dockerfile:"fa-brands fa-docker text-blue-400",gitignore:"fa-brands fa-git text-red-400",gitattributes:"fa-brands fa-git text-red-400",license:"fa-solid fa-scale-balanced text-yellow-400",png:"fa-solid fa-image text-green-400",jpg:"fa-solid fa-image text-green-400",jpeg:"fa-solid fa-image text-green-400",gif:"fa-solid fa-image text-green-400",svg:"fa-solid fa-image text-green-400",ico:"fa-solid fa-image text-green-400",webp:"fa-solid fa-image text-green-400",bmp:"fa-solid fa-image text-green-400",mp4:"fa-solid fa-film text-purple-400",avi:"fa-solid fa-film text-purple-400",mov:"fa-solid fa-film text-purple-400",mkv:"fa-solid fa-film text-purple-400",mp3:"fa-solid fa-music text-pink-400",wav:"fa-solid fa-music text-pink-400",flac:"fa-solid fa-music text-pink-400",woff:"fa-solid fa-font text-blue-400",woff2:"fa-solid fa-font text-blue-400",ttf:"fa-solid fa-font text-blue-400",otf:"fa-solid fa-font text-blue-400",eot:"fa-solid fa-font text-blue-400",zip:"fa-solid fa-file-zipper text-yellow-600",rar:"fa-solid fa-file-zipper text-yellow-600","7z":"fa-solid fa-file-zipper text-yellow-600",tar:"fa-solid fa-file-zipper text-yellow-600",gz:"fa-solid fa-file-zipper text-yellow-600",pdf:"fa-solid fa-file-pdf text-red-500",doc:"fa-solid fa-file-word text-blue-600",docx:"fa-solid fa-file-word text-blue-600",xls:"fa-solid fa-file-excel text-green-600",xlsx:"fa-solid fa-file-excel text-green-600",ppt:"fa-solid fa-file-powerpoint text-orange-600",pptx:"fa-solid fa-file-powerpoint text-orange-600"};return i==="dockerfile"?n.dockerfile:i===".gitignore"?n.gitignore:i===".gitattributes"?n.gitattributes:i==="license"||i.startsWith("license")?n.license:i.startsWith("readme")?n.md:n[t]||"fa-solid fa-file text-gray-400"}}};var Iht=function(){var i;var e=this,t=e._self._c;return t("div",{staticClass:"file-tree-node"},[t("div",{staticClass:"node-content",class:{selected:e.isSelected,directory:e.node.is_directory},style:{paddingLeft:e.level*16+4+"px"},on:{click:e.handleClick,dblclick:e.handleDblClick,contextmenu:function(n){return n.preventDefault(),e.handleContextMenu.apply(null,arguments)}}},[e.node.is_directory?t("span",{staticClass:"expand-icon",on:{click:function(n){return n.stopPropagation(),e.toggleExpand.apply(null,arguments)}}},[e.loading?t("i",{staticClass:"fa-solid fa-spinner fa-spin"}):e.expanded?t("i",{staticClass:"fa-solid fa-chevron-down"}):e.node.has_children||e.node.children&&e.node.children.length>0?t("i",{staticClass:"fa-solid fa-chevron-right"}):t("span",{staticClass:"placeholder"})]):t("span",{staticClass:"expand-icon placeholder"}),t("span",{staticClass:"node-icon"},[t("i",{class:e.getFileIcon(e.node.name,e.node.is_directory)})]),t("span",{staticClass:"node-name"},[e._v(e._s(e.node.name))])]),e.node.is_directory&&e.expanded&&(e.loadedChildren.length>0||((i=e.node.children)==null?void 0:i.length)>0)?t("div",{staticClass:"children"},e._l(e.loadedChildren.length>0?e.loadedChildren:e.node.children,function(n){return t("file-tree-node",{key:n.path,attrs:{node:n,level:e.level+1,"selected-path":e.selectedPath,"expanded-paths":e.expandedPaths},on:{select:function(r){return e.$emit("select",r)},"open-file":function(r){return e.$emit("open-file",r)},"load-children":function(r){return e.$emit("load-children",r)},contextmenu:(r,o)=>e.$emit("contextmenu",r,o),"expand-path":function(r){return e.$emit("expand-path",r)},"collapse-path":function(r){return e.$emit("collapse-path",r)}}})}),1):e._e()])},Eht=[],Tht=Li(Dht,Iht,Eht,!1,null,"19d1205f");const ake=Tht.exports,Nht={name:"DesignSelectDialog",components:{FileTreeNode:ake},props:{visible:{type:Boolean,default:!1}},data(){return{loading:!1,browseResult:{current_path:"",parent_path:null,items:[]},selectedPath:"",selectedPageName:"",selectedPagePath:"",selectedRelativePath:"",expandedPaths:new Set,currentDevice:"web",previewSrc:"",designBasePath:".txcode/design",nodeMap:{}}},computed:{fileTreeData(){return this.browseResult.items.filter(e=>e.name==="session.json"?!1:e.is_directory?!0:e.name.endsWith(".html")).map(e=>({name:e.name,path:e.path,is_directory:e.is_directory,is_drive:!1,size:e.size,has_children:e.is_directory,expanded:!1,children:[]})).sort((e,t)=>e.is_directory===t.is_directory?e.name.localeCompare(t.name):e.is_directory?-1:1)}},watch:{visible(s){s&&(this.initBrowse(),this.selectedPath="",this.selectedPageName="",this.selectedPagePath="",this.selectedRelativePath="",this.previewSrc="",this.expandedPaths=new Set,this.nodeMap={},this.currentDevice="web")}},methods:{async initBrowse(){this.loading=!0;try{const s=await jt.browseFilesystem(this.designBasePath);this.browseResult=s.data,this.nodeMap={};for(const e of s.data.items)e.name!=="session.json"&&(e.is_directory||e.name.endsWith(".html"))&&(this.nodeMap[this.toRelativeDesignPath(e.path.replace(/\\/g,"/"))]=e)}catch(s){console.error("Browse design dir failed:",s),this.browseResult={current_path:this.designBasePath,parent_path:"",items:[]}}finally{this.loading=!1}},getRelativePath(s){const e=s.replace(/\\/g,"/"),i=e.indexOf(".txcode/design/");return i===-1?s:e.substring(i)},handleSelect(s){s.is_directory||(this.selectedPath=s.path,this.selectedPagePath=s.path,this.selectedPageName=s.name.replace(".html",""),this.selectedRelativePath=this.getRelativePath(s.path),this.loadPreview(s.path))},handleOpenFile(s){this.handleSelect(s)},async handleLoadChildren({path:s,callback:e}){try{const i=((await jt.browseFilesystem(s)).data.items||[]).filter(n=>n.name==="session.json"?!1:n.is_directory?!0:n.name.endsWith(".html")).map(n=>{const r=n.path.replace(/\\/g,"/");return this.nodeMap[this.toRelativeDesignPath(r)]=n,{name:n.name,path:n.path,is_directory:n.is_directory,is_drive:!1,size:n.size,has_children:n.is_directory,expanded:!1,children:[]}});e(i.sort((n,r)=>n.is_directory===r.is_directory?n.name.localeCompare(r.name):n.is_directory?-1:1))}catch(t){console.error("Load children failed:",t),e([])}},onExpandPath(s){const e=new Set(this.expandedPaths);e.add(s),this.expandedPaths=e},onCollapsePath(s){const e=new Set(this.expandedPaths);e.delete(s),this.expandedPaths=e},loadPreview(s){const e=this.getRelativePath(s).replace(/^\.txcode\/design\//,"").replace(/\\/g,"/");this.previewSrc=`/design_html/${encodeURI(e)}?_t=${Date.now()}`,console.log("[DesignSelect] loadPreview previewSrc:",this.previewSrc)},onIframeNav(){var s,e;try{const t=(e=(s=this.$el)==null?void 0:s.querySelector)==null?void 0:e.call(s,".preview-content");if(!t||!t.contentWindow){console.log("[DesignSelect] onIframeNav: iframe not ready");return}const i=t.contentWindow.location.pathname;console.log("[DesignSelect] onIframeNav pathname:",i);const n=".txcode/design"+decodeURIComponent(i.replace(/^\/design_html/,""));console.log("[DesignSelect] onIframeNav filePath:",n);const r=this.toRelativeDesignPath(n.replace(/\\/g,"/"));console.log("[DesignSelect] onIframeNav filePathRel:",r),console.log("[DesignSelect] nodeMap keys:",Object.keys(this.nodeMap));const o=this.nodeMap[r];if(console.log("[DesignSelect] onIframeNav item:",o),!o)return;if(this.selectedPath===o.path){console.log("[DesignSelect] onIframeNav: already selected, skip");return}console.log("[DesignSelect] onIframeNav: selecting",o.path),this.handleSelectFileItem(o),this.expandAncestors(n)}catch(t){console.log("[DesignSelect] onIframeNav error:",t)}},handleSelectFileItem(s){s.is_directory||(this.selectedPath=s.path,this.selectedPagePath=s.path,this.selectedPageName=s.name.replace(".html",""),this.selectedRelativePath=this.getRelativePath(s.path),this.loadPreview(s.path))},findNodeByPath(s,e){if(!s||!s.length)return null;const t=e.replace(/\\/g,"/");for(const i of s){const n=(i.path||"").replace(/\\/g,"/"),r=this.toRelativeDesignPath(n),o=this.toRelativeDesignPath(t);if(r===o)return i;if(i.children&&i.children.length){const a=this.findNodeByPath(i.children,t);if(a)return a}}return null},toRelativeDesignPath(s){const t=s.indexOf(".txcode/design/");return t!==-1?s.substring(t):s},expandAncestors(s){const e=s.replace(/\\/g,"/").split("/");let t="";const i=new Set(this.expandedPaths);for(let n=0;n<e.length-1;n++)t+=(n===0?"":"/")+e[n],i.add(t);console.log("[DesignSelect] expandAncestors:",[...i]),this.expandedPaths=i},setDevice(s){this.currentDevice=s,this.selectedPagePath&&this.loadPreview(this.selectedPagePath)},refreshPreview(){this.selectedPagePath&&this.loadPreview(this.selectedPagePath)},handleConfirm(){this.selectedPath&&(this.$emit("select",{id:this.selectedPath,name:this.selectedPageName,path:this.selectedRelativePath,absPath:this.selectedPagePath}),this.$emit("update:visible",!1))},handleClose(){this.$emit("close")},handleVisibleChange(s){this.$emit("update:visible",s)}}};var Pht=function(){var e=this,t=e._self._c;return t("el-dialog",{staticClass:"design-select-dialog",attrs:{visible:e.visible,title:"选择设计",width:"1200px",top:"3vh","close-on-click-modal":!1},on:{"update:visible":e.handleVisibleChange,close:e.handleClose}},[t("div",{staticClass:"dialog-body"},[t("div",{staticClass:"design-left"},[t("div",{staticClass:"page-tree"},[e.loading?t("div",{staticClass:"flex items-center justify-center py-8 text-textMuted text-sm"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e.fileTreeData.length===0?t("div",{staticClass:"empty-state"},[e._v(" 暂无设计页面,请在 .txcode/design/ 目录下添加 HTML 文件 ")]):e._l(e.fileTreeData,function(i){return t("file-tree-node",{key:i.path,attrs:{node:i,level:0,"selected-path":e.selectedPath,"expanded-paths":e.expandedPaths},on:{select:e.handleSelect,"open-file":e.handleOpenFile,"load-children":e.handleLoadChildren,"expand-path":e.onExpandPath,"collapse-path":e.onCollapsePath}})})],2),t("div",{staticClass:"footer"},[t("span",{staticClass:"selected-info"},[e._v(e._s(e.selectedRelativePath||"未选择"))]),t("button",{staticClass:"btn-confirm",attrs:{disabled:!e.selectedPath},on:{click:e.handleConfirm}},[e._v("确认选择")])])]),t("div",{staticClass:"design-right"},[t("div",{staticClass:"preview-toolbar"},[t("div",{staticClass:"device-btns"},[t("button",{class:{active:e.currentDevice==="web"},on:{click:function(i){return e.setDevice("web")}}},[e._v("💻 Web")]),t("button",{class:{active:e.currentDevice==="pad"},on:{click:function(i){return e.setDevice("pad")}}},[e._v("📱 Pad")]),t("button",{class:{active:e.currentDevice==="app"},on:{click:function(i){return e.setDevice("app")}}},[e._v("📱 App")])]),t("div",{staticClass:"preview-actions"},[t("button",{attrs:{title:"刷新预览"},on:{click:e.refreshPreview}},[t("svg",{attrs:{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"}},[t("polyline",{attrs:{points:"23 4 23 10 17 10"}}),t("polyline",{attrs:{points:"1 20 1 14 7 14"}}),t("path",{attrs:{d:"M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"}})])])]),t("span",{staticClass:"page-indicator"},[e._v("当前:"+e._s(e.selectedPageName||"—"))])]),t("div",{staticClass:"preview-frame"},[t("div",{staticClass:"device-frame",class:"device-frame-"+e.currentDevice,attrs:{id:"previewWrapper"}},[e.currentDevice==="web"||e.currentDevice==="pad"?t("div",{staticClass:"browser-toolbar"},[t("div",{staticClass:"browser-dots"},[t("span",{staticClass:"red"}),t("span",{staticClass:"yellow"}),t("span",{staticClass:"green"})]),t("span",{staticClass:"browser-url"},[e._v(e._s(e.selectedRelativePath||"/"))])]):e._e(),e.previewSrc?t("div",{staticClass:"preview-content-wrapper"},[e.previewSrc?t("iframe",{staticClass:"preview-content",attrs:{src:e.previewSrc,sandbox:"allow-scripts allow-same-origin"},on:{load:e.onIframeNav}}):e._e()]):t("div",{staticClass:"preview-empty"},[e._v(" 请选择左侧页面预览 ")])])])])])])},Mht=[],Rht=Li(Nht,Pht,Mht,!1,null,"2366d6f7");const lke=Rht.exports,Oht={name:"CommandDialog",props:{visible:{type:Boolean,default:!1}},data(){return{loading:!1,selectedCommand:"",commands:[{name:"/compact",description:"压缩当前会话上下文"}]}},methods:{open(){},handleExecute(s){this.$emit("execute",s.name),this.$emit("update:visible",!1)},handleClose(){this.$emit("close")},handleVisibleChange(s){this.$emit("update:visible",s)}}};var Aht=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{visible:e.visible,title:"命令",width:"500px","close-on-click-modal":!1},on:{"update:visible":e.handleVisibleChange,close:e.handleClose}},[t("div",{staticClass:"command-list"},[e._l(e.commands,function(i){return t("div",{key:i.name,staticClass:"command-item",class:{selected:e.selectedCommand===i.name},attrs:{title:"双击执行: "+i.name},on:{click:function(n){e.selectedCommand=i.name},dblclick:function(n){return e.handleExecute(i)}}},[t("span",{staticClass:"command-name"},[e._v(e._s(i.name))]),t("span",{staticClass:"command-desc"},[e._v(e._s(i.description))])])}),e.loading?t("div",{staticClass:"empty-commands"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e._e()],2)])},Fht=[],Bht=Li(Oht,Aht,Fht,!1,null,"439b4563");const cke=Bht.exports,Wht="/api";async function Vht(s){const e=new FormData;e.append("file",s);const i=await(await fetch(`${Wht}/chat/upload_image_chat`,{method:"POST",body:e})).json();if(i.success===!1)throw new Error(i.error||"上传失败");return i}function Hht(s){var n;const t=s.input.trim(),i=(s.mediaFiles||[]).filter(r=>!r.uploading&&r.filePath);return{message:t,sessionId:(n=s.session)==null?void 0:n.id,modelName:s.modelName||void 0,enableDevLog:s.enableDevLog,mediaFiles:i.map(r=>({filePath:r.filePath,type:r.type}))}}async function dke(s){const e=await new Promise((i,n)=>{const r=new FileReader;r.onload=()=>i(r.result),r.onerror=n,r.readAsDataURL(s)}),t=await Vht(s);return{dataUrl:e,filePath:t.data.filePath,type:t.data.filePath.endsWith(".png")?"image/png":s.type||"image/jpeg"}}const $ht={name:"PlanAssistant",components:{ResizableTextarea:cse,ImagePreviewList:ike,FileSelectDialog:rke,SkillSelectDialog:oke,DesignSelectDialog:lke,CommandDialog:cke},props:{visible:{type:Boolean,default:!1},width:{type:Number,default:420},designPanel:{type:Object,required:!0},discussPanel:{type:Object,required:!0},discussSessions:{type:Array,default:()=>[]},currentDiscuss:{type:Object,default:null},planFilePath:{type:String,default:""}},data(){return{activeTab:"design",dropdownOpen:!1,menuId:null,renameVisible:!1,renameValue:"",renameTarget:null,deleteVisible:!1,deleteTarget:null,fileSelectVisible:!1,skillSelectVisible:!1,designSelectVisible:!1,commandDialogVisible:!1,previewImage:null}},watch:{visible(s){s&&this.scrollAllToBottom()}},mounted(){document.addEventListener("mousedown",this.onMouseDown)},beforeDestroy(){document.removeEventListener("mousedown",this.onMouseDown)},methods:{getTodoStatusIcon:a7,getToolCallName:ase,getToolCallArguments:lse,formatInput:l7,renderMarkdown:ik,onMouseDown(s){this.menuId&&!s.target.closest(".item-actions")&&(this.menuId=null),this.dropdownOpen&&!s.target.closest(".discuss-dropdown")&&(this.dropdownOpen=!1)},switchDiscuss(s){this.dropdownOpen=!1,this.$emit("switchDiscuss",s)},createDiscuss(){this.dropdownOpen=!1,this.$emit("createDiscuss")},startRename(s){this.menuId=null,this.renameTarget=s,this.renameValue=s.title,this.renameVisible=!0},doRename(){!this.renameValue.trim()||!this.renameTarget||(this.$emit("renameDiscuss",this.renameTarget,this.renameValue.trim()),this.renameVisible=!1,this.renameTarget=null)},confirmDelete(s){this.menuId=null,this.deleteTarget=s,this.deleteVisible=!0},doDelete(){this.deleteTarget&&(this.$emit("deleteDiscuss",this.deleteTarget),this.deleteVisible=!1,this.deleteTarget=null)},scrollDesignToBottom(s=!1){const e=oJ(this.$refs.designMsgs);this.$nextTick(()=>{const t=this.$refs.designMsgs;t&&aJ(t,{force:s,prevSnapshot:e})})},scrollDiscussToBottom(s=!1){const e=oJ(this.$refs.discussMsgs);this.$nextTick(()=>{const t=this.$refs.discussMsgs;t&&aJ(t,{force:s,prevSnapshot:e})})},scrollAllToBottom(){this.scrollDesignToBottom(),this.scrollDiscussToBottom()},handleDesignKeydown(s){if(s.key==="Enter")if(s.ctrlKey){const e=s.target,t=e.selectionStart,i=e.selectionEnd;this.designPanel.input=this.designPanel.input.substring(0,t)+`
|
|
950
950
|
`+this.designPanel.input.substring(i),this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+1})}else s.preventDefault(),this.designPanel.disabled||this.$emit("sendDesign")},handleDiscussKeydown(s){if(s.key==="Enter")if(s.ctrlKey){const e=s.target,t=e.selectionStart,i=e.selectionEnd;this.discussPanel.input=this.discussPanel.input.substring(0,t)+`
|
|
951
951
|
`+this.discussPanel.input.substring(i),this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+1})}else s.preventDefault(),this.discussPanel.disabled||this.$emit("sendDiscuss")},handleDesignImageUpload(){const s=this.$refs.designImgInput;s&&(Array.isArray(s)?s[0]:s).click()},handleDiscussImageUpload(){const s=this.$refs.discussImgInput;s&&(Array.isArray(s)?s[0]:s).click()},async handleImageSelected(s,e){const t=s.target.files;if(!t||!t.length)return;const i=Array.from(t);s.target.value="",await this._uploadFiles(i,e)},async handlePasteImages(s,e){s.disabled||await this._uploadFiles(e,s)},async _uploadFiles(s,e){const n=5-(e.mediaFiles||[]).length;if(n<=0){this.$message.warning("最多上传5张图片");return}const r=Math.min(s.length,n);e.mediaFiles||(e.mediaFiles=[]);for(let a=0;a<r;a++){const l=s[a];e.mediaFiles.push({id:Date.now()+"_"+a+"_"+Math.random().toString(36).slice(2),name:l.name||"paste.png",dataUrl:"",filePath:"",type:l.type||"image/png",uploading:!0})}const o=e.mediaFiles.length-r;for(let a=0;a<r;a++){const l=o+a;try{const d=await dke(s[a]);Object.assign(e.mediaFiles[l],{dataUrl:d.dataUrl,filePath:d.filePath,type:d.type,uploading:!1})}catch{e.mediaFiles.splice(l,1)}}},removeMedia(s,e){const t=(s.mediaFiles||[]).findIndex(i=>i.id===e);t>-1&&s.mediaFiles.splice(t,1)},openImagePreview(s){this.previewImage=s},closeImagePreview(){this.previewImage=null},onFileSelected(s){const e=this.activeTab==="design"?this.designPanel:this.discussPanel;e.input=e.input+s+" ",this.fileSelectVisible=!1},onSkillSelected(s){const e=this.activeTab==="design"?this.designPanel:this.discussPanel;e.input="[Skill:"+s+"] "+e.input,this.skillSelectVisible=!1},onDesignSelected(s){const e=this.activeTab==="design"?this.designPanel:this.discussPanel,t=`[设计:${s.name}](${s.path}) `;e.input+=t,this.designSelectVisible=!1},handleExecuteCommand(s){const e=this.activeTab==="design"?this.designPanel:this.discussPanel;e.input=s+" ",this.$nextTick(()=>{const t=this.$el.querySelector(".tab-panel:not(.hidden) .input-area textarea");t&&t.focus()})}}};var zht=function(){var e=this,t=e._self._c;return t("div",{staticClass:"plan-assistant",class:{hidden:!e.visible},style:e.visible?{width:e.width+"px"}:{}},[t("div",{staticClass:"assistant-tabs"},[t("button",{staticClass:"assistant-tab",class:{active:e.activeTab==="design"},on:{click:function(i){e.activeTab="design"}}},[e._v("AI生成方案")]),t("button",{staticClass:"assistant-tab",class:{active:e.activeTab==="discuss"},on:{click:function(i){e.activeTab="discuss"}}},[e._v("AI方案交流")])]),t("div",{staticClass:"tab-panel",class:{hidden:e.activeTab!=="design"}},[t("div",{ref:"designMsgs",staticClass:"assistant-chat-messages"},[!e.designPanel.logItems||e.designPanel.logItems.length===0?t("div",{staticClass:"assistant-empty"},[t("p",[e._v("输入需求描述,AI将协助您完善方案。")])]):e._e(),e._l(e.designPanel.logItems||[],function(i,n){return[i.type==="todos"?t("div",{key:"td-"+n,staticClass:"todos-list"},e._l(i.todos,function(r,o){return t("div",{key:"ti-"+o,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[e._v(e._s(e.getTodoStatusIcon(r.status)))]),t("span",{staticClass:"todo-name"},[e._v(e._s(r.name))])])}),0):i.type==="chat"?t("div",{key:"dc-"+n,staticClass:"flex justify-end"},[t("div",{staticClass:"user-question"},[i.mediaFiles&&i.mediaFiles.length?t("div",{staticClass:"chat-images"},e._l(i.mediaFiles,function(r){return t("img",{key:r.filePath,staticClass:"chat-image-thumb",attrs:{src:r.url||r.dataUrl||r.filePath},on:{click:function(o){return o.stopPropagation(),e.openImagePreview(r)}}})}),0):e._e(),t("div",[e._v(e._s(i.content))])])]):i.type==="think"?t("div",{key:"dt-"+n,staticClass:"ai-thought",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="step"?[i.thought?t("div",{staticClass:"ai-thought",domProps:{innerHTML:e._s(e.renderMarkdown(i.thought))}}):e._e(),e._l(i.toolCalls,function(r,o){return t("div",{key:"dst-"+o,staticClass:"log-mute"},[t("span",{class:i.success!==!1?"tool-success":"tool-fail"},[e._v(e._s(i.success!==!1?"✓":"✗"))]),e._v(" "+e._s(e.getToolCallName(r))+" "),e.getToolCallArguments(r)?t("span",{staticClass:"tool-input"},[e._v(e._s(e.formatInput(e.getToolCallName(r),e.getToolCallArguments(r))))]):e._e()])})]:e._e()]}),e.designPanel.modelName?t("div",{staticClass:"build-info"},[t("span",{staticClass:"icon"},[e._v("▣")]),e._v(" Build · "+e._s(e.designPanel.modelName)+" ")]):e._e()],2),t("div",{staticClass:"assistant-input-area"},[e.designPanel.mediaFiles&&e.designPanel.mediaFiles.length?t("div",{staticClass:"image-preview-wrap"},[t("ImagePreviewList",{attrs:{files:e.designPanel.mediaFiles,disabled:e.designPanel.disabled},on:{remove:i=>e.removeMedia(e.designPanel,i)}})],1):e._e(),t("div",{staticClass:"assistant-input-panel"},[t("div",{staticClass:"input-wrapper"},[t("ResizableTextarea",{staticClass:"input-area",attrs:{rows:4,placeholder:"输入需求描述... (Enter 发送, Ctrl+Enter 换行)",disabled:e.designPanel.disabled},on:{"paste-image":i=>e.handlePasteImages(e.designPanel,i)},nativeOn:{keydown:function(i){return!i.type.indexOf("key")&&e._k(i.keyCode,"enter",13,i.key,"Enter")?null:e.handleDesignKeydown.apply(null,arguments)}},model:{value:e.designPanel.input,callback:function(i){e.$set(e.designPanel,"input",i)},expression:"designPanel.input"}}),t("input",{ref:"designImgInput",staticStyle:{display:"none"},attrs:{type:"file",accept:"image/*",multiple:""},on:{change:i=>e.handleImageSelected(i,e.designPanel)}})],1),t("div",{staticClass:"input-actions"},[t("div",{staticClass:"input-actions-left"},[t("span",{staticClass:"status-action",on:{click:function(i){e.fileSelectVisible=!0},mousedown:function(i){i.preventDefault()}}},[e._v("选择文件")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:function(i){e.skillSelectVisible=!0},mousedown:function(i){i.preventDefault()}}},[e._v("选择Skill")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:function(i){e.designSelectVisible=!0},mousedown:function(i){i.preventDefault()}}},[e._v("选择设计")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:function(i){e.commandDialogVisible=!0},mousedown:function(i){i.preventDefault()}}},[e._v("命令")])]),t("div",{staticClass:"input-actions-right"},[t("button",{staticClass:"action-btn btn-upload",attrs:{disabled:e.designPanel.disabled},on:{click:e.handleDesignImageUpload}},[e._v("图片")]),e.designPanel.disabled&&!e.designPanel.stopping?t("button",{staticClass:"action-btn btn-stop",on:{click:function(i){return e.$emit("stopDesign")}}},[e._v("■ 停止")]):e.designPanel.stopping?t("button",{staticClass:"action-btn btn-stop",attrs:{disabled:""}},[e._v("停止中...")]):t("button",{staticClass:"btn-send",attrs:{disabled:!e.designPanel.input.trim()&&(!e.designPanel.mediaFiles||!e.designPanel.mediaFiles.length)},on:{click:function(i){return e.$emit("sendDesign")}}},[e._v("发送")])])])])]),t("div",{staticClass:"status-bar"},[t("span",{class:e.designPanel.sessionStatus==="processing"||e.designPanel.disabled?"status-thinking":"status-ready"},[e.designPanel.sessionStatus==="processing"||e.designPanel.disabled?t("span",{staticClass:"thinking-spinner"}):e._e(),e._v(" "+e._s(e.designPanel.sessionStatus==="processing"||e.designPanel.disabled?"思考中":"✓ 就绪")+" ")]),t("span",{staticClass:"sep"},[e._v("|")]),t("span",{staticClass:"model-selector",on:{click:function(i){return e.$emit("openModel")},mousedown:function(i){i.preventDefault()}}},[e._v("模型: "+e._s(e.designPanel.modelName||"-")+" ▾")]),t("span",{staticClass:"sep"},[e._v("|")]),t("span",[e._v("会话: "+e._s(e.designPanel.sessionId?e.designPanel.sessionId.slice(0,8):"未创建"))]),t("span",{staticClass:"sep"},[e._v("|")]),t("span",[e._v("token: "+e._s(e.designPanel.promptTokens||0))])])]),t("div",{staticClass:"tab-panel",class:{hidden:e.activeTab!=="discuss"}},[e.discussSessions.length>0?t("div",{staticClass:"discuss-dropdown"},[t("div",{staticClass:"dropdown-trigger",on:{click:function(i){e.dropdownOpen=!e.dropdownOpen}}},[t("span",{staticClass:"dropdown-title"},[e._v(e._s(e.currentDiscuss?e.currentDiscuss.title:"选择探讨"))]),t("span",{staticClass:"dropdown-arrow",class:{rotated:e.dropdownOpen}},[e._v("▾")])]),e.dropdownOpen?t("div",{staticClass:"dropdown-menu"},[e._l(e.discussSessions,function(i){return t("div",{key:i.id,staticClass:"dropdown-item",class:{active:e.currentDiscuss&&e.currentDiscuss.id===i.id}},[t("span",{staticClass:"item-title",on:{click:function(n){return e.switchDiscuss(i)}}},[e._v(e._s(i.title))]),t("span",{staticClass:"item-actions",on:{click:function(n){n.stopPropagation()}}},[t("span",{staticClass:"menu-trigger",on:{click:function(n){n.stopPropagation(),e.menuId=e.menuId===i.id?null:i.id}}},[e._v("⋮")]),e.menuId===i.id?t("div",{staticClass:"disc-menu-popup"},[t("div",{staticClass:"menu-item",on:{click:function(n){return n.stopPropagation(),e.startRename(i)}}},[e._v("重命名")]),t("div",{staticClass:"menu-item danger",on:{click:function(n){return n.stopPropagation(),e.confirmDelete(i)}}},[e._v("删除")])]):e._e()])])}),t("div",{staticClass:"dropdown-item add-item",on:{click:e.createDiscuss}},[e._v("+ 新建探讨")])],2):e._e()]):e._e(),e.discussSessions.length===0?t("div",{staticClass:"assistant-empty",staticStyle:{flex:"1",display:"flex","flex-direction":"column","align-items":"center","justify-content":"center",cursor:"pointer"},on:{click:e.createDiscuss}},[t("p",[e._v("与AI探讨方案内容,不会修改方案文件")]),t("button",{staticClass:"btn-send",staticStyle:{"margin-top":"8px"}},[e._v("新建探讨")])]):e._e(),e.currentDiscuss?[t("div",{ref:"discussMsgs",staticClass:"assistant-chat-messages"},[e._l(e.discussPanel.logItems||[],function(i,n){return[i.type==="todos"?t("div",{key:"dt-"+n,staticClass:"todos-list"},e._l(i.todos,function(r,o){return t("div",{key:"di-"+o,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[e._v(e._s(e.getTodoStatusIcon(r.status)))]),t("span",{staticClass:"todo-name"},[e._v(e._s(r.name))])])}),0):i.type==="chat"?t("div",{key:"dc2-"+n,staticClass:"flex justify-end"},[t("div",{staticClass:"user-question"},[i.mediaFiles&&i.mediaFiles.length?t("div",{staticClass:"chat-images"},e._l(i.mediaFiles,function(r){return t("img",{key:r.filePath,staticClass:"chat-image-thumb",attrs:{src:r.url||r.dataUrl||r.filePath},on:{click:function(o){return o.stopPropagation(),e.openImagePreview(r)}}})}),0):e._e(),t("div",[e._v(e._s(i.content))])])]):i.type==="think"?t("div",{key:"dt2-"+n,staticClass:"ai-thought",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="step"?[i.thought?t("div",{staticClass:"ai-thought",domProps:{innerHTML:e._s(e.renderMarkdown(i.thought))}}):e._e(),e._l(i.toolCalls,function(r,o){return t("div",{key:"dst2-"+o,staticClass:"log-mute"},[t("span",{class:i.success!==!1?"tool-success":"tool-fail"},[e._v(e._s(i.success!==!1?"✓":"✗"))]),e._v(" "+e._s(e.getToolCallName(r))+" "),e.getToolCallArguments(r)?t("span",{staticClass:"tool-input"},[e._v(e._s(e.formatInput(e.getToolCallName(r),e.getToolCallArguments(r))))]):e._e()])})]:e._e()]}),e.discussPanel.modelName?t("div",{staticClass:"build-info"},[t("span",{staticClass:"icon"},[e._v("▣")]),e._v(" Build · "+e._s(e.discussPanel.modelName)+" ")]):e._e()],2),t("div",{staticClass:"assistant-input-area"},[e.discussPanel.mediaFiles&&e.discussPanel.mediaFiles.length?t("div",{staticClass:"image-preview-wrap"},[t("ImagePreviewList",{attrs:{files:e.discussPanel.mediaFiles,disabled:e.discussPanel.disabled},on:{remove:i=>e.removeMedia(e.discussPanel,i)}})],1):e._e(),t("div",{staticClass:"assistant-input-panel"},[t("div",{staticClass:"input-wrapper"},[t("ResizableTextarea",{staticClass:"input-area",attrs:{rows:4,placeholder:"与AI探讨方案... (Enter 发送, Ctrl+Enter 换行)",disabled:e.discussPanel.disabled},on:{"paste-image":i=>e.handlePasteImages(e.discussPanel,i)},nativeOn:{keydown:function(i){return!i.type.indexOf("key")&&e._k(i.keyCode,"enter",13,i.key,"Enter")?null:e.handleDiscussKeydown.apply(null,arguments)}},model:{value:e.discussPanel.input,callback:function(i){e.$set(e.discussPanel,"input",i)},expression:"discussPanel.input"}}),t("input",{ref:"discussImgInput",staticStyle:{display:"none"},attrs:{type:"file",accept:"image/*",multiple:""},on:{change:i=>e.handleImageSelected(i,e.discussPanel)}})],1),t("div",{staticClass:"input-actions"},[t("div",{staticClass:"input-actions-left"},[t("span",{staticClass:"status-action",on:{click:function(i){e.fileSelectVisible=!0},mousedown:function(i){i.preventDefault()}}},[e._v("选择文件")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:function(i){e.skillSelectVisible=!0},mousedown:function(i){i.preventDefault()}}},[e._v("选择Skill")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:function(i){e.designSelectVisible=!0},mousedown:function(i){i.preventDefault()}}},[e._v("选择设计")]),t("span",{staticClass:"separator"},[e._v("|")]),t("span",{staticClass:"status-action",on:{click:function(i){e.commandDialogVisible=!0},mousedown:function(i){i.preventDefault()}}},[e._v("命令")])]),t("div",{staticClass:"input-actions-right"},[t("button",{staticClass:"action-btn btn-upload",attrs:{disabled:e.discussPanel.disabled},on:{click:e.handleDiscussImageUpload}},[e._v("图片")]),e.discussPanel.disabled&&!e.discussPanel.stopping?t("button",{staticClass:"action-btn btn-stop",on:{click:function(i){return e.$emit("stopDiscuss")}}},[e._v("■ 停止")]):e.discussPanel.stopping?t("button",{staticClass:"action-btn btn-stop",attrs:{disabled:""}},[e._v("停止中...")]):t("button",{staticClass:"btn-send",attrs:{disabled:!e.discussPanel.input.trim()&&(!e.discussPanel.mediaFiles||!e.discussPanel.mediaFiles.length)},on:{click:function(i){return e.$emit("sendDiscuss")}}},[e._v("发送")])])])])]),t("div",{staticClass:"status-bar"},[t("span",{class:e.discussPanel.sessionStatus==="processing"||e.discussPanel.disabled?"status-thinking":"status-ready"},[e.discussPanel.sessionStatus==="processing"||e.discussPanel.disabled?t("span",{staticClass:"thinking-spinner"}):e._e(),e._v(" "+e._s(e.discussPanel.sessionStatus==="processing"||e.discussPanel.disabled?"思考中":"✓ 就绪")+" ")]),t("span",{staticClass:"sep"},[e._v("|")]),t("span",[e._v("会话: "+e._s(e.discussPanel.sessionId?e.discussPanel.sessionId.slice(0,8):"未创建"))]),t("span",{staticClass:"sep"},[e._v("|")]),t("span",[e._v("token: "+e._s(e.discussPanel.promptTokens||0))])])]:e._e()],2),t("el-dialog",{attrs:{visible:e.renameVisible,title:"重命名探讨",width:"400px","close-on-click-modal":!1},on:{"update:visible":function(i){e.renameVisible=i}}},[t("el-input",{attrs:{placeholder:"请输入新名称"},nativeOn:{keydown:function(i){return!i.type.indexOf("key")&&e._k(i.keyCode,"enter",13,i.key,"Enter")?null:e.doRename.apply(null,arguments)}},model:{value:e.renameValue,callback:function(i){e.renameValue=i},expression:"renameValue"}}),t("span",{attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(i){e.renameVisible=!1}}},[e._v("取消")]),t("el-button",{attrs:{type:"primary",disabled:!e.renameValue.trim()},on:{click:e.doRename}},[e._v("确定")])],1)],1),t("el-dialog",{attrs:{visible:e.deleteVisible,title:"确认删除",width:"360px","close-on-click-modal":!1},on:{"update:visible":function(i){e.deleteVisible=i}}},[t("p",[e._v("确定要删除探讨「"+e._s(e.deleteTarget?e.deleteTarget.title:"")+"」吗?")]),t("span",{attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(i){e.deleteVisible=!1}}},[e._v("取消")]),t("el-button",{attrs:{type:"danger"},on:{click:e.doDelete}},[e._v("删除")])],1)]),t("FileSelectDialog",{attrs:{visible:e.fileSelectVisible},on:{"update:visible":function(i){e.fileSelectVisible=i},select:e.onFileSelected,close:function(i){e.fileSelectVisible=!1}}}),t("SkillSelectDialog",{attrs:{visible:e.skillSelectVisible},on:{"update:visible":function(i){e.skillSelectVisible=i},select:e.onSkillSelected,close:function(i){e.skillSelectVisible=!1}}}),t("DesignSelectDialog",{attrs:{visible:e.designSelectVisible},on:{"update:visible":function(i){e.designSelectVisible=i},select:e.onDesignSelected,close:function(i){e.designSelectVisible=!1}}}),t("CommandDialog",{attrs:{visible:e.commandDialogVisible},on:{"update:visible":function(i){e.commandDialogVisible=i},execute:e.handleExecuteCommand}}),e.previewImage?t("div",{staticClass:"image-lightbox",on:{click:e.closeImagePreview}},[t("span",{staticClass:"lightbox-close",on:{click:e.closeImagePreview}},[e._v("×")]),t("img",{staticClass:"lightbox-image",attrs:{src:e.previewImage.url||e.previewImage.dataUrl||e.previewImage.filePath},on:{click:function(i){i.stopPropagation()}}})]):e._e()],1)},jht=[],Uht=Li($ht,zht,jht,!1,null,"7fff271f");const qht=Uht.exports,Kht={name:"ModelSelectDialog",props:{visible:{type:Boolean,default:!1},currentModel:{type:String,default:""}},data(){return{models:[],loading:!1}},computed:{selectedModelName(){return this.currentModel}},watch:{visible(s){s&&this.loadModels()}},methods:{open(){this.loadModels()},async loadModels(){this.loading=!0;try{const s=await jt.getModels();this.models=s.data||[]}catch(s){console.error("加载模型列表失败:",s),this.models=[]}finally{this.loading=!1}},handleSelect(s){this.$emit("select",s),this.$emit("update:visible",!1)},handleClose(){this.$emit("close")},handleVisibleChange(s){this.$emit("update:visible",s)}}};var Ght=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{visible:e.visible,title:"选择模型",width:"400px"},on:{"update:visible":e.handleVisibleChange,close:e.handleClose}},[t("div",{staticClass:"model-list"},[e._l(e.models,function(i){return t("div",{key:i.id,staticClass:"model-item",class:{active:e.selectedModelName===i.name},on:{click:function(n){return e.handleSelect(i)}}},[t("span",{staticClass:"model-name"},[e._v(e._s(i.name))]),t("span",{staticClass:"model-provider"},[e._v(e._s(i.providerId))])])}),e.loading?t("div",{staticClass:"empty-models"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e.models.length===0?t("div",{staticClass:"empty-models"},[e._v(" 暂无可用模型 ")]):e._e()],2)])},Yht=[],Zht=Li(Kht,Ght,Yht,!1,null,"96e8b517");const Xht=Zht.exports,Qht={name:"CreateSubPlanDialog",props:{visible:{type:Boolean,default:!1}},methods:{handleVisibleChange(s){this.$emit("update:visible",s)},handleClose(){this.$emit("cancel")},onConfirm(){this.$emit("confirm"),this.$emit("update:visible",!1)},onCancel(){this.$emit("cancel"),this.$emit("update:visible",!1)}}};var Jht=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{visible:e.visible,title:"新建子方案",width:"360px"},on:{"update:visible":e.handleVisibleChange,close:e.handleClose}},[t("div",{staticStyle:{"text-align":"center",padding:"16px 0","font-size":"14px",color:"var(--color-textMain)"}},[e._v(" 是否新建子方案? ")]),t("span",{attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:e.onCancel}},[e._v("取消")]),t("el-button",{attrs:{type:"primary"},on:{click:e.onConfirm}},[e._v("确认")])],1)])},eft=[],tft=Li(Qht,Jht,eft,!1,null,"ae2c339b");const ift=tft.exports,nft="/api";async function bl(s,e,t=null){const i={method:s,headers:{"Content-Type":"application/json"}};t&&s!=="GET"&&(i.body=JSON.stringify(t));const r=await(await fetch(`${nft}${e}`,i)).json();if(r.success===!1)throw new Error(r.error||r.message||"请求失败");return r}const sft=Object.freeze(Object.defineProperty({__proto__:null,request:bl},Symbol.toStringTag,{value:"Module"}));async function rft(s=20,e=0){return bl("GET",`/session/list_session?limit=${s}&offset=${e}`)}async function fB(s="新会话",e=null){return bl("POST","/session/create_session",{title:s,projectPath:e})}async function oft(s){return bl("POST","/session/delete_session",{id:s})}async function dse(s){return bl("GET",`/chat/history_chat?sessionId=${s}`)}function aft(){return bl("GET","/plan-code/list")}function $pe(s,e){return bl("POST","/plan-code/create",{sessionName:s,parentPlanPath:e})}function lft(s,e){return bl("POST","/plan-code/update",{folderName:s,sessionName:e})}function cft(s){return bl("POST","/plan-code/delete",{folderName:s})}function dft(s){return bl("GET",`/plan-code/detail?folderName=${encodeURIComponent(s)}`)}function TD(s,e){return bl("POST","/plan-code/save-meta",{folderName:s,meta:e})}function uft(s,e){return bl("POST","/plan-code/save-plan",{folderName:s,content:e})}function hft(s){return bl("GET",`/plan-code/read-plan?folderName=${encodeURIComponent(s)}`)}async function fft(s){return bl("GET",`/sys_config/get_config?key=${encodeURIComponent(s)}`)}async function gft(s,e){return bl("POST","/sys_config/set_config",{key:s,value:e})}const pft={name:"PlanCodeTest",components:{ResizableTextarea:cse},props:{visible:{type:Boolean,default:!1},planFilePath:{type:String,default:""},folderName:{type:String,default:""},modelName:{type:String,default:""}},emits:["update:visible","test-session-created"],data(){return{inputMessage:"",disabled:!1,stopping:!1,promptTokens:0,sessionId:"",sessionStatus:"idle",logItems:[],wsUnsubscribe:null}},watch:{visible(s){s?this.$nextTick(()=>this.loadSession()):this.cleanup()}},beforeDestroy(){this.cleanup()},methods:{getTodoStatusIcon:a7,formatInput:l7,renderMarkdown:ik,async loadSession(){var s;if(this.folderName)try{const t=((s=(await dft(this.folderName)).data)==null?void 0:s.meta)||{};t.testSessionId&&(this.sessionId=t.testSessionId,await this.loadMessages(),this.subscribeSession())}catch(e){console.error("TestDialog loadSession failed:",e)}},async ensureSession(){if(this.sessionId)return this.sessionId;const s=await fB(this.folderName||"test");return this.sessionId=s.data.id,this.$emit("test-session-created",this.sessionId),this.sessionId},fillTestCommand(){this.planFilePath&&(this.inputMessage=`根据 ${this.planFilePath} 方案检查相应功能是否完成。`)},handleKeydown(s){if(s.ctrlKey){const e=s.target,t=e.selectionStart,i=e.selectionEnd;this.inputMessage=this.inputMessage.substring(0,t)+`
|
|
952
952
|
`+this.inputMessage.substring(i),this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+1})}else s.preventDefault(),!this.disabled&&this.inputMessage.trim()&&this.sendMessage()},async sendMessage(){const s=this.inputMessage.trim();if(!(!s||this.disabled)){try{await this.ensureSession()}catch{return}this.subscribeSession(),this.inputMessage="",this.disabled=!0,this.stopping=!1,this.logItems.push({type:"chat",content:s}),this.scrollToBottom(),Ks.send("chat",{message:s,sessionId:this.sessionId,modelName:this.modelName||void 0})}},stopChat(){!this.sessionId||this.stopping||(this.stopping=!0,Ks.send("stop",{sessionId:this.sessionId}))},subscribeSession(){this.sessionId&&(this.wsUnsubscribe&&this.wsUnsubscribe(),this.wsUnsubscribe=Ks.subscribe(this.sessionId,{todos:s=>{s!=null&&s.todos&&this.logItems.push({type:"todos",todos:s.todos}),this.scrollToBottom()},step:s=>{var e;this.logItems.push(rJ(s)),(e=s==null?void 0:s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),this.scrollToBottom()},compact:()=>{this.loadMessages()},done:s=>{var e;s!=null&&s.sessionId&&this.sessionId&&s.sessionId!==this.sessionId||(this.disabled=!1,this.stopping=!1,this.sessionStatus="completed",s!=null&&s.modelName&&this.$emit("update:modelName",s.modelName),(e=s==null?void 0:s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),s!=null&&s.response&&this.logItems.push(VF(s.response)),this.scrollToBottom())},stopped:()=>{this.disabled=!1,this.stopping=!1,this.sessionStatus="idle",this.logItems.push(VF("【已停止】")),this.scrollToBottom()},error:s=>{this.$message.error((s==null?void 0:s.error)||"发生错误"),this.disabled=!1,this.stopping=!1,this.sessionStatus="idle"}}))},async loadMessages(){if(this.sessionId)try{const s=await dse(this.sessionId);this.logItems=(s.data||[]).map(e=>e.type==="think"?VF(e.content||""):e.type==="step"?rJ(e):e.type==="chat"&&e.mediaFiles?{type:"chat",content:e.content,mediaFiles:e.mediaFiles}:e),this.$nextTick(()=>this.scrollToBottom(!0))}catch(s){console.error("TestDialog loadMessages failed:",s)}},scrollToBottom(s=!1){const e=this.$refs.messagesContainer;e&&this.$nextTick(()=>{e.scrollTop=e.scrollHeight})},cleanup(){this.wsUnsubscribe&&(this.wsUnsubscribe(),this.wsUnsubscribe=null)},handleClose(){this.$emit("update:visible",!1)},handleVisibleChange(s){this.$emit("update:visible",s)}}};var mft=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{visible:e.visible,title:"测试验收",width:"900px",top:"3vh","close-on-click-modal":!1},on:{"update:visible":e.handleVisibleChange,close:e.handleClose}},[t("div",{ref:"messagesContainer",staticClass:"test-chat-messages"},[e.logItems.length?e._e():t("div",{staticClass:"empty-state"},[t("p",[e._v("输入测试要求进行验收")])]),e._l(e.logItems,function(i,n){return[i.type==="todos"?t("div",{key:n,staticClass:"todos-list"},e._l(i.todos,function(r,o){return t("div",{key:o,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[e._v(e._s(e.getTodoStatusIcon(r.status)))]),t("span",{staticClass:"todo-name"},[e._v(e._s(r.name))])])}),0):i.type==="chat"?t("div",{key:n,staticClass:"flex justify-end"},[t("div",{staticClass:"user-question"},[i.mediaFiles&&i.mediaFiles.length>0?t("div",{staticClass:"chat-images"},e._l(i.mediaFiles,function(r){return t("img",{key:r.filePath,staticClass:"chat-image-thumb",attrs:{src:r.url||r.dataUrl||r.filePath}})}),0):e._e(),t("div",[e._v(e._s(i.content))])])]):i.type==="think"?t("div",{key:n,staticClass:"ai-thought",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="system"?t("div",{key:n,staticClass:"system-message",domProps:{innerHTML:e._s(e.renderMarkdown(i.content))}}):i.type==="step"?[i.thought?t("div",{staticClass:"ai-thought",domProps:{innerHTML:e._s(e.renderMarkdown(i.thought))}}):e._e(),e._l(i.toolCalls,function(r,o){return t("div",{key:o,staticClass:"log-mute"},[t("span",{class:i.success!==!1?"tool-success":"tool-fail"},[e._v(" "+e._s(i.success!==!1?"✓":"✗")+" ")]),e._v(" "+e._s(r.function.name)+" "),r.function.arguments?t("span",{staticClass:"tool-input"},[e._v(e._s(e.formatInput(r.function.name,r.function.arguments)))]):e._e()])})]:e._e()]}),e.modelName?t("div",{staticClass:"build-info"},[t("span",{staticClass:"icon"},[e._v("▣")]),e._v(" Build · "+e._s(e.modelName)+" ")]):e._e()],2),t("div",{staticClass:"test-input-block"},[t("div",{staticClass:"test-input-wrapper"},[t("ResizableTextarea",{staticClass:"test-input-area",attrs:{rows:4,placeholder:"输入测试要求... (Enter 发送, Ctrl+Enter 换行)",disabled:e.disabled&&!e.stopping},nativeOn:{keydown:function(i){return!i.type.indexOf("key")&&e._k(i.keyCode,"enter",13,i.key,"Enter")?null:e.handleKeydown.apply(null,arguments)}},model:{value:e.inputMessage,callback:function(i){e.inputMessage=i},expression:"inputMessage"}}),t("div",{staticClass:"test-input-actions"},[t("span",{class:e.disabled?"status-thinking":"status-ready"},[e.disabled?t("span",{staticClass:"thinking-spinner"}):e._e(),e._v(" "+e._s(e.disabled?"思考中":"✓ 就绪")+" ")]),t("span",{staticClass:"sep"},[e._v("|")]),t("span",[e._v("会话: "+e._s(e.sessionId?e.sessionId.slice(0,8):"未创建"))]),t("span",{staticClass:"sep"},[e._v("|")]),t("span",[e._v("token: "+e._s(e.promptTokens||0))]),t("div",{staticClass:"actions-spacer"}),t("button",{staticClass:"action-btn btn-test",attrs:{disabled:e.disabled},on:{click:e.fillTestCommand}},[e._v("方案测试")]),e.disabled&&!e.stopping?t("button",{staticClass:"action-btn btn-stop",on:{click:e.stopChat}},[e._v("■ 停止")]):e.stopping?t("button",{staticClass:"action-btn btn-stop",attrs:{disabled:""}},[e._v("停止中...")]):t("button",{staticClass:"action-btn btn-send",attrs:{disabled:!e.inputMessage.trim()},on:{click:e.sendMessage}},[e._v("发送")])])],1)])])},_ft=[],vft=Li(pft,mft,_ft,!1,null,"ac58f9ff");const bft=vft.exports,Cft={name:"GitChangesSidebar",props:{changes:{type:Array,default:()=>[]},selectedPath:{type:String,default:null},isRepo:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},width:{type:Number,default:320}},methods:{getStatusClass(s){return{modified:"bg-blue-600 text-white",added:"bg-green-600 text-white",deleted:"bg-red-600 text-white",untracked:"bg-gray-600 text-white",renamed:"bg-purple-600 text-white"}[s]||"bg-gray-600 text-white"},getFileName(s){return s.split("/").pop()||s.split("\\").pop()||s},getDirPath(s){const e=s.split("/");return e.pop(),e.join("/")||"."}}};var yft=function(){var e=this,t=e._self._c;return t("aside",{staticClass:"bg-sidebar border-r border-border flex flex-col shrink-0",style:{width:e.width+"px"}},[t("div",{staticClass:"flex border-b border-border text-xs uppercase font-bold text-textMuted"},[e._m(0),t("button",{staticClass:"ml-auto px-3 py-2 hover:text-white text-textMuted",attrs:{title:"刷新"},on:{click:function(i){return e.$emit("refresh")}}},[t("i",{staticClass:"fa-solid fa-refresh"})]),t("button",{staticClass:"px-3 py-2 hover:text-yellow-400 text-textMuted disabled:opacity-30",attrs:{disabled:e.changes.length===0,title:"撤销全部"},on:{click:function(i){return e.$emit("revert-all")}}},[t("i",{staticClass:"fa-solid fa-undo-alt"})])]),t("div",{staticClass:"flex-1 overflow-y-auto py-1 sidebar-scroll"},[e.loading?t("div",{staticClass:"flex items-center justify-center py-8 text-textMuted"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e.isRepo?e.changes.length===0?t("div",{staticClass:"flex items-center justify-center py-8 text-textMuted text-sm"},[e._m(2)]):t("div",e._l(e.changes,function(i){return t("div",{key:i.path,staticClass:"px-3 py-2 cursor-pointer border-b border-border/50 hover:bg-hoverBg transition-colors",class:e.selectedPath===i.path?"bg-hoverBg border-l-2 border-l-accent":"",on:{click:function(n){return e.$emit("select",i)}}},[t("div",{staticClass:"flex items-center gap-2"},[t("span",{staticClass:"text-xs font-bold px-1.5 py-0.5 rounded shrink-0",class:e.getStatusClass(i.status)},[e._v(" "+e._s(i.statusCode)+" ")]),t("div",{staticClass:"flex-1 min-w-0"},[t("div",{staticClass:"text-sm text-textMain truncate",attrs:{title:i.path}},[e._v(" "+e._s(e.getFileName(i.path))+" ")]),t("div",{staticClass:"text-xs text-textMuted truncate",attrs:{title:i.path}},[e._v(" "+e._s(e.getDirPath(i.path))+" ")])]),t("div",{staticClass:"flex items-center gap-1 shrink-0",on:{click:function(n){n.stopPropagation()}}},[t("button",{staticClass:"p-1 text-textMuted hover:text-blue-400 transition-colors",attrs:{title:"打开"},on:{click:function(n){return e.$emit("open-file",i)}}},[t("i",{staticClass:"fa-solid fa-external-link-alt text-xs"})]),t("button",{staticClass:"p-1 text-textMuted hover:text-yellow-400 transition-colors",attrs:{title:"撤销"},on:{click:function(n){return e.$emit("revert",i)}}},[t("i",{staticClass:"fa-solid fa-undo text-xs"})])])])])}),0):t("div",{staticClass:"flex items-center justify-center py-8 text-textMuted text-sm"},[e._m(1)])]),t("div",{staticClass:"border-t border-border px-3 py-2 text-xs text-textMuted"},[t("span",[e._v(e._s(e.changes.length)+" 个文件变更")])])])},wft=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"px-4 py-2 border-b-2 border-accent text-white flex items-center gap-2"},[e("i",{staticClass:"fa-brands fa-git-alt"}),s._v(" Git Changes ")])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"text-center"},[e("i",{staticClass:"fa-brands fa-git-alt text-4xl mb-4 opacity-30"}),e("p",[s._v("当前目录不是 Git 仓库")])])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"text-center"},[e("i",{staticClass:"fa-solid fa-check-circle text-4xl mb-4 opacity-30 text-green-500"}),e("p",[s._v("没有待提交的变更")])])}],Sft=Li(Cft,yft,wft,!1,null,"809cca3f");const xft=Sft.exports,kft={name:"DiffViewer",props:{change:{type:Object,default:null},diffContent:{type:String,default:""},loading:{type:Boolean,default:!1}},data(){return{oldLines:[],newLines:[]}},watch:{diffContent:{immediate:!0,handler(s){this.parseDiff(s)}}},methods:{getStatusClass(s){return{modified:"bg-blue-600 text-white",added:"bg-green-600 text-white",deleted:"bg-red-600 text-white",untracked:"bg-gray-600 text-white",renamed:"bg-purple-600 text-white"}[s]||"bg-gray-600 text-white"},getLinePrefix(s){return s.removed?"-":s.added?"+":" "},getLineClass(s){return s.type==="header"?"bg-inputBg text-blue-400":s.removed?"bg-red-900/50 text-red-300":s.added?"bg-green-900/50 text-green-300":s.empty?"bg-hoverBg":"text-textMain"},parseDiff(s){if(this.oldLines=[],this.newLines=[],!s)return;const e=s.split(`
|
|
@@ -956,4 +956,4 @@ Please report this to https://github.com/markedjs/marked.`,s){let i="<p>An error
|
|
|
956
956
|
|
|
957
957
|
这个是对这个方案的探讨 你只需要回答用户的问题即可 不需要修改方案 也不要修改代码
|
|
958
958
|
|
|
959
|
-
用户输入: ${e}`,sessionId:s.sessionId,modelName:s.modelName,agent:"discuss",mediaFiles:i.map(n=>({filePath:n.filePath,type:n.type}))}),s.mediaFiles=[]},stopDiscussPanel(){!this.discussPanel.sessionId||this.discussPanel.stopping||(this.discussPanel.stopping=!0,Ks.send("stop",{sessionId:this.discussPanel.sessionId}))},async renameDiscuss(s,e){const t={...this.currentPlanSession.meta},i=t.discussSessions.findIndex(n=>n.id===s.id);i>-1&&(t.discussSessions[i].title=e,t.updatedAt=new Date().toISOString(),await TD(this.planFolderName,t),this.currentPlanSession.meta=t,this.currentDiscuss&&this.currentDiscuss.id===s.id&&(this.currentDiscuss.title=e))},async deleteDiscuss(s){const e={...this.currentPlanSession.meta};if(e.discussSessions=e.discussSessions.filter(t=>t.id!==s.id),e.updatedAt=new Date().toISOString(),s.sessionId)try{await oft(s.sessionId)}catch{}await TD(this.planFolderName,e),this.currentPlanSession.meta=e,this.currentDiscuss&&this.currentDiscuss.id===s.id&&(this.discussPanel.wsUnsubscribe&&(this.discussPanel.wsUnsubscribe(),this.discussPanel.wsUnsubscribe=null),this.currentDiscuss=null,this.discussPanel=this.createPanel(),e.discussSessions.length&&await this.switchDiscuss(e.discussSessions[0]))},pushLogItem(s,e){s.logItems.push(this.withLogId(e));const t=this.$options.MAX_LOG_ITEMS;s.logItems.length>t&&s.logItems.splice(0,s.logItems.length-t)},stopThinking(s){s.disabled=!1,s.stopping=!1,s.sessionStatus="idle"},scrollCodeToBottom(s=!1){const e=this.$refs.chatPanel;e&&e.scrollToBottom(s)},scrollAfterUpdate(s){s==="code"?this.scrollCodeToBottom():s==="design"?this.$refs.planAssistant&&this.$refs.planAssistant.scrollDesignToBottom():s==="discuss"&&this.$refs.planAssistant&&this.$refs.planAssistant.scrollDiscussToBottom()},subscribePanel(s,e){s.sessionId&&(s.wsUnsubscribe&&s.wsUnsubscribe(),s.wsUnsubscribe=Ks.subscribe(s.sessionId,{todos:t=>{this.pushLogItem(s,{type:"todos",todos:t.todos}),this.scrollAfterUpdate(e)},step:t=>{var i;this.pushLogItem(s,this.createStepItem(t)),(i=t==null?void 0:t.usage)!=null&&i.promptTokens&&(s.promptTokens=t.usage.promptTokens),this.scrollAfterUpdate(e)},compact:()=>{e==="code"&&this.loadMessages(s,s.sessionId)},done:t=>{var i;t!=null&&t.sessionId&&s.sessionId&&t.sessionId!==s.sessionId||(this.stopThinking(s),s.sessionStatus="completed",t!=null&&t.modelName&&(s.modelName=t.modelName),(i=t==null?void 0:t.usage)!=null&&i.promptTokens&&(s.promptTokens=t.usage.promptTokens),t!=null&&t.response&&(this.pushLogItem(s,this.createThinkItem(t.response)),this.scrollAfterUpdate(e)),e==="design"&&this.loadPlanContent())},stopped:()=>{this.stopThinking(s),this.pushLogItem(s,this.createThinkItem("【已停止】")),this.scrollAfterUpdate(e)},error:t=>{this.$message.error((t==null?void 0:t.error)||"发生错误"),this.stopThinking(s)},running_sessions:t=>{const i=t.runningSessionIds||[];s.sessionId&&i.includes(s.sessionId)?(s.disabled=!0,s.sessionStatus="processing"):s.stopping||(s.disabled=!1,s.sessionStatus="idle")}}))},async loadMessages(s,e){try{const t=await dse(e);s.logItems=(t.data||[]).map(i=>i.type==="think"?this.withLogId(this.createThinkItem(i.content||"")):i.type==="step"?this.withLogId(this.createStepItem(i)):i.type==="chat"&&i.mediaFiles?this.withLogId({type:"chat",content:i.content,mediaFiles:i.mediaFiles}):this.withLogId(i))}catch{s.logItems=[]}},unsubscribeAll(){[this.codePanel,this.designPanel,this.discussPanel].forEach(s=>{s.sessionStatus!=="running"&&s.wsUnsubscribe&&(s.wsUnsubscribe(),s.wsUnsubscribe=null)})},resubscribeActive(){this.codePanel.sessionId&&this.codePanel.sessionStatus!=="running"&&this.subscribePanel(this.codePanel,"code"),this.designPanel.sessionId&&this.designPanel.sessionStatus!=="running"&&this.subscribePanel(this.designPanel,"design"),this.discussPanel.sessionId&&this.discussPanel.sessionStatus!=="running"&&this.subscribePanel(this.discussPanel,"discuss")},subscribeRunningSessions(){this.unsubRunning||(this.unsubRunning=Ks.on("running_sessions",s=>{var t;const e=((t=s.data)==null?void 0:t.runningSessionIds)||[];this.runningSessionIds=e,this.updateTaskStatus(e)}))},unsubscribeRunning(){this.unsubRunning&&(this.unsubRunning(),this.unsubRunning=null)},_unsubRename(){this._renameUnsub&&(this._renameUnsub(),this._renameUnsub=null)},_subRename(){this._unsubRename(),this._renameUnsub=Ks.on("rename",s=>{const e=s.data||s;if(!e.folderName||!e.sessionName)return;const t=this.planSessions.find(i=>i.folderName===e.folderName);t&&this.renamePlanSession(t,e.sessionName)})},updateTaskStatus(s){var i,n,r;const e=[this.codePanel.sessionId,this.designPanel.sessionId,(i=this.currentDiscuss)==null?void 0:i.sessionId,(r=(n=this.currentPlanSession)==null?void 0:n.meta)==null?void 0:r.testSessionId].filter(Boolean);if(e.length===0){this.taskStatus="idle";return}e.some(o=>s.includes(o))?this.taskStatus="running":this.taskStatus==="running"&&(this.taskStatus="idle")},updateTitle(){const s=this.taskStatus==="running"?"⏳ ":"";document.title=`${s}TXCode`},getStoreKey(s){return`txcode:plan-code:${s}:state`},loadState(s){if(!s)return null;try{const e=localStorage.getItem(this.getStoreKey(s));return e?JSON.parse(e):null}catch{return null}},saveState(){if(!this.planFolderName)return;const s=this.getStoreKey(this.planFolderName),e=this.loadState(this.planFolderName)||{};e.currentMode=this.currentMode,localStorage.setItem(s,JSON.stringify(e))},saveCodeScrollTop(){if(!this.planFolderName)return;const s=this.getStoreKey(this.planFolderName),e=this.loadState(this.planFolderName)||{},t=this.$refs.chatPanel;e.codeScrollTop=t?t.getScrollTop():0,localStorage.setItem(s,JSON.stringify(e))},restoreCodeScrollTop(){if(!this.planFolderName)return;const s=this.loadState(this.planFolderName);s&&s.codeScrollTop!=null&&this.$nextTick(()=>{const e=this.$refs.chatPanel;e&&e.setScrollTop(s.codeScrollTop)})},openModelSelector(s){this.modelSelectTarget=s,this.modelSelectVisible=!0},onModelSelected(s){const e=s.name.split("/").length>2?s.name.split("/").slice(1).join("/"):s.name;this.codePanel.modelName=e,this.designPanel.modelName=e,this.discussPanel.modelName=e,gft("defaultModel",e)},async loadDefaultModel(){var s;try{const e=await fft("defaultModel");(s=e.data)!=null&&s.value&&(this.codePanel.modelName=e.data.value,this.designPanel.modelName=e.data.value,this.discussPanel.modelName=e.data.value)}catch{}},handleStatusAction(s){switch(s){case"open-model":this.openModelSelector("code");break;case"open-command":this.commandDialogVisible=!0;break;case"open-file":this.fileSelectVisible=!0;break;case"open-skill":this.skillSelectVisible=!0;break;case"open-design":this.designSelectVisible=!0;break}},onFileSelected(s){this.codePanel.input=this.codePanel.input+s+" ",this.fileSelectVisible=!1},onSkillSelected(s){this.codePanel.input="[Skill:"+s+"] "+this.codePanel.input,this.skillSelectVisible=!1},openImagePreview(s){this.previewImage=s},closeImagePreview(){this.previewImage=null},onDesignSelected(s){const e=`[设计:${s.name}](${s.path}) `;this.codePanel.input+=e,this.designSelectVisible=!1},handleExecuteCommand(s){this.codePanel.input=s+" ",this.$nextTick(()=>{const e=this.$el.querySelector(".code-input-area textarea");e&&e.focus()})},async loadCustomActions(){try{const{request:s}=await rt(async()=>{const{request:t}=await Promise.resolve().then(()=>sft);return{request:t}},void 0),e=await s("GET","/custom_action/list_custom_action?type=code");this.customActions=e.data||[]}catch(s){console.error("Load custom actions failed:",s)}},executeCustomAction(s){this.codePanel.input=s.prompt,this.$nextTick(()=>{const e=this.$el.querySelector(".code-input-area textarea");e&&e.focus(),s.auto_send&&this.sendToCodePanel()})},handleCreateSubScheme(){this.subSchemeVisible=!0},async onSubSchemeConfirm(){try{const s=this.planFilePath;await $pe("新计划会话",s),await this.loadPlanSessions();const e=this.planSessions[0];e&&await this.selectPlanSession(e),this.subSchemeVisible=!1}catch(s){this.$message.error("创建子方案失败: "+s.message)}},handleExport(){if(!this.planFilePath){this.$message.warning("请先选择方案");return}const s=this.planFilePath.split("/").pop()||"方案.md",e=`/api/file/download_file?path=${encodeURIComponent(this.planFilePath)}`,t=document.createElement("a");t.href=e,t.download=s,document.body.appendChild(t),t.click(),document.body.removeChild(t)},onTestSessionCreated(s){this.testSessionId=s;const e={...this.currentPlanSession.meta,testSessionId:s};TD(this.planFolderName,e),this.currentPlanSession.meta=e},onResizeStart(s){const e=s.clientX,t=this.resizeWidth,i=r=>{this.resizeWidth=Math.max(280,Math.min(700,t+(e-r.clientX)))},n=()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",n),document.body.style.cursor="",document.body.style.userSelect="",this.$refs.planEditor&&this.$refs.planEditor.layout()};document.addEventListener("mousemove",i),document.addEventListener("mouseup",n),document.body.style.cursor="col-resize",document.body.style.userSelect="none"}}};var fgt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"app-container"},[t("PlanSessionSidebar",{attrs:{sessions:e.planSessions,"current-folder-name":e.currentPlanSession?e.currentPlanSession.folderName:"","running-session-ids":e.runningSessionIds},on:{create:e.createPlanSession,select:e.selectPlanSession,rename:e.renamePlanSession,delete:e.deletePlanSession}}),t("div",{staticClass:"main-area"},[t("div",{staticClass:"mode-float"},[t("button",{staticClass:"mode-tab",class:{active:e.currentMode==="plan"},on:{click:function(i){return e.switchMode("plan")}}},[e._v("方案模式")]),t("button",{staticClass:"mode-tab",class:{active:e.currentMode==="code"},on:{click:function(i){return e.switchMode("code")}}},[e._v("编码模式")])]),e.currentPlanSession?t("div",{staticClass:"content-area"},[t("ChatPanel",{ref:"chatPanel",attrs:{visible:e.currentMode==="code",panel:e.codePanel,"session-name":e.currentPlanSession.meta.sessionName||e.currentPlanSession.folderName,"plan-file-path":e.planFilePath,"custom-actions":e.customActions,"status-actions":e.statusActions,"hide-status-bar":!0,placeholder:"输入消息... (Enter 发送, Ctrl+Enter 换行, @ 选择文件)"},on:{send:e.sendToCodePanel,stop:e.stopCodePanel,"paste-image":i=>e._uploadFiles(i,e.codePanel),"files-selected":i=>e._uploadFiles(i,e.codePanel),"remove-media":i=>e.removeMedia(e.codePanel,i),"custom-action":e.executeCustomAction,"status-action":e.handleStatusAction,"fill-dev-plan":e.fillDevPlan,"open-git-changes":function(i){e.gitChangesDialogVisible=!0},"preview-image":e.openImagePreview,"open-model":function(i){return e.openModelSelector("code")},"open-test":function(i){e.testDialogVisible=!0}}}),t("PlanEditor",{ref:"planEditor",attrs:{visible:e.currentMode==="plan",content:e.planContent,"plan-file-path":e.planFilePath},on:{save:e.savePlanContent,refresh:e.loadPlanContent,export:e.handleExport,"create-sub-scheme":e.handleCreateSubScheme,"generate-code":e.fillDevPlan}}),t("div",{ref:"resizeHandleEl",staticClass:"resize-handle",class:{visible:e.currentMode==="plan"},on:{mousedown:e.onResizeStart}}),t("PlanAssistant",{ref:"planAssistant",attrs:{visible:e.currentMode==="plan",width:e.resizeWidth,"design-panel":e.designPanel,"discuss-panel":e.discussPanel,"discuss-sessions":e.discussSessions,"current-discuss":e.currentDiscuss,"plan-file-path":e.planFilePath},on:{sendDesign:e.sendDesignMessage,stopDesign:e.stopDesignPanel,sendDiscuss:e.sendDiscussMessage,stopDiscuss:e.stopDiscussPanel,switchDiscuss:e.switchDiscuss,createDiscuss:e.createDiscuss,renameDiscuss:e.renameDiscuss,deleteDiscuss:e.deleteDiscuss,openModel:function(i){return e.openModelSelector("design")}}})],1):t("div",{staticClass:"content-area empty-content"},[t("div",{staticClass:"chat-empty",staticStyle:{height:"100%"}},[t("span",{staticClass:"chat-empty-icon"},[e._v("📋")]),t("p",[e._v("选择或创建一个计划会话开始")]),t("button",{staticClass:"sidebar-new-btn",staticStyle:{"margin-top":"12px","font-size":"13px",padding:"6px 16px"},on:{click:e.createPlanSession}},[e._v("+ 新建会话")])])])]),t("ModelSelectDialog",{attrs:{visible:e.modelSelectVisible,"current-model":e.modelSelectTarget==="code"?e.codePanel.modelName:e.designPanel.modelName},on:{"update:visible":function(i){e.modelSelectVisible=i},select:e.onModelSelected}}),t("FileSelectDialog",{attrs:{visible:e.fileSelectVisible},on:{"update:visible":function(i){e.fileSelectVisible=i},select:e.onFileSelected,close:function(i){e.fileSelectVisible=!1}}}),t("SkillSelectDialog",{attrs:{visible:e.skillSelectVisible},on:{"update:visible":function(i){e.skillSelectVisible=i},select:e.onSkillSelected,close:function(i){e.skillSelectVisible=!1}}}),t("DesignSelectDialog",{attrs:{visible:e.designSelectVisible},on:{"update:visible":function(i){e.designSelectVisible=i},select:e.onDesignSelected,close:function(i){e.designSelectVisible=!1}}}),t("CommandDialog",{attrs:{visible:e.commandDialogVisible},on:{"update:visible":function(i){e.commandDialogVisible=i},execute:e.handleExecuteCommand}}),t("CreateSubPlanDialog",{attrs:{visible:e.subSchemeVisible},on:{"update:visible":function(i){e.subSchemeVisible=i},confirm:e.onSubSchemeConfirm,cancel:function(i){e.subSchemeVisible=!1}}}),e.previewImage?t("div",{staticClass:"image-lightbox",on:{click:e.closeImagePreview}},[t("span",{staticClass:"lightbox-close",on:{click:e.closeImagePreview}},[e._v("×")]),t("img",{staticClass:"lightbox-image",attrs:{src:e.previewImage.url||e.previewImage.dataUrl||e.previewImage.filePath},on:{click:function(i){i.stopPropagation()}}})]):e._e(),t("PlanCodeTest",{attrs:{visible:e.testDialogVisible,"plan-file-path":e.planFilePath,"folder-name":e.planFolderName,"model-name":e.codePanel.modelName},on:{"update:visible":function(i){e.testDialogVisible=i},"test-session-created":e.onTestSessionCreated}}),t("GitChangesDialog",{attrs:{visible:e.gitChangesDialogVisible},on:{"update:visible":function(i){e.gitChangesDialogVisible=i}}})],1)},ggt=[],pgt=Li(hgt,fgt,ggt,!1,null,"34e924f7");const zpe=pgt.exports,mgt={name:"ProviderList",props:{providers:{type:Array,default:()=>[]},models:{type:Array,default:()=>[]},songbingProvider:{type:Object,default:null}},emits:["add-provider","edit-provider","delete-provider","add-model","edit-model","delete-model","export-config","import-config","auth-songbing","sync-songbing-models","cancel-songbing-auth"],data(){return{expandedProviders:[]}},computed:{nonOfficialProviders(){return this.providers.filter(s=>s.name!=="自建AI平台")},songbingModels(){return this.songbingProvider?this.models.filter(s=>s.providerId===this.songbingProvider.id):[]},songbingBaseUrl(){var s;return((s=this.songbingProvider)==null?void 0:s.baseUrl)||""},songbingPlatformUrl(){return this.songbingBaseUrl.replace(/\/api\/v1$/,"")}},methods:{toggleProvider(s){const e=this.expandedProviders.indexOf(s);e>-1?this.expandedProviders.splice(e,1):this.expandedProviders.push(s)},getModelsByProvider(s){return this.models.filter(e=>e.providerId===s)}}};var _gt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"provider-list"},[t("div",{staticClass:"flex justify-between items-center mb-4"},[t("h3",{staticClass:"text-xl text-white"},[e._v("AI 服务商 & 模型")]),t("div",{staticClass:"flex gap-2"},[t("el-button",{attrs:{size:"small"},on:{click:function(i){return e.$emit("export-config")}}},[t("i",{staticClass:"fa-solid fa-download mr-1"}),e._v("导出配置 ")]),t("el-button",{attrs:{size:"small"},on:{click:function(i){return e.$emit("import-config")}}},[t("i",{staticClass:"fa-solid fa-upload mr-1"}),e._v("导入配置 ")]),t("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(i){return e.$emit("add-provider")}}},[e._v("+ 添加服务商")])],1)]),t("div",{staticClass:"providers"},[t("div",{staticClass:"provider-item official-provider"},[t("div",{staticClass:"provider-main",on:{click:function(i){return e.toggleProvider("songbing-official")}}},[t("span",{staticClass:"expand-icon",class:{expanded:e.expandedProviders.includes("songbing-official")}},[e._v("▶")]),t("div",{staticClass:"provider-logo official-logo"},[e._v("S")]),t("div",{staticClass:"provider-info"},[t("div",{staticClass:"provider-name"},[e._v(" 自建AI平台 "),e.songbingProvider?t("el-tag",{attrs:{type:"success",size:"mini"}},[e._v("已认证")]):e._e()],1),t("div",{staticClass:"provider-url"},[e._v(e._s(e.songbingPlatformUrl))])]),t("div",{staticClass:"provider-actions"},[t("el-button",{attrs:{type:"warning",size:"small"},on:{click:function(i){return i.stopPropagation(),e.$emit("auth-songbing")}}},[e._v(" "+e._s(e.songbingProvider?"重新认证":"认证")+" ")]),t("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(i){return i.stopPropagation(),e.$emit("sync-songbing-models")}}},[e._v(" 同步模型 ")]),e.songbingProvider?t("el-button",{attrs:{type:"danger",size:"small"},on:{click:function(i){return i.stopPropagation(),e.$emit("cancel-songbing-auth")}}},[e._v(" 取消认证 ")]):e._e()],1)]),t("div",{staticClass:"models-panel",class:{expanded:e.expandedProviders.includes("songbing-official")}},[e._l(e.songbingModels,function(i){return t("div",{key:i.id,staticClass:"model-item"},[t("span",{staticClass:"model-name"},[e._v(e._s(i.name))]),i.enabled?t("el-tag",{attrs:{type:"success",size:"mini"}},[e._v("启用")]):t("el-tag",{attrs:{type:"info",size:"mini"}},[e._v("禁用")])],1)}),e.songbingModels.length===0?t("div",{staticClass:"empty-models"},[e._v(" 暂无模型,请先认证后同步 ")]):e._e()],2)]),e._l(e.nonOfficialProviders,function(i){return t("div",{key:i.id,staticClass:"provider-item"},[t("div",{staticClass:"provider-main",on:{click:function(n){return e.toggleProvider(i.id)}}},[t("span",{staticClass:"expand-icon",class:{expanded:e.expandedProviders.includes(i.id)}},[e._v("▶")]),t("div",{staticClass:"provider-logo"},[e._v(e._s(i.name.charAt(0).toUpperCase()))]),t("div",{staticClass:"provider-info"},[t("div",{staticClass:"provider-name"},[e._v(" "+e._s(i.name)+" "),i.isDefault?t("el-tag",{attrs:{type:"success",size:"mini"}},[e._v("默认")]):e._e()],1),t("div",{staticClass:"provider-url"},[e._v(e._s(i.baseUrl))])]),t("div",{staticClass:"provider-actions"},[t("el-button",{attrs:{type:"text",size:"small"},on:{click:function(n){return n.stopPropagation(),e.$emit("edit-provider",i)}}},[e._v("修改")]),t("el-button",{staticClass:"delete-btn",attrs:{type:"text",size:"small"},on:{click:function(n){return n.stopPropagation(),e.$emit("delete-provider",i.id)}}},[e._v("删除")])],1)]),t("div",{staticClass:"models-panel",class:{expanded:e.expandedProviders.includes(i.id)}},[t("div",{staticClass:"models-header"},[t("span",{staticClass:"models-title"},[e._v("模型列表")]),t("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(n){return n.stopPropagation(),e.$emit("add-model",i.id)}}},[e._v("+ 添加模型")])],1),e._l(e.getModelsByProvider(i.id),function(n){return t("div",{key:n.id,staticClass:"model-item"},[t("span",{staticClass:"model-name"},[e._v(e._s(n.name))]),n.enabled?t("el-tag",{attrs:{type:"success",size:"mini"}},[e._v("启用")]):t("el-tag",{attrs:{type:"info",size:"mini"}},[e._v("禁用")]),t("div",{staticClass:"model-actions"},[t("el-button",{attrs:{type:"text",size:"small"},on:{click:function(r){return r.stopPropagation(),e.$emit("edit-model",n)}}},[e._v("修改")]),t("el-button",{staticClass:"delete-btn",attrs:{type:"text",size:"small"},on:{click:function(r){return r.stopPropagation(),e.$emit("delete-model",n.id)}}},[e._v("删除")])],1)],1)}),e.getModelsByProvider(i.id).length===0?t("div",{staticClass:"empty-models"},[e._v(" 暂无模型 ")]):e._e()],2)])}),e.nonOfficialProviders.length===0?t("div",{staticClass:"empty"},[e._v(" 暂无服务商 ")]):e._e()],2)])},vgt=[],bgt=Li(mgt,_gt,vgt,!1,null,"df73201c");const Cgt=bgt.exports,ygt={name:"ProviderDialog",props:{visible:{type:Boolean,default:!1},editingProvider:{type:Object,default:null}},data(){return{selectedPreset:"",originalApiKey:"",presets:[{name:"openai",label:"OpenAI",nameValue:"OpenAI",baseUrlValue:"https://api.openai.com/v1"},{name:"deepseek",label:"DeepSeek",nameValue:"DeepSeek",baseUrlValue:"https://api.deepseek.com/v1"},{name:"minimax",label:"MiniMax",nameValue:"MiniMax",baseUrlValue:"https://api.minimax.io/v1"},{name:"zlm",label:"ZLM",nameValue:"ZLM",baseUrlValue:"https://open.bigmodel.cn/api/paas/v4/"},{name:"qwen",label:"Qwen",nameValue:"Qwen",baseUrlValue:"https://dashscope-intl.aliyuncs.com/compatible-mode/v1"},{name:"xiaomi_mimo",label:"Xiaomi Mimo",nameValue:"Xiaomi Mimo",baseUrlValue:"https://api.xiaomimimo.com/v1"},{name:"openrouter",label:"OpenRouter",nameValue:"OpenRouter",baseUrlValue:"https://openrouter.ai/api/v1"},{name:"custom",label:"自定义",nameValue:"",baseUrlValue:""}],form:{name:"",apiKey:"",baseUrl:""},rules:{name:[{required:!0,message:"请输入名称",trigger:"blur"}],apiKey:[{required:!0,message:"请输入 API Key",trigger:"blur"}]}}},watch:{visible(s){s&&this.editingProvider?this.loadProviderDetail():s&&(this.selectedPreset="",this.originalApiKey="",this.form={name:"",apiKey:"",baseUrl:""})}},methods:{async loadProviderDetail(){var s;try{const e=await this.$api.getProvider(this.editingProvider.id);this.originalApiKey=((s=e.data)==null?void 0:s.apiKey)||"",this.form={name:this.editingProvider.name,apiKey:this.originalApiKey,baseUrl:this.editingProvider.baseUrl||""}}catch{this.form={name:this.editingProvider.name,apiKey:"",baseUrl:this.editingProvider.baseUrl||""}}},onPresetChange(s){const e=this.presets.find(t=>t.name===s);e&&(this.form.name=e.nameValue,this.form.baseUrl=e.baseUrlValue)},handleClose(){var s;(s=this.$refs.formRef)==null||s.resetFields(),this.selectedPreset="",this.originalApiKey="",this.$emit("update:visible",!1),this.$emit("close")},async handleSubmit(){try{await this.$refs.formRef.validate()}catch{return}try{if(this.editingProvider){const s={name:this.form.name,baseUrl:this.form.baseUrl};this.form.apiKey&&this.form.apiKey!==this.originalApiKey&&(s.apiKey=this.form.apiKey),await this.$api.updateProvider(this.editingProvider.id,s),this.$message.success("更新成功")}else await this.$api.addProvider(this.form),this.$message.success("添加成功");this.$emit("success"),this.handleClose()}catch(s){this.$message.error("保存失败: "+s.message)}}}};var wgt=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{title:e.editingProvider?"编辑服务商":"添加服务商",visible:e.visible,width:"500px"},on:{"update:visible":function(i){e.visible=i},close:e.handleClose}},[t("el-form",{ref:"formRef",attrs:{model:e.form,rules:e.rules,"label-width":"100px"}},[e.editingProvider?e._e():t("el-form-item",{attrs:{label:"预设模板"}},[t("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"选择预设或自定义"},on:{change:e.onPresetChange},model:{value:e.selectedPreset,callback:function(i){e.selectedPreset=i},expression:"selectedPreset"}},e._l(e.presets,function(i){return t("el-option",{key:i.name,attrs:{label:i.label,value:i.name}})}),1)],1),t("el-form-item",{attrs:{label:"名称",prop:"name"}},[t("el-input",{attrs:{placeholder:"例如: OpenAI"},model:{value:e.form.name,callback:function(i){e.$set(e.form,"name",i)},expression:"form.name"}})],1),t("el-form-item",{attrs:{label:"API Key",prop:"apiKey"}},[t("el-input",{attrs:{placeholder:e.editingProvider?"留空则不修改":"sk-..."},model:{value:e.form.apiKey,callback:function(i){e.$set(e.form,"apiKey",i)},expression:"form.apiKey"}}),e.editingProvider&&e.originalApiKey?t("div",{staticClass:"form-tip"},[e._v("当前已设置 API Key")]):e._e()],1),t("el-form-item",{attrs:{label:"Base URL",prop:"baseUrl"}},[t("el-input",{attrs:{placeholder:"https://api.openai.com/v1"},model:{value:e.form.baseUrl,callback:function(i){e.$set(e.form,"baseUrl",i)},expression:"form.baseUrl"}})],1)],1),t("span",{attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:e.handleClose}},[e._v("取消")]),t("el-button",{attrs:{type:"primary"},on:{click:e.handleSubmit}},[e._v("保存")])],1)],1)},Sgt=[],xgt=Li(ygt,wgt,Sgt,!1,null,"1529f1f1");const kgt=xgt.exports,Lgt={name:"ModelDialog",props:{visible:{type:Boolean,default:!1},editingModel:{type:Object,default:null},providers:{type:Array,default:()=>[]},defaultProviderId:{type:String,default:""}},data(){return{form:{providerId:"",name:"",enabled:!0},rules:{providerId:[{required:!0,message:"请选择服务商",trigger:"blur"}],name:[{required:!0,message:"请输入模型名称",trigger:"blur"}]}}},watch:{visible(s){s&&(this.editingModel?this.form={providerId:this.editingModel.providerId,name:this.editingModel.name,enabled:this.editingModel.enabled}:this.form={providerId:this.defaultProviderId||"",name:"",enabled:!0})}},methods:{handleClose(){var s;(s=this.$refs.formRef)==null||s.resetFields(),this.$emit("update:visible",!1),this.$emit("close")},async handleSubmit(){try{await this.$refs.formRef.validate()}catch{return}try{this.editingModel?(await this.$api.updateModel(this.editingModel.id,{name:this.form.name,enabled:this.form.enabled}),this.$message.success("更新成功")):(await this.$api.addModel(this.form),this.$message.success("添加成功")),this.$emit("success"),this.handleClose()}catch(s){this.$message.error("保存失败: "+s.message)}}}};var Dgt=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{title:e.editingModel?"编辑模型":"添加模型",visible:e.visible,width:"500px"},on:{"update:visible":function(i){e.visible=i},close:e.handleClose}},[t("el-form",{ref:"formRef",attrs:{model:e.form,rules:e.rules,"label-width":"100px"}},[e.editingModel?e._e():t("el-form-item",{attrs:{label:"所属服务商",prop:"providerId"}},[t("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"选择服务商"},model:{value:e.form.providerId,callback:function(i){e.$set(e.form,"providerId",i)},expression:"form.providerId"}},e._l(e.providers,function(i){return t("el-option",{key:i.id,attrs:{label:i.name,value:i.id}})}),1)],1),t("el-form-item",{attrs:{label:"模型名称",prop:"name"}},[t("el-input",{attrs:{placeholder:"例如: GPT-4"},model:{value:e.form.name,callback:function(i){e.$set(e.form,"name",i)},expression:"form.name"}})],1),t("el-form-item",{attrs:{label:"启用"}},[t("el-switch",{model:{value:e.form.enabled,callback:function(i){e.$set(e.form,"enabled",i)},expression:"form.enabled"}})],1)],1),t("span",{attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:e.handleClose}},[e._v("取消")]),t("el-button",{attrs:{type:"primary"},on:{click:e.handleSubmit}},[e._v("保存")])],1)],1)},Igt=[],Egt=Li(Lgt,Dgt,Igt,!1,null,"879e8810");const Tgt=Egt.exports,Ngt={name:"SkillsList",props:{skills:{type:Array,default:()=>[]}}};var Pgt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"skills-list"},[t("div",{staticClass:"list"},[e._l(e.skills,function(i){return t("div",{key:i.id||i.name,staticClass:"skill-item"},[t("div",{staticClass:"skill-info"},[t("div",{staticClass:"skill-name"},[e._v(e._s(i.name))]),t("div",{staticClass:"skill-desc"},[e._v(e._s(i.description||"暂无描述"))])]),t("el-tag",{attrs:{type:i.enabled?"success":"info",size:"mini"}},[e._v(" "+e._s(i.enabled?"启用":"禁用")+" ")])],1)}),e.skills.length===0?t("div",{staticClass:"empty"},[e._v(" 暂无技能 ")]):e._e()],2)])},Mgt=[],Rgt=Li(Ngt,Pgt,Mgt,!1,null,"8ff78b73");const Ogt=Rgt.exports,Agt={name:"Settings",components:{ProviderList:Cgt,ProviderDialog:kgt,ModelDialog:Tgt,SkillsList:Ogt},data(){return{activeTab:"providers",tabs:[{name:"providers",label:"AI 服务商",icon:"fa-solid fa-server"},{name:"advanced",label:"高级",icon:"fa-solid fa-gear"},{name:"proxy",label:"代理设置",icon:"fa-solid fa-globe"},{name:"gateway",label:"网关",icon:"fa-solid fa-plug"},{name:"email",label:"邮件配置",icon:"fa-solid fa-envelope"}],providers:[],models:[],skills:[],defaultProviderId:null,config:{maxToolIterations:10,maxSessionCompression:5,webPort:4e4},proxyConfig:{enabled:!1,type:"http",host:"",port:1080},gateway:{enabled:!1,clientId:"",clientSecret:""},gatewayStatus:{running:!1,configured:!1},gatewayLoading:!1,showProviderDialog:!1,editingProvider:null,showModelDialog:!1,editingModel:null,emailConfig:{host:"",port:587,secure:!1,user:"",password:"",fromName:""},emailStatus:{valid:null},emailLoading:!1,wafGateway:{serverIp:"",secretKey:""},wafStatus:{status:"stopped",configured:!1},wafGatewayLoading:!1,songbingConfig:{platformUrl:"",apiBaseUrl:""},songbingProvider:null,pollTimer:null,showAuthDialog:!1,authForm:{platformUrl:""},authLoading:!1}},created(){this.loadProviders(),this.loadModels(),this.loadSkills(),this.loadConfig(),this.loadProxyConfig(),this.loadGatewayConfig(),this.loadGatewayStatus(),this.loadSongbingConfig()},activated(){this.activeTab==="gateway"&&(this.loadGatewayConfig(),this.loadGatewayStatus())},watch:{activeTab(s){s==="gateway"?(this.loadGatewayConfig(),this.loadGatewayStatus(),this.loadWafConfig(),this.loadWafStatus()):s==="proxy"?this.loadProxyConfig():s==="email"&&this.loadEmailConfig()}},methods:{async loadProxyConfig(){try{const s=await this.$api.getProxyConfig();s.data&&(this.proxyConfig={enabled:s.data.enabled||!1,type:s.data.type||"http",host:s.data.host||"",port:s.data.port||1080})}catch{}},async saveProxyConfig(){try{await this.$api.updateProxyConfig(this.proxyConfig),this.$message.success("代理配置已保存")}catch(s){this.$message.error("保存失败: "+s.message)}},openProviderDialog(s){this.editingProvider=s,this.showProviderDialog=!0},openModelDialog(s,e){this.editingModel=e,this.showModelDialog=!0},async loadProviders(){try{const s=await this.$api.getProviders();this.providers=s.data||[];const e=this.providers.find(t=>t.isDefault);this.defaultProviderId=(e==null?void 0:e.id)||null,this.checkSongbingProvider()}catch(s){this.$message.error("加载提供商失败: "+s.message)}},async loadModels(){try{const s=await this.$api.getModels();this.models=s.data||[]}catch(s){this.$message.error("加载模型失败: "+s.message)}},async loadSkills(){try{const s=await this.$api.getSkills();this.skills=s.data||[]}catch{this.skills=[]}},async loadConfig(){var s;try{const e=await this.$api.getConfig("ai.maxToolIterations");(s=e.data)!=null&&s.value&&(this.config.maxToolIterations=parseInt(e.data.value))}catch{}},async deleteProvider(s){try{await this.$confirm("确定要删除该服务商吗?","提示",{type:"warning"}),await this.$api.deleteProvider(s),this.$message.success("删除成功"),await this.loadProviders()}catch(e){e!=="cancel"&&this.$message.error("删除失败: "+e.message)}},async deleteModel(s){try{await this.$confirm("确定要删除该模型吗?","提示",{type:"warning"}),await this.$api.deleteModel(s),this.$message.success("删除成功"),await this.loadModels()}catch(e){e!=="cancel"&&this.$message.error("删除失败: "+e.message)}},async saveConfig(s,e){try{await this.$api.setConfig(s,e),this.$message.success("配置已保存")}catch(t){this.$message.error("保存失败: "+t.message)}},async loadGatewayConfig(){try{const s=await this.$api.getDingtalkConfig();s.data&&(this.gateway={enabled:s.data.enabled||!1,clientId:s.data.clientId||"",clientSecret:s.data.clientSecret||""})}catch(s){console.error("Failed to load gateway config:",s)}},async loadGatewayStatus(){try{const s=await this.$api.getGatewayStatus();s.data&&(this.gatewayStatus={running:s.data.running||!1,configured:s.data.configured||!1})}catch(s){console.error("Failed to load gateway status:",s)}},async saveGatewayConfig(){try{await this.$api.updateDingtalkConfig(this.gateway),this.$message.success("网关配置已保存"),this.loadGatewayStatus()}catch(s){this.$message.error("保存失败: "+s.message)}},async toggleGateway(){this.gatewayLoading=!0;try{if(this.gatewayStatus.running)await this.$api.stopDingtalk(),this.$message.success("网关已停止");else{if(!this.gateway.clientId||!this.gateway.clientSecret){this.$message.error("请先配置 Client ID 和 Client Secret"),this.gatewayLoading=!1;return}await this.$api.updateDingtalkConfig(this.gateway),await this.$api.startDingtalk(),this.$message.success("网关已启动")}await this.loadGatewayStatus()}catch(s){this.$message.error("操作失败: "+s.message)}finally{this.gatewayLoading=!1}},async loadWafConfig(){try{const s=await this.$api.getWafConfig();s.data&&(this.wafGateway={serverIp:s.data.server_ip||"",secretKey:s.data.secret_key||""})}catch(s){console.error("Failed to load WAF config:",s)}},async loadWafStatus(){try{const s=await this.$api.getWafStatus();s.data&&(this.wafStatus={status:s.data.status||"stopped",configured:s.data.configured||!1})}catch(s){console.error("Failed to load WAF status:",s)}},async saveWafConfig(){try{await this.$api.updateWafConfig({server_ip:this.wafGateway.serverIp,secret_key:this.wafGateway.secretKey}),this.$message.success("WAF网关配置已保存"),this.loadWafStatus()}catch(s){this.$message.error("保存失败: "+s.message)}},async toggleWafGateway(){this.wafGatewayLoading=!0;try{if(this.wafStatus.status==="running")await this.$api.stopWaf(),this.$message.success("WAF网关已停止");else{if(!this.wafGateway.serverIp||!this.wafGateway.secretKey){this.$message.error("请先配置服务器IP和秘钥"),this.wafGatewayLoading=!1;return}await this.$api.updateWafConfig({server_ip:this.wafGateway.serverIp,secret_key:this.wafGateway.secretKey}),await this.$api.startWaf(),this.$message.success("WAF网关已启动")}await this.loadWafStatus()}catch(s){this.$message.error("操作失败: "+s.message)}finally{this.wafGatewayLoading=!1}},async loadEmailConfig(){try{const e=(await this.$api.getEmailConfigs()).data||[];if(e.length>0){const t=e[0];this.emailConfig={host:t.host||"",port:t.port||587,secure:!!t.secure,user:t.user||"",password:t.password||"",fromName:t.from_name||""},this.emailStatus.valid=null}else this.emailConfig={host:"",port:587,secure:!1,user:"",password:"",fromName:""},this.emailStatus.valid=null}catch(s){this.$message.error("加载邮件配置失败: "+s.message)}},async saveEmailConfig(){try{const e=((await this.$api.getEmailConfigs()).data||[])[0];e?await this.$api.updateEmailConfig(e.id,{host:this.emailConfig.host,port:this.emailConfig.port,secure:this.emailConfig.secure,user:this.emailConfig.user,password:this.emailConfig.password,from_name:this.emailConfig.fromName}):await this.$api.createEmailConfig({host:this.emailConfig.host,port:this.emailConfig.port,secure:this.emailConfig.secure,user:this.emailConfig.user,password:this.emailConfig.password,from_name:this.emailConfig.fromName,is_default:!0}),this.$message.success("配置已保存")}catch(s){this.$message.error("保存失败: "+s.message)}},async testEmailConfig(){try{const e=((await this.$api.getEmailConfigs()).data||[])[0];if(!e){this.$message.error("请先保存配置后再测试");return}this.emailLoading=!0;const t=await this.$api.validateEmailConfig(e.id);t.success?(this.$message.success("连接测试成功"),this.emailStatus.valid=!0):(this.$message.error("连接测试失败: "+t.error),this.emailStatus.valid=!1)}catch(s){this.$message.error("测试失败: "+s.message),this.emailStatus.valid=!1}finally{this.emailLoading=!1}},async handleExportConfig(){try{const s=await this.$api.exportConfig(),e=new Date,i=`config_${e.getFullYear().toString()+(e.getMonth()+1).toString().padStart(2,"0")+e.getDate().toString().padStart(2,"0")+"_"+e.getHours().toString().padStart(2,"0")+e.getMinutes().toString().padStart(2,"0")+e.getSeconds().toString().padStart(2,"0")}.yml`,n=window.URL.createObjectURL(s),r=document.createElement("a");r.href=n,r.download=i,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(n),this.$message.success("配置导出成功")}catch(s){this.$message.error("导出失败: "+s.message)}},handleImportConfig(){const s=document.createElement("input");s.type="file",s.accept=".yml,.yaml",s.onchange=async e=>{const t=e.target.files[0];if(t)try{const i=await t.text(),n=await this.$api.importConfig(i);n.success?(this.$message.success("配置导入成功"),await this.loadProviders(),await this.loadModels(),await this.loadGatewayConfig(),this.loadWafConfig(),this.loadEmailConfig()):this.$message.error("导入失败: "+n.error)}catch(i){this.$message.error("导入失败: "+i.message)}},s.click()},async loadSongbingConfig(){try{const s=await this.$api.getSongbingConfig();this.songbingConfig=s.data}catch(s){console.error("Failed to load songbing config:",s)}},checkSongbingProvider(){this.songbingProvider=this.providers.find(s=>s.name==="自建AI平台")||null},authSongbing(){this.authForm.platformUrl=this.songbingConfig.platformUrl,this.showAuthDialog=!0},async confirmAuthSongbing(){const{platformUrl:s}=this.authForm;if(!s){this.$message.error("请输入平台地址");return}if(!s.startsWith("http://")&&!s.startsWith("https://")){this.$message.error("平台地址必须以 http:// 或 https:// 开头");return}this.showAuthDialog=!1,this.authLoading=!0,this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null);try{const e=await this.$api.startSongbingAuth(s),{key:t,auth_url:i}=e.data;window.open(s+i,"_blank"),this.$message.info("请在打开的页面完成授权,认证中...");let n=0;this.pollTimer=setInterval(async()=>{var r;if(n++,n>=100){clearInterval(this.pollTimer),this.pollTimer=null,this.$message.warning("认证超时,请重试"),this.authLoading=!1;return}try{const o=await this.$api.verifySongbingAuth(t);(r=o.data)!=null&&r.active&&(clearInterval(this.pollTimer),this.pollTimer=null,this.$message.success(`自建AI平台 认证成功!已同步 ${o.data.syncedModels} 个模型`),await this.loadProviders(),await this.loadModels(),this.checkSongbingProvider(),this.authLoading=!1)}catch{}},3e3)}catch(e){this.$message.error("认证失败: "+e.message),this.authLoading=!1}},async cancelSongbingAuth(){try{await this.$confirm("确定要取消认证吗?取消后已同步的模型将被删除。","提示",{type:"warning"}),await this.$api.cancelSongbingAuth(),this.$message.success("已取消认证"),await this.loadProviders(),await this.loadModels(),this.songbingProvider=null}catch(s){s!=="cancel"&&this.$message.error("取消认证失败: "+s.message)}},async syncSongbingModels(){if(!this.songbingProvider){this.$message.warning("请先完成认证");return}try{const s=await this.$api.syncSongbingModels();this.$message.success(`同步成功,新增 ${s.data.count} 个模型`),await this.loadModels()}catch(s){this.$message.error("同步模型失败: "+s.message)}}},beforeDestroy(){this.pollTimer&&clearInterval(this.pollTimer)}};var Fgt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"flex-1 flex overflow-hidden bg-[#1e1e1e]"},[t("aside",{staticClass:"w-[220px] bg-sidebar border-r border-border shrink-0 py-4"},[t("h2",{staticClass:"text-white font-bold text-lg px-4 mb-4"},[e._v("设置")]),t("nav",{staticClass:"space-y-1"},e._l(e.tabs,function(i){return t("button",{key:i.name,staticClass:"w-full text-left px-4 py-2 text-sm flex items-center gap-2 transition-colors",class:e.activeTab===i.name?"bg-active text-white border-l-2 border-accent":"text-textMuted hover:text-white hover:bg-white/5 border-l-2 border-transparent",on:{click:function(n){e.activeTab=i.name}}},[t("i",{class:i.icon}),e._v(" "+e._s(i.label)+" ")])}),0)]),t("main",{staticClass:"flex-1 overflow-y-auto p-6"},[t("div",{staticClass:"max-w-3xl mx-auto"},[t("div",{directives:[{name:"show",rawName:"v-show",value:e.activeTab==="providers",expression:"activeTab === 'providers'"}]},[t("ProviderList",{attrs:{providers:e.providers,models:e.models,"songbing-provider":e.songbingProvider},on:{"add-provider":function(i){return e.openProviderDialog(null)},"edit-provider":function(i){return e.openProviderDialog(i)},"delete-provider":e.deleteProvider,"add-model":function(i){return e.openModelDialog(i,null)},"edit-model":function(i){return e.openModelDialog(i.providerId,i)},"delete-model":e.deleteModel,"export-config":e.handleExportConfig,"import-config":e.handleImportConfig,"auth-songbing":e.authSongbing,"sync-songbing-models":e.syncSongbingModels,"cancel-songbing-auth":e.cancelSongbingAuth}})],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.activeTab==="skills",expression:"activeTab === 'skills'"}]},[t("h3",{staticClass:"text-xl text-white mb-4"},[e._v("Skills")]),t("SkillsList",{attrs:{skills:e.skills}})],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.activeTab==="advanced",expression:"activeTab === 'advanced'"}]},[t("h3",{staticClass:"text-xl text-white mb-4"},[e._v("高级设置")]),t("el-form",{staticClass:"advanced-form",attrs:{"label-width":"150px"}},[t("el-form-item",{attrs:{label:"最大工具轮数"}},[t("el-input-number",{attrs:{min:1,max:100},on:{change:function(i){return e.saveConfig("maxToolIterations",i)}},model:{value:e.config.maxToolIterations,callback:function(i){e.$set(e.config,"maxToolIterations",i)},expression:"config.maxToolIterations"}})],1),t("el-form-item",{attrs:{label:"会话压缩阈值"}},[t("el-input-number",{attrs:{min:1,max:100},on:{change:function(i){return e.saveConfig("maxSessionCompression",i)}},model:{value:e.config.maxSessionCompression,callback:function(i){e.$set(e.config,"maxSessionCompression",i)},expression:"config.maxSessionCompression"}})],1),t("el-form-item",{attrs:{label:"Web 服务端口"}},[t("el-input-number",{attrs:{min:1024,max:65535},on:{change:function(i){return e.saveConfig("web.port",i)}},model:{value:e.config.webPort,callback:function(i){e.$set(e.config,"webPort",i)},expression:"config.webPort"}})],1)],1)],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.activeTab==="proxy",expression:"activeTab === 'proxy'"}]},[t("h3",{staticClass:"text-xl text-white mb-4"},[e._v("代理设置")]),t("el-form",{staticClass:"advanced-form",attrs:{"label-width":"150px"}},[t("el-form-item",{attrs:{label:"启用代理"}},[t("el-switch",{on:{change:e.saveProxyConfig},model:{value:e.proxyConfig.enabled,callback:function(i){e.$set(e.proxyConfig,"enabled",i)},expression:"proxyConfig.enabled"}})],1),t("el-form-item",{attrs:{label:"代理类型"}},[t("el-select",{attrs:{disabled:!e.proxyConfig.enabled},on:{change:e.saveProxyConfig},model:{value:e.proxyConfig.type,callback:function(i){e.$set(e.proxyConfig,"type",i)},expression:"proxyConfig.type"}},[t("el-option",{attrs:{label:"HTTP",value:"http"}}),t("el-option",{attrs:{label:"SOCKS5",value:"socks5"}})],1)],1),t("el-form-item",{attrs:{label:"代理IP"}},[t("el-input",{attrs:{disabled:!e.proxyConfig.enabled},on:{blur:e.saveProxyConfig},model:{value:e.proxyConfig.host,callback:function(i){e.$set(e.proxyConfig,"host",i)},expression:"proxyConfig.host"}})],1),t("el-form-item",{attrs:{label:"代理端口"}},[t("el-input-number",{attrs:{min:1,max:65535,disabled:!e.proxyConfig.enabled},on:{change:e.saveProxyConfig},model:{value:e.proxyConfig.port,callback:function(i){e.$set(e.proxyConfig,"port",i)},expression:"proxyConfig.port"}})],1)],1)],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.activeTab==="gateway",expression:"activeTab === 'gateway'"}]},[t("h3",{staticClass:"text-xl text-white mb-4"},[e._v("网关配置")]),t("el-form",{staticClass:"gateway-form",attrs:{"label-width":"150px"}},[t("el-form-item",{attrs:{label:"启用钉钉机器人"}},[t("el-switch",{on:{change:e.saveGatewayConfig},model:{value:e.gateway.enabled,callback:function(i){e.$set(e.gateway,"enabled",i)},expression:"gateway.enabled"}})],1),t("el-form-item",{attrs:{label:"Client ID"}},[t("el-input",{attrs:{placeholder:"请输入Client ID"},on:{blur:e.saveGatewayConfig},model:{value:e.gateway.clientId,callback:function(i){e.$set(e.gateway,"clientId",i)},expression:"gateway.clientId"}})],1),t("el-form-item",{attrs:{label:"Client Secret"}},[t("el-input",{attrs:{type:"password",placeholder:"请输入Client Secret"},on:{blur:e.saveGatewayConfig},model:{value:e.gateway.clientSecret,callback:function(i){e.$set(e.gateway,"clientSecret",i)},expression:"gateway.clientSecret"}})],1),t("el-form-item",{attrs:{label:"运行状态"}},[t("el-tag",{attrs:{type:e.gatewayStatus.running?"success":"info"}},[e._v(" "+e._s(e.gatewayStatus.running?"运行中":"已停止")+" ")]),e.gatewayStatus.configured&&!e.gatewayStatus.running?t("span",{staticClass:"text-textMuted text-sm ml-2"},[e._v(" (配置已保存,可启动) ")]):e._e()],1),t("el-form-item",[t("el-button",{attrs:{type:"primary",loading:e.gatewayLoading},on:{click:e.toggleGateway}},[e._v(" "+e._s(e.gatewayStatus.running?"停止":"启动")+" ")])],1)],1),t("h3",{staticClass:"text-xl text-white mb-4 mt-8"},[e._v("梓豪WAF网关配置")]),t("el-form",{staticClass:"gateway-form",attrs:{"label-width":"150px"}},[t("el-form-item",{attrs:{label:"服务器IP"}},[t("el-input",{attrs:{placeholder:"请输入服务器IP地址"},on:{blur:e.saveWafConfig},model:{value:e.wafGateway.serverIp,callback:function(i){e.$set(e.wafGateway,"serverIp",i)},expression:"wafGateway.serverIp"}})],1),t("el-form-item",{attrs:{label:"秘钥"}},[t("el-input",{attrs:{type:"password",placeholder:"请输入秘钥","show-password":""},on:{blur:e.saveWafConfig},model:{value:e.wafGateway.secretKey,callback:function(i){e.$set(e.wafGateway,"secretKey",i)},expression:"wafGateway.secretKey"}})],1),t("el-form-item",{attrs:{label:"运行状态"}},[t("div",{staticClass:"flex items-center gap-2"},[t("span",{staticClass:"w-2 h-2 rounded-full",class:e.wafStatus.status==="running"?"bg-green-500":"bg-gray-400"}),t("el-tag",{attrs:{type:e.wafStatus.status==="running"?"success":"info"}},[e._v(" "+e._s(e.wafStatus.status==="running"?"运行中":"已停止")+" ")])],1)]),t("el-form-item",[t("el-button",{attrs:{type:"primary",loading:e.wafGatewayLoading,disabled:!e.wafStatus.configured},on:{click:e.toggleWafGateway}},[e._v(" "+e._s(e.wafStatus.status==="running"?"停止":"启动")+" ")])],1)],1)],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.activeTab==="email",expression:"activeTab === 'email'"}]},[t("h3",{staticClass:"text-xl text-white mb-4"},[e._v("邮件配置")]),t("el-form",{staticClass:"gateway-form",attrs:{"label-width":"150px"}},[t("el-form-item",{attrs:{label:"SMTP 服务器"}},[t("el-input",{attrs:{placeholder:"smtp.example.com"},on:{blur:e.saveEmailConfig},model:{value:e.emailConfig.host,callback:function(i){e.$set(e.emailConfig,"host",i)},expression:"emailConfig.host"}})],1),t("el-form-item",{attrs:{label:"端口"}},[t("el-input-number",{attrs:{min:1,max:65535},on:{change:e.saveEmailConfig},model:{value:e.emailConfig.port,callback:function(i){e.$set(e.emailConfig,"port",i)},expression:"emailConfig.port"}})],1),t("el-form-item",{attrs:{label:"使用 SSL/TLS"}},[t("el-switch",{on:{change:e.saveEmailConfig},model:{value:e.emailConfig.secure,callback:function(i){e.$set(e.emailConfig,"secure",i)},expression:"emailConfig.secure"}})],1),t("el-form-item",{attrs:{label:"用户名"}},[t("el-input",{attrs:{placeholder:"邮箱地址"},on:{blur:e.saveEmailConfig},model:{value:e.emailConfig.user,callback:function(i){e.$set(e.emailConfig,"user",i)},expression:"emailConfig.user"}})],1),t("el-form-item",{attrs:{label:"密码/授权码"}},[t("el-input",{attrs:{type:"password",placeholder:"邮箱密码或授权码","show-password":""},on:{blur:e.saveEmailConfig},model:{value:e.emailConfig.password,callback:function(i){e.$set(e.emailConfig,"password",i)},expression:"emailConfig.password"}})],1),t("el-form-item",{attrs:{label:"发件人名称"}},[t("el-input",{attrs:{placeholder:"显示的发件人名称(可选)"},on:{blur:e.saveEmailConfig},model:{value:e.emailConfig.fromName,callback:function(i){e.$set(e.emailConfig,"fromName",i)},expression:"emailConfig.fromName"}})],1),t("el-form-item",{attrs:{label:"运行状态"}},[t("el-tag",{attrs:{type:e.emailStatus.valid?"success":"info"}},[e._v(" "+e._s(e.emailStatus.valid?"配置有效":e.emailStatus.valid===!1?"配置无效":"未配置")+" ")])],1),t("el-form-item",[t("el-button",{attrs:{type:"primary",loading:e.emailLoading},on:{click:e.testEmailConfig}},[e._v("测试连接")])],1)],1)],1)])]),t("ProviderDialog",{attrs:{visible:e.showProviderDialog,"editing-provider":e.editingProvider},on:{"update:visible":function(i){e.showProviderDialog=i},success:e.loadProviders}}),t("ModelDialog",{attrs:{visible:e.showModelDialog,"editing-model":e.editingModel,providers:e.providers,"default-provider-id":e.defaultProviderId},on:{"update:visible":function(i){e.showModelDialog=i},success:e.loadModels}}),t("el-dialog",{attrs:{title:"自建AI平台认证",visible:e.showAuthDialog,width:"500px","close-on-click-modal":!1},on:{"update:visible":function(i){e.showAuthDialog=i}}},[t("el-form",{attrs:{"label-width":"80px"}},[t("el-form-item",{attrs:{label:"平台地址"}},[t("el-input",{model:{value:e.authForm.platformUrl,callback:function(i){e.$set(e.authForm,"platformUrl",i)},expression:"authForm.platformUrl"}})],1),t("el-alert",{staticStyle:{"margin-top":"10px"},attrs:{title:"注意:填写您的自建AI平台服务地址",type:"info",closable:!1}})],1),t("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(i){e.showAuthDialog=!1}}},[e._v("取消")]),t("el-button",{attrs:{type:"primary",loading:e.authLoading},on:{click:e.confirmAuthSongbing}},[e._v("开始认证")])],1)],1)],1)},Bgt=[],Wgt=Li(Agt,Fgt,Bgt,!1,null,"c3903b2c");const uke=Wgt.exports,Vgt={name:"CopyPathDialog",data(){return{visible:!1,path:""}},methods:{open(s){this.path=s,this.visible=!0},handleClose(){this.path=""},handleCopy(){navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(this.path).then(()=>{this.$message.success("路径已复制")}).catch(()=>{this.$message.info("请手动 Ctrl+C 复制")}):this.$message.info("请手动 Ctrl+C 复制"),this.visible=!1}}};var Hgt=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{title:"文件路径",visible:e.visible,width:"500px","close-on-click-modal":!0},on:{"update:visible":function(i){e.visible=i},close:e.handleClose}},[t("div",{staticClass:"flex gap-2"},[t("el-input",{staticClass:"flex-1",attrs:{readonly:""},model:{value:e.path,callback:function(i){e.path=i},expression:"path"}}),t("el-button",{attrs:{type:"primary"},on:{click:e.handleCopy}},[e._v("复制")])],1)])},$gt=[],zgt=Li(Vgt,Hgt,$gt,!1,null,null);const jgt=zgt.exports,Ugt={name:"Files",components:{FileTreeNode:ake,CopyPathDialog:jgt},data(){return{browseResult:{current_path:"",parent_path:null,items:[]},selectedPath:"",selectedItem:null,fileContent:null,loading:!1,expandedPaths:new Set,openFiles:[],activeFile:null,fileLoading:!1,saving:!1,editor:null,originalContent:"",sidebarWidth:260,isResizing:!1,contextMenu:{visible:!1,x:0,y:0,target:null},inputDialog:{visible:!1,title:"",value:"",placeholder:"",type:"",target:null},fileIcons:{js:"fa-brands fa-js text-yellow-400",ts:"fa-brands fa-js text-blue-400",html:"fa-brands fa-html5 text-orange-500",css:"fa-brands fa-css3 text-blue-400",scss:"fa-brands fa-sass text-pink-400",json:"fa-solid fa-file-code text-yellow-300",yaml:"fa-solid fa-file-code text-blue-300",yml:"fa-solid fa-file-code text-blue-300",md:"fa-solid fa-file-lines text-gray-400",py:"fa-brands fa-python text-blue-500",vue:"fa-brands fa-vuejs text-green-400",sh:"fa-solid fa-terminal text-green-400",go:"fa-brands fa-golang text-cyan-400",rs:"fa-brands fa-rust text-orange-400"},uploadProgress:{visible:!1,percent:0,filename:"",cancelled:!1},downloadProgress:{visible:!1,percent:0,filename:"",cancelled:!1}}},computed:{fileTreeData(){return this.browseResult.items.map(e=>this.transformNode(e)).sort((e,t)=>e.is_directory===t.is_directory?e.name.localeCompare(t.name):e.is_directory?-1:1)},hasChanges(){return this.editor?this.editor.getValue()!==this.originalContent:!1},isBinaryFile(){var s;return(s=this.activeFile)==null?void 0:s.is_binary}},watch:{activeFile:{immediate:!0,handler(s){this.$nextTick(()=>{!this.editor&&this.$refs.editorContainer&&this.initEditor(),s&&this.editor?this.loadFileContent(s.path).then(e=>{const t=this.getLanguageFromFilename(s.name),i=Dg.createModel(e,t);this.editor.setModel(i),this.originalContent=e}):this.editor&&(this.editor.setModel(Dg.createModel("","plaintext")),this.originalContent="")})}}},async created(){await this.browse(""),document.addEventListener("click",this.hideContextMenu),document.addEventListener("mousemove",this.handleResize),document.addEventListener("mouseup",this.stopResize)},activated(){!this.editor&&this.$refs.editorContainer&&this.initEditor()},beforeDestroy(){document.removeEventListener("click",this.hideContextMenu),document.removeEventListener("mousemove",this.handleResize),document.removeEventListener("mouseup",this.stopResize),this.editor&&(this.editor.dispose(),this.editor=null)},methods:{async browse(s){this.loading=!0;try{const e=await jt.browseFilesystem(s);this.browseResult=e.data}catch(e){console.error("Browse failed:",e)}finally{this.loading=!1}},transformNode(s){return{name:s.name,path:s.path,is_directory:s.is_directory,is_drive:s.is_drive||!1,size:s.size,has_children:s.is_directory,expanded:!1,children:[]}},handleSelect(s){this.selectedPath=s.path,this.selectedItem=s},async openFile(s){var t;if(s.is_directory)return;const e=this.openFiles.find(i=>i.path===s.path);if(e){this.activeFile=e;return}this.fileLoading=!0;try{const i=await this.loadFileContent(s.path),n={name:s.name,path:s.path,is_binary:((t=this.fileContent)==null?void 0:t.is_binary)||!1};this.openFiles.push(n),this.activeFile=n}catch(i){console.error("Open file failed:",i)}finally{this.fileLoading=!1}},closeFile(s){var t;const e=this.openFiles.findIndex(i=>i.path===s.path);if(this.openFiles=this.openFiles.filter(i=>i.path!==s.path),((t=this.activeFile)==null?void 0:t.path)===s.path){const i=e>0?e-1:0;this.activeFile=this.openFiles.length>0?this.openFiles[Math.min(i,this.openFiles.length-1)]:null}},async saveFile(){if(!(!this.activeFile||!this.hasChanges)){this.saving=!0;try{const s=this.editor.getValue();await jt.writeFile(this.activeFile.path,s),this.originalContent=s,this.$message.success("文件已保存")}catch(s){console.error("Save file failed:",s),this.$message.error("保存文件失败")}finally{this.saving=!1}}},async handleLoadChildren({path:s,callback:e}){try{const n=((await jt.browseFilesystem(s)).data.items||[]).map(r=>this.transformNode(r)).sort((r,o)=>r.is_directory===o.is_directory?r.name.localeCompare(o.name):r.is_directory?-1:1);e(n)}catch(t){console.error("Load children failed:",t),e([])}},goUp(){this.browseResult.parent_path!==null&&this.browse(this.browseResult.parent_path===""?"":this.browseResult.parent_path)},goHome(){this.browse("")},refresh(){this.browse(this.browseResult.current_path||"")},async loadFileContent(s){var e;try{const t=await jt.getFileContent(s);return this.fileContent=t.data||{content:"加载失败",is_binary:!1,size:0},((e=t.data)==null?void 0:e.content)||""}catch(t){return console.error("Load file content failed:",t),this.fileContent={content:"加载失败",is_binary:!1,size:0},""}},startResize(s){this.isResizing=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},handleResize(s){if(!this.isResizing)return;const e=s.clientX;e>=150&&e<=500&&(this.sidebarWidth=e)},stopResize(){this.isResizing=!1,document.body.style.cursor="",document.body.style.userSelect=""},showContextMenu(s,e){e&&(s.preventDefault(),this.contextMenu={visible:!0,x:s.pageX,y:s.pageY,target:e},this.selectedItem=e,this.selectedPath=e.path)},hideContextMenu(){this.contextMenu.visible=!1},async createNewFile(){this.hideContextMenu(),this.inputDialog={visible:!0,title:"新建文件",value:"",placeholder:"输入文件名",type:"file",target:this.contextMenu.target},this.$nextTick(()=>{var s;(s=this.$refs.renameInput)==null||s.focus()})},async createNewFolder(){this.hideContextMenu(),this.inputDialog={visible:!0,title:"新建文件夹",value:"",placeholder:"输入文件夹名",type:"folder",target:this.contextMenu.target},this.$nextTick(()=>{var s;(s=this.$refs.renameInput)==null||s.focus()})},copyPath(){this.hideContextMenu(),this.$refs.copyPathDialog.open(this.contextMenu.target.path)},renameItem(){this.hideContextMenu(),this.inputDialog={visible:!0,title:"重命名",value:this.contextMenu.target.name,placeholder:"输入新名称",type:"rename",target:this.contextMenu.target},this.$nextTick(()=>{var s,e;(s=this.$refs.renameInput)==null||s.focus(),(e=this.$refs.renameInput)==null||e.select()})},async confirmInput(){const{type:s,value:e,target:t}=this.inputDialog;if(!e.trim()){this.cancelInput();return}try{const i=t.path.includes("\\")?"\\":"/";if(s==="file"){const n=t.path+i+e.trim();await jt.writeFile(n,"")}else if(s==="folder"){const n=t.path+i+e.trim();await jt.createDirectory(n)}else if(s==="rename"){const r=t.path.substring(0,t.path.lastIndexOf(i))+i+e.trim();await jt.renameFile(t.path,r)}this.refresh()}catch(i){console.error("Operation failed:",i),this.$message.error("操作失败")}this.inputDialog.visible=!1},cancelInput(){this.inputDialog.visible=!1},async deleteItem(){this.hideContextMenu();try{await this.$confirm(`确定要删除 "${this.contextMenu.target.name}" 吗?`,"确认删除",{confirmButtonText:"删除",cancelButtonText:"取消",type:"warning"}),await jt.deleteFile(this.contextMenu.target.path),this.$message.success("删除成功"),this.refresh()}catch(s){s!=="cancel"&&(console.error("Delete failed:",s),this.$message.error("删除失败"))}},triggerFileUpload(){var s;this.hideContextMenu(),(s=this.$refs.fileInput)==null||s.click()},handleFileSelect(s){var i,n;const e=(i=s.target.files)==null?void 0:i[0];if(!e)return;const t=(n=this.contextMenu.target)==null?void 0:n.path;t&&(this.uploadFile(e,t),s.target.value="")},uploadFile(s,e){this.uploadProgress={visible:!0,percent:0,filename:s.name,cancelled:!1},jt.uploadFilesystemWithProgress(e,s,t=>{this.uploadProgress.percent=t}).then(()=>{this.uploadProgress.visible=!1,this.$message.success("上传成功"),this.refresh()}).catch(t=>{this.uploadProgress.visible=!1,this.$message.error("上传失败: "+t.message)})},cancelUpload(){this.uploadProgress.cancelled=!0,this.uploadProgress.visible=!1},downloadFile(){this.hideContextMenu();const s=this.contextMenu.target;s&&(this.downloadProgress={visible:!0,percent:0,filename:s.name,cancelled:!1},jt.downloadFilesystemWithProgress(s.path,s.name,e=>{this.downloadProgress.percent=e}).then(()=>{this.downloadProgress.visible=!1}).catch(e=>{this.downloadProgress.visible=!1,this.$message.error("下载失败: "+e.message)}))},cancelDownload(){this.downloadProgress.cancelled=!0,this.downloadProgress.visible=!1},initEditor(){this.editor||this.$refs.editorContainer&&(this.editor=Dg.create(this.$refs.editorContainer,{value:"",language:"plaintext",theme:"vs-dark",automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:14,fontFamily:'Consolas, Monaco, "Courier New", monospace',lineNumbers:"on",roundedSelection:!1,scrollbar:{useShadows:!1,verticalHasArrows:!1,horizontalHasArrows:!1,vertical:"auto",horizontal:"auto"}}),this.editor.onDidChangeModelContent(()=>{this.$forceUpdate()}),this.editor.addCommand(ix.CtrlCmd|tx.KeyS,()=>{this.saveFile()}))},getFileIcon(s){const e=s.split(".").pop().toLowerCase(),t=s.toLowerCase();return t==="dockerfile"?"fa-brands fa-docker text-blue-400":t===".gitignore"?"fa-brands fa-git text-red-400":t.startsWith("readme")?this.fileIcons.md:this.fileIcons[e]||"fa-solid fa-file text-gray-400"},getLanguageFromFilename(s){const e=s.split(".").pop().toLowerCase();return{js:"javascript",ts:"typescript",html:"html",css:"css",scss:"scss",vue:"html",py:"python",md:"markdown",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",sql:"sql",sh:"shell",go:"go",rs:"rust"}[e]||"plaintext"}}};var qgt=function(){var i;var e=this,t=e._self._c;return t("div",{staticClass:"flex-1 flex overflow-hidden"},[t("aside",{staticClass:"bg-sidebar border-r border-border flex flex-col shrink-0",style:{width:e.sidebarWidth+"px"}},[e._m(0),t("div",{staticClass:"flex items-center gap-1 px-2 py-2 border-b border-border"},[t("button",{staticClass:"p-1 text-textMuted hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",attrs:{disabled:!e.browseResult.parent_path&&e.browseResult.parent_path!=="",title:"上级目录"},on:{click:e.goUp}},[t("i",{staticClass:"fa-solid fa-arrow-up"})]),t("button",{staticClass:"p-1 text-textMuted hover:text-white",attrs:{title:"刷新"},on:{click:e.refresh}},[t("i",{staticClass:"fa-solid fa-refresh"})]),t("button",{staticClass:"p-1 text-textMuted hover:text-white",attrs:{title:"我的电脑"},on:{click:e.goHome}},[t("i",{staticClass:"fa-solid fa-home"})])]),t("div",{staticClass:"flex-1 overflow-y-auto py-1 sidebar-scroll"},[e.loading?t("div",{staticClass:"flex items-center justify-center py-8 text-textMuted"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e.fileTreeData.length===0?t("div",{staticClass:"flex items-center justify-center py-8 text-textMuted text-sm"},[e._v(" 此目录为空 ")]):e._l(e.fileTreeData,function(n){return t("file-tree-node",{key:n.path,attrs:{node:n,level:0,"selected-path":e.selectedPath},on:{select:e.handleSelect,"open-file":e.openFile,"load-children":e.handleLoadChildren,contextmenu:e.showContextMenu}})})],2),t("div",{directives:[{name:"show",rawName:"v-show",value:e.contextMenu.visible,expression:"contextMenu.visible"}],staticClass:"fixed bg-sidebar border border-border rounded shadow-lg py-1 z-50 min-w-[160px]",style:{left:e.contextMenu.x+"px",top:e.contextMenu.y+"px"}},[(i=e.contextMenu.target)!=null&&i.is_directory?[t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.copyPath}},[t("i",{staticClass:"fa-solid fa-copy text-xs"}),e._v(" 复制路径 ")]),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.createNewFile}},[t("i",{staticClass:"fa-solid fa-file-lines text-xs"}),e._v(" 新建文件 ")]),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.createNewFolder}},[t("i",{staticClass:"fa-solid fa-folder-plus text-xs"}),e._v(" 新建文件夹 ")]),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.triggerFileUpload}},[t("i",{staticClass:"fa-solid fa-upload text-xs"}),e._v(" 上传文件 ")]),t("div",{staticClass:"border-t border-border my-1"}),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.renameItem}},[t("i",{staticClass:"fa-solid fa-pen text-xs"}),e._v(" 重命名 ")]),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-red-400 hover:bg-active flex items-center gap-2",on:{click:e.deleteItem}},[t("i",{staticClass:"fa-solid fa-trash text-xs"}),e._v(" 删除 ")])]:[t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.copyPath}},[t("i",{staticClass:"fa-solid fa-copy text-xs"}),e._v(" 复制路径 ")]),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.downloadFile}},[t("i",{staticClass:"fa-solid fa-download text-xs"}),e._v(" 下载 ")]),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.renameItem}},[t("i",{staticClass:"fa-solid fa-pen text-xs"}),e._v(" 重命名 ")]),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-red-400 hover:bg-active flex items-center gap-2",on:{click:e.deleteItem}},[t("i",{staticClass:"fa-solid fa-trash text-xs"}),e._v(" 删除 ")])]],2),t("div",{directives:[{name:"show",rawName:"v-show",value:e.inputDialog.visible,expression:"inputDialog.visible"}],staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",on:{click:function(n){return n.target!==n.currentTarget?null:e.cancelInput.apply(null,arguments)}}},[t("div",{staticClass:"bg-sidebar border border-border rounded p-4 w-80"},[t("p",{staticClass:"text-white text-sm mb-3"},[e._v(e._s(e.inputDialog.title))]),t("input",{directives:[{name:"model",rawName:"v-model",value:e.inputDialog.value,expression:"inputDialog.value"}],ref:"renameInput",staticClass:"w-full px-3 py-2 bg-contentBg border border-border rounded text-white text-sm focus:outline-none focus:border-accent",attrs:{placeholder:e.inputDialog.placeholder},domProps:{value:e.inputDialog.value},on:{keyup:[function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"enter",13,n.key,"Enter")?null:e.confirmInput.apply(null,arguments)},function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"escape",void 0,n.key,void 0)?null:e.cancelInput.apply(null,arguments)}],input:function(n){n.target.composing||e.$set(e.inputDialog,"value",n.target.value)}}}),t("div",{staticClass:"flex justify-end gap-2 mt-4"},[t("button",{staticClass:"px-3 py-1 text-xs text-textMuted hover:text-white",on:{click:e.cancelInput}},[e._v("取消")]),t("button",{staticClass:"px-3 py-1 text-xs bg-accent text-white rounded hover:bg-blue-600",on:{click:e.confirmInput}},[e._v("确定")])])])]),t("input",{ref:"fileInput",staticClass:"hidden",attrs:{type:"file"},on:{change:e.handleFileSelect}}),e.uploadProgress.visible?t("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50"},[t("div",{staticClass:"bg-sidebar border border-border rounded p-4 w-80"},[t("p",{staticClass:"text-white text-sm mb-3"},[e._v("正在上传 "+e._s(e.uploadProgress.filename))]),t("div",{staticClass:"w-full bg-contentBg rounded-full h-2"},[t("div",{staticClass:"bg-accent h-2 rounded-full transition-all",style:{width:e.uploadProgress.percent+"%"}})]),t("p",{staticClass:"text-textMuted text-xs mt-2 text-center"},[e._v(e._s(e.uploadProgress.percent)+"%")]),t("button",{staticClass:"w-full mt-4 py-2 text-xs text-textMuted hover:text-white border border-border rounded",on:{click:e.cancelUpload}},[e._v("取消")])])]):e._e(),e.downloadProgress.visible?t("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50"},[t("div",{staticClass:"bg-sidebar border border-border rounded p-4 w-80"},[t("p",{staticClass:"text-white text-sm mb-3"},[e._v("正在下载 "+e._s(e.downloadProgress.filename))]),t("div",{staticClass:"w-full bg-contentBg rounded-full h-2"},[t("div",{staticClass:"bg-accent h-2 rounded-full transition-all",style:{width:e.downloadProgress.percent+"%"}})]),t("p",{staticClass:"text-textMuted text-xs mt-2 text-center"},[e._v(e._s(e.downloadProgress.percent)+"%")]),t("button",{staticClass:"w-full mt-4 py-2 text-xs text-textMuted hover:text-white border border-border rounded",on:{click:e.cancelDownload}},[e._v("取消")])])]):e._e()]),t("div",{staticClass:"w-1 bg-border hover:bg-accent cursor-col-resize transition-colors",on:{mousedown:e.startResize}}),t("main",{staticClass:"flex-1 flex flex-col min-w-0 bg-contentBg"},[t("div",{staticClass:"flex border-b border-border bg-sidebar overflow-x-auto"},e._l(e.openFiles,function(n){var r;return t("div",{key:n.path,staticClass:"flex items-center gap-2 px-3 py-2 cursor-pointer border-r border-border",class:((r=e.activeFile)==null?void 0:r.path)===n.path?"bg-contentBg text-white border-t-2 border-t-accent":"text-textMuted hover:bg-hoverBg",on:{click:function(o){e.activeFile=n}}},[t("i",{staticClass:"text-xs",class:e.getFileIcon(n.name)}),t("span",{staticClass:"text-xs"},[e._v(e._s(n.name))]),t("button",{staticClass:"ml-2 hover:text-white text-textMuted",on:{click:function(o){return o.stopPropagation(),e.closeFile(n)}}},[t("i",{staticClass:"fa-solid fa-times text-[10px]"})])])}),0),t("div",{staticClass:"flex-1 overflow-hidden"},[e.activeFile?e.fileLoading?t("div",{staticClass:"flex items-center justify-center h-full text-textMuted"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e.isBinaryFile?t("div",{staticClass:"flex items-center justify-center h-full text-textMuted"},[e._m(1)]):e._e():t("div",{staticClass:"text-textMuted text-center mt-20"},[t("i",{staticClass:"fa-solid fa-file-code text-6xl mb-4 opacity-20"}),t("p",[e._v("双击左侧文件打开编辑器")])]),t("div",{directives:[{name:"show",rawName:"v-show",value:e.activeFile&&!e.isBinaryFile,expression:"activeFile && !isBinaryFile"}],ref:"editorContainer",staticClass:"monaco-editor-container"})]),e.activeFile&&!e.isBinaryFile?t("div",{staticClass:"h-8 bg-sidebar border-t border-border flex items-center justify-between px-3"},[t("div",{staticClass:"flex items-center gap-4 text-xs text-textMuted"},[t("span",[e._v(e._s(e.activeFile.path))]),e.hasChanges?t("span",{staticClass:"text-yellow-500"},[e._v("已修改")]):e._e()]),t("div",{staticClass:"flex items-center gap-2"},[t("button",{staticClass:"px-3 py-1 text-xs bg-primary hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed text-white rounded",attrs:{disabled:!e.hasChanges||e.saving},on:{click:e.saveFile}},[e.saving?t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-1"}):t("i",{staticClass:"fa-solid fa-save mr-1"}),e._v(" 保存 ")])])]):e._e()]),t("CopyPathDialog",{ref:"copyPathDialog"})],1)},Kgt=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"flex border-b border-border text-xs uppercase font-bold text-textMuted"},[e("div",{staticClass:"px-4 py-2 border-b-2 border-accent text-white flex items-center gap-2"},[e("i",{staticClass:"fa-solid fa-folder-open"}),s._v(" Explorer ")])])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"text-center"},[e("i",{staticClass:"fa-solid fa-file text-4xl mb-4 opacity-30"}),e("p",[s._v("二进制文件无法预览")])])}],Ggt=Li(Ugt,qgt,Kgt,!1,null,"f659ba7f");const Ygt=Ggt.exports,Zgt={name:"SkillCard",props:{skill:{type:Object,required:!0},installed:{type:Boolean,default:!1},installing:{type:Boolean,default:!1}},computed:{tagList(){return this.skill.tags?this.skill.tags.split(",").map(s=>s.trim()).filter(Boolean):[]}}};var Xgt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"skill-card bg-sidebar border border-border rounded-lg p-4 hover:border-accent transition-colors flex flex-col"},[t("div",{staticClass:"flex items-start gap-3 mb-3"},[t("div",{staticClass:"w-10 h-10 rounded-lg flex items-center justify-center text-lg shrink-0",class:e.installed?"bg-green-900/30 text-green-400":"bg-blue-900/30 text-blue-400"},[t("i",{staticClass:"fa-solid fa-shapes"})]),t("div",{staticClass:"flex-1 min-w-0"},[t("div",{staticClass:"flex items-center gap-2"},[t("h4",{staticClass:"text-white font-semibold text-sm truncate"},[e._v(e._s(e.skill.name))]),e.installed?t("el-tag",{attrs:{type:"success",size:"mini"}},[e._v("已安装")]):e._e()],1),t("p",{staticClass:"text-textMuted text-xs mt-1 line-clamp-2"},[e._v(e._s(e.skill.description||"No description"))])])]),e.skill.tags?t("div",{staticClass:"flex items-center gap-1 flex-wrap mb-3"},e._l(e.tagList,function(i){return t("span",{key:i,staticClass:"text-[10px] px-2 py-0.5 rounded bg-white/5 text-textMuted"},[e._v(e._s(i))])}),0):e._e(),t("div",{staticClass:"flex items-center justify-between mt-auto pt-3 border-t border-border"},[t("div",{staticClass:"flex items-center gap-3 text-xs text-textMuted"},[e.skill.latest_version?t("span",{staticClass:"flex items-center gap-1"},[t("i",{staticClass:"fa-solid fa-code-branch"}),e._v(" "+e._s(e.skill.latest_version)+" ")]):e._e(),e.skill.download_count!==void 0?t("span",{staticClass:"flex items-center gap-1"},[t("i",{staticClass:"fa-solid fa-download"}),e._v(" "+e._s(e.skill.download_count)+" ")]):e._e()]),t("div",[e.installed?t("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(i){return e.$emit("view",e.skill)}}},[e._v("查看")]):e._e(),e.installed?t("el-button",{attrs:{type:"danger",size:"mini",plain:""},on:{click:function(i){return e.$emit("uninstall",e.skill)}}},[e._v("卸载")]):t("el-button",{attrs:{type:"primary",size:"mini",loading:e.installing},on:{click:function(i){return e.$emit("install",e.skill)}}},[e._v("安装")])],1)])])},Qgt=[],Jgt=Li(Zgt,Xgt,Qgt,!1,null,"9f1fb0b4");const ept=Jgt.exports,tpt={name:"SkillMarket",components:{SkillCard:ept},props:{localSkills:{type:Array,default:()=>[]},projectPath:{type:String,default:""}},data(){return{categories:[],selectedCategoryId:null,keyword:"",filterMode:"all",skills:[],localInstalledSkills:[],total:0,currentPage:1,pageSize:20,loading:!1,installingIds:{}}},computed:{displaySkills(){return this.filterMode==="installed"?this.localInstalledSkills:this.skills}},created(){this.loadCategories(),this.loadSkills()},methods:{async loadCategories(){try{const s=await jt.getSkillCategories();this.categories=s.data||[]}catch(s){console.error("Failed to load categories:",s)}},async loadSkills(){this.loading=!0;try{const e=(await jt.getPublishedSkills({page:this.currentPage,pageSize:this.pageSize,keyword:this.keyword||void 0,categoryId:this.selectedCategoryId||void 0})).data||{};this.skills=e.list||[],this.total=e.total||0}catch(s){console.error("Failed to load skills:",s),this.skills=[]}finally{this.loading=!1}},async loadLocalInstalledSkills(){this.loading=!0;try{const s=await jt.getLocalSkills(this.projectPath);this.localInstalledSkills=s.data||[]}catch(s){console.error("Failed to load local installed skills:",s),this.localInstalledSkills=[]}finally{this.loading=!1}},selectFilter(s){this.filterMode=s,this.currentPage=1,this.selectedCategoryId="",s==="installed"?this.loadLocalInstalledSkills():this.loadSkills()},selectCategory(s){this.selectedCategoryId=s,this.currentPage=1,this.filterMode="",this.loadSkills()},onSearch(){this.currentPage=1,this.loadSkills()},handlePageChange(s){this.currentPage=s,this.loadSkills()},isInstalled(s){return this.localSkills.some(e=>e.name===s)},async handleInstall(s){try{await this.$confirm(`确定要安装 "${s.name}" 吗?`,"确认",{type:"info"})}catch{return}this.$set(this.installingIds,s.id,!0);try{await jt.installSkill(s.id,s.name),this.$message.success(`安装成功: ${s.name}`),this.$emit("refresh-local")}catch(e){this.$message.error("安装失败: "+(e.message||"Unknown error"))}finally{this.$set(this.installingIds,s.id,!1)}},async handleUninstall(s){try{await this.$confirm(`确定要卸载 "${s.name}" 吗?`,"确认",{type:"warning"}),await jt.uninstallSkill(s.name),this.$message.success(`卸载成功: ${s.name}`),this.$emit("refresh-local"),this.filterMode==="installed"&&this.loadLocalInstalledSkills()}catch(e){e!=="cancel"&&this.$message.error("卸载失败: "+(e.message||"Unknown error"))}},handleView(s){this.$emit("view",s)}}};var ipt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"skill-market flex flex-col h-full"},[t("div",{staticClass:"flex items-center gap-2 mb-4 flex-wrap"},[t("el-input",{staticClass:"w-[200px]",staticStyle:{width:"250px"},attrs:{placeholder:"搜索 Skill...",size:"small",clearable:""},on:{keyup:function(i){return!i.type.indexOf("key")&&e._k(i.keyCode,"enter",13,i.key,"Enter")?null:e.onSearch.apply(null,arguments)}},model:{value:e.keyword,callback:function(i){e.keyword=i},expression:"keyword"}}),t("el-button",{attrs:{size:"small",type:"primary"},on:{click:e.onSearch}},[e._v("查询")]),t("button",{staticClass:"px-3 py-1 rounded text-sm border transition-colors",class:e.filterMode==="all"?"bg-accent text-white border-accent":"bg-sidebar text-textMuted border-border hover:text-white hover:border-accent",on:{click:function(i){return e.selectFilter("all")}}},[e._v("全部")]),t("button",{staticClass:"px-3 py-1 rounded text-sm border transition-colors",class:e.filterMode==="installed"?"bg-accent text-white border-accent":"bg-sidebar text-textMuted border-border hover:text-white hover:border-accent",on:{click:function(i){return e.selectFilter("installed")}}},[e._v("已安装")]),e._l(e.categories,function(i){return t("button",{key:i.id,staticClass:"px-3 py-1 rounded text-sm border transition-colors",class:e.selectedCategoryId===i.id?"bg-accent text-white border-accent":"bg-sidebar text-textMuted border-border hover:text-white hover:border-accent",on:{click:function(n){return e.selectCategory(i.id)}}},[e._v(e._s(i.name))])})],2),e.loading?t("div",{staticClass:"flex-1 flex items-center justify-center"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin text-2xl text-textMuted"})]):e.displaySkills.length===0?t("div",{staticClass:"flex-1 flex flex-col items-center justify-center text-textMuted"},[t("i",{staticClass:"fa-solid fa-shapes text-4xl mb-4 opacity-30"}),t("p",[e._v("暂无 Skill")])]):[t("div",{staticClass:"flex-1 overflow-y-auto"},[t("div",{staticClass:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4"},e._l(e.displaySkills,function(i){return t("SkillCard",{key:i.id||i.name,attrs:{skill:i,installed:e.filterMode==="installed"?!0:e.isInstalled(i.name),installing:e.installingIds[i.id]},on:{install:e.handleInstall,uninstall:e.handleUninstall,view:e.handleView}})}),1)]),e.filterMode==="all"&&e.total>e.pageSize?t("div",{staticClass:"flex items-center justify-center pt-4 mt-auto"},[t("el-pagination",{attrs:{background:"",small:"",layout:"prev, pager, next",total:e.total,"page-size":e.pageSize,"current-page":e.currentPage},on:{"current-change":e.handlePageChange}})],1):e._e()]],2)},npt=[],spt=Li(tpt,ipt,npt,!1,null,null);const rpt=spt.exports,opt={name:"SkillViewer",props:{visible:{type:Boolean,default:!1},skill:{type:Object,default:null},content:{type:String,default:""}},computed:{dialogVisible:{get(){return this.visible},set(s){this.$emit("update:visible",s)}}}};var apt=function(){var e=this,t=e._self._c;return t("el-dialog",{staticClass:"skill-viewer-dialog",attrs:{title:e.skill.name,visible:e.dialogVisible,width:"800px"},on:{"update:visible":function(i){e.dialogVisible=i}}},[e.skill?t("div",{staticClass:"max-h-[60vh] overflow-y-auto"},[t("div",{staticClass:"mb-4"},[t("p",{staticClass:"text-textMuted text-sm mt-1"},[e._v(e._s(e.skill.description))])]),t("pre",{staticClass:"bg-sidebar p-4 rounded text-sm text-textMain overflow-x-auto whitespace-pre-wrap"},[e._v(e._s(e.content))])]):e._e()])},lpt=[],cpt=Li(opt,apt,lpt,!1,null,"0de9708e");const dpt=cpt.exports,upt={name:"SpecCard",props:{spec:{type:Object,required:!0},installed:{type:Boolean,default:!1},installing:{type:Boolean,default:!1}}};var hpt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"spec-card bg-sidebar border border-border rounded-lg p-4 hover:border-accent transition-colors flex flex-col"},[t("div",{staticClass:"flex items-start gap-3 mb-3"},[t("div",{staticClass:"w-10 h-10 rounded-lg flex items-center justify-center text-lg shrink-0",class:e.installed?"bg-green-900/30 text-green-400":"bg-purple-900/30 text-purple-400"},[t("i",{staticClass:"fa-solid fa-file-alt"})]),t("div",{staticClass:"flex-1 min-w-0"},[t("div",{staticClass:"flex items-center gap-2"},[t("h4",{staticClass:"text-white font-semibold text-sm truncate"},[e._v(e._s(e.spec.name))]),e.installed?t("el-tag",{attrs:{type:"success",size:"mini"}},[e._v("已安装")]):e._e()],1),t("p",{staticClass:"text-textMuted text-xs mt-1 line-clamp-2"},[e._v(e._s(e.spec.description||"No description"))])])]),t("div",{staticClass:"flex items-center justify-between mt-auto pt-3 border-t border-border"},[t("div",{staticClass:"flex items-center gap-3 text-xs text-textMuted"},[e.spec.latest_version?t("span",{staticClass:"flex items-center gap-1"},[t("i",{staticClass:"fa-solid fa-code-branch"}),e._v(" "+e._s(e.spec.latest_version)+" ")]):e._e(),e.spec.download_count!==void 0?t("span",{staticClass:"flex items-center gap-1"},[t("i",{staticClass:"fa-solid fa-download"}),e._v(" "+e._s(e.spec.download_count)+" ")]):e._e()]),t("div",[e.installed?t("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(i){return e.$emit("view",e.spec)}}},[e._v("查看")]):e._e(),e.installed?t("el-button",{attrs:{type:"danger",size:"mini",plain:""},on:{click:function(i){return e.$emit("uninstall",e.spec)}}},[e._v("卸载")]):t("el-button",{attrs:{type:"primary",size:"mini",loading:e.installing},on:{click:function(i){return e.$emit("install",e.spec)}}},[e._v("安装")])],1)])])},fpt=[],gpt=Li(upt,hpt,fpt,!1,null,"45111e53");const ppt=gpt.exports,mpt={name:"SpecMarket",components:{SpecCard:ppt},props:{localSpecs:{type:Array,default:()=>[]},projectPath:{type:String,default:""}},data(){return{categories:[],selectedCategoryId:null,keyword:"",filterMode:"all",specs:[],localInstalledSpecs:[],total:0,currentPage:1,pageSize:20,loading:!1,installingIds:{}}},computed:{displaySpecs(){return this.filterMode==="installed"?this.localInstalledSpecs:this.specs}},created(){this.loadCategories(),this.loadSpecs()},methods:{async loadCategories(){try{const s=await jt.getSpecCategories();this.categories=s.data||[]}catch(s){console.error("Failed to load spec categories:",s)}},async loadSpecs(){this.loading=!0;try{const e=(await jt.getPublishedSpecs({page:this.currentPage,pageSize:this.pageSize,keyword:this.keyword||void 0,categoryId:this.selectedCategoryId||void 0})).data||{};this.specs=e.list||[],this.total=e.total||0}catch(s){console.error("Failed to load specs:",s),this.specs=[]}finally{this.loading=!1}},async loadLocalInstalledSpecs(){var s;this.loading=!0;try{const e=await jt.getLocalSpecs(this.projectPath);this.localInstalledSpecs=((s=e.data)==null?void 0:s.specs)||[]}catch(e){console.error("Failed to load local installed specs:",e),this.localInstalledSpecs=[]}finally{this.loading=!1}},selectFilter(s){this.filterMode=s,this.currentPage=1,this.selectedCategoryId="",s==="installed"?this.loadLocalInstalledSpecs():this.loadSpecs()},selectCategory(s){this.selectedCategoryId=s,this.currentPage=1,this.filterMode="",this.loadSpecs()},onSearch(){this.currentPage=1,this.loadSpecs()},handlePageChange(s){this.currentPage=s,this.loadSpecs()},isInstalled(s){return this.localSpecs.some(e=>e.name===s)},async handleInstall(s){try{await this.$confirm(`确定要安装 "${s.name}" 吗?`,"确认",{type:"info"})}catch{return}this.$set(this.installingIds,s.id,!0);try{await jt.installSpec(s.id,s.name),this.$message.success(`安装成功: ${s.name}`),this.$emit("refresh-local")}catch(e){this.$message.error("安装失败: "+(e.message||"Unknown error"))}finally{this.$set(this.installingIds,s.id,!1)}},async handleUninstall(s){try{await this.$confirm(`确定要卸载 "${s.name}" 吗?`,"确认",{type:"warning"}),await jt.uninstallSpec(s.name),this.$message.success(`卸载成功: ${s.name}`),this.$emit("refresh-local"),this.filterMode==="installed"&&this.loadLocalInstalledSpecs()}catch(e){e!=="cancel"&&this.$message.error("卸载失败: "+(e.message||"Unknown error"))}},handleView(s){this.$emit("view",s)}}};var _pt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"spec-market flex flex-col h-full"},[t("div",{staticClass:"flex items-center gap-2 mb-4 flex-wrap"},[t("el-input",{staticClass:"w-[200px]",staticStyle:{width:"250px"},attrs:{placeholder:"搜索规范...",size:"small",clearable:""},on:{keyup:function(i){return!i.type.indexOf("key")&&e._k(i.keyCode,"enter",13,i.key,"Enter")?null:e.onSearch.apply(null,arguments)}},model:{value:e.keyword,callback:function(i){e.keyword=i},expression:"keyword"}}),t("el-button",{attrs:{size:"small",type:"primary"},on:{click:e.onSearch}},[e._v("查询")]),t("button",{staticClass:"px-3 py-1 rounded text-sm border transition-colors",class:e.filterMode==="all"?"bg-accent text-white border-accent":"bg-sidebar text-textMuted border-border hover:text-white hover:border-accent",on:{click:function(i){return e.selectFilter("all")}}},[e._v("全部")]),t("button",{staticClass:"px-3 py-1 rounded text-sm border transition-colors",class:e.filterMode==="installed"?"bg-accent text-white border-accent":"bg-sidebar text-textMuted border-border hover:text-white hover:border-accent",on:{click:function(i){return e.selectFilter("installed")}}},[e._v("已安装")]),e._l(e.categories,function(i){return t("button",{key:i.id,staticClass:"px-3 py-1 rounded text-sm border transition-colors",class:e.selectedCategoryId===i.id?"bg-accent text-white border-accent":"bg-sidebar text-textMuted border-border hover:text-white hover:border-accent",on:{click:function(n){return e.selectCategory(i.id)}}},[e._v(e._s(i.name))])})],2),e.loading?t("div",{staticClass:"flex-1 flex items-center justify-center"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin text-2xl text-textMuted"})]):e.displaySpecs.length===0?t("div",{staticClass:"flex-1 flex flex-col items-center justify-center text-textMuted"},[t("i",{staticClass:"fa-solid fa-file-alt text-4xl mb-4 opacity-30"}),t("p",[e._v("暂无规范")])]):[t("div",{staticClass:"flex-1 overflow-y-auto"},[t("div",{staticClass:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4"},e._l(e.displaySpecs,function(i){return t("SpecCard",{key:i.id||i.name,attrs:{spec:i,installed:e.filterMode==="installed"?!0:e.isInstalled(i.name),installing:e.installingIds[i.id]},on:{install:e.handleInstall,uninstall:e.handleUninstall,view:e.handleView}})}),1)]),e.filterMode==="all"&&e.total>e.pageSize?t("div",{staticClass:"flex items-center justify-center pt-4 mt-auto"},[t("el-pagination",{attrs:{background:"",small:"",layout:"prev, pager, next",total:e.total,"page-size":e.pageSize,"current-page":e.currentPage},on:{"current-change":e.handlePageChange}})],1):e._e()]],2)},vpt=[],bpt=Li(mpt,_pt,vpt,!1,null,null);const Cpt=bpt.exports,ypt={name:"SpecViewer",props:{visible:{type:Boolean,default:!1},spec:{type:Object,default:null},content:{type:String,default:""}},computed:{dialogVisible:{get(){return this.visible},set(s){this.$emit("update:visible",s)}}}};var wpt=function(){var e=this,t=e._self._c;return t("el-dialog",{staticClass:"spec-viewer-dialog",attrs:{title:e.spec.name,visible:e.dialogVisible,width:"800px"},on:{"update:visible":function(i){e.dialogVisible=i}}},[e.spec?t("div",{staticClass:"max-h-[60vh] overflow-y-auto"},[t("div",{staticClass:"mb-4"},[t("p",{staticClass:"text-textMuted text-sm mt-1"},[e._v(e._s(e.spec.description))])]),t("pre",{staticClass:"bg-sidebar p-4 rounded text-sm text-textMain overflow-x-auto whitespace-pre-wrap"},[e._v(e._s(e.content))])]):e._e()])},Spt=[],xpt=Li(ypt,wpt,Spt,!1,null,"21d87b34");const kpt=xpt.exports,Lpt={name:"MemoryDisplay",props:{items:{type:Array,default:()=>[]}}};var Dpt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"memory-display"},[e.items.length===0?t("div",{staticClass:"text-textMuted text-center py-8"},[e._v(" No memories yet. Click the edit button to add some. ")]):t("div",{staticClass:"space-y-4"},e._l(e.items,function(i,n){return t("div",{key:n,staticClass:"bg-sidebar rounded p-4 border border-border"},[t("div",{staticClass:"text-white whitespace-pre-wrap"},[e._v(e._s(i.content))]),i.description?t("div",{staticClass:"text-textMuted text-sm mt-2 whitespace-pre-wrap"},[e._v(e._s(i.description))]):e._e()])}),0)])},Ipt=[],Ept=Li(Lpt,Dpt,Ipt,!1,null,null);const Tpt=Ept.exports,Npt={name:"MemoryEditDialog",props:{visible:{type:Boolean,default:!1},content:{type:String,default:""}},data(){return{editContent:""}},computed:{dialogVisible:{get(){return this.visible},set(s){this.$emit("update:visible",s)}}},watch:{content(s){this.editContent=s}},methods:{handleClose(){this.$emit("update:visible",!1),this.$emit("close")},handleSave(){this.$emit("update:visible",!1),this.$emit("save",this.editContent)}}};var Ppt=function(){var e=this,t=e._self._c;return t("el-dialog",{staticClass:"memory-edit-dialog",attrs:{title:"Edit Memory",visible:e.dialogVisible,width:"800px"},on:{"update:visible":function(i){e.dialogVisible=i},close:e.handleClose}},[t("div",{staticClass:"mb-2 text-textMuted text-sm"},[e._v(' Format: memory content followed by optional description after "---", separated by § ')]),t("el-input",{staticClass:"w-full",attrs:{type:"textarea",rows:15},model:{value:e.editContent,callback:function(i){e.editContent=i},expression:"editContent"}}),t("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:e.handleClose}},[e._v("Cancel")]),t("el-button",{attrs:{type:"primary"},on:{click:e.handleSave}},[e._v("Save")])],1)],1)},Mpt=[],Rpt=Li(Npt,Ppt,Mpt,!1,null,"144910b3");const Opt=Rpt.exports,Apt={name:"Skills",components:{SkillMarket:rpt,SkillViewer:dpt,SpecMarket:Cpt,SpecViewer:kpt,MemoryDisplay:Tpt,MemoryEditDialog:Opt},data(){return{subTab:"market",filterText:"",localSkills:[],localSpecs:[],showSpecViewer:!1,currentSpec:null,currentSpecContent:"",showSkillViewer:!1,currentSkill:null,currentSkillContent:"",projectPath:"",memoryItems:[],memoryRawContent:"",showMemoryEdit:!1}},watch:{subTab(s){s==="memory"&&this.projectPath&&this.loadMemory()}},async created(){await this.loadProjectPath(),await this.loadLocalSkills(),await this.loadLocalSpecs(),this.subTab==="memory"&&await this.loadMemory()},methods:{async loadProjectPath(){try{const s=await jt.getProjectPath();s.success&&s.data&&(this.projectPath=s.data.path||"")}catch(s){console.error("Failed to load project path:",s)}},async loadLocalSkills(){try{const s=await jt.getLocalSkills(this.projectPath);this.localSkills=s.data||[]}catch(s){console.error("Failed to load local skills:",s),this.localSkills=[]}},async handleViewSkill(s){try{const e=await jt.getSkillContent(s.name);this.currentSkill=s,this.currentSkillContent=e.data,this.showSkillViewer=!0}catch(e){console.error("Failed to load skill content:",e),this.$message.error("Failed to load skill content")}},async loadLocalSpecs(){var s;try{const e=await jt.getLocalSpecs(this.projectPath);this.localSpecs=((s=e.data)==null?void 0:s.specs)||[]}catch(e){console.error("Failed to load local specs:",e),this.localSpecs=[]}},async handleViewSpec(s){try{const e=await jt.getSpecContent(s.name);this.currentSpec=s,this.currentSpecContent=e.data,this.showSpecViewer=!0}catch(e){console.error("Failed to load spec content:",e),this.$message.error("Failed to load spec content")}},async loadMemory(){var s,e;try{const t=await jt.getMemory(this.projectPath);this.memoryItems=((s=t.data)==null?void 0:s.items)||[],this.memoryRawContent=((e=t.data)==null?void 0:e.rawContent)||""}catch(t){console.error("Failed to load memory:",t),this.memoryItems=[],this.memoryRawContent=""}},openMemoryEdit(){this.showMemoryEdit=!0},async handleSaveMemory(s){try{await jt.saveMemory(this.projectPath,s),await this.loadMemory(),this.$message.success("Memory saved")}catch(e){console.error("Failed to save memory:",e),this.$message.error("Failed to save memory")}}}};var Fpt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"flex-1 flex overflow-hidden"},[t("aside",{staticClass:"w-[220px] bg-sidebar border-r border-border flex flex-col shrink-0 py-4"},[t("div",{staticClass:"px-4 mb-4"},[t("h2",{staticClass:"text-white font-bold text-lg mb-1"},[e._v("Skills & Specs")]),t("input",{directives:[{name:"model",rawName:"v-model",value:e.filterText,expression:"filterText"}],staticClass:"w-full bg-black/20 border border-border rounded px-2 py-1 text-xs",attrs:{type:"text",placeholder:"Filter..."},domProps:{value:e.filterText},on:{input:function(i){i.target.composing||(e.filterText=i.target.value)}}})]),t("div",{staticClass:"flex-1 overflow-y-auto"},[t("div",{staticClass:"px-4 py-1 text-xs font-bold text-textMuted uppercase mt-2"},[e._v("Skills")]),t("button",{staticClass:"w-full text-left px-4 py-2 flex items-center gap-2",class:e.subTab==="market"?"bg-active text-white border-l-2 border-accent":"text-textMuted hover:text-white hover:bg-white/5 border-l-2 border-transparent",on:{click:function(i){e.subTab="market"}}},[t("i",{staticClass:"fa-solid fa-store w-4 text-center"}),e._v(" skill 市场 ")]),t("div",{staticClass:"px-4 py-1 text-xs font-bold text-textMuted uppercase mt-4"},[e._v("Specs")]),t("button",{staticClass:"w-full text-left px-4 py-2 flex items-center gap-2",class:e.subTab==="specMarket"?"bg-active text-white border-l-2 border-accent":"text-textMuted hover:text-white hover:bg-white/5 border-l-2 border-transparent",on:{click:function(i){e.subTab="specMarket"}}},[t("i",{staticClass:"fa-solid fa-store w-4 text-center"}),e._v(" 规范市场 ")]),t("div",{staticClass:"px-4 py-1 text-xs font-bold text-textMuted uppercase mt-4"},[e._v("Memory")]),t("button",{staticClass:"w-full text-left px-4 py-2 flex items-center gap-2",class:e.subTab==="memory"?"bg-active text-white border-l-2 border-accent":"text-textMuted hover:text-white hover:bg-white/5 border-l-2 border-transparent",on:{click:function(i){e.subTab="memory"}}},[t("i",{staticClass:"fa-solid fa-brain w-4 text-center"}),e._v(" 记忆 ")])])]),t("main",{staticClass:"flex-1 flex flex-col bg-contentBg min-w-0"},[t("div",{directives:[{name:"show",rawName:"v-show",value:e.subTab==="market",expression:"subTab === 'market'"}],staticClass:"flex-1 p-6 overflow-hidden flex flex-col"},[t("SkillMarket",{ref:"skillMarket",attrs:{"local-skills":e.localSkills,"project-path":e.projectPath},on:{"refresh-local":e.loadLocalSkills,view:e.handleViewSkill}})],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.subTab==="specMarket",expression:"subTab === 'specMarket'"}],staticClass:"flex-1 p-6 overflow-hidden flex flex-col"},[t("SpecMarket",{ref:"specMarket",attrs:{"local-specs":e.localSpecs,"project-path":e.projectPath},on:{"refresh-local":e.loadLocalSpecs,view:e.handleViewSpec}})],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.subTab==="memory",expression:"subTab === 'memory'"}],staticClass:"flex-1 flex flex-col overflow-hidden"},[t("div",{staticClass:"flex items-center justify-between px-6 py-3 border-b border-border"},[t("h2",{staticClass:"text-lg font-bold text-white"},[e._v("记忆")]),t("el-button",{attrs:{size:"small"},on:{click:e.openMemoryEdit}},[t("i",{staticClass:"fa-solid fa-pen"})])],1),t("div",{staticClass:"flex-1 p-6 overflow-y-auto"},[t("MemoryDisplay",{attrs:{items:e.memoryItems}})],1)])]),t("SpecViewer",{attrs:{visible:e.showSpecViewer,spec:e.currentSpec,content:e.currentSpecContent},on:{"update:visible":function(i){e.showSpecViewer=i}}}),t("SkillViewer",{attrs:{visible:e.showSkillViewer,skill:e.currentSkill,content:e.currentSkillContent},on:{"update:visible":function(i){e.showSkillViewer=i}}}),t("MemoryEditDialog",{attrs:{visible:e.showMemoryEdit,content:e.memoryRawContent},on:{"update:visible":function(i){e.showMemoryEdit=i},save:e.handleSaveMemory}})],1)},Bpt=[],Wpt=Li(Apt,Fpt,Bpt,!1,null,null);const Vpt=Wpt.exports,Hpt={name:"DbView",data(){return{tables:[],selectedTable:null,tableInfo:{},tableData:{columns:[],rows:[]},page:1,pageSize:50,totalPages:1,loading:!1}},async created(){await this.loadTables()},methods:{async loadTables(){this.loading=!0;try{const s=await jt.getDbTables();this.tables=(s.data||[]).map(e=>e.name)}catch(s){console.error("Load tables failed:",s),this.tables=[]}finally{this.loading=!1}},async selectTable(s){this.selectedTable=s,this.page=1,await this.loadTableInfo(),await this.loadTableData()},async loadTableInfo(){if(this.selectedTable)try{const s=await jt.getTableInfo(this.selectedTable);this.tableInfo=s.data||{},this.totalPages=Math.max(1,Math.ceil((this.tableInfo.row_count||0)/this.pageSize))}catch(s){console.error("Load table info failed:",s),this.tableInfo={}}},async loadTableData(){if(this.selectedTable)try{const s=await jt.getTableData(this.selectedTable,this.page,this.pageSize);this.tableData={rows:s.data||[]}}catch(s){console.error("Load table data failed:",s),this.tableData={columns:[],rows:[]}}},async prevPage(){this.page>1&&(this.page--,await this.loadTableData())},async nextPage(){this.page<this.totalPages&&(this.page++,await this.loadTableData())},formatCell(s){return s===null?"<null>":s===void 0?"":typeof s=="boolean"?s?"true":"false":typeof s=="object"?JSON.stringify(s):String(s)}}};var $pt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"flex-1 flex overflow-hidden"},[t("aside",{staticClass:"w-[260px] bg-sidebar border-r border-border flex flex-col shrink-0"},[e._m(0),t("div",{staticClass:"flex items-center gap-1 px-2 py-2 border-b border-border"},[t("button",{staticClass:"p-1 text-textMuted hover:text-white",attrs:{title:"刷新"},on:{click:e.loadTables}},[t("i",{staticClass:"fa-solid fa-refresh"})])]),t("div",{staticClass:"flex-1 overflow-y-auto py-1"},[e.loading?t("div",{staticClass:"flex items-center justify-center py-8 text-textMuted"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e.tables.length===0?t("div",{staticClass:"flex items-center justify-center py-8 text-textMuted text-sm"},[e._v(" 暂无表 ")]):t("div",e._l(e.tables,function(i){return t("div",{key:i,staticClass:"flex items-center gap-2 px-3 py-1.5 cursor-pointer text-sm",class:e.selectedTable===i?"bg-active text-white border-l-2 border-accent":"text-textMuted hover:text-white hover:bg-white/5 border-l-2 border-transparent",on:{click:function(n){return e.selectTable(i)}}},[t("i",{staticClass:"fa-solid fa-table text-textMuted text-xs"}),t("span",{staticClass:"truncate"},[e._v(e._s(i))])])}),0)])]),t("main",{staticClass:"flex-1 flex flex-col min-w-0 bg-contentBg"},[e.selectedTable?t("div",{staticClass:"flex-1 flex flex-col overflow-hidden"},[t("div",{staticClass:"flex items-center justify-between px-4 py-2 border-b border-border bg-sidebar"},[t("div",{staticClass:"flex items-center gap-2"},[t("i",{staticClass:"fa-solid fa-table text-textMuted"}),t("span",{staticClass:"text-sm text-white"},[e._v(e._s(e.selectedTable))]),t("span",{staticClass:"text-xs text-textMuted"},[e._v("("+e._s(e.tableInfo.row_count||0)+" 行)")])]),t("div",{staticClass:"flex items-center gap-2"},[t("button",{staticClass:"px-2 py-1 text-xs text-textMuted hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",attrs:{disabled:e.page<=1},on:{click:e.prevPage}},[t("i",{staticClass:"fa-solid fa-chevron-left"})]),t("span",{staticClass:"text-xs text-textMuted"},[e._v(e._s(e.page)+" / "+e._s(e.totalPages||1))]),t("button",{staticClass:"px-2 py-1 text-xs text-textMuted hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",attrs:{disabled:e.page>=e.totalPages},on:{click:e.nextPage}},[t("i",{staticClass:"fa-solid fa-chevron-right"})])])]),t("div",{staticClass:"flex-1 overflow-auto"},[t("table",{staticClass:"w-full text-sm"},[t("thead",{staticClass:"bg-sidebar sticky top-0"},[t("tr",e._l(e.tableInfo.columns,function(i){return t("th",{key:i.name,staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[e._v(" "+e._s(i.name)+" "),t("span",{staticClass:"text-xs font-normal text-textMuted opacity-60 ml-1"},[e._v(e._s(i.type))])])}),0)]),t("tbody",[e._l(e.tableData.rows,function(i,n){return t("tr",{key:n,staticClass:"hover:bg-white/5"},e._l(e.tableInfo.columns,function(r){return t("td",{key:r.name,staticClass:"px-3 py-1.5 text-gray-300 border-b border-border/30"},[e._v(" "+e._s(e.formatCell(i[r.name]))+" ")])}),0)}),e.tableData.rows&&e.tableData.rows.length===0?t("tr",[t("td",{staticClass:"px-3 py-8 text-center text-textMuted",attrs:{colspan:e.tableInfo.columns?e.tableInfo.columns.length:0}},[e._v(" 表中无数据 ")])]):e._e()],2)])])]):t("div",{staticClass:"flex-1 flex items-center justify-center text-textMuted"},[e._m(1)])])])},zpt=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"flex border-b border-border text-xs uppercase font-bold text-textMuted"},[e("div",{staticClass:"px-4 py-2 border-b-2 border-accent text-white flex items-center gap-2"},[e("i",{staticClass:"fa-solid fa-database"}),s._v(" Tables ")])])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"text-center"},[e("i",{staticClass:"fa-solid fa-database text-6xl mb-4 opacity-20"}),e("p",[s._v("选择表查看数据")])])}],jpt=Li(Hpt,$pt,zpt,!1,null,null);const Upt=jpt.exports,qpt={name:"AppLayout",computed:{isHome(){return this.$route.path==="/views/app"}}};var Kpt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"app-layout"},[e.isHome?t("header",{staticClass:"app-header"},[e._m(0)]):e._e(),t("main",{staticClass:"app-content"},[t("router-view")],1)])},Gpt=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"header-left"},[e("i",{staticClass:"fa-solid fa-robot text-accent"}),e("span",[s._v("TXCode")])])}],Ypt=Li(qpt,Kpt,Gpt,!1,null,"ff369547");const Zpt=Ypt.exports,Xpt={name:"IndexViewApp",data(){return{sessions:[]}},async created(){await this.loadSessions()},methods:{goTo(s){this.$router.push(s)},async loadSessions(){try{const s=await jt.getSessions();this.sessions=s.data||[]}catch(s){console.error("加载会话失败:",s)}},goSession(s){this.$router.push({name:"app-ChatViewApp-session",params:{id:s.id}})},async createSession(){try{const s=await jt.createSession("新会话");this.$router.push({name:"app-ChatViewApp-session",params:{id:s.data.id}})}catch{this.$message.error("创建会话失败")}},formatTime(s){if(!s)return"";const e=new Date(s),i=new Date-e;return i<6e4?"刚刚":i<36e5?Math.floor(i/6e4)+"分钟前":i<864e5?Math.floor(i/36e5)+"小时前":i<6048e5?Math.floor(i/864e5)+"天前":e.toLocaleDateString()}}};var Qpt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"index-view"},[e._m(0),t("div",{staticClass:"feature-grid"},[t("div",{staticClass:"feature-card code",on:{click:function(i){return e.goTo("/views/app/ChatViewApp")}}},[t("i",{staticClass:"fa-regular fa-comments"}),t("h3",[e._v("代码对话")]),t("p",[e._v("与 AI 对话开发")])]),t("div",{staticClass:"feature-card workflow",on:{click:function(i){return e.goTo("/views/app/DevWorkflowViewApp")}}},[t("i",{staticClass:"fa-solid fa-laptop-code"}),t("h3",[e._v("软件研发")]),t("p",[e._v("规范研发流程")])]),t("div",{staticClass:"feature-card files",on:{click:function(i){return e.goTo("/views/app/FilesViewApp")}}},[t("i",{staticClass:"fa-solid fa-folder-open"}),t("h3",[e._v("文件管理")]),t("p",[e._v("浏览项目文件")])]),t("div",{staticClass:"feature-card git",on:{click:function(i){return e.goTo("/views/app/GitChangesApp")}}},[t("i",{staticClass:"fa-brands fa-git-alt"}),t("h3",[e._v("Git变更")]),t("p",[e._v("查看代码变更")])])]),t("div",{staticClass:"section-header"},[t("h2",{staticClass:"section-title"},[e._v("最近会话")]),t("a",{staticClass:"section-more",attrs:{href:"javascript:void(0)"},on:{click:function(i){return e.goTo("/views/app/ChatViewApp")}}},[e._v("查看全部")])]),e.sessions.length>0?t("div",{staticClass:"session-list"},e._l(e.sessions.slice(0,5),function(i){return t("div",{key:i.id,staticClass:"session-item",on:{click:function(n){return e.goSession(i)}}},[e._m(1,!0),t("div",{staticClass:"session-info"},[t("h4",[e._v(e._s(i.title||"未命名会话"))]),t("p",[e._v(e._s(e.formatTime(i.updatedAt||i.createTime)))])]),t("div",{staticClass:"session-status"})])}),0):t("div",{staticClass:"empty-state"},[t("i",{staticClass:"fa-regular fa-comment-dots"}),t("p",[e._v("暂无会话记录")]),t("span",{staticClass:"start-btn",on:{click:e.createSession}},[e._v("开始新对话")])])])},Jpt=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"welcome-section"},[e("div",{staticClass:"welcome-icon"},[e("i",{staticClass:"fa-solid fa-wand-magic-sparkles"})]),e("h1",{staticClass:"welcome-title"},[s._v("你好,我是 TXCode")]),e("p",{staticClass:"welcome-subtitle"},[s._v("AI 驱动的软件开发助手")])])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"session-icon"},[e("i",{staticClass:"fa-solid fa-robot"})])}],emt=Li(Xpt,Qpt,Jpt,!1,null,"b3cab99a");const tmt=emt.exports,imt={name:"FilesViewApp",data(){return{projects:[],currentProject:null,browseResult:{current_path:"",parent_path:null,items:[]},loading:!1,contextMenu:{visible:!1,target:null},inputDialog:{visible:!1,title:"",value:"",placeholder:"",type:"",target:null},confirmDialog:{visible:!1,message:"",target:null},fileViewerVisible:!1,editingFileName:"",editingFilePath:"",fileLoading:!1,saving:!1,isBinary:!1,editor:null,originalContent:"",fileIcons:{js:"fa-brands fa-js text-yellow-400",ts:"fa-brands fa-js text-blue-400",html:"fa-brands fa-html5 text-orange-500",css:"fa-brands fa-css3 text-blue-400",json:"fa-solid fa-file-code text-yellow-300",yaml:"fa-solid fa-file-code text-blue-300",yml:"fa-solid fa-file-code text-blue-300",md:"fa-solid fa-file-lines text-gray-400",py:"fa-brands fa-python text-blue-500",vue:"fa-brands fa-vuejs text-green-400",sh:"fa-solid fa-terminal text-green-400",go:"fa-brands fa-golang text-cyan-400"}}},computed:{fileTreeData(){return this.browseResult.items.map(e=>this.transformNode(e)).sort((e,t)=>e.is_directory===t.is_directory?e.name.localeCompare(t.name):e.is_directory?-1:1)},currentDirName(){const s=this.browseResult.current_path;return s?s.split(/[/\\]/).pop()||s:"我的电脑"},hasChanges(){return this.editor?this.editor.getValue()!==this.originalContent:!1},isBinaryFile(){return this.isBinary}},async created(){await this.loadProjects(),await this.browse(""),document.addEventListener("keydown",this.handleKeydown)},beforeDestroy(){document.removeEventListener("keydown",this.handleKeydown),this.editor&&(this.editor.dispose(),this.editor=null)},methods:{async loadProjects(){try{const s=await jt.getProjects();this.projects=s.data||[];const e=await jt.getCurrentProject();this.currentProject=e.data||null}catch(s){console.error("Load projects failed:",s)}},async handleProjectChange(s){try{await jt.setCurrentProject(s);const e=this.projects.find(t=>t.id===s);e&&(this.currentProject=e),location.reload()}catch(e){this.$message.error("切换项目失败: "+e.message)}},async browse(s){this.loading=!0;try{const e=await jt.browseFilesystem(s);this.browseResult=e.data}catch(e){console.error("Browse failed:",e)}finally{this.loading=!1}},transformNode(s){return{name:s.name,path:s.path,is_directory:s.is_directory,is_drive:s.is_drive||!1,size:s.size,is_binary:s.is_binary||!1}},handleItemClick(s){s.is_directory?this.browse(s.path):this.openFileViewer(s)},toggleMenu(){this.$message.info("长安文件可进行更多操作")},async openFileItem(){this.hideContextMenu(),this.contextMenu.target&&this.openFileViewer(this.contextMenu.target)},goBack(){this.$router.back()},goUp(){if(!this.browseResult.parent_path&&this.browseResult.parent_path!=="")return;const s=this.browseResult.parent_path===""?"":this.browseResult.parent_path;this.browse(s)},async openFileViewer(s){var n,r;if(this.fileViewerVisible=!0,this.editingFileName=s.name,this.editingFilePath=s.path,this.fileLoading=!0,this.isBinary=s.is_binary||!1,this.editor=null,this.isBinary){this.fileLoading=!1;return}let e="";try{const o=await jt.getFileContent(s.path);this.isBinary=((n=o.data)==null?void 0:n.is_binary)||!1,e=((r=o.data)==null?void 0:r.content)||""}catch(o){console.error("Load file failed:",o),this.fileLoading=!1;return}if(this.fileLoading=!1,this.isBinary||(await this.$nextTick(),!this.$refs.editorContainer))return;this.editor=Dg.create(this.$refs.editorContainer,{value:"",language:"plaintext",theme:"vs-dark",automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:16,fontFamily:'Consolas, Monaco, "Courier New", monospace',lineNumbers:"on",roundedSelection:!1,scrollbar:{useShadows:!1,vertical:"auto",horizontal:"auto"}}),this.editor.onDidChangeModelContent(()=>{this.$forceUpdate()}),this.editor.addCommand(ix.CtrlCmd|tx.KeyS,()=>{this.saveFile()});const t=this.getLanguageFromFilename(s.name),i=Dg.createModel(e,t);this.editor.setModel(i),this.originalContent=e},closeFileViewer(){this.editor&&(this.editor.dispose(),this.editor=null),this.fileViewerVisible=!1},async saveFile(){if(!(!this.editor||this.saving)){this.saving=!0;try{const s=this.editor.getValue();await jt.writeFile(this.editingFilePath,s),this.originalContent=s,this.$message.success("已保存")}catch(s){console.error("Save failed:",s),this.$message.error("保存失败")}finally{this.saving=!1}}},initEditor(){this.editor||!this.$refs.editorContainer||(this.editor=Dg.create(this.$refs.editorContainer,{value:"",language:"plaintext",theme:"vs-dark",automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:16,fontFamily:'Consolas, Monaco, "Courier New", monospace',lineNumbers:"on"}),this.editor.addCommand(ix.CtrlCmd|tx.KeyS,()=>{this.saveFile()}))},showContextMenu(s,e){s.stopPropagation(),this.contextMenu={visible:!0,target:e}},hideContextMenu(){this.contextMenu.visible=!1},copyPath(){this.hideContextMenu(),this.contextMenu.target&&(navigator.clipboard.writeText(this.contextMenu.target.path),this.$message.success("路径已复制"))},createNewFile(){this.hideContextMenu(),this.inputDialog={visible:!0,title:"新建文件",value:"",placeholder:"输入文件名",type:"file",target:this.contextMenu.target},this.$nextTick(()=>{var s;(s=this.$refs.dialogInput)==null||s.focus()})},createNewFolder(){this.hideContextMenu(),this.inputDialog={visible:!0,title:"新建文件夹",value:"",placeholder:"输入文件夹名",type:"folder",target:this.contextMenu.target},this.$nextTick(()=>{var s;(s=this.$refs.dialogInput)==null||s.focus()})},renameItem(){this.hideContextMenu(),this.inputDialog={visible:!0,title:"重命名",value:this.contextMenu.target.name,placeholder:"输入新名称",type:"rename",target:this.contextMenu.target},this.$nextTick(()=>{var s,e;(s=this.$refs.dialogInput)==null||s.focus(),(e=this.$refs.dialogInput)==null||e.select()})},async confirmInput(){const{type:s,value:e,target:t}=this.inputDialog;if(!e.trim()){this.cancelInput();return}try{const i=t.path.includes("\\")?"\\":"/";if(s==="file"){const n=t.path+i+e.trim();await jt.writeFile(n,"")}else if(s==="folder"){const n=t.path+i+e.trim();await jt.createDirectory(n)}else if(s==="rename"){const r=t.path.substring(0,t.path.lastIndexOf(i))+i+e.trim();await jt.renameFile(t.path,r)}this.browse(this.browseResult.current_path)}catch(i){console.error("Operation failed:",i),this.$message.error("操作失败")}this.inputDialog.visible=!1},cancelInput(){this.inputDialog.visible=!1},deleteItem(){this.hideContextMenu(),this.confirmDialog={visible:!0,message:`确定要删除 "${this.contextMenu.target.name}" 吗?`,target:this.contextMenu.target}},cancelConfirm(){this.confirmDialog.visible=!1},async confirmDelete(){try{await jt.deleteFile(this.confirmDialog.target.path),this.$message.success("删除成功"),this.browse(this.browseResult.current_path)}catch(s){console.error("Delete failed:",s),this.$message.error("删除失败")}this.confirmDialog.visible=!1},handleKeydown(s){s.ctrlKey&&s.key==="s"&&this.fileViewerVisible&&(s.preventDefault(),this.saveFile())},getItemIcon(s){if(s.is_directory)return"fa-solid fa-folder text-blue-400";const e=s.name.split(".").pop().toLowerCase(),t=s.name.toLowerCase();return t==="dockerfile"?"fa-brands fa-docker text-blue-400":t===".gitignore"?"fa-brands fa-git text-red-400":this.fileIcons[e]||"fa-solid fa-file text-gray-400"},getLanguageFromFilename(s){const e=s.split(".").pop().toLowerCase();return{js:"javascript",ts:"typescript",html:"html",css:"css",vue:"html",py:"python",md:"markdown",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",sql:"sql",sh:"shell",go:"go",rs:"rust"}[e]||"plaintext"}}};var nmt=function(){var i,n,r,o;var e=this,t=e._self._c;return t("div",{staticClass:"h-full flex flex-col bg-[#1e1e1e]"},[t("div",{staticClass:"bg-sidebar border-b border-border px-4 py-3 flex items-center justify-between shrink-0"},[t("div",{staticClass:"flex items-center gap-2"},[t("button",{staticClass:"p-2 text-textMuted hover:text-white",attrs:{title:"返回"},on:{click:e.goBack}},[t("i",{staticClass:"fa-solid fa-chevron-left"})]),t("button",{staticClass:"p-2 text-textMuted hover:text-white disabled:opacity-30",attrs:{disabled:!e.browseResult.parent_path&&e.browseResult.parent_path!=="",title:"上级目录"},on:{click:e.goUp}},[t("i",{staticClass:"fa-solid fa-arrow-up"})])]),t("div",{staticClass:"flex items-center gap-2"},[e.projects.length>0?t("el-dropdown",{attrs:{trigger:"click"},on:{command:e.handleProjectChange}},[t("span",{staticClass:"text-sm text-white cursor-pointer hover:text-accent"},[e._v(" "+e._s(((i=e.currentProject)==null?void 0:i.name)||"选择项目")+" "),t("i",{staticClass:"fa-solid fa-chevron-down ml-1 text-xs"})]),t("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},e._l(e.projects,function(a){var l;return t("el-dropdown-item",{key:a.id,attrs:{command:a.id}},[t("span",{class:a.id===((l=e.currentProject)==null?void 0:l.id)?"text-accent":""},[e._v(e._s(a.name))])])}),1)],1):e._e()],1),t("button",{staticClass:"p-2 text-textMuted hover:text-white",on:{click:e.toggleMenu}},[t("i",{staticClass:"fa-solid fa-ellipsis-v"})])]),t("div",{staticClass:"flex-1 overflow-y-auto"},[e.loading?t("div",{staticClass:"flex flex-col items-center justify-center h-full text-textMuted"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin text-2xl mb-2"}),t("span",{staticClass:"text-sm"},[e._v("加载中...")])]):e.fileTreeData.length===0?t("div",{staticClass:"flex flex-col items-center justify-center h-full text-textMuted"},[t("i",{staticClass:"fa-solid fa-folder-open text-4xl mb-2 opacity-30"}),t("span",{staticClass:"text-sm"},[e._v("此目录为空")])]):t("div",{staticClass:"divide-y divide-border"},e._l(e.fileTreeData,function(a){return t("div",{key:a.path,staticClass:"flex items-center px-4 py-3 active:bg-active",on:{click:function(l){return e.handleItemClick(a)}}},[t("i",{staticClass:"text-lg w-8 text-center",class:e.getItemIcon(a)}),t("span",{staticClass:"flex-1 text-sm text-white ml-2 truncate"},[e._v(e._s(a.name))]),a.is_directory?t("i",{staticClass:"fa-solid fa-chevron-right text-textMuted text-xs"}):e._e()])}),0)]),e.contextMenu.visible?t("div",{staticClass:"fixed inset-0 bg-black/50 z-50",on:{click:e.hideContextMenu}},[t("div",{staticClass:"absolute bottom-0 left-0 right-0 bg-sidebar rounded-t-xl p-4",on:{click:function(a){a.stopPropagation()}}},[t("div",{staticClass:"w-12 h-1 bg-gray-500 rounded-full mx-auto mb-4"}),t("div",{staticClass:"space-y-1"},[(n=e.contextMenu.target)!=null&&n.is_directory?t("button",{staticClass:"w-full flex items-center gap-3 px-4 py-3 text-white text-sm active:bg-active rounded-lg",on:{click:e.createNewFile}},[t("i",{staticClass:"fa-solid fa-file-lines w-5"}),e._v(" 新建文件 ")]):e._e(),(r=e.contextMenu.target)!=null&&r.is_directory?t("button",{staticClass:"w-full flex items-center gap-3 px-4 py-3 text-white text-sm active:bg-active rounded-lg",on:{click:e.createNewFolder}},[t("i",{staticClass:"fa-solid fa-folder-plus w-5"}),e._v(" 新建文件夹 ")]):e._e(),t("button",{staticClass:"w-full flex items-center gap-3 px-4 py-3 text-white text-sm active:bg-active rounded-lg",on:{click:e.copyPath}},[t("i",{staticClass:"fa-solid fa-copy w-5"}),e._v(" 复制路径 ")]),(o=e.contextMenu.target)!=null&&o.is_directory?e._e():t("button",{staticClass:"w-full flex items-center gap-3 px-4 py-3 text-white text-sm active:bg-active rounded-lg",on:{click:e.openFileItem}},[t("i",{staticClass:"fa-solid fa-folder-open w-5"}),e._v(" 打开文件 ")]),t("button",{staticClass:"w-full flex items-center gap-3 px-4 py-3 text-white text-sm active:bg-active rounded-lg",on:{click:e.renameItem}},[t("i",{staticClass:"fa-solid fa-pen w-5"}),e._v(" 重命名 ")]),t("button",{staticClass:"w-full flex items-center gap-3 px-4 py-3 text-red-400 text-sm active:bg-active rounded-lg",on:{click:e.deleteItem}},[t("i",{staticClass:"fa-solid fa-trash w-5"}),e._v(" 删除 ")])])])]):e._e(),e.inputDialog.visible?t("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",on:{click:function(a){return a.target!==a.currentTarget?null:e.cancelInput.apply(null,arguments)}}},[t("div",{staticClass:"w-full max-w-sm bg-sidebar border border-border rounded-xl p-4"},[t("p",{staticClass:"text-white text-base mb-4"},[e._v(e._s(e.inputDialog.title))]),t("input",{directives:[{name:"model",rawName:"v-model",value:e.inputDialog.value,expression:"inputDialog.value"}],ref:"dialogInput",staticClass:"w-full px-4 py-3 bg-[#1e1e1e] border border-border rounded-lg text-white text-sm focus:outline-none focus:border-accent",attrs:{placeholder:e.inputDialog.placeholder},domProps:{value:e.inputDialog.value},on:{keyup:[function(a){return!a.type.indexOf("key")&&e._k(a.keyCode,"enter",13,a.key,"Enter")?null:e.confirmInput.apply(null,arguments)},function(a){return!a.type.indexOf("key")&&e._k(a.keyCode,"escape",void 0,a.key,void 0)?null:e.cancelInput.apply(null,arguments)}],input:function(a){a.target.composing||e.$set(e.inputDialog,"value",a.target.value)}}}),t("div",{staticClass:"flex gap-3 mt-4"},[t("button",{staticClass:"flex-1 py-3 text-textMuted text-sm rounded-lg",on:{click:e.cancelInput}},[e._v("取消")]),t("button",{staticClass:"flex-1 py-3 bg-accent text-white text-sm rounded-lg",on:{click:e.confirmInput}},[e._v("确定")])])])]):e._e(),e.fileViewerVisible?t("div",{staticClass:"fixed inset-0 bg-black/50 z-50",on:{click:function(a){return a.target!==a.currentTarget?null:e.closeFileViewer.apply(null,arguments)}}},[t("div",{staticClass:"absolute bottom-0 left-0 right-0 bg-[#1e1e1e] rounded-t-2xl flex flex-col",staticStyle:{height:"85vh"}},[e._m(0),t("div",{staticClass:"bg-sidebar border-b border-border px-4 py-2 flex items-center justify-between shrink-0"},[t("span",{staticClass:"text-sm text-white truncate"},[e._v(e._s(e.editingFileName))]),t("div",{staticClass:"flex items-center gap-2"},[t("button",{staticClass:"p-2 text-accent disabled:opacity-50",attrs:{disabled:!e.hasChanges||e.saving,title:"保存"},on:{click:e.saveFile}},[e.saving?t("i",{staticClass:"fa-solid fa-spinner fa-spin"}):t("i",{staticClass:"fa-solid fa-save"})]),t("button",{staticClass:"p-2 text-textMuted hover:text-white",attrs:{title:"关闭"},on:{click:e.closeFileViewer}},[t("i",{staticClass:"fa-solid fa-times"})])])]),t("div",{staticClass:"flex-1 overflow-hidden"},[e.fileLoading?t("div",{staticClass:"flex items-center justify-center h-full text-textMuted"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e.isBinary?t("div",{staticClass:"flex items-center justify-center h-full text-textMuted"},[e._m(1)]):t("div",{ref:"editorContainer",staticClass:"w-full h-full monaco-editor-container"})]),e.hasChanges&&!e.isBinary?t("div",{staticClass:"bg-yellow-600/20 border-t border-yellow-600/30 px-4 py-2 text-yellow-500 text-sm text-center shrink-0"},[e._v(" 文件已修改,Ctrl+S 保存 ")]):e._e()])]):e._e(),e.confirmDialog.visible?t("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4"},[t("div",{staticClass:"w-full max-w-sm bg-sidebar border border-border rounded-xl p-4"},[t("p",{staticClass:"text-white text-base mb-4"},[e._v(e._s(e.confirmDialog.message))]),t("div",{staticClass:"flex gap-3"},[t("button",{staticClass:"flex-1 py-3 text-textMuted text-sm rounded-lg",on:{click:e.cancelConfirm}},[e._v("取消")]),t("button",{staticClass:"flex-1 py-3 bg-red-500 text-white text-sm rounded-lg",on:{click:e.confirmDelete}},[e._v("删除")])])])]):e._e()])},smt=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"flex justify-center pt-3 pb-1 shrink-0"},[e("div",{staticClass:"w-10 h-1 bg-gray-500 rounded-full"})])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"text-center"},[e("i",{staticClass:"fa-solid fa-file text-4xl mb-4 opacity-30"}),e("p",[s._v("二进制文件无法预览")])])}],rmt=Li(imt,nmt,smt,!1,null,"d8b2d27d");const omt=rmt.exports,amt={name:"FileTreeNode",props:{node:{type:Object,required:!0},selectedPath:{type:String,default:""}},data(){return{loading:!1}},methods:{async toggleExpand(){this.node.is_directory&&(!this.node.expanded&&this.node.children.length===0?(this.node.loading=!0,this.$emit("load-children",this.node)):this.node.expanded=!this.node.expanded)},handleClick(){this.node.is_directory?this.toggleExpand():this.$emit("select-node",this.node)},handleLoadChildren(s){this.$emit("load-children",s)},handleSelectNode(s){this.$emit("select-node",s)},getFileIcon(s,e){if(e)return"fa-solid fa-folder";const t=s.split(".").pop().toLowerCase(),i=s.toLowerCase(),n={js:"fa-brands fa-js",jsx:"fa-brands fa-react",ts:"fa-brands fa-js",tsx:"fa-brands fa-react",vue:"fa-brands fa-vuejs",py:"fa-brands fa-python",html:"fa-brands fa-html5",htm:"fa-brands fa-html5",css:"fa-brands fa-css3",scss:"fa-brands fa-sass",json:"fa-solid fa-file-code",yaml:"fa-solid fa-file-code",yml:"fa-solid fa-file-code",md:"fa-solid fa-file-lines",sql:"fa-solid fa-database",sh:"fa-solid fa-terminal",go:"fa-brands fa-golang",java:"fa-brands fa-java",dockerfile:"fa-brands fa-docker"};return i==="dockerfile"?"fa-brands fa-docker":i===".gitignore"?"fa-brands fa-git":n[t]||"fa-solid fa-file"}}};var lmt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"file-tree-node"},[t("div",{staticClass:"node-row",class:{selected:e.selectedPath===e.node.path},on:{click:e.handleClick}},[e.node.is_directory?t("span",{staticClass:"expand-icon",on:{click:function(i){return i.stopPropagation(),e.toggleExpand.apply(null,arguments)}}},[e.node.loading?t("i",{staticClass:"fa-solid fa-spinner fa-spin"}):e.node.expanded?t("i",{staticClass:"fa-solid fa-chevron-down"}):t("i",{staticClass:"fa-solid fa-chevron-right"})]):t("span",{staticClass:"expand-icon placeholder"}),t("span",{staticClass:"node-icon"},[t("i",{class:e.getFileIcon(e.node.name,e.node.is_directory)})]),t("span",{staticClass:"node-name"},[e._v(e._s(e.node.name))])]),e.node.is_directory&&e.node.expanded&&e.node.children&&e.node.children.length>0?t("div",{staticClass:"node-children"},e._l(e.node.children,function(i){return t("FileTreeNode",{key:i.path,attrs:{node:i,"selected-path":e.selectedPath},on:{"load-children":e.handleLoadChildren,"select-node":e.handleSelectNode}})}),1):e._e()])},cmt=[],dmt=Li(amt,lmt,cmt,!1,null,"95a2c18b");const umt=dmt.exports,hmt={name:"FileSelectDrawer",components:{FileTreeNode:umt},props:{visible:{type:Boolean,default:!1}},data(){return{currentPath:"",parentPath:null,fileTreeData:[],selectedPath:"",loading:!1}},computed:{canGoUp(){return this.parentPath!==null&&this.parentPath!==void 0}},watch:{visible(s){s?this.loadFileTree(""):this.reset()}},methods:{reset(){this.currentPath="",this.parentPath=null,this.fileTreeData=[],this.selectedPath="",this.loading=!1},async loadFileTree(s=""){var e,t,i;this.loading=!0;try{const n=await jt.browseFilesystem(s);this.currentPath=((e=n.data)==null?void 0:e.current_path)||s,this.parentPath=(t=n.data)==null?void 0:t.parent_path;const r=(((i=n.data)==null?void 0:i.items)||[]).map(o=>this.transformNode(o));r.sort((o,a)=>o.is_directory===a.is_directory?o.name.localeCompare(a.name):o.is_directory?-1:1),this.fileTreeData=r}catch(n){console.error("加载文件树失败:",n),this.fileTreeData=[]}finally{this.loading=!1}},transformNode(s){return{name:s.name,path:s.path,is_directory:s.is_directory,has_children:s.is_directory,expanded:!1,children:[],loading:!1}},async onLoadChildren(s){var e;try{const i=(((e=(await jt.browseFilesystem(s.path)).data)==null?void 0:e.items)||[]).map(n=>this.transformNode(n));i.sort((n,r)=>n.is_directory===r.is_directory?n.name.localeCompare(r.name):n.is_directory?-1:1),s.children=i,s.expanded=!0}catch(t){console.error("加载子目录失败:",t),s.children=[],s.expanded=!0}finally{s.loading=!1}},onSelectNode(s){this.selectedPath=s.path},goUp(){this.parentPath!==null&&this.parentPath!==void 0&&this.loadFileTree(this.parentPath===""?"":this.parentPath)},goHome(){this.loadFileTree("")},handleConfirm(){this.selectedPath&&(this.$emit("select",this.selectedPath),this.$emit("close"))},handleClose(){this.$emit("close")},getFileIcon(s,e){if(e)return"fa-solid fa-folder";const t=s.split(".").pop().toLowerCase(),i=s.toLowerCase(),n={js:"fa-brands fa-js",jsx:"fa-brands fa-react",ts:"fa-brands fa-js",tsx:"fa-brands fa-react",vue:"fa-brands fa-vuejs",py:"fa-brands fa-python",html:"fa-brands fa-html5",htm:"fa-brands fa-html5",css:"fa-brands fa-css3",scss:"fa-brands fa-sass",json:"fa-solid fa-file-code",yaml:"fa-solid fa-file-code",yml:"fa-solid fa-file-code",md:"fa-solid fa-file-lines",sql:"fa-solid fa-database",sh:"fa-solid fa-terminal",go:"fa-brands fa-golang",java:"fa-brands fa-java",dockerfile:"fa-brands fa-docker"};return i==="dockerfile"?"fa-brands fa-docker":i===".gitignore"?"fa-brands fa-git":n[t]||"fa-solid fa-file"}}};var fmt=function(){var e=this,t=e._self._c;return t("div",[t("div",{staticClass:"drawer-overlay",class:{show:e.visible},on:{click:e.handleClose}}),t("div",{staticClass:"file-drawer",class:{show:e.visible}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title",staticStyle:{color:"#f4f4f5"}},[e._v("选择文件")]),t("button",{staticClass:"drawer-close",on:{click:e.handleClose}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"file-toolbar"},[t("button",{staticClass:"toolbar-btn",attrs:{disabled:!e.canGoUp},on:{click:e.goUp}},[t("i",{staticClass:"fa-solid fa-arrow-up"})]),t("button",{staticClass:"toolbar-btn",on:{click:e.goHome}},[t("i",{staticClass:"fa-solid fa-home"})]),t("div",{staticClass:"file-path"},[e._v(e._s(e.currentPath||"/"))])]),t("div",{staticClass:"file-tree-container"},[e.loading?t("div",{staticClass:"file-loading"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin"}),e._v(" 加载中... ")]):e.fileTreeData.length===0?t("div",{staticClass:"file-empty"},[e._v(" 此目录为空 ")]):e._l(e.fileTreeData,function(i){return t("FileTreeNode",{key:i.path,attrs:{node:i,"selected-path":e.selectedPath},on:{"load-children":e.onLoadChildren,"select-node":e.onSelectNode}})})],2),t("div",{staticClass:"drawer-footer"},[t("div",{staticClass:"selected-path"},[e._v(e._s(e.selectedPath||"未选择"))]),t("button",{staticClass:"confirm-btn",attrs:{disabled:!e.selectedPath},on:{click:e.handleConfirm}},[e._v("选择")])])])])},gmt=[],pmt=Li(hmt,fmt,gmt,!1,null,"bde2b0c6");const mmt=pmt.exports,_mt={name:"ChatViewApp",components:{FileSelectDrawer:mmt},data(){return{sessions:[],currentSessionId:null,currentSession:null,logItems:[],inputMessage:"",isProcessing:!1,modelName:"",promptTokens:0,showSessionDrawer:!1,showModelDrawer:!1,showCommandDrawer:!1,showFileDrawer:!1,searchKeyword:"",models:[],logSeq:0,wsUnsubscribe:null}},computed:{filteredSessions(){if(!this.searchKeyword)return this.sessions;const s=this.searchKeyword.toLowerCase();return this.sessions.filter(e=>(e.title||"").toLowerCase().includes(s))}},async created(){this.initGlobalWs(),await this.loadSessions(),await this.loadModels(),await this.loadDefaultModel();const s=this.$route.params.id;if(s){const e=this.sessions.find(t=>t.id===s);e&&await this.selectSession(e,!1)}},activated(){this.currentSessionId&&this.subscribeSession()},deactivated(){this.wsUnsubscribe&&(this.wsUnsubscribe(),this.wsUnsubscribe=null)},methods:{goBack(){this.$router.push("/views/app")},initGlobalWs(){Ks.init()},closeAllDrawers(){this.showSessionDrawer=!1,this.showModelDrawer=!1,this.showCommandDrawer=!1,this.showFileDrawer=!1},renderMarkdown(s){return s?Zn(s):""},getTodoStatusIcon(s){return{completed:"✅",in_progress:"🔄",pending:"⬜",cancelled:"❌"}[s]||"⬜"},getToolCallName(s){var e;return((e=s==null?void 0:s.function)==null?void 0:e.name)||"unknown"},formatToolArgs(s){var e,t,i;try{const n=JSON.parse(((e=s==null?void 0:s.function)==null?void 0:e.arguments)||"{}");return n.file_path?n.file_path:n.command?n.command:((t=s==null?void 0:s.function)==null?void 0:t.arguments)||""}catch{return((i=s==null?void 0:s.function)==null?void 0:i.arguments)||""}},async loadSessions(){try{const s=await rft();this.sessions=s.data||[]}catch(s){console.error("加载会话失败:",s)}},async loadModels(){try{const s=await jt.getModels();this.models=s.data||[]}catch(s){console.error("加载模型失败:",s)}},async loadDefaultModel(){var s;try{const e=await jt.getConfig("defaultModel");(s=e.data)!=null&&s.value&&(this.modelName=e.data.value)}catch{this.modelName="gpt-4o"}},async selectSession(s,e=!0){this.wsUnsubscribe&&(this.wsUnsubscribe(),this.wsUnsubscribe=null),this.currentSession=s,this.currentSessionId=s.id,this.logItems=[],this.isProcessing=s.status==="processing",e&&this.$route.params.id!==s.id&&this.$router.push({name:"app-ChatViewApp-session",params:{id:s.id}}).catch(()=>{}),await this.loadMessages(),this.subscribeSession(),this.showSessionDrawer=!1},async loadMessages(){try{const s=await dse(this.currentSessionId);this.logItems=(s.data||[]).map(e=>e.type==="think"?{type:"think",content:e.content||"",_id:`log-${++this.logSeq}`}:e.type==="step"?{type:"step",thought:e.thought,toolCalls:e.toolCalls||[],success:e.success,_id:`log-${++this.logSeq}`}:e.type==="chat"?{type:"chat",content:e.content,_id:`log-${++this.logSeq}`}:e.type==="todos"?{type:"todos",todos:e.todos||[],_id:`log-${++this.logSeq}`}:{type:"system",content:String(e),_id:`log-${++this.logSeq}`}),this.scrollToBottom()}catch(s){console.error("加载消息失败:",s)}},subscribeSession(){this.currentSessionId&&(this.wsUnsubscribe&&this.wsUnsubscribe(),this.wsUnsubscribe=Ks.subscribe(this.currentSessionId,{running_sessions:s=>{const e=(s==null?void 0:s.runningSessionIds)||[];this.updateSessionStatus(e)},todos:s=>{this.logItems.push({type:"todos",todos:s.todos,_id:`log-${++this.logSeq}`}),this.scrollToBottom()},session:s=>{s!=null&&s.sessionId&&!this.currentSessionId&&(this.currentSessionId=s.sessionId)},step:s=>{var e;this.logItems.push({type:"step",thought:s==null?void 0:s.thought,toolCalls:(s==null?void 0:s.toolCalls)||[],success:s==null?void 0:s.success,_id:`log-${++this.logSeq}`}),(e=s==null?void 0:s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),this.scrollToBottom()},compact:s=>{this.logItems.push({type:"system",content:`【压缩完成】${s.summary||""}`,_id:`log-${++this.logSeq}`}),this.loadSessions(),this.loadMessages()},done:s=>{var e;this.isProcessing=!1,s!=null&&s.modelName&&(this.modelName=s.modelName),(e=s==null?void 0:s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),s!=null&&s.response&&this.logItems.push({type:"think",content:s.response,_id:`log-${++this.logSeq}`}),this.loadSessions(),this.scrollToBottom()},stopped:()=>{this.isProcessing=!1,this.logItems.push({type:"think",content:"【已停止】",_id:`log-${++this.logSeq}`}),this.scrollToBottom()},error:s=>{this.isProcessing=!1,this.$message.error((s==null?void 0:s.error)||"发生错误")}}))},updateSessionStatus(s){new Set(s||[]).has(this.currentSessionId)?this.isProcessing=!0:this.isProcessing=!1},async createSession(){try{const s=await fB("新会话");this.sessions.unshift(s.data),await this.selectSession(s.data)}catch(s){this.$message.error("创建会话失败: "+s.message)}},sendMessage(){if(!this.inputMessage.trim()||this.isProcessing)return;if(!this.currentSessionId){this.createSession().then(()=>this.sendMessage());return}const s=this.inputMessage.trim();this.inputMessage="",this.isProcessing=!0,this.logItems.push({type:"chat",content:s,_id:`log-${++this.logSeq}`}),this.scrollToBottom(),Ks.send("chat",{message:s,sessionId:this.currentSessionId,modelName:this.modelName||void 0})},stopGeneration(){this.currentSessionId&&(this.isProcessing=!1,Ks.send("stop",{sessionId:this.currentSessionId}))},appendCommand(s){var e;this.inputMessage=s+" ",(e=this.$refs.inputField)==null||e.focus()},openFileSelect(){this.showFileDrawer=!0},onFileSelected(s){var e;this.inputMessage=this.inputMessage+s+" ",this.showFileDrawer=!1,(e=this.$refs.inputField)==null||e.focus()},selectModel(s){const e=s.name.split("/");this.modelName=e.length>2?e.slice(1).join("/"):s.name,jt.setConfig("defaultModel",this.modelName),this.showModelDrawer=!1},formatTime(s){if(!s)return"";const e=new Date(s),i=new Date-e;return i<6e4?"刚刚":i<36e5?Math.floor(i/6e4)+"分钟前":i<864e5?"今天 "+e.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}):i<6048e5?Math.floor(i/864e5)+"天前":e.toLocaleDateString()},scrollToBottom(){this.$nextTick(()=>{this.$refs.chatArea&&(this.$refs.chatArea.scrollTop=this.$refs.chatArea.scrollHeight)})}}};var vmt=function(){var i;var e=this,t=e._self._c;return t("div",{staticClass:"app-container"},[t("header",{staticClass:"header"},[t("a",{staticClass:"header-back",attrs:{href:"#"},on:{click:function(n){return n.preventDefault(),e.goBack.apply(null,arguments)}}},[t("i",{staticClass:"fa-solid fa-chevron-left"})]),t("div",{staticClass:"session-switch-btn",on:{click:function(n){e.showSessionDrawer=!0}}},[t("i",{staticClass:"fa-solid fa-comments"}),t("span",{staticClass:"title"},[e._v(e._s(((i=e.currentSession)==null?void 0:i.title)||"新会话"))]),t("i",{staticClass:"fa-solid fa-chevron-down arrow"})]),t("div",{staticClass:"header-actions"},[t("a",{staticClass:"header-btn",attrs:{href:"#",title:"命令"},on:{click:function(n){n.preventDefault(),e.showCommandDrawer=!0}}},[t("i",{staticClass:"fa-solid fa-terminal"})])])]),t("div",{staticClass:"model-selector"},[t("span",[e._v("模型")]),t("span",{staticClass:"model-name",on:{click:function(n){e.showModelDrawer=!0}}},[e._v(e._s(e.modelName||"gpt-4o"))]),t("span",{staticClass:"model-change",staticStyle:{color:"var(--accent)","font-size":"12px"},on:{click:function(n){e.showModelDrawer=!0}}},[e._v("切换")])]),t("div",{ref:"chatArea",staticClass:"chat-area"},[e.logItems.length===0?t("div",{staticClass:"empty-state"},[e._m(0),t("div",{staticClass:"empty-title"},[e._v("开始对话")]),t("div",{staticClass:"empty-desc"},[e._v("选择或创建会话开始对话")])]):e._e(),e._l(e.logItems,function(n,r){return[n.type==="chat"?[t("div",{staticClass:"message user"},[t("div",{staticClass:"message-bubble"},[e._v(e._s(n.content))])])]:n.type==="think"?[t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble",domProps:{innerHTML:e._s(e.renderMarkdown(n.content))}})])]:n.type==="todos"?[t("div",{staticClass:"message assistant"},[t("div",{staticClass:"todo-list"},e._l(n.todos,function(o,a){return t("div",{key:a,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[e._v(e._s(e.getTodoStatusIcon(o.status)))]),t("span",[e._v(e._s(o.name))])])}),0)])]:n.type==="step"?[n.thought?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble",domProps:{innerHTML:e._s(e.renderMarkdown(n.thought))}})]):e._e(),e._l(n.toolCalls,function(o,a){return t("div",{key:"tc-"+a,staticClass:"tool-log",class:n.success!==!1?"tool-success":"tool-fail"},[t("span",[e._v(e._s(n.success!==!1?"✓":"✗"))]),t("span",{staticClass:"tool-name"},[e._v(e._s(e.getToolCallName(o)))]),t("span",{staticClass:"tool-args"},[e._v(e._s(e.formatToolArgs(o)))])])})]:n.type==="system"?[t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble"},[e._v(e._s(n.content))])])]:e._e()]}),e.isProcessing?t("div",{staticClass:"message assistant thinking"},[t("div",{staticClass:"message-bubble"},[e._v("思考中...")])]):e._e()],2),t("div",{staticClass:"input-area"},[t("div",{staticClass:"input-container"},[t("div",{staticClass:"input-wrapper"},[t("textarea",{directives:[{name:"model",rawName:"v-model",value:e.inputMessage,expression:"inputMessage"}],ref:"inputField",staticClass:"input-field",attrs:{placeholder:"输入消息... (Enter 发送)"},domProps:{value:e.inputMessage},on:{keydown:function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"enter",13,n.key,"Enter")||n.ctrlKey||n.shiftKey||n.altKey||n.metaKey?null:(n.preventDefault(),e.sendMessage.apply(null,arguments))},input:function(n){n.target.composing||(e.inputMessage=n.target.value)}}})]),t("button",{staticClass:"send-btn",class:{"stop-btn":e.isProcessing},attrs:{disabled:!e.inputMessage.trim()&&!e.isProcessing},on:{click:function(n){e.isProcessing?e.stopGeneration():e.sendMessage()}}},[t("i",{class:e.isProcessing?"fa-solid fa-stop":"fa-solid fa-paper-plane"})])]),t("div",{staticClass:"command-quick"},[t("div",{staticClass:"command-chip",on:{click:function(n){return e.appendCommand("/compact")}}},[t("i",{staticClass:"fa-solid fa-compress-alt"}),e._v(" 压缩会话 ")]),t("div",{staticClass:"command-chip",on:{click:function(n){e.showFileDrawer=!0}}},[t("i",{staticClass:"fa-solid fa-file-circle-plus"}),e._v(" 选择文件 ")])])]),t("div",{staticClass:"status-bar"},[t("div",{staticClass:"status-indicator"},[t("span",{staticClass:"status-dot",class:{processing:e.isProcessing}}),t("span",{class:{"status-processing":e.isProcessing,"status-ready":!e.isProcessing}},[e._v(e._s(e.isProcessing?"处理中...":"就绪"))])]),t("span",[e._v("Token: "+e._s(e.promptTokens||0))])]),t("div",{staticClass:"drawer-overlay",class:{show:e.showSessionDrawer||e.showModelDrawer||e.showCommandDrawer},on:{click:e.closeAllDrawers}}),t("FileSelectDrawer",{attrs:{visible:e.showFileDrawer},on:{select:e.onFileSelected,close:function(n){e.showFileDrawer=!1}}}),t("div",{staticClass:"session-drawer",class:{show:e.showSessionDrawer}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title",staticStyle:{color:"var(--text-primary, #f4f4f5)"}},[e._v("选择会话")]),t("button",{staticClass:"drawer-close",on:{click:function(n){e.showSessionDrawer=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"drawer-search"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.searchKeyword,expression:"searchKeyword"}],staticClass:"search-input",attrs:{type:"text",placeholder:"搜索会话..."},domProps:{value:e.searchKeyword},on:{input:function(n){n.target.composing||(e.searchKeyword=n.target.value)}}})]),t("div",{staticClass:"session-list"},e._l(e.filteredSessions,function(n){return t("div",{key:n.id,staticClass:"session-list-item",class:{active:n.id===e.currentSessionId},on:{click:function(r){return e.selectSession(n)}}},[e._m(1,!0),t("div",{staticClass:"session-list-info"},[t("div",{staticClass:"session-list-title"},[e._v(e._s(n.title||"未命名会话"))]),t("div",{staticClass:"session-list-meta"},[e._v(e._s(e.formatTime(n.updatedAt||n.createTime)))])]),t("div",{staticClass:"session-list-status",class:{processing:n.status==="processing"}})])}),0),t("div",{staticClass:"drawer-footer"},[t("button",{staticClass:"new-session-btn",on:{click:e.createSession}},[t("i",{staticClass:"fa-solid fa-plus"}),e._v(" 新建会话 ")])])]),t("div",{staticClass:"session-drawer",class:{show:e.showModelDrawer}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title",staticStyle:{color:"var(--text-primary, #f4f4f5)"}},[e._v("选择模型")]),t("button",{staticClass:"drawer-close",on:{click:function(n){e.showModelDrawer=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"command-list"},e._l(e.models,function(n){return t("div",{key:n.id,staticClass:"command-item",class:{active:n.name===e.modelName},on:{click:function(r){return e.selectModel(n)}}},[e._m(2,!0),t("div",{staticClass:"command-info"},[t("div",{staticClass:"command-name"},[e._v(e._s(n.name))]),t("div",{staticClass:"command-desc"},[e._v(e._s(n.provider||"默认"))])])])}),0)]),t("div",{staticClass:"command-drawer",class:{show:e.showCommandDrawer}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title",staticStyle:{color:"var(--text-primary, #f4f4f5)"}},[e._v("快捷命令")]),t("button",{staticClass:"drawer-close",on:{click:function(n){e.showCommandDrawer=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"command-list"},[t("div",{staticClass:"command-item",on:{click:function(n){e.appendCommand("/compact"),e.showCommandDrawer=!1}}},[e._m(3),e._m(4)]),t("div",{staticClass:"command-item",on:{click:function(n){e.appendCommand("/clear"),e.showCommandDrawer=!1}}},[e._m(5),e._m(6)]),t("div",{staticClass:"command-item",on:{click:function(n){e.openFileSelect(),e.showCommandDrawer=!1}}},[e._m(7),e._m(8)])])])],1)},bmt=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"empty-icon"},[e("i",{staticClass:"fa-regular fa-comments"})])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"session-list-icon"},[e("i",{staticClass:"fa-solid fa-robot"})])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"command-icon"},[e("i",{staticClass:"fa-solid fa-microchip"})])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"command-icon"},[e("i",{staticClass:"fa-solid fa-compress-alt"})])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"command-info"},[e("div",{staticClass:"command-name"},[s._v("压缩会话")]),e("div",{staticClass:"command-desc"},[s._v("减少上下文长度")])])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"command-icon"},[e("i",{staticClass:"fa-solid fa-trash"})])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"command-info"},[e("div",{staticClass:"command-name"},[s._v("清空对话")]),e("div",{staticClass:"command-desc"},[s._v("清空当前会话内容")])])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"command-icon"},[e("i",{staticClass:"fa-solid fa-file-circle-plus"})])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"command-info"},[e("div",{staticClass:"command-name"},[s._v("选择文件")]),e("div",{staticClass:"command-desc"},[s._v("添加参考文件到上下文")])])}],Cmt=Li(_mt,vmt,bmt,!1,null,"2352d831");const jpe=Cmt.exports,ymt={path:"/views/app",component:Zpt,children:[{path:"",name:"app-index",component:tmt,meta:{title:"首页"}},{path:"ChatViewApp",name:"app-ChatViewApp",component:jpe,meta:{title:"对话"}},{path:"ChatViewApp/:id",name:"app-ChatViewApp-session",component:jpe,meta:{title:"对话"}},{path:"FilesViewApp",name:"app-FilesViewApp",component:omt,meta:{title:"文件"}},{path:"GitChangesApp",name:"app-GitChangesApp",component:()=>rt(()=>import("./gitChangesApp-o1xUwMZ_.js"),__vite__mapDeps([2,3])),meta:{title:"Git 变更"}},{path:"DevWorkflowViewApp",name:"app-DevWorkflowViewApp",component:()=>rt(()=>import("./devWorkflowViewApp-CKSoqveu.js"),__vite__mapDeps([4,5])),meta:{title:"软件研发"}},{path:"settings",name:"app-settings",component:uke,meta:{title:"设置"}}]};Is.use(gve);const wmt=[{path:"/",redirect:"/views/pc/planAndCode"},ymt,{path:"/views/pc",component:()=>rt(()=>import("./PcLayout-DEP-5oVL.js"),__vite__mapDeps([6,7])),children:[{path:"",redirect:"/views/pc/planAndCode"},{path:"planAndCode",name:"planAndCode",component:zpe,meta:{title:"计划编码"}},{path:"planAndCode/:id",name:"planAndCode-session",component:zpe,meta:{title:"计划编码"}},{path:"files",name:"files",component:Ygt,meta:{title:"文件管理"}},{path:"fileZihao",name:"fileZihao",component:()=>rt(()=>import("./fileZihao-0UKigAgL.js"),[]),meta:{title:"文件互联"}},{path:"skills",name:"skills",component:Vpt,meta:{title:"Skill 管理"}},{path:"terminal",name:"terminal",component:()=>rt(()=>import("./terminalView-D9LlaS3g.js"),__vite__mapDeps([8,9])),meta:{title:"终端"}},{path:"terminal/:id",name:"terminal-session",component:()=>rt(()=>import("./terminalView-D9LlaS3g.js"),__vite__mapDeps([8,9])),meta:{title:"终端"}},{path:"db",name:"db",component:Upt,meta:{title:"数据库"}},{path:"aiLogs",name:"aiLogs",component:()=>rt(()=>import("./aiLogsView-i3_vXGdn.js"),[]),meta:{title:"AI 日志"}},{path:"tasks",name:"tasks",component:()=>rt(()=>import("./taskView-BlSL_Dow.js"),[]),meta:{title:"任务列表"}},{path:"devWorkflow",name:"devWorkflow",component:()=>rt(()=>import("./devWorkflowView-U4v8ICoZ.js"),__vite__mapDeps([10,11,12])),meta:{title:"软件研发"}},{path:"settings",name:"settings",component:uke,meta:{title:"设置"}},{path:"git-changes",name:"gitChanges",component:()=>rt(()=>import("./gitChanges-B9i4hT7g.js"),[]),meta:{title:"Git 变更"}},{path:"custom-actions",name:"customActions",component:()=>rt(()=>import("./customActionsView-IPBMHLn5.js"),[]),meta:{title:"自定义操作"}},{path:"wiki",name:"wiki",component:()=>rt(()=>import("./wikiView-DDMiaAjr.js"),__vite__mapDeps([13,14])),meta:{title:"文档"}},{path:"deploy",name:"deploy",component:()=>rt(()=>import("./deployView-6_rjjo9r.js"),__vite__mapDeps([15,16])),meta:{title:"部署"}},{path:"designView",name:"designView",component:()=>rt(()=>import("./designView-cX2Hqfh8.js"),__vite__mapDeps([17,11,18])),meta:{title:"软件设计"}}]}],hke=new gve({mode:"hash",routes:wmt});hke.afterEach(s=>{var e;(e=s.meta)!=null&&e.title&&(document.title=`${s.meta.title} - TXCode`)});Is.use(POe);Is.prototype.$api=jt;Is.config.productionTip=!1;new Is({router:hke,render:s=>s(FOe)}).$mount("#app");const fke=document.createElement("style");fke.textContent=".v-modal { z-index: 1999 !important; }";document.head.appendChild(fke);export{jgt as C,lke as D,rke as F,xft as G,ike as I,ix as K,Xht as M,cse as R,oke as S,jt as a,aJ as b,cke as c,tx as d,Dg as e,nke as f,Zn as g,Vft as h,Oft as i,Eft as j,ake as k,mmt as l,dse as m,Li as n,jN as o,oJ as s,p0e as t,dke as u,Ks as w};
|
|
959
|
+
用户输入: ${e}`,sessionId:s.sessionId,modelName:s.modelName,agent:"discuss",mediaFiles:i.map(n=>({filePath:n.filePath,type:n.type}))}),s.mediaFiles=[]},stopDiscussPanel(){!this.discussPanel.sessionId||this.discussPanel.stopping||(this.discussPanel.stopping=!0,Ks.send("stop",{sessionId:this.discussPanel.sessionId}))},async renameDiscuss(s,e){const t={...this.currentPlanSession.meta},i=t.discussSessions.findIndex(n=>n.id===s.id);i>-1&&(t.discussSessions[i].title=e,t.updatedAt=new Date().toISOString(),await TD(this.planFolderName,t),this.currentPlanSession.meta=t,this.currentDiscuss&&this.currentDiscuss.id===s.id&&(this.currentDiscuss.title=e))},async deleteDiscuss(s){const e={...this.currentPlanSession.meta};if(e.discussSessions=e.discussSessions.filter(t=>t.id!==s.id),e.updatedAt=new Date().toISOString(),s.sessionId)try{await oft(s.sessionId)}catch{}await TD(this.planFolderName,e),this.currentPlanSession.meta=e,this.currentDiscuss&&this.currentDiscuss.id===s.id&&(this.discussPanel.wsUnsubscribe&&(this.discussPanel.wsUnsubscribe(),this.discussPanel.wsUnsubscribe=null),this.currentDiscuss=null,this.discussPanel=this.createPanel(),e.discussSessions.length&&await this.switchDiscuss(e.discussSessions[0]))},pushLogItem(s,e){s.logItems.push(this.withLogId(e));const t=this.$options.MAX_LOG_ITEMS;s.logItems.length>t&&s.logItems.splice(0,s.logItems.length-t)},stopThinking(s){s.disabled=!1,s.stopping=!1,s.sessionStatus="idle"},scrollCodeToBottom(s=!1){const e=this.$refs.chatPanel;e&&e.scrollToBottom(s)},scrollAfterUpdate(s){s==="code"?this.scrollCodeToBottom():s==="design"?this.$refs.planAssistant&&this.$refs.planAssistant.scrollDesignToBottom():s==="discuss"&&this.$refs.planAssistant&&this.$refs.planAssistant.scrollDiscussToBottom()},subscribePanel(s,e){s.sessionId&&(s.wsUnsubscribe&&s.wsUnsubscribe(),s.wsUnsubscribe=Ks.subscribe(s.sessionId,{todos:t=>{this.pushLogItem(s,{type:"todos",todos:t.todos}),this.scrollAfterUpdate(e)},step:t=>{var i;this.pushLogItem(s,this.createStepItem(t)),(i=t==null?void 0:t.usage)!=null&&i.promptTokens&&(s.promptTokens=t.usage.promptTokens),this.scrollAfterUpdate(e)},compact:()=>{e==="code"&&this.loadMessages(s,s.sessionId)},done:t=>{var i;t!=null&&t.sessionId&&s.sessionId&&t.sessionId!==s.sessionId||(this.stopThinking(s),s.sessionStatus="completed",t!=null&&t.modelName&&(s.modelName=t.modelName),(i=t==null?void 0:t.usage)!=null&&i.promptTokens&&(s.promptTokens=t.usage.promptTokens),t!=null&&t.response&&(this.pushLogItem(s,this.createThinkItem(t.response)),this.scrollAfterUpdate(e)),e==="design"&&this.loadPlanContent())},stopped:()=>{this.stopThinking(s),this.pushLogItem(s,this.createThinkItem("【已停止】")),this.scrollAfterUpdate(e)},error:t=>{this.$message.error((t==null?void 0:t.error)||"发生错误"),this.stopThinking(s)},running_sessions:t=>{const i=t.runningSessionIds||[];s.sessionId&&i.includes(s.sessionId)?(s.disabled=!0,s.sessionStatus="processing"):s.stopping||(s.disabled=!1,s.sessionStatus="idle")}}))},async loadMessages(s,e){try{const t=await dse(e);s.logItems=(t.data||[]).map(i=>i.type==="think"?this.withLogId(this.createThinkItem(i.content||"")):i.type==="step"?this.withLogId(this.createStepItem(i)):i.type==="chat"&&i.mediaFiles?this.withLogId({type:"chat",content:i.content,mediaFiles:i.mediaFiles}):this.withLogId(i))}catch{s.logItems=[]}},unsubscribeAll(){[this.codePanel,this.designPanel,this.discussPanel].forEach(s=>{s.sessionStatus!=="running"&&s.wsUnsubscribe&&(s.wsUnsubscribe(),s.wsUnsubscribe=null)})},resubscribeActive(){this.codePanel.sessionId&&this.codePanel.sessionStatus!=="running"&&this.subscribePanel(this.codePanel,"code"),this.designPanel.sessionId&&this.designPanel.sessionStatus!=="running"&&this.subscribePanel(this.designPanel,"design"),this.discussPanel.sessionId&&this.discussPanel.sessionStatus!=="running"&&this.subscribePanel(this.discussPanel,"discuss")},subscribeRunningSessions(){this.unsubRunning||(this.unsubRunning=Ks.on("running_sessions",s=>{var t;const e=((t=s.data)==null?void 0:t.runningSessionIds)||[];this.runningSessionIds=e,this.updateTaskStatus(e)}))},unsubscribeRunning(){this.unsubRunning&&(this.unsubRunning(),this.unsubRunning=null)},_unsubRename(){this._renameUnsub&&(this._renameUnsub(),this._renameUnsub=null)},_subRename(){this._unsubRename(),this._renameUnsub=Ks.on("rename",s=>{const e=s.data||s;if(!e.folderName||!e.sessionName)return;const t=this.planSessions.find(i=>i.folderName===e.folderName);t&&this.renamePlanSession(t,e.sessionName)})},updateTaskStatus(s){var i,n,r;const e=[this.codePanel.sessionId,this.designPanel.sessionId,(i=this.currentDiscuss)==null?void 0:i.sessionId,(r=(n=this.currentPlanSession)==null?void 0:n.meta)==null?void 0:r.testSessionId].filter(Boolean);if(e.length===0){this.taskStatus="idle";return}e.some(o=>s.includes(o))?this.taskStatus="running":this.taskStatus==="running"&&(this.taskStatus="idle")},updateTitle(){const s=this.taskStatus==="running"?"⏳ ":"";document.title=`${s}TXCode`},getStoreKey(s){return`txcode:plan-code:${s}:state`},loadState(s){if(!s)return null;try{const e=localStorage.getItem(this.getStoreKey(s));return e?JSON.parse(e):null}catch{return null}},saveState(){if(!this.planFolderName)return;const s=this.getStoreKey(this.planFolderName),e=this.loadState(this.planFolderName)||{};e.currentMode=this.currentMode,localStorage.setItem(s,JSON.stringify(e))},saveCodeScrollTop(){if(!this.planFolderName)return;const s=this.getStoreKey(this.planFolderName),e=this.loadState(this.planFolderName)||{},t=this.$refs.chatPanel;e.codeScrollTop=t?t.getScrollTop():0,localStorage.setItem(s,JSON.stringify(e))},restoreCodeScrollTop(){if(!this.planFolderName)return;const s=this.loadState(this.planFolderName);s&&s.codeScrollTop!=null&&this.$nextTick(()=>{const e=this.$refs.chatPanel;e&&e.setScrollTop(s.codeScrollTop)})},openModelSelector(s){this.modelSelectTarget=s,this.modelSelectVisible=!0},onModelSelected(s){const e=s.name.split("/").length>2?s.name.split("/").slice(1).join("/"):s.name;this.codePanel.modelName=e,this.designPanel.modelName=e,this.discussPanel.modelName=e,gft("defaultModel",e)},async loadDefaultModel(){var s;try{const e=await fft("defaultModel");(s=e.data)!=null&&s.value&&(this.codePanel.modelName=e.data.value,this.designPanel.modelName=e.data.value,this.discussPanel.modelName=e.data.value)}catch{}},handleStatusAction(s){switch(s){case"open-model":this.openModelSelector("code");break;case"open-command":this.commandDialogVisible=!0;break;case"open-file":this.fileSelectVisible=!0;break;case"open-skill":this.skillSelectVisible=!0;break;case"open-design":this.designSelectVisible=!0;break}},onFileSelected(s){this.codePanel.input=this.codePanel.input+s+" ",this.fileSelectVisible=!1},onSkillSelected(s){this.codePanel.input="[Skill:"+s+"] "+this.codePanel.input,this.skillSelectVisible=!1},openImagePreview(s){this.previewImage=s},closeImagePreview(){this.previewImage=null},onDesignSelected(s){const e=`[设计:${s.name}](${s.path}) `;this.codePanel.input+=e,this.designSelectVisible=!1},handleExecuteCommand(s){this.codePanel.input=s+" ",this.$nextTick(()=>{const e=this.$el.querySelector(".code-input-area textarea");e&&e.focus()})},async loadCustomActions(){try{const{request:s}=await rt(async()=>{const{request:t}=await Promise.resolve().then(()=>sft);return{request:t}},void 0),e=await s("GET","/custom_action/list_custom_action?type=code");this.customActions=e.data||[]}catch(s){console.error("Load custom actions failed:",s)}},executeCustomAction(s){this.codePanel.input=s.prompt,this.$nextTick(()=>{const e=this.$el.querySelector(".code-input-area textarea");e&&e.focus(),s.auto_send&&this.sendToCodePanel()})},handleCreateSubScheme(){this.subSchemeVisible=!0},async onSubSchemeConfirm(){try{const s=this.planFilePath;await $pe("新计划会话",s),await this.loadPlanSessions();const e=this.planSessions[0];e&&await this.selectPlanSession(e),this.subSchemeVisible=!1}catch(s){this.$message.error("创建子方案失败: "+s.message)}},handleExport(){if(!this.planFilePath){this.$message.warning("请先选择方案");return}const s=this.planFilePath.split("/").pop()||"方案.md",e=`/api/file/download_file?path=${encodeURIComponent(this.planFilePath)}`,t=document.createElement("a");t.href=e,t.download=s,document.body.appendChild(t),t.click(),document.body.removeChild(t)},onTestSessionCreated(s){this.testSessionId=s;const e={...this.currentPlanSession.meta,testSessionId:s};TD(this.planFolderName,e),this.currentPlanSession.meta=e},onResizeStart(s){const e=s.clientX,t=this.resizeWidth,i=r=>{this.resizeWidth=Math.max(280,Math.min(700,t+(e-r.clientX)))},n=()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",n),document.body.style.cursor="",document.body.style.userSelect="",this.$refs.planEditor&&this.$refs.planEditor.layout()};document.addEventListener("mousemove",i),document.addEventListener("mouseup",n),document.body.style.cursor="col-resize",document.body.style.userSelect="none"}}};var fgt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"app-container"},[t("PlanSessionSidebar",{attrs:{sessions:e.planSessions,"current-folder-name":e.currentPlanSession?e.currentPlanSession.folderName:"","running-session-ids":e.runningSessionIds},on:{create:e.createPlanSession,select:e.selectPlanSession,rename:e.renamePlanSession,delete:e.deletePlanSession}}),t("div",{staticClass:"main-area"},[t("div",{staticClass:"mode-float"},[t("button",{staticClass:"mode-tab",class:{active:e.currentMode==="plan"},on:{click:function(i){return e.switchMode("plan")}}},[e._v("方案模式")]),t("button",{staticClass:"mode-tab",class:{active:e.currentMode==="code"},on:{click:function(i){return e.switchMode("code")}}},[e._v("编码模式")])]),e.currentPlanSession?t("div",{staticClass:"content-area"},[t("ChatPanel",{ref:"chatPanel",attrs:{visible:e.currentMode==="code",panel:e.codePanel,"session-name":e.currentPlanSession.meta.sessionName||e.currentPlanSession.folderName,"plan-file-path":e.planFilePath,"custom-actions":e.customActions,"status-actions":e.statusActions,"hide-status-bar":!0,placeholder:"输入消息... (Enter 发送, Ctrl+Enter 换行, @ 选择文件)"},on:{send:e.sendToCodePanel,stop:e.stopCodePanel,"paste-image":i=>e._uploadFiles(i,e.codePanel),"files-selected":i=>e._uploadFiles(i,e.codePanel),"remove-media":i=>e.removeMedia(e.codePanel,i),"custom-action":e.executeCustomAction,"status-action":e.handleStatusAction,"fill-dev-plan":e.fillDevPlan,"open-git-changes":function(i){e.gitChangesDialogVisible=!0},"preview-image":e.openImagePreview,"open-model":function(i){return e.openModelSelector("code")},"open-test":function(i){e.testDialogVisible=!0}}}),t("PlanEditor",{ref:"planEditor",attrs:{visible:e.currentMode==="plan",content:e.planContent,"plan-file-path":e.planFilePath},on:{save:e.savePlanContent,refresh:e.loadPlanContent,export:e.handleExport,"create-sub-scheme":e.handleCreateSubScheme,"generate-code":e.fillDevPlan}}),t("div",{ref:"resizeHandleEl",staticClass:"resize-handle",class:{visible:e.currentMode==="plan"},on:{mousedown:e.onResizeStart}}),t("PlanAssistant",{ref:"planAssistant",attrs:{visible:e.currentMode==="plan",width:e.resizeWidth,"design-panel":e.designPanel,"discuss-panel":e.discussPanel,"discuss-sessions":e.discussSessions,"current-discuss":e.currentDiscuss,"plan-file-path":e.planFilePath},on:{sendDesign:e.sendDesignMessage,stopDesign:e.stopDesignPanel,sendDiscuss:e.sendDiscussMessage,stopDiscuss:e.stopDiscussPanel,switchDiscuss:e.switchDiscuss,createDiscuss:e.createDiscuss,renameDiscuss:e.renameDiscuss,deleteDiscuss:e.deleteDiscuss,openModel:function(i){return e.openModelSelector("design")}}})],1):t("div",{staticClass:"content-area empty-content"},[t("div",{staticClass:"chat-empty",staticStyle:{height:"100%"}},[t("span",{staticClass:"chat-empty-icon"},[e._v("📋")]),t("p",[e._v("选择或创建一个计划会话开始")]),t("button",{staticClass:"sidebar-new-btn",staticStyle:{"margin-top":"12px","font-size":"13px",padding:"6px 16px"},on:{click:e.createPlanSession}},[e._v("+ 新建会话")])])])]),t("ModelSelectDialog",{attrs:{visible:e.modelSelectVisible,"current-model":e.modelSelectTarget==="code"?e.codePanel.modelName:e.designPanel.modelName},on:{"update:visible":function(i){e.modelSelectVisible=i},select:e.onModelSelected}}),t("FileSelectDialog",{attrs:{visible:e.fileSelectVisible},on:{"update:visible":function(i){e.fileSelectVisible=i},select:e.onFileSelected,close:function(i){e.fileSelectVisible=!1}}}),t("SkillSelectDialog",{attrs:{visible:e.skillSelectVisible},on:{"update:visible":function(i){e.skillSelectVisible=i},select:e.onSkillSelected,close:function(i){e.skillSelectVisible=!1}}}),t("DesignSelectDialog",{attrs:{visible:e.designSelectVisible},on:{"update:visible":function(i){e.designSelectVisible=i},select:e.onDesignSelected,close:function(i){e.designSelectVisible=!1}}}),t("CommandDialog",{attrs:{visible:e.commandDialogVisible},on:{"update:visible":function(i){e.commandDialogVisible=i},execute:e.handleExecuteCommand}}),t("CreateSubPlanDialog",{attrs:{visible:e.subSchemeVisible},on:{"update:visible":function(i){e.subSchemeVisible=i},confirm:e.onSubSchemeConfirm,cancel:function(i){e.subSchemeVisible=!1}}}),e.previewImage?t("div",{staticClass:"image-lightbox",on:{click:e.closeImagePreview}},[t("span",{staticClass:"lightbox-close",on:{click:e.closeImagePreview}},[e._v("×")]),t("img",{staticClass:"lightbox-image",attrs:{src:e.previewImage.url||e.previewImage.dataUrl||e.previewImage.filePath},on:{click:function(i){i.stopPropagation()}}})]):e._e(),t("PlanCodeTest",{attrs:{visible:e.testDialogVisible,"plan-file-path":e.planFilePath,"folder-name":e.planFolderName,"model-name":e.codePanel.modelName},on:{"update:visible":function(i){e.testDialogVisible=i},"test-session-created":e.onTestSessionCreated}}),t("GitChangesDialog",{attrs:{visible:e.gitChangesDialogVisible},on:{"update:visible":function(i){e.gitChangesDialogVisible=i}}})],1)},ggt=[],pgt=Li(hgt,fgt,ggt,!1,null,"34e924f7");const zpe=pgt.exports,mgt={name:"ProviderList",props:{providers:{type:Array,default:()=>[]},models:{type:Array,default:()=>[]},songbingProvider:{type:Object,default:null}},emits:["add-provider","edit-provider","delete-provider","add-model","edit-model","delete-model","export-config","import-config","auth-songbing","sync-songbing-models","cancel-songbing-auth"],data(){return{expandedProviders:[]}},computed:{nonOfficialProviders(){return this.providers.filter(s=>s.name!=="自建AI平台")},songbingModels(){return this.songbingProvider?this.models.filter(s=>s.providerId===this.songbingProvider.id):[]},songbingBaseUrl(){var s;return((s=this.songbingProvider)==null?void 0:s.baseUrl)||""},songbingPlatformUrl(){return this.songbingBaseUrl.replace(/\/api\/v1$/,"")}},methods:{toggleProvider(s){const e=this.expandedProviders.indexOf(s);e>-1?this.expandedProviders.splice(e,1):this.expandedProviders.push(s)},getModelsByProvider(s){return this.models.filter(e=>e.providerId===s)}}};var _gt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"provider-list"},[t("div",{staticClass:"flex justify-between items-center mb-4"},[t("h3",{staticClass:"text-xl text-white"},[e._v("AI 服务商 & 模型")]),t("div",{staticClass:"flex gap-2"},[t("el-button",{attrs:{size:"small"},on:{click:function(i){return e.$emit("export-config")}}},[t("i",{staticClass:"fa-solid fa-download mr-1"}),e._v("导出配置 ")]),t("el-button",{attrs:{size:"small"},on:{click:function(i){return e.$emit("import-config")}}},[t("i",{staticClass:"fa-solid fa-upload mr-1"}),e._v("导入配置 ")]),t("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(i){return e.$emit("add-provider")}}},[e._v("+ 添加服务商")])],1)]),t("div",{staticClass:"providers"},[t("div",{staticClass:"provider-item official-provider"},[t("div",{staticClass:"provider-main",on:{click:function(i){return e.toggleProvider("songbing-official")}}},[t("span",{staticClass:"expand-icon",class:{expanded:e.expandedProviders.includes("songbing-official")}},[e._v("▶")]),t("div",{staticClass:"provider-logo official-logo"},[e._v("S")]),t("div",{staticClass:"provider-info"},[t("div",{staticClass:"provider-name"},[e._v(" 自建AI平台 "),e.songbingProvider?t("el-tag",{attrs:{type:"success",size:"mini"}},[e._v("已认证")]):e._e()],1),t("div",{staticClass:"provider-url"},[e._v(e._s(e.songbingPlatformUrl))])]),t("div",{staticClass:"provider-actions"},[t("el-button",{attrs:{type:"warning",size:"small"},on:{click:function(i){return i.stopPropagation(),e.$emit("auth-songbing")}}},[e._v(" "+e._s(e.songbingProvider?"重新认证":"认证")+" ")]),t("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(i){return i.stopPropagation(),e.$emit("sync-songbing-models")}}},[e._v(" 同步模型 ")]),e.songbingProvider?t("el-button",{attrs:{type:"danger",size:"small"},on:{click:function(i){return i.stopPropagation(),e.$emit("cancel-songbing-auth")}}},[e._v(" 取消认证 ")]):e._e()],1)]),t("div",{staticClass:"models-panel",class:{expanded:e.expandedProviders.includes("songbing-official")}},[e._l(e.songbingModels,function(i){return t("div",{key:i.id,staticClass:"model-item"},[t("span",{staticClass:"model-name"},[e._v(e._s(i.name))]),i.enabled?t("el-tag",{attrs:{type:"success",size:"mini"}},[e._v("启用")]):t("el-tag",{attrs:{type:"info",size:"mini"}},[e._v("禁用")])],1)}),e.songbingModels.length===0?t("div",{staticClass:"empty-models"},[e._v(" 暂无模型,请先认证后同步 ")]):e._e()],2)]),e._l(e.nonOfficialProviders,function(i){return t("div",{key:i.id,staticClass:"provider-item"},[t("div",{staticClass:"provider-main",on:{click:function(n){return e.toggleProvider(i.id)}}},[t("span",{staticClass:"expand-icon",class:{expanded:e.expandedProviders.includes(i.id)}},[e._v("▶")]),t("div",{staticClass:"provider-logo"},[e._v(e._s(i.name.charAt(0).toUpperCase()))]),t("div",{staticClass:"provider-info"},[t("div",{staticClass:"provider-name"},[e._v(" "+e._s(i.name)+" "),i.isDefault?t("el-tag",{attrs:{type:"success",size:"mini"}},[e._v("默认")]):e._e()],1),t("div",{staticClass:"provider-url"},[e._v(e._s(i.baseUrl))])]),t("div",{staticClass:"provider-actions"},[t("el-button",{attrs:{type:"text",size:"small"},on:{click:function(n){return n.stopPropagation(),e.$emit("edit-provider",i)}}},[e._v("修改")]),t("el-button",{staticClass:"delete-btn",attrs:{type:"text",size:"small"},on:{click:function(n){return n.stopPropagation(),e.$emit("delete-provider",i.id)}}},[e._v("删除")])],1)]),t("div",{staticClass:"models-panel",class:{expanded:e.expandedProviders.includes(i.id)}},[t("div",{staticClass:"models-header"},[t("span",{staticClass:"models-title"},[e._v("模型列表")]),t("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(n){return n.stopPropagation(),e.$emit("add-model",i.id)}}},[e._v("+ 添加模型")])],1),e._l(e.getModelsByProvider(i.id),function(n){return t("div",{key:n.id,staticClass:"model-item"},[t("span",{staticClass:"model-name"},[e._v(e._s(n.name))]),n.enabled?t("el-tag",{attrs:{type:"success",size:"mini"}},[e._v("启用")]):t("el-tag",{attrs:{type:"info",size:"mini"}},[e._v("禁用")]),t("div",{staticClass:"model-actions"},[t("el-button",{attrs:{type:"text",size:"small"},on:{click:function(r){return r.stopPropagation(),e.$emit("edit-model",n)}}},[e._v("修改")]),t("el-button",{staticClass:"delete-btn",attrs:{type:"text",size:"small"},on:{click:function(r){return r.stopPropagation(),e.$emit("delete-model",n.id)}}},[e._v("删除")])],1)],1)}),e.getModelsByProvider(i.id).length===0?t("div",{staticClass:"empty-models"},[e._v(" 暂无模型 ")]):e._e()],2)])}),e.nonOfficialProviders.length===0?t("div",{staticClass:"empty"},[e._v(" 暂无服务商 ")]):e._e()],2)])},vgt=[],bgt=Li(mgt,_gt,vgt,!1,null,"df73201c");const Cgt=bgt.exports,ygt={name:"ProviderDialog",props:{visible:{type:Boolean,default:!1},editingProvider:{type:Object,default:null}},data(){return{selectedPreset:"",originalApiKey:"",presets:[{name:"openai",label:"OpenAI",nameValue:"OpenAI",baseUrlValue:"https://api.openai.com/v1"},{name:"deepseek",label:"DeepSeek",nameValue:"DeepSeek",baseUrlValue:"https://api.deepseek.com/v1"},{name:"minimax",label:"MiniMax",nameValue:"MiniMax",baseUrlValue:"https://api.minimax.io/v1"},{name:"zlm",label:"ZLM",nameValue:"ZLM",baseUrlValue:"https://open.bigmodel.cn/api/paas/v4/"},{name:"qwen",label:"Qwen",nameValue:"Qwen",baseUrlValue:"https://dashscope-intl.aliyuncs.com/compatible-mode/v1"},{name:"xiaomi_mimo",label:"Xiaomi Mimo",nameValue:"Xiaomi Mimo",baseUrlValue:"https://api.xiaomimimo.com/v1"},{name:"openrouter",label:"OpenRouter",nameValue:"OpenRouter",baseUrlValue:"https://openrouter.ai/api/v1"},{name:"custom",label:"自定义",nameValue:"",baseUrlValue:""}],form:{name:"",apiKey:"",baseUrl:""},rules:{name:[{required:!0,message:"请输入名称",trigger:"blur"}],apiKey:[{required:!0,message:"请输入 API Key",trigger:"blur"}]}}},watch:{visible(s){s&&this.editingProvider?this.loadProviderDetail():s&&(this.selectedPreset="",this.originalApiKey="",this.form={name:"",apiKey:"",baseUrl:""})}},methods:{async loadProviderDetail(){var s;try{const e=await this.$api.getProvider(this.editingProvider.id);this.originalApiKey=((s=e.data)==null?void 0:s.apiKey)||"",this.form={name:this.editingProvider.name,apiKey:this.originalApiKey,baseUrl:this.editingProvider.baseUrl||""}}catch{this.form={name:this.editingProvider.name,apiKey:"",baseUrl:this.editingProvider.baseUrl||""}}},onPresetChange(s){const e=this.presets.find(t=>t.name===s);e&&(this.form.name=e.nameValue,this.form.baseUrl=e.baseUrlValue)},handleClose(){var s;(s=this.$refs.formRef)==null||s.resetFields(),this.selectedPreset="",this.originalApiKey="",this.$emit("update:visible",!1),this.$emit("close")},async handleSubmit(){try{await this.$refs.formRef.validate()}catch{return}try{if(this.editingProvider){const s={name:this.form.name,baseUrl:this.form.baseUrl};this.form.apiKey&&this.form.apiKey!==this.originalApiKey&&(s.apiKey=this.form.apiKey),await this.$api.updateProvider(this.editingProvider.id,s),this.$message.success("更新成功")}else await this.$api.addProvider(this.form),this.$message.success("添加成功");this.$emit("success"),this.handleClose()}catch(s){this.$message.error("保存失败: "+s.message)}}}};var wgt=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{title:e.editingProvider?"编辑服务商":"添加服务商",visible:e.visible,width:"500px"},on:{"update:visible":function(i){e.visible=i},close:e.handleClose}},[t("el-form",{ref:"formRef",attrs:{model:e.form,rules:e.rules,"label-width":"100px"}},[e.editingProvider?e._e():t("el-form-item",{attrs:{label:"预设模板"}},[t("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"选择预设或自定义"},on:{change:e.onPresetChange},model:{value:e.selectedPreset,callback:function(i){e.selectedPreset=i},expression:"selectedPreset"}},e._l(e.presets,function(i){return t("el-option",{key:i.name,attrs:{label:i.label,value:i.name}})}),1)],1),t("el-form-item",{attrs:{label:"名称",prop:"name"}},[t("el-input",{attrs:{placeholder:"例如: OpenAI"},model:{value:e.form.name,callback:function(i){e.$set(e.form,"name",i)},expression:"form.name"}})],1),t("el-form-item",{attrs:{label:"API Key",prop:"apiKey"}},[t("el-input",{attrs:{placeholder:e.editingProvider?"留空则不修改":"sk-..."},model:{value:e.form.apiKey,callback:function(i){e.$set(e.form,"apiKey",i)},expression:"form.apiKey"}}),e.editingProvider&&e.originalApiKey?t("div",{staticClass:"form-tip"},[e._v("当前已设置 API Key")]):e._e()],1),t("el-form-item",{attrs:{label:"Base URL",prop:"baseUrl"}},[t("el-input",{attrs:{placeholder:"https://api.openai.com/v1"},model:{value:e.form.baseUrl,callback:function(i){e.$set(e.form,"baseUrl",i)},expression:"form.baseUrl"}})],1)],1),t("span",{attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:e.handleClose}},[e._v("取消")]),t("el-button",{attrs:{type:"primary"},on:{click:e.handleSubmit}},[e._v("保存")])],1)],1)},Sgt=[],xgt=Li(ygt,wgt,Sgt,!1,null,"1529f1f1");const kgt=xgt.exports,Lgt={name:"ModelDialog",props:{visible:{type:Boolean,default:!1},editingModel:{type:Object,default:null},providers:{type:Array,default:()=>[]},defaultProviderId:{type:String,default:""}},data(){return{form:{providerId:"",name:"",enabled:!0},rules:{providerId:[{required:!0,message:"请选择服务商",trigger:"blur"}],name:[{required:!0,message:"请输入模型名称",trigger:"blur"}]}}},watch:{visible(s){s&&(this.editingModel?this.form={providerId:this.editingModel.providerId,name:this.editingModel.name,enabled:this.editingModel.enabled}:this.form={providerId:this.defaultProviderId||"",name:"",enabled:!0})}},methods:{handleClose(){var s;(s=this.$refs.formRef)==null||s.resetFields(),this.$emit("update:visible",!1),this.$emit("close")},async handleSubmit(){try{await this.$refs.formRef.validate()}catch{return}try{this.editingModel?(await this.$api.updateModel(this.editingModel.id,{name:this.form.name,enabled:this.form.enabled}),this.$message.success("更新成功")):(await this.$api.addModel(this.form),this.$message.success("添加成功")),this.$emit("success"),this.handleClose()}catch(s){this.$message.error("保存失败: "+s.message)}}}};var Dgt=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{title:e.editingModel?"编辑模型":"添加模型",visible:e.visible,width:"500px"},on:{"update:visible":function(i){e.visible=i},close:e.handleClose}},[t("el-form",{ref:"formRef",attrs:{model:e.form,rules:e.rules,"label-width":"100px"}},[e.editingModel?e._e():t("el-form-item",{attrs:{label:"所属服务商",prop:"providerId"}},[t("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"选择服务商"},model:{value:e.form.providerId,callback:function(i){e.$set(e.form,"providerId",i)},expression:"form.providerId"}},e._l(e.providers,function(i){return t("el-option",{key:i.id,attrs:{label:i.name,value:i.id}})}),1)],1),t("el-form-item",{attrs:{label:"模型名称",prop:"name"}},[t("el-input",{attrs:{placeholder:"例如: GPT-4"},model:{value:e.form.name,callback:function(i){e.$set(e.form,"name",i)},expression:"form.name"}})],1),t("el-form-item",{attrs:{label:"启用"}},[t("el-switch",{model:{value:e.form.enabled,callback:function(i){e.$set(e.form,"enabled",i)},expression:"form.enabled"}})],1)],1),t("span",{attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:e.handleClose}},[e._v("取消")]),t("el-button",{attrs:{type:"primary"},on:{click:e.handleSubmit}},[e._v("保存")])],1)],1)},Igt=[],Egt=Li(Lgt,Dgt,Igt,!1,null,"879e8810");const Tgt=Egt.exports,Ngt={name:"SkillsList",props:{skills:{type:Array,default:()=>[]}}};var Pgt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"skills-list"},[t("div",{staticClass:"list"},[e._l(e.skills,function(i){return t("div",{key:i.id||i.name,staticClass:"skill-item"},[t("div",{staticClass:"skill-info"},[t("div",{staticClass:"skill-name"},[e._v(e._s(i.name))]),t("div",{staticClass:"skill-desc"},[e._v(e._s(i.description||"暂无描述"))])]),t("el-tag",{attrs:{type:i.enabled?"success":"info",size:"mini"}},[e._v(" "+e._s(i.enabled?"启用":"禁用")+" ")])],1)}),e.skills.length===0?t("div",{staticClass:"empty"},[e._v(" 暂无技能 ")]):e._e()],2)])},Mgt=[],Rgt=Li(Ngt,Pgt,Mgt,!1,null,"8ff78b73");const Ogt=Rgt.exports,Agt={name:"Settings",components:{ProviderList:Cgt,ProviderDialog:kgt,ModelDialog:Tgt,SkillsList:Ogt},data(){return{activeTab:"providers",tabs:[{name:"providers",label:"AI 服务商",icon:"fa-solid fa-server"},{name:"advanced",label:"高级",icon:"fa-solid fa-gear"},{name:"proxy",label:"代理设置",icon:"fa-solid fa-globe"},{name:"gateway",label:"网关",icon:"fa-solid fa-plug"},{name:"email",label:"邮件配置",icon:"fa-solid fa-envelope"}],providers:[],models:[],skills:[],defaultProviderId:null,config:{maxToolIterations:10,maxSessionCompression:5,webPort:4e4},proxyConfig:{enabled:!1,type:"http",host:"",port:1080},gateway:{enabled:!1,clientId:"",clientSecret:""},gatewayStatus:{running:!1,configured:!1},gatewayLoading:!1,showProviderDialog:!1,editingProvider:null,showModelDialog:!1,editingModel:null,emailConfig:{host:"",port:587,secure:!1,user:"",password:"",fromName:""},emailStatus:{valid:null},emailLoading:!1,wafGateway:{serverIp:"",secretKey:""},wafStatus:{status:"stopped",configured:!1},wafGatewayLoading:!1,songbingConfig:{platformUrl:"",apiBaseUrl:""},songbingProvider:null,pollTimer:null,showAuthDialog:!1,authForm:{platformUrl:""},authLoading:!1}},created(){this.loadProviders(),this.loadModels(),this.loadSkills(),this.loadConfig(),this.loadProxyConfig(),this.loadGatewayConfig(),this.loadGatewayStatus(),this.loadSongbingConfig()},activated(){this.activeTab==="gateway"&&(this.loadGatewayConfig(),this.loadGatewayStatus())},watch:{activeTab(s){s==="gateway"?(this.loadGatewayConfig(),this.loadGatewayStatus(),this.loadWafConfig(),this.loadWafStatus()):s==="proxy"?this.loadProxyConfig():s==="email"&&this.loadEmailConfig()}},methods:{async loadProxyConfig(){try{const s=await this.$api.getProxyConfig();s.data&&(this.proxyConfig={enabled:s.data.enabled||!1,type:s.data.type||"http",host:s.data.host||"",port:s.data.port||1080})}catch{}},async saveProxyConfig(){try{await this.$api.updateProxyConfig(this.proxyConfig),this.$message.success("代理配置已保存")}catch(s){this.$message.error("保存失败: "+s.message)}},openProviderDialog(s){this.editingProvider=s,this.showProviderDialog=!0},openModelDialog(s,e){this.editingModel=e,this.showModelDialog=!0},async loadProviders(){try{const s=await this.$api.getProviders();this.providers=s.data||[];const e=this.providers.find(t=>t.isDefault);this.defaultProviderId=(e==null?void 0:e.id)||null,this.checkSongbingProvider()}catch(s){this.$message.error("加载提供商失败: "+s.message)}},async loadModels(){try{const s=await this.$api.getModels();this.models=s.data||[]}catch(s){this.$message.error("加载模型失败: "+s.message)}},async loadSkills(){try{const s=await this.$api.getSkills();this.skills=s.data||[]}catch{this.skills=[]}},async loadConfig(){var s;try{const e=await this.$api.getConfig("ai.maxToolIterations");(s=e.data)!=null&&s.value&&(this.config.maxToolIterations=parseInt(e.data.value))}catch{}},async deleteProvider(s){try{await this.$confirm("确定要删除该服务商吗?","提示",{type:"warning"}),await this.$api.deleteProvider(s),this.$message.success("删除成功"),await this.loadProviders()}catch(e){e!=="cancel"&&this.$message.error("删除失败: "+e.message)}},async deleteModel(s){try{await this.$confirm("确定要删除该模型吗?","提示",{type:"warning"}),await this.$api.deleteModel(s),this.$message.success("删除成功"),await this.loadModels()}catch(e){e!=="cancel"&&this.$message.error("删除失败: "+e.message)}},async saveConfig(s,e){try{await this.$api.setConfig(s,e),this.$message.success("配置已保存")}catch(t){this.$message.error("保存失败: "+t.message)}},async loadGatewayConfig(){try{const s=await this.$api.getDingtalkConfig();s.data&&(this.gateway={enabled:s.data.enabled||!1,clientId:s.data.clientId||"",clientSecret:s.data.clientSecret||""})}catch(s){console.error("Failed to load gateway config:",s)}},async loadGatewayStatus(){try{const s=await this.$api.getGatewayStatus();s.data&&(this.gatewayStatus={running:s.data.running||!1,configured:s.data.configured||!1})}catch(s){console.error("Failed to load gateway status:",s)}},async saveGatewayConfig(){try{await this.$api.updateDingtalkConfig(this.gateway),this.$message.success("网关配置已保存"),this.loadGatewayStatus()}catch(s){this.$message.error("保存失败: "+s.message)}},async toggleGateway(){this.gatewayLoading=!0;try{if(this.gatewayStatus.running)await this.$api.stopDingtalk(),this.$message.success("网关已停止");else{if(!this.gateway.clientId||!this.gateway.clientSecret){this.$message.error("请先配置 Client ID 和 Client Secret"),this.gatewayLoading=!1;return}await this.$api.updateDingtalkConfig(this.gateway),await this.$api.startDingtalk(),this.$message.success("网关已启动")}await this.loadGatewayStatus()}catch(s){this.$message.error("操作失败: "+s.message)}finally{this.gatewayLoading=!1}},async loadWafConfig(){try{const s=await this.$api.getWafConfig();s.data&&(this.wafGateway={serverIp:s.data.server_ip||"",secretKey:s.data.secret_key||""})}catch(s){console.error("Failed to load WAF config:",s)}},async loadWafStatus(){try{const s=await this.$api.getWafStatus();s.data&&(this.wafStatus={status:s.data.status||"stopped",configured:s.data.configured||!1})}catch(s){console.error("Failed to load WAF status:",s)}},async saveWafConfig(){try{await this.$api.updateWafConfig({server_ip:this.wafGateway.serverIp,secret_key:this.wafGateway.secretKey}),this.$message.success("WAF网关配置已保存"),this.loadWafStatus()}catch(s){this.$message.error("保存失败: "+s.message)}},async toggleWafGateway(){this.wafGatewayLoading=!0;try{if(this.wafStatus.status==="running")await this.$api.stopWaf(),this.$message.success("WAF网关已停止");else{if(!this.wafGateway.serverIp||!this.wafGateway.secretKey){this.$message.error("请先配置服务器IP和秘钥"),this.wafGatewayLoading=!1;return}await this.$api.updateWafConfig({server_ip:this.wafGateway.serverIp,secret_key:this.wafGateway.secretKey}),await this.$api.startWaf(),this.$message.success("WAF网关已启动")}await this.loadWafStatus()}catch(s){this.$message.error("操作失败: "+s.message)}finally{this.wafGatewayLoading=!1}},async loadEmailConfig(){try{const e=(await this.$api.getEmailConfigs()).data||[];if(e.length>0){const t=e[0];this.emailConfig={host:t.host||"",port:t.port||587,secure:!!t.secure,user:t.user||"",password:t.password||"",fromName:t.from_name||""},this.emailStatus.valid=null}else this.emailConfig={host:"",port:587,secure:!1,user:"",password:"",fromName:""},this.emailStatus.valid=null}catch(s){this.$message.error("加载邮件配置失败: "+s.message)}},async saveEmailConfig(){try{const e=((await this.$api.getEmailConfigs()).data||[])[0];e?await this.$api.updateEmailConfig(e.id,{host:this.emailConfig.host,port:this.emailConfig.port,secure:this.emailConfig.secure,user:this.emailConfig.user,password:this.emailConfig.password,from_name:this.emailConfig.fromName}):await this.$api.createEmailConfig({host:this.emailConfig.host,port:this.emailConfig.port,secure:this.emailConfig.secure,user:this.emailConfig.user,password:this.emailConfig.password,from_name:this.emailConfig.fromName,is_default:!0}),this.$message.success("配置已保存")}catch(s){this.$message.error("保存失败: "+s.message)}},async testEmailConfig(){try{const e=((await this.$api.getEmailConfigs()).data||[])[0];if(!e){this.$message.error("请先保存配置后再测试");return}this.emailLoading=!0;const t=await this.$api.validateEmailConfig(e.id);t.success?(this.$message.success("连接测试成功"),this.emailStatus.valid=!0):(this.$message.error("连接测试失败: "+t.error),this.emailStatus.valid=!1)}catch(s){this.$message.error("测试失败: "+s.message),this.emailStatus.valid=!1}finally{this.emailLoading=!1}},async handleExportConfig(){try{const s=await this.$api.exportConfig(),e=new Date,i=`config_${e.getFullYear().toString()+(e.getMonth()+1).toString().padStart(2,"0")+e.getDate().toString().padStart(2,"0")+"_"+e.getHours().toString().padStart(2,"0")+e.getMinutes().toString().padStart(2,"0")+e.getSeconds().toString().padStart(2,"0")}.yml`,n=window.URL.createObjectURL(s),r=document.createElement("a");r.href=n,r.download=i,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(n),this.$message.success("配置导出成功")}catch(s){this.$message.error("导出失败: "+s.message)}},handleImportConfig(){const s=document.createElement("input");s.type="file",s.accept=".yml,.yaml",s.onchange=async e=>{const t=e.target.files[0];if(t)try{const i=await t.text(),n=await this.$api.importConfig(i);n.success?(this.$message.success("配置导入成功"),await this.loadProviders(),await this.loadModels(),await this.loadGatewayConfig(),this.loadWafConfig(),this.loadEmailConfig()):this.$message.error("导入失败: "+n.error)}catch(i){this.$message.error("导入失败: "+i.message)}},s.click()},async loadSongbingConfig(){try{const s=await this.$api.getSongbingConfig();this.songbingConfig=s.data}catch(s){console.error("Failed to load songbing config:",s)}},checkSongbingProvider(){this.songbingProvider=this.providers.find(s=>s.name==="自建AI平台")||null},authSongbing(){this.authForm.platformUrl=this.songbingConfig.platformUrl,this.showAuthDialog=!0},async confirmAuthSongbing(){const{platformUrl:s}=this.authForm;if(!s){this.$message.error("请输入平台地址");return}if(!s.startsWith("http://")&&!s.startsWith("https://")){this.$message.error("平台地址必须以 http:// 或 https:// 开头");return}this.showAuthDialog=!1,this.authLoading=!0,this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null);try{const e=await this.$api.startSongbingAuth(s),{key:t,auth_url:i}=e.data;window.open(s+i,"_blank"),this.$message.info("请在打开的页面完成授权,认证中...");let n=0;this.pollTimer=setInterval(async()=>{var r;if(n++,n>=100){clearInterval(this.pollTimer),this.pollTimer=null,this.$message.warning("认证超时,请重试"),this.authLoading=!1;return}try{const o=await this.$api.verifySongbingAuth(t);(r=o.data)!=null&&r.active&&(clearInterval(this.pollTimer),this.pollTimer=null,this.$message.success(`自建AI平台 认证成功!已同步 ${o.data.syncedModels} 个模型`),await this.loadProviders(),await this.loadModels(),this.checkSongbingProvider(),this.authLoading=!1)}catch{}},3e3)}catch(e){this.$message.error("认证失败: "+e.message),this.authLoading=!1}},async cancelSongbingAuth(){try{await this.$confirm("确定要取消认证吗?取消后已同步的模型将被删除。","提示",{type:"warning"}),await this.$api.cancelSongbingAuth(),this.$message.success("已取消认证"),await this.loadProviders(),await this.loadModels(),this.songbingProvider=null}catch(s){s!=="cancel"&&this.$message.error("取消认证失败: "+s.message)}},async syncSongbingModels(){if(!this.songbingProvider){this.$message.warning("请先完成认证");return}try{const s=await this.$api.syncSongbingModels();this.$message.success(`同步成功,新增 ${s.data.count} 个模型`),await this.loadModels()}catch(s){this.$message.error("同步模型失败: "+s.message)}}},beforeDestroy(){this.pollTimer&&clearInterval(this.pollTimer)}};var Fgt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"flex-1 flex overflow-hidden bg-[#1e1e1e]"},[t("aside",{staticClass:"w-[220px] bg-sidebar border-r border-border shrink-0 py-4"},[t("h2",{staticClass:"text-white font-bold text-lg px-4 mb-4"},[e._v("设置")]),t("nav",{staticClass:"space-y-1"},e._l(e.tabs,function(i){return t("button",{key:i.name,staticClass:"w-full text-left px-4 py-2 text-sm flex items-center gap-2 transition-colors",class:e.activeTab===i.name?"bg-active text-white border-l-2 border-accent":"text-textMuted hover:text-white hover:bg-white/5 border-l-2 border-transparent",on:{click:function(n){e.activeTab=i.name}}},[t("i",{class:i.icon}),e._v(" "+e._s(i.label)+" ")])}),0)]),t("main",{staticClass:"flex-1 overflow-y-auto p-6"},[t("div",{staticClass:"max-w-3xl mx-auto"},[t("div",{directives:[{name:"show",rawName:"v-show",value:e.activeTab==="providers",expression:"activeTab === 'providers'"}]},[t("ProviderList",{attrs:{providers:e.providers,models:e.models,"songbing-provider":e.songbingProvider},on:{"add-provider":function(i){return e.openProviderDialog(null)},"edit-provider":function(i){return e.openProviderDialog(i)},"delete-provider":e.deleteProvider,"add-model":function(i){return e.openModelDialog(i,null)},"edit-model":function(i){return e.openModelDialog(i.providerId,i)},"delete-model":e.deleteModel,"export-config":e.handleExportConfig,"import-config":e.handleImportConfig,"auth-songbing":e.authSongbing,"sync-songbing-models":e.syncSongbingModels,"cancel-songbing-auth":e.cancelSongbingAuth}})],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.activeTab==="skills",expression:"activeTab === 'skills'"}]},[t("h3",{staticClass:"text-xl text-white mb-4"},[e._v("Skills")]),t("SkillsList",{attrs:{skills:e.skills}})],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.activeTab==="advanced",expression:"activeTab === 'advanced'"}]},[t("h3",{staticClass:"text-xl text-white mb-4"},[e._v("高级设置")]),t("el-form",{staticClass:"advanced-form",attrs:{"label-width":"150px"}},[t("el-form-item",{attrs:{label:"最大工具轮数"}},[t("el-input-number",{attrs:{min:1,max:100},on:{change:function(i){return e.saveConfig("maxToolIterations",i)}},model:{value:e.config.maxToolIterations,callback:function(i){e.$set(e.config,"maxToolIterations",i)},expression:"config.maxToolIterations"}})],1),t("el-form-item",{attrs:{label:"会话压缩阈值"}},[t("el-input-number",{attrs:{min:1,max:100},on:{change:function(i){return e.saveConfig("maxSessionCompression",i)}},model:{value:e.config.maxSessionCompression,callback:function(i){e.$set(e.config,"maxSessionCompression",i)},expression:"config.maxSessionCompression"}})],1),t("el-form-item",{attrs:{label:"Web 服务端口"}},[t("el-input-number",{attrs:{min:1024,max:65535},on:{change:function(i){return e.saveConfig("web.port",i)}},model:{value:e.config.webPort,callback:function(i){e.$set(e.config,"webPort",i)},expression:"config.webPort"}})],1)],1)],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.activeTab==="proxy",expression:"activeTab === 'proxy'"}]},[t("h3",{staticClass:"text-xl text-white mb-4"},[e._v("代理设置")]),t("el-form",{staticClass:"advanced-form",attrs:{"label-width":"150px"}},[t("el-form-item",{attrs:{label:"启用代理"}},[t("el-switch",{on:{change:e.saveProxyConfig},model:{value:e.proxyConfig.enabled,callback:function(i){e.$set(e.proxyConfig,"enabled",i)},expression:"proxyConfig.enabled"}})],1),t("el-form-item",{attrs:{label:"代理类型"}},[t("el-select",{attrs:{disabled:!e.proxyConfig.enabled},on:{change:e.saveProxyConfig},model:{value:e.proxyConfig.type,callback:function(i){e.$set(e.proxyConfig,"type",i)},expression:"proxyConfig.type"}},[t("el-option",{attrs:{label:"HTTP",value:"http"}}),t("el-option",{attrs:{label:"SOCKS5",value:"socks5"}})],1)],1),t("el-form-item",{attrs:{label:"代理IP"}},[t("el-input",{attrs:{disabled:!e.proxyConfig.enabled},on:{blur:e.saveProxyConfig},model:{value:e.proxyConfig.host,callback:function(i){e.$set(e.proxyConfig,"host",i)},expression:"proxyConfig.host"}})],1),t("el-form-item",{attrs:{label:"代理端口"}},[t("el-input-number",{attrs:{min:1,max:65535,disabled:!e.proxyConfig.enabled},on:{change:e.saveProxyConfig},model:{value:e.proxyConfig.port,callback:function(i){e.$set(e.proxyConfig,"port",i)},expression:"proxyConfig.port"}})],1)],1)],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.activeTab==="gateway",expression:"activeTab === 'gateway'"}]},[t("h3",{staticClass:"text-xl text-white mb-4"},[e._v("网关配置")]),t("el-form",{staticClass:"gateway-form",attrs:{"label-width":"150px"}},[t("el-form-item",{attrs:{label:"启用钉钉机器人"}},[t("el-switch",{on:{change:e.saveGatewayConfig},model:{value:e.gateway.enabled,callback:function(i){e.$set(e.gateway,"enabled",i)},expression:"gateway.enabled"}})],1),t("el-form-item",{attrs:{label:"Client ID"}},[t("el-input",{attrs:{placeholder:"请输入Client ID"},on:{blur:e.saveGatewayConfig},model:{value:e.gateway.clientId,callback:function(i){e.$set(e.gateway,"clientId",i)},expression:"gateway.clientId"}})],1),t("el-form-item",{attrs:{label:"Client Secret"}},[t("el-input",{attrs:{type:"password",placeholder:"请输入Client Secret"},on:{blur:e.saveGatewayConfig},model:{value:e.gateway.clientSecret,callback:function(i){e.$set(e.gateway,"clientSecret",i)},expression:"gateway.clientSecret"}})],1),t("el-form-item",{attrs:{label:"运行状态"}},[t("el-tag",{attrs:{type:e.gatewayStatus.running?"success":"info"}},[e._v(" "+e._s(e.gatewayStatus.running?"运行中":"已停止")+" ")]),e.gatewayStatus.configured&&!e.gatewayStatus.running?t("span",{staticClass:"text-textMuted text-sm ml-2"},[e._v(" (配置已保存,可启动) ")]):e._e()],1),t("el-form-item",[t("el-button",{attrs:{type:"primary",loading:e.gatewayLoading},on:{click:e.toggleGateway}},[e._v(" "+e._s(e.gatewayStatus.running?"停止":"启动")+" ")])],1)],1),t("h3",{staticClass:"text-xl text-white mb-4 mt-8"},[e._v("梓豪WAF网关配置")]),t("el-form",{staticClass:"gateway-form",attrs:{"label-width":"150px"}},[t("el-form-item",{attrs:{label:"服务器IP"}},[t("el-input",{attrs:{placeholder:"请输入服务器IP地址"},on:{blur:e.saveWafConfig},model:{value:e.wafGateway.serverIp,callback:function(i){e.$set(e.wafGateway,"serverIp",i)},expression:"wafGateway.serverIp"}})],1),t("el-form-item",{attrs:{label:"秘钥"}},[t("el-input",{attrs:{type:"password",placeholder:"请输入秘钥","show-password":""},on:{blur:e.saveWafConfig},model:{value:e.wafGateway.secretKey,callback:function(i){e.$set(e.wafGateway,"secretKey",i)},expression:"wafGateway.secretKey"}})],1),t("el-form-item",{attrs:{label:"运行状态"}},[t("div",{staticClass:"flex items-center gap-2"},[t("span",{staticClass:"w-2 h-2 rounded-full",class:e.wafStatus.status==="running"?"bg-green-500":"bg-gray-400"}),t("el-tag",{attrs:{type:e.wafStatus.status==="running"?"success":"info"}},[e._v(" "+e._s(e.wafStatus.status==="running"?"运行中":"已停止")+" ")])],1)]),t("el-form-item",[t("el-button",{attrs:{type:"primary",loading:e.wafGatewayLoading,disabled:!e.wafStatus.configured},on:{click:e.toggleWafGateway}},[e._v(" "+e._s(e.wafStatus.status==="running"?"停止":"启动")+" ")])],1)],1)],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.activeTab==="email",expression:"activeTab === 'email'"}]},[t("h3",{staticClass:"text-xl text-white mb-4"},[e._v("邮件配置")]),t("el-form",{staticClass:"gateway-form",attrs:{"label-width":"150px"}},[t("el-form-item",{attrs:{label:"SMTP 服务器"}},[t("el-input",{attrs:{placeholder:"smtp.example.com"},on:{blur:e.saveEmailConfig},model:{value:e.emailConfig.host,callback:function(i){e.$set(e.emailConfig,"host",i)},expression:"emailConfig.host"}})],1),t("el-form-item",{attrs:{label:"端口"}},[t("el-input-number",{attrs:{min:1,max:65535},on:{change:e.saveEmailConfig},model:{value:e.emailConfig.port,callback:function(i){e.$set(e.emailConfig,"port",i)},expression:"emailConfig.port"}})],1),t("el-form-item",{attrs:{label:"使用 SSL/TLS"}},[t("el-switch",{on:{change:e.saveEmailConfig},model:{value:e.emailConfig.secure,callback:function(i){e.$set(e.emailConfig,"secure",i)},expression:"emailConfig.secure"}})],1),t("el-form-item",{attrs:{label:"用户名"}},[t("el-input",{attrs:{placeholder:"邮箱地址"},on:{blur:e.saveEmailConfig},model:{value:e.emailConfig.user,callback:function(i){e.$set(e.emailConfig,"user",i)},expression:"emailConfig.user"}})],1),t("el-form-item",{attrs:{label:"密码/授权码"}},[t("el-input",{attrs:{type:"password",placeholder:"邮箱密码或授权码","show-password":""},on:{blur:e.saveEmailConfig},model:{value:e.emailConfig.password,callback:function(i){e.$set(e.emailConfig,"password",i)},expression:"emailConfig.password"}})],1),t("el-form-item",{attrs:{label:"发件人名称"}},[t("el-input",{attrs:{placeholder:"显示的发件人名称(可选)"},on:{blur:e.saveEmailConfig},model:{value:e.emailConfig.fromName,callback:function(i){e.$set(e.emailConfig,"fromName",i)},expression:"emailConfig.fromName"}})],1),t("el-form-item",{attrs:{label:"运行状态"}},[t("el-tag",{attrs:{type:e.emailStatus.valid?"success":"info"}},[e._v(" "+e._s(e.emailStatus.valid?"配置有效":e.emailStatus.valid===!1?"配置无效":"未配置")+" ")])],1),t("el-form-item",[t("el-button",{attrs:{type:"primary",loading:e.emailLoading},on:{click:e.testEmailConfig}},[e._v("测试连接")])],1)],1)],1)])]),t("ProviderDialog",{attrs:{visible:e.showProviderDialog,"editing-provider":e.editingProvider},on:{"update:visible":function(i){e.showProviderDialog=i},success:e.loadProviders}}),t("ModelDialog",{attrs:{visible:e.showModelDialog,"editing-model":e.editingModel,providers:e.providers,"default-provider-id":e.defaultProviderId},on:{"update:visible":function(i){e.showModelDialog=i},success:e.loadModels}}),t("el-dialog",{attrs:{title:"自建AI平台认证",visible:e.showAuthDialog,width:"500px","close-on-click-modal":!1},on:{"update:visible":function(i){e.showAuthDialog=i}}},[t("el-form",{attrs:{"label-width":"80px"}},[t("el-form-item",{attrs:{label:"平台地址"}},[t("el-input",{model:{value:e.authForm.platformUrl,callback:function(i){e.$set(e.authForm,"platformUrl",i)},expression:"authForm.platformUrl"}})],1),t("el-alert",{staticStyle:{"margin-top":"10px"},attrs:{title:"注意:填写您的自建AI平台服务地址",type:"info",closable:!1}})],1),t("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(i){e.showAuthDialog=!1}}},[e._v("取消")]),t("el-button",{attrs:{type:"primary",loading:e.authLoading},on:{click:e.confirmAuthSongbing}},[e._v("开始认证")])],1)],1)],1)},Bgt=[],Wgt=Li(Agt,Fgt,Bgt,!1,null,"c3903b2c");const uke=Wgt.exports,Vgt={name:"CopyPathDialog",data(){return{visible:!1,path:""}},methods:{open(s){this.path=s,this.visible=!0},handleClose(){this.path=""},handleCopy(){navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(this.path).then(()=>{this.$message.success("路径已复制")}).catch(()=>{this.$message.info("请手动 Ctrl+C 复制")}):this.$message.info("请手动 Ctrl+C 复制"),this.visible=!1}}};var Hgt=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{title:"文件路径",visible:e.visible,width:"500px","close-on-click-modal":!0},on:{"update:visible":function(i){e.visible=i},close:e.handleClose}},[t("div",{staticClass:"flex gap-2"},[t("el-input",{staticClass:"flex-1",attrs:{readonly:""},model:{value:e.path,callback:function(i){e.path=i},expression:"path"}}),t("el-button",{attrs:{type:"primary"},on:{click:e.handleCopy}},[e._v("复制")])],1)])},$gt=[],zgt=Li(Vgt,Hgt,$gt,!1,null,null);const jgt=zgt.exports,Ugt={name:"Files",components:{FileTreeNode:ake,CopyPathDialog:jgt},data(){return{browseResult:{current_path:"",parent_path:null,items:[]},selectedPath:"",selectedItem:null,fileContent:null,loading:!1,expandedPaths:new Set,openFiles:[],activeFile:null,fileLoading:!1,saving:!1,editor:null,originalContent:"",sidebarWidth:260,isResizing:!1,contextMenu:{visible:!1,x:0,y:0,target:null},inputDialog:{visible:!1,title:"",value:"",placeholder:"",type:"",target:null},fileIcons:{js:"fa-brands fa-js text-yellow-400",ts:"fa-brands fa-js text-blue-400",html:"fa-brands fa-html5 text-orange-500",css:"fa-brands fa-css3 text-blue-400",scss:"fa-brands fa-sass text-pink-400",json:"fa-solid fa-file-code text-yellow-300",yaml:"fa-solid fa-file-code text-blue-300",yml:"fa-solid fa-file-code text-blue-300",md:"fa-solid fa-file-lines text-gray-400",py:"fa-brands fa-python text-blue-500",vue:"fa-brands fa-vuejs text-green-400",sh:"fa-solid fa-terminal text-green-400",go:"fa-brands fa-golang text-cyan-400",rs:"fa-brands fa-rust text-orange-400"},uploadProgress:{visible:!1,percent:0,filename:"",cancelled:!1},downloadProgress:{visible:!1,percent:0,filename:"",cancelled:!1}}},computed:{fileTreeData(){return this.browseResult.items.map(e=>this.transformNode(e)).sort((e,t)=>e.is_directory===t.is_directory?e.name.localeCompare(t.name):e.is_directory?-1:1)},hasChanges(){return this.editor?this.editor.getValue()!==this.originalContent:!1},isBinaryFile(){var s;return(s=this.activeFile)==null?void 0:s.is_binary}},watch:{activeFile:{immediate:!0,handler(s){this.$nextTick(()=>{!this.editor&&this.$refs.editorContainer&&this.initEditor(),s&&this.editor?this.loadFileContent(s.path).then(e=>{const t=this.getLanguageFromFilename(s.name),i=Dg.createModel(e,t);this.editor.setModel(i),this.originalContent=e}):this.editor&&(this.editor.setModel(Dg.createModel("","plaintext")),this.originalContent="")})}}},async created(){await this.browse(""),document.addEventListener("click",this.hideContextMenu),document.addEventListener("mousemove",this.handleResize),document.addEventListener("mouseup",this.stopResize)},activated(){!this.editor&&this.$refs.editorContainer&&this.initEditor()},beforeDestroy(){document.removeEventListener("click",this.hideContextMenu),document.removeEventListener("mousemove",this.handleResize),document.removeEventListener("mouseup",this.stopResize),this.editor&&(this.editor.dispose(),this.editor=null)},methods:{async browse(s){this.loading=!0;try{const e=await jt.browseFilesystem(s);this.browseResult=e.data}catch(e){console.error("Browse failed:",e)}finally{this.loading=!1}},transformNode(s){return{name:s.name,path:s.path,is_directory:s.is_directory,is_drive:s.is_drive||!1,size:s.size,has_children:s.is_directory,expanded:!1,children:[]}},handleSelect(s){this.selectedPath=s.path,this.selectedItem=s},async openFile(s){var t;if(s.is_directory)return;const e=this.openFiles.find(i=>i.path===s.path);if(e){this.activeFile=e;return}this.fileLoading=!0;try{const i=await this.loadFileContent(s.path),n={name:s.name,path:s.path,is_binary:((t=this.fileContent)==null?void 0:t.is_binary)||!1};this.openFiles.push(n),this.activeFile=n}catch(i){console.error("Open file failed:",i)}finally{this.fileLoading=!1}},closeFile(s){var t;const e=this.openFiles.findIndex(i=>i.path===s.path);if(this.openFiles=this.openFiles.filter(i=>i.path!==s.path),((t=this.activeFile)==null?void 0:t.path)===s.path){const i=e>0?e-1:0;this.activeFile=this.openFiles.length>0?this.openFiles[Math.min(i,this.openFiles.length-1)]:null}},async saveFile(){if(!(!this.activeFile||!this.hasChanges)){this.saving=!0;try{const s=this.editor.getValue();await jt.writeFile(this.activeFile.path,s),this.originalContent=s,this.$message.success("文件已保存")}catch(s){console.error("Save file failed:",s),this.$message.error("保存文件失败")}finally{this.saving=!1}}},async handleLoadChildren({path:s,callback:e}){try{const n=((await jt.browseFilesystem(s)).data.items||[]).map(r=>this.transformNode(r)).sort((r,o)=>r.is_directory===o.is_directory?r.name.localeCompare(o.name):r.is_directory?-1:1);e(n)}catch(t){console.error("Load children failed:",t),e([])}},goUp(){this.browseResult.parent_path!==null&&this.browse(this.browseResult.parent_path===""?"":this.browseResult.parent_path)},goHome(){this.browse("")},refresh(){this.browse(this.browseResult.current_path||"")},async loadFileContent(s){var e;try{const t=await jt.getFileContent(s);return this.fileContent=t.data||{content:"加载失败",is_binary:!1,size:0},((e=t.data)==null?void 0:e.content)||""}catch(t){return console.error("Load file content failed:",t),this.fileContent={content:"加载失败",is_binary:!1,size:0},""}},startResize(s){this.isResizing=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},handleResize(s){if(!this.isResizing)return;const e=s.clientX;e>=150&&e<=500&&(this.sidebarWidth=e)},stopResize(){this.isResizing=!1,document.body.style.cursor="",document.body.style.userSelect=""},showContextMenu(s,e){e&&(s.preventDefault(),this.contextMenu={visible:!0,x:s.pageX,y:s.pageY,target:e},this.selectedItem=e,this.selectedPath=e.path)},hideContextMenu(){this.contextMenu.visible=!1},async createNewFile(){this.hideContextMenu(),this.inputDialog={visible:!0,title:"新建文件",value:"",placeholder:"输入文件名",type:"file",target:this.contextMenu.target},this.$nextTick(()=>{var s;(s=this.$refs.renameInput)==null||s.focus()})},async createNewFolder(){this.hideContextMenu(),this.inputDialog={visible:!0,title:"新建文件夹",value:"",placeholder:"输入文件夹名",type:"folder",target:this.contextMenu.target},this.$nextTick(()=>{var s;(s=this.$refs.renameInput)==null||s.focus()})},copyPath(){this.hideContextMenu(),this.$refs.copyPathDialog.open(this.contextMenu.target.path)},renameItem(){this.hideContextMenu(),this.inputDialog={visible:!0,title:"重命名",value:this.contextMenu.target.name,placeholder:"输入新名称",type:"rename",target:this.contextMenu.target},this.$nextTick(()=>{var s,e;(s=this.$refs.renameInput)==null||s.focus(),(e=this.$refs.renameInput)==null||e.select()})},async confirmInput(){const{type:s,value:e,target:t}=this.inputDialog;if(!e.trim()){this.cancelInput();return}try{const i=t.path.includes("\\")?"\\":"/";if(s==="file"){const n=t.path+i+e.trim();await jt.writeFile(n,"")}else if(s==="folder"){const n=t.path+i+e.trim();await jt.createDirectory(n)}else if(s==="rename"){const r=t.path.substring(0,t.path.lastIndexOf(i))+i+e.trim();await jt.renameFile(t.path,r)}this.refresh()}catch(i){console.error("Operation failed:",i),this.$message.error("操作失败")}this.inputDialog.visible=!1},cancelInput(){this.inputDialog.visible=!1},async deleteItem(){this.hideContextMenu();try{await this.$confirm(`确定要删除 "${this.contextMenu.target.name}" 吗?`,"确认删除",{confirmButtonText:"删除",cancelButtonText:"取消",type:"warning"}),await jt.deleteFile(this.contextMenu.target.path),this.$message.success("删除成功"),this.refresh()}catch(s){s!=="cancel"&&(console.error("Delete failed:",s),this.$message.error("删除失败"))}},triggerFileUpload(){var s;this.hideContextMenu(),(s=this.$refs.fileInput)==null||s.click()},handleFileSelect(s){var i,n;const e=(i=s.target.files)==null?void 0:i[0];if(!e)return;const t=(n=this.contextMenu.target)==null?void 0:n.path;t&&(this.uploadFile(e,t),s.target.value="")},uploadFile(s,e){this.uploadProgress={visible:!0,percent:0,filename:s.name,cancelled:!1},jt.uploadFilesystemWithProgress(e,s,t=>{this.uploadProgress.percent=t}).then(()=>{this.uploadProgress.visible=!1,this.$message.success("上传成功"),this.refresh()}).catch(t=>{this.uploadProgress.visible=!1,this.$message.error("上传失败: "+t.message)})},cancelUpload(){this.uploadProgress.cancelled=!0,this.uploadProgress.visible=!1},downloadFile(){this.hideContextMenu();const s=this.contextMenu.target;s&&(this.downloadProgress={visible:!0,percent:0,filename:s.name,cancelled:!1},jt.downloadFilesystemWithProgress(s.path,s.name,e=>{this.downloadProgress.percent=e}).then(()=>{this.downloadProgress.visible=!1}).catch(e=>{this.downloadProgress.visible=!1,this.$message.error("下载失败: "+e.message)}))},cancelDownload(){this.downloadProgress.cancelled=!0,this.downloadProgress.visible=!1},initEditor(){this.editor||this.$refs.editorContainer&&(this.editor=Dg.create(this.$refs.editorContainer,{value:"",language:"plaintext",theme:"vs-dark",automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:14,fontFamily:'Consolas, Monaco, "Courier New", monospace',lineNumbers:"on",roundedSelection:!1,scrollbar:{useShadows:!1,verticalHasArrows:!1,horizontalHasArrows:!1,vertical:"auto",horizontal:"auto"}}),this.editor.onDidChangeModelContent(()=>{this.$forceUpdate()}),this.editor.addCommand(ix.CtrlCmd|tx.KeyS,()=>{this.saveFile()}))},getFileIcon(s){const e=s.split(".").pop().toLowerCase(),t=s.toLowerCase();return t==="dockerfile"?"fa-brands fa-docker text-blue-400":t===".gitignore"?"fa-brands fa-git text-red-400":t.startsWith("readme")?this.fileIcons.md:this.fileIcons[e]||"fa-solid fa-file text-gray-400"},getLanguageFromFilename(s){const e=s.split(".").pop().toLowerCase();return{js:"javascript",ts:"typescript",html:"html",css:"css",scss:"scss",vue:"html",py:"python",md:"markdown",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",sql:"sql",sh:"shell",go:"go",rs:"rust"}[e]||"plaintext"}}};var qgt=function(){var i;var e=this,t=e._self._c;return t("div",{staticClass:"flex-1 flex overflow-hidden"},[t("aside",{staticClass:"bg-sidebar border-r border-border flex flex-col shrink-0",style:{width:e.sidebarWidth+"px"}},[e._m(0),t("div",{staticClass:"flex items-center gap-1 px-2 py-2 border-b border-border"},[t("button",{staticClass:"p-1 text-textMuted hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",attrs:{disabled:!e.browseResult.parent_path&&e.browseResult.parent_path!=="",title:"上级目录"},on:{click:e.goUp}},[t("i",{staticClass:"fa-solid fa-arrow-up"})]),t("button",{staticClass:"p-1 text-textMuted hover:text-white",attrs:{title:"刷新"},on:{click:e.refresh}},[t("i",{staticClass:"fa-solid fa-refresh"})]),t("button",{staticClass:"p-1 text-textMuted hover:text-white",attrs:{title:"我的电脑"},on:{click:e.goHome}},[t("i",{staticClass:"fa-solid fa-home"})])]),t("div",{staticClass:"flex-1 overflow-y-auto py-1 sidebar-scroll"},[e.loading?t("div",{staticClass:"flex items-center justify-center py-8 text-textMuted"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e.fileTreeData.length===0?t("div",{staticClass:"flex items-center justify-center py-8 text-textMuted text-sm"},[e._v(" 此目录为空 ")]):e._l(e.fileTreeData,function(n){return t("file-tree-node",{key:n.path,attrs:{node:n,level:0,"selected-path":e.selectedPath},on:{select:e.handleSelect,"open-file":e.openFile,"load-children":e.handleLoadChildren,contextmenu:e.showContextMenu}})})],2),t("div",{directives:[{name:"show",rawName:"v-show",value:e.contextMenu.visible,expression:"contextMenu.visible"}],staticClass:"fixed bg-sidebar border border-border rounded shadow-lg py-1 z-50 min-w-[160px]",style:{left:e.contextMenu.x+"px",top:e.contextMenu.y+"px"}},[(i=e.contextMenu.target)!=null&&i.is_directory?[t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.copyPath}},[t("i",{staticClass:"fa-solid fa-copy text-xs"}),e._v(" 复制路径 ")]),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.createNewFile}},[t("i",{staticClass:"fa-solid fa-file-lines text-xs"}),e._v(" 新建文件 ")]),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.createNewFolder}},[t("i",{staticClass:"fa-solid fa-folder-plus text-xs"}),e._v(" 新建文件夹 ")]),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.triggerFileUpload}},[t("i",{staticClass:"fa-solid fa-upload text-xs"}),e._v(" 上传文件 ")]),t("div",{staticClass:"border-t border-border my-1"}),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.renameItem}},[t("i",{staticClass:"fa-solid fa-pen text-xs"}),e._v(" 重命名 ")]),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-red-400 hover:bg-active flex items-center gap-2",on:{click:e.deleteItem}},[t("i",{staticClass:"fa-solid fa-trash text-xs"}),e._v(" 删除 ")])]:[t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.copyPath}},[t("i",{staticClass:"fa-solid fa-copy text-xs"}),e._v(" 复制路径 ")]),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.downloadFile}},[t("i",{staticClass:"fa-solid fa-download text-xs"}),e._v(" 下载 ")]),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-textMain hover:bg-active flex items-center gap-2",on:{click:e.renameItem}},[t("i",{staticClass:"fa-solid fa-pen text-xs"}),e._v(" 重命名 ")]),t("button",{staticClass:"w-full text-left px-4 py-2 text-sm text-red-400 hover:bg-active flex items-center gap-2",on:{click:e.deleteItem}},[t("i",{staticClass:"fa-solid fa-trash text-xs"}),e._v(" 删除 ")])]],2),t("div",{directives:[{name:"show",rawName:"v-show",value:e.inputDialog.visible,expression:"inputDialog.visible"}],staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",on:{click:function(n){return n.target!==n.currentTarget?null:e.cancelInput.apply(null,arguments)}}},[t("div",{staticClass:"bg-sidebar border border-border rounded p-4 w-80"},[t("p",{staticClass:"text-white text-sm mb-3"},[e._v(e._s(e.inputDialog.title))]),t("input",{directives:[{name:"model",rawName:"v-model",value:e.inputDialog.value,expression:"inputDialog.value"}],ref:"renameInput",staticClass:"w-full px-3 py-2 bg-contentBg border border-border rounded text-white text-sm focus:outline-none focus:border-accent",attrs:{placeholder:e.inputDialog.placeholder},domProps:{value:e.inputDialog.value},on:{keyup:[function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"enter",13,n.key,"Enter")?null:e.confirmInput.apply(null,arguments)},function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"escape",void 0,n.key,void 0)?null:e.cancelInput.apply(null,arguments)}],input:function(n){n.target.composing||e.$set(e.inputDialog,"value",n.target.value)}}}),t("div",{staticClass:"flex justify-end gap-2 mt-4"},[t("button",{staticClass:"px-3 py-1 text-xs text-textMuted hover:text-white",on:{click:e.cancelInput}},[e._v("取消")]),t("button",{staticClass:"px-3 py-1 text-xs bg-accent text-white rounded hover:bg-blue-600",on:{click:e.confirmInput}},[e._v("确定")])])])]),t("input",{ref:"fileInput",staticClass:"hidden",attrs:{type:"file"},on:{change:e.handleFileSelect}}),e.uploadProgress.visible?t("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50"},[t("div",{staticClass:"bg-sidebar border border-border rounded p-4 w-80"},[t("p",{staticClass:"text-white text-sm mb-3"},[e._v("正在上传 "+e._s(e.uploadProgress.filename))]),t("div",{staticClass:"w-full bg-contentBg rounded-full h-2"},[t("div",{staticClass:"bg-accent h-2 rounded-full transition-all",style:{width:e.uploadProgress.percent+"%"}})]),t("p",{staticClass:"text-textMuted text-xs mt-2 text-center"},[e._v(e._s(e.uploadProgress.percent)+"%")]),t("button",{staticClass:"w-full mt-4 py-2 text-xs text-textMuted hover:text-white border border-border rounded",on:{click:e.cancelUpload}},[e._v("取消")])])]):e._e(),e.downloadProgress.visible?t("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50"},[t("div",{staticClass:"bg-sidebar border border-border rounded p-4 w-80"},[t("p",{staticClass:"text-white text-sm mb-3"},[e._v("正在下载 "+e._s(e.downloadProgress.filename))]),t("div",{staticClass:"w-full bg-contentBg rounded-full h-2"},[t("div",{staticClass:"bg-accent h-2 rounded-full transition-all",style:{width:e.downloadProgress.percent+"%"}})]),t("p",{staticClass:"text-textMuted text-xs mt-2 text-center"},[e._v(e._s(e.downloadProgress.percent)+"%")]),t("button",{staticClass:"w-full mt-4 py-2 text-xs text-textMuted hover:text-white border border-border rounded",on:{click:e.cancelDownload}},[e._v("取消")])])]):e._e()]),t("div",{staticClass:"w-1 bg-border hover:bg-accent cursor-col-resize transition-colors",on:{mousedown:e.startResize}}),t("main",{staticClass:"flex-1 flex flex-col min-w-0 bg-contentBg"},[t("div",{staticClass:"flex border-b border-border bg-sidebar overflow-x-auto"},e._l(e.openFiles,function(n){var r;return t("div",{key:n.path,staticClass:"flex items-center gap-2 px-3 py-2 cursor-pointer border-r border-border",class:((r=e.activeFile)==null?void 0:r.path)===n.path?"bg-contentBg text-white border-t-2 border-t-accent":"text-textMuted hover:bg-hoverBg",on:{click:function(o){e.activeFile=n}}},[t("i",{staticClass:"text-xs",class:e.getFileIcon(n.name)}),t("span",{staticClass:"text-xs"},[e._v(e._s(n.name))]),t("button",{staticClass:"ml-2 hover:text-white text-textMuted",on:{click:function(o){return o.stopPropagation(),e.closeFile(n)}}},[t("i",{staticClass:"fa-solid fa-times text-[10px]"})])])}),0),t("div",{staticClass:"flex-1 overflow-hidden"},[e.activeFile?e.fileLoading?t("div",{staticClass:"flex items-center justify-center h-full text-textMuted"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e.isBinaryFile?t("div",{staticClass:"flex items-center justify-center h-full text-textMuted"},[e._m(1)]):e._e():t("div",{staticClass:"text-textMuted text-center mt-20"},[t("i",{staticClass:"fa-solid fa-file-code text-6xl mb-4 opacity-20"}),t("p",[e._v("双击左侧文件打开编辑器")])]),t("div",{directives:[{name:"show",rawName:"v-show",value:e.activeFile&&!e.isBinaryFile,expression:"activeFile && !isBinaryFile"}],ref:"editorContainer",staticClass:"monaco-editor-container"})]),e.activeFile&&!e.isBinaryFile?t("div",{staticClass:"h-8 bg-sidebar border-t border-border flex items-center justify-between px-3"},[t("div",{staticClass:"flex items-center gap-4 text-xs text-textMuted"},[t("span",[e._v(e._s(e.activeFile.path))]),e.hasChanges?t("span",{staticClass:"text-yellow-500"},[e._v("已修改")]):e._e()]),t("div",{staticClass:"flex items-center gap-2"},[t("button",{staticClass:"px-3 py-1 text-xs bg-primary hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed text-white rounded",attrs:{disabled:!e.hasChanges||e.saving},on:{click:e.saveFile}},[e.saving?t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-1"}):t("i",{staticClass:"fa-solid fa-save mr-1"}),e._v(" 保存 ")])])]):e._e()]),t("CopyPathDialog",{ref:"copyPathDialog"})],1)},Kgt=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"flex border-b border-border text-xs uppercase font-bold text-textMuted"},[e("div",{staticClass:"px-4 py-2 border-b-2 border-accent text-white flex items-center gap-2"},[e("i",{staticClass:"fa-solid fa-folder-open"}),s._v(" Explorer ")])])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"text-center"},[e("i",{staticClass:"fa-solid fa-file text-4xl mb-4 opacity-30"}),e("p",[s._v("二进制文件无法预览")])])}],Ggt=Li(Ugt,qgt,Kgt,!1,null,"f659ba7f");const Ygt=Ggt.exports,Zgt={name:"SkillCard",props:{skill:{type:Object,required:!0},installed:{type:Boolean,default:!1},installing:{type:Boolean,default:!1}},computed:{tagList(){return this.skill.tags?this.skill.tags.split(",").map(s=>s.trim()).filter(Boolean):[]}}};var Xgt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"skill-card bg-sidebar border border-border rounded-lg p-4 hover:border-accent transition-colors flex flex-col"},[t("div",{staticClass:"flex items-start gap-3 mb-3"},[t("div",{staticClass:"w-10 h-10 rounded-lg flex items-center justify-center text-lg shrink-0",class:e.installed?"bg-green-900/30 text-green-400":"bg-blue-900/30 text-blue-400"},[t("i",{staticClass:"fa-solid fa-shapes"})]),t("div",{staticClass:"flex-1 min-w-0"},[t("div",{staticClass:"flex items-center gap-2"},[t("h4",{staticClass:"text-white font-semibold text-sm truncate"},[e._v(e._s(e.skill.name))]),e.installed?t("el-tag",{attrs:{type:"success",size:"mini"}},[e._v("已安装")]):e._e()],1),t("p",{staticClass:"text-textMuted text-xs mt-1 line-clamp-2"},[e._v(e._s(e.skill.description||"No description"))])])]),e.skill.tags?t("div",{staticClass:"flex items-center gap-1 flex-wrap mb-3"},e._l(e.tagList,function(i){return t("span",{key:i,staticClass:"text-[10px] px-2 py-0.5 rounded bg-white/5 text-textMuted"},[e._v(e._s(i))])}),0):e._e(),t("div",{staticClass:"flex items-center justify-between mt-auto pt-3 border-t border-border"},[t("div",{staticClass:"flex items-center gap-3 text-xs text-textMuted"},[e.skill.latest_version?t("span",{staticClass:"flex items-center gap-1"},[t("i",{staticClass:"fa-solid fa-code-branch"}),e._v(" "+e._s(e.skill.latest_version)+" ")]):e._e(),e.skill.download_count!==void 0?t("span",{staticClass:"flex items-center gap-1"},[t("i",{staticClass:"fa-solid fa-download"}),e._v(" "+e._s(e.skill.download_count)+" ")]):e._e()]),t("div",[e.installed?t("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(i){return e.$emit("view",e.skill)}}},[e._v("查看")]):e._e(),e.installed?t("el-button",{attrs:{type:"danger",size:"mini",plain:""},on:{click:function(i){return e.$emit("uninstall",e.skill)}}},[e._v("卸载")]):t("el-button",{attrs:{type:"primary",size:"mini",loading:e.installing},on:{click:function(i){return e.$emit("install",e.skill)}}},[e._v("安装")])],1)])])},Qgt=[],Jgt=Li(Zgt,Xgt,Qgt,!1,null,"9f1fb0b4");const ept=Jgt.exports,tpt={name:"SkillMarket",components:{SkillCard:ept},props:{localSkills:{type:Array,default:()=>[]},projectPath:{type:String,default:""}},data(){return{categories:[],selectedCategoryId:null,keyword:"",filterMode:"all",skills:[],localInstalledSkills:[],total:0,currentPage:1,pageSize:20,loading:!1,installingIds:{}}},computed:{displaySkills(){return this.filterMode==="installed"?this.localInstalledSkills:this.skills}},created(){this.loadCategories(),this.loadSkills()},methods:{async loadCategories(){try{const s=await jt.getSkillCategories();this.categories=s.data||[]}catch(s){console.error("Failed to load categories:",s)}},async loadSkills(){this.loading=!0;try{const e=(await jt.getPublishedSkills({page:this.currentPage,pageSize:this.pageSize,keyword:this.keyword||void 0,categoryId:this.selectedCategoryId||void 0})).data||{};this.skills=e.list||[],this.total=e.total||0}catch(s){console.error("Failed to load skills:",s),this.skills=[]}finally{this.loading=!1}},async loadLocalInstalledSkills(){this.loading=!0;try{const s=await jt.getLocalSkills(this.projectPath);this.localInstalledSkills=s.data||[]}catch(s){console.error("Failed to load local installed skills:",s),this.localInstalledSkills=[]}finally{this.loading=!1}},selectFilter(s){this.filterMode=s,this.currentPage=1,this.selectedCategoryId="",s==="installed"?this.loadLocalInstalledSkills():this.loadSkills()},selectCategory(s){this.selectedCategoryId=s,this.currentPage=1,this.filterMode="",this.loadSkills()},onSearch(){this.currentPage=1,this.loadSkills()},handlePageChange(s){this.currentPage=s,this.loadSkills()},isInstalled(s){return this.localSkills.some(e=>e.name===s)},async handleInstall(s){try{await this.$confirm(`确定要安装 "${s.name}" 吗?`,"确认",{type:"info"})}catch{return}this.$set(this.installingIds,s.id,!0);try{await jt.installSkill(s.id,s.name),this.$message.success(`安装成功: ${s.name}`),this.$emit("refresh-local")}catch(e){this.$message.error("安装失败: "+(e.message||"Unknown error"))}finally{this.$set(this.installingIds,s.id,!1)}},async handleUninstall(s){try{await this.$confirm(`确定要卸载 "${s.name}" 吗?`,"确认",{type:"warning"}),await jt.uninstallSkill(s.name),this.$message.success(`卸载成功: ${s.name}`),this.$emit("refresh-local"),this.filterMode==="installed"&&this.loadLocalInstalledSkills()}catch(e){e!=="cancel"&&this.$message.error("卸载失败: "+(e.message||"Unknown error"))}},handleView(s){this.$emit("view",s)}}};var ipt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"skill-market flex flex-col h-full"},[t("div",{staticClass:"flex items-center gap-2 mb-4 flex-wrap"},[t("el-input",{staticClass:"w-[200px]",staticStyle:{width:"250px"},attrs:{placeholder:"搜索 Skill...",size:"small",clearable:""},on:{keyup:function(i){return!i.type.indexOf("key")&&e._k(i.keyCode,"enter",13,i.key,"Enter")?null:e.onSearch.apply(null,arguments)}},model:{value:e.keyword,callback:function(i){e.keyword=i},expression:"keyword"}}),t("el-button",{attrs:{size:"small",type:"primary"},on:{click:e.onSearch}},[e._v("查询")]),t("button",{staticClass:"px-3 py-1 rounded text-sm border transition-colors",class:e.filterMode==="all"?"bg-accent text-white border-accent":"bg-sidebar text-textMuted border-border hover:text-white hover:border-accent",on:{click:function(i){return e.selectFilter("all")}}},[e._v("全部")]),t("button",{staticClass:"px-3 py-1 rounded text-sm border transition-colors",class:e.filterMode==="installed"?"bg-accent text-white border-accent":"bg-sidebar text-textMuted border-border hover:text-white hover:border-accent",on:{click:function(i){return e.selectFilter("installed")}}},[e._v("已安装")]),e._l(e.categories,function(i){return t("button",{key:i.id,staticClass:"px-3 py-1 rounded text-sm border transition-colors",class:e.selectedCategoryId===i.id?"bg-accent text-white border-accent":"bg-sidebar text-textMuted border-border hover:text-white hover:border-accent",on:{click:function(n){return e.selectCategory(i.id)}}},[e._v(e._s(i.name))])})],2),e.loading?t("div",{staticClass:"flex-1 flex items-center justify-center"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin text-2xl text-textMuted"})]):e.displaySkills.length===0?t("div",{staticClass:"flex-1 flex flex-col items-center justify-center text-textMuted"},[t("i",{staticClass:"fa-solid fa-shapes text-4xl mb-4 opacity-30"}),t("p",[e._v("暂无 Skill")])]):[t("div",{staticClass:"flex-1 overflow-y-auto"},[t("div",{staticClass:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4"},e._l(e.displaySkills,function(i){return t("SkillCard",{key:i.id||i.name,attrs:{skill:i,installed:e.filterMode==="installed"?!0:e.isInstalled(i.name),installing:e.installingIds[i.id]},on:{install:e.handleInstall,uninstall:e.handleUninstall,view:e.handleView}})}),1)]),e.filterMode==="all"&&e.total>e.pageSize?t("div",{staticClass:"flex items-center justify-center pt-4 mt-auto"},[t("el-pagination",{attrs:{background:"",small:"",layout:"prev, pager, next",total:e.total,"page-size":e.pageSize,"current-page":e.currentPage},on:{"current-change":e.handlePageChange}})],1):e._e()]],2)},npt=[],spt=Li(tpt,ipt,npt,!1,null,null);const rpt=spt.exports,opt={name:"SkillViewer",props:{visible:{type:Boolean,default:!1},skill:{type:Object,default:null},content:{type:String,default:""}},computed:{dialogVisible:{get(){return this.visible},set(s){this.$emit("update:visible",s)}}}};var apt=function(){var e=this,t=e._self._c;return t("el-dialog",{staticClass:"skill-viewer-dialog",attrs:{title:e.skill.name,visible:e.dialogVisible,width:"800px"},on:{"update:visible":function(i){e.dialogVisible=i}}},[e.skill?t("div",{staticClass:"max-h-[60vh] overflow-y-auto"},[t("div",{staticClass:"mb-4"},[t("p",{staticClass:"text-textMuted text-sm mt-1"},[e._v(e._s(e.skill.description))])]),t("pre",{staticClass:"bg-sidebar p-4 rounded text-sm text-textMain overflow-x-auto whitespace-pre-wrap"},[e._v(e._s(e.content))])]):e._e()])},lpt=[],cpt=Li(opt,apt,lpt,!1,null,"0de9708e");const dpt=cpt.exports,upt={name:"SpecCard",props:{spec:{type:Object,required:!0},installed:{type:Boolean,default:!1},installing:{type:Boolean,default:!1}}};var hpt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"spec-card bg-sidebar border border-border rounded-lg p-4 hover:border-accent transition-colors flex flex-col"},[t("div",{staticClass:"flex items-start gap-3 mb-3"},[t("div",{staticClass:"w-10 h-10 rounded-lg flex items-center justify-center text-lg shrink-0",class:e.installed?"bg-green-900/30 text-green-400":"bg-purple-900/30 text-purple-400"},[t("i",{staticClass:"fa-solid fa-file-alt"})]),t("div",{staticClass:"flex-1 min-w-0"},[t("div",{staticClass:"flex items-center gap-2"},[t("h4",{staticClass:"text-white font-semibold text-sm truncate"},[e._v(e._s(e.spec.name))]),e.installed?t("el-tag",{attrs:{type:"success",size:"mini"}},[e._v("已安装")]):e._e()],1),t("p",{staticClass:"text-textMuted text-xs mt-1 line-clamp-2"},[e._v(e._s(e.spec.description||"No description"))])])]),t("div",{staticClass:"flex items-center justify-between mt-auto pt-3 border-t border-border"},[t("div",{staticClass:"flex items-center gap-3 text-xs text-textMuted"},[e.spec.latest_version?t("span",{staticClass:"flex items-center gap-1"},[t("i",{staticClass:"fa-solid fa-code-branch"}),e._v(" "+e._s(e.spec.latest_version)+" ")]):e._e(),e.spec.download_count!==void 0?t("span",{staticClass:"flex items-center gap-1"},[t("i",{staticClass:"fa-solid fa-download"}),e._v(" "+e._s(e.spec.download_count)+" ")]):e._e()]),t("div",[e.installed?t("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(i){return e.$emit("view",e.spec)}}},[e._v("查看")]):e._e(),e.installed?t("el-button",{attrs:{type:"danger",size:"mini",plain:""},on:{click:function(i){return e.$emit("uninstall",e.spec)}}},[e._v("卸载")]):t("el-button",{attrs:{type:"primary",size:"mini",loading:e.installing},on:{click:function(i){return e.$emit("install",e.spec)}}},[e._v("安装")])],1)])])},fpt=[],gpt=Li(upt,hpt,fpt,!1,null,"45111e53");const ppt=gpt.exports,mpt={name:"SpecMarket",components:{SpecCard:ppt},props:{localSpecs:{type:Array,default:()=>[]},projectPath:{type:String,default:""}},data(){return{categories:[],selectedCategoryId:null,keyword:"",filterMode:"all",specs:[],localInstalledSpecs:[],total:0,currentPage:1,pageSize:20,loading:!1,installingIds:{}}},computed:{displaySpecs(){return this.filterMode==="installed"?this.localInstalledSpecs:this.specs}},created(){this.loadCategories(),this.loadSpecs()},methods:{async loadCategories(){try{const s=await jt.getSpecCategories();this.categories=s.data||[]}catch(s){console.error("Failed to load spec categories:",s)}},async loadSpecs(){this.loading=!0;try{const e=(await jt.getPublishedSpecs({page:this.currentPage,pageSize:this.pageSize,keyword:this.keyword||void 0,categoryId:this.selectedCategoryId||void 0})).data||{};this.specs=e.list||[],this.total=e.total||0}catch(s){console.error("Failed to load specs:",s),this.specs=[]}finally{this.loading=!1}},async loadLocalInstalledSpecs(){var s;this.loading=!0;try{const e=await jt.getLocalSpecs(this.projectPath);this.localInstalledSpecs=((s=e.data)==null?void 0:s.specs)||[]}catch(e){console.error("Failed to load local installed specs:",e),this.localInstalledSpecs=[]}finally{this.loading=!1}},selectFilter(s){this.filterMode=s,this.currentPage=1,this.selectedCategoryId="",s==="installed"?this.loadLocalInstalledSpecs():this.loadSpecs()},selectCategory(s){this.selectedCategoryId=s,this.currentPage=1,this.filterMode="",this.loadSpecs()},onSearch(){this.currentPage=1,this.loadSpecs()},handlePageChange(s){this.currentPage=s,this.loadSpecs()},isInstalled(s){return this.localSpecs.some(e=>e.name===s)},async handleInstall(s){try{await this.$confirm(`确定要安装 "${s.name}" 吗?`,"确认",{type:"info"})}catch{return}this.$set(this.installingIds,s.id,!0);try{await jt.installSpec(s.id,s.name),this.$message.success(`安装成功: ${s.name}`),this.$emit("refresh-local")}catch(e){this.$message.error("安装失败: "+(e.message||"Unknown error"))}finally{this.$set(this.installingIds,s.id,!1)}},async handleUninstall(s){try{await this.$confirm(`确定要卸载 "${s.name}" 吗?`,"确认",{type:"warning"}),await jt.uninstallSpec(s.name),this.$message.success(`卸载成功: ${s.name}`),this.$emit("refresh-local"),this.filterMode==="installed"&&this.loadLocalInstalledSpecs()}catch(e){e!=="cancel"&&this.$message.error("卸载失败: "+(e.message||"Unknown error"))}},handleView(s){this.$emit("view",s)}}};var _pt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"spec-market flex flex-col h-full"},[t("div",{staticClass:"flex items-center gap-2 mb-4 flex-wrap"},[t("el-input",{staticClass:"w-[200px]",staticStyle:{width:"250px"},attrs:{placeholder:"搜索规范...",size:"small",clearable:""},on:{keyup:function(i){return!i.type.indexOf("key")&&e._k(i.keyCode,"enter",13,i.key,"Enter")?null:e.onSearch.apply(null,arguments)}},model:{value:e.keyword,callback:function(i){e.keyword=i},expression:"keyword"}}),t("el-button",{attrs:{size:"small",type:"primary"},on:{click:e.onSearch}},[e._v("查询")]),t("button",{staticClass:"px-3 py-1 rounded text-sm border transition-colors",class:e.filterMode==="all"?"bg-accent text-white border-accent":"bg-sidebar text-textMuted border-border hover:text-white hover:border-accent",on:{click:function(i){return e.selectFilter("all")}}},[e._v("全部")]),t("button",{staticClass:"px-3 py-1 rounded text-sm border transition-colors",class:e.filterMode==="installed"?"bg-accent text-white border-accent":"bg-sidebar text-textMuted border-border hover:text-white hover:border-accent",on:{click:function(i){return e.selectFilter("installed")}}},[e._v("已安装")]),e._l(e.categories,function(i){return t("button",{key:i.id,staticClass:"px-3 py-1 rounded text-sm border transition-colors",class:e.selectedCategoryId===i.id?"bg-accent text-white border-accent":"bg-sidebar text-textMuted border-border hover:text-white hover:border-accent",on:{click:function(n){return e.selectCategory(i.id)}}},[e._v(e._s(i.name))])})],2),e.loading?t("div",{staticClass:"flex-1 flex items-center justify-center"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin text-2xl text-textMuted"})]):e.displaySpecs.length===0?t("div",{staticClass:"flex-1 flex flex-col items-center justify-center text-textMuted"},[t("i",{staticClass:"fa-solid fa-file-alt text-4xl mb-4 opacity-30"}),t("p",[e._v("暂无规范")])]):[t("div",{staticClass:"flex-1 overflow-y-auto"},[t("div",{staticClass:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4"},e._l(e.displaySpecs,function(i){return t("SpecCard",{key:i.id||i.name,attrs:{spec:i,installed:e.filterMode==="installed"?!0:e.isInstalled(i.name),installing:e.installingIds[i.id]},on:{install:e.handleInstall,uninstall:e.handleUninstall,view:e.handleView}})}),1)]),e.filterMode==="all"&&e.total>e.pageSize?t("div",{staticClass:"flex items-center justify-center pt-4 mt-auto"},[t("el-pagination",{attrs:{background:"",small:"",layout:"prev, pager, next",total:e.total,"page-size":e.pageSize,"current-page":e.currentPage},on:{"current-change":e.handlePageChange}})],1):e._e()]],2)},vpt=[],bpt=Li(mpt,_pt,vpt,!1,null,null);const Cpt=bpt.exports,ypt={name:"SpecViewer",props:{visible:{type:Boolean,default:!1},spec:{type:Object,default:null},content:{type:String,default:""}},computed:{dialogVisible:{get(){return this.visible},set(s){this.$emit("update:visible",s)}}}};var wpt=function(){var e=this,t=e._self._c;return t("el-dialog",{staticClass:"spec-viewer-dialog",attrs:{title:e.spec.name,visible:e.dialogVisible,width:"800px"},on:{"update:visible":function(i){e.dialogVisible=i}}},[e.spec?t("div",{staticClass:"max-h-[60vh] overflow-y-auto"},[t("div",{staticClass:"mb-4"},[t("p",{staticClass:"text-textMuted text-sm mt-1"},[e._v(e._s(e.spec.description))])]),t("pre",{staticClass:"bg-sidebar p-4 rounded text-sm text-textMain overflow-x-auto whitespace-pre-wrap"},[e._v(e._s(e.content))])]):e._e()])},Spt=[],xpt=Li(ypt,wpt,Spt,!1,null,"21d87b34");const kpt=xpt.exports,Lpt={name:"MemoryDisplay",props:{items:{type:Array,default:()=>[]}}};var Dpt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"memory-display"},[e.items.length===0?t("div",{staticClass:"text-textMuted text-center py-8"},[e._v(" No memories yet. Click the edit button to add some. ")]):t("div",{staticClass:"space-y-4"},e._l(e.items,function(i,n){return t("div",{key:n,staticClass:"bg-sidebar rounded p-4 border border-border"},[t("div",{staticClass:"text-white whitespace-pre-wrap"},[e._v(e._s(i.content))]),i.description?t("div",{staticClass:"text-textMuted text-sm mt-2 whitespace-pre-wrap"},[e._v(e._s(i.description))]):e._e()])}),0)])},Ipt=[],Ept=Li(Lpt,Dpt,Ipt,!1,null,null);const Tpt=Ept.exports,Npt={name:"MemoryEditDialog",props:{visible:{type:Boolean,default:!1},content:{type:String,default:""}},data(){return{editContent:""}},computed:{dialogVisible:{get(){return this.visible},set(s){this.$emit("update:visible",s)}}},watch:{content(s){this.editContent=s}},methods:{handleClose(){this.$emit("update:visible",!1),this.$emit("close")},handleSave(){this.$emit("update:visible",!1),this.$emit("save",this.editContent)}}};var Ppt=function(){var e=this,t=e._self._c;return t("el-dialog",{staticClass:"memory-edit-dialog",attrs:{title:"Edit Memory",visible:e.dialogVisible,width:"800px"},on:{"update:visible":function(i){e.dialogVisible=i},close:e.handleClose}},[t("div",{staticClass:"mb-2 text-textMuted text-sm"},[e._v(' Format: memory content followed by optional description after "---", separated by § ')]),t("el-input",{staticClass:"w-full",attrs:{type:"textarea",rows:15},model:{value:e.editContent,callback:function(i){e.editContent=i},expression:"editContent"}}),t("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:e.handleClose}},[e._v("Cancel")]),t("el-button",{attrs:{type:"primary"},on:{click:e.handleSave}},[e._v("Save")])],1)],1)},Mpt=[],Rpt=Li(Npt,Ppt,Mpt,!1,null,"144910b3");const Opt=Rpt.exports,Apt={name:"Skills",components:{SkillMarket:rpt,SkillViewer:dpt,SpecMarket:Cpt,SpecViewer:kpt,MemoryDisplay:Tpt,MemoryEditDialog:Opt},data(){return{subTab:"market",filterText:"",localSkills:[],localSpecs:[],showSpecViewer:!1,currentSpec:null,currentSpecContent:"",showSkillViewer:!1,currentSkill:null,currentSkillContent:"",projectPath:"",memoryItems:[],memoryRawContent:"",showMemoryEdit:!1}},watch:{subTab(s){s==="memory"&&this.projectPath&&this.loadMemory()}},async created(){await this.loadProjectPath(),await this.loadLocalSkills(),await this.loadLocalSpecs(),this.subTab==="memory"&&await this.loadMemory()},methods:{async loadProjectPath(){try{const s=await jt.getProjectPath();s.success&&s.data&&(this.projectPath=s.data.path||"")}catch(s){console.error("Failed to load project path:",s)}},async loadLocalSkills(){try{const s=await jt.getLocalSkills(this.projectPath);this.localSkills=s.data||[]}catch(s){console.error("Failed to load local skills:",s),this.localSkills=[]}},async handleViewSkill(s){try{const e=await jt.getSkillContent(s.name);this.currentSkill=s,this.currentSkillContent=e.data,this.showSkillViewer=!0}catch(e){console.error("Failed to load skill content:",e),this.$message.error("Failed to load skill content")}},async loadLocalSpecs(){var s;try{const e=await jt.getLocalSpecs(this.projectPath);this.localSpecs=((s=e.data)==null?void 0:s.specs)||[]}catch(e){console.error("Failed to load local specs:",e),this.localSpecs=[]}},async handleViewSpec(s){try{const e=await jt.getSpecContent(s.name);this.currentSpec=s,this.currentSpecContent=e.data,this.showSpecViewer=!0}catch(e){console.error("Failed to load spec content:",e),this.$message.error("Failed to load spec content")}},async loadMemory(){var s,e;try{const t=await jt.getMemory(this.projectPath);this.memoryItems=((s=t.data)==null?void 0:s.items)||[],this.memoryRawContent=((e=t.data)==null?void 0:e.rawContent)||""}catch(t){console.error("Failed to load memory:",t),this.memoryItems=[],this.memoryRawContent=""}},openMemoryEdit(){this.showMemoryEdit=!0},async handleSaveMemory(s){try{await jt.saveMemory(this.projectPath,s),await this.loadMemory(),this.$message.success("Memory saved")}catch(e){console.error("Failed to save memory:",e),this.$message.error("Failed to save memory")}}}};var Fpt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"flex-1 flex overflow-hidden"},[t("aside",{staticClass:"w-[220px] bg-sidebar border-r border-border flex flex-col shrink-0 py-4"},[t("div",{staticClass:"px-4 mb-4"},[t("h2",{staticClass:"text-white font-bold text-lg mb-1"},[e._v("Skills & Specs")]),t("input",{directives:[{name:"model",rawName:"v-model",value:e.filterText,expression:"filterText"}],staticClass:"w-full bg-black/20 border border-border rounded px-2 py-1 text-xs",attrs:{type:"text",placeholder:"Filter..."},domProps:{value:e.filterText},on:{input:function(i){i.target.composing||(e.filterText=i.target.value)}}})]),t("div",{staticClass:"flex-1 overflow-y-auto"},[t("div",{staticClass:"px-4 py-1 text-xs font-bold text-textMuted uppercase mt-2"},[e._v("Skills")]),t("button",{staticClass:"w-full text-left px-4 py-2 flex items-center gap-2",class:e.subTab==="market"?"bg-active text-white border-l-2 border-accent":"text-textMuted hover:text-white hover:bg-white/5 border-l-2 border-transparent",on:{click:function(i){e.subTab="market"}}},[t("i",{staticClass:"fa-solid fa-store w-4 text-center"}),e._v(" skill 市场 ")]),t("div",{staticClass:"px-4 py-1 text-xs font-bold text-textMuted uppercase mt-4"},[e._v("Specs")]),t("button",{staticClass:"w-full text-left px-4 py-2 flex items-center gap-2",class:e.subTab==="specMarket"?"bg-active text-white border-l-2 border-accent":"text-textMuted hover:text-white hover:bg-white/5 border-l-2 border-transparent",on:{click:function(i){e.subTab="specMarket"}}},[t("i",{staticClass:"fa-solid fa-store w-4 text-center"}),e._v(" 规范市场 ")]),t("div",{staticClass:"px-4 py-1 text-xs font-bold text-textMuted uppercase mt-4"},[e._v("Memory")]),t("button",{staticClass:"w-full text-left px-4 py-2 flex items-center gap-2",class:e.subTab==="memory"?"bg-active text-white border-l-2 border-accent":"text-textMuted hover:text-white hover:bg-white/5 border-l-2 border-transparent",on:{click:function(i){e.subTab="memory"}}},[t("i",{staticClass:"fa-solid fa-brain w-4 text-center"}),e._v(" 记忆 ")])])]),t("main",{staticClass:"flex-1 flex flex-col bg-contentBg min-w-0"},[t("div",{directives:[{name:"show",rawName:"v-show",value:e.subTab==="market",expression:"subTab === 'market'"}],staticClass:"flex-1 p-6 overflow-hidden flex flex-col"},[t("SkillMarket",{ref:"skillMarket",attrs:{"local-skills":e.localSkills,"project-path":e.projectPath},on:{"refresh-local":e.loadLocalSkills,view:e.handleViewSkill}})],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.subTab==="specMarket",expression:"subTab === 'specMarket'"}],staticClass:"flex-1 p-6 overflow-hidden flex flex-col"},[t("SpecMarket",{ref:"specMarket",attrs:{"local-specs":e.localSpecs,"project-path":e.projectPath},on:{"refresh-local":e.loadLocalSpecs,view:e.handleViewSpec}})],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.subTab==="memory",expression:"subTab === 'memory'"}],staticClass:"flex-1 flex flex-col overflow-hidden"},[t("div",{staticClass:"flex items-center justify-between px-6 py-3 border-b border-border"},[t("h2",{staticClass:"text-lg font-bold text-white"},[e._v("记忆")]),t("el-button",{attrs:{size:"small"},on:{click:e.openMemoryEdit}},[t("i",{staticClass:"fa-solid fa-pen"})])],1),t("div",{staticClass:"flex-1 p-6 overflow-y-auto"},[t("MemoryDisplay",{attrs:{items:e.memoryItems}})],1)])]),t("SpecViewer",{attrs:{visible:e.showSpecViewer,spec:e.currentSpec,content:e.currentSpecContent},on:{"update:visible":function(i){e.showSpecViewer=i}}}),t("SkillViewer",{attrs:{visible:e.showSkillViewer,skill:e.currentSkill,content:e.currentSkillContent},on:{"update:visible":function(i){e.showSkillViewer=i}}}),t("MemoryEditDialog",{attrs:{visible:e.showMemoryEdit,content:e.memoryRawContent},on:{"update:visible":function(i){e.showMemoryEdit=i},save:e.handleSaveMemory}})],1)},Bpt=[],Wpt=Li(Apt,Fpt,Bpt,!1,null,null);const Vpt=Wpt.exports,Hpt={name:"DbView",data(){return{tables:[],selectedTable:null,tableInfo:{},tableData:{columns:[],rows:[]},page:1,pageSize:50,totalPages:1,loading:!1}},async created(){await this.loadTables()},methods:{async loadTables(){this.loading=!0;try{const s=await jt.getDbTables();this.tables=(s.data||[]).map(e=>e.name)}catch(s){console.error("Load tables failed:",s),this.tables=[]}finally{this.loading=!1}},async selectTable(s){this.selectedTable=s,this.page=1,await this.loadTableInfo(),await this.loadTableData()},async loadTableInfo(){if(this.selectedTable)try{const s=await jt.getTableInfo(this.selectedTable);this.tableInfo=s.data||{},this.totalPages=Math.max(1,Math.ceil((this.tableInfo.row_count||0)/this.pageSize))}catch(s){console.error("Load table info failed:",s),this.tableInfo={}}},async loadTableData(){if(this.selectedTable)try{const s=await jt.getTableData(this.selectedTable,this.page,this.pageSize);this.tableData={rows:s.data||[]}}catch(s){console.error("Load table data failed:",s),this.tableData={columns:[],rows:[]}}},async prevPage(){this.page>1&&(this.page--,await this.loadTableData())},async nextPage(){this.page<this.totalPages&&(this.page++,await this.loadTableData())},formatCell(s){return s===null?"<null>":s===void 0?"":typeof s=="boolean"?s?"true":"false":typeof s=="object"?JSON.stringify(s):String(s)}}};var $pt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"flex-1 flex overflow-hidden"},[t("aside",{staticClass:"w-[260px] bg-sidebar border-r border-border flex flex-col shrink-0"},[e._m(0),t("div",{staticClass:"flex items-center gap-1 px-2 py-2 border-b border-border"},[t("button",{staticClass:"p-1 text-textMuted hover:text-white",attrs:{title:"刷新"},on:{click:e.loadTables}},[t("i",{staticClass:"fa-solid fa-refresh"})])]),t("div",{staticClass:"flex-1 overflow-y-auto py-1"},[e.loading?t("div",{staticClass:"flex items-center justify-center py-8 text-textMuted"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e.tables.length===0?t("div",{staticClass:"flex items-center justify-center py-8 text-textMuted text-sm"},[e._v(" 暂无表 ")]):t("div",e._l(e.tables,function(i){return t("div",{key:i,staticClass:"flex items-center gap-2 px-3 py-1.5 cursor-pointer text-sm",class:e.selectedTable===i?"bg-active text-white border-l-2 border-accent":"text-textMuted hover:text-white hover:bg-white/5 border-l-2 border-transparent",on:{click:function(n){return e.selectTable(i)}}},[t("i",{staticClass:"fa-solid fa-table text-textMuted text-xs"}),t("span",{staticClass:"truncate"},[e._v(e._s(i))])])}),0)])]),t("main",{staticClass:"flex-1 flex flex-col min-w-0 bg-contentBg"},[e.selectedTable?t("div",{staticClass:"flex-1 flex flex-col overflow-hidden"},[t("div",{staticClass:"flex items-center justify-between px-4 py-2 border-b border-border bg-sidebar"},[t("div",{staticClass:"flex items-center gap-2"},[t("i",{staticClass:"fa-solid fa-table text-textMuted"}),t("span",{staticClass:"text-sm text-white"},[e._v(e._s(e.selectedTable))]),t("span",{staticClass:"text-xs text-textMuted"},[e._v("("+e._s(e.tableInfo.row_count||0)+" 行)")])]),t("div",{staticClass:"flex items-center gap-2"},[t("button",{staticClass:"px-2 py-1 text-xs text-textMuted hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",attrs:{disabled:e.page<=1},on:{click:e.prevPage}},[t("i",{staticClass:"fa-solid fa-chevron-left"})]),t("span",{staticClass:"text-xs text-textMuted"},[e._v(e._s(e.page)+" / "+e._s(e.totalPages||1))]),t("button",{staticClass:"px-2 py-1 text-xs text-textMuted hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",attrs:{disabled:e.page>=e.totalPages},on:{click:e.nextPage}},[t("i",{staticClass:"fa-solid fa-chevron-right"})])])]),t("div",{staticClass:"flex-1 overflow-auto"},[t("table",{staticClass:"w-full text-sm"},[t("thead",{staticClass:"bg-sidebar sticky top-0"},[t("tr",e._l(e.tableInfo.columns,function(i){return t("th",{key:i.name,staticClass:"px-3 py-2 text-left text-xs font-bold text-textMuted uppercase border-b border-border"},[e._v(" "+e._s(i.name)+" "),t("span",{staticClass:"text-xs font-normal text-textMuted opacity-60 ml-1"},[e._v(e._s(i.type))])])}),0)]),t("tbody",[e._l(e.tableData.rows,function(i,n){return t("tr",{key:n,staticClass:"hover:bg-white/5"},e._l(e.tableInfo.columns,function(r){return t("td",{key:r.name,staticClass:"px-3 py-1.5 text-gray-300 border-b border-border/30"},[e._v(" "+e._s(e.formatCell(i[r.name]))+" ")])}),0)}),e.tableData.rows&&e.tableData.rows.length===0?t("tr",[t("td",{staticClass:"px-3 py-8 text-center text-textMuted",attrs:{colspan:e.tableInfo.columns?e.tableInfo.columns.length:0}},[e._v(" 表中无数据 ")])]):e._e()],2)])])]):t("div",{staticClass:"flex-1 flex items-center justify-center text-textMuted"},[e._m(1)])])])},zpt=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"flex border-b border-border text-xs uppercase font-bold text-textMuted"},[e("div",{staticClass:"px-4 py-2 border-b-2 border-accent text-white flex items-center gap-2"},[e("i",{staticClass:"fa-solid fa-database"}),s._v(" Tables ")])])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"text-center"},[e("i",{staticClass:"fa-solid fa-database text-6xl mb-4 opacity-20"}),e("p",[s._v("选择表查看数据")])])}],jpt=Li(Hpt,$pt,zpt,!1,null,null);const Upt=jpt.exports,qpt={name:"AppLayout",computed:{isHome(){return this.$route.path==="/views/app"}}};var Kpt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"app-layout"},[e.isHome?t("header",{staticClass:"app-header"},[e._m(0)]):e._e(),t("main",{staticClass:"app-content"},[t("router-view")],1)])},Gpt=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"header-left"},[e("i",{staticClass:"fa-solid fa-robot text-accent"}),e("span",[s._v("TXCode")])])}],Ypt=Li(qpt,Kpt,Gpt,!1,null,"ff369547");const Zpt=Ypt.exports,Xpt={name:"IndexViewApp",data(){return{sessions:[]}},async created(){await this.loadSessions()},methods:{goTo(s){this.$router.push(s)},async loadSessions(){try{const s=await jt.getSessions();this.sessions=s.data||[]}catch(s){console.error("加载会话失败:",s)}},goSession(s){this.$router.push({name:"app-ChatViewApp-session",params:{id:s.id}})},async createSession(){try{const s=await jt.createSession("新会话");this.$router.push({name:"app-ChatViewApp-session",params:{id:s.data.id}})}catch{this.$message.error("创建会话失败")}},formatTime(s){if(!s)return"";const e=new Date(s),i=new Date-e;return i<6e4?"刚刚":i<36e5?Math.floor(i/6e4)+"分钟前":i<864e5?Math.floor(i/36e5)+"小时前":i<6048e5?Math.floor(i/864e5)+"天前":e.toLocaleDateString()}}};var Qpt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"index-view"},[e._m(0),t("div",{staticClass:"feature-grid"},[t("div",{staticClass:"feature-card code",on:{click:function(i){return e.goTo("/views/app/ChatViewApp")}}},[t("i",{staticClass:"fa-regular fa-comments"}),t("h3",[e._v("代码对话")]),t("p",[e._v("与 AI 对话开发")])]),t("div",{staticClass:"feature-card workflow",on:{click:function(i){return e.goTo("/views/app/DevWorkflowViewApp")}}},[t("i",{staticClass:"fa-solid fa-laptop-code"}),t("h3",[e._v("软件研发")]),t("p",[e._v("规范研发流程")])]),t("div",{staticClass:"feature-card files",on:{click:function(i){return e.goTo("/views/app/FilesViewApp")}}},[t("i",{staticClass:"fa-solid fa-folder-open"}),t("h3",[e._v("文件管理")]),t("p",[e._v("浏览项目文件")])]),t("div",{staticClass:"feature-card git",on:{click:function(i){return e.goTo("/views/app/GitChangesApp")}}},[t("i",{staticClass:"fa-brands fa-git-alt"}),t("h3",[e._v("Git变更")]),t("p",[e._v("查看代码变更")])])]),t("div",{staticClass:"section-header"},[t("h2",{staticClass:"section-title"},[e._v("最近会话")]),t("a",{staticClass:"section-more",attrs:{href:"javascript:void(0)"},on:{click:function(i){return e.goTo("/views/app/ChatViewApp")}}},[e._v("查看全部")])]),e.sessions.length>0?t("div",{staticClass:"session-list"},e._l(e.sessions.slice(0,5),function(i){return t("div",{key:i.id,staticClass:"session-item",on:{click:function(n){return e.goSession(i)}}},[e._m(1,!0),t("div",{staticClass:"session-info"},[t("h4",[e._v(e._s(i.title||"未命名会话"))]),t("p",[e._v(e._s(e.formatTime(i.updatedAt||i.createTime)))])]),t("div",{staticClass:"session-status"})])}),0):t("div",{staticClass:"empty-state"},[t("i",{staticClass:"fa-regular fa-comment-dots"}),t("p",[e._v("暂无会话记录")]),t("span",{staticClass:"start-btn",on:{click:e.createSession}},[e._v("开始新对话")])])])},Jpt=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"welcome-section"},[e("div",{staticClass:"welcome-icon"},[e("i",{staticClass:"fa-solid fa-wand-magic-sparkles"})]),e("h1",{staticClass:"welcome-title"},[s._v("你好,我是 TXCode")]),e("p",{staticClass:"welcome-subtitle"},[s._v("AI 驱动的软件开发助手")])])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"session-icon"},[e("i",{staticClass:"fa-solid fa-robot"})])}],emt=Li(Xpt,Qpt,Jpt,!1,null,"b3cab99a");const tmt=emt.exports,imt={name:"FilesViewApp",data(){return{projects:[],currentProject:null,browseResult:{current_path:"",parent_path:null,items:[]},loading:!1,contextMenu:{visible:!1,target:null},inputDialog:{visible:!1,title:"",value:"",placeholder:"",type:"",target:null},confirmDialog:{visible:!1,message:"",target:null},fileViewerVisible:!1,editingFileName:"",editingFilePath:"",fileLoading:!1,saving:!1,isBinary:!1,editor:null,originalContent:"",fileIcons:{js:"fa-brands fa-js text-yellow-400",ts:"fa-brands fa-js text-blue-400",html:"fa-brands fa-html5 text-orange-500",css:"fa-brands fa-css3 text-blue-400",json:"fa-solid fa-file-code text-yellow-300",yaml:"fa-solid fa-file-code text-blue-300",yml:"fa-solid fa-file-code text-blue-300",md:"fa-solid fa-file-lines text-gray-400",py:"fa-brands fa-python text-blue-500",vue:"fa-brands fa-vuejs text-green-400",sh:"fa-solid fa-terminal text-green-400",go:"fa-brands fa-golang text-cyan-400"}}},computed:{fileTreeData(){return this.browseResult.items.map(e=>this.transformNode(e)).sort((e,t)=>e.is_directory===t.is_directory?e.name.localeCompare(t.name):e.is_directory?-1:1)},currentDirName(){const s=this.browseResult.current_path;return s?s.split(/[/\\]/).pop()||s:"我的电脑"},hasChanges(){return this.editor?this.editor.getValue()!==this.originalContent:!1},isBinaryFile(){return this.isBinary}},async created(){await this.loadProjects(),await this.browse(""),document.addEventListener("keydown",this.handleKeydown)},beforeDestroy(){document.removeEventListener("keydown",this.handleKeydown),this.editor&&(this.editor.dispose(),this.editor=null)},methods:{async loadProjects(){try{const s=await jt.getProjects();this.projects=s.data||[];const e=await jt.getCurrentProject();this.currentProject=e.data||null}catch(s){console.error("Load projects failed:",s)}},async handleProjectChange(s){try{await jt.setCurrentProject(s);const e=this.projects.find(t=>t.id===s);e&&(this.currentProject=e),location.reload()}catch(e){this.$message.error("切换项目失败: "+e.message)}},async browse(s){this.loading=!0;try{const e=await jt.browseFilesystem(s);this.browseResult=e.data}catch(e){console.error("Browse failed:",e)}finally{this.loading=!1}},transformNode(s){return{name:s.name,path:s.path,is_directory:s.is_directory,is_drive:s.is_drive||!1,size:s.size,is_binary:s.is_binary||!1}},handleItemClick(s){s.is_directory?this.browse(s.path):this.openFileViewer(s)},toggleMenu(){this.$message.info("长安文件可进行更多操作")},async openFileItem(){this.hideContextMenu(),this.contextMenu.target&&this.openFileViewer(this.contextMenu.target)},goBack(){this.$router.back()},goUp(){if(!this.browseResult.parent_path&&this.browseResult.parent_path!=="")return;const s=this.browseResult.parent_path===""?"":this.browseResult.parent_path;this.browse(s)},async openFileViewer(s){var n,r;if(this.fileViewerVisible=!0,this.editingFileName=s.name,this.editingFilePath=s.path,this.fileLoading=!0,this.isBinary=s.is_binary||!1,this.editor=null,this.isBinary){this.fileLoading=!1;return}let e="";try{const o=await jt.getFileContent(s.path);this.isBinary=((n=o.data)==null?void 0:n.is_binary)||!1,e=((r=o.data)==null?void 0:r.content)||""}catch(o){console.error("Load file failed:",o),this.fileLoading=!1;return}if(this.fileLoading=!1,this.isBinary||(await this.$nextTick(),!this.$refs.editorContainer))return;this.editor=Dg.create(this.$refs.editorContainer,{value:"",language:"plaintext",theme:"vs-dark",automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:16,fontFamily:'Consolas, Monaco, "Courier New", monospace',lineNumbers:"on",roundedSelection:!1,scrollbar:{useShadows:!1,vertical:"auto",horizontal:"auto"}}),this.editor.onDidChangeModelContent(()=>{this.$forceUpdate()}),this.editor.addCommand(ix.CtrlCmd|tx.KeyS,()=>{this.saveFile()});const t=this.getLanguageFromFilename(s.name),i=Dg.createModel(e,t);this.editor.setModel(i),this.originalContent=e},closeFileViewer(){this.editor&&(this.editor.dispose(),this.editor=null),this.fileViewerVisible=!1},async saveFile(){if(!(!this.editor||this.saving)){this.saving=!0;try{const s=this.editor.getValue();await jt.writeFile(this.editingFilePath,s),this.originalContent=s,this.$message.success("已保存")}catch(s){console.error("Save failed:",s),this.$message.error("保存失败")}finally{this.saving=!1}}},initEditor(){this.editor||!this.$refs.editorContainer||(this.editor=Dg.create(this.$refs.editorContainer,{value:"",language:"plaintext",theme:"vs-dark",automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:16,fontFamily:'Consolas, Monaco, "Courier New", monospace',lineNumbers:"on"}),this.editor.addCommand(ix.CtrlCmd|tx.KeyS,()=>{this.saveFile()}))},showContextMenu(s,e){s.stopPropagation(),this.contextMenu={visible:!0,target:e}},hideContextMenu(){this.contextMenu.visible=!1},copyPath(){this.hideContextMenu(),this.contextMenu.target&&(navigator.clipboard.writeText(this.contextMenu.target.path),this.$message.success("路径已复制"))},createNewFile(){this.hideContextMenu(),this.inputDialog={visible:!0,title:"新建文件",value:"",placeholder:"输入文件名",type:"file",target:this.contextMenu.target},this.$nextTick(()=>{var s;(s=this.$refs.dialogInput)==null||s.focus()})},createNewFolder(){this.hideContextMenu(),this.inputDialog={visible:!0,title:"新建文件夹",value:"",placeholder:"输入文件夹名",type:"folder",target:this.contextMenu.target},this.$nextTick(()=>{var s;(s=this.$refs.dialogInput)==null||s.focus()})},renameItem(){this.hideContextMenu(),this.inputDialog={visible:!0,title:"重命名",value:this.contextMenu.target.name,placeholder:"输入新名称",type:"rename",target:this.contextMenu.target},this.$nextTick(()=>{var s,e;(s=this.$refs.dialogInput)==null||s.focus(),(e=this.$refs.dialogInput)==null||e.select()})},async confirmInput(){const{type:s,value:e,target:t}=this.inputDialog;if(!e.trim()){this.cancelInput();return}try{const i=t.path.includes("\\")?"\\":"/";if(s==="file"){const n=t.path+i+e.trim();await jt.writeFile(n,"")}else if(s==="folder"){const n=t.path+i+e.trim();await jt.createDirectory(n)}else if(s==="rename"){const r=t.path.substring(0,t.path.lastIndexOf(i))+i+e.trim();await jt.renameFile(t.path,r)}this.browse(this.browseResult.current_path)}catch(i){console.error("Operation failed:",i),this.$message.error("操作失败")}this.inputDialog.visible=!1},cancelInput(){this.inputDialog.visible=!1},deleteItem(){this.hideContextMenu(),this.confirmDialog={visible:!0,message:`确定要删除 "${this.contextMenu.target.name}" 吗?`,target:this.contextMenu.target}},cancelConfirm(){this.confirmDialog.visible=!1},async confirmDelete(){try{await jt.deleteFile(this.confirmDialog.target.path),this.$message.success("删除成功"),this.browse(this.browseResult.current_path)}catch(s){console.error("Delete failed:",s),this.$message.error("删除失败")}this.confirmDialog.visible=!1},handleKeydown(s){s.ctrlKey&&s.key==="s"&&this.fileViewerVisible&&(s.preventDefault(),this.saveFile())},getItemIcon(s){if(s.is_directory)return"fa-solid fa-folder text-blue-400";const e=s.name.split(".").pop().toLowerCase(),t=s.name.toLowerCase();return t==="dockerfile"?"fa-brands fa-docker text-blue-400":t===".gitignore"?"fa-brands fa-git text-red-400":this.fileIcons[e]||"fa-solid fa-file text-gray-400"},getLanguageFromFilename(s){const e=s.split(".").pop().toLowerCase();return{js:"javascript",ts:"typescript",html:"html",css:"css",vue:"html",py:"python",md:"markdown",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",sql:"sql",sh:"shell",go:"go",rs:"rust"}[e]||"plaintext"}}};var nmt=function(){var i,n,r,o;var e=this,t=e._self._c;return t("div",{staticClass:"h-full flex flex-col bg-[#1e1e1e]"},[t("div",{staticClass:"bg-sidebar border-b border-border px-4 py-3 flex items-center justify-between shrink-0"},[t("div",{staticClass:"flex items-center gap-2"},[t("button",{staticClass:"p-2 text-textMuted hover:text-white",attrs:{title:"返回"},on:{click:e.goBack}},[t("i",{staticClass:"fa-solid fa-chevron-left"})]),t("button",{staticClass:"p-2 text-textMuted hover:text-white disabled:opacity-30",attrs:{disabled:!e.browseResult.parent_path&&e.browseResult.parent_path!=="",title:"上级目录"},on:{click:e.goUp}},[t("i",{staticClass:"fa-solid fa-arrow-up"})])]),t("div",{staticClass:"flex items-center gap-2"},[e.projects.length>0?t("el-dropdown",{attrs:{trigger:"click"},on:{command:e.handleProjectChange}},[t("span",{staticClass:"text-sm text-white cursor-pointer hover:text-accent"},[e._v(" "+e._s(((i=e.currentProject)==null?void 0:i.name)||"选择项目")+" "),t("i",{staticClass:"fa-solid fa-chevron-down ml-1 text-xs"})]),t("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},e._l(e.projects,function(a){var l;return t("el-dropdown-item",{key:a.id,attrs:{command:a.id}},[t("span",{class:a.id===((l=e.currentProject)==null?void 0:l.id)?"text-accent":""},[e._v(e._s(a.name))])])}),1)],1):e._e()],1),t("button",{staticClass:"p-2 text-textMuted hover:text-white",on:{click:e.toggleMenu}},[t("i",{staticClass:"fa-solid fa-ellipsis-v"})])]),t("div",{staticClass:"flex-1 overflow-y-auto"},[e.loading?t("div",{staticClass:"flex flex-col items-center justify-center h-full text-textMuted"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin text-2xl mb-2"}),t("span",{staticClass:"text-sm"},[e._v("加载中...")])]):e.fileTreeData.length===0?t("div",{staticClass:"flex flex-col items-center justify-center h-full text-textMuted"},[t("i",{staticClass:"fa-solid fa-folder-open text-4xl mb-2 opacity-30"}),t("span",{staticClass:"text-sm"},[e._v("此目录为空")])]):t("div",{staticClass:"divide-y divide-border"},e._l(e.fileTreeData,function(a){return t("div",{key:a.path,staticClass:"flex items-center px-4 py-3 active:bg-active",on:{click:function(l){return e.handleItemClick(a)}}},[t("i",{staticClass:"text-lg w-8 text-center",class:e.getItemIcon(a)}),t("span",{staticClass:"flex-1 text-sm text-white ml-2 truncate"},[e._v(e._s(a.name))]),a.is_directory?t("i",{staticClass:"fa-solid fa-chevron-right text-textMuted text-xs"}):e._e()])}),0)]),e.contextMenu.visible?t("div",{staticClass:"fixed inset-0 bg-black/50 z-50",on:{click:e.hideContextMenu}},[t("div",{staticClass:"absolute bottom-0 left-0 right-0 bg-sidebar rounded-t-xl p-4",on:{click:function(a){a.stopPropagation()}}},[t("div",{staticClass:"w-12 h-1 bg-gray-500 rounded-full mx-auto mb-4"}),t("div",{staticClass:"space-y-1"},[(n=e.contextMenu.target)!=null&&n.is_directory?t("button",{staticClass:"w-full flex items-center gap-3 px-4 py-3 text-white text-sm active:bg-active rounded-lg",on:{click:e.createNewFile}},[t("i",{staticClass:"fa-solid fa-file-lines w-5"}),e._v(" 新建文件 ")]):e._e(),(r=e.contextMenu.target)!=null&&r.is_directory?t("button",{staticClass:"w-full flex items-center gap-3 px-4 py-3 text-white text-sm active:bg-active rounded-lg",on:{click:e.createNewFolder}},[t("i",{staticClass:"fa-solid fa-folder-plus w-5"}),e._v(" 新建文件夹 ")]):e._e(),t("button",{staticClass:"w-full flex items-center gap-3 px-4 py-3 text-white text-sm active:bg-active rounded-lg",on:{click:e.copyPath}},[t("i",{staticClass:"fa-solid fa-copy w-5"}),e._v(" 复制路径 ")]),(o=e.contextMenu.target)!=null&&o.is_directory?e._e():t("button",{staticClass:"w-full flex items-center gap-3 px-4 py-3 text-white text-sm active:bg-active rounded-lg",on:{click:e.openFileItem}},[t("i",{staticClass:"fa-solid fa-folder-open w-5"}),e._v(" 打开文件 ")]),t("button",{staticClass:"w-full flex items-center gap-3 px-4 py-3 text-white text-sm active:bg-active rounded-lg",on:{click:e.renameItem}},[t("i",{staticClass:"fa-solid fa-pen w-5"}),e._v(" 重命名 ")]),t("button",{staticClass:"w-full flex items-center gap-3 px-4 py-3 text-red-400 text-sm active:bg-active rounded-lg",on:{click:e.deleteItem}},[t("i",{staticClass:"fa-solid fa-trash w-5"}),e._v(" 删除 ")])])])]):e._e(),e.inputDialog.visible?t("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",on:{click:function(a){return a.target!==a.currentTarget?null:e.cancelInput.apply(null,arguments)}}},[t("div",{staticClass:"w-full max-w-sm bg-sidebar border border-border rounded-xl p-4"},[t("p",{staticClass:"text-white text-base mb-4"},[e._v(e._s(e.inputDialog.title))]),t("input",{directives:[{name:"model",rawName:"v-model",value:e.inputDialog.value,expression:"inputDialog.value"}],ref:"dialogInput",staticClass:"w-full px-4 py-3 bg-[#1e1e1e] border border-border rounded-lg text-white text-sm focus:outline-none focus:border-accent",attrs:{placeholder:e.inputDialog.placeholder},domProps:{value:e.inputDialog.value},on:{keyup:[function(a){return!a.type.indexOf("key")&&e._k(a.keyCode,"enter",13,a.key,"Enter")?null:e.confirmInput.apply(null,arguments)},function(a){return!a.type.indexOf("key")&&e._k(a.keyCode,"escape",void 0,a.key,void 0)?null:e.cancelInput.apply(null,arguments)}],input:function(a){a.target.composing||e.$set(e.inputDialog,"value",a.target.value)}}}),t("div",{staticClass:"flex gap-3 mt-4"},[t("button",{staticClass:"flex-1 py-3 text-textMuted text-sm rounded-lg",on:{click:e.cancelInput}},[e._v("取消")]),t("button",{staticClass:"flex-1 py-3 bg-accent text-white text-sm rounded-lg",on:{click:e.confirmInput}},[e._v("确定")])])])]):e._e(),e.fileViewerVisible?t("div",{staticClass:"fixed inset-0 bg-black/50 z-50",on:{click:function(a){return a.target!==a.currentTarget?null:e.closeFileViewer.apply(null,arguments)}}},[t("div",{staticClass:"absolute bottom-0 left-0 right-0 bg-[#1e1e1e] rounded-t-2xl flex flex-col",staticStyle:{height:"85vh"}},[e._m(0),t("div",{staticClass:"bg-sidebar border-b border-border px-4 py-2 flex items-center justify-between shrink-0"},[t("span",{staticClass:"text-sm text-white truncate"},[e._v(e._s(e.editingFileName))]),t("div",{staticClass:"flex items-center gap-2"},[t("button",{staticClass:"p-2 text-accent disabled:opacity-50",attrs:{disabled:!e.hasChanges||e.saving,title:"保存"},on:{click:e.saveFile}},[e.saving?t("i",{staticClass:"fa-solid fa-spinner fa-spin"}):t("i",{staticClass:"fa-solid fa-save"})]),t("button",{staticClass:"p-2 text-textMuted hover:text-white",attrs:{title:"关闭"},on:{click:e.closeFileViewer}},[t("i",{staticClass:"fa-solid fa-times"})])])]),t("div",{staticClass:"flex-1 overflow-hidden"},[e.fileLoading?t("div",{staticClass:"flex items-center justify-center h-full text-textMuted"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin mr-2"}),e._v(" 加载中... ")]):e.isBinary?t("div",{staticClass:"flex items-center justify-center h-full text-textMuted"},[e._m(1)]):t("div",{ref:"editorContainer",staticClass:"w-full h-full monaco-editor-container"})]),e.hasChanges&&!e.isBinary?t("div",{staticClass:"bg-yellow-600/20 border-t border-yellow-600/30 px-4 py-2 text-yellow-500 text-sm text-center shrink-0"},[e._v(" 文件已修改,Ctrl+S 保存 ")]):e._e()])]):e._e(),e.confirmDialog.visible?t("div",{staticClass:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4"},[t("div",{staticClass:"w-full max-w-sm bg-sidebar border border-border rounded-xl p-4"},[t("p",{staticClass:"text-white text-base mb-4"},[e._v(e._s(e.confirmDialog.message))]),t("div",{staticClass:"flex gap-3"},[t("button",{staticClass:"flex-1 py-3 text-textMuted text-sm rounded-lg",on:{click:e.cancelConfirm}},[e._v("取消")]),t("button",{staticClass:"flex-1 py-3 bg-red-500 text-white text-sm rounded-lg",on:{click:e.confirmDelete}},[e._v("删除")])])])]):e._e()])},smt=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"flex justify-center pt-3 pb-1 shrink-0"},[e("div",{staticClass:"w-10 h-1 bg-gray-500 rounded-full"})])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"text-center"},[e("i",{staticClass:"fa-solid fa-file text-4xl mb-4 opacity-30"}),e("p",[s._v("二进制文件无法预览")])])}],rmt=Li(imt,nmt,smt,!1,null,"d8b2d27d");const omt=rmt.exports,amt={name:"FileTreeNode",props:{node:{type:Object,required:!0},selectedPath:{type:String,default:""}},data(){return{loading:!1}},methods:{async toggleExpand(){this.node.is_directory&&(!this.node.expanded&&this.node.children.length===0?(this.node.loading=!0,this.$emit("load-children",this.node)):this.node.expanded=!this.node.expanded)},handleClick(){this.node.is_directory?this.toggleExpand():this.$emit("select-node",this.node)},handleLoadChildren(s){this.$emit("load-children",s)},handleSelectNode(s){this.$emit("select-node",s)},getFileIcon(s,e){if(e)return"fa-solid fa-folder";const t=s.split(".").pop().toLowerCase(),i=s.toLowerCase(),n={js:"fa-brands fa-js",jsx:"fa-brands fa-react",ts:"fa-brands fa-js",tsx:"fa-brands fa-react",vue:"fa-brands fa-vuejs",py:"fa-brands fa-python",html:"fa-brands fa-html5",htm:"fa-brands fa-html5",css:"fa-brands fa-css3",scss:"fa-brands fa-sass",json:"fa-solid fa-file-code",yaml:"fa-solid fa-file-code",yml:"fa-solid fa-file-code",md:"fa-solid fa-file-lines",sql:"fa-solid fa-database",sh:"fa-solid fa-terminal",go:"fa-brands fa-golang",java:"fa-brands fa-java",dockerfile:"fa-brands fa-docker"};return i==="dockerfile"?"fa-brands fa-docker":i===".gitignore"?"fa-brands fa-git":n[t]||"fa-solid fa-file"}}};var lmt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"file-tree-node"},[t("div",{staticClass:"node-row",class:{selected:e.selectedPath===e.node.path},on:{click:e.handleClick}},[e.node.is_directory?t("span",{staticClass:"expand-icon",on:{click:function(i){return i.stopPropagation(),e.toggleExpand.apply(null,arguments)}}},[e.node.loading?t("i",{staticClass:"fa-solid fa-spinner fa-spin"}):e.node.expanded?t("i",{staticClass:"fa-solid fa-chevron-down"}):t("i",{staticClass:"fa-solid fa-chevron-right"})]):t("span",{staticClass:"expand-icon placeholder"}),t("span",{staticClass:"node-icon"},[t("i",{class:e.getFileIcon(e.node.name,e.node.is_directory)})]),t("span",{staticClass:"node-name"},[e._v(e._s(e.node.name))])]),e.node.is_directory&&e.node.expanded&&e.node.children&&e.node.children.length>0?t("div",{staticClass:"node-children"},e._l(e.node.children,function(i){return t("FileTreeNode",{key:i.path,attrs:{node:i,"selected-path":e.selectedPath},on:{"load-children":e.handleLoadChildren,"select-node":e.handleSelectNode}})}),1):e._e()])},cmt=[],dmt=Li(amt,lmt,cmt,!1,null,"95a2c18b");const umt=dmt.exports,hmt={name:"FileSelectDrawer",components:{FileTreeNode:umt},props:{visible:{type:Boolean,default:!1}},data(){return{currentPath:"",parentPath:null,fileTreeData:[],selectedPath:"",loading:!1}},computed:{canGoUp(){return this.parentPath!==null&&this.parentPath!==void 0}},watch:{visible(s){s?this.loadFileTree(""):this.reset()}},methods:{reset(){this.currentPath="",this.parentPath=null,this.fileTreeData=[],this.selectedPath="",this.loading=!1},async loadFileTree(s=""){var e,t,i;this.loading=!0;try{const n=await jt.browseFilesystem(s);this.currentPath=((e=n.data)==null?void 0:e.current_path)||s,this.parentPath=(t=n.data)==null?void 0:t.parent_path;const r=(((i=n.data)==null?void 0:i.items)||[]).map(o=>this.transformNode(o));r.sort((o,a)=>o.is_directory===a.is_directory?o.name.localeCompare(a.name):o.is_directory?-1:1),this.fileTreeData=r}catch(n){console.error("加载文件树失败:",n),this.fileTreeData=[]}finally{this.loading=!1}},transformNode(s){return{name:s.name,path:s.path,is_directory:s.is_directory,has_children:s.is_directory,expanded:!1,children:[],loading:!1}},async onLoadChildren(s){var e;try{const i=(((e=(await jt.browseFilesystem(s.path)).data)==null?void 0:e.items)||[]).map(n=>this.transformNode(n));i.sort((n,r)=>n.is_directory===r.is_directory?n.name.localeCompare(r.name):n.is_directory?-1:1),s.children=i,s.expanded=!0}catch(t){console.error("加载子目录失败:",t),s.children=[],s.expanded=!0}finally{s.loading=!1}},onSelectNode(s){this.selectedPath=s.path},goUp(){this.parentPath!==null&&this.parentPath!==void 0&&this.loadFileTree(this.parentPath===""?"":this.parentPath)},goHome(){this.loadFileTree("")},handleConfirm(){this.selectedPath&&(this.$emit("select",this.selectedPath),this.$emit("close"))},handleClose(){this.$emit("close")},getFileIcon(s,e){if(e)return"fa-solid fa-folder";const t=s.split(".").pop().toLowerCase(),i=s.toLowerCase(),n={js:"fa-brands fa-js",jsx:"fa-brands fa-react",ts:"fa-brands fa-js",tsx:"fa-brands fa-react",vue:"fa-brands fa-vuejs",py:"fa-brands fa-python",html:"fa-brands fa-html5",htm:"fa-brands fa-html5",css:"fa-brands fa-css3",scss:"fa-brands fa-sass",json:"fa-solid fa-file-code",yaml:"fa-solid fa-file-code",yml:"fa-solid fa-file-code",md:"fa-solid fa-file-lines",sql:"fa-solid fa-database",sh:"fa-solid fa-terminal",go:"fa-brands fa-golang",java:"fa-brands fa-java",dockerfile:"fa-brands fa-docker"};return i==="dockerfile"?"fa-brands fa-docker":i===".gitignore"?"fa-brands fa-git":n[t]||"fa-solid fa-file"}}};var fmt=function(){var e=this,t=e._self._c;return t("div",[t("div",{staticClass:"drawer-overlay",class:{show:e.visible},on:{click:e.handleClose}}),t("div",{staticClass:"file-drawer",class:{show:e.visible}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title",staticStyle:{color:"#f4f4f5"}},[e._v("选择文件")]),t("button",{staticClass:"drawer-close",on:{click:e.handleClose}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"file-toolbar"},[t("button",{staticClass:"toolbar-btn",attrs:{disabled:!e.canGoUp},on:{click:e.goUp}},[t("i",{staticClass:"fa-solid fa-arrow-up"})]),t("button",{staticClass:"toolbar-btn",on:{click:e.goHome}},[t("i",{staticClass:"fa-solid fa-home"})]),t("div",{staticClass:"file-path"},[e._v(e._s(e.currentPath||"/"))])]),t("div",{staticClass:"file-tree-container"},[e.loading?t("div",{staticClass:"file-loading"},[t("i",{staticClass:"fa-solid fa-spinner fa-spin"}),e._v(" 加载中... ")]):e.fileTreeData.length===0?t("div",{staticClass:"file-empty"},[e._v(" 此目录为空 ")]):e._l(e.fileTreeData,function(i){return t("FileTreeNode",{key:i.path,attrs:{node:i,"selected-path":e.selectedPath},on:{"load-children":e.onLoadChildren,"select-node":e.onSelectNode}})})],2),t("div",{staticClass:"drawer-footer"},[t("div",{staticClass:"selected-path"},[e._v(e._s(e.selectedPath||"未选择"))]),t("button",{staticClass:"confirm-btn",attrs:{disabled:!e.selectedPath},on:{click:e.handleConfirm}},[e._v("选择")])])])])},gmt=[],pmt=Li(hmt,fmt,gmt,!1,null,"bde2b0c6");const mmt=pmt.exports,_mt={name:"ChatViewApp",components:{FileSelectDrawer:mmt},data(){return{sessions:[],currentSessionId:null,currentSession:null,logItems:[],inputMessage:"",isProcessing:!1,modelName:"",promptTokens:0,showSessionDrawer:!1,showModelDrawer:!1,showCommandDrawer:!1,showFileDrawer:!1,searchKeyword:"",models:[],logSeq:0,wsUnsubscribe:null}},computed:{filteredSessions(){if(!this.searchKeyword)return this.sessions;const s=this.searchKeyword.toLowerCase();return this.sessions.filter(e=>(e.title||"").toLowerCase().includes(s))}},async created(){this.initGlobalWs(),await this.loadSessions(),await this.loadModels(),await this.loadDefaultModel();const s=this.$route.params.id;if(s){const e=this.sessions.find(t=>t.id===s);e&&await this.selectSession(e,!1)}},activated(){this.currentSessionId&&this.subscribeSession()},deactivated(){this.wsUnsubscribe&&(this.wsUnsubscribe(),this.wsUnsubscribe=null)},methods:{goBack(){this.$router.push("/views/app")},initGlobalWs(){Ks.init()},closeAllDrawers(){this.showSessionDrawer=!1,this.showModelDrawer=!1,this.showCommandDrawer=!1,this.showFileDrawer=!1},renderMarkdown(s){return s?Zn(s):""},getTodoStatusIcon(s){return{completed:"✅",in_progress:"🔄",pending:"⬜",cancelled:"❌"}[s]||"⬜"},getToolCallName(s){var e;return((e=s==null?void 0:s.function)==null?void 0:e.name)||"unknown"},formatToolArgs(s){var e,t,i;try{const n=JSON.parse(((e=s==null?void 0:s.function)==null?void 0:e.arguments)||"{}");return n.file_path?n.file_path:n.command?n.command:((t=s==null?void 0:s.function)==null?void 0:t.arguments)||""}catch{return((i=s==null?void 0:s.function)==null?void 0:i.arguments)||""}},async loadSessions(){try{const s=await rft();this.sessions=s.data||[]}catch(s){console.error("加载会话失败:",s)}},async loadModels(){try{const s=await jt.getModels();this.models=s.data||[]}catch(s){console.error("加载模型失败:",s)}},async loadDefaultModel(){var s;try{const e=await jt.getConfig("defaultModel");(s=e.data)!=null&&s.value&&(this.modelName=e.data.value)}catch{this.modelName="gpt-4o"}},async selectSession(s,e=!0){this.wsUnsubscribe&&(this.wsUnsubscribe(),this.wsUnsubscribe=null),this.currentSession=s,this.currentSessionId=s.id,this.logItems=[],this.isProcessing=s.status==="processing",e&&this.$route.params.id!==s.id&&this.$router.push({name:"app-ChatViewApp-session",params:{id:s.id}}).catch(()=>{}),await this.loadMessages(),this.subscribeSession(),this.showSessionDrawer=!1},async loadMessages(){try{const s=await dse(this.currentSessionId);this.logItems=(s.data||[]).map(e=>e.type==="think"?{type:"think",content:e.content||"",_id:`log-${++this.logSeq}`}:e.type==="step"?{type:"step",thought:e.thought,toolCalls:e.toolCalls||[],success:e.success,_id:`log-${++this.logSeq}`}:e.type==="chat"?{type:"chat",content:e.content,_id:`log-${++this.logSeq}`}:e.type==="todos"?{type:"todos",todos:e.todos||[],_id:`log-${++this.logSeq}`}:{type:"system",content:String(e),_id:`log-${++this.logSeq}`}),this.scrollToBottom()}catch(s){console.error("加载消息失败:",s)}},subscribeSession(){this.currentSessionId&&(this.wsUnsubscribe&&this.wsUnsubscribe(),this.wsUnsubscribe=Ks.subscribe(this.currentSessionId,{running_sessions:s=>{const e=(s==null?void 0:s.runningSessionIds)||[];this.updateSessionStatus(e)},todos:s=>{this.logItems.push({type:"todos",todos:s.todos,_id:`log-${++this.logSeq}`}),this.scrollToBottom()},session:s=>{s!=null&&s.sessionId&&!this.currentSessionId&&(this.currentSessionId=s.sessionId)},step:s=>{var e;this.logItems.push({type:"step",thought:s==null?void 0:s.thought,toolCalls:(s==null?void 0:s.toolCalls)||[],success:s==null?void 0:s.success,_id:`log-${++this.logSeq}`}),(e=s==null?void 0:s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),this.scrollToBottom()},compact:s=>{this.logItems.push({type:"system",content:`【压缩完成】${s.summary||""}`,_id:`log-${++this.logSeq}`}),this.loadSessions(),this.loadMessages()},done:s=>{var e;this.isProcessing=!1,s!=null&&s.modelName&&(this.modelName=s.modelName),(e=s==null?void 0:s.usage)!=null&&e.promptTokens&&(this.promptTokens=s.usage.promptTokens),s!=null&&s.response&&this.logItems.push({type:"think",content:s.response,_id:`log-${++this.logSeq}`}),this.loadSessions(),this.scrollToBottom()},stopped:()=>{this.isProcessing=!1,this.logItems.push({type:"think",content:"【已停止】",_id:`log-${++this.logSeq}`}),this.scrollToBottom()},error:s=>{this.isProcessing=!1,this.$message.error((s==null?void 0:s.error)||"发生错误")}}))},updateSessionStatus(s){new Set(s||[]).has(this.currentSessionId)?this.isProcessing=!0:this.isProcessing=!1},async createSession(){try{const s=await fB("新会话");this.sessions.unshift(s.data),await this.selectSession(s.data)}catch(s){this.$message.error("创建会话失败: "+s.message)}},sendMessage(){if(!this.inputMessage.trim()||this.isProcessing)return;if(!this.currentSessionId){this.createSession().then(()=>this.sendMessage());return}const s=this.inputMessage.trim();this.inputMessage="",this.isProcessing=!0,this.logItems.push({type:"chat",content:s,_id:`log-${++this.logSeq}`}),this.scrollToBottom(),Ks.send("chat",{message:s,sessionId:this.currentSessionId,modelName:this.modelName||void 0})},stopGeneration(){this.currentSessionId&&(this.isProcessing=!1,Ks.send("stop",{sessionId:this.currentSessionId}))},appendCommand(s){var e;this.inputMessage=s+" ",(e=this.$refs.inputField)==null||e.focus()},openFileSelect(){this.showFileDrawer=!0},onFileSelected(s){var e;this.inputMessage=this.inputMessage+s+" ",this.showFileDrawer=!1,(e=this.$refs.inputField)==null||e.focus()},selectModel(s){const e=s.name.split("/");this.modelName=e.length>2?e.slice(1).join("/"):s.name,jt.setConfig("defaultModel",this.modelName),this.showModelDrawer=!1},formatTime(s){if(!s)return"";const e=new Date(s),i=new Date-e;return i<6e4?"刚刚":i<36e5?Math.floor(i/6e4)+"分钟前":i<864e5?"今天 "+e.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}):i<6048e5?Math.floor(i/864e5)+"天前":e.toLocaleDateString()},scrollToBottom(){this.$nextTick(()=>{this.$refs.chatArea&&(this.$refs.chatArea.scrollTop=this.$refs.chatArea.scrollHeight)})}}};var vmt=function(){var i;var e=this,t=e._self._c;return t("div",{staticClass:"app-container"},[t("header",{staticClass:"header"},[t("a",{staticClass:"header-back",attrs:{href:"#"},on:{click:function(n){return n.preventDefault(),e.goBack.apply(null,arguments)}}},[t("i",{staticClass:"fa-solid fa-chevron-left"})]),t("div",{staticClass:"session-switch-btn",on:{click:function(n){e.showSessionDrawer=!0}}},[t("i",{staticClass:"fa-solid fa-comments"}),t("span",{staticClass:"title"},[e._v(e._s(((i=e.currentSession)==null?void 0:i.title)||"新会话"))]),t("i",{staticClass:"fa-solid fa-chevron-down arrow"})]),t("div",{staticClass:"header-actions"},[t("a",{staticClass:"header-btn",attrs:{href:"#",title:"命令"},on:{click:function(n){n.preventDefault(),e.showCommandDrawer=!0}}},[t("i",{staticClass:"fa-solid fa-terminal"})])])]),t("div",{staticClass:"model-selector"},[t("span",[e._v("模型")]),t("span",{staticClass:"model-name",on:{click:function(n){e.showModelDrawer=!0}}},[e._v(e._s(e.modelName||"gpt-4o"))]),t("span",{staticClass:"model-change",staticStyle:{color:"var(--accent)","font-size":"12px"},on:{click:function(n){e.showModelDrawer=!0}}},[e._v("切换")])]),t("div",{ref:"chatArea",staticClass:"chat-area"},[e.logItems.length===0?t("div",{staticClass:"empty-state"},[e._m(0),t("div",{staticClass:"empty-title"},[e._v("开始对话")]),t("div",{staticClass:"empty-desc"},[e._v("选择或创建会话开始对话")])]):e._e(),e._l(e.logItems,function(n,r){return[n.type==="chat"?[t("div",{staticClass:"message user"},[t("div",{staticClass:"message-bubble"},[e._v(e._s(n.content))])])]:n.type==="think"?[t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble",domProps:{innerHTML:e._s(e.renderMarkdown(n.content))}})])]:n.type==="todos"?[t("div",{staticClass:"message assistant"},[t("div",{staticClass:"todo-list"},e._l(n.todos,function(o,a){return t("div",{key:a,staticClass:"todo-item"},[t("span",{staticClass:"todo-status"},[e._v(e._s(e.getTodoStatusIcon(o.status)))]),t("span",[e._v(e._s(o.name))])])}),0)])]:n.type==="step"?[n.thought?t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble",domProps:{innerHTML:e._s(e.renderMarkdown(n.thought))}})]):e._e(),e._l(n.toolCalls,function(o,a){return t("div",{key:"tc-"+a,staticClass:"tool-log",class:n.success!==!1?"tool-success":"tool-fail"},[t("span",[e._v(e._s(n.success!==!1?"✓":"✗"))]),t("span",{staticClass:"tool-name"},[e._v(e._s(e.getToolCallName(o)))]),t("span",{staticClass:"tool-args"},[e._v(e._s(e.formatToolArgs(o)))])])})]:n.type==="system"?[t("div",{staticClass:"message assistant"},[t("div",{staticClass:"message-bubble"},[e._v(e._s(n.content))])])]:e._e()]}),e.isProcessing?t("div",{staticClass:"message assistant thinking"},[t("div",{staticClass:"message-bubble"},[e._v("思考中...")])]):e._e()],2),t("div",{staticClass:"input-area"},[t("div",{staticClass:"input-container"},[t("div",{staticClass:"input-wrapper"},[t("textarea",{directives:[{name:"model",rawName:"v-model",value:e.inputMessage,expression:"inputMessage"}],ref:"inputField",staticClass:"input-field",attrs:{placeholder:"输入消息... (Enter 发送)"},domProps:{value:e.inputMessage},on:{keydown:function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"enter",13,n.key,"Enter")||n.ctrlKey||n.shiftKey||n.altKey||n.metaKey?null:(n.preventDefault(),e.sendMessage.apply(null,arguments))},input:function(n){n.target.composing||(e.inputMessage=n.target.value)}}})]),t("button",{staticClass:"send-btn",class:{"stop-btn":e.isProcessing},attrs:{disabled:!e.inputMessage.trim()&&!e.isProcessing},on:{click:function(n){e.isProcessing?e.stopGeneration():e.sendMessage()}}},[t("i",{class:e.isProcessing?"fa-solid fa-stop":"fa-solid fa-paper-plane"})])]),t("div",{staticClass:"command-quick"},[t("div",{staticClass:"command-chip",on:{click:function(n){return e.appendCommand("/compact")}}},[t("i",{staticClass:"fa-solid fa-compress-alt"}),e._v(" 压缩会话 ")]),t("div",{staticClass:"command-chip",on:{click:function(n){e.showFileDrawer=!0}}},[t("i",{staticClass:"fa-solid fa-file-circle-plus"}),e._v(" 选择文件 ")])])]),t("div",{staticClass:"status-bar"},[t("div",{staticClass:"status-indicator"},[t("span",{staticClass:"status-dot",class:{processing:e.isProcessing}}),t("span",{class:{"status-processing":e.isProcessing,"status-ready":!e.isProcessing}},[e._v(e._s(e.isProcessing?"处理中...":"就绪"))])]),t("span",[e._v("Token: "+e._s(e.promptTokens||0))])]),t("div",{staticClass:"drawer-overlay",class:{show:e.showSessionDrawer||e.showModelDrawer||e.showCommandDrawer},on:{click:e.closeAllDrawers}}),t("FileSelectDrawer",{attrs:{visible:e.showFileDrawer},on:{select:e.onFileSelected,close:function(n){e.showFileDrawer=!1}}}),t("div",{staticClass:"session-drawer",class:{show:e.showSessionDrawer}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title",staticStyle:{color:"var(--text-primary, #f4f4f5)"}},[e._v("选择会话")]),t("button",{staticClass:"drawer-close",on:{click:function(n){e.showSessionDrawer=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"drawer-search"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.searchKeyword,expression:"searchKeyword"}],staticClass:"search-input",attrs:{type:"text",placeholder:"搜索会话..."},domProps:{value:e.searchKeyword},on:{input:function(n){n.target.composing||(e.searchKeyword=n.target.value)}}})]),t("div",{staticClass:"session-list"},e._l(e.filteredSessions,function(n){return t("div",{key:n.id,staticClass:"session-list-item",class:{active:n.id===e.currentSessionId},on:{click:function(r){return e.selectSession(n)}}},[e._m(1,!0),t("div",{staticClass:"session-list-info"},[t("div",{staticClass:"session-list-title"},[e._v(e._s(n.title||"未命名会话"))]),t("div",{staticClass:"session-list-meta"},[e._v(e._s(e.formatTime(n.updatedAt||n.createTime)))])]),t("div",{staticClass:"session-list-status",class:{processing:n.status==="processing"}})])}),0),t("div",{staticClass:"drawer-footer"},[t("button",{staticClass:"new-session-btn",on:{click:e.createSession}},[t("i",{staticClass:"fa-solid fa-plus"}),e._v(" 新建会话 ")])])]),t("div",{staticClass:"session-drawer",class:{show:e.showModelDrawer}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title",staticStyle:{color:"var(--text-primary, #f4f4f5)"}},[e._v("选择模型")]),t("button",{staticClass:"drawer-close",on:{click:function(n){e.showModelDrawer=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"command-list"},e._l(e.models,function(n){return t("div",{key:n.id,staticClass:"command-item",class:{active:n.name===e.modelName},on:{click:function(r){return e.selectModel(n)}}},[e._m(2,!0),t("div",{staticClass:"command-info"},[t("div",{staticClass:"command-name"},[e._v(e._s(n.name))]),t("div",{staticClass:"command-desc"},[e._v(e._s(n.provider||"默认"))])])])}),0)]),t("div",{staticClass:"command-drawer",class:{show:e.showCommandDrawer}},[t("div",{staticClass:"drawer-header"},[t("span",{staticClass:"drawer-title",staticStyle:{color:"var(--text-primary, #f4f4f5)"}},[e._v("快捷命令")]),t("button",{staticClass:"drawer-close",on:{click:function(n){e.showCommandDrawer=!1}}},[t("i",{staticClass:"fa-solid fa-xmark"})])]),t("div",{staticClass:"command-list"},[t("div",{staticClass:"command-item",on:{click:function(n){e.appendCommand("/compact"),e.showCommandDrawer=!1}}},[e._m(3),e._m(4)]),t("div",{staticClass:"command-item",on:{click:function(n){e.appendCommand("/clear"),e.showCommandDrawer=!1}}},[e._m(5),e._m(6)]),t("div",{staticClass:"command-item",on:{click:function(n){e.openFileSelect(),e.showCommandDrawer=!1}}},[e._m(7),e._m(8)])])])],1)},bmt=[function(){var s=this,e=s._self._c;return e("div",{staticClass:"empty-icon"},[e("i",{staticClass:"fa-regular fa-comments"})])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"session-list-icon"},[e("i",{staticClass:"fa-solid fa-robot"})])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"command-icon"},[e("i",{staticClass:"fa-solid fa-microchip"})])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"command-icon"},[e("i",{staticClass:"fa-solid fa-compress-alt"})])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"command-info"},[e("div",{staticClass:"command-name"},[s._v("压缩会话")]),e("div",{staticClass:"command-desc"},[s._v("减少上下文长度")])])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"command-icon"},[e("i",{staticClass:"fa-solid fa-trash"})])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"command-info"},[e("div",{staticClass:"command-name"},[s._v("清空对话")]),e("div",{staticClass:"command-desc"},[s._v("清空当前会话内容")])])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"command-icon"},[e("i",{staticClass:"fa-solid fa-file-circle-plus"})])},function(){var s=this,e=s._self._c;return e("div",{staticClass:"command-info"},[e("div",{staticClass:"command-name"},[s._v("选择文件")]),e("div",{staticClass:"command-desc"},[s._v("添加参考文件到上下文")])])}],Cmt=Li(_mt,vmt,bmt,!1,null,"2352d831");const jpe=Cmt.exports,ymt={path:"/views/app",component:Zpt,children:[{path:"",name:"app-index",component:tmt,meta:{title:"首页"}},{path:"ChatViewApp",name:"app-ChatViewApp",component:jpe,meta:{title:"对话"}},{path:"ChatViewApp/:id",name:"app-ChatViewApp-session",component:jpe,meta:{title:"对话"}},{path:"FilesViewApp",name:"app-FilesViewApp",component:omt,meta:{title:"文件"}},{path:"GitChangesApp",name:"app-GitChangesApp",component:()=>rt(()=>import("./gitChangesApp-CRVkFMef.js"),__vite__mapDeps([2,3])),meta:{title:"Git 变更"}},{path:"DevWorkflowViewApp",name:"app-DevWorkflowViewApp",component:()=>rt(()=>import("./devWorkflowViewApp-394d9AlG.js"),__vite__mapDeps([4,5])),meta:{title:"软件研发"}},{path:"settings",name:"app-settings",component:uke,meta:{title:"设置"}}]};Is.use(gve);const wmt=[{path:"/",redirect:"/views/pc/planAndCode"},ymt,{path:"/views/pc",component:()=>rt(()=>import("./PcLayout-ZXjT7WP9.js"),__vite__mapDeps([6,7])),children:[{path:"",redirect:"/views/pc/planAndCode"},{path:"planAndCode",name:"planAndCode",component:zpe,meta:{title:"计划编码"}},{path:"planAndCode/:id",name:"planAndCode-session",component:zpe,meta:{title:"计划编码"}},{path:"files",name:"files",component:Ygt,meta:{title:"文件管理"}},{path:"fileZihao",name:"fileZihao",component:()=>rt(()=>import("./fileZihao-Chayeahb.js"),[]),meta:{title:"文件互联"}},{path:"skills",name:"skills",component:Vpt,meta:{title:"Skill 管理"}},{path:"terminal",name:"terminal",component:()=>rt(()=>import("./terminalView-0Gixm1yH.js"),__vite__mapDeps([8,9])),meta:{title:"终端"}},{path:"terminal/:id",name:"terminal-session",component:()=>rt(()=>import("./terminalView-0Gixm1yH.js"),__vite__mapDeps([8,9])),meta:{title:"终端"}},{path:"db",name:"db",component:Upt,meta:{title:"数据库"}},{path:"aiLogs",name:"aiLogs",component:()=>rt(()=>import("./aiLogsView-B1Xv86FO.js"),[]),meta:{title:"AI 日志"}},{path:"tasks",name:"tasks",component:()=>rt(()=>import("./taskView-CJ1d1bfR.js"),[]),meta:{title:"任务列表"}},{path:"devWorkflow",name:"devWorkflow",component:()=>rt(()=>import("./devWorkflowView-CPJuckoU.js"),__vite__mapDeps([10,11,12])),meta:{title:"软件研发"}},{path:"settings",name:"settings",component:uke,meta:{title:"设置"}},{path:"git-changes",name:"gitChanges",component:()=>rt(()=>import("./gitChanges-Bcc9Ioc7.js"),[]),meta:{title:"Git 变更"}},{path:"custom-actions",name:"customActions",component:()=>rt(()=>import("./customActionsView-BFZzvWXk.js"),[]),meta:{title:"自定义操作"}},{path:"wiki",name:"wiki",component:()=>rt(()=>import("./wikiView-BAnnCorX.js"),__vite__mapDeps([13,14])),meta:{title:"文档"}},{path:"deploy",name:"deploy",component:()=>rt(()=>import("./deployView-BV8JVWE5.js"),__vite__mapDeps([15,16])),meta:{title:"部署"}},{path:"designView",name:"designView",component:()=>rt(()=>import("./designView-_qXRJlPw.js"),__vite__mapDeps([17,11,18])),meta:{title:"软件设计"}}]}],hke=new gve({mode:"hash",routes:wmt});hke.afterEach(s=>{var e;(e=s.meta)!=null&&e.title&&(document.title=`${s.meta.title} - TXCode`)});Is.use(POe);Is.prototype.$api=jt;Is.config.productionTip=!1;new Is({router:hke,render:s=>s(FOe)}).$mount("#app");const fke=document.createElement("style");fke.textContent=".v-modal { z-index: 1999 !important; }";document.head.appendChild(fke);export{jgt as C,lke as D,rke as F,xft as G,ike as I,ix as K,Xht as M,cse as R,oke as S,jt as a,aJ as b,cke as c,tx as d,Dg as e,nke as f,Zn as g,Vft as h,Oft as i,Eft as j,ake as k,mmt as l,dse as m,Li as n,jN as o,oJ as s,p0e as t,dke as u,Ks as w};
|