filecat 6.14.0 → 6.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +1 -1
  2. package/build/dist/{1448.c54dfb4f0ace2c6f84cb.js → 1448.cb0b816ecce11857fbc4.js} +1 -1
  3. package/build/dist/{2542.d6a50122f60efba32a30.js → 2542.26cb302b60de23166227.js} +1 -1
  4. package/build/dist/{2674.4fc554b04a11a3a3151d.js → 2674.570467c7d8e3378316cc.js} +1 -1
  5. package/build/dist/3402.5d4caccb2e21dbeb3398.js +1 -0
  6. package/build/dist/{4488.8a2727ce013104c4cfb4.js → 4488.72cda485aa8175ce03bd.js} +1 -1
  7. package/build/dist/{5308.93a513c4d2025f65e546.js → 5308.cc7a2e88ea22f247ec76.js} +1 -1
  8. package/build/dist/{5516.679dadeb7510275a7616.js → 5516.f442aef7efd919af92cd.js} +1 -1
  9. package/build/dist/{5937.d865e6e197bc253c59c2.js → 5937.820d7e5fcf608c346964.js} +1 -1
  10. package/build/dist/{6247.1b04f0b4739846af26ce.js → 6247.8116d7df0a5040d144c2.js} +1 -1
  11. package/build/dist/{6413.db94d756b5e793e26b12.js → 6413.38627ec984b26437de1e.js} +1 -1
  12. package/build/dist/6505.f730960378f6e4b7bc24.js +1 -0
  13. package/build/dist/{6892.bc3f13ff4689ffab1237.js → 6892.fac5b622852f0aad613d.js} +1 -1
  14. package/build/dist/{7181.984cdb2ff1a58762c55b.js → 7181.9f22415130200367cfda.js} +1 -1
  15. package/build/dist/{7209.9672e5474b99d79ee570.js → 7209.de0fc874821ef1cb0684.js} +1 -1
  16. package/build/dist/{8302.3d668f33b2a6c22b50d6.js → 8302.19a72820071ef3c3e981.js} +1 -1
  17. package/build/dist/{8603.cb2ce741aa06a7b51f41.js → 8603.8b4a272c8bbe4d5fd4c4.js} +1 -1
  18. package/build/dist/{8714.e140283ef498d673e526.js → 8714.0609ed38a42421e9eb02.js} +1 -1
  19. package/build/dist/{8765.9b2daf5a74be623229d3.js → 8765.e8c4f80fb9afd6730bd3.js} +1 -1
  20. package/build/dist/{9782.09fe7cb72f4b3a631e98.js → 9782.1b7bf041c0f1673905df.js} +1 -1
  21. package/build/dist/index.html +1 -1
  22. package/build/dist/main.e8e3157be6063ea4da8a.js +2 -0
  23. package/build/dist/{main.0becf41c30bea61f0dd1.js.LICENSE.txt → main.e8e3157be6063ea4da8a.js.LICENSE.txt} +1 -1
  24. package/build/main.js +1 -1
  25. package/build/threads.work.filecat.js +1 -1
  26. package/package.json +2 -2
  27. package/build/dist/3402.e9728fb7eb5d5f4bb06f.js +0 -1
  28. package/build/dist/6348.397911571278791a9ed4.js +0 -1
  29. package/build/dist/6505.01504c688fc55b7574ce.js +0 -1
  30. package/build/dist/8629.c19719a557d874a65155.js +0 -1
  31. package/build/dist/9223.4f7ab2180d2ed8b3316c.js +0 -1
  32. package/build/dist/9762.207645c718a09cfa0c72.js +0 -1
  33. package/build/dist/main.0becf41c30bea61f0dd1.js +0 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "filecat",
3
- "version": "6.14.0",
3
+ "version": "6.14.2",
4
4
  "description": "FileCat File Browser Server Manager",
5
5
  "author": "xiaobaidadada",
6
6
  "repository": {
@@ -106,7 +106,7 @@
106
106
  "normalize.css": "^8.0.1",
107
107
  "noty": "^3.2.0-beta-deprecated",
108
108
  "pinyin-pro": "^3.28.0",
109
- "pty-shell": "1.5.2",
109
+ "pty-shell": "1.5.3",
110
110
  "react": "^19.2.7",
111
111
  "react-dom": "^19.2.7",
112
112
  "react-i18next": "^17.0.8",
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3402],{72693(e,n,t){t.d(n,{w:()=>u});var s=t(96540),a=t(22022),c=t(14944),r=t(92275),o=t(34843),d=t(82893),l=t(85997),i=t(74848);function u(){const[e,n]=(0,o.fp)(d.AG.prompt_card),{t}=(0,a.Bd)(),u=(0,s.useRef)([]),f=(0,s.useRef)(!1),m=(0,s.useCallback)(()=>{if(f.current)return;if(0===u.current.length)return f.current=!1,void n({open:!1});f.current=!0;const e=u.current.shift();e?n({open:!0,title:t("命令确认"),cancel:()=>{c.ws.sendData(r.HK.ai_confirm_cmd,{askId:e.askId,approved:!1}),n({open:!1}),f.current=!1,m()},context_div:(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{style:{maxHeight:"60vh",overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",background:"var(--surfaceSecondary)",padding:"0.75em",borderRadius:"0.5em",marginBottom:"0.75em",fontFamily:"monospace",fontSize:"0.9em",lineHeight:"1.5"},children:e.cmd}),(0,i.jsxs)("div",{style:{display:"flex",gap:"0.5em",justifyContent:"flex-end"},children:[(0,i.jsx)(l.$n,{text:t("拒绝"),color:"var(--red)",clickFun:()=>{c.ws.sendData(r.HK.ai_confirm_cmd,{askId:e.askId,approved:!1}),n({open:!1}),f.current=!1,m()}}),(0,i.jsx)(l.$n,{text:t("允许"),clickFun:()=>{c.ws.sendData(r.HK.ai_confirm_cmd,{askId:e.askId,approved:!0}),n({open:!1}),f.current=!1,m()}})]})]})}):f.current=!1},[t]),h=(0,s.useCallback)(e=>{u.current.push(e),m()},[m]);(0,s.useEffect)(()=>(c.ws.addMsg(r.HK.ai_confirm_cmd,e=>{const n=e.context||{};n.askId&&n.cmd&&h({askId:n.askId,cmd:n.cmd})}),()=>{c.ws.removeMsg(r.HK.ai_confirm_cmd)}),[h]),(0,s.useEffect)(()=>()=>{u.current=[],f.current=!1},[])}},63402(e,n,t){t.r(n),t.d(n,{default:()=>h});var s=t(96540),a=t(97856),c=t(92275),r=t(14944),o=t(34843),d=t(82893),l=t(64405),i=t(40505),u=t(72693),f=t(74848);const m=s.lazy(()=>Promise.all([t.e(2543),t.e(5614)]).then(t.bind(t,85614)));function h(e){const[n,t]=(0,s.useState)(null),[h,p]=(0,o.fp)(d.AG.fileShellShow),[w,k]=(0,o.fp)(d.AG.file_shell_hidden),[_,g]=(0,o.fp)(d.AG.user_base_info),x=_.user_data.theme?.includes("dark")?"#FFFFFF":"#000000";(0,u.w)();const v=()=>{n?.dispose(),t(null)};(0,s.useEffect)(()=>()=>{v()},[]),(0,s.useEffect)(()=>{h.show?n?h.cmd&&r.ws.sendData(c.HK.shell_send,h.cmd):(async()=>{const e=new a.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:x,cursor:x,selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4});let n;const s=n=>{e.write(n)};n=t=>{e.clear(),e.write(t),n=s},await r.ws.addMsg(c.HK.shell_getting,e=>{n(e.context)}),await r.ws.addMsg(c.HK.shell_copy,n=>{n.context&&(0,i.lW)(n.context),e.focus()}),e.onData(async e=>{const n=new c.hf(c.HK.shell_send);n.context=e,await r.ws.send(n)}),t(e)})():v()},[h]);return(0,f.jsx)(m,{show:h.show,file_shell_hidden:w,terminal:n,init:(e,t)=>{n.writeln("open shell... ");const s=new c.hf(c.HK.shell_open),a=new l.n;a.init_path=h.path,a.rows=e,a.cols=t,a.http_token=localStorage.getItem("token"),s.context=a,r.ws.send(s),h.cmd&&r.ws.sendData(c.HK.shell_send,h.cmd)}})}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6348],{66348(e,r,t){t.r(r),t.d(r,{default:()=>f});var o=t(96540),s=(t(82893),t(14284)),n=t(62042),i=t(22022),a=t(74848);const d="var(--surfacePrimary, #ffffff)",l="var(--surfaceSecondary, #f1f3f4)",c="var(--divider, rgba(0,0,0,0.08))",p="var(--textPrimary, #202124)",x="var(--textSecondary, #5f6368)",g="var(--primary, #1a73e8)",u="var(--secondary, #34a853)";function f({dir:e,onOpenFile:r,onClose:t}){const{t:f}=(0,i.Bd)(),[y,b]=(0,o.useState)([]),[v,j]=(0,o.useState)(""),[S,k]=(0,o.useState)({exportDir:"",exportTypes:["ts"]}),[m,z]=(0,o.useState)(!1),w=e;(0,o.useEffect)(()=>{C(),$()},[e]);const C=async e=>{try{const r=await s.Si.post("list",{dir:w,search:e||v});0===r.code&&b(r.data)}catch(e){}},$=async()=>{try{const e=await s.Si.post("export_config/load",{dir:w});0===e.code&&e.data&&k(e.data)}catch(e){}},T=y.filter(e=>!v||e.toLowerCase().includes(v.toLowerCase()));return(0,a.jsxs)("div",{style:{position:"fixed",top:0,left:0,width:320,height:"100vh",zIndex:2e3,background:d,color:p,display:"flex",flexDirection:"column",borderRight:`1px solid ${c}`,boxShadow:"2px 0 10px rgba(0,0,0,0.5)"},children:[(0,a.jsxs)("div",{style:{padding:"12px 16px",background:d,borderBottom:`1px solid ${c}`,display:"flex",alignItems:"center",gap:8},children:[(0,a.jsxs)("span",{style:{fontWeight:"bold",color:g,fontSize:14},children:["📋 ",f("配置表")]}),(0,a.jsx)("div",{style:{flex:1}}),(0,a.jsx)("button",{onClick:t,style:{background:"none",border:"none",color:x,cursor:"pointer",fontSize:16},children:"✕"})]}),(0,a.jsx)("div",{style:{padding:"8px 12px"},children:(0,a.jsx)("input",{placeholder:f("搜索文件..."),value:v,onChange:e=>{j(e.target.value),C(e.target.value)},style:{width:"100%",padding:"8px 12px",borderRadius:8,border:`1px solid ${c}`,background:d,color:p,fontSize:13,boxSizing:"border-box"}})}),(0,a.jsxs)("div",{style:{flex:1,overflow:"auto",padding:"0 8px"},children:[T.map(e=>(0,a.jsxs)("div",{onClick:()=>r(e),style:{padding:"10px 12px",cursor:"pointer",borderRadius:8,margin:"2px 0",borderBottom:`1px solid ${c}`,display:"flex",alignItems:"center",gap:8,transition:"background 0.2s"},onMouseEnter:e=>e.currentTarget.style.background=l,onMouseLeave:e=>e.currentTarget.style.background="transparent",children:[(0,a.jsx)("span",{style:{color:g},children:"⚙"}),(0,a.jsxs)("span",{style:{fontSize:13},children:[e,".gcfg"]})]},e)),0===T.length&&(0,a.jsx)("p",{style:{color:x,textAlign:"center",padding:20,fontSize:12},children:f("此目录下没有 .gcfg 文件")})]}),(0,a.jsxs)("div",{style:{padding:"8px 12px",borderTop:`1px solid ${c}`,background:d},children:[(0,a.jsxs)("button",{onClick:()=>z(!m),style:{width:"100%",padding:"8px",borderRadius:8,border:`1px solid ${g}`,background:"transparent",color:g,cursor:"pointer",fontSize:13,marginBottom:m?8:0},children:["⚙ ",f("导出设置")]}),m&&(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{style:{color:x,fontSize:11},children:[f("导出目录"),":"]}),(0,a.jsx)("input",{value:S.exportDir,onChange:e=>k(r=>({...r,exportDir:e.target.value})),placeholder:"/path/to/export",style:{width:"100%",padding:"6px 8px",borderRadius:8,border:`1px solid ${c}`,background:d,color:p,fontSize:12,boxSizing:"border-box",marginTop:2}})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{style:{color:x,fontSize:11},children:[f("导出语言"),":"]}),(0,a.jsx)("div",{style:{display:"flex",gap:8,marginTop:4},children:["ts","go"].map(e=>(0,a.jsxs)("label",{style:{color:p,fontSize:12},children:[(0,a.jsx)("input",{type:"checkbox",checked:S.exportTypes.includes(e),onChange:r=>{const t=r.target.checked?[...S.exportTypes,e]:S.exportTypes.filter(r=>r!==e);k(e=>({...e,exportTypes:t}))}})," ",e.toUpperCase()]},e))})]}),(0,a.jsxs)("div",{style:{display:"flex",gap:6},children:[(0,a.jsxs)("button",{onClick:async()=>{try{const e=await s.Si.post("export_config/save",{dir:w,config:S});0===e.code?(0,n.SK)(f("导出配置已保存")):(0,n.zN)(e.message)}catch(e){(0,n.zN)(e?.message)}},style:h(u),children:["💾 ",f("保存配置")]}),(0,a.jsxs)("button",{onClick:async()=>{if(S.exportDir)try{const e=await s.Si.post("export",{dir:w});if(0===e.code){const{generated:r,errors:t}=e.data;let o=`${f("导出完成")}: ${r.length} ${f("个文件")}`;t.length>0&&(o+=`\n${f("错误")}: ${t.join(", ")}`),(0,n.SK)(o)}else(0,n.zN)(e.message)}catch(e){(0,n.zN)(e?.message)}else(0,n.zN)(f("请先设置导出目录"))},style:h(g),children:["🚀 ",f("一键导出")]})]})]})]})]})}function h(e){return{flex:1,padding:"6px 8px",borderRadius:4,border:`1px solid ${e}`,background:"transparent",color:e,cursor:"pointer",fontSize:12}}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6505],{26505(e,t,s){s.r(t),s.d(t,{default:()=>k});var a=s(96540),r=(s(82893),s(14284)),n=s(62042),o=s(22022),i=s(85997),l=s(57952),d=s(52671),c=s(34289),p=s(87361),h=s(2543),x=s(74848);const u="var(--surfacePrimary, #ffffff)",f="var(--surfaceSecondary, #f1f3f4)",g="var(--divider, rgba(0,0,0,0.08))",y="var(--textPrimary, #202124)",b="var(--textSecondary, #5f6368)",m="var(--primary, #1a73e8)",j="var(--primary-light, #d2e3fc)",v="var(--secondary, #34a853)",S="var(--accent, #ea4335)",z="#f9ab00";function k(){const{t:e}=(0,o.Bd)(),t=(0,d.Zp)();let s=decodeURIComponent((0,c.GG)(p.o.git_page,(0,c.vX)()));s=s.replace(/\/+$/,"");const[k,C]=(0,a.useState)([]),[N,U]=(0,a.useState)([]),[$,R]=(0,a.useState)({current:"",branches:[]}),[T,W]=(0,a.useState)(""),[B,K]=(0,a.useState)(new Set),[_,P]=(0,a.useState)("status"),[A,D]=(0,a.useState)(!1),[I,F]=(0,a.useState)(16),[L,E]=(0,a.useState)(!1),G=(0,a.useRef)(null),X=(0,a.useRef)(null);(0,a.useEffect)(()=>{s&&(H(),M(),Z())},[s]);const H=async()=>{try{D(!0);const e=await r.TU.post("status",{path:s});0===e.code&&C(e.data||[])}catch(e){}finally{D(!1)}},M=async()=>{try{const e=await r.TU.post("log",{path:s,maxCount:50});0===e.code&&U(e.data||[])}catch(e){}},Z=async()=>{try{const e=await r.TU.post("branches",{path:s});0===e.code&&R(e.data||{current:"",branches:[]})}catch(e){}},q=()=>{B.size===k.length?K(new Set):K(new Set(k.map(e=>e.path)))},J=async(t=!1)=>{try{D(!0);const a=await r.TU.post("push",{path:s,force:t});0===a.code?(0,n.SK)(e("推送成功")):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}finally{D(!1)}},O=e=>{switch(e){case"modified":return z;case"added":return v;case"deleted":case"conflict":return S;case"untracked":default:return b;case"renamed":return m}},Q=e=>{switch(e){case"modified":return"M";case"added":return"A";case"deleted":return"D";case"untracked":return"?";case"renamed":return"R";case"conflict":return"!";default:return e}},V=(0,a.useCallback)(h.throttle(e=>{const t=parseFloat(getComputedStyle(X.current).fontSize),s=window.innerWidth/t-4,a=e.clientX/t,r=2.25+G.current.offsetWidth/t;a<=s&&a>=r&&F(parseFloat(a.toFixed(2)))},32),[]),Y=()=>{E(!1),X.current.removeEventListener("pointermove",V)};s.split("/").filter(Boolean).pop();return(0,x.jsxs)("div",{className:"studio",children:[(0,x.jsx)(l.A,{ignore_tags:!0,left_children:[(0,x.jsx)(i.rA,{title:e("取消"),icon:"close",onClick:()=>{t(-1)}},1),(0,x.jsx)("span",{children:s})],children:(0,x.jsx)(i.rA,{icon:"refresh",title:e("刷新"),onClick:()=>{H(),M(),Z()}})}),(0,x.jsxs)("div",{className:"studio-body",ref:X,children:[(0,x.jsxs)("div",{className:"studio-nav",style:{width:I-1+"em"},children:[(0,x.jsxs)("div",{style:{display:"flex",borderBottom:`1px solid ${g}`},children:[(0,x.jsxs)("button",{onClick:()=>P("status"),style:{flex:1,padding:"10px 8px",border:"none",background:"status"===_?j:"transparent",color:"status"===_?m:b,cursor:"pointer",fontSize:13,fontWeight:"status"===_?600:400,borderBottom:"status"===_?`2px solid ${m}`:"2px solid transparent"},children:["📝 ",e("变更")," (",k.length,")"]}),(0,x.jsxs)("button",{onClick:()=>P("log"),style:{flex:1,padding:"10px 8px",border:"none",background:"log"===_?j:"transparent",color:"log"===_?m:b,cursor:"pointer",fontSize:13,fontWeight:"log"===_?600:400,borderBottom:"log"===_?`2px solid ${m}`:"2px solid transparent"},children:["📜 ",e("提交记录")," (",N.length,")"]})]}),"status"===_&&(0,x.jsxs)("div",{style:{flex:1,overflow:"auto"},children:[k.length>0&&(0,x.jsxs)("div",{style:{padding:"6px 12px",borderBottom:`1px solid ${g}`,display:"flex",alignItems:"center",gap:8,fontSize:12,color:b,cursor:"pointer"},onClick:q,children:[(0,x.jsx)("input",{type:"checkbox",checked:B.size===k.length&&k.length>0,onChange:q,style:{cursor:"pointer"}}),(0,x.jsxs)("span",{children:[e("全选")," (",B.size,"/",k.length,")"]})]}),k.map(e=>(0,x.jsxs)("div",{onClick:()=>(e=>{const t=new Set(B);t.has(e)?t.delete(e):t.add(e),K(t)})(e.path),style:{padding:"8px 12px",cursor:"pointer",borderBottom:`1px solid ${g}`,display:"flex",alignItems:"center",gap:8,background:B.has(e.path)?j:"transparent",transition:"background 0.2s"},children:[(0,x.jsx)("input",{type:"checkbox",checked:B.has(e.path),onChange:()=>{},style:{cursor:"pointer"}}),(0,x.jsx)("span",{style:{fontSize:11,fontWeight:600,width:20,height:20,borderRadius:4,display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#fff",background:O(e.status),flexShrink:0},children:Q(e.status)}),(0,x.jsxs)("span",{style:{fontSize:13,color:y,wordBreak:"break-all"},children:[e.path,e.oldPath&&(0,x.jsxs)("span",{style:{color:b,fontSize:11},children:[" (← ",e.oldPath,")"]})]})]},e.path)),0===k.length&&(0,x.jsx)("p",{style:{color:b,textAlign:"center",padding:20,fontSize:12},children:e("没有变更")})]}),"log"===_&&(0,x.jsxs)("div",{style:{flex:1,overflow:"auto"},children:[N.map((e,t)=>(0,x.jsxs)("div",{style:{padding:"10px 12px",borderBottom:`1px solid ${g}`,display:"flex",flexDirection:"column",gap:4},children:[(0,x.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,x.jsx)("span",{style:{fontSize:11,fontFamily:"monospace",color:m,background:j,padding:"2px 6px",borderRadius:4},children:e.hash}),(0,x.jsx)("span",{style:{fontSize:13,color:y,flex:1},children:e.message})]}),(0,x.jsxs)("div",{style:{fontSize:11,color:b,paddingLeft:4},children:[e.author," · ",e.date]})]},t)),0===N.length&&(0,x.jsx)("p",{style:{color:b,textAlign:"center",padding:20,fontSize:12},children:e("暂无提交记录")})]})]}),(0,x.jsx)("div",{className:"studio__divider",ref:G,onPointerDown:()=>{E(!0),X.current.addEventListener("pointermove",V)},onPointerUp:Y}),L&&(0,x.jsx)("div",{className:"shell__overlay",onPointerUp:Y}),(0,x.jsx)("div",{className:"studio-editor",children:(0,x.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",padding:"16px",gap:12,overflow:"auto"},children:[(0,x.jsxs)("div",{style:{padding:"12px",borderRadius:8,border:`1px solid ${g}`,background:u},children:[(0,x.jsxs)("div",{style:{fontSize:13,fontWeight:600,color:y,marginBottom:8},children:["🌿 ",e("分支"),": ",(0,x.jsx)("span",{style:{color:v},children:$.current})]}),(0,x.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:$.branches.map(t=>(0,x.jsx)("button",{onClick:()=>(async t=>{try{D(!0);const a=await r.TU.post("checkout",{path:s,branch:t});0===a.code?((0,n.SK)(e("切换分支成功")),H(),M(),Z()):(0,n.zN)(a.message)}catch(e){(0,n.zN)(e?.message)}finally{D(!1)}})(t),disabled:t===$.current||t.startsWith("*"),style:{padding:"4px 10px",borderRadius:12,fontSize:11,border:t===$.current?`1px solid ${v}`:`1px solid ${g}`,background:t===$.current?j:"transparent",color:t===$.current?v:b,cursor:t===$.current?"default":"pointer",opacity:t===$.current?1:.8},children:t.replace("remotes/origin/","")},t))})]}),(0,x.jsxs)("div",{style:{padding:"12px",borderRadius:8,border:`1px solid ${g}`,background:u,display:"flex",flexDirection:"column",gap:8},children:[(0,x.jsx)("textarea",{placeholder:e("输入提交信息..."),value:T,onChange:e=>W(e.target.value),rows:2,style:{width:"100%",padding:"8px 12px",borderRadius:8,border:`1px solid ${g}`,background:u,color:y,fontSize:13,boxSizing:"border-box",resize:"vertical"}}),(0,x.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[(0,x.jsxs)("button",{onClick:async()=>{if(T.trim())try{D(!0);const t=await r.TU.post("commit",{path:s,message:T.trim(),allChanged:!0});0===t.code?((0,n.SK)(e("提交成功")),W(""),H(),M()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}finally{D(!1)}else(0,n.zN)(e("请输入提交信息"))},disabled:A||!T.trim(),style:w(v),children:["✅ ",e("提交")]}),(0,x.jsxs)("button",{onClick:async()=>{try{const t=await r.TU.post("add_all",{path:s});0===t.code?((0,n.SK)(e("已暂存全部")),H()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}},style:w(m),children:["➕ ",e("暂存全部")]}),(0,x.jsxs)("button",{onClick:async()=>{if(0!==B.size)try{const t=await r.TU.post("add",{path:s,files:[...B]});0===t.code?((0,n.SK)(e("已暂存")),K(new Set),H()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}else(0,n.zN)(e("请先选择文件"))},style:w(m),children:["📥 ",e("暂存选中")]}),(0,x.jsxs)("button",{onClick:async()=>{if(0!==B.size)try{const t=await r.TU.post("reset",{path:s,files:[...B]});0===t.code?((0,n.SK)(e("已取消暂存")),K(new Set),H()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}else(0,n.zN)(e("请先选择文件"))},style:w(z),children:["↩ ",e("取消暂存")]})]})]}),(0,x.jsxs)("div",{style:{padding:"12px",borderRadius:8,border:`1px solid ${g}`,background:u,display:"flex",flexDirection:"column",gap:8},children:[(0,x.jsxs)("div",{style:{fontSize:13,fontWeight:600,color:y},children:["☁️ ",e("远程操作")]}),(0,x.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[(0,x.jsxs)("button",{onClick:async()=>{try{D(!0);const t=await r.TU.post("pull",{path:s});0===t.code?((0,n.SK)(e("拉取成功")),H(),M()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}finally{D(!1)}},disabled:A,style:w(m),children:["⬇ ",e("拉取")]}),(0,x.jsxs)("button",{onClick:()=>J(!1),disabled:A,style:w(m),children:["⬆ ",e("推送")]}),(0,x.jsxs)("button",{onClick:()=>J(!0),disabled:A,style:w(S),children:["⚠ ",e("强制推送")]})]}),(0,x.jsxs)("div",{style:{display:"flex",gap:6},children:[(0,x.jsxs)("button",{onClick:async()=>{try{const t=await r.TU.post("stash",{path:s});0===t.code?((0,n.SK)(e("暂存工作区成功")),H()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}},style:w(b),children:["📦 ",e("暂存工作区")]}),(0,x.jsxs)("button",{onClick:async()=>{try{const t=await r.TU.post("stash_pop",{path:s});0===t.code?((0,n.SK)(e("恢复工作区成功")),H()):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}},style:w(b),children:["📤 ",e("恢复工作区")]})]})]}),(0,x.jsxs)("div",{style:{padding:"12px",borderRadius:8,border:`1px solid ${g}`,background:f,fontSize:11,color:b,lineHeight:1.6},children:["💡 ",e("提示:"),(0,x.jsxs)("ul",{style:{margin:"4px 0",paddingLeft:16},children:[(0,x.jsx)("li",{children:e("左侧勾选文件后,使用「暂存选中」将其加入暂存区")}),(0,x.jsx)("li",{children:e("输入提交信息后点击「提交」")}),(0,x.jsx)("li",{children:e("如有冲突,请自行在shell中解决冲突后再提交")}),(0,x.jsx)("li",{children:e("「强制推送」会覆盖远程分支,请谨慎使用")})]})]})]})})]})]})}function w(e){return{padding:"6px 12px",borderRadius:6,border:`1px solid ${e}`,background:"transparent",color:e,cursor:"pointer",fontSize:12}}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[8629],{68629(e,t,r){r.r(t),r.d(t,{default:()=>k});var s=r(96540),o=(r(82893),r(14284)),n=r(62042),a=r(22022),i=r(85997),l=r(57952),d=r(52671),c=r(87361),p=r(34289),x=r(2543),u=r(74848);const g="var(--surfacePrimary, #ffffff)",h="var(--surfaceSecondary, #f1f3f4)",f="var(--divider, rgba(0,0,0,0.08))",y="var(--textPrimary, #202124)",v="var(--textSecondary, #5f6368)",b="var(--primary, #1a73e8)",m="var(--primary-light, #d2e3fc)",j="var(--secondary, #34a853)",S=s.lazy(()=>r.e(9762).then(r.bind(r,99762)));function k(){const{t:e}=(0,a.Bd)(),t=(0,d.Zp)(),r=(0,d.zy)(),k=decodeURIComponent((0,p.GG)(c.o.gcfg_page,(0,p.vX)())),[w,C]=(0,s.useState)([]),[$,N]=(0,s.useState)(""),[R,T]=(0,s.useState)(null),[P,_]=(0,s.useState)({exportDir:"",exportTypes:["ts"]}),[L,U]=(0,s.useState)(!1),[D,E]=(0,s.useState)(16),B=(0,s.useRef)(null),I=(0,s.useRef)(null),[A,F]=(0,s.useState)(!1),G=new URLSearchParams(r.search).get("edit")||"";(0,s.useEffect)(()=>{G&&T(G)},[G]),(0,s.useEffect)(()=>{k&&(K(),M())},[k]);const K=async e=>{try{const t=await o.Si.post("list",{dir:k,search:e||$});0===t.code&&C(t.data)}catch(e){}},M=async()=>{try{const e=await o.Si.post("export_config/load",{dir:k});0===e.code&&e.data&&_(e.data)}catch(e){}},W=w.filter(e=>!$||e.toLowerCase().includes($.toLowerCase())),X=(0,s.useCallback)(x.throttle(e=>{const t=parseFloat(getComputedStyle(I.current).fontSize),r=window.innerWidth/t-4,s=e.clientX/t,o=2.25+B.current.offsetWidth/t;s<=r&&s>=o&&E(parseFloat(s.toFixed(2)))},32),[]),Z=()=>{F(!1),I.current.removeEventListener("pointermove",X)};return(0,u.jsxs)("div",{className:"studio",children:[(0,u.jsx)(l.A,{ignore_tags:!0,left_children:[(0,u.jsx)(i.rA,{title:e("取消"),icon:"close",onClick:()=>{t(-1)}},1),(0,u.jsxs)("title",{children:["📋 ",e("配置表")," - ",decodeURIComponent((k.split("/").filter(Boolean).pop()||k).replace(/\/$/,""))]},2)]}),(0,u.jsxs)("div",{className:"studio-body",ref:I,children:[(0,u.jsxs)("div",{className:"studio-nav",style:{width:D-1+"em"},children:[(0,u.jsx)("div",{style:{padding:"8px 12px"},children:(0,u.jsx)("input",{placeholder:e("搜索文件..."),value:$,onChange:e=>{N(e.target.value),K(e.target.value)},style:{width:"100%",padding:"8px 12px",borderRadius:8,border:`1px solid ${f}`,background:g,color:y,fontSize:13,boxSizing:"border-box"}})}),(0,u.jsxs)("div",{style:{flex:1,overflow:"auto",padding:"0 8px"},children:[W.map(e=>(0,u.jsxs)("div",{onClick:()=>(e=>{T(e);const s=new URLSearchParams(r.search);s.set("edit",e),t(`${r.pathname}?${s.toString()}`,{replace:!0})})(e),style:{padding:"10px 12px",cursor:"pointer",borderRadius:8,margin:"2px 0",borderBottom:`1px solid ${f}`,display:"flex",alignItems:"center",gap:8,transition:"background 0.2s",background:R===e?m:"transparent"},onMouseEnter:e=>e.currentTarget.style.background=h,onMouseLeave:t=>t.currentTarget.style.background=R===e?m:"transparent",children:[(0,u.jsx)("span",{style:{color:b},children:"⚙"}),(0,u.jsxs)("span",{style:{fontSize:13},children:[e,".gcfg"]})]},e)),0===W.length&&(0,u.jsx)("p",{style:{color:v,textAlign:"center",padding:20,fontSize:12},children:e("此目录下没有 .gcfg 文件")})]}),(0,u.jsxs)("div",{style:{padding:"8px 12px",borderTop:`1px solid ${f}`,background:g},children:[(0,u.jsxs)("button",{onClick:()=>U(!L),style:{width:"100%",padding:"8px",borderRadius:8,border:`1px solid ${b}`,background:"transparent",color:b,cursor:"pointer",fontSize:13,marginBottom:L?8:0},children:["⚙ ",e("导出设置")]}),L&&(0,u.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(0,u.jsxs)("div",{children:[(0,u.jsxs)("label",{style:{color:v,fontSize:11},children:[e("导出目录"),":"]}),(0,u.jsx)("input",{value:P.exportDir,onChange:e=>_(t=>({...t,exportDir:e.target.value})),placeholder:"/path/to/export",style:{width:"100%",padding:"6px 8px",borderRadius:8,border:`1px solid ${f}`,background:g,color:y,fontSize:12,boxSizing:"border-box",marginTop:2}})]}),(0,u.jsxs)("div",{children:[(0,u.jsxs)("label",{style:{color:v,fontSize:11},children:[e("导出语言"),":"]}),(0,u.jsx)("div",{style:{display:"flex",gap:8,marginTop:4},children:["ts","go"].map(e=>(0,u.jsxs)("label",{style:{color:y,fontSize:12},children:[(0,u.jsx)("input",{type:"checkbox",checked:P.exportTypes.includes(e),onChange:t=>{const r=t.target.checked?[...P.exportTypes,e]:P.exportTypes.filter(t=>t!==e);_(e=>({...e,exportTypes:r}))}})," ",e.toUpperCase()]},e))})]}),(0,u.jsxs)("div",{style:{display:"flex",gap:6},children:[(0,u.jsxs)("button",{onClick:async()=>{try{const t=await o.Si.post("export_config/save",{dir:k,config:P});0===t.code?(0,n.SK)(e("导出配置已保存")):(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}},style:z(j),children:["💾 ",e("保存配置")]}),(0,u.jsxs)("button",{onClick:async()=>{if(P.exportDir)try{const t=await o.Si.post("export",{dir:k});if(0===t.code){const{generated:r,errors:s}=t.data;let o=`${e("导出完成")}: ${r.length} ${e("个文件")}`;s.length>0&&(o+=`\n${e("错误")}: ${s.join(", ")}`),(0,n.SK)(o)}else(0,n.zN)(t.message)}catch(e){(0,n.zN)(e?.message)}else(0,n.zN)(e("请先设置导出目录"))},style:z(b),children:["🚀 ",e("一键导出")]})]})]})]})]}),(0,u.jsx)("div",{className:"studio__divider",ref:B,onPointerDown:()=>{F(!0),I.current.addEventListener("pointermove",X)},onPointerUp:Z}),A&&(0,u.jsx)("div",{className:"shell__overlay",onPointerUp:Z}),(0,u.jsx)("div",{className:"studio-editor",children:R?(0,u.jsx)(s.Suspense,{fallback:(0,u.jsx)("div",{}),children:(0,u.jsx)(S,{filePath:`${k}${R}.gcfg`,fileName:`${R}.gcfg`,onClose:()=>{T(null);const e=new URLSearchParams(r.search);e.delete("edit"),t(`${r.pathname}?${e.toString()}`,{replace:!0})}})}):(0,u.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",color:v,flexDirection:"column",gap:12,height:"100%"},children:[(0,u.jsx)("span",{style:{fontSize:48},children:"📋"}),(0,u.jsx)("span",{children:e("从左侧选择一个配置表文件进行编辑")})]})},R||"placeholder")]})]})}function z(e){return{flex:1,padding:"6px 8px",borderRadius:4,border:`1px solid ${e}`,background:"transparent",color:e,cursor:"pointer",fontSize:12}}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[9223],{79223(e,n,l){l.r(n),l.d(n,{default:()=>d});var s=l(96540),c=l(34843),i=l(82893),a=(l(22022),l(74848));const f=s.lazy(()=>l.e(9762).then(l.bind(l,99762))),t=s.lazy(()=>l.e(6348).then(l.bind(l,66348)));function d(){const[e,n]=(0,c.fp)(i.AG.gcfg_editor),[l,d]=(0,c.fp)(i.AG.gcfg_dir_config),[p,o]=(0,s.useState)(null),r=e=>{n({open:!0,path:`${l.dir}/${e}.gcfg`,name:`${e}.gcfg`})};return e.open?(0,a.jsx)(s.Suspense,{fallback:(0,a.jsx)("div",{}),children:(0,a.jsx)(f,{})}):l.open?(0,a.jsx)(s.Suspense,{fallback:(0,a.jsx)("div",{}),children:(0,a.jsx)(t,{dir:l.dir,onOpenFile:r,onClose:()=>d({open:!1})})}):null}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[9762],{99762(e,t,r){r.r(t),r.d(t,{default:()=>Z});var n=r(96540),l=r(34843),s=r(82893),i=r(14284),a=r(62042),o=r(22022),d=r(5275);const c={surface:"var(--surfacePrimary, #ffffff)",surface2:"var(--surfaceSecondary, #f1f3f4)",border:"var(--divider, rgba(0,0,0,0.08))",text:"var(--textPrimary, #202124)",text2:"var(--textSecondary, #5f6368)",primary:"var(--primary, #1a73e8)",primaryLight:"var(--primary-light, #d2e3fc)",green:"var(--secondary, #34a853)",red:"var(--accent, #ea4335)",yellow:"var(--warning, #fbbc04)"},x=[{value:d.V.Dict,label:"字典(Dict)"},{value:d.V.TwoDim,label:"二维表(TwoDim)"},{value:d.V.Const,label:"常量(Const)"}],p=[{value:d.S.String,label:"字符串"},{value:d.S.Number,label:"数字"},{value:d.S.Boolean,label:"布尔"}];function h(e){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)}const y={color:c.text2,fontSize:13,marginRight:4},u={padding:"6px 10px",borderRadius:8,border:`1px solid ${c.border}`,background:c.surface,color:c.text,fontSize:13},m={padding:"4px 8px",borderRadius:4,border:`1px solid ${c.border}`,background:c.surface,color:c.text,fontSize:12,width:"100%",boxSizing:"border-box",minWidth:80},g={width:"100%",borderCollapse:"collapse",border:`1px solid ${c.border}`,fontSize:13},f={padding:"8px 12px",textAlign:"left",borderBottom:`1px solid ${c.border}`,color:c.primary,fontWeight:"bold"},j={padding:"4px 8px",borderBottom:`1px solid ${c.border}`,color:c.text},v={padding:"6px 12px",borderRadius:8,border:`1px solid ${c.green}`,background:"transparent",color:c.green,cursor:"pointer",fontSize:12},b={padding:"4px 8px",borderRadius:8,border:`1px solid ${c.red}`,background:"transparent",color:c.red,cursor:"pointer",fontSize:11};function S(e,t){return{padding:"6px 16px",border:`1px solid ${t||(e?c.primary:c.border)}`,borderRadius:8,background:e?c.primaryLight:"transparent",color:e?c.primary:t||c.text2,cursor:"pointer",fontSize:13}}var N=r(74848);function k({cfg:e,updateConfig:t,t:r}){const l=e.dict,s=function(e){if(0===e.length||"id"!==e[0].enName)return[{enName:"id",desc:"编号",valueType:d.S.String},...e.filter(e=>"id"!==e.enName)];const t=e[0];if(t.valueType!==d.S.String||"编号"!==t.desc)return[{...t,desc:"编号",valueType:d.S.String},...e.slice(1).filter(e=>"id"!==e.enName)];return e}(l.keys);s!==l.keys&&t({dict:{keys:s}});const[i,a]=(0,n.useState)(""),[o,x]=(0,n.useState)(""),[m,S]=(0,n.useState)(d.S.String),k=e=>{t({dict:{...l,...e}})};return(0,N.jsxs)("div",{children:[(0,N.jsx)("h3",{style:{color:c.primary,marginTop:0},children:r("字典(Dict) 表结构")}),(0,N.jsx)("p",{style:{color:c.text2,fontSize:12,marginBottom:16},children:r("字典表:第一列固定为「编号」(id),类型为字符串。可添加更多列并选择类型。每行数据填写各列的值。")}),(0,N.jsx)("div",{style:{display:"flex",gap:20,flexWrap:"wrap",marginBottom:16},children:(0,N.jsxs)("label",{children:[(0,N.jsxs)("span",{style:y,children:[r("英文表名"),": "]}),(0,N.jsx)("input",{value:e.enName,onChange:e=>t({enName:e.target.value}),placeholder:"CamelCaseName",style:u})]})}),(0,N.jsxs)("h4",{style:{color:c.text},children:[r("列定义")," (",s.length,")"]}),(0,N.jsxs)("table",{style:g,children:[(0,N.jsx)("thead",{children:(0,N.jsxs)("tr",{style:{background:c.primaryLight},children:[(0,N.jsx)("th",{style:f,children:r("中文名")}),(0,N.jsx)("th",{style:f,children:r("英文名(变量名)")}),(0,N.jsx)("th",{style:f,children:r("类型")}),(0,N.jsx)("th",{style:f,children:r("操作")})]})}),(0,N.jsx)("tbody",{children:s.map((e,t)=>(0,N.jsxs)("tr",{children:[(0,N.jsx)("td",{style:j,children:0===t?(0,N.jsxs)("span",{style:{fontWeight:"bold",color:c.primary},children:["🔒 ",e.desc]}):e.desc}),(0,N.jsx)("td",{style:j,children:(0,N.jsx)("span",{style:{color:h(e.enName)?c.green:c.red,fontFamily:"monospace"},children:e.enName||"(空)"})}),(0,N.jsx)("td",{style:j,children:0===t?(0,N.jsx)("span",{style:{color:c.text2,fontSize:12},children:"字符串 (固定)"}):(0,N.jsx)("select",{value:e.valueType,onChange:t=>{return r=e.enName,n=t.target.value,void("id"!==r&&k({keys:s.map(e=>e.enName===r?{...e,valueType:n}:e)}));var r,n},style:{...u,padding:"2px 6px",fontSize:12},children:p.map(e=>(0,N.jsx)("option",{value:e.value,children:e.label},e.value))})}),(0,N.jsx)("td",{style:j,children:0===t?(0,N.jsx)("span",{style:{color:c.text2,fontSize:11},children:r("固定列")}):(0,N.jsx)("button",{onClick:()=>{var t;"id"!==(t=e.enName)?k({keys:s.filter(e=>e.enName!==t)}):alert(r("编号列不可删除"))},style:b,children:"✕"})})]},e.enName))})]}),(0,N.jsxs)("div",{style:{display:"flex",gap:8,marginTop:12,alignItems:"center",flexWrap:"wrap"},children:[(0,N.jsx)("input",{placeholder:r("中文名"),value:o,onChange:e=>x(e.target.value),style:u}),(0,N.jsx)("input",{placeholder:r("英文名(必需,如 heroId)"),value:i,onChange:e=>a(e.target.value),style:u}),(0,N.jsx)("select",{value:m,onChange:e=>S(e.target.value),style:u,children:p.map(e=>(0,N.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,N.jsxs)("button",{onClick:()=>{if(!o.trim()||!i.trim())return;if(!h(i.trim()))return void alert(r("英文名不符合变量命名规范"));if(s.find(e=>e.enName===i.trim()))return void alert(r("该英文名已存在"));const e={enName:i.trim(),desc:o.trim(),valueType:m};k({keys:[...s,e]}),a(""),x(""),S(d.S.String)},style:v,children:["+ ",r("添加列")]})]})]})}function C({cfg:e,updateConfig:t,t:r}){const l=e.twoDim,[s,i]=(0,n.useState)(""),[a,o]=(0,n.useState)(""),[d,x]=(0,n.useState)(""),[m,S]=(0,n.useState)(""),k=e=>{t({twoDim:{...l,...e}})};return(0,N.jsxs)("div",{children:[(0,N.jsx)("h3",{style:{color:c.primary,marginTop:0},children:r("二维表(TwoDim) 表结构")}),(0,N.jsx)("p",{style:{color:c.text2,fontSize:12,marginBottom:16},children:r("二维表:X 轴 keys(列头)× Y 轴 keys(行头),用户在表格中填入对应的 value。")}),(0,N.jsx)("div",{style:{display:"flex",gap:20,flexWrap:"wrap",marginBottom:16},children:(0,N.jsxs)("label",{children:[(0,N.jsxs)("span",{style:y,children:[r("英文表名"),": "]}),(0,N.jsx)("input",{value:e.enName,onChange:e=>t({enName:e.target.value}),placeholder:"CamelCaseName",style:u})]})}),(0,N.jsx)("div",{style:{marginBottom:16},children:(0,N.jsxs)("label",{children:[(0,N.jsxs)("span",{style:y,children:[r("Value 类型"),": "]}),(0,N.jsx)("select",{value:l.valueType,onChange:e=>k({valueType:e.target.value}),style:u,children:p.map(e=>(0,N.jsx)("option",{value:e.value,children:e.label},e.value))})]})}),(0,N.jsxs)("div",{style:{marginBottom:20},children:[(0,N.jsxs)("h4",{style:{color:c.text},children:[r("X 轴 Keys(列头)")," (",l.xKeys.length,")",(0,N.jsx)("span",{style:{color:c.text2,fontSize:11,marginLeft:8},children:r("每个 X key 类型为 string,都展示在列头")})]}),(0,N.jsxs)("table",{style:g,children:[(0,N.jsx)("thead",{children:(0,N.jsxs)("tr",{style:{background:c.primaryLight},children:[(0,N.jsx)("th",{style:f,children:r("中文名")}),(0,N.jsx)("th",{style:f,children:r("英文名")}),(0,N.jsx)("th",{style:f,children:r("类型")}),(0,N.jsx)("th",{style:f,children:r("操作")})]})}),(0,N.jsxs)("tbody",{children:[l.xKeys.map(e=>(0,N.jsxs)("tr",{children:[(0,N.jsx)("td",{style:j,children:e.desc}),(0,N.jsx)("td",{style:j,children:(0,N.jsx)("span",{style:{fontFamily:"monospace",color:c.primary},children:e.enName})}),(0,N.jsx)("td",{style:j,children:"string"}),(0,N.jsx)("td",{style:j,children:(0,N.jsx)("button",{onClick:()=>{return t=e.enName,void k({xKeys:l.xKeys.filter(e=>e.enName!==t)});var t},style:b,children:"✕"})})]},e.enName)),0===l.xKeys.length&&(0,N.jsx)("tr",{children:(0,N.jsx)("td",{colSpan:4,style:{...j,textAlign:"center",color:c.text2},children:r("暂无 X 轴 key")})})]})]}),(0,N.jsxs)("div",{style:{display:"flex",gap:8,marginTop:8,alignItems:"center"},children:[(0,N.jsx)("input",{placeholder:r("中文名"),value:a,onChange:e=>o(e.target.value),style:u}),(0,N.jsx)("input",{placeholder:r("英文名(如 heroId)"),value:s,onChange:e=>i(e.target.value),style:u}),(0,N.jsxs)("button",{onClick:()=>{if(!a.trim()||!s.trim())return;if(!h(s.trim()))return void alert(r("英文名不符合变量命名规范"));if(l.xKeys.find(e=>e.enName===s.trim()))return void alert(r("该英文名已存在"));const e={enName:s.trim(),desc:a.trim()};k({xKeys:[...l.xKeys,e]}),i(""),o("")},style:v,children:["+ ",r("添加 X Key")]})]})]}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("h4",{style:{color:c.text},children:[r("Y 轴 Keys(行头)")," (",l.yKeys.length,")",(0,N.jsx)("span",{style:{color:c.text2,fontSize:11,marginLeft:8},children:r("每个 Y key 类型为 string,都展示在行头")})]}),(0,N.jsxs)("table",{style:g,children:[(0,N.jsx)("thead",{children:(0,N.jsxs)("tr",{style:{background:c.primaryLight},children:[(0,N.jsx)("th",{style:f,children:r("中文名")}),(0,N.jsx)("th",{style:f,children:r("英文名")}),(0,N.jsx)("th",{style:f,children:r("类型")}),(0,N.jsx)("th",{style:f,children:r("操作")})]})}),(0,N.jsxs)("tbody",{children:[l.yKeys.map(e=>(0,N.jsxs)("tr",{children:[(0,N.jsx)("td",{style:j,children:e.desc}),(0,N.jsx)("td",{style:j,children:(0,N.jsx)("span",{style:{fontFamily:"monospace",color:c.primary},children:e.enName})}),(0,N.jsx)("td",{style:j,children:"string"}),(0,N.jsx)("td",{style:j,children:(0,N.jsx)("button",{onClick:()=>{return t=e.enName,void k({yKeys:l.yKeys.filter(e=>e.enName!==t)});var t},style:b,children:"✕"})})]},e.enName)),0===l.yKeys.length&&(0,N.jsx)("tr",{children:(0,N.jsx)("td",{colSpan:4,style:{...j,textAlign:"center",color:c.text2},children:r("暂无 Y 轴 key")})})]})]}),(0,N.jsxs)("div",{style:{display:"flex",gap:8,marginTop:8,alignItems:"center"},children:[(0,N.jsx)("input",{placeholder:r("中文名"),value:m,onChange:e=>S(e.target.value),style:u}),(0,N.jsx)("input",{placeholder:r("英文名(如 itemId)"),value:d,onChange:e=>x(e.target.value),style:u}),(0,N.jsxs)("button",{onClick:()=>{if(!m.trim()||!d.trim())return;if(!h(d.trim()))return void alert(r("英文名不符合变量命名规范"));if(l.yKeys.find(e=>e.enName===d.trim()))return void alert(r("该英文名已存在"));const e={enName:d.trim(),desc:m.trim()};k({yKeys:[...l.yKeys,e]}),x(""),S("")},style:v,children:["+ ",r("添加 Y Key")]})]})]})]})}const w={width:"100%",borderCollapse:"collapse",border:`1px solid ${c.border}`,fontSize:13},z={padding:"8px 12px",textAlign:"left",borderBottom:`1px solid ${c.border}`,color:c.primary,fontWeight:"bold",background:c.primaryLight},T={padding:"4px 8px",borderBottom:`1px solid ${c.border}`,color:c.text};function D({cfg:e,updateConfig:t,t:r}){const l=e.const_.keys||[],[s,i]=(0,n.useState)(""),[a,o]=(0,n.useState)(""),[x,m]=(0,n.useState)(d.S.String),g=e=>{t({const_:{keys:e}})};return(0,N.jsxs)("div",{children:[(0,N.jsx)("h3",{style:{color:c.primary,marginTop:0},children:r("常量(Const) 表结构")}),(0,N.jsx)("p",{style:{color:c.text2,fontSize:12,marginBottom:16},children:r("常量表:每行一个常量,可设置中文名、英文名和各自的值类型。")}),(0,N.jsx)("div",{style:{display:"flex",gap:20,flexWrap:"wrap",marginBottom:16},children:(0,N.jsxs)("label",{children:[(0,N.jsxs)("span",{style:y,children:[r("英文表名"),": "]}),(0,N.jsx)("input",{value:e.enName,onChange:e=>t({enName:e.target.value}),placeholder:"CamelCaseName",style:u})]})}),(0,N.jsxs)("h4",{style:{color:c.text},children:[r("常量定义列表")," (",l.length,")"]}),(0,N.jsxs)("table",{style:w,children:[(0,N.jsx)("thead",{children:(0,N.jsxs)("tr",{children:[(0,N.jsx)("th",{style:z,children:r("中文名")}),(0,N.jsx)("th",{style:z,children:r("英文名(变量名)")}),(0,N.jsx)("th",{style:z,children:r("值类型")}),(0,N.jsx)("th",{style:z,children:r("操作")})]})}),(0,N.jsxs)("tbody",{children:[l.map(e=>(0,N.jsxs)("tr",{children:[(0,N.jsx)("td",{style:T,children:e.desc}),(0,N.jsx)("td",{style:T,children:(0,N.jsx)("span",{style:{color:h(e.enName)?c.green:c.red,fontFamily:"monospace"},children:e.enName||"(空)"})}),(0,N.jsx)("td",{style:T,children:(0,N.jsx)("select",{value:e.valueType,onChange:t=>{return r=e.enName,n=t.target.value,void g(l.map(e=>e.enName===r?{...e,valueType:n}:e));var r,n},style:{...u,fontSize:12,padding:"4px 8px"},children:p.map(e=>(0,N.jsx)("option",{value:e.value,children:e.label},e.value))})}),(0,N.jsx)("td",{style:T,children:(0,N.jsx)("button",{onClick:()=>{return t=e.enName,void g(l.filter(e=>e.enName!==t));var t},style:b,children:"✕"})})]},e.enName)),0===l.length&&(0,N.jsx)("tr",{children:(0,N.jsx)("td",{colSpan:4,style:{...T,textAlign:"center",color:c.text2},children:r("暂无常量定义,请在下方添加")})})]})]}),(0,N.jsxs)("div",{style:{display:"flex",gap:8,marginTop:12,alignItems:"center",flexWrap:"wrap"},children:[(0,N.jsx)("input",{placeholder:r("中文名"),value:s,onChange:e=>i(e.target.value),style:u}),(0,N.jsx)("input",{placeholder:r("英文名(如 MAX_HP)"),value:a,onChange:e=>o(e.target.value),style:u}),(0,N.jsx)("select",{value:x,onChange:e=>m(e.target.value),style:u,children:p.map(e=>(0,N.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,N.jsxs)("button",{onClick:()=>{if(!s.trim()||!a.trim())return;if(!h(a.trim()))return void alert(r("英文名不符合变量命名规范"));if(l.find(e=>e.enName===a.trim()))return void alert(r("该英文名已存在"));const e={enName:a.trim(),desc:s.trim(),valueType:x};g([...l,e]),i(""),o(""),m(d.S.String)},style:v,children:["+ ",r("添加常量")]})]})]})}const K={overflowX:"auto",width:"100%",border:`1px solid ${c.border}`,borderRadius:8},$={width:"100%",borderCollapse:"collapse",fontSize:13,minWidth:600},B={padding:"8px 12px",textAlign:"left",borderBottom:`2px solid ${c.border}`,background:c.primaryLight,color:c.primary,fontWeight:"bold",whiteSpace:"nowrap",position:"sticky",top:0},W={padding:"2px 4px",borderBottom:`1px solid ${c.border}`},A={width:"100%",padding:"6px 8px",borderRadius:6,border:"1px solid transparent",background:"transparent",color:c.text,fontSize:13,boxSizing:"border-box",minWidth:100},L={width:"100%",padding:"6px 8px",borderRadius:6,border:`1px dashed ${c.primary}`,background:c.surface,color:c.text,fontSize:13,boxSizing:"border-box",minWidth:100};function R(e){return e.desc||e.enName}function V({cfg:e,data:t,updateData:r,t:l}){const s=e.dict.keys,i=t?.rows||[],[a,o]=(0,n.useState)({});if(0===s.length)return(0,N.jsx)("p",{style:{color:c.text2},children:l("请先在表结构中添加列定义")});const d=()=>{if(!(a.id||"").trim())return;const e={};for(const t of s)e[t.enName]=a[t.enName]||"";r({rows:[...i,e]}),o({})},x=e=>{"Enter"===e.key&&d()};return(0,N.jsxs)("div",{children:[(0,N.jsx)("h3",{style:{color:c.primary,marginTop:0},children:l("字典数据编辑")}),(0,N.jsx)("p",{style:{color:c.text2,fontSize:12,marginBottom:12},children:l("表格式编辑:表头为各列定义,每行填写各列的值。编号列不可为空。")}),(0,N.jsx)("div",{style:K,children:(0,N.jsxs)("table",{style:$,children:[(0,N.jsx)("thead",{children:(0,N.jsxs)("tr",{children:[(0,N.jsx)("th",{style:{...B,width:60},children:"#"}),s.map(e=>(0,N.jsxs)("th",{style:B,children:[(0,N.jsx)("div",{children:e.desc||e.enName}),(0,N.jsxs)("div",{style:{fontSize:10,fontWeight:"normal",color:c.text2},children:[e.enName," (",e.valueType,")"]})]},e.enName)),(0,N.jsx)("th",{style:{...B,width:60},children:l("操作")})]})}),(0,N.jsxs)("tbody",{children:[(0,N.jsxs)("tr",{style:{background:c.surface2},children:[(0,N.jsx)("td",{style:{...W,textAlign:"center",color:c.text2},children:"+"}),s.map(e=>(0,N.jsx)("td",{style:W,children:(0,N.jsx)("input",{value:a[e.enName]||"",onChange:t=>{return r=e.enName,n=t.target.value,void o(e=>({...e,[r]:n}));var r,n},onKeyDown:x,placeholder:R(e),style:L})},e.enName)),(0,N.jsx)("td",{style:{...W,textAlign:"center"},children:(0,N.jsx)("button",{onClick:d,style:v,children:"+"})})]}),i.map((e,t)=>(0,N.jsxs)("tr",{onMouseEnter:e=>{e.currentTarget.style.background=c.primaryLight},onMouseLeave:e=>{e.currentTarget.style.background=""},children:[(0,N.jsx)("td",{style:{...W,textAlign:"center",color:c.text2,fontSize:12},children:t+1}),s.map(n=>(0,N.jsx)("td",{style:W,children:(0,N.jsx)("input",{value:e[n.enName]||"",onChange:e=>((e,t,n)=>{const l=i.map((r,l)=>l!==e?r:{...r,[t]:n});r({rows:l})})(t,n.enName,e.target.value),placeholder:R(n),style:{...A,borderColor:"transparent"},onFocus:e=>{e.target.style.border=`1px solid ${c.primary}`,e.target.style.background=c.surface},onBlur:e=>{e.target.style.border="1px solid transparent",e.target.style.background="transparent"}})},n.enName)),(0,N.jsx)("td",{style:{...W,textAlign:"center"},children:(0,N.jsx)("button",{onClick:()=>(e=>{r({rows:i.filter((t,r)=>r!==e)})})(t),style:b,children:"✕"})})]},t))]})]})}),0===i.length&&(0,N.jsx)("div",{style:{textAlign:"center",color:c.text2,padding:20},children:l("暂无数据,请在上方添加行")})]})}function I({cfg:e,data:t,updateData:r,t:n}){const l=e.twoDim,s=l.xKeys,i=l.yKeys;if(0===s.length||0===i.length)return(0,N.jsx)("p",{style:{color:c.text2},children:n("请先在表结构中添加 X 轴和 Y 轴的 key")});const a=t?.cells||{},o=Math.max(100,120);return(0,N.jsxs)("div",{children:[(0,N.jsx)("h3",{style:{color:c.primary,marginTop:0},children:n("二维表数据编辑")}),(0,N.jsxs)("p",{style:{color:c.text2,fontSize:12,marginBottom:8},children:[n("X 轴(列头):"),s.map(e=>e.desc).join(", ")," | ",n("Y 轴(行头):"),i.map(e=>e.desc).join(", ")," | Value类型:",l.valueType]}),(0,N.jsx)("div",{style:{overflow:"auto"},children:(0,N.jsxs)("table",{style:{...g,borderCollapse:"collapse"},children:[(0,N.jsx)("thead",{children:(0,N.jsxs)("tr",{children:[(0,N.jsx)("th",{style:{...f,background:c.surface2,minWidth:140},children:(0,N.jsx)("span",{style:{fontSize:11,color:c.text2},children:"Y ↓ / X →"})}),s.map(e=>(0,N.jsxs)("th",{style:{...f,minWidth:o,background:c.primaryLight,textAlign:"center"},children:[(0,N.jsx)("div",{style:{fontWeight:"bold"},children:e.desc}),(0,N.jsx)("div",{style:{fontSize:11,color:c.text2,fontFamily:"monospace"},children:e.enName})]},e.enName))]})}),(0,N.jsx)("tbody",{children:i.map(e=>(0,N.jsxs)("tr",{children:[(0,N.jsxs)("td",{style:{...j,background:c.primaryLight,fontWeight:"bold"},children:[(0,N.jsx)("div",{children:e.desc}),(0,N.jsx)("div",{style:{fontSize:11,color:c.text2,fontFamily:"monospace"},children:e.enName})]}),s.map(t=>(0,N.jsx)("td",{style:j,children:(0,N.jsx)("input",{value:a[t.enName]?.[e.enName]||"",onChange:n=>((e,t,n)=>{const l={...a};l[e]||(l[e]={}),l[e]={...l[e],[t]:n},""===n&&Object.keys(l[e]).every(t=>!l[e][t])&&delete l[e],r({cells:l})})(t.enName,e.enName,n.target.value),placeholder:l.valueType,style:m})},t.enName))]},e.enName))})]})})]})}const X={display:"flex",alignItems:"center",gap:8,marginBottom:6,padding:"6px 8px",borderRadius:8,background:c.surface,border:`1px solid ${c.border}`},_={width:160,minWidth:160,fontFamily:"monospace",fontWeight:"bold",color:c.primary,fontSize:13,wordBreak:"break-all",padding:"4px 8px",background:c.primaryLight,borderRadius:4,flexShrink:0},F={fontSize:11,color:c.text2,minWidth:80,flexShrink:0},Y={flex:1,padding:"6px 10px",borderRadius:8,border:`1px solid ${c.border}`,background:c.surface,color:c.text,fontSize:13,minWidth:120},E={fontSize:10,color:c.text2,background:c.surface2,padding:"2px 6px",borderRadius:4,flexShrink:0};function M({cfg:e,data:t,updateData:r,t:n}){const l=e.const_.keys||[],s=t?.values||{};return 0===l.length?(0,N.jsx)("p",{style:{color:c.text2},children:n("请先在表结构中添加常量定义")}):(0,N.jsxs)("div",{children:[(0,N.jsx)("h3",{style:{color:c.primary,marginTop:0},children:n("常量数据编辑")}),(0,N.jsx)("p",{style:{color:c.text2,fontSize:12,marginBottom:12},children:n("根据表结构中定义的常量,为每个常量输入对应的值。")}),l.map(e=>(0,N.jsxs)("div",{style:X,children:[(0,N.jsx)("div",{style:_,title:e.enName,children:e.enName}),(0,N.jsx)("div",{style:F,children:e.desc}),(0,N.jsx)("input",{value:s[e.enName]||"",onChange:t=>{return n=e.enName,l=t.target.value,void r({values:{...s,[n]:l}});var n,l},style:Y,placeholder:`${e.desc||e.enName}`}),(0,N.jsx)("span",{style:E,children:e.valueType})]},e.enName))]})}function P(){return{config:{type:d.V.Dict,enName:"",dict:{keys:[{enName:"id",desc:"编号",valueType:"string"}]}}}}function G(e){const t={...e};switch(t.type){case d.V.Const:t.const_||(t.const_={keys:[]});break;case d.V.Dict:t.dict||(t.dict={keys:[{enName:"id",desc:"编号",valueType:"string"}]});break;case d.V.TwoDim:t.twoDim||(t.twoDim={xKeys:[],yKeys:[],valueType:d.S.String})}return t}function Z(e){const[t,r]=(0,l.fp)(s.AG.gcfg_editor),{t:p}=(0,o.Bd)(),[y,u]=(0,n.useState)(P()),[m,g]=(0,n.useState)(!1),[f,j]=(0,n.useState)(!1),[v,b]=(0,n.useState)("config"),w=e?.filePath||t.path,z=e?.fileName||t.name,T=e?.onClose,[K,$]=(0,n.useState)(!1);(0,n.useEffect)(()=>{w&&W()},[w]);const B=()=>w||"",W=async()=>{g(!0);try{const e=await i.Si.post("load",{path:B()});if(0===e.code){const t=G(e.data.config),r=e.data.data||{};u({config:t,data:r}),$(!0),b("data")}else u(P()),$(!1)}catch(e){u(P()),$(!1)}g(!1)},A=()=>j(!0),L=e=>{K&&void 0!==e.type&&e.type!==y.config.type||(u(t=>({config:G({...t.config,...e}),data:t.data})),A())},R=e=>{u(t=>({...t,data:e})),A()},X=y.config;if(m)return(0,N.jsx)("div",{style:{padding:20,color:c.text2},children:"Loading..."});const _=!!T;return(0,N.jsxs)("div",{style:_?{width:"100%",height:"100%",background:c.surface,color:c.text,display:"flex",flexDirection:"column",overflow:"hidden"}:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",zIndex:2e3,background:c.surface,color:c.text,display:"flex",flexDirection:"column"},children:[(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",padding:"8px 16px",background:c.surface,borderBottom:`1px solid ${c.border}`,gap:12,flexShrink:0},children:[(0,N.jsx)("span",{style:{fontWeight:"bold",fontSize:16,color:c.primary},children:"⚙ Gcfg Editor"}),(0,N.jsx)("span",{style:{color:c.text2},children:z}),K?(0,N.jsxs)("span",{style:{padding:"3px 10px",borderRadius:12,fontSize:12,background:c.BG2,color:c.text2,border:`1px solid ${c.border}`},children:["🔒 ",x.find(e=>e.value===X.type)?.label||X.type]}):(0,N.jsx)("select",{value:X.type,onChange:e=>L({type:e.target.value}),style:{padding:"3px 10px",borderRadius:12,fontSize:12,background:c.primaryLight,color:c.primary,border:`1px solid ${c.primary}`,cursor:"pointer",outline:"none"},children:x.map(e=>(0,N.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,N.jsx)("div",{style:{flex:1}}),(0,N.jsx)("button",{onClick:()=>b("config"),style:S("config"===v),children:p("表结构")}),(0,N.jsx)("button",{onClick:()=>b("data"),style:S("data"===v),children:p("数据")}),(0,N.jsxs)("button",{onClick:async()=>{const e=y.config;if(e.enName&&h(e.enName))try{const e=await i.Si.post("save",{path:B(),content:y});0===e.code?((0,a.SK)(p("保存成功")),j(!1)):(0,a.zN)(e.message||p("保存失败"))}catch(e){(0,a.zN)(e?.message||p("保存失败"))}else(0,a.zN)(p("英文表名不符合变量命名规范"))},style:S(!1,c.green),children:["💾 ",p("保存")," ",f?"●":""]}),(0,N.jsxs)("button",{onClick:()=>{f&&!window.confirm(p("有未保存的更改,确定关闭吗?"))||(T?T():(r({open:!1}),t.close?.()))},style:S(!1,c.red),children:["✕ ",p("关闭")]})]}),(0,N.jsxs)("div",{style:{flex:1,overflow:"auto",padding:16},children:["config"===v&&(()=>{switch(X.type){case d.V.Dict:return(0,N.jsx)(k,{cfg:X,updateConfig:L,t:p});case d.V.TwoDim:return(0,N.jsx)(C,{cfg:X,updateConfig:L,t:p});case d.V.Const:return(0,N.jsx)(D,{cfg:X,updateConfig:L,t:p});default:return(0,N.jsx)(k,{cfg:X,updateConfig:L,t:p})}})(),"data"===v&&(()=>{const e=y.data;switch(X.type){case d.V.Dict:return(0,N.jsx)(V,{cfg:X,data:e,updateData:R,t:p});case d.V.TwoDim:return(0,N.jsx)(I,{cfg:X,data:e,updateData:R,t:p});case d.V.Const:return(0,N.jsx)(M,{cfg:X,data:e,updateData:R,t:p});default:return(0,N.jsx)(V,{cfg:X,data:e,updateData:R,t:p})}})()]})]})}}}]);