lantern-harness 0.1.23 → 0.1.25
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/CHANGELOG.md +51 -0
- package/builtin/session/bash-session.mjs +91 -0
- package/builtin/session/lh-bash.mjs +67 -1
- package/builtin/session/lh-web.mjs +103 -52
- package/builtin/session/mcp-client.mjs +290 -0
- package/builtin/session/pwsh-session.mjs +90 -0
- package/builtin/session/session-runs.mjs +6 -1
- package/builtin/session/tool-run-policy.mjs +32 -0
- package/builtin/session/web-fetch-policy.mjs +79 -0
- package/cli/acp-server.mjs +19 -9
- package/cli/agent-policy.mjs +60 -0
- package/cli/headless.mjs +30 -6
- package/cli/jsonrpc-server.mjs +9 -3
- package/cli/lantern.mjs +40 -5
- package/cli/server.mjs +2 -0
- package/dist/500.html +4 -4
- package/dist/_astro/Base.COYvzmy5.css +1 -0
- package/dist/_astro/{Base.astro_astro_type_script_index_0_lang.CWRCetQl.js → Base.astro_astro_type_script_index_0_lang.Cb6ggViJ.js} +1 -1
- package/dist/_astro/{CaseExecBoard.Dnb8oP5i.js → CaseExecBoard.cl2Od7av.js} +1 -1
- package/dist/_astro/{CaseGenerateApp.ci_JowEk.js → CaseGenerateApp.nE3RR7bV.js} +5 -5
- package/dist/_astro/CasesLibrary.e3vlOqSQ.js +21 -0
- package/dist/_astro/ChatApp.CECImcJo.js +226 -0
- package/dist/_astro/ConfirmDialog.D5qXeML0.js +1 -0
- package/dist/_astro/{DashboardBoard.D-zHXRds.js → DashboardBoard.CmxqpmzI.js} +2 -2
- package/dist/_astro/{DocsFileBrowser.BM3nH4VD.js → DocsFileBrowser.BdpWp8zQ.js} +1 -1
- package/dist/_astro/DocsPager.D55FTK9d.js +1 -0
- package/dist/_astro/{KnowledgeLibrary.D9KnqXzr.js → KnowledgeLibrary.DKci9jN8.js} +1 -1
- package/dist/_astro/MultiSelectDropdown.BHxW9XLR.js +1 -0
- package/dist/_astro/NamePromptDialog.Csfnh5eM.js +1 -0
- package/dist/_astro/{NavLibraries.RH3Sinuh.js → NavLibraries.BybmHnXn.js} +1 -1
- package/dist/_astro/PluginsPage.B6dsHB44.js +1 -0
- package/dist/_astro/{PluginsPage.DBRfSxtq.js → PluginsPage.D5LXPMns.js} +2 -2
- package/dist/_astro/{PmBugsBoard.BnnaNP1y.js → PmBugsBoard.B6w50MHD.js} +1 -1
- package/dist/_astro/{PmIterationsBoard.phiyhQVA.js → PmIterationsBoard.Dk7JheCU.js} +1 -1
- package/dist/_astro/{PmProjectDetail.C8kRX5lu.js → PmProjectDetail.O44fnczN.js} +1 -1
- package/dist/_astro/{PmProjectsBoard.CFApEGPo.js → PmProjectsBoard.qgj9HAj8.js} +1 -1
- package/dist/_astro/PmRequirementsBoard.BKY3h4CQ.js +1 -0
- package/dist/_astro/{PmRequirementsBoard.DR9egcgA.js → PmRequirementsBoard.DTL_RFxq.js} +1 -1
- package/dist/_astro/{PmShared.BrBicDMN.js → PmShared.Bwphj4KH.js} +1 -1
- package/dist/_astro/{PromptsLibrary.sz6MivVn.js → PromptsLibrary.Dv5OABdK.js} +1 -1
- package/dist/_astro/{ReportsPage.CYZtpeiv.js → ReportsPage.B7MOskzc.js} +1 -1
- package/dist/_astro/ReqAnalysisBoard.nUp89z1s.js +39 -0
- package/dist/_astro/{RequirementsLibrary.R4dNZa9y.js → RequirementsLibrary._OviMClB.js} +1 -1
- package/dist/_astro/SearchableSelect.D3ODywC4.js +1 -0
- package/dist/_astro/SettingsDialog.D3f4EOwl.js +1 -0
- package/dist/_astro/SlideOverDrawer.CpQu7VMQ.js +1 -0
- package/dist/_astro/SpaceSwitcher.DQOG363O.js +7 -0
- package/dist/_astro/{TasksBoard.D0HwS5hd.js → TasksBoard.rwdPWLAh.js} +1 -1
- package/dist/_astro/{TemplatesLibrary.CVv5Ef30.js → TemplatesLibrary.CEVQPDDz.js} +1 -1
- package/dist/_astro/{TestStatsBoard._qNcNorG.js → TestStatsBoard.CO4JMh4N.js} +1 -1
- package/dist/_astro/{TodosBoard.CF5wbJy7.js → TodosBoard.CrZMl6Ei.js} +1 -1
- package/dist/_astro/UiAutoBoard.BRMCH1zB.js +9 -0
- package/dist/_astro/{app-config.CF1xVPmo.js → app-config.DAIyT--R.js} +1 -1
- package/dist/_astro/app-version.BPkgRlbu.js +1 -0
- package/dist/_astro/bash-tools.D4DBYc9k.js +27 -0
- package/dist/_astro/case-fields.Dqkws1iX.js +1 -0
- package/dist/_astro/case-gen-run.Byxy6M5X.js +22 -0
- package/dist/_astro/case-review.DlCarphW.js +3 -0
- package/dist/_astro/{case-types.DS1EQ5yP.js → case-types.B6MLX3iE.js} +1 -1
- package/dist/_astro/{hydrate-cache.CmC22o_H.js → hydrate-cache.C0F0L04c.js} +1 -1
- package/dist/_astro/i18n.ele1lM9e.js +7 -0
- package/dist/_astro/{llm.BuR7z55C.js → llm.DyweO-KK.js} +1 -1
- package/dist/_astro/open-docs-in-session.D608wzlx.js +1 -0
- package/dist/_astro/{plugins.CVM1IaoC.js → plugins.Di6uuouN.js} +1 -1
- package/dist/_astro/req-analysis.CIZ_cIJQ.js +23 -0
- package/dist/_astro/settings.DbhUT6Ao.js +2 -0
- package/dist/_astro/{spaces-client.DnS6MgGy.js → spaces-client.OuJPy3GP.js} +1 -1
- package/dist/_astro/{story-review.BbdIf5zg.js → story-review.BvgXBApZ.js} +6 -3
- package/dist/_astro/{view-prefs.D1snIG5o.js → view-prefs.DkS1ldnh.js} +1 -1
- package/dist/case-exec/index.html +5 -5
- package/dist/cases/generate/index.html +5 -5
- package/dist/cases/library/index.html +5 -5
- package/dist/dashboard/index.html +5 -5
- package/dist/docs/changelog/index.html +52 -5
- package/dist/docs/install/index.html +48 -4
- package/dist/docs/manual/index.html +40 -33
- package/dist/knowledge/index.html +5 -5
- package/dist/plugins/index.html +5 -5
- package/dist/pm/bugs/index.html +5 -5
- package/dist/pm/iterations/index.html +5 -5
- package/dist/pm/projects/detail/index.html +5 -5
- package/dist/pm/projects/index.html +5 -5
- package/dist/pm/requirements/index.html +5 -5
- package/dist/prompts/index.html +5 -5
- package/dist/reports/index.html +5 -5
- package/dist/requirement-analysis/index.html +5 -5
- package/dist/requirements/index.html +5 -5
- package/dist/tasks/index.html +5 -5
- package/dist/templates/index.html +5 -5
- package/dist/test-automation/index.html +5 -5
- package/dist/test-stats/index.html +5 -5
- package/dist/todos/index.html +5 -5
- package/dist/workbench/index.html +5 -5
- package/docs//344/274/232/350/257/235/346/217/222/344/273/266.md +9 -7
- package/docs//345/205/250/345/261/200/346/217/222/344/273/266.md +14 -2
- package/docs//345/256/211/350/243/205/346/211/213/345/206/214.md +23 -0
- package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +35 -27
- package/lh-plugins/case-review-prompt.mjs +12 -106
- package/lh-plugins/lh-case-review.mjs +118 -34
- package/lh-plugins/lh-mcp.mjs +79 -0
- package/lh-plugins/lh-reports.mjs +11 -29
- package/lh-plugins/lh-req-analysis.mjs +59 -6
- package/lh-plugins/req-analysis-prompt.mjs +34 -44
- package/lh-plugins/story-review-prompt.mjs +8 -52
- package/lh-plugins/uiauto-prompt.mjs +9 -65
- package/package.json +3 -1
- package/dist/_astro/Base.GThhapKd.css +0 -1
- package/dist/_astro/CasesLibrary.CDjuLV_E.js +0 -21
- package/dist/_astro/ChatApp.Td2xCiQG.js +0 -216
- package/dist/_astro/ConfirmDialog.CsMwWevK.js +0 -1
- package/dist/_astro/DocsPager.B9VhI6E3.js +0 -1
- package/dist/_astro/NamePromptDialog.CS1pTTVl.js +0 -1
- package/dist/_astro/PluginsPage.DMDyUktn.js +0 -1
- package/dist/_astro/PmRequirementsBoard.B-AI9iZX.js +0 -1
- package/dist/_astro/ReqAnalysisBoard.CazI9SU-.js +0 -29
- package/dist/_astro/SearchableSelect.Cbb8jMnP.js +0 -1
- package/dist/_astro/SettingsDialog.Bs1I8b27.js +0 -1
- package/dist/_astro/SlideOverDrawer.DMWJPD_W.js +0 -1
- package/dist/_astro/SpaceSwitcher.Dw9LjKiJ.js +0 -7
- package/dist/_astro/UiAutoBoard.B-7mL3ez.js +0 -9
- package/dist/_astro/app-version.yT2l6J8H.js +0 -1
- package/dist/_astro/bash-tools.CPS0ZiKi.js +0 -25
- package/dist/_astro/case-fields.h0roo2br.js +0 -1
- package/dist/_astro/case-gen-run.D8DGX0mr.js +0 -19
- package/dist/_astro/case-review.C1hQRbQ2.js +0 -3
- package/dist/_astro/i18n.CjqQGCAI.js +0 -7
- package/dist/_astro/open-docs-in-session.Cj0J2-XT.js +0 -1
- package/dist/_astro/req-analysis.dhgy4p2f.js +0 -14
- package/dist/_astro/settings.B1yetppp.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{p as n}from"./app-config.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{p as n}from"./app-config.DAIyT--R.js";import{n as r,o as i,r as a,s as o}from"./view-prefs.DkS1ldnh.js";import{t as s}from"./jsx-runtime.DUg_B_vD.js";import{d as c,t as l,u}from"./ColumnResize.BgYkV9Iy.js";import{n as d,t as f}from"./DocsPager.D55FTK9d.js";import{t as p}from"./OverflowHint.pvo2Xc8R.js";import{t as m}from"./SelectDropdown.apWlFGbA.js";import{n as h,t as g}from"./docs-format.BlGh-XA_.js";import{t as _}from"./useListAnim.BoerpmsB.js";var v=`tw.docs.files.v1.`;function y(e){try{let t=sessionStorage.getItem(n(v+e));if(!t)return null;let r=JSON.parse(t);return Array.isArray(r)?r:null}catch{return null}}function b(e,t){try{sessionStorage.setItem(n(v+e),JSON.stringify(t))}catch{}}var x=e(t(),1),S=s(),ee=[{value:`mtime`,label:`按修改时间`},{value:`name`,label:`按文件名`}],C=ee.map(e=>e.value),te=`h-8 px-3 text-sm border border-stone-300 rounded-lg bg-white text-stone-800 focus:outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6]`,ne=`transition-colors duration-150 hover:bg-stone-50 hover:shadow-[inset_3px_0_0_0_var(--tw-accent)] cursor-pointer`,w=`w-38 shrink-0`,T=`w-16 shrink-0 text-left`,re=176,ie=96,ae=24,E=160,D=32,oe=8,O=168,k=`shrink-0 justify-center text-center`,A=`text-sm text-stone-400 py-12 text-center`;function j(e,t,n){let[s,c]=(0,x.useState)(()=>n?a(`docs.${n}.search`):``),[l,u]=(0,x.useState)(()=>n?r(`docs.${n}.sort`,C,`mtime`):`mtime`),[f,p]=(0,x.useState)(1),[m,h]=d(t),g=(0,x.useMemo)(()=>{let t=s.trim().toLowerCase(),n=[...t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e];return l===`name`?n.sort((e,t)=>e.name.localeCompare(t.name,`zh`)):n.sort((e,t)=>(t.mtime??0)-(e.mtime??0)),n},[e,s,l]),_=Math.max(1,Math.ceil(g.length/m)),v=Math.min(f,_);return{query:s,setQuery:e=>{c(e),n&&o(`docs.${n}.search`,e),p(1)},sortBy:l,setSortBy:e=>{u(e),n&&i(`docs.${n}.sort`,e),p(1)},page:v,setPage:p,pageSize:m,setPageSize:e=>{h(e),p(1)},filtered:g,totalPages:_,pageFiles:(0,x.useMemo)(()=>g.slice((v-1)*m,v*m),[g,v,m])}}function M({files:e,filtered:t,pageFiles:n,query:r,onQuery:i,sortBy:a,onSortBy:o,page:s,totalPages:d,pageSize:v,onPage:y,onPageSize:b,busy:C=!1,emptyText:j,searchPlaceholder:M,selectAllLabel:se=`全选本页`,renderBadge:N,renderNameAction:P,renderActions:F,resizeKey:I=`docs:list:cols:v1`,extraColumn:L,onRowDoubleClick:R,selectable:ce,selected:z,onToggleRow:le,onSelectPage:ue}){let B=ce??(()=>!0),V=n.filter(B),H=V.length>0&&V.every(e=>z[e.path]),de=!H&&V.some(e=>z[e.path]),{cls:fe,play:U}=_(),pe=e=>{U(),i(e)},me=e=>{U(),o(e)},he=e=>{U(),y(e)},ge=e=>{U(),b(e)},[W,_e]=(0,x.useState)(re),G=(0,x.useMemo)(()=>[{key:`check`},{key:`name`,min:E},...L?[{key:`extra`,width:O,min:120}]:[],{key:`ctime`,width:152,min:96},{key:`mtime`,width:152,min:96},{key:`size`,width:64,min:48},{key:`actions`}],[L]),K=u(I,G),ve=c(I),q=K.styleOf(`name`)?.width,J=!!q,Y=q?{width:q,flex:`0 0 auto`,minWidth:E}:{minWidth:E},X=G.reduce((e,t)=>t.key===`check`?e+D+oe:t.key===`actions`?e+W:t.key===`name`?e+(q??E):e+(K.styleOf(t.key)?.width??t.width??0),0)+(G.length-1)*8,Z=J?`shrink-0 min-w-0`:`flex-1 min-w-0`,Q=`tw-sticky-l`,ye=`tw-sticky-r`,be={"--tw-sticky-left":`0px`},xe=J?{width:40+Number(q),...be}:{minWidth:200,...be},Se={width:K.styleOf(`extra`)?.width??O,flex:`0 0 auto`,...K.styleOf(`extra`)},Ce=(0,x.useRef)(null),$=n[0]??t[0]??e[0],we=$&&e.length>0?F($):null;return(0,x.useLayoutEffect)(()=>{let e=Ce.current;if(!e)return;let t=()=>{let t=Math.max(ie,Math.ceil(e.getBoundingClientRect().width)+ae);_e(e=>Math.abs(e-t)>1?t:e)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[$?.path]),(0,S.jsxs)(S.Fragment,{children:[e.length>0?(0,S.jsxs)(`div`,{className:`shrink-0 px-4 py-2 border-b border-stone-100 bg-stone-50/60 flex items-center gap-2 flex-wrap`,children:[(0,S.jsx)(`input`,{type:`search`,value:r,onChange:e=>pe(e.target.value),placeholder:M,"aria-label":M,className:`${te} flex-1 min-w-48`}),(0,S.jsx)(m,{compact:!0,options:ee,value:a,onChange:me,ariaLabel:`排序方式`,showCheck:!1,className:`w-34 shrink-0`})]}):null,(0,S.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-4`,children:(0,S.jsx)(`div`,{ref:ve,className:`tw-scroll-x min-h-0 flex-1 overflow-auto rounded-lg border border-stone-200`,children:e.length===0?(0,S.jsx)(`p`,{className:A,children:j}):t.length===0?(0,S.jsxs)(`p`,{className:A,children:[`没有匹配「`,r.trim(),`」的文件。`]}):(0,S.jsxs)(`ul`,{className:`${fe}tw-sticky-list divide-y divide-stone-100`,style:X?{minWidth:X}:void 0,children:[(0,S.jsxs)(`li`,{className:`flex items-stretch gap-2 bg-stone-50 text-xs text-stone-500`,children:[(0,S.jsxs)(`div`,{className:`${Q} flex min-w-0 items-stretch gap-2 ${J?`shrink-0`:`flex-1`}`,style:xe,children:[(0,S.jsx)(`span`,{className:`flex shrink-0 items-center justify-center`,style:{width:D},children:(0,S.jsx)(`input`,{type:`checkbox`,checked:H,ref:e=>{e&&(e.indeterminate=de)},onChange:()=>ue(V.map(e=>e.path),!H),disabled:C||V.length===0,className:`rounded border-stone-300`,"aria-label":se})}),(0,S.jsxs)(`span`,{className:`relative flex min-w-0 items-center py-2 ${Z}`,style:Y,"data-col":`name`,children:[`文件名`,(0,S.jsx)(l,{...K.resizeProps(`name`)})]})]}),L?(0,S.jsxs)(`span`,{className:`relative flex shrink-0 items-center py-2`,style:Se,"data-col":`extra`,children:[L.header,(0,S.jsx)(l,{...K.resizeProps(`extra`)})]}):null,(0,S.jsxs)(`span`,{className:`relative flex items-center py-2 ${w}`,style:K.styleOf(`ctime`),"data-col":`ctime`,children:[`创建时间`,(0,S.jsx)(l,{...K.resizeProps(`ctime`)})]}),(0,S.jsxs)(`span`,{className:`relative flex items-center py-2 ${w}`,style:K.styleOf(`mtime`),"data-col":`mtime`,children:[`修改时间`,(0,S.jsx)(l,{...K.resizeProps(`mtime`)})]}),(0,S.jsxs)(`span`,{className:`relative flex items-center py-2 ${T}`,style:K.styleOf(`size`),"data-col":`size`,children:[`大小`,(0,S.jsx)(l,{...K.resizeProps(`size`)})]}),(0,S.jsx)(`span`,{className:`flex-1`,"aria-hidden":!0}),(0,S.jsx)(`span`,{className:`flex items-center py-2 ${ye} ${k} px-3`,style:{width:W,flex:`0 0 auto`},children:`操作`})]}),n.map(e=>{let t=B(e);return(0,S.jsxs)(`li`,{className:`group flex items-stretch gap-2 ${ne}`,onDoubleClick:R?()=>R(e):void 0,children:[(0,S.jsxs)(`div`,{className:`${Q} flex min-w-0 items-center gap-2 py-2.5 ${J?`shrink-0`:`flex-1`}`,style:xe,children:[(0,S.jsx)(`span`,{className:`flex shrink-0 items-center justify-center`,style:{width:D},children:(0,S.jsx)(`input`,{type:`checkbox`,checked:!!z[e.path],disabled:C||!t,onChange:()=>le(e.path),onDoubleClick:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),className:`rounded border-stone-300`,"aria-label":`选择 ${e.name}`})}),(0,S.jsxs)(`div`,{className:`${Z} text-left flex items-center gap-2`,style:Y,children:[(0,S.jsx)(p,{text:e.name,className:`text-sm text-stone-800 truncate`}),N?N(e):null,P?(0,S.jsx)(`span`,{className:`ml-0.5 mr-2 flex shrink-0 items-center gap-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100`,onDoubleClick:e=>e.stopPropagation(),children:P(e)}):null]})]}),L?(0,S.jsx)(`div`,{className:`flex min-w-0 items-center overflow-hidden py-2.5`,style:Se,children:L.render(e)}):null,(0,S.jsx)(`span`,{className:`${w} flex items-center py-2.5 text-[11px] text-stone-500 tabular-nums`,style:K.styleOf(`ctime`),children:h(e.ctime??e.mtime)}),(0,S.jsx)(`span`,{className:`${w} flex items-center py-2.5 text-[11px] text-stone-500 tabular-nums`,style:K.styleOf(`mtime`),children:h(e.mtime)}),(0,S.jsx)(`span`,{className:`${T} flex items-center py-2.5 text-[11px] text-stone-400`,style:K.styleOf(`size`),children:g(e.size)}),(0,S.jsx)(`span`,{className:`flex-1`,"aria-hidden":!0}),(0,S.jsx)(`div`,{className:`${ye} ${k} flex flex-nowrap items-center justify-center gap-1 px-3 py-2.5`,style:{width:W,flex:`0 0 auto`},onDoubleClick:e=>e.stopPropagation(),children:F(e)})]},e.path)})]})})}),we?(0,S.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none invisible fixed top-0 left-0 -z-10 flex w-max flex-nowrap items-center gap-1 text-xs`,children:(0,S.jsx)(`div`,{ref:Ce,className:`flex w-max flex-nowrap items-center gap-1`,children:we})}):null,e.length>0?(0,S.jsx)(f,{page:s,totalPages:d,pageSize:v,busy:C,onPage:he,onPageSize:ge}):null]})}export{b as i,j as n,y as r,M as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{p as n}from"./app-config.DAIyT--R.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";import{t as i}from"./SelectDropdown.apWlFGbA.js";var a=e(t(),1),o=[5,10,20,50],s=`tw.docs.page-size.v1`;function c(e){return typeof e==`number`&&o.includes(e)}function l(e,t=s){try{let r=localStorage.getItem(n(t)),i=r===null?NaN:Number(r);return c(i)?i:e}catch{return e}}function u(e,t=s){if(c(e))try{localStorage.setItem(n(t),String(e))}catch{}}var d=r(),f=`h-8 px-3 shrink-0 whitespace-nowrap text-sm text-stone-600 border border-stone-200 rounded-lg hover:bg-stone-50 disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer`,p=o.map(e=>({value:String(e),label:String(e)}));function m(e,t){let[n,r]=(0,a.useState)(()=>l(e,t));return[n,(0,a.useCallback)(e=>{c(e)&&(u(e,t),r(e))},[t])]}function h({page:e,totalPages:t,pageSize:n,busy:r=!1,onPage:a,onPageSize:o,className:s=``}){return(0,d.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-t border-stone-100 flex items-center justify-between gap-2 flex-wrap ${s}`.trim(),children:[(0,d.jsxs)(`span`,{className:`text-xs text-stone-500 flex items-center gap-1.5`,children:[(0,d.jsxs)(`span`,{children:[`第 `,e,` / `,t,` 页 ·`]}),(0,d.jsx)(i,{compact:!0,centerContent:!0,options:p,value:String(n),onChange:e=>o(Number(e)),disabled:r,ariaLabel:`每页条数`,showCheck:!1,className:`w-18`}),(0,d.jsx)(`span`,{children:`条`})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,d.jsx)(`button`,{type:`button`,disabled:r||e<=1,onClick:()=>a(1),className:f,children:`首页`}),(0,d.jsx)(`button`,{type:`button`,disabled:r||e<=1,onClick:()=>a(e-1),className:f,children:`上一页`}),(0,d.jsx)(`button`,{type:`button`,disabled:r||e>=t,onClick:()=>a(e+1),className:f,children:`下一页`}),(0,d.jsx)(`button`,{type:`button`,disabled:r||e>=t,onClick:()=>a(t),className:f,children:`末页`})]})]})}export{m as n,h as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.DAIyT--R.js";import{i as r,o as i,s as a}from"./plugins.Di6uuouN.js";import{t as o}from"./jsx-runtime.DUg_B_vD.js";import{t as s}from"./ConfirmDialog.D5qXeML0.js";import{showToast as c}from"./Toast.BO2NFckG.js";import{c as l,n as u,r as d,u as f}from"./project-docs.DAw9bzgk.js";import{n as p}from"./doc-roots.DAJP9Svr.js";import{i as m,n as h,r as g,t as _}from"./DocsFileBrowser.BdpWp8zQ.js";import{d as v,t as y}from"./open-docs-in-session.D608wzlx.js";var b=e(t(),1),x=o(),S=10;async function C(e=`.`){let{entries:t}=await l(`knowledge`,e),n=[];for(let e of t)e.type===`file`?e.name.endsWith(`.md`)&&n.push(e):n.push(...await C(e.path));return n}function w({staticCount:e=0,base:t}){let o=g(`knowledge`),[l,w]=(0,b.useState)(!1),[T,E]=(0,b.useState)(!0),[D,O]=(0,b.useState)(o?!0:null),[k,A]=(0,b.useState)(()=>o??[]),[j,M]=(0,b.useState)(null),[N,P]=(0,b.useState)(!1),[F,I]=(0,b.useState)({}),[L,R]=(0,b.useState)(null),z=h(k,S,`knowledge`),B=(0,b.useCallback)(async()=>{M(null);try{let e=await C(`.`);A(e),m(`knowledge`,e)}catch(e){M(e instanceof Error?e.message:String(e))}},[]);(0,b.useEffect)(()=>{let e=i(e=>E(!!e.knowledgeLib));return n().then(()=>{E(r(`knowledgeLib`)),w(!0)}),e},[]),(0,b.useEffect)(()=>{l&&T&&(async()=>{await d(`knowledge`)?(await v().catch(()=>null),await B(),O(!0)):O(!1)})()},[l,T,B]);let V=(0,b.useMemo)(()=>Object.keys(F).filter(e=>F[e]),[F]);function H(){r(`knowledgeGen`)?window.location.href=`${t}workbench/?plugin=knowledgeGen`:M(a(`knowledgeGen`))}async function U(e){P(!0),M(null);try{await f(`knowledge`,e.path)}catch(e){M(e instanceof Error?e.message:String(e))}finally{P(!1)}}async function W(e){P(!0),M(null);try{await y(`knowledge`,e)}catch(e){M(e instanceof Error?e.message:String(e)),P(!1)}}async function G(){let e=L;if(e){R(null),P(!0),M(null);try{if(e.kind===`one`)await u(`knowledge`,e.entry.path);else{for(let t of e.paths)await u(`knowledge`,t);I({})}await B(),c(e.kind===`one`?`已删除「${e.entry.name}」`:`已删除 ${e.paths.length} 个知识库文件`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);M(t),c(`删除失败:${t}`,`error`)}finally{P(!1)}}}let K=L?.kind===`one`?`删除「${L.entry.name}」?将从 ${p(`knowledge`)} 中移除。`:L?.kind===`batch`?`确认删除已选中的 ${L.paths.length} 个知识库文件?此操作不可恢复。`:``;return l?T?D===null?(0,x.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,x.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,x.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):D?(0,x.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,children:[(0,x.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,x.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0`,children:[z.query.trim()?(0,x.jsxs)(x.Fragment,{children:[`匹配 `,(0,x.jsx)(`span`,{className:`font-medium text-stone-800`,children:z.filtered.length}),` 个`,(0,x.jsxs)(`span`,{className:`text-stone-400`,children:[` · 共 `,k.length]})]}):(0,x.jsxs)(x.Fragment,{children:[`共 `,(0,x.jsx)(`span`,{className:`font-medium text-stone-800`,children:k.length}),` 个知识库文件`]}),V.length>0?(0,x.jsxs)(`span`,{className:`text-stone-400`,children:[` · 已选 `,V.length]}):null]}),(0,x.jsx)(`button`,{type:`button`,disabled:N||V.length===0,onClick:()=>R({kind:`batch`,paths:V}),className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-red-600 border border-red-200 rounded-lg hover:bg-red-50 disabled:opacity-40`,children:`批量删除`}),(0,x.jsx)(`button`,{type:`button`,disabled:N,onClick:H,className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40`,children:`生成知识库`})]}),j?(0,x.jsx)(`div`,{className:`shrink-0 mx-4 mt-3 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:j}):null,(0,x.jsx)(_,{resizeKey:`docs:knowledge:cols:v1`,files:k,filtered:z.filtered,pageFiles:z.pageFiles,query:z.query,onQuery:z.setQuery,sortBy:z.sortBy,onSortBy:z.setSortBy,page:z.page,totalPages:z.totalPages,pageSize:z.pageSize,onPage:z.setPage,onPageSize:z.setPageSize,busy:N,emptyText:`暂无知识库文件,点击「生成知识库」前往我的工作台。`,searchPlaceholder:`搜索文件名或路径…`,selected:F,onToggleRow:e=>I(t=>({...t,[e]:!t[e]})),onSelectPage:(e,t)=>I(n=>{let r={...n};for(let n of e)t?r[n]=!0:delete r[n];return r}),onRowDoubleClick:e=>void U(e),renderBadge:e=>{let t=e.path.includes(`/`)?e.path.split(`/`)[0]:``;return t?(0,x.jsx)(`span`,{className:`shrink-0 text-[10px] px-1.5 py-0.5 rounded bg-amber-50 text-amber-800 border border-amber-100`,children:t}):null},renderActions:e=>(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`button`,{type:`button`,disabled:N,onClick:()=>void W(e),className:`text-xs whitespace-nowrap text-white bg-[#4176e6] px-2 py-1 rounded hover:bg-[#3565c7] cursor-pointer disabled:opacity-40`,children:`在会话中打开`}),(0,x.jsx)(`button`,{type:`button`,disabled:N,onClick:()=>R({kind:`one`,entry:e}),className:`text-xs whitespace-nowrap text-red-600 hover:bg-red-50 px-2 py-1 rounded cursor-pointer disabled:opacity-40`,children:`删除`})]})}),(0,x.jsx)(s,{open:L!=null,title:L?.kind===`batch`?`批量删除`:`删除知识库文件`,message:K,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>R(null),onConfirm:()=>void G()})]}):(0,x.jsxs)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:[`知识库管理需要本地文档服务,当前未就绪`,e>0?`(构建期约有 ${e} 份文档可浏览)`:``,`。`]}):(0,x.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:a(`knowledgeLib`)}):(0,x.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,x.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,x.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{w as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{t as n}from"./jsx-runtime.DUg_B_vD.js";import{t as r}from"./OverflowHint.pvo2Xc8R.js";var i=e(t(),1),a=n();function o({options:e,values:t,onChange:n,placeholder:o=`选择…`,disabled:s=!1,chips:c=!1,searchable:l=!1,searchPlaceholder:u=`搜索…`}){let[d,f]=(0,i.useState)(!1),[p,m]=(0,i.useState)(``),h=(0,i.useRef)(null),g=(0,i.useRef)(null);(0,i.useEffect)(()=>{if(!d){m(``);return}function e(e){h.current?.contains(e.target)||f(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[d]),(0,i.useEffect)(()=>{if(!d||!l)return;let e=window.setTimeout(()=>g.current?.focus(),0);return()=>window.clearTimeout(e)},[d,l]);let _=(0,i.useMemo)(()=>e.filter(e=>t.includes(e.value)),[e,t]),v=_.map(e=>e.label),y=s||v.length===0?o:v.length<=2?v.join(`、`):`已选 ${v.length} 项`,b=(0,i.useMemo)(()=>{let t=p.trim().toLowerCase();return t?e.filter(e=>e.label.toLowerCase().includes(t)||e.value.toLowerCase().includes(t)):e},[e,p]);function x(e){t.includes(e)?n(t.filter(t=>t!==e)):n([...t,e])}function S(e,r){r.stopPropagation(),n(t.filter(t=>t!==e))}return(0,a.jsxs)(`div`,{className:`relative`,ref:h,children:[(0,a.jsx)(`button`,{type:`button`,disabled:s,onClick:()=>f(e=>!e),className:s?`w-full min-h-9 flex items-center justify-start gap-1 rounded-lg border border-stone-200 bg-stone-50 px-3 py-1.5 text-sm text-left text-stone-400 cursor-not-allowed`:`tw-field-trigger w-full min-h-9 flex items-center justify-start gap-1 rounded-lg border border-stone-200 bg-white px-3 py-1.5 text-sm text-left text-stone-800 outline-none hover:border-stone-300 focus:ring-2 focus:ring-[#4176e6]/30`,children:c&&!s?(0,a.jsx)(`span`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-1`,children:_.length===0?(0,a.jsx)(`span`,{className:`text-stone-400`,children:o}):_.map(e=>(0,a.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-0.5 rounded-md bg-stone-100 px-1.5 py-0.5 text-[11px] text-stone-700`,children:[(0,a.jsx)(r,{text:e.label,className:`min-w-0 max-w-[9rem] truncate`}),(0,a.jsx)(`span`,{role:`button`,tabIndex:-1,className:`shrink-0 rounded px-0.5 text-stone-400 hover:bg-stone-200 hover:text-stone-700`,onClick:t=>S(e.value,t),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),S(e.value,t))},children:`×`})]},e.value))}):(0,a.jsx)(r,{text:y,className:`min-w-0 flex-1 truncate ${s||v.length?``:`text-stone-400`}`})}),d?(0,a.jsxs)(`div`,{className:`tw-select-menu tw-dsh-scroll tw-popover-anim absolute z-80 mt-1 max-h-72 w-full overflow-auto rounded-lg p-1 shadow-lg ring-1 ring-stone-200`,children:[l?(0,a.jsx)(`div`,{className:`sticky top-0 z-10 bg-white p-1 pb-1.5`,children:(0,a.jsx)(`input`,{ref:g,type:`text`,value:p,onChange:e=>m(e.target.value),placeholder:u,className:`h-8 w-full rounded-md border border-stone-200 bg-stone-50 px-2 text-xs text-stone-700 outline-none focus:border-[#4176e6]/40 focus:bg-white`,onClick:e=>e.stopPropagation()})}):null,b.length===0?(0,a.jsx)(`div`,{className:`px-3 py-2 text-sm text-stone-400`,children:`暂无可选项`}):b.map(e=>{let n=t.includes(e.value);return(0,a.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-stone-700 hover:bg-stone-50`,children:[(0,a.jsx)(`input`,{type:`checkbox`,checked:n,onChange:()=>x(e.value),className:`rounded border-stone-300 text-[#4176e6] focus:ring-[#4176e6]/40`}),(0,a.jsx)(r,{text:e.label,className:`min-w-0 flex-1 truncate`})]},e.value)})]}):null]})}export{o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,n as r,r as i,t as a}from"./dialog.DZHZCe_T.js";import{t as o}from"./jsx-runtime.DUg_B_vD.js";var s=e(t(),1),c=o();function l({open:e,title:t=`新建文件夹`,label:o=`文件夹名称`,placeholder:l=`请输入名称`,initialValue:u=``,lockExtension:d=!1,confirmLabel:f=`创建`,cancelLabel:p=`取消`,error:m=``,onClose:h,onConfirm:g}){let[_,v]=(0,s.useState)(``),[y,b]=(0,s.useState)(``),x=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(e){let e=u,t=``;if(d){let n=u.lastIndexOf(`.`);n>0&&(e=u.slice(0,n),t=u.slice(n))}v(e),b(t);let n=window.setTimeout(()=>{x.current?.focus(),x.current?.select()},50);return()=>window.clearTimeout(n)}},[e,u,d]);function S(){let e=_.trim();e&&g(e+y)}return(0,c.jsxs)(i,{open:e,onClose:h,className:`relative z-110`,children:[(0,c.jsx)(a,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":`true`}),(0,c.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,c.jsxs)(n,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,c.jsx)(r,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:t}),(0,c.jsxs)(`label`,{className:`tw-confirm-msg mt-4 block text-xs font-medium text-stone-500`,children:[o,(0,c.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-0 rounded-lg border border-stone-200 focus-within:ring-2 focus-within:ring-[#4176e6]/30 focus-within:border-[#4176e6] transition-colors`,children:[(0,c.jsx)(`input`,{ref:x,value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),S())},placeholder:l,className:`flex-1 min-w-0 h-9 px-3 text-sm rounded-lg border-0 bg-transparent text-stone-800 outline-none`}),y?(0,c.jsx)(`span`,{className:`shrink-0 pr-3 text-sm text-stone-400 select-none`,children:y}):null]}),m?(0,c.jsx)(`span`,{className:`mt-1.5 block text-[11px] font-normal leading-relaxed text-red-600`,children:m}):null]}),(0,c.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,c.jsx)(`button`,{type:`button`,onClick:h,className:`tw-confirm-cancel h-8 px-3 text-sm rounded-lg text-stone-600 hover:bg-stone-100 transition-colors`,children:p}),(0,c.jsx)(`button`,{type:`button`,disabled:!_.trim(),onClick:S,className:`h-8 px-4 text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 transition-colors`,children:f})]})]})})]})}export{l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{A as n,C as r,D as i,F as a,I as o,L as s,M as c,N as l,O as u,P as d,R as f,S as p,T as m,_ as h,a as g,b as _,g as v,h as y,i as b,j as x,k as S,m as C,p as w,r as T,t as E,u as D,v as ee,w as te,x as ne,y as re}from"./app-config.CF1xVPmo.js";import{a as O,i as k,o as ie}from"./plugins.CVM1IaoC.js";import{t as A}from"./react-dom.DLW9pGCF.js";import{i as j,n as M,r as N,t as P}from"./dialog.DZHZCe_T.js";import{t as F}from"./jsx-runtime.DUg_B_vD.js";import{t as ae}from"./ConfirmDialog.CsMwWevK.js";import{showToast as I}from"./Toast.BO2NFckG.js";import{n as L}from"./i18n.CjqQGCAI.js";import{n as oe}from"./hydrate-cache.CmC22o_H.js";var R=e(t(),1),z=e(A(),1),B=`/__tb_nav/groups`;function se(){return T().navGroups}function ce(){return u(T().navIcons)}function le(e,t){let n={...ce(),[e]:t};return D({navIcons:n}),E(),n}function ue(){return T().navOrder}function de(e,t){let n=i(e),r=S(t,n);return D({navGroups:n,navOrder:r}),E(),{groups:n,order:r}}function V(e,t){return JSON.stringify(e)===JSON.stringify(t)}async function fe(e){if(!g())return null;try{let t=await fetch(B,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({groups:e}),signal:AbortSignal.timeout(4e3)});if(!t.ok)return null;let n=await t.json();return{groups:i(n.groups,!1),warnings:Array.isArray(n.warnings)?n.warnings.filter(e=>typeof e==`string`):[]}}catch{return null}}async function pe(){if(!g())return;let e=T(),t=null;try{let e=await fetch(B,{signal:AbortSignal.timeout(4e3)});e.ok&&(t=await e.json())}catch{return}if(!t)return;if(t.scanned){let n=i(t.groups,!1),r=S(e.navOrder,n);(!V(n,e.navGroups)||!V(r,e.navOrder))&&(D({navGroups:n,navOrder:r}),E());return}if(!e.navGroups.length)return;let n=await fe(e.navGroups);n&&!V(n.groups,e.navGroups)&&(D({navGroups:n.groups,navOrder:S(e.navOrder,n.groups)}),E())}function H(e,t,n){let[r,i]=(0,R.useState)(null),a=(0,R.useRef)(null),o=(0,R.useRef)(e);o.current=e;let c=(0,R.useRef)(t);c.current=t;let l=(0,R.useRef)(n);l.current=n;function u(e,t){if(t.button!==0)return;t.preventDefault(),t.stopPropagation();let n=a.current;if(!n)return;i(e);let r=e=>{let t=[...n.querySelectorAll(`[data-sort-key]`)];for(let n of t){let t=n.getBoundingClientRect();if(e>=t.top&&e<=t.bottom)return n.dataset.sortKey}return null},u=t=>{let n=r(t.clientY);if(!n||n===e)return;let i=s(o.current,e,n);i.join(`|`)!==o.current.join(`|`)&&(o.current=i,c.current(i))},d=()=>{window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d),i(null),l.current?.()};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)}return{listRef:a,dragId:r,onPointerDown:u}}var U=F(),W=`/`;function me(e){return`${W.endsWith(`/`)?W:`${W}/`}${e.replace(/^\//,``)}`}function G(e,t){let n=W.replace(/\/$/,``),r=e.slice(n.length).replace(/^\/+/,``);return r===t||r.startsWith(`${t}/`)}function K(e){return[`tw-nav-item`,e?`is-active font-medium`:``].filter(Boolean).join(` `)}function he(e){return w(`tw.nav.groupOpen.${e}`)}function ge(){return w(`tw.nav.docsOpen`)}function _e(e,t){try{let t=localStorage.getItem(he(e));if(t===`1`)return!0;if(t===`0`)return!1;if(e===`docs`){let e=localStorage.getItem(ge());if(e===`1`)return!0;if(e===`0`)return!1}}catch{}return t}function q(e,t){try{localStorage.setItem(he(e),t?`1`:`0`),e===`docs`&&localStorage.setItem(ge(),t?`1`:`0`)}catch{}}function J(e){return e.id===`docs`&&(e.name===`文档库`||e.name===`Documents`)?L(`nav.docs`):e.name.replace(/ \(\d+\)$/,``).replace(/ \(分组\)$/,``).trim()||e.name}function ve(e){return e.type===`group`?J(e.group):L(_(e.id).i18n)}function Y(e){return e.type===`item`?te(e.id):ne(e.group.id)}function ye(){let[e,t]=(0,R.useState)(()=>window.location.pathname);return(0,R.useEffect)(()=>{let e=()=>t(window.location.pathname);return document.addEventListener(`astro:page-load`,e),document.addEventListener(`astro:after-swap`,e),window.addEventListener(`popstate`,e),()=>{document.removeEventListener(`astro:page-load`,e),document.removeEventListener(`astro:after-swap`,e),window.removeEventListener(`popstate`,e)}},[]),e}function X({children:e}){return(0,U.jsx)(`svg`,{className:`tw-nav-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:e})}function Z({id:e,icon:t}){return(0,U.jsx)(X,{children:Q[t??C[e]]})}var Q={dashboard:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`14`,y:`14`,width:`7`,height:`7`,rx:`1.5`})]}),check:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M9 11l3 3L22 4`}),(0,U.jsx)(`path`,{d:`M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11`})]}),pencil:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 20h9`}),(0,U.jsx)(`path`,{d:`M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z`})]}),book:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M4 19.5A2.5 2.5 0 0 1 6.5 17H20`}),(0,U.jsx)(`path`,{d:`M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z`})]}),fileText:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M14 3v5h5`}),(0,U.jsx)(`path`,{d:`M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z`}),(0,U.jsx)(`path`,{d:`M8 13h8`}),(0,U.jsx)(`path`,{d:`M8 17h6`})]}),layers:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 3 3 8l9 5 9-5-9-5z`}),(0,U.jsx)(`path`,{d:`m3 13 9 5 9-5`})]}),list:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M8 6h13`}),(0,U.jsx)(`path`,{d:`M8 12h13`}),(0,U.jsx)(`path`,{d:`M8 18h13`}),(0,U.jsx)(`path`,{d:`M3 6h.01`}),(0,U.jsx)(`path`,{d:`M3 12h.01`}),(0,U.jsx)(`path`,{d:`M3 18h.01`})]}),folder:(0,U.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`}),star:(0,U.jsx)(`path`,{d:`m12 3 2.1 5.9L20 11l-5 4.3 1.7 6.2-5.7-3.9-5.7 3.9L7 15.3 2 11l5.9-2.1L12 3z`}),database:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`ellipse`,{cx:`12`,cy:`6`,rx:`8`,ry:`3`}),(0,U.jsx)(`path`,{d:`M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6`}),(0,U.jsx)(`path`,{d:`M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]}),target:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`})]}),code:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`m8 8-4 4 4 4`}),(0,U.jsx)(`path`,{d:`m16 8 4 4-4 4`})]}),flask:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M9 3h6`}),(0,U.jsx)(`path`,{d:`M10 3v6l-5 8a2 2 0 0 0 1.7 3h10.6a2 2 0 0 0 1.7-3l-5-8V3`}),(0,U.jsx)(`path`,{d:`M7.5 14h9`})]}),home:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M3 10.5 12 3l9 7.5`}),(0,U.jsx)(`path`,{d:`M5 9.5V20h14V9.5`})]}),clipboard:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M9 4h6v3H9z`}),(0,U.jsx)(`path`,{d:`M8 4H6a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-2`})]}),bug:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`14`,r:`5`}),(0,U.jsx)(`path`,{d:`M9 6l2 2`}),(0,U.jsx)(`path`,{d:`M15 6l-2 2`}),(0,U.jsx)(`path`,{d:`M7 11H4`}),(0,U.jsx)(`path`,{d:`M20 11h-3`}),(0,U.jsx)(`path`,{d:`M7 17H4`}),(0,U.jsx)(`path`,{d:`M20 17h-3`})]}),calendar:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`5`,width:`18`,height:`16`,rx:`2`}),(0,U.jsx)(`path`,{d:`M8 3v4`}),(0,U.jsx)(`path`,{d:`M16 3v4`}),(0,U.jsx)(`path`,{d:`M3 10h18`})]}),chart:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M4 20V10`}),(0,U.jsx)(`path`,{d:`M10 20V4`}),(0,U.jsx)(`path`,{d:`M16 20v-7`}),(0,U.jsx)(`path`,{d:`M2 20h20`})]}),globe:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,U.jsx)(`path`,{d:`M3 12h18`}),(0,U.jsx)(`path`,{d:`M12 3c2.5 2.5 4 5.7 4 9s-1.5 6.5-4 9c-2.5-2.5-4-5.7-4-9s1.5-6.5 4-9z`})]}),link:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M10 13a4 4 0 0 0 5.7 0l2.3-2.3a4 4 0 0 0-5.7-5.7L11 6.3`}),(0,U.jsx)(`path`,{d:`M14 11a4 4 0 0 0-5.7 0L6 13.3a4 4 0 0 0 5.7 5.7L13 17.7`})]}),users:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`9`,cy:`8`,r:`3.5`}),(0,U.jsx)(`path`,{d:`M2.5 20a6.5 6.5 0 0 1 13 0`}),(0,U.jsx)(`path`,{d:`M16 5.5a3.5 3.5 0 0 1 0 7`}),(0,U.jsx)(`path`,{d:`M18 20a6 6 0 0 0-2-4.5`})]}),terminal:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`m5 8 4 4-4 4`}),(0,U.jsx)(`path`,{d:`M13 16h6`})]}),tag:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0l-7.2-7.2a2 2 0 0 1-.6-1.4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 1.4.6l6.2 6.2a2 2 0 0 1 0 2.6z`}),(0,U.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.2`})]}),flag:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M5 21V4`}),(0,U.jsx)(`path`,{d:`M5 5h11l-2 4 2 4H5z`})]}),zap:(0,U.jsx)(`path`,{d:`M13 2 4 14h6l-1 8 9-12h-6l1-8z`}),search:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,U.jsx)(`path`,{d:`m20 20-3.5-3.5`})]}),settings:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,U.jsx)(`path`,{d:`M19.4 15a1.7 1.7 0 0 0 .3 1.9l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-2.1-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.9.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.9 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.9l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.9.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.9-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.9V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z`})]}),bell:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M18 8a6 6 0 1 0-12 0c0 5-2 6-2 6h16s-2-1-2-6`}),(0,U.jsx)(`path`,{d:`M10.3 20a2 2 0 0 0 3.4 0`})]}),clock:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,U.jsx)(`path`,{d:`M12 7v5l3.5 2`})]}),mail:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`}),(0,U.jsx)(`path`,{d:`m3.5 7 8.5 6 8.5-6`})]}),message:(0,U.jsx)(`path`,{d:`M21 12a8 8 0 0 1-8 8H8l-5 3 1.4-4.6A8 8 0 1 1 21 12z`}),image:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`16`,rx:`2`}),(0,U.jsx)(`circle`,{cx:`8.5`,cy:`9.5`,r:`1.5`}),(0,U.jsx)(`path`,{d:`m4 17 5-5 3.5 3.5L16 11l4 4.5`})]}),video:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`6`,width:`12`,height:`12`,rx:`2`}),(0,U.jsx)(`path`,{d:`m15 11 6-3.5v9L15 13`})]}),download:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 3v12`}),(0,U.jsx)(`path`,{d:`m7 10 5 5 5-5`}),(0,U.jsx)(`path`,{d:`M4 20h16`})]}),upload:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 16V4`}),(0,U.jsx)(`path`,{d:`m7 9 5-5 5 5`}),(0,U.jsx)(`path`,{d:`M4 20h16`})]}),plus:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 5v14`}),(0,U.jsx)(`path`,{d:`M5 12h14`})]}),trash:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M4 7h16`}),(0,U.jsx)(`path`,{d:`M9 7V4h6v3`}),(0,U.jsx)(`path`,{d:`M6 7l1 13h10l1-13`}),(0,U.jsx)(`path`,{d:`M10 11v6M14 11v6`})]}),lock:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`4`,y:`10`,width:`16`,height:`11`,rx:`2`}),(0,U.jsx)(`path`,{d:`M8 10V7a4 4 0 0 1 8 0v3`})]}),shield:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 3l7 3v6c0 4.2-2.9 7.5-7 9-4.1-1.5-7-4.8-7-9V6l7-3z`}),(0,U.jsx)(`path`,{d:`m9 12 2 2 4-4`})]}),key:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`8`,cy:`12`,r:`4`}),(0,U.jsx)(`path`,{d:`M12 12h9`}),(0,U.jsx)(`path`,{d:`M17 12v4M20 12v3`})]}),cloud:(0,U.jsx)(`path`,{d:`M7 18h10a4 4 0 0 0 .5-8 6 6 0 0 0-11.4 1.5A3.5 3.5 0 0 0 7 18z`}),box:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`m12 3 8 4.5v9L12 21l-8-4.5v-9L12 3z`}),(0,U.jsx)(`path`,{d:`m4 7.5 8 4.5 8-4.5`}),(0,U.jsx)(`path`,{d:`M12 12v9`})]}),filter:(0,U.jsx)(`path`,{d:`M3 5h18l-7 8v6l-4 2v-8L3 5z`}),grid:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`4`,y:`4`,width:`6.5`,height:`6.5`,rx:`1`}),(0,U.jsx)(`rect`,{x:`13.5`,y:`4`,width:`6.5`,height:`6.5`,rx:`1`}),(0,U.jsx)(`rect`,{x:`4`,y:`13.5`,width:`6.5`,height:`6.5`,rx:`1`}),(0,U.jsx)(`rect`,{x:`13.5`,y:`13.5`,width:`6.5`,height:`6.5`,rx:`1`})]}),pin:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 21v-7`}),(0,U.jsx)(`path`,{d:`M8 4h8l-1 6 3 3H6l3-3-1-6z`})]}),sparkle:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`m12 3 1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z`}),(0,U.jsx)(`path`,{d:`M18 16.5 18.7 18.3 20.5 19 18.7 19.7 18 21.5 17.3 19.7 15.5 19 17.3 18.3 18 16.5z`})]}),rocket:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M13.5 4.5c3-2 5.5-1.5 5.5-1.5s.5 2.5-1.5 5.5c-1.6 2.4-4.5 5-6.5 6.5l-3.5-3.5c1.5-2 4.1-4.9 6-7z`}),(0,U.jsx)(`path`,{d:`M8 12 5 13l-2 4 5-1`}),(0,U.jsx)(`path`,{d:`M12 16l-1 3 4-2 1-3`}),(0,U.jsx)(`circle`,{cx:`15`,cy:`9`,r:`1.2`})]}),eye:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M2.5 12S6 6 12 6s9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6z`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`2.8`})]}),bookmark:(0,U.jsx)(`path`,{d:`M7 3h10a1 1 0 0 1 1 1v17l-6-4-6 4V4a1 1 0 0 1 1-1z`}),archive:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`4`,rx:`1`}),(0,U.jsx)(`path`,{d:`M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8`}),(0,U.jsx)(`path`,{d:`M10 12h4`})]}),refresh:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M20 12a8 8 0 1 1-2.4-5.7`}),(0,U.jsx)(`path`,{d:`M20 4v5h-5`})]}),play:(0,U.jsx)(`path`,{d:`M8 5v14l11-7L8 5z`}),map:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`m3 6 6-2 6 2 6-2v14l-6 2-6-2-6 2V6z`}),(0,U.jsx)(`path`,{d:`M9 4v14M15 6v14`})]}),activity:(0,U.jsx)(`path`,{d:`M3 12h4l3-7 4 14 3-7h4`}),cpu:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`7`,y:`7`,width:`10`,height:`10`,rx:`2`}),(0,U.jsx)(`path`,{d:`M10 3v4M14 3v4M10 17v4M14 17v4M3 10h4M3 14h4M17 10h4M17 14h4`})]}),briefcase:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`8`,width:`18`,height:`12`,rx:`2`}),(0,U.jsx)(`path`,{d:`M9 8V5h6v3`}),(0,U.jsx)(`path`,{d:`M3 13h18`})]}),presentation:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,U.jsx)(`path`,{d:`M12 16v4`}),(0,U.jsx)(`path`,{d:`m8 22 4-4 4 4`}),(0,U.jsx)(`path`,{d:`M8 8h8M8 12h5`})]}),copy:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`8`,y:`8`,width:`12`,height:`12`,rx:`2`}),(0,U.jsx)(`path`,{d:`M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2`})]}),save:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z`}),(0,U.jsx)(`path`,{d:`M7 3v6h9`}),(0,U.jsx)(`path`,{d:`M8 21v-6h8v6`})]})};function be(){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`svg`,{className:`tw-nav-ico tw-nav-ico--closed`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`})}),(0,U.jsx)(`svg`,{className:`tw-nav-ico tw-nav-ico--open`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M6 14l1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`})})]})}function xe(){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:[(0,U.jsx)(`path`,{d:`M21 4H14`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M10 4H3`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M21 12H12`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M8 12H3`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M21 20H16`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M12 20H3`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M14 2v4`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M8 10v4`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M16 18v4`,strokeLinecap:`round`})]})}function Se(){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,U.jsx)(`path`,{d:`M12 8v8`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M8 12h8`,strokeLinecap:`round`})]})}function Ce(){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.7`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.7`}),(0,U.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.7`})]})}function we(){return(0,U.jsx)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,U.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`})})}function Te(){return(0,U.jsxs)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,U.jsx)(`path`,{d:`M9 6H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h4`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M16 8l4 4-4 4`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,U.jsx)(`path`,{d:`M20 12H9`,strokeLinecap:`round`})]})}function Ee(){return(0,U.jsxs)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,U.jsx)(`circle`,{cx:`8.5`,cy:`8.5`,r:`4.5`}),(0,U.jsx)(`rect`,{x:`12`,y:`12`,width:`9`,height:`9`,rx:`2`})]})}function De(){return(0,U.jsxs)(X,{children:[(0,U.jsx)(`path`,{d:`M8 6v12`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M5 9l3-3 3 3`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,U.jsx)(`path`,{d:`M16 18V6`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M13 15l3 3 3-3`,strokeLinecap:`round`,strokeLinejoin:`round`})]})}function Oe(){return(0,U.jsxs)(`svg`,{className:`tw-nav-drag-grip`,viewBox:`0 0 20 20`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`7`,cy:`5`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`13`,cy:`5`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`7`,cy:`10`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`13`,cy:`10`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`7`,cy:`15`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`13`,cy:`15`,r:`1.25`,fill:`currentColor`})]})}function $(e,t){if(r(e))return!1;let n=_(e).plugin;return!n||t[n]!==!1}function ke({id:e,icon:t,pathname:n,actionOpen:r,onMenu:i}){let a=_(e),o=G(n,a.match);return(0,U.jsxs)(`div`,{className:[K(o),r?`is-action-open`:``].filter(Boolean).join(` `),"data-plugin-nav":a.plugin,children:[(0,U.jsxs)(`a`,{href:me(a.href),className:`tw-nav-item-main`,children:[(0,U.jsx)(Z,{id:e,icon:t}),(0,U.jsx)(`span`,{className:`tw-nav-label`,children:L(a.i18n)})]}),(0,U.jsx)(`button`,{type:`button`,className:`tw-nav-hover-btn`,"aria-label":L(`nav.more`),onClick:e=>{e.preventDefault(),e.stopPropagation(),i(e.currentTarget)},children:(0,U.jsx)(Ce,{})})]})}function Ae(e,t,n){return e.items.some(e=>{if(r(e))return!1;let t=_(e).plugin;return(!t||k(t))&&G(n,_(e).match)})?!0:m(t,e.id).some(e=>Ae(e,t,n))}function je(e,t){return e.items.some(e=>{if(r(e))return!1;let t=_(e).plugin;return!t||k(t)})?!0:m(t,e.id).some(e=>je(e,t))}function Me({group:e,groups:t,order:n,icons:i,pathname:a,openItem:o,openGroupId:s,onMenu:c,onItemMenu:l}){let u=e.items.filter(e=>{if(r(e))return!1;let t=_(e).plugin;return!t||k(t)}),f=d(t,e.id,n),p=Ae(e,t,a),[m,h]=(0,R.useState)(()=>_e(e.id,!0)),[g,v]=(0,R.useState)(!1),y=(0,R.useRef)(null),b=(0,R.useRef)(null),x=(0,R.useRef)(null);if((0,R.useEffect)(()=>S,[]),!je(e,t))return null;function S(){x.current&&y.current&&y.current.removeEventListener(`transitionend`,x.current),x.current=null,b.current!==null&&(window.clearTimeout(b.current),b.current=null)}function C(){S(),q(e.id,!0),v(!1),h(!0)}function w(t){if(t.preventDefault(),!m||g){C();return}v(!0),q(e.id,!1);let n=y.current,r=!1,i=()=>{r||(r=!0,S(),h(!1),v(!1))},a=e=>{e.target===n&&e.propertyName===`grid-template-rows`&&i()};S(),x.current=a,n?.addEventListener(`transitionend`,a),b.current=window.setTimeout(i,360)}return(0,U.jsxs)(`details`,{className:`tw-nav-details ${g?`is-closing`:``}`,open:m||g,"data-nav-group":e.id,children:[(0,U.jsxs)(`summary`,{className:[`tw-nav-item tw-nav-summary`,p?`is-branch-active`:``,s===e.id?`is-action-open`:``].filter(Boolean).join(` `),onClick:w,children:[(0,U.jsx)(be,{}),(0,U.jsx)(`span`,{className:`tw-nav-label min-w-0 flex-1 truncate`,children:J(e)}),(0,U.jsx)(`button`,{type:`button`,className:`tw-nav-hover-btn`,"aria-label":L(`nav.groupActions`),onClick:t=>{t.preventDefault(),t.stopPropagation(),c(e,t.currentTarget)},children:(0,U.jsx)(xe,{})}),(0,U.jsx)(`svg`,{className:`tw-nav-chevron opacity-70`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M7 5l6 5-6 5`,strokeLinecap:`round`,strokeLinejoin:`round`})})]}),(0,U.jsx)(`div`,{className:`tw-nav-subtree-anim`,ref:y,children:(0,U.jsxs)(`div`,{className:`tw-nav-subtree`,children:[u.map(e=>(0,U.jsx)(ke,{id:e,icon:i[e],pathname:a,actionOpen:o===e,onMenu:t=>l(e,t)},e)),f.map(e=>(0,U.jsx)(Me,{group:e,groups:t,order:n,icons:i,pathname:a,openItem:o,openGroupId:s,onMenu:c,onItemMenu:l},e.id))]})})]})}function Ne({open:e,draft:t,groups:n,plugins:r,icons:i,onClose:a,onSave:o,onDelete:s}){let[c,l]=(0,R.useState)(``),[u,d]=(0,R.useState)([]),[f,p]=(0,R.useState)(``),m=(0,R.useRef)(null),h=new Set(n.filter(e=>e.id!==t?.id).flatMap(e=>e.items)),g=y.filter(e=>$(e.id,r)&&(!h.has(e.id)||u.includes(e.id))),_=H(u,d);(0,R.useEffect)(()=>{if(!e||!t)return;l(t.name),d(t.items.filter(e=>$(e,r))),p(``);let n=window.setTimeout(()=>{m.current?.focus(),m.current?.select()},50);return()=>window.clearTimeout(n)},[e,t,r]);function v(e){d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function b(){let e=c.trim();if(!e){p(L(`nav.groupNameRequired`));return}if(!u.length){p(L(`nav.groupItemsRequired`));return}let n=(t?.items??[]).filter(e=>!$(e,r));o({id:t?.id,name:e,items:[...n,...u],parentId:t?.parentId})}let x=[...u.map(e=>g.find(t=>t.id===e)).filter(e=>!!e),...g.filter(e=>!u.includes(e.id))];return(0,U.jsxs)(N,{open:e,onClose:a,transition:!0,className:`relative z-110`,children:[(0,U.jsx)(P,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":!0}),(0,U.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,U.jsxs)(j,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,U.jsx)(M,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:t?.id?L(`nav.editGroupTitle`):t?.parentId?L(`nav.addSubgroup`):L(`nav.createGroup`)}),(0,U.jsxs)(`label`,{className:`tw-confirm-msg mt-4 block text-xs font-medium text-stone-500`,children:[L(`nav.groupName`),(0,U.jsx)(`input`,{ref:m,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),b())},className:`mt-1.5 w-full h-9 rounded-lg border border-stone-200 px-3 text-sm text-stone-800 outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6]`})]}),(0,U.jsxs)(`div`,{className:`mt-4`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:L(`nav.groupItems`)}),(0,U.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:L(`nav.groupItemsHint`)}),(0,U.jsxs)(`div`,{ref:_.listRef,className:`mt-2 max-h-52 overflow-auto rounded-lg border border-stone-200 p-1`,children:[x.map(e=>{let t=u.includes(e.id);return(0,U.jsxs)(`label`,{"data-sort-key":t?e.id:void 0,className:[`flex items-center gap-2 rounded-md px-3 py-2 text-sm text-stone-700 cursor-pointer hover:bg-stone-50`,t?`tw-nav-drag-row`:``,_.dragId===e.id?`is-dragging`:``].filter(Boolean).join(` `),onPointerDown:t?t=>{t.target.closest(`input`)||_.onPointerDown(e.id,t)}:void 0,children:[t?(0,U.jsx)(Oe,{}):(0,U.jsx)(`span`,{className:`tw-nav-drag-grip`}),(0,U.jsx)(`input`,{type:`checkbox`,checked:t,onChange:()=>v(e.id),className:`rounded border-stone-300 text-[#4176e6] focus:ring-[#4176e6]/40`}),(0,U.jsx)(`span`,{className:`tw-nav-editor-ico`,children:(0,U.jsx)(Z,{id:e.id,icon:i[e.id]})}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:L(e.i18n)})]},e.id)}),x.length?null:(0,U.jsx)(`div`,{className:`px-3 py-4 text-center text-[12px] text-stone-400`,children:L(`nav.noAddableItems`)})]})]}),f?(0,U.jsx)(`p`,{className:`mt-2 text-[12px] text-red-600`,children:f}):null,(0,U.jsxs)(`div`,{className:`mt-5 flex items-center gap-2`,children:[t?.id&&s?(0,U.jsx)(`button`,{type:`button`,onClick:s,className:`h-8 px-3 text-sm rounded-lg border border-red-200 text-red-600 hover:bg-red-50`,children:L(`nav.deleteGroup`)}):null,(0,U.jsx)(`div`,{className:`flex-1`}),(0,U.jsx)(`button`,{type:`button`,onClick:a,className:`tw-confirm-cancel h-8 px-3 text-sm rounded-lg border border-stone-200 text-stone-600 hover:bg-stone-100`,children:L(`nav.groupCancel`)}),(0,U.jsx)(`button`,{type:`button`,onClick:b,className:`h-8 px-3 text-sm rounded-lg text-white bg-[#4176e6] hover:bg-[#3566d0]`,children:L(`nav.groupSave`)})]})]})})]})}function Pe({ids:e,labelOf:t,onChange:n,onEnd:r,indent:i}){let a=H(e,n,r);return(0,U.jsx)(`div`,{ref:a.listRef,className:`flex flex-col`,children:e.map(e=>(0,U.jsxs)(`div`,{"data-sort-key":e,className:[`tw-nav-drag-row px-3 py-2 text-sm text-stone-700 hover:bg-stone-50`,i?`tw-nav-drag-row--nested`:``,a.dragId===e?`is-dragging`:``].filter(Boolean).join(` `),onPointerDown:t=>a.onPointerDown(e,t),children:[(0,U.jsx)(Oe,{}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t(e)})]},e))})}function Fe({open:e,focusGroupId:t,nodes:n,groups:r,order:i,visible:a,onClose:o,onCommit:s,onChildCommit:c}){let l=e=>!a||a(e),u=e=>e.items.some(l)||r.filter(t=>t.parentId===e.id).some(e=>u(e)),f=n.filter(e=>e.type===`item`?l(e.id):u(e.group)),[p,m]=(0,R.useState)(()=>f.map(Y)),[h,g]=(0,R.useState)(()=>Object.fromEntries(r.map(e=>[e.id,[...e.items]]))),[v,y]=(0,R.useState)([]),b=(0,R.useRef)(p);b.current=p;let x=(0,R.useRef)(h);x.current=h;let S=(0,R.useRef)(r);S.current=r;let C=(0,R.useRef)(i);C.current=i;let w=(0,R.useRef)(f);w.current=f;let T=(0,R.useRef)(v);T.current=v;let E=()=>{let e=S.current.map(e=>({...e,items:x.current[e.id]??e.items}));s(b.current,e)},D=()=>{t&&c(t,T.current)};(0,R.useEffect)(()=>{if(!e)return;let n=w.current.map(Y);b.current=n,m(n);let r=Object.fromEntries(S.current.map(e=>[e.id,[...e.items]]));x.current=r,g(r);let i=t?d(S.current,t,C.current).map(e=>e.id):[];T.current=i,y(i)},[e,t]);let ee=e=>{b.current=e,m(e)},te=e=>{T.current=e,y(e)},ne=(e,t)=>{let n=(x.current[e]??[]).filter(e=>!l(e)),r={...x.current,[e]:t.length?[...t,...n]:n};x.current=r,g(r)},re=new Map(f.map(e=>[Y(e),ve(e)])),O=t?r.find(e=>e.id===t):void 0,k=O?(h[O.id]??O.items).filter(l):[],ie=O?d(r,O.id,i):[],A=v.length?v:ie.map(e=>e.id);return(0,U.jsxs)(N,{open:e,onClose:o,transition:!0,className:`relative z-110`,children:[(0,U.jsx)(P,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":!0}),(0,U.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,U.jsxs)(j,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,U.jsx)(M,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:L(`nav.sortMenuTitle`)}),(0,U.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:L(`nav.sortHint`)}),(0,U.jsx)(`div`,{className:`mt-4 max-h-80 overflow-auto rounded-lg border border-stone-200 p-1`,children:O?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Pe,{ids:k,labelOf:e=>L(_(e).i18n),onChange:e=>ne(O.id,e),onEnd:E,indent:!0}),A.length?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`mt-1 border-t border-stone-100 px-3 pb-1 pt-2 text-[11px] font-medium text-stone-400`,children:L(`nav.subgroups`)}),(0,U.jsx)(Pe,{ids:A,labelOf:e=>{let t=r.find(t=>t.id===e);return t?J(t):e},onChange:te,onEnd:D,indent:!0})]}):null]}):(0,U.jsx)(Pe,{ids:p,labelOf:e=>re.get(e)??e,onChange:ee,onEnd:E})})]})})]})}function Ie(e,t){let n=[];for(let r of e.filter(e=>!e.parentId)){n.push({group:r,indent:!1});for(let i of d(e,r.id,t))n.push({group:i,indent:!0})}return n}function Le(){return(0,U.jsx)(`svg`,{className:`tw-nav-group-pop-arrow`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M7 5l5 5-5 5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}var Re=120;function ze(){let[e,t]=(0,R.useState)(null),n=(0,R.useRef)(null),r=(0,R.useCallback)(()=>{n.current!==null&&(window.clearTimeout(n.current),n.current=null)},[]),i=(0,R.useCallback)(e=>{r(),t({value:e,closing:!1})},[r]),a=(0,R.useCallback)(()=>{r(),t(e=>e&&!e.closing?{...e,closing:!0}:e),n.current=window.setTimeout(()=>{n.current=null,t(null)},Re)},[r]),o=(0,R.useCallback)(()=>{r(),t(null)},[r]);return(0,R.useEffect)(()=>r,[r]),{value:e?.value??null,closing:!!e?.closing,open:i,close:a,closeNow:o}}function Be(e,t){return{onMouseOver:()=>e?.(),onMouseOut:e=>{let n=e.relatedTarget;n&&e.currentTarget.contains(n)||t?.()}}}function Ve({anchor:e,current:t,itemId:n,closing:r,onPick:i,onHoverEnter:a,onHoverLeave:o}){let s=(0,R.useRef)(null),[c,l]=(0,R.useState)({top:e.top,left:e.right+8});return(0,R.useEffect)(()=>{let t=s.current;if(!t)return;let n=t.offsetWidth,r=t.offsetHeight,i=e.right+8,a=e.top-6;i+n>window.innerWidth-8&&(i=Math.max(8,e.left-n-6)),a+r>window.innerHeight-8&&(a=Math.max(8,window.innerHeight-r-8)),a<8&&(a=8),l({top:a,left:i})},[e]),(0,z.createPortal)((0,U.jsxs)(`div`,{ref:s,className:[`tw-nav-group-pop`,`tw-nav-icon-pop`,r?`is-closing`:``].filter(Boolean).join(` `),style:{top:c.top,left:c.left},...Be(a,o),children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:L(`nav.chooseIcon`)}),(0,U.jsx)(`div`,{className:`tw-nav-icon-grid`,children:v.map(e=>(0,U.jsx)(`button`,{type:`button`,className:[`tw-nav-icon-cell`,t===e?`is-current`:``].filter(Boolean).join(` `),onClick:()=>i(e),children:(0,U.jsx)(Z,{id:n,icon:e})},e))})]}),document.body)}function He({rect:e,closing:t=!1,onClose:n,onHoverEnter:r,onHoverLeave:i,children:a}){let o=(0,R.useRef)(null),[s,c]=(0,R.useState)({top:e.top,left:e.right+6});return(0,R.useEffect)(()=>{let t=o.current;if(!t)return;let n=t.offsetWidth,r=t.offsetHeight,i=e.right+6,a=e.top;i+n>window.innerWidth-8&&(i=Math.max(8,e.left-n-6)),a+r>window.innerHeight-8&&(a=Math.max(8,window.innerHeight-r-8)),c({top:a,left:i})},[e]),(0,R.useEffect)(()=>{let e=e=>{let t=e.target;o.current?.contains(t)||t?.closest?.(`.tw-nav-icon-pop`)||t?.closest?.(`.tw-nav-hover-btn`)||n()},t=e=>{e.key===`Escape`&&n()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t),window.removeEventListener(`resize`,n)}},[n]),(0,z.createPortal)((0,U.jsx)(`div`,{ref:o,className:[`tw-nav-group-pop`,t?`is-closing`:``].filter(Boolean).join(` `),style:{top:s.top,left:s.left},...Be(r,i),children:a}),document.body)}function Ue(){let e=ye(),[t,r]=(0,R.useState)(()=>se()),[i,s]=(0,R.useState)(()=>ce()),[u,d]=(0,R.useState)(()=>ue()),[m,g]=(0,R.useState)(()=>O()),[v,y]=(0,R.useState)(null),[S,C]=(0,R.useState)(!1),[w,T]=(0,R.useState)(null),[E,D]=(0,R.useState)(!1),[te,ne]=(0,R.useState)(null),k=ze(),A=ze(),j=k.value,M=A.value,N=(0,R.useRef)(null);(0,R.useEffect)(()=>()=>{N.current!==null&&window.clearTimeout(N.current)},[]);function P(e){ne(e),D(!0)}function F(e){y(e),C(!0)}function z(){C(!1),T(null)}(0,R.useEffect)(()=>{let e=!0,t=ie(e=>{g({...e})});return b().then(async()=>{e&&(await pe(),e&&(r(se()),d(ue()),s(ce()),g(O())))}),()=>{e=!1,t()}},[]);let B=ee(t,u);(0,R.useEffect)(()=>{let e=window.setTimeout(()=>{let e=document.querySelector(`.tw-nav-libraries > astro-island`);e&&e.querySelector(`.tw-nav-item-main`)&&oe(`nav`,e.innerHTML)},400);return()=>window.clearTimeout(e)});function V(e,t){let n=de(e,t);r(n.groups),d(n.order),fe(n.groups).then(e=>{if(!e||(e.warnings.length&&I(`分组已保存,但${e.warnings[0]}`,`error`),JSON.stringify(e.groups)===JSON.stringify(n.groups)))return;let t=de(e.groups,n.order);r(t.groups),d(t.order)})}function H(){W(),A.close(),k.close()}function W(){N.current!==null&&(window.clearTimeout(N.current),N.current=null)}function me(){W(),N.current=window.setTimeout(()=>{N.current=null,A.close()},220)}function G(e,t){W(),A.open({itemId:e,rect:t.getBoundingClientRect()})}function K(e,t){j?.kind===`itemMenu`&&j.itemId===e?H():(A.closeNow(),k.open({kind:`itemMenu`,itemId:e,rect:t.getBoundingClientRect()}))}function he(e,t){j?.kind===`groupMenu`&&j.group.id===e.id?H():(A.closeNow(),k.open({kind:`groupMenu`,group:e,rect:t.getBoundingClientRect()}))}function ge(e,n){V(h(t,e,n),u),H();let r=t.find(t=>t.id===e);I(`已加入分组「${r?J(r):``}」`,`success`)}function _e(e){let{groups:n,owner:r}=a(t,e);V(n,r?x(u,e,r,n):u),H(),I(`已移出分组`,`success`)}let q=j?.kind===`assign`||j?.kind===`itemMenu`?j.itemId:void 0,ve=j?.kind===`groupMenu`?j.group.id:void 0,Y=j?.kind===`itemMenu`?j:null,X=j?.kind===`groupMenu`?j:null,Z=j?.kind===`assign`?j:null,Q=Y?t.find(e=>e.items.includes(Y.itemId))??null:null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`tw-nav-ready`,"aria-hidden":`true`}),B.map(n=>n.type===`item`?$(n.id,m)?(0,U.jsx)(ke,{id:n.id,icon:i[n.id],pathname:e,actionOpen:q===n.id,onMenu:e=>K(n.id,e)},n.id):null:(0,U.jsx)(Me,{group:n.group,groups:t,order:u,icons:i,pathname:e,openItem:q,openGroupId:ve,onMenu:he,onItemMenu:K},n.group.id)),Y?(0,U.jsxs)(He,{rect:Y.rect,closing:k.closing,onClose:H,onHoverEnter:W,onHoverLeave:me,children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:L(_(Y.itemId).i18n)}),(0,U.jsxs)(`div`,{className:`tw-nav-group-pop-list`,onMouseOver:e=>{let t=e.target.closest(`.tw-nav-group-pop-item`);t&&t.getAttribute(`data-submenu`)!==`icons`&&(W(),A.close())},children:[Q?(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item is-leave`,onClick:()=>_e(Y.itemId),children:[(0,U.jsx)(Te,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.leaveGroup`)})]}):null,(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>k.open({kind:`assign`,itemId:Y.itemId,rect:Y.rect}),children:[(0,U.jsx)(we,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.assignGroup`)})]}),Q?null:(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=Y.itemId;H(),F({name:``,items:[e]})},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(Se,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.addToGroup`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=Q?.id??null;H(),P(e)},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(De,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.sortMenu`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,"data-submenu":`icons`,onMouseEnter:e=>G(Y.itemId,e.currentTarget),onClick:e=>G(Y.itemId,e.currentTarget),children:[(0,U.jsx)(Ee,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.chooseIcon`)}),(0,U.jsx)(Le,{})]})]})]}):null,M&&Y&&M.itemId===Y.itemId?(0,U.jsx)(Ve,{anchor:M.rect,itemId:M.itemId,current:i[M.itemId],closing:A.closing,onHoverEnter:W,onHoverLeave:me,onPick:e=>{s(le(M.itemId,e)),H(),I(`已更换图标`,`success`)}}):null,X?(0,U.jsxs)(He,{rect:X.rect,closing:k.closing,onClose:H,children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:J(X.group)}),(0,U.jsxs)(`div`,{className:`tw-nav-group-pop-list`,children:[X.group.parentId?null:(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item is-create`,onClick:()=>{let e=X.group.id;H(),F({name:``,items:[],parentId:e})},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(Se,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.addSubgroup`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=X.group;H(),P(e.parentId??null)},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(De,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.sortMenu`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=X.group;H(),F({id:e.id,name:e.name,items:[...e.items],parentId:e.parentId})},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(xe,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.editGroupTitle`)})]})]})]}):null,Z?(0,U.jsxs)(He,{rect:Z.rect,closing:k.closing,onClose:H,children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:L(`nav.assignGroup`)}),(0,U.jsx)(`div`,{className:`tw-nav-group-pop-list`,children:(()=>{let e=t.find(e=>e.items.includes(Z.itemId))?.id??null,n=Ie(t,u).filter(({group:t})=>t.id!==e);return n.length?n.map(({group:e,indent:t})=>(0,U.jsxs)(`button`,{type:`button`,className:[`tw-nav-group-pop-item`,t?`is-child`:``].filter(Boolean).join(` `),onClick:()=>ge(e.id,Z.itemId),children:[(0,U.jsx)(we,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:J(e)})]},e.id)):(0,U.jsx)(`div`,{className:`tw-nav-group-pop-empty`,children:L(e?`nav.noOtherGroups`:`nav.noGroups`)})})()})]}):null,(0,U.jsx)(Ne,{open:S&&!w,draft:v,groups:t,plugins:m,icons:i,onClose:z,onSave:e=>{let n=!t.some(t=>t.id===e.id),r=f(t,e);V(r.groups,l(u,r.groups,r.id));let i=r.groups.find(e=>e.id===r.id);I(n?`已新增分组「${i?J(i):e.name}」`:`已保存分组`,`success`),z()},onDelete:v?.id?()=>T(v.id):void 0}),(0,U.jsx)(Fe,{open:E,focusGroupId:te,nodes:B,groups:t,order:u,visible:e=>$(e,m),onClose:()=>D(!1),onCommit:(e,t)=>{let n=u.filter(e=>p(e,t));V(t,[...e,...n.filter(t=>!e.includes(t))])},onChildCommit:(e,r)=>V(t,n(u,t,e,r))}),(0,U.jsx)(ae,{open:!!w,title:L(`nav.deleteGroup`),message:t.find(e=>e.id===w)?.parentId?L(`nav.deleteSubgroupMsg`):L(`nav.deleteGroupMsg`),confirmLabel:L(`nav.deleteGroup`),cancelLabel:L(`nav.groupCancel`),danger:`outline`,onClose:()=>T(null),onConfirm:()=>{if(w){let e=t.find(e=>e.id===w),n=re(t,w),r=o(t,w);V(r,e?c(u,e,r,n):u),e&&I(`已删除分组「${J(e)}」`,`success`)}z()}})]})}export{Ue as default};
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{A as n,C as r,D as i,F as a,I as o,L as s,M as c,N as l,O as u,P as d,R as f,S as p,T as m,_ as h,a as g,b as _,g as v,h as y,i as b,j as x,k as S,m as C,p as w,r as T,t as E,u as D,v as ee,w as te,x as ne,y as re}from"./app-config.DAIyT--R.js";import{a as O,i as k,o as ie}from"./plugins.Di6uuouN.js";import{t as A}from"./react-dom.DLW9pGCF.js";import{i as j,n as M,r as N,t as P}from"./dialog.DZHZCe_T.js";import{t as F}from"./jsx-runtime.DUg_B_vD.js";import{t as ae}from"./ConfirmDialog.D5qXeML0.js";import{showToast as I}from"./Toast.BO2NFckG.js";import{n as L}from"./i18n.ele1lM9e.js";import{n as oe}from"./hydrate-cache.C0F0L04c.js";var R=e(t(),1),z=e(A(),1),B=`/__tb_nav/groups`;function se(){return T().navGroups}function ce(){return u(T().navIcons)}function le(e,t){let n={...ce(),[e]:t};return D({navIcons:n}),E(),n}function ue(){return T().navOrder}function de(e,t){let n=i(e),r=S(t,n);return D({navGroups:n,navOrder:r}),E(),{groups:n,order:r}}function V(e,t){return JSON.stringify(e)===JSON.stringify(t)}async function fe(e){if(!g())return null;try{let t=await fetch(B,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({groups:e}),signal:AbortSignal.timeout(4e3)});if(!t.ok)return null;let n=await t.json();return{groups:i(n.groups,!1),warnings:Array.isArray(n.warnings)?n.warnings.filter(e=>typeof e==`string`):[]}}catch{return null}}async function pe(){if(!g())return;let e=T(),t=null;try{let e=await fetch(B,{signal:AbortSignal.timeout(4e3)});e.ok&&(t=await e.json())}catch{return}if(!t)return;if(t.scanned){let n=i(t.groups,!1),r=S(e.navOrder,n);(!V(n,e.navGroups)||!V(r,e.navOrder))&&(D({navGroups:n,navOrder:r}),E());return}if(!e.navGroups.length)return;let n=await fe(e.navGroups);n&&!V(n.groups,e.navGroups)&&(D({navGroups:n.groups,navOrder:S(e.navOrder,n.groups)}),E())}function H(e,t,n){let[r,i]=(0,R.useState)(null),a=(0,R.useRef)(null),o=(0,R.useRef)(e);o.current=e;let c=(0,R.useRef)(t);c.current=t;let l=(0,R.useRef)(n);l.current=n;function u(e,t){if(t.button!==0)return;t.preventDefault(),t.stopPropagation();let n=a.current;if(!n)return;i(e);let r=e=>{let t=[...n.querySelectorAll(`[data-sort-key]`)];for(let n of t){let t=n.getBoundingClientRect();if(e>=t.top&&e<=t.bottom)return n.dataset.sortKey}return null},u=t=>{let n=r(t.clientY);if(!n||n===e)return;let i=s(o.current,e,n);i.join(`|`)!==o.current.join(`|`)&&(o.current=i,c.current(i))},d=()=>{window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d),i(null),l.current?.()};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)}return{listRef:a,dragId:r,onPointerDown:u}}var U=F(),W=`/`;function me(e){return`${W.endsWith(`/`)?W:`${W}/`}${e.replace(/^\//,``)}`}function G(e,t){let n=W.replace(/\/$/,``),r=e.slice(n.length).replace(/^\/+/,``);return r===t||r.startsWith(`${t}/`)}function K(e){return[`tw-nav-item`,e?`is-active font-medium`:``].filter(Boolean).join(` `)}function he(e){return w(`tw.nav.groupOpen.${e}`)}function ge(){return w(`tw.nav.docsOpen`)}function _e(e,t){try{let t=localStorage.getItem(he(e));if(t===`1`)return!0;if(t===`0`)return!1;if(e===`docs`){let e=localStorage.getItem(ge());if(e===`1`)return!0;if(e===`0`)return!1}}catch{}return t}function q(e,t){try{localStorage.setItem(he(e),t?`1`:`0`),e===`docs`&&localStorage.setItem(ge(),t?`1`:`0`)}catch{}}function J(e){return e.id===`docs`&&(e.name===`文档库`||e.name===`Documents`)?L(`nav.docs`):e.name.replace(/ \(\d+\)$/,``).replace(/ \(分组\)$/,``).trim()||e.name}function ve(e){return e.type===`group`?J(e.group):L(_(e.id).i18n)}function Y(e){return e.type===`item`?te(e.id):ne(e.group.id)}function ye(){let[e,t]=(0,R.useState)(()=>window.location.pathname);return(0,R.useEffect)(()=>{let e=()=>t(window.location.pathname);return document.addEventListener(`astro:page-load`,e),document.addEventListener(`astro:after-swap`,e),window.addEventListener(`popstate`,e),()=>{document.removeEventListener(`astro:page-load`,e),document.removeEventListener(`astro:after-swap`,e),window.removeEventListener(`popstate`,e)}},[]),e}function X({children:e}){return(0,U.jsx)(`svg`,{className:`tw-nav-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:e})}function Z({id:e,icon:t}){return(0,U.jsx)(X,{children:Q[t??C[e]]})}var Q={dashboard:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`14`,y:`14`,width:`7`,height:`7`,rx:`1.5`})]}),check:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M9 11l3 3L22 4`}),(0,U.jsx)(`path`,{d:`M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11`})]}),pencil:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 20h9`}),(0,U.jsx)(`path`,{d:`M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z`})]}),book:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M4 19.5A2.5 2.5 0 0 1 6.5 17H20`}),(0,U.jsx)(`path`,{d:`M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z`})]}),fileText:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M14 3v5h5`}),(0,U.jsx)(`path`,{d:`M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z`}),(0,U.jsx)(`path`,{d:`M8 13h8`}),(0,U.jsx)(`path`,{d:`M8 17h6`})]}),layers:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 3 3 8l9 5 9-5-9-5z`}),(0,U.jsx)(`path`,{d:`m3 13 9 5 9-5`})]}),list:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M8 6h13`}),(0,U.jsx)(`path`,{d:`M8 12h13`}),(0,U.jsx)(`path`,{d:`M8 18h13`}),(0,U.jsx)(`path`,{d:`M3 6h.01`}),(0,U.jsx)(`path`,{d:`M3 12h.01`}),(0,U.jsx)(`path`,{d:`M3 18h.01`})]}),folder:(0,U.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`}),star:(0,U.jsx)(`path`,{d:`m12 3 2.1 5.9L20 11l-5 4.3 1.7 6.2-5.7-3.9-5.7 3.9L7 15.3 2 11l5.9-2.1L12 3z`}),database:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`ellipse`,{cx:`12`,cy:`6`,rx:`8`,ry:`3`}),(0,U.jsx)(`path`,{d:`M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6`}),(0,U.jsx)(`path`,{d:`M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]}),target:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`})]}),code:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`m8 8-4 4 4 4`}),(0,U.jsx)(`path`,{d:`m16 8 4 4-4 4`})]}),flask:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M9 3h6`}),(0,U.jsx)(`path`,{d:`M10 3v6l-5 8a2 2 0 0 0 1.7 3h10.6a2 2 0 0 0 1.7-3l-5-8V3`}),(0,U.jsx)(`path`,{d:`M7.5 14h9`})]}),home:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M3 10.5 12 3l9 7.5`}),(0,U.jsx)(`path`,{d:`M5 9.5V20h14V9.5`})]}),clipboard:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M9 4h6v3H9z`}),(0,U.jsx)(`path`,{d:`M8 4H6a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-2`})]}),bug:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`14`,r:`5`}),(0,U.jsx)(`path`,{d:`M9 6l2 2`}),(0,U.jsx)(`path`,{d:`M15 6l-2 2`}),(0,U.jsx)(`path`,{d:`M7 11H4`}),(0,U.jsx)(`path`,{d:`M20 11h-3`}),(0,U.jsx)(`path`,{d:`M7 17H4`}),(0,U.jsx)(`path`,{d:`M20 17h-3`})]}),calendar:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`5`,width:`18`,height:`16`,rx:`2`}),(0,U.jsx)(`path`,{d:`M8 3v4`}),(0,U.jsx)(`path`,{d:`M16 3v4`}),(0,U.jsx)(`path`,{d:`M3 10h18`})]}),chart:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M4 20V10`}),(0,U.jsx)(`path`,{d:`M10 20V4`}),(0,U.jsx)(`path`,{d:`M16 20v-7`}),(0,U.jsx)(`path`,{d:`M2 20h20`})]}),globe:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,U.jsx)(`path`,{d:`M3 12h18`}),(0,U.jsx)(`path`,{d:`M12 3c2.5 2.5 4 5.7 4 9s-1.5 6.5-4 9c-2.5-2.5-4-5.7-4-9s1.5-6.5 4-9z`})]}),link:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M10 13a4 4 0 0 0 5.7 0l2.3-2.3a4 4 0 0 0-5.7-5.7L11 6.3`}),(0,U.jsx)(`path`,{d:`M14 11a4 4 0 0 0-5.7 0L6 13.3a4 4 0 0 0 5.7 5.7L13 17.7`})]}),users:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`9`,cy:`8`,r:`3.5`}),(0,U.jsx)(`path`,{d:`M2.5 20a6.5 6.5 0 0 1 13 0`}),(0,U.jsx)(`path`,{d:`M16 5.5a3.5 3.5 0 0 1 0 7`}),(0,U.jsx)(`path`,{d:`M18 20a6 6 0 0 0-2-4.5`})]}),terminal:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`m5 8 4 4-4 4`}),(0,U.jsx)(`path`,{d:`M13 16h6`})]}),tag:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0l-7.2-7.2a2 2 0 0 1-.6-1.4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 1.4.6l6.2 6.2a2 2 0 0 1 0 2.6z`}),(0,U.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.2`})]}),flag:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M5 21V4`}),(0,U.jsx)(`path`,{d:`M5 5h11l-2 4 2 4H5z`})]}),zap:(0,U.jsx)(`path`,{d:`M13 2 4 14h6l-1 8 9-12h-6l1-8z`}),search:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,U.jsx)(`path`,{d:`m20 20-3.5-3.5`})]}),settings:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,U.jsx)(`path`,{d:`M19.4 15a1.7 1.7 0 0 0 .3 1.9l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-2.1-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.9.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.9 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.9l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.9.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.9-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.9V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z`})]}),bell:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M18 8a6 6 0 1 0-12 0c0 5-2 6-2 6h16s-2-1-2-6`}),(0,U.jsx)(`path`,{d:`M10.3 20a2 2 0 0 0 3.4 0`})]}),clock:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,U.jsx)(`path`,{d:`M12 7v5l3.5 2`})]}),mail:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`}),(0,U.jsx)(`path`,{d:`m3.5 7 8.5 6 8.5-6`})]}),message:(0,U.jsx)(`path`,{d:`M21 12a8 8 0 0 1-8 8H8l-5 3 1.4-4.6A8 8 0 1 1 21 12z`}),image:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`16`,rx:`2`}),(0,U.jsx)(`circle`,{cx:`8.5`,cy:`9.5`,r:`1.5`}),(0,U.jsx)(`path`,{d:`m4 17 5-5 3.5 3.5L16 11l4 4.5`})]}),video:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`6`,width:`12`,height:`12`,rx:`2`}),(0,U.jsx)(`path`,{d:`m15 11 6-3.5v9L15 13`})]}),download:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 3v12`}),(0,U.jsx)(`path`,{d:`m7 10 5 5 5-5`}),(0,U.jsx)(`path`,{d:`M4 20h16`})]}),upload:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 16V4`}),(0,U.jsx)(`path`,{d:`m7 9 5-5 5 5`}),(0,U.jsx)(`path`,{d:`M4 20h16`})]}),plus:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 5v14`}),(0,U.jsx)(`path`,{d:`M5 12h14`})]}),trash:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M4 7h16`}),(0,U.jsx)(`path`,{d:`M9 7V4h6v3`}),(0,U.jsx)(`path`,{d:`M6 7l1 13h10l1-13`}),(0,U.jsx)(`path`,{d:`M10 11v6M14 11v6`})]}),lock:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`4`,y:`10`,width:`16`,height:`11`,rx:`2`}),(0,U.jsx)(`path`,{d:`M8 10V7a4 4 0 0 1 8 0v3`})]}),shield:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 3l7 3v6c0 4.2-2.9 7.5-7 9-4.1-1.5-7-4.8-7-9V6l7-3z`}),(0,U.jsx)(`path`,{d:`m9 12 2 2 4-4`})]}),key:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`8`,cy:`12`,r:`4`}),(0,U.jsx)(`path`,{d:`M12 12h9`}),(0,U.jsx)(`path`,{d:`M17 12v4M20 12v3`})]}),cloud:(0,U.jsx)(`path`,{d:`M7 18h10a4 4 0 0 0 .5-8 6 6 0 0 0-11.4 1.5A3.5 3.5 0 0 0 7 18z`}),box:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`m12 3 8 4.5v9L12 21l-8-4.5v-9L12 3z`}),(0,U.jsx)(`path`,{d:`m4 7.5 8 4.5 8-4.5`}),(0,U.jsx)(`path`,{d:`M12 12v9`})]}),filter:(0,U.jsx)(`path`,{d:`M3 5h18l-7 8v6l-4 2v-8L3 5z`}),grid:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`4`,y:`4`,width:`6.5`,height:`6.5`,rx:`1`}),(0,U.jsx)(`rect`,{x:`13.5`,y:`4`,width:`6.5`,height:`6.5`,rx:`1`}),(0,U.jsx)(`rect`,{x:`4`,y:`13.5`,width:`6.5`,height:`6.5`,rx:`1`}),(0,U.jsx)(`rect`,{x:`13.5`,y:`13.5`,width:`6.5`,height:`6.5`,rx:`1`})]}),pin:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M12 21v-7`}),(0,U.jsx)(`path`,{d:`M8 4h8l-1 6 3 3H6l3-3-1-6z`})]}),sparkle:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`m12 3 1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z`}),(0,U.jsx)(`path`,{d:`M18 16.5 18.7 18.3 20.5 19 18.7 19.7 18 21.5 17.3 19.7 15.5 19 17.3 18.3 18 16.5z`})]}),rocket:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M13.5 4.5c3-2 5.5-1.5 5.5-1.5s.5 2.5-1.5 5.5c-1.6 2.4-4.5 5-6.5 6.5l-3.5-3.5c1.5-2 4.1-4.9 6-7z`}),(0,U.jsx)(`path`,{d:`M8 12 5 13l-2 4 5-1`}),(0,U.jsx)(`path`,{d:`M12 16l-1 3 4-2 1-3`}),(0,U.jsx)(`circle`,{cx:`15`,cy:`9`,r:`1.2`})]}),eye:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M2.5 12S6 6 12 6s9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6z`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`2.8`})]}),bookmark:(0,U.jsx)(`path`,{d:`M7 3h10a1 1 0 0 1 1 1v17l-6-4-6 4V4a1 1 0 0 1 1-1z`}),archive:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`4`,rx:`1`}),(0,U.jsx)(`path`,{d:`M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8`}),(0,U.jsx)(`path`,{d:`M10 12h4`})]}),refresh:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M20 12a8 8 0 1 1-2.4-5.7`}),(0,U.jsx)(`path`,{d:`M20 4v5h-5`})]}),play:(0,U.jsx)(`path`,{d:`M8 5v14l11-7L8 5z`}),map:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`m3 6 6-2 6 2 6-2v14l-6 2-6-2-6 2V6z`}),(0,U.jsx)(`path`,{d:`M9 4v14M15 6v14`})]}),activity:(0,U.jsx)(`path`,{d:`M3 12h4l3-7 4 14 3-7h4`}),cpu:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`7`,y:`7`,width:`10`,height:`10`,rx:`2`}),(0,U.jsx)(`path`,{d:`M10 3v4M14 3v4M10 17v4M14 17v4M3 10h4M3 14h4M17 10h4M17 14h4`})]}),briefcase:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`8`,width:`18`,height:`12`,rx:`2`}),(0,U.jsx)(`path`,{d:`M9 8V5h6v3`}),(0,U.jsx)(`path`,{d:`M3 13h18`})]}),presentation:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,U.jsx)(`path`,{d:`M12 16v4`}),(0,U.jsx)(`path`,{d:`m8 22 4-4 4 4`}),(0,U.jsx)(`path`,{d:`M8 8h8M8 12h5`})]}),copy:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{x:`8`,y:`8`,width:`12`,height:`12`,rx:`2`}),(0,U.jsx)(`path`,{d:`M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2`})]}),save:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z`}),(0,U.jsx)(`path`,{d:`M7 3v6h9`}),(0,U.jsx)(`path`,{d:`M8 21v-6h8v6`})]})};function be(){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`svg`,{className:`tw-nav-ico tw-nav-ico--closed`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`})}),(0,U.jsx)(`svg`,{className:`tw-nav-ico tw-nav-ico--open`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M6 14l1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`})})]})}function xe(){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:[(0,U.jsx)(`path`,{d:`M21 4H14`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M10 4H3`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M21 12H12`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M8 12H3`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M21 20H16`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M12 20H3`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M14 2v4`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M8 10v4`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M16 18v4`,strokeLinecap:`round`})]})}function Se(){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,U.jsx)(`path`,{d:`M12 8v8`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M8 12h8`,strokeLinecap:`round`})]})}function Ce(){return(0,U.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.7`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.7`}),(0,U.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.7`})]})}function we(){return(0,U.jsx)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,U.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z`})})}function Te(){return(0,U.jsxs)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,U.jsx)(`path`,{d:`M9 6H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h4`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M16 8l4 4-4 4`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,U.jsx)(`path`,{d:`M20 12H9`,strokeLinecap:`round`})]})}function Ee(){return(0,U.jsxs)(`svg`,{className:`tw-nav-group-pop-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,U.jsx)(`circle`,{cx:`8.5`,cy:`8.5`,r:`4.5`}),(0,U.jsx)(`rect`,{x:`12`,y:`12`,width:`9`,height:`9`,rx:`2`})]})}function De(){return(0,U.jsxs)(X,{children:[(0,U.jsx)(`path`,{d:`M8 6v12`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M5 9l3-3 3 3`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,U.jsx)(`path`,{d:`M16 18V6`,strokeLinecap:`round`}),(0,U.jsx)(`path`,{d:`M13 15l3 3 3-3`,strokeLinecap:`round`,strokeLinejoin:`round`})]})}function Oe(){return(0,U.jsxs)(`svg`,{className:`tw-nav-drag-grip`,viewBox:`0 0 20 20`,"aria-hidden":!0,children:[(0,U.jsx)(`circle`,{cx:`7`,cy:`5`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`13`,cy:`5`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`7`,cy:`10`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`13`,cy:`10`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`7`,cy:`15`,r:`1.25`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`13`,cy:`15`,r:`1.25`,fill:`currentColor`})]})}function $(e,t){if(r(e))return!1;let n=_(e).plugin;return!n||t[n]!==!1}function ke({id:e,icon:t,pathname:n,actionOpen:r,onMenu:i}){let a=_(e),o=G(n,a.match);return(0,U.jsxs)(`div`,{className:[K(o),r?`is-action-open`:``].filter(Boolean).join(` `),"data-plugin-nav":a.plugin,children:[(0,U.jsxs)(`a`,{href:me(a.href),className:`tw-nav-item-main`,children:[(0,U.jsx)(Z,{id:e,icon:t}),(0,U.jsx)(`span`,{className:`tw-nav-label`,children:L(a.i18n)})]}),(0,U.jsx)(`button`,{type:`button`,className:`tw-nav-hover-btn`,"aria-label":L(`nav.more`),onClick:e=>{e.preventDefault(),e.stopPropagation(),i(e.currentTarget)},children:(0,U.jsx)(Ce,{})})]})}function Ae(e,t,n){return e.items.some(e=>{if(r(e))return!1;let t=_(e).plugin;return(!t||k(t))&&G(n,_(e).match)})?!0:m(t,e.id).some(e=>Ae(e,t,n))}function je(e,t){return e.items.some(e=>{if(r(e))return!1;let t=_(e).plugin;return!t||k(t)})?!0:m(t,e.id).some(e=>je(e,t))}function Me({group:e,groups:t,order:n,icons:i,pathname:a,openItem:o,openGroupId:s,onMenu:c,onItemMenu:l}){let u=e.items.filter(e=>{if(r(e))return!1;let t=_(e).plugin;return!t||k(t)}),f=d(t,e.id,n),p=Ae(e,t,a),[m,h]=(0,R.useState)(()=>_e(e.id,!0)),[g,v]=(0,R.useState)(!1),y=(0,R.useRef)(null),b=(0,R.useRef)(null),x=(0,R.useRef)(null);if((0,R.useEffect)(()=>S,[]),!je(e,t))return null;function S(){x.current&&y.current&&y.current.removeEventListener(`transitionend`,x.current),x.current=null,b.current!==null&&(window.clearTimeout(b.current),b.current=null)}function C(){S(),q(e.id,!0),v(!1),h(!0)}function w(t){if(t.preventDefault(),!m||g){C();return}v(!0),q(e.id,!1);let n=y.current,r=!1,i=()=>{r||(r=!0,S(),h(!1),v(!1))},a=e=>{e.target===n&&e.propertyName===`grid-template-rows`&&i()};S(),x.current=a,n?.addEventListener(`transitionend`,a),b.current=window.setTimeout(i,360)}return(0,U.jsxs)(`details`,{className:`tw-nav-details ${g?`is-closing`:``}`,open:m||g,"data-nav-group":e.id,children:[(0,U.jsxs)(`summary`,{className:[`tw-nav-item tw-nav-summary`,p?`is-branch-active`:``,s===e.id?`is-action-open`:``].filter(Boolean).join(` `),onClick:w,children:[(0,U.jsx)(be,{}),(0,U.jsx)(`span`,{className:`tw-nav-label min-w-0 flex-1 truncate`,children:J(e)}),(0,U.jsx)(`button`,{type:`button`,className:`tw-nav-hover-btn`,"aria-label":L(`nav.groupActions`),onClick:t=>{t.preventDefault(),t.stopPropagation(),c(e,t.currentTarget)},children:(0,U.jsx)(xe,{})}),(0,U.jsx)(`svg`,{className:`tw-nav-chevron opacity-70`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M7 5l6 5-6 5`,strokeLinecap:`round`,strokeLinejoin:`round`})})]}),(0,U.jsx)(`div`,{className:`tw-nav-subtree-anim`,ref:y,children:(0,U.jsxs)(`div`,{className:`tw-nav-subtree`,children:[u.map(e=>(0,U.jsx)(ke,{id:e,icon:i[e],pathname:a,actionOpen:o===e,onMenu:t=>l(e,t)},e)),f.map(e=>(0,U.jsx)(Me,{group:e,groups:t,order:n,icons:i,pathname:a,openItem:o,openGroupId:s,onMenu:c,onItemMenu:l},e.id))]})})]})}function Ne({open:e,draft:t,groups:n,plugins:r,icons:i,onClose:a,onSave:o,onDelete:s}){let[c,l]=(0,R.useState)(``),[u,d]=(0,R.useState)([]),[f,p]=(0,R.useState)(``),m=(0,R.useRef)(null),h=new Set(n.filter(e=>e.id!==t?.id).flatMap(e=>e.items)),g=y.filter(e=>$(e.id,r)&&(!h.has(e.id)||u.includes(e.id))),_=H(u,d);(0,R.useEffect)(()=>{if(!e||!t)return;l(t.name),d(t.items.filter(e=>$(e,r))),p(``);let n=window.setTimeout(()=>{m.current?.focus(),m.current?.select()},50);return()=>window.clearTimeout(n)},[e,t,r]);function v(e){d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function b(){let e=c.trim();if(!e){p(L(`nav.groupNameRequired`));return}if(!u.length){p(L(`nav.groupItemsRequired`));return}let n=(t?.items??[]).filter(e=>!$(e,r));o({id:t?.id,name:e,items:[...n,...u],parentId:t?.parentId})}let x=[...u.map(e=>g.find(t=>t.id===e)).filter(e=>!!e),...g.filter(e=>!u.includes(e.id))];return(0,U.jsxs)(N,{open:e,onClose:a,className:`relative z-110`,children:[(0,U.jsx)(P,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":!0}),(0,U.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,U.jsxs)(j,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,U.jsx)(M,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:t?.id?L(`nav.editGroupTitle`):t?.parentId?L(`nav.addSubgroup`):L(`nav.createGroup`)}),(0,U.jsxs)(`label`,{className:`tw-confirm-msg mt-4 block text-xs font-medium text-stone-500`,children:[L(`nav.groupName`),(0,U.jsx)(`input`,{ref:m,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),b())},className:`mt-1.5 w-full h-9 rounded-lg border border-stone-200 px-3 text-sm text-stone-800 outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6]`})]}),(0,U.jsxs)(`div`,{className:`mt-4`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:L(`nav.groupItems`)}),(0,U.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:L(`nav.groupItemsHint`)}),(0,U.jsxs)(`div`,{ref:_.listRef,className:`mt-2 max-h-52 overflow-auto rounded-lg border border-stone-200 p-1`,children:[x.map(e=>{let t=u.includes(e.id);return(0,U.jsxs)(`label`,{"data-sort-key":t?e.id:void 0,className:[`flex items-center gap-2 rounded-md px-3 py-2 text-sm text-stone-700 cursor-pointer hover:bg-stone-50`,t?`tw-nav-drag-row`:``,_.dragId===e.id?`is-dragging`:``].filter(Boolean).join(` `),onPointerDown:t?t=>{t.target.closest(`input`)||_.onPointerDown(e.id,t)}:void 0,children:[t?(0,U.jsx)(Oe,{}):(0,U.jsx)(`span`,{className:`tw-nav-drag-grip`}),(0,U.jsx)(`input`,{type:`checkbox`,checked:t,onChange:()=>v(e.id),className:`rounded border-stone-300 text-[#4176e6] focus:ring-[#4176e6]/40`}),(0,U.jsx)(`span`,{className:`tw-nav-editor-ico`,children:(0,U.jsx)(Z,{id:e.id,icon:i[e.id]})}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:L(e.i18n)})]},e.id)}),x.length?null:(0,U.jsx)(`div`,{className:`px-3 py-4 text-center text-[12px] text-stone-400`,children:L(`nav.noAddableItems`)})]})]}),f?(0,U.jsx)(`p`,{className:`mt-2 text-[12px] text-red-600`,children:f}):null,(0,U.jsxs)(`div`,{className:`mt-5 flex items-center gap-2`,children:[t?.id&&s?(0,U.jsx)(`button`,{type:`button`,onClick:s,className:`h-8 px-3 text-sm rounded-lg border border-red-200 text-red-600 hover:bg-red-50`,children:L(`nav.deleteGroup`)}):null,(0,U.jsx)(`div`,{className:`flex-1`}),(0,U.jsx)(`button`,{type:`button`,onClick:a,className:`tw-confirm-cancel h-8 px-3 text-sm rounded-lg border border-stone-200 text-stone-600 hover:bg-stone-100`,children:L(`nav.groupCancel`)}),(0,U.jsx)(`button`,{type:`button`,onClick:b,className:`h-8 px-3 text-sm rounded-lg text-white bg-[#4176e6] hover:bg-[#3566d0]`,children:L(`nav.groupSave`)})]})]})})]})}function Pe({ids:e,labelOf:t,onChange:n,onEnd:r,indent:i}){let a=H(e,n,r);return(0,U.jsx)(`div`,{ref:a.listRef,className:`flex flex-col`,children:e.map(e=>(0,U.jsxs)(`div`,{"data-sort-key":e,className:[`tw-nav-drag-row px-3 py-2 text-sm text-stone-700 hover:bg-stone-50`,i?`tw-nav-drag-row--nested`:``,a.dragId===e?`is-dragging`:``].filter(Boolean).join(` `),onPointerDown:t=>a.onPointerDown(e,t),children:[(0,U.jsx)(Oe,{}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t(e)})]},e))})}function Fe({open:e,focusGroupId:t,nodes:n,groups:r,order:i,visible:a,onClose:o,onCommit:s,onChildCommit:c}){let l=e=>!a||a(e),u=e=>e.items.some(l)||r.filter(t=>t.parentId===e.id).some(e=>u(e)),f=n.filter(e=>e.type===`item`?l(e.id):u(e.group)),[p,m]=(0,R.useState)(()=>f.map(Y)),[h,g]=(0,R.useState)(()=>Object.fromEntries(r.map(e=>[e.id,[...e.items]]))),[v,y]=(0,R.useState)([]),b=(0,R.useRef)(p);b.current=p;let x=(0,R.useRef)(h);x.current=h;let S=(0,R.useRef)(r);S.current=r;let C=(0,R.useRef)(i);C.current=i;let w=(0,R.useRef)(f);w.current=f;let T=(0,R.useRef)(v);T.current=v;let E=()=>{let e=S.current.map(e=>({...e,items:x.current[e.id]??e.items}));s(b.current,e)},D=()=>{t&&c(t,T.current)};(0,R.useEffect)(()=>{if(!e)return;let n=w.current.map(Y);b.current=n,m(n);let r=Object.fromEntries(S.current.map(e=>[e.id,[...e.items]]));x.current=r,g(r);let i=t?d(S.current,t,C.current).map(e=>e.id):[];T.current=i,y(i)},[e,t]);let ee=e=>{b.current=e,m(e)},te=e=>{T.current=e,y(e)},ne=(e,t)=>{let n=(x.current[e]??[]).filter(e=>!l(e)),r={...x.current,[e]:t.length?[...t,...n]:n};x.current=r,g(r)},re=new Map(f.map(e=>[Y(e),ve(e)])),O=t?r.find(e=>e.id===t):void 0,k=O?(h[O.id]??O.items).filter(l):[],ie=O?d(r,O.id,i):[],A=v.length?v:ie.map(e=>e.id);return(0,U.jsxs)(N,{open:e,onClose:o,className:`relative z-110`,children:[(0,U.jsx)(P,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":!0}),(0,U.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,U.jsxs)(j,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,U.jsx)(M,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:L(`nav.sortMenuTitle`)}),(0,U.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:L(`nav.sortHint`)}),(0,U.jsx)(`div`,{className:`mt-4 max-h-80 overflow-auto rounded-lg border border-stone-200 p-1`,children:O?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Pe,{ids:k,labelOf:e=>L(_(e).i18n),onChange:e=>ne(O.id,e),onEnd:E,indent:!0}),A.length?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`mt-1 border-t border-stone-100 px-3 pb-1 pt-2 text-[11px] font-medium text-stone-400`,children:L(`nav.subgroups`)}),(0,U.jsx)(Pe,{ids:A,labelOf:e=>{let t=r.find(t=>t.id===e);return t?J(t):e},onChange:te,onEnd:D,indent:!0})]}):null]}):(0,U.jsx)(Pe,{ids:p,labelOf:e=>re.get(e)??e,onChange:ee,onEnd:E})})]})})]})}function Ie(e,t){let n=[];for(let r of e.filter(e=>!e.parentId)){n.push({group:r,indent:!1});for(let i of d(e,r.id,t))n.push({group:i,indent:!0})}return n}function Le(){return(0,U.jsx)(`svg`,{className:`tw-nav-group-pop-arrow`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":!0,children:(0,U.jsx)(`path`,{d:`M7 5l5 5-5 5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}var Re=120;function ze(){let[e,t]=(0,R.useState)(null),n=(0,R.useRef)(null),r=(0,R.useCallback)(()=>{n.current!==null&&(window.clearTimeout(n.current),n.current=null)},[]),i=(0,R.useCallback)(e=>{r(),t({value:e,closing:!1})},[r]),a=(0,R.useCallback)(()=>{r(),t(e=>e&&!e.closing?{...e,closing:!0}:e),n.current=window.setTimeout(()=>{n.current=null,t(null)},Re)},[r]),o=(0,R.useCallback)(()=>{r(),t(null)},[r]);return(0,R.useEffect)(()=>r,[r]),{value:e?.value??null,closing:!!e?.closing,open:i,close:a,closeNow:o}}function Be(e,t){return{onMouseOver:()=>e?.(),onMouseOut:e=>{let n=e.relatedTarget;n&&e.currentTarget.contains(n)||t?.()}}}function Ve({anchor:e,current:t,itemId:n,closing:r,onPick:i,onHoverEnter:a,onHoverLeave:o}){let s=(0,R.useRef)(null),[c,l]=(0,R.useState)({top:e.top,left:e.right+8});return(0,R.useEffect)(()=>{let t=s.current;if(!t)return;let n=t.offsetWidth,r=t.offsetHeight,i=e.right+8,a=e.top-6;i+n>window.innerWidth-8&&(i=Math.max(8,e.left-n-6)),a+r>window.innerHeight-8&&(a=Math.max(8,window.innerHeight-r-8)),a<8&&(a=8),l({top:a,left:i})},[e]),(0,z.createPortal)((0,U.jsxs)(`div`,{ref:s,className:[`tw-nav-group-pop`,`tw-nav-icon-pop`,r?`is-closing`:``].filter(Boolean).join(` `),style:{top:c.top,left:c.left},...Be(a,o),children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:L(`nav.chooseIcon`)}),(0,U.jsx)(`div`,{className:`tw-nav-icon-grid`,children:v.map(e=>(0,U.jsx)(`button`,{type:`button`,className:[`tw-nav-icon-cell`,t===e?`is-current`:``].filter(Boolean).join(` `),onClick:()=>i(e),children:(0,U.jsx)(Z,{id:n,icon:e})},e))})]}),document.body)}function He({rect:e,closing:t=!1,onClose:n,onHoverEnter:r,onHoverLeave:i,children:a}){let o=(0,R.useRef)(null),[s,c]=(0,R.useState)({top:e.top,left:e.right+6});return(0,R.useEffect)(()=>{let t=o.current;if(!t)return;let n=t.offsetWidth,r=t.offsetHeight,i=e.right+6,a=e.top;i+n>window.innerWidth-8&&(i=Math.max(8,e.left-n-6)),a+r>window.innerHeight-8&&(a=Math.max(8,window.innerHeight-r-8)),c({top:a,left:i})},[e]),(0,R.useEffect)(()=>{let e=e=>{let t=e.target;o.current?.contains(t)||t?.closest?.(`.tw-nav-icon-pop`)||t?.closest?.(`.tw-nav-hover-btn`)||n()},t=e=>{e.key===`Escape`&&n()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t),window.removeEventListener(`resize`,n)}},[n]),(0,z.createPortal)((0,U.jsx)(`div`,{ref:o,className:[`tw-nav-group-pop`,t?`is-closing`:``].filter(Boolean).join(` `),style:{top:s.top,left:s.left},...Be(r,i),children:a}),document.body)}function Ue(){let e=ye(),[t,r]=(0,R.useState)(()=>se()),[i,s]=(0,R.useState)(()=>ce()),[u,d]=(0,R.useState)(()=>ue()),[m,g]=(0,R.useState)(()=>O()),[v,y]=(0,R.useState)(null),[S,C]=(0,R.useState)(!1),[w,T]=(0,R.useState)(null),[E,D]=(0,R.useState)(!1),[te,ne]=(0,R.useState)(null),k=ze(),A=ze(),j=k.value,M=A.value,N=(0,R.useRef)(null);(0,R.useEffect)(()=>()=>{N.current!==null&&window.clearTimeout(N.current)},[]);function P(e){ne(e),D(!0)}function F(e){y(e),C(!0)}function z(){C(!1),T(null)}(0,R.useEffect)(()=>{let e=!0,t=ie(e=>{g({...e})});return b().then(async()=>{e&&(await pe(),e&&(r(se()),d(ue()),s(ce()),g(O())))}),()=>{e=!1,t()}},[]);let B=ee(t,u);(0,R.useEffect)(()=>{let e=window.setTimeout(()=>{let e=document.querySelector(`.tw-nav-libraries > astro-island`);e&&e.querySelector(`.tw-nav-item-main`)&&oe(`nav`,e.innerHTML)},400);return()=>window.clearTimeout(e)});function V(e,t){let n=de(e,t);r(n.groups),d(n.order),fe(n.groups).then(e=>{if(!e||(e.warnings.length&&I(`分组已保存,但${e.warnings[0]}`,`error`),JSON.stringify(e.groups)===JSON.stringify(n.groups)))return;let t=de(e.groups,n.order);r(t.groups),d(t.order)})}function H(){W(),A.close(),k.close()}function W(){N.current!==null&&(window.clearTimeout(N.current),N.current=null)}function me(){W(),N.current=window.setTimeout(()=>{N.current=null,A.close()},220)}function G(e,t){W(),A.open({itemId:e,rect:t.getBoundingClientRect()})}function K(e,t){j?.kind===`itemMenu`&&j.itemId===e?H():(A.closeNow(),k.open({kind:`itemMenu`,itemId:e,rect:t.getBoundingClientRect()}))}function he(e,t){j?.kind===`groupMenu`&&j.group.id===e.id?H():(A.closeNow(),k.open({kind:`groupMenu`,group:e,rect:t.getBoundingClientRect()}))}function ge(e,n){V(h(t,e,n),u),H();let r=t.find(t=>t.id===e);I(`已加入分组「${r?J(r):``}」`,`success`)}function _e(e){let{groups:n,owner:r}=a(t,e);V(n,r?x(u,e,r,n):u),H(),I(`已移出分组`,`success`)}let q=j?.kind===`assign`||j?.kind===`itemMenu`?j.itemId:void 0,ve=j?.kind===`groupMenu`?j.group.id:void 0,Y=j?.kind===`itemMenu`?j:null,X=j?.kind===`groupMenu`?j:null,Z=j?.kind===`assign`?j:null,Q=Y?t.find(e=>e.items.includes(Y.itemId))??null:null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`tw-nav-ready`,"aria-hidden":`true`}),B.map(n=>n.type===`item`?$(n.id,m)?(0,U.jsx)(ke,{id:n.id,icon:i[n.id],pathname:e,actionOpen:q===n.id,onMenu:e=>K(n.id,e)},n.id):null:(0,U.jsx)(Me,{group:n.group,groups:t,order:u,icons:i,pathname:e,openItem:q,openGroupId:ve,onMenu:he,onItemMenu:K},n.group.id)),Y?(0,U.jsxs)(He,{rect:Y.rect,closing:k.closing,onClose:H,onHoverEnter:W,onHoverLeave:me,children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:L(_(Y.itemId).i18n)}),(0,U.jsxs)(`div`,{className:`tw-nav-group-pop-list`,onMouseOver:e=>{let t=e.target.closest(`.tw-nav-group-pop-item`);t&&t.getAttribute(`data-submenu`)!==`icons`&&(W(),A.close())},children:[Q?(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item is-leave`,onClick:()=>_e(Y.itemId),children:[(0,U.jsx)(Te,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.leaveGroup`)})]}):null,(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>k.open({kind:`assign`,itemId:Y.itemId,rect:Y.rect}),children:[(0,U.jsx)(we,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.assignGroup`)})]}),Q?null:(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=Y.itemId;H(),F({name:``,items:[e]})},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(Se,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.addToGroup`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=Q?.id??null;H(),P(e)},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(De,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.sortMenu`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,"data-submenu":`icons`,onMouseEnter:e=>G(Y.itemId,e.currentTarget),onClick:e=>G(Y.itemId,e.currentTarget),children:[(0,U.jsx)(Ee,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.chooseIcon`)}),(0,U.jsx)(Le,{})]})]})]}):null,M&&Y&&M.itemId===Y.itemId?(0,U.jsx)(Ve,{anchor:M.rect,itemId:M.itemId,current:i[M.itemId],closing:A.closing,onHoverEnter:W,onHoverLeave:me,onPick:e=>{s(le(M.itemId,e)),H(),I(`已更换图标`,`success`)}}):null,X?(0,U.jsxs)(He,{rect:X.rect,closing:k.closing,onClose:H,children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:J(X.group)}),(0,U.jsxs)(`div`,{className:`tw-nav-group-pop-list`,children:[X.group.parentId?null:(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item is-create`,onClick:()=>{let e=X.group.id;H(),F({name:``,items:[],parentId:e})},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(Se,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.addSubgroup`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=X.group;H(),P(e.parentId??null)},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(De,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.sortMenu`)})]}),(0,U.jsxs)(`button`,{type:`button`,className:`tw-nav-group-pop-item`,onClick:()=>{let e=X.group;H(),F({id:e.id,name:e.name,items:[...e.items],parentId:e.parentId})},children:[(0,U.jsx)(`span`,{className:`tw-nav-group-pop-ico`,children:(0,U.jsx)(xe,{})}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:L(`nav.editGroupTitle`)})]})]})]}):null,Z?(0,U.jsxs)(He,{rect:Z.rect,closing:k.closing,onClose:H,children:[(0,U.jsx)(`div`,{className:`tw-nav-group-pop-head`,children:L(`nav.assignGroup`)}),(0,U.jsx)(`div`,{className:`tw-nav-group-pop-list`,children:(()=>{let e=t.find(e=>e.items.includes(Z.itemId))?.id??null,n=Ie(t,u).filter(({group:t})=>t.id!==e);return n.length?n.map(({group:e,indent:t})=>(0,U.jsxs)(`button`,{type:`button`,className:[`tw-nav-group-pop-item`,t?`is-child`:``].filter(Boolean).join(` `),onClick:()=>ge(e.id,Z.itemId),children:[(0,U.jsx)(we,{}),(0,U.jsx)(`span`,{className:`tw-nav-group-pop-name`,children:J(e)})]},e.id)):(0,U.jsx)(`div`,{className:`tw-nav-group-pop-empty`,children:L(e?`nav.noOtherGroups`:`nav.noGroups`)})})()})]}):null,(0,U.jsx)(Ne,{open:S&&!w,draft:v,groups:t,plugins:m,icons:i,onClose:z,onSave:e=>{let n=!t.some(t=>t.id===e.id),r=f(t,e);V(r.groups,l(u,r.groups,r.id));let i=r.groups.find(e=>e.id===r.id);I(n?`已新增分组「${i?J(i):e.name}」`:`已保存分组`,`success`),z()},onDelete:v?.id?()=>T(v.id):void 0}),(0,U.jsx)(Fe,{open:E,focusGroupId:te,nodes:B,groups:t,order:u,visible:e=>$(e,m),onClose:()=>D(!1),onCommit:(e,t)=>{let n=u.filter(e=>p(e,t));V(t,[...e,...n.filter(t=>!e.includes(t))])},onChildCommit:(e,r)=>V(t,n(u,t,e,r))}),(0,U.jsx)(ae,{open:!!w,title:L(`nav.deleteGroup`),message:t.find(e=>e.id===w)?.parentId?L(`nav.deleteSubgroupMsg`):L(`nav.deleteGroupMsg`),confirmLabel:L(`nav.deleteGroup`),cancelLabel:L(`nav.groupCancel`),danger:`outline`,onClose:()=>T(null),onConfirm:()=>{if(w){let e=t.find(e=>e.id===w),n=re(t,w),r=o(t,w);V(r,e?c(u,e,r,n):u),e&&I(`已删除分组「${J(e)}」`,`success`)}z()}})]})}export{Ue as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{t as default}from"./PluginsPage.D5LXPMns.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.DAIyT--R.js";import{a as r,l as i,o as a,r as o,t as s}from"./plugins.Di6uuouN.js";import{o as c}from"./case-exec.BipZCK6G.js";import{t as l}from"./jsx-runtime.DUg_B_vD.js";import{t as u}from"./OverflowHint.pvo2Xc8R.js";import{showToast as d}from"./Toast.BO2NFckG.js";import{$ as f}from"./req-analysis.CIZ_cIJQ.js";import"./settings.DbhUT6Ao.js";import{F as ee,P as te}from"./case-review.DlCarphW.js";import{F as p,v as m}from"./pm.pMOkNqqK.js";import{s as h}from"./fs-tools.3F9MFrLf.js";import{s as g,w as _}from"./tasks.BNBkrFC3.js";import{c as v}from"./report-prompt.CAfZ6RIo.js";import{r as y}from"./test-stats.MEm3K2rB.js";import{a as b}from"./ui-auto-prompt.l_EXfDs5.js";import{s as x,y as S}from"./story-review.BvgXBApZ.js";var C=e(t(),1),w=`/__tb_memory`,T=3e3,E=`你可以使用跨会话长期记忆(本机五轨:user / memory / key / project / daily):
|
|
2
2
|
- 系统可能已在 <memory_snapshot> 注入用户档案、全局事实与项目关键记忆;优先参考。
|
|
3
3
|
- 查历史进展:memory_search 或 memory_read(project / daily 不自动注入)。
|
|
4
4
|
- 用户明确要求记住偏好/全局事实/项目约定:调用 memory_suggest(进待确认,确认后才注入)。
|
|
5
5
|
- 回合进展写入:memory_append 到 project 或 daily(无需确认)。
|
|
6
6
|
- 不要把寒暄、一次性闲聊写入记忆。`,D=[{type:`function`,function:{name:`memory_search`,description:`在五轨记忆中按关键词搜索条目。`,parameters:{type:`object`,properties:{query:{type:`string`,description:`搜索关键词`}},required:[`query`]}}},{type:`function`,function:{name:`memory_read`,description:`读取某一轨的全部条目。target: user|memory|key|project|daily`,parameters:{type:`object`,properties:{target:{type:`string`,enum:[`user`,`memory`,`key`,`project`,`daily`]}},required:[`target`]}}},{type:`function`,function:{name:`memory_suggest`,description:`提议写入用户档案/全局事实/项目关键(user|memory|key)。写入待确认队列,用户采纳后才生效。`,parameters:{type:`object`,properties:{target:{type:`string`,enum:[`user`,`memory`,`key`]},content:{type:`string`,description:`要记住的事实(简洁)`},reason:{type:`string`,description:`为何值得记住`}},required:[`target`,`content`]}}},{type:`function`,function:{name:`memory_append`,description:`向项目日志或每日日志追加进展(直写,无需确认)。`,parameters:{type:`object`,properties:{target:{type:`string`,enum:[`project`,`daily`]},content:{type:`string`}},required:[`target`,`content`]}}}];async function O(e,t={},n){let r=await fetch(`${w}${e}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t),signal:n}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(i.error??`HTTP ${r.status}`);return i}async function k(e){let t=await fetch(`${w}${e}`),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.error??`HTTP ${t.status}`);return n}async function A(){try{let e=await fetch(`${w}/health`,{signal:AbortSignal.timeout(1500)});return e.ok?await e.json():null}catch{return null}}async function j(){try{return(await k(`/config`)).config??null}catch{return null}}async function M(e){return(await O(`/config`,e)).config}async function N(e=``){try{let t=await O(`/snapshot`,{cwd:e},AbortSignal.timeout(T));return typeof t.text==`string`?t.text:``}catch{return``}}async function P(e=``,t=`all`){let n=await O(`/tracks`,{cwd:e,target:t});return t===`all`?{tracks:n.tracks??{},projectId:n.projectId}:{tracks:{[t]:{entries:n.entries??[],path:n.path,target:t}},projectId:n.projectId}}async function F(){return(await k(`/suggestions`)).suggestions??[]}async function I(e){await O(`/suggestions/approve`,{id:e})}async function L(e){await O(`/suggestions/reject`,{id:e})}async function R(e,t,n=``){await O(`/archive`,{target:e,index:t,cwd:n})}async function z(e,t,n=``){await O(`/delete`,{target:e,index:t,cwd:n})}async function B(e,t,n=``){await O(`/archives/delete`,{target:e,index:t,cwd:n})}async function V(e,t=``){return(await O(`/archives`,{target:e,cwd:t})).entries??[]}async function H(e,t,n=``){await O(`/promote`,{target:e,index:t,cwd:n})}async function U(e,t,n=``){await O(`/manual-add`,{target:e,content:t,cwd:n})}async function W(e,t){let n=t?.cwd??``,r=t?.maxChars??8e3;try{let e=await N(n);return e.length>r&&(e=`${e.slice(0,r-20)}\n…\n</memory_snapshot>`),{context:e,hits:[]}}catch{return{context:``,hits:[]}}}var G=/记住|记下|别忘了|以后都|请记得|我喜欢|我的偏好|默认用|默认显示|默认城市|约定|不要再|以后默认/;async function K(e,t=``){let n=e.trim();if(!n||n.length<4||!G.test(n))return!1;let r=n.length>400?`${n.slice(0,400)}…`:n;try{return await O(`/suggest`,{cwd:t,target:/偏好|喜欢|习惯|称呼|默认/.test(n)?`user`:`memory`,content:r,reason:`用户话术触发自动沉淀`}),!0}catch{return!1}}async function q(e,t,n=``){let r={};try{r=JSON.parse(t||`{}`)}catch{return JSON.stringify({error:`invalid JSON arguments`})}try{switch(e){case`memory_search`:{let e=await O(`/search`,{query:r.query,cwd:n});return JSON.stringify(e)}case`memory_read`:{let e=await O(`/tracks`,{target:r.target,cwd:n});return JSON.stringify(e)}case`memory_suggest`:{let e=await O(`/suggest`,{target:r.target,content:r.content,reason:r.reason,cwd:n});return JSON.stringify(e)}case`memory_append`:{let e=await O(`/append`,{target:r.target,content:r.content,cwd:n});return JSON.stringify(e)}case`memory_create_entities`:case`memory_add_observations`:{let e=Array.isArray(r.entities)?r.entities:[],t=Array.isArray(r.observations)?r.observations:[],i=[];for(let t of e){let e=t,n=(e.observations??[]).join(`;`);i.push(n?`${e.name}: ${n}`:String(e.name??``))}for(let e of t){let t=e;i.push(`${t.entityName}: ${(t.contents??[]).join(`;`)}`)}let a=i.filter(Boolean).join(`
|
|
7
|
-
`);if(!a)return JSON.stringify({error:`empty`});let o=await O(`/suggest`,{target:`memory`,content:a,reason:`兼容旧工具调用`,cwd:n});return JSON.stringify(o)}case`memory_create_relations`:return JSON.stringify({ok:!0,skipped:!0,note:`五轨模式不使用关系图`});case`memory_open_nodes`:{let e=await O(`/search`,{query:Array.isArray(r.names)?r.names.join(` `):``,cwd:n});return JSON.stringify(e)}default:return JSON.stringify({error:`unknown tool: ${e}`})}}catch(e){return JSON.stringify({error:e instanceof Error?e.message:String(e)})}}async function J(e){}var Y=l(),X={tasks:`侧栏「任务管理」按状态列出任务;工作台可直接增删改`,todos:`侧栏「待办事项」按状态 / 紧急程度分组;工作台可直接增删改`,projects:`侧栏「项目列表」管理项目并汇总迭代 / 需求 / 缺陷;工作台可直接增删改`,iterations:`侧栏「迭代管理」按项目维护迭代周期、进度与逾期;工作台可直接增删改`,pmRequirements:`侧栏「需求管理」维护需求编号 / 优先级 / 状态与验收标准;工作台可直接增删改`,bugs:`侧栏「缺陷管理」记录严重程度 / 重现步骤与修复状态;工作台可直接增删改`,testStats:`侧栏「测试统计」按维度记录每天的统计数量`,caseExec:`侧栏「用例执行统计」按项目记录用例执行情况`,dashboard:`侧栏「仪表盘」聚合待办 / 任务 / 测试统计;卡片可拖动排序、拖角改宽高,右上角编辑组件`},Z={tasks:g,todos:_,projects:h,iterations:h,pmRequirements:h,bugs:h,testStats:y,caseExec:c,dashboard:_},ne=[{id:`all`,label:`全部`},{id:`on`,label:`已启用`},{id:`off`,label:`未启用`}],Q=o();function re({embedded:e=!1}){let[t,o]=(0,C.useState)(()=>r()),[c,l]=(0,C.useState)(null),[u,h]=(0,C.useState)(null),[g,_]=(0,C.useState)(null),[y,w]=(0,C.useState)(!0),[T,E]=(0,C.useState)(``),[D,O]=(0,C.useState)(`all`),[k,j]=(0,C.useState)(null),[M,N]=(0,C.useState)({});async function P(){w(!0);try{let[e,t,n,r,i,a,o,s,c,u,d]=await Promise.all([A(),p(),Z.tasks(),Z.todos(),Z.projects(),Z.iterations(),Z.pmRequirements(),Z.bugs(),Z.testStats(),Z.caseExec(),Z.dashboard()]);l(e),h(t),_({tasks:n,todos:r,projects:i,iterations:a,pmRequirements:o,bugs:s,testStats:c,caseExec:u,dashboard:d})}finally{w(!1)}}(0,C.useEffect)(()=>{let e=a(e=>o(e));return n().then(()=>{o(r()),P()}),()=>{e()}},[]);function F(e){if(e===`cases`)return{available:!0,detail:`侧栏「用例管理」浏览与维护本空间用例库`};if(e===`caseGen`)return t.cases?{available:!0,detail:`对话输入 / 打开配置面板,生成用例并写入用例库`}:{available:!1,detail:`需先启用「用例管理」,生成结果才能写入用例列表`};if(e===`prompts`)return{available:!0,detail:`侧栏「提示词管理」浏览与维护本空间提示词库`};if(e===`promptGen`)return t.prompts?{available:!0,detail:`对话输入 / 打开配置面板,生成提示词并写入提示词库`}:{available:!1,detail:`需先启用「提示词管理」,生成结果才能写入提示词列表`};if(e===`knowledgeLib`)return{available:!0,detail:`侧栏「知识库管理」浏览与维护本空间知识库`};if(e===`requirements`)return{available:!0,detail:`侧栏「需求文档库」浏览与维护本空间需求文档`};if(e===`templates`)return{available:!0,detail:`侧栏「测试模板库」浏览与维护本空间用例模板`};if(e===`reports`)return{available:!0,detail:`侧栏「工作汇报」按日报 / 周报 / 月报列出汇报文件`};if(e===`tasks`||e===`todos`||e===`projects`||e===`iterations`||e===`pmRequirements`||e===`bugs`||e===`testStats`||e===`caseExec`||e===`dashboard`){let t=g?.[e];return t===void 0?{available:y?null:!1,detail:y?`探测中…`:`需本地服务`}:t?{available:!0,detail:X[e]}:{available:!1,detail:`需本地服务(npm run dev / lantern web)`}}return e===`knowledgeGen`?t.knowledgeLib?{available:!0,detail:`对话输入 / 打开配置面板,生成文档并写入知识库`}:{available:!1,detail:`需先启用「知识库管理」,生成结果才能写入知识库列表`}:e===`memory`?y&&c===null?{available:null,detail:`探测中…`}:c?.ok?{available:!0,detail:`已连接 · ${c.entryCount??c.entityCount??0} 条记忆 / 待确认 ${c.suggestionCount??0}`}:{available:!1,detail:`本地记忆服务未就绪`}:e===`knowledge`?{available:!0,detail:`对话输入 @ 可引用知识库与模板文档`}:e===`pluginDev`?y&&u===null?{available:null,detail:`探测中…`}:u?.ok?{available:!0,detail:`固定提示词开发扩展插件;先评估确认,再改代码并入「扩展插件」`}:{available:!1,detail:`需本地文件服务:开发要读写项目源码`}:{available:!1,detail:`未知`}}function I(e){let n=i(e,!t[e]),r=!!n[e],a=s.find(t=>t.id===e)?.name??e;o(n),d(r?`已启用「${a}」`:`已停用「${a}」`,`success`),e===`reports`&&v(!!n.reports).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`工作汇报提示词没生成成功:${t}`,`error`)}),e===`uiAuto`&&b(!!n.uiAuto).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`UI自动化测试提示词没生成成功:${t}`,`error`)}),e===`reqAnalysis`&&f(!!n.reqAnalysis).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`需求分析提示词没生成成功:${t}`,`error`)}),e===`storyReview`&&x(!!n.storyReview).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`用户故事审查提示词没生成成功:${t}`,`error`)}),e===`testPoints`&&S(!!n.testPoints).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`测试点生成提示词没生成成功:${t}`,`error`)}),(e===`caseReview`||e===`cases`)&&ee(!!n.caseReview).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`用例质量评审提示词没生成成功:${t}`,`error`)}),(e===`caseBlindspot`||e===`cases`)&&te(!!n.caseBlindspot).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`场景遗漏补全提示词没生成成功:${t}`,`error`)}),(e===`projects`||e===`iterations`||e===`pmRequirements`||e===`bugs`)&&n[e]&&m().catch(e=>{console.warn(`[pm] 同步项目管理数据目录失败`,e)})}let L=(0,C.useMemo)(()=>s.filter(e=>t[e.id]).length,[t]),R=T.trim().toLowerCase(),z=(0,C.useMemo)(()=>Q.map(e=>({...e,items:e.items.filter(e=>{let n=!R||e.name.toLowerCase().includes(R)||e.id.toLowerCase().includes(R)||e.description.toLowerCase().includes(R),r=D===`all`||(D===`on`?t[e.id]:!t[e.id]);return n&&r})})).filter(e=>e.items.length>0),[t,R,D]);return(0,Y.jsx)(`div`,{className:`tw-plugins-page overflow-y-auto ${e?`h-full min-h-0 flex-1`:`min-h-screen`}`,children:(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-[1080px] ${e?`px-6 py-5`:`px-6 py-7`}`,children:[(0,Y.jsxs)(`header`,{className:`tw-plugins-head`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-[20px] font-semibold tracking-tight text-stone-900`,children:`我的插件`}),(0,Y.jsxs)(`p`,{className:`mt-1.5 text-[13px] leading-6 text-stone-500`,children:[`按用途分组的扩展能力,开关保存在本机;会话 / 全局内置能力在`,(0,Y.jsx)(`span`,{className:`mx-1 rounded bg-stone-100 px-1 py-0.5 text-[12px] text-stone-600`,children:`设置 → 内置插件`}),`里查看。`]})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-stats`,"aria-label":`插件概览`,children:[(0,Y.jsxs)(`div`,{className:`tw-plugins-stat`,children:[(0,Y.jsx)(`span`,{className:`tw-plugins-stat-num`,children:s.length}),(0,Y.jsx)(`span`,{className:`tw-plugins-stat-label`,children:`个插件`})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-stat`,children:[(0,Y.jsx)(`span`,{className:`tw-plugins-stat-num is-on`,children:L}),(0,Y.jsx)(`span`,{className:`tw-plugins-stat-label`,children:`已启用`})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-stat`,children:[(0,Y.jsx)(`span`,{className:`tw-plugins-stat-num`,children:Q.length}),(0,Y.jsx)(`span`,{className:`tw-plugins-stat-label`,children:`个分类`})]})]})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-toolbar`,children:[(0,Y.jsxs)(`label`,{className:`relative block w-full max-w-72`,children:[(0,Y.jsxs)(`svg`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-stone-400`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:[(0,Y.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,Y.jsx)(`path`,{d:`m20 20-3.5-3.5`})]}),(0,Y.jsx)(`input`,{value:T,onChange:e=>E(e.target.value),placeholder:`搜索插件名 / 作用`,className:`h-9 w-full rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-[13px] text-stone-800 outline-none transition-colors placeholder:text-stone-400 focus:border-[#4176e6]`})]}),(0,Y.jsx)(`div`,{className:`tw-plugins-pills`,role:`group`,"aria-label":`按状态筛选`,children:ne.map(e=>(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":D===e.id,onClick:()=>O(e.id),children:e.label},e.id))})]}),(0,Y.jsxs)(`div`,{className:`mt-4 space-y-6`,children:[z.map(e=>{let n=!!M[e.category],r=e.items.filter(e=>t[e.id]).length;return(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":!n,onClick:()=>N(t=>({...t,[e.category]:!n})),className:`mb-2.5 flex w-full items-center gap-2 text-left`,children:[(0,Y.jsx)($,{className:`h-3.5 w-3.5 shrink-0 text-stone-400 transition-transform ${n?`-rotate-90`:``}`}),(0,Y.jsx)(`span`,{className:`text-[13px] font-semibold text-stone-800`,children:e.category}),(0,Y.jsxs)(`span`,{className:`rounded-full bg-stone-100 px-1.5 py-0.5 text-[11px] tabular-nums text-stone-500`,children:[r,`/`,e.items.length]}),(0,Y.jsx)(`span`,{className:`ml-1 h-px flex-1 bg-stone-200/70`,"aria-hidden":`true`})]}),n?null:(0,Y.jsx)(`ul`,{className:`tw-anim-list tw-plugin-grid`,children:e.items.map(e=>{let n=t[e.id],r=F(e.id),i=k===`ext:${e.id}`;return(0,Y.jsx)(`li`,{className:`relative z-0 min-w-0 overflow-visible hover:z-40 focus-within:z-40${i?` z-40`:``}`,children:(0,Y.jsx)(ie,{open:i,onToggleOpen:()=>j(i?null:`ext:${e.id}`),title:e.name,subtitle:e.description,badge:(0,Y.jsxs)(`span`,{className:`rounded border border-stone-200 px-1.5 py-0.5 text-[11px] tabular-nums text-stone-400`,children:[`v`,e.version]}),trailing:e.alwaysOn?(0,Y.jsx)(`span`,{className:`rounded border border-stone-200 px-1.5 py-0.5 text-[11px] text-stone-500`,children:`内置`}):(0,Y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n,"aria-label":`${n?`关闭`:`打开`} ${e.name}`,onClick:()=>I(e.id),className:`tw-toggle`,children:(0,Y.jsx)(`span`,{className:`tw-toggle-knob`})}),fullName:`@lh-plugins/${e.id}`,configLabel:e.alwaysOn?`内置常开`:n?`已启用`:`未启用`,runLabel:n&&r.available===!0?`运行中`:`已停用`,extra:r.detail})},e.id)})})]},e.category)}),z.length?null:(0,Y.jsxs)(`div`,{className:`rounded-xl border border-dashed border-stone-200 bg-white/60 px-4 py-12 text-center`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-stone-600`,children:`没有匹配的插件`}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-stone-400`,children:`换个关键词,或把状态筛选切回「全部」。`})]})]})]})})}function ie(e){let{open:t,onToggleOpen:n,title:r,subtitle:i,badge:a,trailing:o,fullName:s,configLabel:c,runLabel:l,extra:d}=e;return(0,Y.jsxs)(`div`,{className:`tw-plugin-card group/card relative z-0 self-start w-full overflow-visible rounded-xl border bg-white transition-colors hover:z-40 focus-within:z-40 ${t?`z-40 border-[#4176e6]/50 shadow-sm`:`border-stone-200 hover:border-stone-300`}`,children:[(0,Y.jsxs)(`div`,{className:`relative flex h-17 items-start gap-3 overflow-visible px-4 py-3`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:n,className:`relative h-full min-w-0 flex-1 overflow-visible text-left outline-none focus:outline-none`,"aria-expanded":t,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`min-w-0 truncate text-[14px] font-medium text-stone-900`,children:r}),a,(0,Y.jsx)($,{className:`h-3.5 w-3.5 shrink-0 text-stone-400 transition-transform duration-300 ease-out ${t?`rotate-180`:``}`})]}),(0,Y.jsx)(u,{text:i,className:`mt-1 block min-w-0 truncate text-[13px] leading-5 text-stone-500`,disabled:t})]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 self-start pt-0.5`,children:o})]}),(0,Y.jsx)(`div`,{className:`tw-collapse ${t?`is-open`:``}`,"aria-hidden":!t,children:(0,Y.jsx)(`div`,{className:`tw-collapse-inner`,children:(0,Y.jsx)(`div`,{className:`border-t border-stone-100 px-4 pb-3 pt-0`,children:(0,Y.jsxs)(`dl`,{className:`mt-2.5 space-y-1.5 text-[13px]`,children:[(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`完整名称`}),(0,Y.jsx)(`dd`,{className:`min-w-0 break-all font-mono text-[12px] text-stone-700`,children:s})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`配置状态`}),(0,Y.jsx)(`dd`,{className:`text-stone-700`,children:c})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`运行状态`}),(0,Y.jsx)(`dd`,{className:l===`运行中`?`text-emerald-600`:`text-stone-500`,children:l})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`简介`}),(0,Y.jsx)(`dd`,{className:`text-[12px] leading-5 text-stone-500`,children:i})]}),d?(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`说明`}),(0,Y.jsx)(`dd`,{className:`text-[12px] leading-5 text-stone-500`,children:d})]}):null]})})})})]})}function $({className:e}){return(0,Y.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,className:e,"aria-hidden":!0,children:(0,Y.jsx)(`path`,{d:`m6 9 6 6 6-6`})})}export{W as _,R as a,M as b,J as c,A as d,P as f,H as g,K as h,I as i,V as l,U as m,E as n,B as o,F as p,D as r,z as s,re as t,j as u,L as v,q as y};
|
|
7
|
+
`);if(!a)return JSON.stringify({error:`empty`});let o=await O(`/suggest`,{target:`memory`,content:a,reason:`兼容旧工具调用`,cwd:n});return JSON.stringify(o)}case`memory_create_relations`:return JSON.stringify({ok:!0,skipped:!0,note:`五轨模式不使用关系图`});case`memory_open_nodes`:{let e=await O(`/search`,{query:Array.isArray(r.names)?r.names.join(` `):``,cwd:n});return JSON.stringify(e)}default:return JSON.stringify({error:`unknown tool: ${e}`})}}catch(e){return JSON.stringify({error:e instanceof Error?e.message:String(e)})}}async function J(e){}var Y=l(),X={tasks:`侧栏「任务管理」按状态列出任务;工作台可直接增删改`,todos:`侧栏「待办事项」按状态 / 紧急程度分组;工作台可直接增删改`,projects:`侧栏「项目列表」管理项目并汇总迭代 / 需求 / 缺陷;工作台可直接增删改`,iterations:`侧栏「迭代管理」按项目维护迭代周期、进度与逾期;工作台可直接增删改`,pmRequirements:`侧栏「需求管理」维护需求编号 / 优先级 / 状态与验收标准;工作台可直接增删改`,bugs:`侧栏「缺陷管理」记录严重程度 / 重现步骤与修复状态;工作台可直接增删改`,testStats:`侧栏「测试统计」按维度记录每天的统计数量`,caseExec:`侧栏「用例执行统计」按项目记录用例执行情况`,dashboard:`侧栏「仪表盘」聚合待办 / 任务 / 测试统计;卡片可拖动排序、拖角改宽高,右上角编辑组件`},Z={tasks:g,todos:_,projects:m,iterations:m,pmRequirements:m,bugs:m,testStats:y,caseExec:c,dashboard:_},ne=[{id:`all`,label:`全部`},{id:`on`,label:`已启用`},{id:`off`,label:`未启用`}],Q=o();function re({embedded:e=!1}){let[t,o]=(0,C.useState)(()=>r()),[c,l]=(0,C.useState)(null),[u,m]=(0,C.useState)(null),[g,_]=(0,C.useState)(null),[y,w]=(0,C.useState)(!0),[T,E]=(0,C.useState)(``),[D,O]=(0,C.useState)(`all`),[k,j]=(0,C.useState)(null),[M,N]=(0,C.useState)({});async function P(){w(!0);try{let[e,t,n,r,i,a,o,s,c,u,d]=await Promise.all([A(),h(),Z.tasks(),Z.todos(),Z.projects(),Z.iterations(),Z.pmRequirements(),Z.bugs(),Z.testStats(),Z.caseExec(),Z.dashboard()]);l(e),m(t),_({tasks:n,todos:r,projects:i,iterations:a,pmRequirements:o,bugs:s,testStats:c,caseExec:u,dashboard:d})}finally{w(!1)}}(0,C.useEffect)(()=>{let e=a(e=>o(e));return n().then(()=>{o(r()),P()}),()=>{e()}},[]);function F(e){if(e===`cases`)return{available:!0,detail:`侧栏「用例管理」浏览与维护本空间用例库`};if(e===`caseGen`)return t.cases?{available:!0,detail:`对话输入 / 打开配置面板,生成用例并写入用例库`}:{available:!1,detail:`需先启用「用例管理」,生成结果才能写入用例列表`};if(e===`prompts`)return{available:!0,detail:`侧栏「提示词管理」浏览与维护本空间提示词库`};if(e===`promptGen`)return t.prompts?{available:!0,detail:`对话输入 / 打开配置面板,生成提示词并写入提示词库`}:{available:!1,detail:`需先启用「提示词管理」,生成结果才能写入提示词列表`};if(e===`knowledgeLib`)return{available:!0,detail:`侧栏「知识库管理」浏览与维护本空间知识库`};if(e===`requirements`)return{available:!0,detail:`侧栏「需求文档库」浏览与维护本空间需求文档`};if(e===`templates`)return{available:!0,detail:`侧栏「测试模板库」浏览与维护本空间用例模板`};if(e===`reports`)return{available:!0,detail:`侧栏「工作汇报」按日报 / 周报 / 月报列出汇报文件`};if(e===`tasks`||e===`todos`||e===`projects`||e===`iterations`||e===`pmRequirements`||e===`bugs`||e===`testStats`||e===`caseExec`||e===`dashboard`){let t=g?.[e];return t===void 0?{available:y?null:!1,detail:y?`探测中…`:`需本地服务`}:t?{available:!0,detail:X[e]}:{available:!1,detail:`需本地服务(npm run dev / lantern web)`}}return e===`knowledgeGen`?t.knowledgeLib?{available:!0,detail:`对话输入 / 打开配置面板,生成文档并写入知识库`}:{available:!1,detail:`需先启用「知识库管理」,生成结果才能写入知识库列表`}:e===`memory`?y&&c===null?{available:null,detail:`探测中…`}:c?.ok?{available:!0,detail:`已连接 · ${c.entryCount??c.entityCount??0} 条记忆 / 待确认 ${c.suggestionCount??0}`}:{available:!1,detail:`本地记忆服务未就绪`}:e===`knowledge`?{available:!0,detail:`对话输入 @ 可引用知识库与模板文档`}:e===`pluginDev`?y&&u===null?{available:null,detail:`探测中…`}:u?.ok?{available:!0,detail:`固定提示词开发扩展插件;先评估确认,再改代码并入「扩展插件」`}:{available:!1,detail:`需本地文件服务:开发要读写项目源码`}:{available:!1,detail:`未知`}}function I(e){let n=i(e,!t[e]),r=!!n[e],a=s.find(t=>t.id===e)?.name??e;o(n),d(r?`已启用「${a}」`:`已停用「${a}」`,`success`),e===`reports`&&v(!!n.reports).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`工作汇报提示词没生成成功:${t}`,`error`)}),e===`uiAuto`&&b(!!n.uiAuto).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`UI自动化测试提示词没生成成功:${t}`,`error`)}),e===`reqAnalysis`&&f(!!n.reqAnalysis).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`需求分析提示词没生成成功:${t}`,`error`)}),e===`storyReview`&&x(!!n.storyReview).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`用户故事审查提示词没生成成功:${t}`,`error`)}),e===`testPoints`&&S(!!n.testPoints).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`测试点生成提示词没生成成功:${t}`,`error`)}),(e===`caseReview`||e===`cases`)&&ee(!!n.caseReview).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`用例质量评审提示词没生成成功:${t}`,`error`)}),(e===`caseBlindspot`||e===`cases`)&&te(!!n.caseBlindspot).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`场景遗漏补全提示词没生成成功:${t}`,`error`)}),(e===`projects`||e===`iterations`||e===`pmRequirements`||e===`bugs`)&&n[e]&&p().catch(e=>{console.warn(`[pm] 同步项目管理数据目录失败`,e)})}let L=(0,C.useMemo)(()=>s.filter(e=>t[e.id]).length,[t]),R=T.trim().toLowerCase(),z=(0,C.useMemo)(()=>Q.map(e=>({...e,items:e.items.filter(e=>{let n=!R||e.name.toLowerCase().includes(R)||e.id.toLowerCase().includes(R)||e.description.toLowerCase().includes(R),r=D===`all`||(D===`on`?t[e.id]:!t[e.id]);return n&&r})})).filter(e=>e.items.length>0),[t,R,D]);return(0,Y.jsx)(`div`,{className:`tw-plugins-page overflow-y-auto ${e?`h-full min-h-0 flex-1`:`min-h-screen`}`,children:(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-[1080px] ${e?`px-6 py-5`:`px-6 py-7`}`,children:[(0,Y.jsxs)(`header`,{className:`tw-plugins-head`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-[20px] font-semibold tracking-tight text-stone-900`,children:`我的插件`}),(0,Y.jsxs)(`p`,{className:`mt-1.5 text-[13px] leading-6 text-stone-500`,children:[`按用途分组的扩展能力,开关保存在本机;会话 / 全局内置能力在`,(0,Y.jsx)(`span`,{className:`mx-1 rounded bg-stone-100 px-1 py-0.5 text-[12px] text-stone-600`,children:`设置 → 内置插件`}),`里查看。`]})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-stats`,"aria-label":`插件概览`,children:[(0,Y.jsxs)(`div`,{className:`tw-plugins-stat`,children:[(0,Y.jsx)(`span`,{className:`tw-plugins-stat-num`,children:s.length}),(0,Y.jsx)(`span`,{className:`tw-plugins-stat-label`,children:`个插件`})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-stat`,children:[(0,Y.jsx)(`span`,{className:`tw-plugins-stat-num is-on`,children:L}),(0,Y.jsx)(`span`,{className:`tw-plugins-stat-label`,children:`已启用`})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-stat`,children:[(0,Y.jsx)(`span`,{className:`tw-plugins-stat-num`,children:Q.length}),(0,Y.jsx)(`span`,{className:`tw-plugins-stat-label`,children:`个分类`})]})]})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-toolbar`,children:[(0,Y.jsxs)(`label`,{className:`relative block w-full max-w-72`,children:[(0,Y.jsxs)(`svg`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-stone-400`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:[(0,Y.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,Y.jsx)(`path`,{d:`m20 20-3.5-3.5`})]}),(0,Y.jsx)(`input`,{value:T,onChange:e=>E(e.target.value),placeholder:`搜索插件名 / 作用`,className:`h-9 w-full rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-[13px] text-stone-800 outline-none transition-colors placeholder:text-stone-400 focus:border-[#4176e6]`})]}),(0,Y.jsx)(`div`,{className:`tw-plugins-pills`,role:`group`,"aria-label":`按状态筛选`,children:ne.map(e=>(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":D===e.id,onClick:()=>O(e.id),children:e.label},e.id))})]}),(0,Y.jsxs)(`div`,{className:`mt-4 space-y-6`,children:[z.map(e=>{let n=!!M[e.category],r=e.items.filter(e=>t[e.id]).length;return(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":!n,onClick:()=>N(t=>({...t,[e.category]:!n})),className:`mb-2.5 flex w-full items-center gap-2 text-left`,children:[(0,Y.jsx)($,{className:`h-3.5 w-3.5 shrink-0 text-stone-400 transition-transform ${n?`-rotate-90`:``}`}),(0,Y.jsx)(`span`,{className:`text-[13px] font-semibold text-stone-800`,children:e.category}),(0,Y.jsxs)(`span`,{className:`rounded-full bg-stone-100 px-1.5 py-0.5 text-[11px] tabular-nums text-stone-500`,children:[r,`/`,e.items.length]}),(0,Y.jsx)(`span`,{className:`ml-1 h-px flex-1 bg-stone-200/70`,"aria-hidden":`true`})]}),n?null:(0,Y.jsx)(`ul`,{className:`tw-anim-list tw-plugin-grid`,children:e.items.map(e=>{let n=t[e.id],r=F(e.id),i=k===`ext:${e.id}`;return(0,Y.jsx)(`li`,{className:`relative z-0 min-w-0 overflow-visible hover:z-40 focus-within:z-40${i?` z-40`:``}`,children:(0,Y.jsx)(ie,{open:i,onToggleOpen:()=>j(i?null:`ext:${e.id}`),title:e.name,subtitle:e.description,badge:(0,Y.jsxs)(`span`,{className:`rounded border border-stone-200 px-1.5 py-0.5 text-[11px] tabular-nums text-stone-400`,children:[`v`,e.version]}),trailing:e.alwaysOn?(0,Y.jsx)(`span`,{className:`rounded border border-stone-200 px-1.5 py-0.5 text-[11px] text-stone-500`,children:`内置`}):(0,Y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n,"aria-label":`${n?`关闭`:`打开`} ${e.name}`,onClick:()=>I(e.id),className:`tw-toggle`,children:(0,Y.jsx)(`span`,{className:`tw-toggle-knob`})}),fullName:`@lh-plugins/${e.id}`,configLabel:e.alwaysOn?`内置常开`:n?`已启用`:`未启用`,runLabel:n&&r.available===!0?`运行中`:`已停用`,extra:r.detail})},e.id)})})]},e.category)}),z.length?null:(0,Y.jsxs)(`div`,{className:`rounded-xl border border-dashed border-stone-200 bg-white/60 px-4 py-12 text-center`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-stone-600`,children:`没有匹配的插件`}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-stone-400`,children:`换个关键词,或把状态筛选切回「全部」。`})]})]})]})})}function ie(e){let{open:t,onToggleOpen:n,title:r,subtitle:i,badge:a,trailing:o,fullName:s,configLabel:c,runLabel:l,extra:d}=e;return(0,Y.jsxs)(`div`,{className:`tw-plugin-card group/card relative z-0 self-start w-full overflow-visible rounded-xl border bg-white transition-colors hover:z-40 focus-within:z-40 ${t?`z-40 border-[#4176e6]/50 shadow-sm`:`border-stone-200 hover:border-stone-300`}`,children:[(0,Y.jsxs)(`div`,{className:`relative flex h-17 items-start gap-3 overflow-visible px-4 py-3`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:n,className:`relative h-full min-w-0 flex-1 overflow-visible text-left outline-none focus:outline-none`,"aria-expanded":t,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`min-w-0 truncate text-[14px] font-medium text-stone-900`,children:r}),a,(0,Y.jsx)($,{className:`h-3.5 w-3.5 shrink-0 text-stone-400 transition-transform duration-300 ease-out ${t?`rotate-180`:``}`})]}),(0,Y.jsx)(u,{text:i,className:`mt-1 block min-w-0 truncate text-[13px] leading-5 text-stone-500`,disabled:t})]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 self-start pt-0.5`,children:o})]}),(0,Y.jsx)(`div`,{className:`tw-collapse ${t?`is-open`:``}`,"aria-hidden":!t,children:(0,Y.jsx)(`div`,{className:`tw-collapse-inner`,children:(0,Y.jsx)(`div`,{className:`border-t border-stone-100 px-4 pb-3 pt-0`,children:(0,Y.jsxs)(`dl`,{className:`mt-2.5 space-y-1.5 text-[13px]`,children:[(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`完整名称`}),(0,Y.jsx)(`dd`,{className:`min-w-0 break-all font-mono text-[12px] text-stone-700`,children:s})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`配置状态`}),(0,Y.jsx)(`dd`,{className:`text-stone-700`,children:c})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`运行状态`}),(0,Y.jsx)(`dd`,{className:l===`运行中`?`text-emerald-600`:`text-stone-500`,children:l})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`简介`}),(0,Y.jsx)(`dd`,{className:`text-[12px] leading-5 text-stone-500`,children:i})]}),d?(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`说明`}),(0,Y.jsx)(`dd`,{className:`text-[12px] leading-5 text-stone-500`,children:d})]}):null]})})})})]})}function $({className:e}){return(0,Y.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,className:e,"aria-hidden":!0,children:(0,Y.jsx)(`path`,{d:`m6 9 6 6 6-6`})})}export{W as _,R as a,M as b,J as c,A as d,P as f,H as g,K as h,I as i,V as l,U as m,E as n,B as o,F as p,D as r,z as s,re as t,j as u,L as v,q as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{s as n}from"./plugins.CVM1IaoC.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";import{t as ee}from"./ConfirmDialog.CsMwWevK.js";import{c as te,d as ne,i as re,l as ie,n as ae,o as oe,r as se,s as ce,t as i}from"./ColumnResize.BgYkV9Iy.js";import{n as le,t as ue}from"./DocsPager.B9VhI6E3.js";import{t as a}from"./SelectDropdown.apWlFGbA.js";import{showToast as o}from"./Toast.BO2NFckG.js";import{A as s,L as c,M as de,N as fe,R as pe,b as me,g as he,h as ge,i as _e,k as l,m as ve,n as ye,p as be,r as u,t as d}from"./pm.pMOkNqqK.js";import{A as xe,C as Se,D as Ce,E as we,O as f,S as p,_ as m,a as h,c as Te,d as Ee,f as g,g as De,h as Oe,k as ke,l as Ae,m as _,n as je,p as Me,s as v,t as Ne,u as Pe,y}from"./PmShared.BrBicDMN.js";var b=e(t(),1),x=r(),Fe=[{key:`id`,width:88,min:72},{key:`title`,width:280,min:160},{key:`severity`,width:100,min:80},{key:`status`,width:120,min:96}],Ie={key:`project`,width:140,min:100},S=[{key:`iteration`,width:120,min:88},{key:`filler`,filler:!0},{key:`action`,width:76,min:64}],Le=20,Re=`tw.pm-bugs.page-size.v1`,ze=[`all`,...u],Be=[`all`,...d],Ve=`pm.bugs.project`,He=`pm.bugs.iteration`,Ue=`pm.bugs.status`,We=`pm.bugs.severity`,Ge=`pm.bugs.keyword`,Ke=d.map(e=>({value:e,label:ye[e]})),qe=u.map(e=>({value:e,label:_e[e]}));function Je(e=``){return{projectId:e,iterationId:``,requirementId:``,title:``,severity:`minor`,status:`pending`,reproduceSteps:``,expectedResult:``,actualResult:``,environment:``,githubIssue:``,attachment:``,remark:``}}function Ye(e){try{let t=new URL(e,`http://localhost`).searchParams.get(`p`)??``;return/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(t)}catch{return!1}}function C({scopeProjectId:e=``}={}){let t=!!e,r=ke(`bugs`),{store:u,live:d,loading:C,error:Xe,setError:w,reload:T}=xe(),[E,D]=f(Ve,`all`),O=e||E,[k,A]=f(He,`all`),[j,Ze]=Ce(Ue,ze,`all`),[M,Qe]=Ce(We,Be,`all`),[N,$e]=f(Ge),[et,P]=(0,b.useState)(1),[F,tt]=le(Le,Re),[I,L]=(0,b.useState)(null),[R,z]=(0,b.useState)(!1),[B,V]=(0,b.useState)(!1),H=(0,b.useRef)(null),U=(0,b.useRef)(new Set),[W,G]=(0,b.useState)(null),[nt,K]=(0,b.useState)(null),q=(0,b.useMemo)(()=>s(I?.attachment??``),[I?.attachment]),J=(0,b.useMemo)(()=>t?[...Fe,...S]:[...Fe,Ie,...S],[t]),Y=ie(t?`pm.bugs.cols.scoped.v1`:`pm.bugs.cols.v1`,J),rt=ne(t?`pm.bugs.scroll.scoped`:`pm.bugs.scroll`),it=Y.widthOf(`id`)??88;(0,b.useEffect)(()=>{for(let e of q)U.current.add(e.url)},[q]);let at=(0,b.useMemo)(()=>[{value:`all`,label:`全部项目`},...u.projects.map(e=>({value:e.id,label:e.name}))],[u.projects]),ot=(0,b.useMemo)(()=>[{value:`all`,label:`全部迭代`},...u.iterations.filter(e=>O===`all`||e.projectId===O).map(e=>({value:e.id,label:e.name}))],[u.iterations,O]),st=(0,b.useMemo)(()=>{let e=new Map(u.projects.map(e=>[e.id,e.name]));return t=>e.get(t)??`—`},[u.projects]),ct=(0,b.useMemo)(()=>{let e=new Map(u.iterations.map(e=>[e.id,e.name]));return t=>t?e.get(t)??`—`:`—`},[u.iterations]),X=(0,b.useMemo)(()=>de(me(u.bugs,{projectId:O,iterationId:k,status:j,severity:M,keyword:N})),[u.bugs,O,k,j,M,N]),Z=t?u.bugs.filter(e=>e.projectId===O).length:u.bugs.length,lt=Math.max(1,Math.ceil(X.length/F)),Q=Math.min(et,lt),ut=X.slice((Q-1)*F,Q*F);(0,b.useEffect)(()=>{t||d===!0&&E!==`all`&&!u.projects.some(e=>e.id===E)&&D(`all`)},[d,u.projects,E,D,t]),(0,b.useEffect)(()=>{d===!0&&k!==`all`&&!u.iterations.some(e=>e.id===k&&(O===`all`||e.projectId===O))&&A(`all`)},[d,u.iterations,O,k,A]);let dt=I?fe(u.iterations.filter(e=>e.projectId===I.projectId)):[],ft=I?u.requirements.filter(e=>e.projectId===I.projectId):[];async function pt(){if(!I)return;if(!I.projectId){w(`请先选择所属项目`);return}let e=I.reproduceSteps.trim();if(!e){w(`缺陷描述不能为空`);return}let t=be(e);z(!0);try{let n={projectId:I.projectId,iterationId:I.iterationId,requirementId:I.requirementId,title:t,severity:I.severity,status:I.status,reproduceSteps:e,expectedResult:I.expectedResult,actualResult:I.actualResult,environment:I.environment,githubIssue:I.githubIssue,attachment:I.attachment,remark:I.remark};I.id?await c(`bugs`,I.id,n):await ge(`bugs`,[n]);let r=!!I.id;L(null),U.current.clear(),w(``),await T(!0),o(r?`已保存缺陷`:`已新建缺陷`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);w(t),o(`保存缺陷失败:${t}`,`error`)}finally{z(!1)}}let $=(0,b.useCallback)(async e=>{if(e&&e.length){V(!0);try{let t=await pe(Array.from(e));L(e=>{if(!e)return e;let n=s(e.attachment);return{...e,attachment:l([...n,...t])}}),w(``)}catch(e){w(e instanceof Error?e.message:String(e))}finally{V(!1),H.current&&(H.current.value=``)}}},[w]),mt=I!==null;(0,b.useEffect)(()=>{if(!mt)return;let e=e=>{let t=Array.from(e.clipboardData?.files??[]);t.length&&(e.preventDefault(),$(t))};return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[mt,$]);async function ht(e){if(!I)return;let t=l(q.filter(t=>t.url!==e));if(I.id)try{await c(`bugs`,I.id,{attachment:t}),await T(!0)}catch(e){w(e instanceof Error?e.message:String(e));return}L(e=>e&&{...e,attachment:t}),ve([e],I.id??``)}function gt(){let e=[...U.current,...q.map(e=>e.url)];U.current.clear(),L(null),e.length&&ve(e)}async function _t(e,t){z(!0);try{await c(`bugs`,e.id,{status:t}),await T(!0)}catch(e){w(e instanceof Error?e.message:String(e))}finally{z(!1)}}async function vt(){let e=W;if(e){G(null),z(!0);try{await he(`bugs`,[e.id]),await T(!0),o(`已删除缺陷`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);w(t),o(`删除缺陷失败:${t}`,`error`)}finally{z(!1)}}}if(!r.ready)return(0,x.jsx)(De,{label:`正在读取插件开关`});if(!r.on)return(0,x.jsx)(m,{children:n(`bugs`)});if(d===null)return(0,x.jsx)(De,{label:`正在连接项目管理服务`});if(!d)return(0,x.jsx)(m,{children:`缺陷管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`});if(u.projects.length===0&&!C&&!t)return(0,x.jsx)(m,{children:`还没有项目。请先在「项目列表」里新建一个项目,再回来记录缺陷。`});let yt=[{value:`all`,label:`全部`},...qe];return(0,x.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,x.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,x.jsxs)(`div`,{className:`text-xs text-stone-400`,children:[`共 `,(0,x.jsx)(`span`,{className:`font-medium text-stone-600`,children:Z}),` 条缺陷`,X.length===Z?``:` · 筛选出 ${X.length} 条`]}),(0,x.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[t?null:(0,x.jsx)(a,{flat:!0,showCheck:!1,ariaLabel:`按项目筛选缺陷`,className:`w-36`,options:at,value:E,onChange:e=>{D(e),A(`all`),P(1)}}),(0,x.jsx)(a,{flat:!0,showCheck:!1,ariaLabel:`按迭代筛选缺陷`,className:`w-32`,options:ot,value:k,onChange:e=>{A(e),P(1)}}),(0,x.jsx)(a,{flat:!0,showCheck:!1,ariaLabel:`按严重程度筛选缺陷`,className:`w-32`,options:[{value:`all`,label:`全部严重程度`},...Ke],value:M,onChange:e=>{Qe(e),P(1)}}),(0,x.jsxs)(`label`,{className:`relative block`,children:[(0,x.jsx)(_,{name:`search`,size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-stone-400`}),(0,x.jsx)(`input`,{value:N,onChange:e=>{$e(e.target.value),P(1)},placeholder:`搜索编号 / 标题…`,className:`h-9 w-48 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,x.jsxs)(`button`,{type:`button`,disabled:R,onClick:()=>L(Je(O===`all`?``:O)),className:`inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:[(0,x.jsx)(_,{name:`plus`,size:14}),`新建缺陷`]})]})]}),(0,x.jsx)(`div`,{className:`mt-3 flex shrink-0 flex-wrap items-center gap-2`,children:(0,x.jsx)(Me,{ariaLabel:`按状态筛选缺陷`,options:yt,value:j,onChange:e=>{Ze(e),P(1)}})}),Xe?(0,x.jsx)(Ee,{message:Xe,onClose:()=>w(``)}):null,(0,x.jsxs)(`div`,{className:`mt-3 flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,x.jsx)(`div`,{ref:rt,className:`tw-scroll-x min-h-0 flex-1 overflow-auto`,children:(0,x.jsxs)(`table`,{className:`tw-data-table tw-sticky-table w-full table-fixed text-sm`,style:Y.tableStyle,children:[(0,x.jsx)(`colgroup`,{children:J.map(e=>(0,x.jsx)(`col`,{style:Y.widthOf(e.key)?{width:Y.widthOf(e.key)}:void 0},e.key))}),(0,x.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-xs text-stone-500`,children:(0,x.jsxs)(`tr`,{children:[(0,x.jsxs)(`th`,{className:`${ce} relative`,children:[`ID`,(0,x.jsx)(i,{...Y.resizeProps(`id`)})]}),(0,x.jsxs)(`th`,{className:oe,style:{"--tw-sticky-left":`${it}px`},children:[`缺陷标题`,(0,x.jsx)(i,{...Y.resizeProps(`title`)})]}),(0,x.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`严重程度`,(0,x.jsx)(i,{...Y.resizeProps(`severity`)})]}),(0,x.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`缺陷状态`,(0,x.jsx)(i,{...Y.resizeProps(`status`)})]}),t?null:(0,x.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`所属项目`,(0,x.jsx)(i,{...Y.resizeProps(`project`)})]}),(0,x.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`所属迭代`,(0,x.jsx)(i,{...Y.resizeProps(`iteration`)})]}),(0,x.jsx)(`th`,{"aria-hidden":`true`}),(0,x.jsx)(`th`,{className:te,children:`操作`})]})}),(0,x.jsxs)(`tbody`,{children:[C&&!u.bugs.length?(0,x.jsx)(`tr`,{children:(0,x.jsx)(`td`,{colSpan:J.length,className:`px-4 py-16 text-center`,children:(0,x.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):ut.length===0?(0,x.jsx)(`tr`,{children:(0,x.jsx)(`td`,{colSpan:J.length,children:Z?(0,x.jsx)(Ae,{children:`没有符合筛选条件的缺陷。`}):(0,x.jsx)(Pe,{icon:`bug`,title:`暂无缺陷`,hint:`记录第一个缺陷,跟踪严重程度与修复状态。`,action:(0,x.jsxs)(`button`,{type:`button`,onClick:()=>L(Je(O===`all`?``:O)),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-stone-200 px-3 text-xs text-stone-600 transition-colors hover:bg-stone-50`,children:[(0,x.jsx)(_,{name:`plus`,size:13}),`新建缺陷`]})})})}):null,ut.map(e=>(0,x.jsxs)(`tr`,{className:`border-t border-stone-100 hover:bg-[#f7f8fa]`,children:[(0,x.jsx)(`td`,{className:`${se} font-mono text-xs text-stone-400`,children:e.autoId}),(0,x.jsx)(`td`,{className:ae,style:{"--tw-sticky-left":`${it}px`},children:(0,x.jsx)(Se,{text:e.title,onClick:()=>L({id:e.id,projectId:e.projectId,iterationId:e.iterationId,requirementId:e.requirementId,title:e.title,severity:e.severity,status:e.status,reproduceSteps:e.reproduceSteps||e.title,expectedResult:e.expectedResult,actualResult:e.actualResult,environment:e.environment,githubIssue:e.githubIssue,attachment:e.attachment,remark:e.remark})})}),(0,x.jsx)(`td`,{className:`px-2 py-1 align-middle`,children:(0,x.jsx)(p,{tone:Ne[e.severity],children:ye[e.severity]})}),(0,x.jsx)(`td`,{className:`min-w-0 overflow-hidden px-2 py-1 align-middle`,children:(0,x.jsx)(a,{unstyled:!0,hideChevron:!0,ariaLabel:`修改 ${e.title} 的状态`,disabled:R,options:qe,value:e.status,onChange:t=>void _t(e,t),renderOptionPrefix:e=>(0,x.jsx)(v,{tone:je[e.value]}),renderTrigger:()=>(0,x.jsx)(p,{tone:je[e.status],children:_e[e.status]})})}),t?null:(0,x.jsx)(`td`,{className:`min-w-0 truncate px-2 py-1 align-middle text-sm text-stone-600`,children:(0,x.jsx)(`a`,{href:we(e.projectId),className:`block truncate transition-colors hover:text-[#3370ff]`,children:st(e.projectId)})}),(0,x.jsx)(`td`,{className:`min-w-0 truncate px-2 py-1 align-middle text-sm text-stone-500`,children:ct(e.iterationId)}),(0,x.jsx)(`td`,{"aria-hidden":`true`}),(0,x.jsx)(`td`,{className:re,children:(0,x.jsx)(`button`,{type:`button`,"aria-label":`删除 ${e.title}`,disabled:R,onClick:()=>G(e),className:`tw-icon-danger inline-flex h-7 w-7 items-center justify-center rounded-md`,children:(0,x.jsx)(_,{name:`trash`,size:15})})})]},e.id))]})]})}),X.length>0?(0,x.jsx)(ue,{page:Q,totalPages:lt,pageSize:F,busy:R,onPage:P,onPageSize:e=>{tt(e),P(1)}}):null]}),(0,x.jsx)(Te,{open:I!==null,title:I?.id?`编辑缺陷`:`新建缺陷`,busy:R,submitLabel:I?.id?`保存`:`创建`,onClose:gt,onSubmit:()=>void pt(),children:I?(0,x.jsxs)(`div`,{className:`space-y-1`,children:[t?null:(0,x.jsx)(g,{label:`所属项目`,required:!0,children:(0,x.jsx)(y,{ariaLabel:`所属项目`,options:u.projects.map(e=>({value:e.id,label:e.name})),value:I.projectId,onChange:e=>L({...I,projectId:e,iterationId:``,requirementId:``})})}),(0,x.jsx)(g,{label:`所属迭代`,children:(0,x.jsx)(y,{ariaLabel:`所属迭代`,options:[{value:``,label:`不关联迭代`},...dt.map(e=>({value:e.id,label:e.name}))],value:I.iterationId,onChange:e=>L({...I,iterationId:e}),disabled:dt.length===0})}),(0,x.jsx)(g,{label:`关联需求`,children:(0,x.jsx)(y,{ariaLabel:`关联需求`,options:[{value:``,label:`不关联需求`},...ft.map(e=>({value:e.id,label:`${e.autoId} ${e.title}`}))],value:I.requirementId,onChange:e=>L({...I,requirementId:e}),disabled:ft.length===0})}),(0,x.jsx)(g,{label:`缺陷描述`,required:!0,children:(0,x.jsx)(`textarea`,{autoFocus:!0,value:I.reproduceSteps,onChange:e=>L({...I,reproduceSteps:e.target.value}),placeholder:`描述问题现象、复现步骤与影响范围`,rows:5,className:h})}),(0,x.jsx)(g,{label:`严重程度`,children:(0,x.jsx)(y,{ariaLabel:`严重程度`,options:Ke,value:I.severity,onChange:e=>L({...I,severity:e}),renderOptionPrefix:e=>(0,x.jsx)(v,{tone:Ne[e.value]})})}),(0,x.jsx)(g,{label:`附件`,children:(0,x.jsxs)(`div`,{className:`space-y-2`,children:[q.length?(0,x.jsx)(`ul`,{className:`space-y-1.5`,children:q.map(e=>{let t=Ye(e.url);return(0,x.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-stone-200 px-2 py-1.5`,children:[t?(0,x.jsx)(`button`,{type:`button`,onClick:()=>K(e),"aria-label":`预览附件 ${e.name}`,className:`shrink-0 cursor-zoom-in`,children:(0,x.jsx)(`img`,{src:e.url,alt:e.name,className:`h-9 w-9 rounded-md border border-stone-100 object-cover`})}):(0,x.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-stone-100 text-stone-400`,children:(0,x.jsx)(_,{name:`file`,size:15})}),t?(0,x.jsx)(`button`,{type:`button`,onClick:()=>K(e),className:`min-w-0 flex-1 truncate text-left text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}):(0,x.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`min-w-0 flex-1 truncate text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}),(0,x.jsx)(`button`,{type:`button`,"aria-label":`移除附件 ${e.name}`,onClick:()=>ht(e.url),className:`tw-icon-danger flex h-6 w-6 shrink-0 items-center justify-center rounded`,children:`✕`})]},e.url)})}):null,(0,x.jsx)(`input`,{ref:H,type:`file`,multiple:!0,className:`hidden`,onChange:e=>void $(e.target.files)}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,x.jsxs)(`button`,{type:`button`,disabled:B,onClick:()=>H.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-dashed border-stone-300 px-2.5 text-xs text-stone-500 transition-colors hover:border-stone-400 hover:text-stone-700 disabled:opacity-40`,children:[(0,x.jsx)(_,{name:B?`file`:`plus`,size:13}),B?`上传中…`:`上传文件 / 图片`]}),(0,x.jsx)(`span`,{className:`text-xs text-stone-400`,children:`可直接粘贴截图 / 图片(⌘V / Ctrl+V),支持多张`})]})]})}),(0,x.jsx)(g,{label:`备注`,children:(0,x.jsx)(`textarea`,{value:I.remark,onChange:e=>L({...I,remark:e.target.value}),rows:2,className:h})})]}):null}),(0,x.jsx)(ee,{open:W!==null,title:`删除缺陷`,message:`确定删除「${W?.title??``}」?此操作无法恢复。`,confirmLabel:`删除`,danger:`solid`,onClose:()=>G(null),onConfirm:()=>void vt()}),(0,x.jsx)(Oe,{file:nt,onClose:()=>K(null)})]})}export{C as default};
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{s as n}from"./plugins.Di6uuouN.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";import{t as ee}from"./ConfirmDialog.D5qXeML0.js";import{c as te,d as ne,i as re,l as ie,n as ae,o as oe,r as se,s as ce,t as i}from"./ColumnResize.BgYkV9Iy.js";import{n as le,t as ue}from"./DocsPager.D55FTK9d.js";import{t as a}from"./SelectDropdown.apWlFGbA.js";import{showToast as o}from"./Toast.BO2NFckG.js";import{A as s,L as c,M as de,N as fe,R as pe,b as me,g as he,h as ge,i as _e,k as l,m as ve,n as ye,p as be,r as u,t as d}from"./pm.pMOkNqqK.js";import{A as xe,C as Se,D as Ce,E as we,O as f,S as p,_ as m,a as h,c as Te,d as Ee,f as g,g as De,h as Oe,k as ke,l as Ae,m as _,n as je,p as Me,s as v,t as Ne,u as Pe,y}from"./PmShared.Bwphj4KH.js";var b=e(t(),1),x=r(),Fe=[{key:`id`,width:88,min:72},{key:`title`,width:280,min:160},{key:`severity`,width:100,min:80},{key:`status`,width:120,min:96}],Ie={key:`project`,width:140,min:100},S=[{key:`iteration`,width:120,min:88},{key:`filler`,filler:!0},{key:`action`,width:76,min:64}],Le=20,Re=`tw.pm-bugs.page-size.v1`,ze=[`all`,...u],Be=[`all`,...d],Ve=`pm.bugs.project`,He=`pm.bugs.iteration`,Ue=`pm.bugs.status`,We=`pm.bugs.severity`,Ge=`pm.bugs.keyword`,Ke=d.map(e=>({value:e,label:ye[e]})),qe=u.map(e=>({value:e,label:_e[e]}));function Je(e=``){return{projectId:e,iterationId:``,requirementId:``,title:``,severity:`minor`,status:`pending`,reproduceSteps:``,expectedResult:``,actualResult:``,environment:``,githubIssue:``,attachment:``,remark:``}}function Ye(e){try{let t=new URL(e,`http://localhost`).searchParams.get(`p`)??``;return/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(t)}catch{return!1}}function C({scopeProjectId:e=``}={}){let t=!!e,r=ke(`bugs`),{store:u,live:d,loading:C,error:Xe,setError:w,reload:T}=xe(),[E,D]=f(Ve,`all`),O=e||E,[k,A]=f(He,`all`),[j,Ze]=Ce(Ue,ze,`all`),[M,Qe]=Ce(We,Be,`all`),[N,$e]=f(Ge),[et,P]=(0,b.useState)(1),[F,tt]=le(Le,Re),[I,L]=(0,b.useState)(null),[R,z]=(0,b.useState)(!1),[B,V]=(0,b.useState)(!1),H=(0,b.useRef)(null),U=(0,b.useRef)(new Set),[W,G]=(0,b.useState)(null),[nt,K]=(0,b.useState)(null),q=(0,b.useMemo)(()=>s(I?.attachment??``),[I?.attachment]),J=(0,b.useMemo)(()=>t?[...Fe,...S]:[...Fe,Ie,...S],[t]),Y=ie(t?`pm.bugs.cols.scoped.v1`:`pm.bugs.cols.v1`,J),rt=ne(t?`pm.bugs.scroll.scoped`:`pm.bugs.scroll`),it=Y.widthOf(`id`)??88;(0,b.useEffect)(()=>{for(let e of q)U.current.add(e.url)},[q]);let at=(0,b.useMemo)(()=>[{value:`all`,label:`全部项目`},...u.projects.map(e=>({value:e.id,label:e.name}))],[u.projects]),ot=(0,b.useMemo)(()=>[{value:`all`,label:`全部迭代`},...u.iterations.filter(e=>O===`all`||e.projectId===O).map(e=>({value:e.id,label:e.name}))],[u.iterations,O]),st=(0,b.useMemo)(()=>{let e=new Map(u.projects.map(e=>[e.id,e.name]));return t=>e.get(t)??`—`},[u.projects]),ct=(0,b.useMemo)(()=>{let e=new Map(u.iterations.map(e=>[e.id,e.name]));return t=>t?e.get(t)??`—`:`—`},[u.iterations]),X=(0,b.useMemo)(()=>de(me(u.bugs,{projectId:O,iterationId:k,status:j,severity:M,keyword:N})),[u.bugs,O,k,j,M,N]),Z=t?u.bugs.filter(e=>e.projectId===O).length:u.bugs.length,lt=Math.max(1,Math.ceil(X.length/F)),Q=Math.min(et,lt),ut=X.slice((Q-1)*F,Q*F);(0,b.useEffect)(()=>{t||d===!0&&E!==`all`&&!u.projects.some(e=>e.id===E)&&D(`all`)},[d,u.projects,E,D,t]),(0,b.useEffect)(()=>{d===!0&&k!==`all`&&!u.iterations.some(e=>e.id===k&&(O===`all`||e.projectId===O))&&A(`all`)},[d,u.iterations,O,k,A]);let dt=I?fe(u.iterations.filter(e=>e.projectId===I.projectId)):[],ft=I?u.requirements.filter(e=>e.projectId===I.projectId):[];async function pt(){if(!I)return;if(!I.projectId){w(`请先选择所属项目`);return}let e=I.reproduceSteps.trim();if(!e){w(`缺陷描述不能为空`);return}let t=be(e);z(!0);try{let n={projectId:I.projectId,iterationId:I.iterationId,requirementId:I.requirementId,title:t,severity:I.severity,status:I.status,reproduceSteps:e,expectedResult:I.expectedResult,actualResult:I.actualResult,environment:I.environment,githubIssue:I.githubIssue,attachment:I.attachment,remark:I.remark};I.id?await c(`bugs`,I.id,n):await ge(`bugs`,[n]);let r=!!I.id;L(null),U.current.clear(),w(``),await T(!0),o(r?`已保存缺陷`:`已新建缺陷`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);w(t),o(`保存缺陷失败:${t}`,`error`)}finally{z(!1)}}let $=(0,b.useCallback)(async e=>{if(e&&e.length){V(!0);try{let t=await pe(Array.from(e));L(e=>{if(!e)return e;let n=s(e.attachment);return{...e,attachment:l([...n,...t])}}),w(``)}catch(e){w(e instanceof Error?e.message:String(e))}finally{V(!1),H.current&&(H.current.value=``)}}},[w]),mt=I!==null;(0,b.useEffect)(()=>{if(!mt)return;let e=e=>{let t=Array.from(e.clipboardData?.files??[]);t.length&&(e.preventDefault(),$(t))};return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[mt,$]);async function ht(e){if(!I)return;let t=l(q.filter(t=>t.url!==e));if(I.id)try{await c(`bugs`,I.id,{attachment:t}),await T(!0)}catch(e){w(e instanceof Error?e.message:String(e));return}L(e=>e&&{...e,attachment:t}),ve([e],I.id??``)}function gt(){let e=[...U.current,...q.map(e=>e.url)];U.current.clear(),L(null),e.length&&ve(e)}async function _t(e,t){z(!0);try{await c(`bugs`,e.id,{status:t}),await T(!0)}catch(e){w(e instanceof Error?e.message:String(e))}finally{z(!1)}}async function vt(){let e=W;if(e){G(null),z(!0);try{await he(`bugs`,[e.id]),await T(!0),o(`已删除缺陷`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);w(t),o(`删除缺陷失败:${t}`,`error`)}finally{z(!1)}}}if(!r.ready)return(0,x.jsx)(De,{label:`正在读取插件开关`});if(!r.on)return(0,x.jsx)(m,{children:n(`bugs`)});if(d===null)return(0,x.jsx)(De,{label:`正在连接项目管理服务`});if(!d)return(0,x.jsx)(m,{children:`缺陷管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`});if(u.projects.length===0&&!C&&!t)return(0,x.jsx)(m,{children:`还没有项目。请先在「项目列表」里新建一个项目,再回来记录缺陷。`});let yt=[{value:`all`,label:`全部`},...qe];return(0,x.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,x.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,x.jsxs)(`div`,{className:`text-xs text-stone-400`,children:[`共 `,(0,x.jsx)(`span`,{className:`font-medium text-stone-600`,children:Z}),` 条缺陷`,X.length===Z?``:` · 筛选出 ${X.length} 条`]}),(0,x.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[t?null:(0,x.jsx)(a,{flat:!0,showCheck:!1,ariaLabel:`按项目筛选缺陷`,className:`w-36`,options:at,value:E,onChange:e=>{D(e),A(`all`),P(1)}}),(0,x.jsx)(a,{flat:!0,showCheck:!1,ariaLabel:`按迭代筛选缺陷`,className:`w-32`,options:ot,value:k,onChange:e=>{A(e),P(1)}}),(0,x.jsx)(a,{flat:!0,showCheck:!1,ariaLabel:`按严重程度筛选缺陷`,className:`w-32`,options:[{value:`all`,label:`全部严重程度`},...Ke],value:M,onChange:e=>{Qe(e),P(1)}}),(0,x.jsxs)(`label`,{className:`relative block`,children:[(0,x.jsx)(_,{name:`search`,size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-stone-400`}),(0,x.jsx)(`input`,{value:N,onChange:e=>{$e(e.target.value),P(1)},placeholder:`搜索编号 / 标题…`,className:`h-9 w-48 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,x.jsxs)(`button`,{type:`button`,disabled:R,onClick:()=>L(Je(O===`all`?``:O)),className:`inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:[(0,x.jsx)(_,{name:`plus`,size:14}),`新建缺陷`]})]})]}),(0,x.jsx)(`div`,{className:`mt-3 flex shrink-0 flex-wrap items-center gap-2`,children:(0,x.jsx)(Me,{ariaLabel:`按状态筛选缺陷`,options:yt,value:j,onChange:e=>{Ze(e),P(1)}})}),Xe?(0,x.jsx)(Ee,{message:Xe,onClose:()=>w(``)}):null,(0,x.jsxs)(`div`,{className:`mt-3 flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,x.jsx)(`div`,{ref:rt,className:`tw-scroll-x min-h-0 flex-1 overflow-auto`,children:(0,x.jsxs)(`table`,{className:`tw-data-table tw-sticky-table w-full table-fixed text-sm`,style:Y.tableStyle,children:[(0,x.jsx)(`colgroup`,{children:J.map(e=>(0,x.jsx)(`col`,{style:Y.widthOf(e.key)?{width:Y.widthOf(e.key)}:void 0},e.key))}),(0,x.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-xs text-stone-500`,children:(0,x.jsxs)(`tr`,{children:[(0,x.jsxs)(`th`,{className:`${ce} relative`,children:[`ID`,(0,x.jsx)(i,{...Y.resizeProps(`id`)})]}),(0,x.jsxs)(`th`,{className:oe,style:{"--tw-sticky-left":`${it}px`},children:[`缺陷标题`,(0,x.jsx)(i,{...Y.resizeProps(`title`)})]}),(0,x.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`严重程度`,(0,x.jsx)(i,{...Y.resizeProps(`severity`)})]}),(0,x.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`缺陷状态`,(0,x.jsx)(i,{...Y.resizeProps(`status`)})]}),t?null:(0,x.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`所属项目`,(0,x.jsx)(i,{...Y.resizeProps(`project`)})]}),(0,x.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`所属迭代`,(0,x.jsx)(i,{...Y.resizeProps(`iteration`)})]}),(0,x.jsx)(`th`,{"aria-hidden":`true`}),(0,x.jsx)(`th`,{className:te,children:`操作`})]})}),(0,x.jsxs)(`tbody`,{children:[C&&!u.bugs.length?(0,x.jsx)(`tr`,{children:(0,x.jsx)(`td`,{colSpan:J.length,className:`px-4 py-16 text-center`,children:(0,x.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):ut.length===0?(0,x.jsx)(`tr`,{children:(0,x.jsx)(`td`,{colSpan:J.length,children:Z?(0,x.jsx)(Ae,{children:`没有符合筛选条件的缺陷。`}):(0,x.jsx)(Pe,{icon:`bug`,title:`暂无缺陷`,hint:`记录第一个缺陷,跟踪严重程度与修复状态。`,action:(0,x.jsxs)(`button`,{type:`button`,onClick:()=>L(Je(O===`all`?``:O)),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-stone-200 px-3 text-xs text-stone-600 transition-colors hover:bg-stone-50`,children:[(0,x.jsx)(_,{name:`plus`,size:13}),`新建缺陷`]})})})}):null,ut.map(e=>(0,x.jsxs)(`tr`,{className:`border-t border-stone-100 hover:bg-[#f7f8fa]`,children:[(0,x.jsx)(`td`,{className:`${se} font-mono text-xs text-stone-400`,children:e.autoId}),(0,x.jsx)(`td`,{className:ae,style:{"--tw-sticky-left":`${it}px`},children:(0,x.jsx)(Se,{text:e.title,onClick:()=>L({id:e.id,projectId:e.projectId,iterationId:e.iterationId,requirementId:e.requirementId,title:e.title,severity:e.severity,status:e.status,reproduceSteps:e.reproduceSteps||e.title,expectedResult:e.expectedResult,actualResult:e.actualResult,environment:e.environment,githubIssue:e.githubIssue,attachment:e.attachment,remark:e.remark})})}),(0,x.jsx)(`td`,{className:`px-2 py-1 align-middle`,children:(0,x.jsx)(p,{tone:Ne[e.severity],children:ye[e.severity]})}),(0,x.jsx)(`td`,{className:`min-w-0 overflow-hidden px-2 py-1 align-middle`,children:(0,x.jsx)(a,{unstyled:!0,hideChevron:!0,ariaLabel:`修改 ${e.title} 的状态`,disabled:R,options:qe,value:e.status,onChange:t=>void _t(e,t),renderOptionPrefix:e=>(0,x.jsx)(v,{tone:je[e.value]}),renderTrigger:()=>(0,x.jsx)(p,{tone:je[e.status],children:_e[e.status]})})}),t?null:(0,x.jsx)(`td`,{className:`min-w-0 truncate px-2 py-1 align-middle text-sm text-stone-600`,children:(0,x.jsx)(`a`,{href:we(e.projectId),className:`block truncate transition-colors hover:text-[#3370ff]`,children:st(e.projectId)})}),(0,x.jsx)(`td`,{className:`min-w-0 truncate px-2 py-1 align-middle text-sm text-stone-500`,children:ct(e.iterationId)}),(0,x.jsx)(`td`,{"aria-hidden":`true`}),(0,x.jsx)(`td`,{className:re,children:(0,x.jsx)(`button`,{type:`button`,"aria-label":`删除 ${e.title}`,disabled:R,onClick:()=>G(e),className:`tw-icon-danger inline-flex h-7 w-7 items-center justify-center rounded-md`,children:(0,x.jsx)(_,{name:`trash`,size:15})})})]},e.id))]})]})}),X.length>0?(0,x.jsx)(ue,{page:Q,totalPages:lt,pageSize:F,busy:R,onPage:P,onPageSize:e=>{tt(e),P(1)}}):null]}),(0,x.jsx)(Te,{open:I!==null,title:I?.id?`编辑缺陷`:`新建缺陷`,busy:R,submitLabel:I?.id?`保存`:`创建`,onClose:gt,onSubmit:()=>void pt(),children:I?(0,x.jsxs)(`div`,{className:`space-y-1`,children:[t?null:(0,x.jsx)(g,{label:`所属项目`,required:!0,children:(0,x.jsx)(y,{ariaLabel:`所属项目`,options:u.projects.map(e=>({value:e.id,label:e.name})),value:I.projectId,onChange:e=>L({...I,projectId:e,iterationId:``,requirementId:``})})}),(0,x.jsx)(g,{label:`所属迭代`,children:(0,x.jsx)(y,{ariaLabel:`所属迭代`,options:[{value:``,label:`不关联迭代`},...dt.map(e=>({value:e.id,label:e.name}))],value:I.iterationId,onChange:e=>L({...I,iterationId:e}),disabled:dt.length===0})}),(0,x.jsx)(g,{label:`关联需求`,children:(0,x.jsx)(y,{ariaLabel:`关联需求`,options:[{value:``,label:`不关联需求`},...ft.map(e=>({value:e.id,label:`${e.autoId} ${e.title}`}))],value:I.requirementId,onChange:e=>L({...I,requirementId:e}),disabled:ft.length===0})}),(0,x.jsx)(g,{label:`缺陷描述`,required:!0,children:(0,x.jsx)(`textarea`,{autoFocus:!0,value:I.reproduceSteps,onChange:e=>L({...I,reproduceSteps:e.target.value}),placeholder:`描述问题现象、复现步骤与影响范围`,rows:5,className:h})}),(0,x.jsx)(g,{label:`严重程度`,children:(0,x.jsx)(y,{ariaLabel:`严重程度`,options:Ke,value:I.severity,onChange:e=>L({...I,severity:e}),renderOptionPrefix:e=>(0,x.jsx)(v,{tone:Ne[e.value]})})}),(0,x.jsx)(g,{label:`附件`,children:(0,x.jsxs)(`div`,{className:`space-y-2`,children:[q.length?(0,x.jsx)(`ul`,{className:`space-y-1.5`,children:q.map(e=>{let t=Ye(e.url);return(0,x.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-stone-200 px-2 py-1.5`,children:[t?(0,x.jsx)(`button`,{type:`button`,onClick:()=>K(e),"aria-label":`预览附件 ${e.name}`,className:`shrink-0 cursor-zoom-in`,children:(0,x.jsx)(`img`,{src:e.url,alt:e.name,className:`h-9 w-9 rounded-md border border-stone-100 object-cover`})}):(0,x.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-stone-100 text-stone-400`,children:(0,x.jsx)(_,{name:`file`,size:15})}),t?(0,x.jsx)(`button`,{type:`button`,onClick:()=>K(e),className:`min-w-0 flex-1 truncate text-left text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}):(0,x.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`min-w-0 flex-1 truncate text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}),(0,x.jsx)(`button`,{type:`button`,"aria-label":`移除附件 ${e.name}`,onClick:()=>ht(e.url),className:`tw-icon-danger flex h-6 w-6 shrink-0 items-center justify-center rounded`,children:`✕`})]},e.url)})}):null,(0,x.jsx)(`input`,{ref:H,type:`file`,multiple:!0,className:`hidden`,onChange:e=>void $(e.target.files)}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,x.jsxs)(`button`,{type:`button`,disabled:B,onClick:()=>H.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-dashed border-stone-300 px-2.5 text-xs text-stone-500 transition-colors hover:border-stone-400 hover:text-stone-700 disabled:opacity-40`,children:[(0,x.jsx)(_,{name:B?`file`:`plus`,size:13}),B?`上传中…`:`上传文件 / 图片`]}),(0,x.jsx)(`span`,{className:`text-xs text-stone-400`,children:`可直接粘贴截图 / 图片(⌘V / Ctrl+V),支持多张`})]})]})}),(0,x.jsx)(g,{label:`备注`,children:(0,x.jsx)(`textarea`,{value:I.remark,onChange:e=>L({...I,remark:e.target.value}),rows:2,className:h})})]}):null}),(0,x.jsx)(ee,{open:W!==null,title:`删除缺陷`,message:`确定删除「${W?.title??``}」?此操作无法恢复。`,confirmLabel:`删除`,danger:`solid`,onClose:()=>G(null),onConfirm:()=>void vt()}),(0,x.jsx)(Oe,{file:nt,onClose:()=>K(null)})]})}export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{s as n}from"./plugins.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{s as n}from"./plugins.Di6uuouN.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";import{t as i}from"./ConfirmDialog.D5qXeML0.js";import{t as a}from"./DatePicker.Bkl71M49.js";import{t as o}from"./SelectDropdown.apWlFGbA.js";import{showToast as s}from"./Toast.BO2NFckG.js";import{D as c,I as ee,L as l,N as te,O as ne,a as u,g as re,h as ie,o as d,x as ae}from"./pm.pMOkNqqK.js";import{A as f,D as oe,E as se,O as p,S as m,_ as h,a as ce,c as le,d as ue,f as g,g as _,i as v,k as de,l as fe,m as y,r as b,s as x,u as S,v as pe,y as C}from"./PmShared.Bwphj4KH.js";var w=e(t(),1),T=r(),E=10,me=[`all`,...u],he=`pm.iterations.project`,D=`pm.iterations.status`,ge=`pm.iterations.keyword`,O=u.map(e=>({value:e,label:d[e]}));function k(e=``){return{projectId:e,name:``,startDate:``,endDate:``,status:`planning`,remark:``}}function A({scopeProjectId:e=``}={}){let t=!!e,r=de(`iterations`),{store:u,live:A,loading:j,error:M,setError:N,reload:P}=f(),[F,I]=p(he,`all`),L=e||F,[R,_e]=oe(D,me,`all`),[z,ve]=p(ge),[ye,B]=(0,w.useState)(1),[V,H]=(0,w.useState)(null),[U,W]=(0,w.useState)(!1),[G,K]=(0,w.useState)(null),q=ee(),be=(0,w.useMemo)(()=>{let e=new Map(u.projects.map(e=>[e.id,e.name]));return t=>e.get(t)??`未关联项目`},[u.projects]),xe=(0,w.useMemo)(()=>[{value:`all`,label:`全部项目`},...u.projects.map(e=>({value:e.id,label:e.name}))],[u.projects]),J=(0,w.useMemo)(()=>te(ae(u.iterations,{projectId:L,status:R,keyword:z})),[u.iterations,L,R,z]),Y=t?u.iterations.filter(e=>e.projectId===L).length:u.iterations.length,X=Math.max(1,Math.ceil(J.length/E)),Z=Math.min(ye,X),Q=J.slice((Z-1)*E,Z*E);(0,w.useEffect)(()=>{t||A===!0&&F!==`all`&&!u.projects.some(e=>e.id===F)&&I(`all`)},[A,u.projects,F,I,t]);async function Se(){if(!V)return;if(!V.projectId){N(`请先选择所属项目`);return}let e=V.name.trim();if(!e)N(`迭代名称不能为空`);else if(V.startDate&&V.endDate&&V.endDate<V.startDate)N(`迭代结束日期不能早于开始日期`);else{W(!0);try{let t={projectId:V.projectId,name:e,startDate:V.startDate,endDate:V.endDate,status:V.status,remark:V.remark};V.id?await l(`iterations`,V.id,t):await ie(`iterations`,[t]),H(null),N(``),await P(!0),s(V.id?`已保存迭代`:`已新建迭代`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);N(t),s(`保存迭代失败:${t}`,`error`)}finally{W(!1)}}}async function $(e,t){W(!0);try{await l(`iterations`,e.id,{status:t}),await P(!0),s(`已更新迭代状态为「${t}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);N(t),s(`更新迭代失败:${t}`,`error`)}finally{W(!1)}}async function Ce(){let e=G;if(e){K(null),W(!0);try{await re(`iterations`,[e.id]),await P(!0),s(`已删除迭代`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);N(t),s(`删除迭代失败:${t}`,`error`)}finally{W(!1)}}}return r.ready?r.on?A===null?(0,T.jsx)(_,{label:`正在连接项目管理服务`}):A?u.projects.length===0&&!j&&!t?(0,T.jsx)(h,{children:`还没有项目。请先在「项目列表」里新建一个项目,再回来维护迭代。`}):(0,T.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,T.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,T.jsxs)(`div`,{className:`text-xs text-stone-400`,children:[`共 `,(0,T.jsx)(`span`,{className:`font-medium text-stone-600`,children:Y}),` 个迭代`,J.length===Y?``:` · 筛选出 ${J.length} 个`]}),(0,T.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[t?null:(0,T.jsx)(o,{flat:!0,showCheck:!1,ariaLabel:`按项目筛选迭代`,className:`w-36`,options:xe,value:F,onChange:e=>{I(e),B(1)}}),(0,T.jsx)(o,{flat:!0,showCheck:!1,ariaLabel:`按状态筛选迭代`,className:`w-28`,options:[{value:`all`,label:`全部状态`},...O],value:R,onChange:e=>{_e(e),B(1)}}),(0,T.jsxs)(`label`,{className:`relative block`,children:[(0,T.jsx)(y,{name:`search`,size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-stone-400`}),(0,T.jsx)(`input`,{value:z,onChange:e=>{ve(e.target.value),B(1)},placeholder:`搜索迭代名称…`,className:`h-9 w-44 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,T.jsxs)(`button`,{type:`button`,disabled:U,onClick:()=>H(k(L===`all`?``:L)),className:`inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:[(0,T.jsx)(y,{name:`plus`,size:14}),`新建迭代`]})]})]}),M?(0,T.jsx)(ue,{message:M,onClose:()=>N(``)}):null,(0,T.jsx)(`div`,{className:`mt-4 min-h-0 flex-1 overflow-auto pb-4`,children:j&&!u.iterations.length?(0,T.jsx)(`div`,{className:`flex min-h-[200px] items-center justify-center`,children:(0,T.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})}):Q.length===0?Y?(0,T.jsx)(fe,{children:`没有符合筛选条件的迭代。`}):(0,T.jsx)(S,{icon:`calendar`,title:`暂无迭代`,hint:`新建一个迭代,用开始 / 截止日期跟踪进度。`,action:(0,T.jsxs)(`button`,{type:`button`,onClick:()=>H(k(L===`all`?``:L)),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-stone-200 px-3 text-xs text-stone-600 transition-colors hover:bg-stone-50`,children:[(0,T.jsx)(y,{name:`plus`,size:13}),`新建迭代`]})}):(0,T.jsx)(`div`,{className:`space-y-3`,children:Q.map(e=>{let n=ne(e,q),r=c(e,q),i=e.endDate&&e.status!==`done`?Math.round((Date.parse(`${e.endDate}T00:00:00`)-Date.parse(`${q}T00:00:00`))/864e5):null;return(0,T.jsxs)(`div`,{className:`rounded-xl border border-stone-200 bg-white px-4 py-3.5 transition-[border-color,box-shadow] hover:border-[#ddd6fe] hover:shadow-sm`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`truncate text-[15px] font-medium text-stone-800`,children:e.name}),(0,T.jsx)(m,{tone:b[e.status],children:d[e.status]})]}),(0,T.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-stone-500`,children:[t?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`a`,{href:se(e.projectId),className:`transition-colors hover:text-[#3370ff]`,children:be(e.projectId)}),(0,T.jsx)(`span`,{className:`text-stone-300`,children:`·`})]}),(0,T.jsxs)(`span`,{className:`tabular-nums`,children:[e.startDate||`—`,` → `,e.endDate||`—`]}),r===null?i!==null&&i>=0&&e.endDate?(0,T.jsxs)(`span`,{className:`text-stone-400`,children:[`还剩 `,i,` 天`]}):null:(0,T.jsxs)(`span`,{className:`text-red-500`,children:[`逾期 `,r,` 天`]})]}),e.remark?(0,T.jsx)(`p`,{className:`mt-1 line-clamp-1 text-xs text-stone-400`,children:e.remark}):null]}),(0,T.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.status===`planning`?(0,T.jsxs)(`button`,{type:`button`,disabled:U,onClick:()=>void $(e,`in_progress`),className:`inline-flex h-8 items-center gap-1 rounded-lg px-2 text-xs text-stone-600 transition-colors hover:bg-stone-100 disabled:opacity-40`,children:[(0,T.jsx)(y,{name:`play`,size:12}),`开始`]}):null,e.status===`in_progress`?(0,T.jsxs)(`button`,{type:`button`,disabled:U,onClick:()=>void $(e,`done`),className:`inline-flex h-8 items-center gap-1 rounded-lg px-2 text-xs text-stone-600 transition-colors hover:bg-stone-100 disabled:opacity-40`,children:[(0,T.jsx)(y,{name:`check`,size:12}),`完成`]}):null,(0,T.jsx)(`button`,{type:`button`,"aria-label":`编辑 ${e.name}`,onClick:()=>H({id:e.id,projectId:e.projectId,name:e.name,startDate:e.startDate,endDate:e.endDate,status:e.status,remark:e.remark}),className:`flex h-8 w-8 items-center justify-center rounded-lg text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-600`,children:(0,T.jsx)(y,{name:`pencil`,size:15})}),(0,T.jsx)(`button`,{type:`button`,"aria-label":`删除 ${e.name}`,disabled:U,onClick:()=>K(e),className:`tw-icon-danger flex h-8 w-8 items-center justify-center rounded-lg`,children:(0,T.jsx)(y,{name:`trash`,size:15})})]})]}),(0,T.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,T.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded-full bg-stone-100`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full bg-[#3370ff] transition-[width] duration-300`,style:{width:`${n}%`}})}),(0,T.jsxs)(`span`,{className:`w-9 shrink-0 text-right text-xs tabular-nums text-stone-500`,children:[n,`%`]})]})]},e.id)})})}),J.length>0?(0,T.jsx)(pe,{page:Z,totalPages:X,busy:U,onPage:B}):null,(0,T.jsx)(le,{open:V!==null,title:V?.id?`编辑迭代`:`新建迭代`,busy:U,submitLabel:V?.id?`保存`:`创建`,onClose:()=>H(null),onSubmit:()=>void Se(),children:V?(0,T.jsxs)(`div`,{className:`space-y-1`,children:[t?null:(0,T.jsx)(g,{label:`所属项目`,required:!0,children:(0,T.jsx)(C,{ariaLabel:`所属项目`,options:u.projects.map(e=>({value:e.id,label:e.name})),value:V.projectId,onChange:e=>H({...V,projectId:e}),disabled:u.projects.length===0})}),(0,T.jsx)(g,{label:`迭代名称`,required:!0,children:(0,T.jsx)(`input`,{autoFocus:!0,value:V.name,onChange:e=>H({...V,name:e.target.value}),placeholder:`如:v1.0 迭代`,className:v})}),(0,T.jsx)(g,{label:`开始日期`,children:(0,T.jsx)(a,{value:V.startDate,onChange:e=>H({...V,startDate:e}),placeholder:`选择开始日期`,className:`${v} tabular-nums`})}),(0,T.jsx)(g,{label:`截止日期`,children:(0,T.jsx)(a,{value:V.endDate,onChange:e=>H({...V,endDate:e}),placeholder:`选择截止日期`,className:`${v} tabular-nums`})}),(0,T.jsx)(g,{label:`状态`,children:(0,T.jsx)(C,{ariaLabel:`迭代状态`,options:O,value:V.status,onChange:e=>H({...V,status:e}),renderOptionPrefix:e=>(0,T.jsx)(x,{tone:b[e.value]})})}),(0,T.jsx)(g,{label:`备注`,children:(0,T.jsx)(`textarea`,{value:V.remark,onChange:e=>H({...V,remark:e.target.value}),placeholder:`迭代目标、范围等(可选)`,rows:3,className:ce})})]}):null}),(0,T.jsx)(i,{open:G!==null,title:`删除迭代`,message:`确定删除「${G?.name??``}」?关联的需求与缺陷会保留,但不再关联到这个迭代。`,confirmLabel:`删除`,danger:`solid`,onClose:()=>K(null),onConfirm:()=>void Ce()})]}):(0,T.jsx)(h,{children:`迭代管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`}):(0,T.jsx)(h,{children:n(`iterations`)}):(0,T.jsx)(_,{label:`正在读取插件开关`})}export{A as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{s as n}from"./plugins.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{s as n}from"./plugins.Di6uuouN.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";import{c as i,j as a}from"./pm.pMOkNqqK.js";import{A as o,D as s,S as c,_ as l,b as u,g as d,k as f,m as p,o as m,u as h,x as g}from"./PmShared.Bwphj4KH.js";import _ from"./PmBugsBoard.B6w50MHD.js";import v from"./PmIterationsBoard.Dk7JheCU.js";import{t as y}from"./PmRequirementsBoard.DTL_RFxq.js";var b=e(t(),1),x=r(),S=[`iterations`,`requirements`,`bugs`],C=`pm.project.tab`,w=`/pm/projects/`;function T(){let e=f(`projects`);return e.ready?e.on?(0,x.jsx)(u,{children:(0,x.jsx)(E,{})}):(0,x.jsx)(l,{children:n(`projects`)}):(0,x.jsx)(d,{label:`正在读取插件开关`})}function E(){let{store:e,live:t,loading:n}=o(),[r,u]=(0,b.useState)(``),[f,T]=s(C,S,`iterations`);(0,b.useEffect)(()=>{u(new URLSearchParams(window.location.search).get(`id`)??``)},[]);let E=(0,b.useMemo)(()=>e.projects.find(e=>e.id===r),[e.projects,r]),O=(0,b.useMemo)(()=>a(e),[e]);if(t===null)return(0,x.jsx)(d,{label:`正在连接项目管理服务`});if(!t)return(0,x.jsx)(l,{children:`项目详情需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`});if(!E)return n&&!e.projects.length?(0,x.jsx)(d,{label:`正在读取项目`}):(0,x.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,x.jsx)(D,{}),(0,x.jsx)(h,{icon:`folder`,title:`没有找到这个项目`,hint:`它可能已被删除,或链接里的项目 id 不正确。`})]});let k=O[E.id],A=[{value:`iterations`,label:`迭代`,count:k?.iterations??0},{value:`requirements`,label:`需求`,count:k?.requirements??0},{value:`bugs`,label:`缺陷`,count:k?.bugs??0}];return(0,x.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,x.jsxs)(`header`,{className:`flex shrink-0 items-start gap-3`,children:[(0,x.jsx)(`a`,{href:w,"aria-label":`返回项目列表`,className:`mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-stone-500 transition-colors hover:bg-stone-100 hover:text-stone-800`,children:(0,x.jsx)(p,{name:`arrowLeft`,size:18})}),(0,x.jsx)(`span`,{className:`tw-pm-tile flex h-9 w-9 shrink-0 items-center justify-center rounded-xl text-sm font-bold`,children:E.name.slice(0,1)}),(0,x.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,x.jsx)(`h1`,{className:`truncate text-lg font-semibold text-stone-800`,children:E.name}),(0,x.jsx)(c,{tone:m[E.status],children:i[E.status]})]}),(0,x.jsx)(`p`,{className:`mt-0.5 text-xs ${E.description?`text-stone-400`:`text-stone-300 italic`}`,children:E.description||`暂无描述`})]})]}),(0,x.jsxs)(`div`,{className:`mt-5 flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[(0,x.jsx)(g,{tabs:A,value:f,onChange:T,ariaLabel:`项目二级菜单`}),(0,x.jsxs)(`div`,{className:`text-xs text-stone-400`,children:[`需求完成 `,k?.requirementPercent??0,`% · 缺陷完成 `,k?.bugClosedPercent??100,`%`]})]}),(0,x.jsxs)(`div`,{className:`mt-4 flex min-h-0 flex-1 flex-col`,children:[f===`iterations`?(0,x.jsx)(v,{scopeProjectId:E.id}):null,f===`requirements`?(0,x.jsx)(y,{scopeProjectId:E.id}):null,f===`bugs`?(0,x.jsx)(_,{scopeProjectId:E.id}):null]})]})}function D(){return(0,x.jsxs)(`a`,{href:w,className:`mb-2 inline-flex w-fit items-center gap-1.5 text-sm text-stone-500 transition-colors hover:text-stone-800`,children:[(0,x.jsx)(p,{name:`arrowLeft`,size:16}),`返回项目列表`]})}export{T as default};
|