lantern-harness 0.1.42 → 0.1.43
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 +15 -0
- package/README.md +2 -2
- package/builtin/session/lh-nav-groups.mjs +2 -0
- package/builtin/session/session-runs.mjs +179 -32
- package/cli/server.mjs +2 -0
- package/config/app.defaults.json +1 -0
- package/config/seeds//346/212/245/345/221/212/347/256/241/347/220/206//345/212/237/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212/.gitkeep +0 -0
- package/config/seeds//346/212/245/345/221/212/347/256/241/347/220/206//346/200/247/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212/.gitkeep +0 -0
- package/config/seeds//346/212/245/345/221/212/347/256/241/347/220/206//346/216/245/345/217/243/346/265/213/350/257/225/346/212/245/345/221/212/.gitkeep +0 -0
- package/config/seeds//346/217/220/347/244/272/350/257/215/347/256/241/347/220/206//345/212/237/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212/346/217/220/347/244/272/350/257/215.md +18 -0
- package/config/seeds//346/217/220/347/244/272/350/257/215/347/256/241/347/220/206//346/200/247/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212/346/217/220/347/244/272/350/257/215.md +18 -0
- package/config/seeds//346/217/220/347/244/272/350/257/215/347/256/241/347/220/206//346/216/245/345/217/243/346/265/213/350/257/225/346/212/245/345/221/212/346/217/220/347/244/272/350/257/215.md +18 -0
- package/dist/500.html +7 -4
- package/dist/_astro/Base.BnVp5Mf8.css +1 -0
- package/dist/_astro/{Base.astro_astro_type_script_index_0_lang.BqOtiCPG.js → Base.astro_astro_type_script_index_0_lang.Chv7r8_9.js} +2 -2
- package/dist/_astro/{CaseExecBoard.1aCJ_MsC.js → CaseExecBoard.DUMjSunb.js} +1 -1
- package/dist/_astro/{CaseGenerateApp.DW0HJj-e.js → CaseGenerateApp.DtuOyQuv.js} +1 -1
- package/dist/_astro/{CasesLibrary.BNgrULER.js → CasesLibrary.B9o_jvXb.js} +1 -1
- package/dist/_astro/ChatApp.CKPGFibd.js +227 -0
- package/dist/_astro/{DashboardBoard.DW_kipSk.js → DashboardBoard.DEvgMoqo.js} +1 -1
- package/dist/_astro/{DocsFileBrowser.DceJyP9V.js → DocsFileBrowser.D66pN9rp.js} +1 -1
- package/dist/_astro/{DocsPager.D0TMvJ67.js → DocsPager.ceBEecmd.js} +1 -1
- package/dist/_astro/{KnowledgeLibrary.C-_UybI5.js → KnowledgeLibrary.DYqE2mRi.js} +1 -1
- package/dist/_astro/{LifeKrTasksBoard.DktIT_uO.js → LifeKrTasksBoard.B7UiEutA.js} +1 -1
- package/dist/_astro/{LifeKrTodosBoard.DVUmgRmh.js → LifeKrTodosBoard.VL7HdhNY.js} +1 -1
- package/dist/_astro/{LifeObjectivesBoard.Cjg3hCkJ.js → LifeObjectivesBoard.lLBPOHEZ.js} +1 -1
- package/dist/_astro/{LifePlanTypeSelect.C63oD8zZ.js → LifePlanTypeSelect.CdKQmlEK.js} +1 -1
- package/dist/_astro/{LifeReviewsBoard.Bj4otl26.js → LifeReviewsBoard.AjO4SbsR.js} +1 -1
- package/dist/_astro/{LifeShared.-pwCbSyP.js → LifeShared.CtdsQI43.js} +1 -1
- package/dist/_astro/{LifeStagesBoard.DJpc4f7A.js → LifeStagesBoard.Dl-kTZ6K.js} +1 -1
- package/dist/_astro/{LifeYearCycleSelect.CObXQA5s.js → LifeYearCycleSelect.BILJOKXK.js} +1 -1
- package/dist/_astro/{LifeYearPlansBoard.Bt6Hc8M9.js → LifeYearPlansBoard.BzJmi7Hw.js} +1 -1
- package/dist/_astro/{NavLibraries.D9EKoN80.js → NavLibraries.BnaL-km5.js} +1 -1
- package/dist/_astro/PluginsPage.CMW4hEFr.js +1 -0
- package/dist/_astro/{PluginsPage.DwmK_UF-.js → PluginsPage.D2OrUGY3.js} +2 -2
- package/dist/_astro/{PmBugsBoard.NUiKlz46.js → PmBugsBoard.BynUocbE.js} +1 -1
- package/dist/_astro/{PmIterationsBoard.C8F55feg.js → PmIterationsBoard.CvFblvfX.js} +1 -1
- package/dist/_astro/{PmProjectDetail.CMiWhGxn.js → PmProjectDetail.Dlm6flwk.js} +1 -1
- package/dist/_astro/{PmProjectsBoard.-g9KAiZJ.js → PmProjectsBoard.B5vaWuax.js} +1 -1
- package/dist/_astro/PmRequirementsBoard.B8KTeso8.js +1 -0
- package/dist/_astro/{PmRequirementsBoard.C5_NcAzj.js → PmRequirementsBoard.piRWjiYA.js} +1 -1
- package/dist/_astro/{PmShared.D6iq_Z9g.js → PmShared.86HEsdd_.js} +1 -1
- package/dist/_astro/PromptMountDialog.DYojFMok.js +1 -0
- package/dist/_astro/PromptsLibrary.GpNbBTj1.js +1 -0
- package/dist/_astro/ReportsPage.B-xhGVEU.js +16 -0
- package/dist/_astro/{ReqAnalysisBoard.LSxbIIWk.js → ReqAnalysisBoard.B3sAOuAq.js} +1 -1
- package/dist/_astro/{RequirementsLibrary.Dat8rP5c.js → RequirementsLibrary.BGys7DeN.js} +1 -1
- package/dist/_astro/{SettingsDialog.D21ojRGF.js → SettingsDialog.CEyjZuxq.js} +1 -1
- package/dist/_astro/{SpaceSwitcher.Bw13MkIw.js → SpaceSwitcher.DJqvw5Lw.js} +1 -1
- package/dist/_astro/{TableFieldConfig.C_NeWm8L.js → TableFieldConfig.D0v9S2g3.js} +1 -1
- package/dist/_astro/{TasksBoard.wGJOOJpR.js → TasksBoard.DZ9LLl_c.js} +1 -1
- package/dist/_astro/{TemplatesLibrary.YIgI089k.js → TemplatesLibrary.iyj_kFMO.js} +1 -1
- package/dist/_astro/TestReportsLibrary.B6pf0d7W.js +1 -0
- package/dist/_astro/{TestStatsBoard.ETea2KcX.js → TestStatsBoard.DS_2bqWI.js} +1 -1
- package/dist/_astro/{TodosBoard.OfBeAGWO.js → TodosBoard.CYAVDD1W.js} +1 -1
- package/dist/_astro/UiAutoBoard.DSsiMfx2.js +9 -0
- package/dist/_astro/{app-config.C4rpn1Ix.js → app-config.DwpFFa5D.js} +1 -1
- package/dist/_astro/app-version.Dabxyva-.js +1 -0
- package/dist/_astro/{bash-tools.RQcI4_42.js → bash-tools.CfNj2sh0.js} +1 -1
- package/dist/_astro/{case-gen-run.FzgC_1Ki.js → case-gen-run.nrr97yK3.js} +1 -1
- package/dist/_astro/{case-template.C-GBxgBC.js → case-template.Cd2xNbgy.js} +1 -1
- package/dist/_astro/{case-types.CprZTsyX.js → case-types.B51yDRdf.js} +1 -1
- package/dist/_astro/{doc-roots.DAJP9Svr.js → doc-roots.CO3IBiY6.js} +1 -1
- package/dist/_astro/{hydrate-cache.DI6vqM0o.js → hydrate-cache.CoD1FB3T.js} +1 -1
- package/dist/_astro/{i18n.BJeTr39S.js → i18n.vo2aElR9.js} +2 -2
- package/dist/_astro/llm.DN5S1KBK.js +7 -0
- package/dist/_astro/markdown-client.BS19nLL3.js +62 -0
- package/dist/_astro/open-docs-in-session.DJtuI1C4.js +1 -0
- package/dist/_astro/plugins.BmKRnp4a.js +1 -0
- package/dist/_astro/project-docs.CCjtiFjB.js +1 -0
- package/dist/_astro/prompts-meta.bF2q5SUy.js +2 -0
- package/dist/_astro/{req-analysis.BqvytN69.js → req-analysis.qmyv5cBw.js} +1 -1
- package/dist/_astro/{settings.NTeTjmxg.js → settings.CYERib3l.js} +2 -2
- package/dist/_astro/{spaces-client.CMGNsQJ-.js → spaces-client.DvIgFink.js} +1 -1
- package/dist/_astro/{story-review.D8FfhzAi.js → story-review.2UUlN3p-.js} +1 -1
- package/dist/_astro/test-reports.DPQ-FMsQ.js +19 -0
- package/dist/_astro/{ui-auto-prompt.l_EXfDs5.js → ui-auto-prompt.COBTt5Gd.js} +1 -1
- package/dist/_astro/{view-prefs.8MPl3A7e.js → view-prefs.GnvelRDj.js} +1 -1
- package/dist/case-exec/index.html +8 -5
- package/dist/cases/generate/index.html +8 -5
- package/dist/cases/library/index.html +8 -5
- package/dist/dashboard/index.html +8 -5
- package/dist/docs/changelog/index.html +64 -48
- package/dist/docs/install/index.html +7 -4
- package/dist/docs/manual/index.html +32 -11
- package/dist/knowledge/index.html +8 -5
- package/dist/life/kr-tasks/index.html +8 -5
- package/dist/life/kr-todos/index.html +8 -5
- package/dist/life/objectives/index.html +8 -5
- package/dist/life/reviews/index.html +8 -5
- package/dist/life/stages/index.html +8 -5
- package/dist/life/year-plans/index.html +8 -5
- package/dist/plugins/index.html +8 -5
- package/dist/pm/bugs/index.html +8 -5
- package/dist/pm/iterations/index.html +8 -5
- package/dist/pm/projects/detail/index.html +8 -5
- package/dist/pm/projects/index.html +8 -5
- package/dist/pm/requirements/index.html +8 -5
- package/dist/prompts/index.html +8 -5
- package/dist/reports/index.html +8 -5
- package/dist/requirement-analysis/index.html +8 -5
- package/dist/requirements/index.html +8 -5
- package/dist/tasks/index.html +8 -5
- package/dist/templates/index.html +8 -5
- package/dist/test-automation/index.html +8 -5
- package/dist/test-reports/index.html +924 -0
- package/dist/test-stats/index.html +8 -5
- package/dist/todos/index.html +8 -5
- package/dist/workbench/index.html +8 -5
- package/docs//345/205/250/345/261/200/346/217/222/344/273/266.md +1 -1
- package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +17 -6
- package/lh-plugins/lh-project-docs.mjs +10 -0
- package/lh-plugins/plugin-prompts.mjs +3 -0
- package/package.json +1 -1
- package/dist/_astro/Base.C-vZfmS4.css +0 -1
- package/dist/_astro/ChatApp.DzYFE67-.js +0 -226
- package/dist/_astro/PluginsPage.DayC2eOs.js +0 -1
- package/dist/_astro/PmRequirementsBoard.C0_6ye63.js +0 -1
- package/dist/_astro/PromptMountDialog.CpTT6L0a.js +0 -62
- package/dist/_astro/PromptsLibrary.DspwabiJ.js +0 -1
- package/dist/_astro/ReportsPage.DFsDsjow.js +0 -1
- package/dist/_astro/UiAutoBoard.Df2ky1Cs.js +0 -9
- package/dist/_astro/app-version.BEerieT3.js +0 -1
- package/dist/_astro/llm.DyweO-KK.js +0 -7
- package/dist/_astro/open-docs-in-session.5cTowYAC.js +0 -1
- package/dist/_astro/plugins.C0NrHGZv.js +0 -1
- package/dist/_astro/project-docs.DAw9bzgk.js +0 -1
- package/dist/_astro/prompts-meta.Dnmq-SnF.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
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"./ConfirmDialog.D5qXeML0.js";import{t as i}from"./OverflowHint.pvo2Xc8R.js";import{t as a}from"./SelectDropdown.Dmk5n225.js";import{showToast as o}from"./Toast.BO2NFckG.js";import{c as s,d as c,i as l,l as u,n as d,o as ee,t as f}from"./ColumnResize.CkE59sGq.js";import{$ as p,A as m,B as h,C as te,D as g,E as ne,G as re,H as ie,J as ae,L as oe,M as _,N as se,Q as ce,S as le,T as ue,U as de,V as fe,W as v,X as pe,Y as me,Z as he,_ as ge,b as _e,c as ve,ct as y,et as ye,f as b,g as x,k as be,lt as S,m as C,o as w,pt as xe,q as Se,v as Ce,vt as T,w as we,wt as Te,x as Ee,y as De,z as E}from"./LifeShared
|
|
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"./ConfirmDialog.D5qXeML0.js";import{t as i}from"./OverflowHint.pvo2Xc8R.js";import{t as a}from"./SelectDropdown.Dmk5n225.js";import{showToast as o}from"./Toast.BO2NFckG.js";import{c as s,d as c,i as l,l as u,n as d,o as ee,t as f}from"./ColumnResize.CkE59sGq.js";import{$ as p,A as m,B as h,C as te,D as g,E as ne,G as re,H as ie,J as ae,L as oe,M as _,N as se,Q as ce,S as le,T as ue,U as de,V as fe,W as v,X as pe,Y as me,Z as he,_ as ge,b as _e,c as ve,ct as y,et as ye,f as b,g as x,k as be,lt as S,m as C,o as w,pt as xe,q as Se,v as Ce,vt as T,w as we,wt as Te,x as Ee,y as De,z as E}from"./LifeShared.CtdsQI43.js";import{c as D,l as O,n as k,t as A}from"./DrawerField.CWpOf3L_.js";var j=e(t(),1),M=n(),Oe=[{key:`select`,width:36,min:32},{key:`title`,width:200,min:140},{key:`objective`,width:180,min:120},{key:`year`,width:88,min:72},{key:`quarter`,width:120,min:88},{key:`progress`,width:120,min:96},{key:`score`,width:72,min:56},{key:`experience`,width:220,min:140},{key:`createdAt`,width:120,min:96},{key:`updatedAt`,width:120,min:96},{key:`filler`,filler:!0},{key:`action`,width:88,min:72}],ke=[{key:`objective`,label:`Objective`},{key:`year`,label:`年度周期`},{key:`quarter`,label:`季度周期`},{key:`progress`,label:`完成度`},{key:`score`,label:`评分`},{key:`experience`,label:`经验收获`},{key:`createdAt`,label:`创建日期`},{key:`updatedAt`,label:`修改日期`}],Ae=`life.reviews.fields`,je=`life.reviews.search`,Me=`life.reviews.group`,Ne=[`year`,`none`],Pe=[{value:`none`,label:`不分组`},{value:`year`,label:`按年度周期分组`}];function Fe(e){return{title:``,objectiveId:e?.objectiveId??``,score:e?.score??0,experience:e?.experience??`1) 有什么是做得好的
|
|
2
2
|
2) 有什么是做得不够好的
|
|
3
3
|
3) 总结如何下次做得更好`}}function N(e,t,n){if(e.trim()||!t)return;let r=n.find(e=>e.id===t)?.title.trim();return r?`${r} 复盘`:void 0}function P(e){return Math.max(0,Math.min(100,Number.isFinite(e)?e:0))}function Ie(e,t){let n=t?.yearCycle?.trim()||``;return n&&Te(e.yearCycles,n)||`—`}function Le(e){let{open:t,item:n,objectiveOptions:r,store:o,isVisible:s,onClose:c,onSave:l}=e,[u,d]=(0,j.useState)(Fe()),[ee,f]=(0,j.useState)(!1),[p,m]=(0,j.useState)(``);(0,j.useEffect)(()=>{t&&(m(``),f(!1),d({title:n.title,objectiveId:n.objectiveId,score:n.score,experience:n.experience}))},[t,n]);let h=v(o,u.objectiveId),te=h?T(h.id,o.krTasks,o.krTodos):0;async function g(){let e=u.title.trim();if(!e)m(`请填写复盘标题`);else{f(!0);try{await l({...u,title:e,score:P(u.score)},n.id),c()}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(!1)}}}return(0,M.jsxs)(_e,{open:t,title:`复盘详情`,onClose:c,footer:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,onClick:c,className:`h-9 rounded-lg border border-stone-200 px-4 text-sm text-stone-700 hover:bg-stone-50`,children:`取消`}),(0,M.jsx)(`button`,{type:`button`,disabled:ee,onClick:()=>void g(),className:`h-9 rounded-lg bg-[#3370ff] px-4 text-sm font-medium text-white hover:bg-[#2b5fd9] disabled:opacity-40`,children:ee?`保存中…`:`保存`})]}),children:[p?(0,M.jsx)(`p`,{className:`mx-6 mb-2 text-sm text-red-600`,children:p}):null,(0,M.jsx)(k,{icon:(0,M.jsx)(O,{}),label:`标题`,children:(0,M.jsx)(`input`,{autoFocus:!0,value:u.title,onChange:e=>d({...u,title:e.target.value}),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),g())},placeholder:`请输入内容`,className:A})}),s(`objective`)?(0,M.jsx)(k,{icon:(0,M.jsx)(D,{}),label:`Objective`,children:(0,M.jsx)(a,{flat:!0,searchable:!0,searchPlaceholder:`搜索 Objective…`,ariaLabel:`Objective`,options:r,value:u.objectiveId,onChange:e=>{let t=N(u.title,e,o.objectives);d({...u,objectiveId:e,...t?{title:t}:null})},className:`w-full`,triggerClassName:u.objectiveId?void 0:w,renderTrigger:()=>u.objectiveId&&h?(0,M.jsx)(i,{text:h.title,className:`block min-w-0 truncate text-stone-800`}):(0,M.jsx)(i,{text:C,className:`block min-w-0 truncate text-stone-400`})})}):null,s(`year`)?(0,M.jsx)(k,{icon:(0,M.jsx)(D,{}),label:`年度周期`,children:(0,M.jsx)(`div`,{className:`px-2 py-1.5 text-sm text-stone-500`,children:h?Ie(o,h):`跟随所属目标`})}):null,s(`quarter`)?(0,M.jsx)(k,{icon:(0,M.jsx)(D,{}),label:`季度周期`,children:(0,M.jsx)(`div`,{className:`px-2 py-1.5 text-sm text-stone-500`,children:h?h.quarter?y[h.quarter]:`—`:`跟随所属目标`})}):null,s(`progress`)?(0,M.jsx)(k,{icon:(0,M.jsx)(D,{}),label:`完成度`,children:(0,M.jsx)(`div`,{className:`px-2 py-1.5 text-sm text-stone-500`,children:h?`${te}%(按关联 KR 任务完成度)`:`关联 Objective 后自动计算`})}):null,s(`score`)?(0,M.jsx)(k,{icon:(0,M.jsx)(O,{}),label:`评分`,children:(0,M.jsx)(`input`,{type:`number`,min:0,max:100,value:u.score,onChange:e=>{let t=e.target.value;if(t===``){d({...u,score:0});return}let n=Number(t);Number.isFinite(n)&&d({...u,score:P(n)})},className:A})}):null,s(`experience`)?(0,M.jsx)(k,{icon:(0,M.jsx)(O,{}),label:`经验收获`,children:(0,M.jsx)(`textarea`,{value:u.experience,onChange:e=>d({...u,experience:e.target.value}),placeholder:S,rows:4,className:`w-full rounded-md border border-transparent px-2 py-1.5 text-sm text-stone-800 outline-none transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white`})}):null,s(`createdAt`)?(0,M.jsx)(k,{icon:(0,M.jsx)(D,{}),label:`创建日期`,children:(0,M.jsx)(`div`,{className:`px-2 py-1.5 text-sm text-stone-500`,children:E(n.createdAt)})}):null,s(`updatedAt`)?(0,M.jsx)(k,{icon:(0,M.jsx)(D,{}),label:`修改日期`,children:(0,M.jsx)(`div`,{className:`px-2 py-1.5 text-sm text-stone-500`,children:E(n.updatedAt)})}):null]})}function F(){let e=ce(),{store:t,live:n,error:_e,setError:S,updateItem:D,createItems:O,deleteItems:k}=ye(e.ready&&e.on),[A,Fe]=he(je),F=de(),[I,Re]=ae(Me,Ne,`none`),[ze,Be]=(0,j.useState)({}),[L,R]=(0,j.useState)(null),[Ve,He]=(0,j.useState)(null),[z,Ue]=(0,j.useState)(!1),[B,We]=(0,j.useState)(!1),[V,H]=(0,j.useState)({}),[U,W]=(0,j.useState)(null),G=me(Ae,ke),Ge=(0,j.useMemo)(()=>oe(Oe,G.isVisible),[G.isVisible]),K=u(`life.reviews.cols.v12`,Ge),Ke=c(`life.reviews`),qe=(0,j.useMemo)(()=>[{value:``,label:C},...Se(t.objectives).map(e=>({value:e.id,label:e.title}))],[t.objectives]),q=(0,j.useMemo)(()=>re(xe(t.reviews,A)),[t.reviews,A]),J=(0,j.useMemo)(()=>{if(I===`none`)return[{key:`all`,label:`全部复盘`,pill:`bg-stone-500 text-white`,items:q}];let e=e=>v(t,e.objectiveId)?.yearCycle?.trim()||``,n=e=>e?Te(t.yearCycles,e)||e:x,r=[...new Set(q.map(e))];r.sort((e,t)=>e?t?n(t).localeCompare(n(e),void 0,{numeric:!0}):-1:1);let i=r.filter(Boolean).map(t=>({key:`year:${t}`,label:n(t),pill:h(t),items:q.filter(n=>e(n)===t)})),a=q.filter(e=>!v(t,e.objectiveId)?.yearCycle?.trim());return a.length&&i.push({key:`year:unset`,label:x,pill:h(``),items:a}),i},[I,q,t,t.yearCycles]),Y=(0,j.useMemo)(()=>{if(I===`none`)return J;let e=J.filter(e=>e.items.length>0);return e.length>0?e:[{key:`year:unset`,label:x,pill:h(``),items:[]}]},[I,J]),Je=(0,j.useMemo)(()=>Y.flatMap(e=>e.items.map(e=>e.id)),[Y]),X=p(Je),{submit:Ye}=pe({row:U,setRow:W,submitting:B,isPristine:e=>!e.title.trim()&&e.objectiveId===e.baseObjectiveId&&e.score===e.baseScore&&e.experience===e.baseExperience,onSubmit:async e=>{We(!0);try{await O(`reviews`,[{title:e.title,objectiveId:e.objectiveId,score:P(e.score),experience:e.experience}]),W(null),o(`已新增复盘`,`success`),S(``)}catch(e){let t=e instanceof Error?e.message:String(e);S(t),o(`新增失败:${t}`,`error`)}finally{We(!1)}}});function Xe(e,t){let n=t?.objectiveId??``,r=t?.score??0,i=t?.experience??`1) 有什么是做得好的
|
|
4
4
|
2) 有什么是做得不够好的
|
|
@@ -1,3 +1,3 @@
|
|
|
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.DwpFFa5D.js";import{i as r,o as i,s as a}from"./plugins.BmKRnp4a.js";import{n as o,o as s,r as c,s as l}from"./view-prefs.GnvelRDj.js";import{i as u,n as d,r as f,t as p}from"./dialog.DZHZCe_T.js";import{t as ee}from"./jsx-runtime.DUg_B_vD.js";import{t as m}from"./DatePicker.Bkl71M49.js";import{t as h}from"./OverflowHint.pvo2Xc8R.js";import{n as te,r as ne,t as re}from"./TableFieldConfig.D0v9S2g3.js";var g=e(t(),1),_=`/__tb_life`,v=[`pending`,`in_progress`,`overdue`,`stalled`,`done`,`closed`],y=[`pool`,`in_progress`,`incomplete`,`done`,`closed`],b=[`in_progress`,`incomplete`,`done`],ie=[`urgent_important`,`urgent`,`important`,`normal`],ae={learning:`pt_learning`,work:`pt_work`,family:`pt_family`,side:`pt_side`},oe=[`Q1`,`Q2`,`Q3`,`Q4`],x={pending:`待开始`,in_progress:`进行中`,overdue:`已延期`,done:`已完成`,stalled:`已停滞`,closed:`已关闭`},se={pool:`任务池`,in_progress:`进行中`,done:`已完成`,incomplete:`未完成`,closed:`已关闭`},ce={in_progress:`进行中`,incomplete:`未完成`,done:`已完成`},le={urgent_important:`重要紧急`,urgent:`紧急不重要`,important:`重要不紧急`,normal:`不重要不紧急`,"":`—`},ue={learning:`学习成长`,work:`工作管理`,family:`家庭生活`,side:`副业赚钱`,pt_learning:`学习成长`,pt_work:`工作管理`,pt_family:`家庭生活`,pt_side:`副业赚钱`,"":`—`};function S(e){return[...e].sort((e,t)=>{let n=(t.updatedAt||``).localeCompare(e.updatedAt||``);return n===0?e.name.localeCompare(t.name,`zh`):n})}function C(e){return[...e].sort((e,t)=>{let n=(t.updatedAt||``).localeCompare(e.updatedAt||``);return n===0?e.name.localeCompare(t.name,`zh`):n})}function w(e){return[...e].sort((e,t)=>{let n=(t.updatedAt||``).localeCompare(e.updatedAt||``);return n===0?e.name.localeCompare(t.name,`zh`):n})}function T(e,t){if(!t)return``;let n=e.find(e=>e.id===t);return n?n.name:ue[t]||t}function E(e,t){if(!t)return``;let n=e.find(e=>e.id===t);return n?n.name:t}function D(e,t){if(!t)return``;let n=e.find(e=>e.id===t);return n?n.name:t}function O(e,t){let n=P(e,40);return n?t.some(e=>e.id===n)?n:t.find(e=>e.name===n)?.id??``:``}function k(e,t){let n=P(e,60);return n?t.some(e=>e.id===n)?n:t.find(e=>e.name===n)?.id??``:``}function A(e,t){let n=P(e,64);if(!n)return``;if(t.has(n))return n;let r=ae[n];return r&&t.has(r)?r:``}var j=`1) 有什么是做得好的
|
|
2
2
|
2) 有什么是做得不够好的
|
|
3
3
|
3) 总结如何下次做得更好`,M={Q1:`Q1(1月-3月)`,Q2:`Q2(4月-6月)`,Q3:`Q3(7月-9月)`,Q4:`Q4(10月-12月)`,"":`—`},N=/^\d{4}-\d{2}-\d{2}$/;function P(e,t=2e3){return typeof e==`string`?e.trim().slice(0,t):``}function F(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function I(e,t){if(!N.test(e)||!N.test(t))return null;let n=Date.parse(`${e}T00:00:00`),r=Date.parse(`${t}T00:00:00`);return!Number.isFinite(n)||!Number.isFinite(r)?null:Math.max(1,Math.round((r-n)/864e5)+1)}function L(e){return e==null?`—`:`${e} 天`}function R(){return{krTodos:[],krTasks:[],objectives:[],reviews:[],yearPlans:[],lifeStages:[],planTypes:[],yearCycles:[],lifeCycles:[]}}function z(e){return Array.isArray(e)?e:[]}function B(e){if(!e||typeof e!=`object`)return null;let t=e,n=P(t.name,40),r=P(t.id,64);return!n||!r?null:{id:r,name:n,createdAt:P(t.createdAt,40),updatedAt:P(t.updatedAt,40)}}function V(e){if(!e||typeof e!=`object`)return null;let t=e,n=P(t.name,40),r=P(t.id,64);return!n||!r?null:{id:r,name:n,createdAt:P(t.createdAt,40),updatedAt:P(t.updatedAt,40)}}function H(e){if(!e||typeof e!=`object`)return null;let t=e,n=P(t.name,60),r=P(t.id,64);return!n||!r?null:{id:r,name:n,createdAt:P(t.createdAt,40),updatedAt:P(t.updatedAt,40)}}function U(e){if(!e||typeof e!=`object`)return R();let t=e,n=z(t.planTypes).map(B).filter(e=>!!e),r=new Set(n.map(e=>e.id)),i=z(t.yearCycles).map(V).filter(e=>!!e),a=z(t.lifeCycles).map(H).filter(e=>!!e),o=e=>({...e,planType:A(e.planType,r)}),s=e=>({...e,yearCycle:O(e.yearCycle,i)}),c=e=>{let t=e.lifeCycle||e.ageRange,{ageRange:n,...r}=e;return{...r,lifeCycle:k(t,a)}},l=z(t.yearPlans).map(o).map(s),u=new Set(l.map(e=>e.id)),d=z(t.objectives).map(s).map(e=>{let t=P(e.yearPlanId,64);return{...e,yearPlanId:t&&u.has(t)?t:``}});return{krTodos:z(t.krTodos),krTasks:z(t.krTasks).map(o),objectives:d,reviews:z(t.reviews),yearPlans:l,lifeStages:z(t.lifeStages).map(o).map(c),planTypes:n,yearCycles:i,lifeCycles:a}}async function de(){let e=await fetch(_,{headers:{Accept:`application/json`}}),t=await e.json().catch(()=>({}));if(!e.ok||!t?.ok)throw Error(P(t?.error)||`读取失败(${e.status})`);return U(t)}async function fe(){let e=await(await fetch(`${_}?health=1`,{headers:{Accept:`application/json`}})).json().catch(()=>({}));return{ok:!!e?.ok,files:e?.files}}async function pe(e,t){let n=await fetch(_,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify({entity:e,items:t})}),r=await n.json().catch(()=>({}));if(!n.ok||!r?.ok)throw Error(P(r?.error)||`创建失败(${n.status})`);return{items:z(r.items),total:Number(r.total)||0}}async function me(e,t,n){let r=await fetch(_,{method:`PUT`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify({entity:e,id:t,...n})}),i=await r.json().catch(()=>({}));if(!r.ok||!i?.ok)throw Error(P(i?.error)||`更新失败(${r.status})`);return i.item}async function he(e,t){let n=await fetch(_,{method:`DELETE`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify({entity:e,ids:t})}),r=await n.json().catch(()=>({}));if(!n.ok||!r?.ok)throw Error(P(r?.error)||`删除失败(${n.status})`);return{removed:Number(r.removed)||0,total:Number(r.total)||0}}function W(e,t){let n=t.filter(t=>t.krTaskId===e),r=n.filter(e=>e.status===`done`).length,i=n.length,a=i===0?0:Math.round(r/i*100),o=n.map(e=>e.title),s=new Map;for(let e of n)s.set(e.status,(s.get(e.status)??0)+1);return{count:i,done:r,progress:a,titles:o,summary:i===0?`暂无待办`:[...s.entries()].map(([e,t])=>`${x[e]??e} ${t}`).join(` · `)}}function ge(e,t,n){let r=t.filter(t=>t.objectiveId===e);if(!r.length)return 0;let i=r.reduce((e,t)=>e+W(t.id,n).progress,0);return Math.round(i/r.length)}function _e(e,t){return t.filter(t=>t.objectiveId===e).map(e=>e.title)}function ve(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.title.toLowerCase().includes(n)||(e.note??``).toLowerCase().includes(n)):e}var G=ee(),ye=8e3;function be(){return a(`life`)}function xe(){let[e,t]=(0,g.useState)(!1),[a,o]=(0,g.useState)(()=>r(`life`));return(0,g.useEffect)(()=>{let e=!0,a=i(()=>o(r(`life`)));return n().then(()=>{e&&(o(r(`life`)),t(!0))}),()=>{e=!1,a()}},[]),{ready:e,on:a}}function Se(e){let[t,n]=(0,g.useState)(R),[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(!0),[s,c]=(0,g.useState)(``),l=(0,g.useRef)(!0),u=(0,g.useCallback)(async(e=!1)=>{e||o(!0);try{let e=await de();return l.current?(n(e),i(!0),c(``),e):null}catch(e){return l.current&&c(e instanceof Error?e.message:String(e)),null}finally{l.current&&!e&&o(!1)}},[]),d=(0,g.useCallback)(async(e,t)=>{let n=await pe(e,t);return await u(!0),n},[u]),f=(0,g.useCallback)(async(e,t,n)=>{await me(e,t,n),await u(!0)},[u]),p=(0,g.useCallback)(async(e,t)=>{await he(e,t),await u(!0)},[u]);return(0,g.useEffect)(()=>{if(!e){o(!1);return}l.current=!0;let t=null;return(async()=>{try{let e=await fe();if(!l.current)return;if(!e.ok){i(!1),o(!1);return}if(await u(),!l.current)return;i(!0),t=window.setInterval(()=>void u(!0),ye)}catch{if(!l.current)return;i(!1),o(!1)}})(),()=>{l.current=!1,t!==null&&window.clearInterval(t)}},[e,u]),{store:t,live:r,loading:a,error:s,setError:c,reload:u,createItems:d,updateItem:f,deleteItems:p}}function Ce(e){let[t,n]=(0,g.useState)(()=>c(e));return[t,(0,g.useCallback)(t=>{n(t),l(e,t)},[e])]}function we(e,t,n){let[r,i]=(0,g.useState)(()=>o(e,t,n));return[r,(0,g.useCallback)(t=>{i(t),s(e,t)},[e])]}function Te(e){let[t,n]=(0,g.useState)({}),r=(0,g.useMemo)(()=>new Set(e),[e]);(0,g.useEffect)(()=>{n(e=>{let t=!1,n={};for(let[i,a]of Object.entries(e))r.has(i)&&a?n[i]=!0:a&&(t=!0);return t||Object.keys(n).length!==Object.keys(e).length?n:e})},[r]);let i=(0,g.useMemo)(()=>Object.keys(t).filter(e=>t[e]),[t]),a=e.length>0&&e.every(e=>t[e]);function o(e){n(t=>({...t,[e]:!t[e]}))}function s(){n(t=>{let n={...t},r=!a;for(let t of e)n[t]=r;return n})}function c(){n({})}return{selected:t,selectedIds:i,allVisibleSelected:a,toggle:o,toggleAllVisible:s,clear:c}}function K(e){return e.items?e.items.length:(e.children??[]).reduce((e,t)=>e+K(t),0)}function q(e,t){let n=[],r=(e,i)=>{for(let a of e){let e=!!a.children?.length,o=K(a);if(o===0&&e||o===0&&a.items===void 0)continue;let s=!t[a.key];n.push({key:a.key,label:a.label,pill:a.pill,depth:i,count:o,kind:e?`section`:`tag`,items:e||!s?void 0:a.items??[]}),s&&e&&r(a.children,i+1)}};return r(e,0),n}function Ee(e,t){return q(e,t).flatMap(e=>e.items?e.items.map(e=>e.id):[])}function J(e=!1){return 36+(e?28:0)}function Y(e=!1){return{"--tw-sticky-left":`${J(e)}px`}}Y(!1);var De=`relative px-2 py-2 text-left text-xs font-medium whitespace-nowrap text-stone-500`,X=`relative border-l border-stone-200/90 px-2 py-2 text-left text-xs font-medium whitespace-nowrap text-stone-500`,Oe=new Set([`select`,`title`,`filler`,`action`]);function ke(e){let t=(e??``).trim();if(!t)return`—`;let n=Date.parse(t);if(!Number.isFinite(n)){let e=t.slice(0,10);return/^\d{4}-\d{2}-\d{2}$/.test(e)?e.replace(/-/g,`/`):`—`}let r=new Date(n);return`${r.getFullYear()}/${String(r.getMonth()+1).padStart(2,`0`)}/${String(r.getDate()).padStart(2,`0`)} ${String(r.getHours()).padStart(2,`0`)}:${String(r.getMinutes()).padStart(2,`0`)}`}function Ae(e,t){return ne(e,t,Oe)}function je(e,t){return te(e,t)}function Me(e){return(0,G.jsx)(re,{...e})}var Ne=`tw-sticky-l px-0 py-1 align-middle`,Pe=`tw-sticky-l px-0 py-2 text-left font-medium whitespace-nowrap`,Fe=`h-8 w-full justify-start rounded-md border border-stone-200 bg-white px-2 text-left text-sm font-normal text-stone-400 hover:border-stone-300 focus:ring-2 focus:ring-[#3370ff]/30`,Ie=`h-8 w-auto max-w-full justify-start bg-transparent px-0 text-left focus:ring-0`,Le=`未选择`,Re=`未关联`,ze=`未设置年度`;function Be(e){return(0,G.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:`text-stone-400 transition-transform duration-200 ease-out ${e.open?`rotate-0`:`-rotate-90`}`,children:(0,G.jsx)(`path`,{d:`m6 9 6 6 6-6`})})}function Ve(e){let t=(e.depth??0)>0,n=e.selectColPx??36;e.kind;let r=(0,G.jsx)(`span`,{className:`max-w-[min(100%,16rem)] truncate rounded-full px-2.5 py-0.5 text-xs font-medium ${e.pill}`,children:e.label}),i=(0,G.jsxs)(`span`,{className:`shrink-0 text-xs text-stone-400 tabular-nums`,children:[e.count,` 条记录`]}),a=(0,G.jsx)(`span`,{className:`flex h-7 w-9 shrink-0 items-center justify-center`,children:(0,G.jsx)(Be,{open:e.open})});if(!t){let t=Math.max(0,e.colSpan-2);return(0,G.jsxs)(`tr`,{role:`button`,tabIndex:0,"aria-expanded":e.open,"aria-label":e.open?`收起分组`:`展开分组`,className:`tw-life-group-head cursor-pointer bg-white`,style:{"--tw-row-bg":`#ffffff`,"--life-select-w":`${n}px`},onClick:e.onToggle,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e.onToggle())},children:[(0,G.jsx)(`td`,{colSpan:2,className:`tw-sticky-l tw-life-group-sticky-lead border-b border-stone-100 px-0 pb-1.5 pt-3 align-middle`,style:{left:0,"--tw-sticky-left":`0px`},children:(0,G.jsxs)(`div`,{className:`flex w-full items-center gap-2 py-1.5 pr-2 text-left`,children:[a,r,i]})}),t>0?(0,G.jsx)(`td`,{colSpan:t,className:`border-b border-stone-100 bg-white pb-1.5 pt-3`,"aria-hidden":`true`}):null]})}let o=Math.max(0,e.colSpan-2);return(0,G.jsxs)(`tr`,{role:`button`,tabIndex:0,"aria-expanded":e.open,"aria-label":e.open?`收起分组`:`展开分组`,className:`tw-life-group-head cursor-pointer bg-white`,style:{"--tw-row-bg":`#ffffff`,"--life-select-w":`${n}px`},onClick:e.onToggle,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e.onToggle())},children:[(0,G.jsx)(`td`,{className:`tw-sticky-l tw-life-group-sticky-lead border-b border-stone-100 px-0 py-0.5 align-middle`,style:{left:0,width:n,minWidth:n,maxWidth:n,"--tw-sticky-left":`0px`},children:(0,G.jsxs)(`div`,{className:`flex w-full items-center py-1.5`,children:[(0,G.jsx)(`span`,{className:`inline-block shrink-0`,style:{width:28},"aria-hidden":`true`}),a]})}),(0,G.jsx)(`td`,{className:`tw-sticky-l tw-life-group-sticky-label border-b border-stone-100 px-2 py-0.5 align-middle`,style:{left:n,"--tw-sticky-left":`${n}px`},children:(0,G.jsxs)(`div`,{className:`flex w-full min-w-0 items-center gap-2 py-1.5 text-left`,children:[r,i]})}),o>0?(0,G.jsx)(`td`,{colSpan:o,className:`border-b border-stone-100 bg-white py-0.5`,"aria-hidden":`true`}):null]})}function He(e){let t=(e.depth??0)>0,n=e.selectColPx??36,r=Math.max(0,e.colSpan-2);return(0,G.jsxs)(`tr`,{className:`tw-life-group-body`,style:{"--life-select-w":`${n}px`},children:[(0,G.jsx)(`td`,{className:`tw-sticky-l tw-life-group-sticky-lead px-0 py-0.5 align-middle`,style:{left:0,width:n,minWidth:n,maxWidth:n,"--tw-sticky-left":`0px`},children:(0,G.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:e.onClick,"aria-label":`新增记录`,className:`flex w-full items-center py-0.5 text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-600 disabled:opacity-40`,children:[t?(0,G.jsx)(`span`,{className:`inline-block shrink-0`,style:{width:28},"aria-hidden":`true`}):null,(0,G.jsx)(`span`,{className:`flex h-7 w-9 shrink-0 items-center justify-center text-sm leading-none`,children:`+`})]})}),(0,G.jsx)(`td`,{className:`tw-sticky-l tw-life-group-sticky-label px-2 py-0.5 align-middle`,style:{left:n,"--tw-sticky-left":`${n}px`},children:(0,G.jsx)(`button`,{type:`button`,disabled:e.disabled,onClick:e.onClick,className:`rounded py-0.5 text-xs text-stone-400 transition-colors hover:text-stone-600 disabled:opacity-40`,children:`新增记录`})}),r>0?(0,G.jsx)(`td`,{colSpan:r,className:`bg-white py-0.5`,"aria-hidden":`true`}):null]})}var Ue=`h-8 w-full truncate rounded-md border border-[#3370ff]/40 bg-white px-2 text-sm text-stone-800 outline-none focus:border-[#3370ff] disabled:opacity-50`;function We(e){let t=(0,g.useRef)(e.row);t.current=e.row;let n=(0,g.useRef)(e.submitting);n.current=e.submitting;let r=(0,g.useRef)(e.onSubmit);r.current=e.onSubmit;let i=(0,g.useRef)(e.isPristine);i.current=e.isPristine;let a=(0,g.useRef)(e.setRow);a.current=e.setRow;let o=(0,g.useCallback)(async()=>{let e=t.current;if(!e||n.current)return;let i=e.title.trim();i&&await r.current({...e,title:i})},[]);return(0,g.useEffect)(()=>{if(e.row==null)return;let n=e=>{let n=e.target;if(!(n instanceof Element)||n.closest(`.tw-new-row`)||n.closest(`.tw-select-menu`)||n.closest(`.tw-date-panel`)||n.closest(`.tw-confirm-dialog`)||n.closest(`[data-headlessui-portal]`))return;let r=t.current;r&&(r.title.trim()?o():i.current(r)&&a.current(null))};return document.addEventListener(`pointerdown`,n,!0),()=>document.removeEventListener(`pointerdown`,n,!0)},[e.row,o]),{submit:o}}function Ge(e){let t=Math.max(0,Math.min(100,Math.round(e.value)));return(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5 ${e.className??``}`,children:[(0,G.jsx)(`span`,{className:`h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-stone-100`,children:(0,G.jsx)(`span`,{className:`block h-full rounded-full bg-[#3370ff]`,style:{width:`${t}%`}})}),(0,G.jsxs)(`span`,{className:`w-9 shrink-0 text-right text-xs tabular-nums text-stone-500`,children:[t,`%`]})]})}function Ke(e){let t=Math.max(0,Math.min(100,Math.round(e.value)));return(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5 ${e.className??``}`,children:[(0,G.jsxs)(`div`,{className:`relative flex h-6 min-w-0 flex-1 items-center`,children:[(0,G.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 h-1.5 overflow-hidden rounded-full bg-stone-100`,"aria-hidden":`true`,children:(0,G.jsx)(`div`,{className:`h-full rounded-full bg-[#3370ff] transition-[width] duration-75`,style:{width:`${t}%`}})}),(0,G.jsx)(`input`,{type:`range`,min:0,max:100,value:t,"aria-label":e.ariaLabel??`进度`,onChange:t=>e.onChange(Number(t.target.value)),onMouseUp:t=>e.onCommit?.(Number(t.target.value)),onTouchEnd:t=>e.onCommit?.(Number(t.target.value)),onKeyUp:t=>{(t.key===`ArrowLeft`||t.key===`ArrowRight`||t.key===`Home`||t.key===`End`)&&e.onCommit?.(Number(t.target.value))},className:`tw-life-range relative z-1 w-full`})]}),(0,G.jsxs)(`span`,{className:`w-9 shrink-0 text-right text-xs tabular-nums text-stone-500`,children:[t,`%`]})]})}function qe(e){let t=(0,g.useRef)(null);return(0,g.useEffect)(()=>{t.current&&(t.current.indeterminate=!!e.indeterminate&&!e.checked)},[e.checked,e.indeterminate]),(0,G.jsx)(`th`,{className:Pe,"aria-label":`全选`,children:(0,G.jsxs)(`div`,{className:`flex items-center`,children:[e.nested?(0,G.jsx)(`span`,{className:`inline-block shrink-0`,style:{width:28},"aria-hidden":`true`}):null,(0,G.jsx)(`div`,{className:`flex h-7 w-9 items-center justify-center`,children:(0,G.jsx)(`input`,{ref:t,type:`checkbox`,checked:e.checked,onChange:e.onChange,"aria-label":`全选`,className:`h-3.5 w-3.5 rounded border-stone-300 text-[#3370ff] focus:ring-[#3370ff]/30`})})]})})}function Je(e){let t=!!(e.selecting||e.checked),n=(e.depth??0)>0;return(0,G.jsx)(`td`,{className:Ne,children:(0,G.jsxs)(`div`,{className:`flex items-center`,children:[n?(0,G.jsx)(`span`,{className:`inline-block shrink-0`,style:{width:28},"aria-hidden":`true`}):null,(0,G.jsxs)(`div`,{className:`relative flex h-7 w-9 shrink-0 items-center justify-center`,children:[(0,G.jsx)(`span`,{className:`text-xs tabular-nums text-stone-400 transition-opacity ${t?`opacity-0`:`opacity-100 group-hover/row:opacity-0`}`,children:e.index}),(0,G.jsx)(`input`,{type:`checkbox`,checked:e.checked,onChange:e.onChange,"aria-label":e.label,className:`absolute h-3.5 w-3.5 rounded border-stone-300 text-[#3370ff] focus:ring-[#3370ff]/30 transition-opacity ${t?`opacity-100`:`opacity-0 group-hover/row:opacity-100`}`})]})]})})}function Ye(e){return(0,G.jsxs)(f,{open:e.open,onClose:e.onClose,transition:!0,className:`relative z-100`,children:[(0,G.jsx)(p,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/25 duration-[280ms]`,"aria-hidden":`true`}),(0,G.jsx)(`div`,{className:`fixed inset-0 flex justify-end overflow-hidden`,children:(0,G.jsxs)(u,{transition:!0,className:`tw-drawer-panel-anim flex h-full w-full max-w-[520px] flex-col border-l border-stone-200 bg-white shadow-2xl duration-[280ms]`,children:[(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-stone-100 px-6 py-4`,children:[(0,G.jsx)(d,{className:`text-base font-semibold text-stone-900`,children:e.title}),(0,G.jsx)(`button`,{type:`button`,onClick:e.onClose,"aria-label":`关闭`,className:`flex h-7 w-7 items-center justify-center rounded-md text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-700`,children:`✕`})]}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-3`,children:e.children}),e.footer?(0,G.jsx)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-stone-100 px-6 py-4`,children:e.footer}):null]})})]})}function Xe(e){return(0,G.jsx)(`button`,{type:`button`,disabled:e.disabled,onClick:e.onClick,"aria-label":e.label,className:`rounded p-1 text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-700 disabled:opacity-40`,children:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M15 3h6v6`}),(0,G.jsx)(`path`,{d:`M9 21H3v-6`}),(0,G.jsx)(`path`,{d:`M21 3l-7 7`}),(0,G.jsx)(`path`,{d:`M3 21l7-7`})]})})}function Ze(e){return[...e].sort((e,t)=>{let n=e.updatedAt||e.createdAt||``;return(t.updatedAt||t.createdAt||``).localeCompare(n)})}function Qe(e){return[...e].sort((e,t)=>{let n=e.createdAt||``,r=t.createdAt||``;return n===r?String(e.id||``).localeCompare(String(t.id||``)):n.localeCompare(r)})}function $e(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,r)=>{let i=n.get(e.status??``)??t.length,a=n.get(r.status??``)??t.length;if(i!==a)return i-a;let o=e.createdAt||``,s=r.createdAt||``;return o===s?String(e.id||``).localeCompare(String(r.id||``)):o.localeCompare(s)})}function et(e,t){return e.objectives.find(e=>e.id===t)}var tt={pending:`bg-stone-100 text-stone-600`,in_progress:`bg-[#e1eaff] text-[#1f4ec2]`,overdue:`bg-[#fee4e3] text-[#c02a26]`,done:`bg-[#d9f5d2] text-[#1d7a12]`,stalled:`bg-[#fff7d6] text-[#8a6100]`,closed:`bg-stone-100 text-stone-400`},nt={pending:`bg-stone-400`,in_progress:`bg-[#3370ff]`,overdue:`bg-[#f54a45]`,done:`bg-[#34c724]`,stalled:`bg-[#f7ba1e]`,closed:`bg-stone-300`},rt={pool:`bg-stone-100 text-stone-600`,in_progress:`bg-[#e1eaff] text-[#1f4ec2]`,done:`bg-[#d9f5d2] text-[#1d7a12]`,incomplete:`bg-[#fff1e3] text-[#a85b00]`,closed:`bg-stone-100 text-stone-400`},it={pool:`bg-stone-400`,in_progress:`bg-[#3370ff]`,done:`bg-[#34c724]`,incomplete:`bg-[#ff8800]`,closed:`bg-stone-300`},at={in_progress:`bg-[#e1eaff] text-[#1f4ec2]`,incomplete:`bg-[#fff1e3] text-[#a85b00]`,done:`bg-[#d9f5d2] text-[#1d7a12]`},ot={in_progress:`bg-[#3370ff]`,incomplete:`bg-[#ff8800]`,done:`bg-[#34c724]`},st={urgent_important:`bg-[#fee4e3] text-[#c02a26]`,important:`bg-[#fff1e3] text-[#a85b00]`,urgent:`bg-[#fff7d6] text-[#8a6100]`,normal:`bg-stone-100 text-stone-600`,"":`bg-stone-50 text-stone-400`},ct={urgent_important:`bg-[#f54a45] text-white`,important:`bg-[#ff8800] text-white`,urgent:`bg-[#f7ba1e] text-stone-800`,normal:`bg-stone-200 text-stone-600`,"":`bg-transparent text-stone-400`},lt={urgent_important:`bg-[#f54a45]`,important:`bg-[#ff8800]`,urgent:`bg-[#f7ba1e]`,normal:`bg-stone-300`,"":`border border-stone-300 bg-transparent`},Z=[{cell:`bg-[#e1eaff] text-[#1f4ec2]`,pill:`bg-[#3370ff] text-white`},{cell:`bg-[#d9f5d2] text-[#1d7a12]`,pill:`bg-[#34c724] text-white`},{cell:`bg-[#fff1e3] text-[#a85b00]`,pill:`bg-[#ff8800] text-white`},{cell:`bg-[#e0f2fe] text-[#0369a1]`,pill:`bg-[#0ea5e9] text-white`},{cell:`bg-[#fce7f3] text-[#9d174d]`,pill:`bg-[#db2777] text-white`},{cell:`bg-[#ecfdf5] text-[#047857]`,pill:`bg-[#10b981] text-white`},{cell:`bg-[#fff7d6] text-[#8a6100]`,pill:`bg-[#f7ba1e] text-stone-800`},{cell:`bg-[#fee4e3] text-[#c02a26]`,pill:`bg-[#f54a45] text-white`}],ut={cell:`bg-stone-50 text-stone-400`,pill:`bg-stone-300 text-stone-600`};function dt(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return t}function Q(e){return e.trim()?Z[dt(e)%Z.length].cell:ut.cell}function ft(e){return!e.id.trim()||!e.label.trim()||e.label===`—`?(0,G.jsx)(`span`,{className:`text-sm text-stone-300`,children:e.emptyLabel??`—`}):(0,G.jsx)(`span`,{className:`inline-flex h-7 max-w-full items-center rounded-md px-2 text-xs font-medium ${Q(e.id)}`,children:(0,G.jsx)(h,{text:e.label,className:`block min-w-0 truncate`})})}var pt=`h-8 w-full min-w-0 truncate rounded-md border border-transparent bg-transparent px-1.5 text-sm text-stone-800 outline-none transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white placeholder:text-stone-300`;function $(e){let{value:t,placeholder:n,muted:r,autoFocus:i,onChange:a,onCommit:o,onCancel:s}=e;return(0,G.jsx)(`input`,{type:`text`,value:t,placeholder:n,autoFocus:i,onChange:e=>a(e.target.value),onBlur:o,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),e.currentTarget.blur()):e.key===`Escape`&&(e.preventDefault(),s(),e.currentTarget.blur())},className:`${pt} ${r&&!t?`text-stone-300`:``}`})}function mt(e){let{value:t,onChange:n,onCommit:r,onCancel:i}=e,[a,o]=(0,g.useState)(!1);return a?(0,G.jsx)($,{value:t,placeholder:`—`,autoFocus:!0,onChange:n,onCommit:()=>{o(!1),r()},onCancel:()=>{o(!1),i()}}):(0,G.jsx)(`button`,{type:`button`,onClick:()=>o(!0),className:`flex h-8 w-full min-w-0 items-center rounded-md border border-transparent px-1.5 text-left text-sm text-stone-700 transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:outline-none`,children:(0,G.jsx)(h,{text:t||`—`,className:`block min-w-0 truncate ${t?``:`text-stone-300`}`})})}function ht(e){return(0,G.jsx)(m,{value:e.value,onChange:e.onChange,placeholder:`选择日期`,className:`h-8 rounded-md border border-transparent px-1.5 text-sm text-stone-800 tabular-nums transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white`})}function gt(e){return(0,G.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,"aria-busy":`true`,"aria-label":e.label??`正在加载`,children:(0,G.jsx)(`div`,{className:`flex min-h-[240px] flex-1 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}function _t(e){return(0,G.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:e.children})}function vt(e){return(0,G.jsx)(`button`,{type:`button`,disabled:e.disabled,onClick:e.onClick,"aria-label":e.label,className:`tw-icon-danger rounded p-1`,children:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M3 6h18`}),(0,G.jsx)(`path`,{d:`M8 6V4h8v2`}),(0,G.jsx)(`path`,{d:`M19 6l-1 14H6L5 6`}),(0,G.jsx)(`path`,{d:`M10 11v6M14 11v6`})]})})}function yt(e){return(0,G.jsx)(h,{text:e.text,className:`block min-w-0 truncate px-1.5 text-sm ${e.muted?`text-stone-300`:`text-stone-600`}`})}function bt(e){return e.error?(0,G.jsxs)(`div`,{className:`mx-4 mt-3 flex shrink-0 items-start gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700`,children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1`,children:e.error}),(0,G.jsx)(`button`,{type:`button`,onClick:e.onDismiss,"aria-label":`关闭`,className:`-mr-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded text-red-700/70 hover:bg-red-100 hover:text-red-900`,children:`✕`})]}):null}export{Te as $,qe as A,Q as B,Me as C,F as Ct,Ge as D,_t as E,ot as F,Qe as G,J as H,Ee as I,we as J,$e as K,je as L,yt as M,$ as N,Ke as O,at as P,xe as Q,q as R,Xe as S,C as St,gt as T,Y as U,be as V,et as W,We as X,Ae as Y,Ce as Z,He as _,_e as _t,nt as a,ie as at,Ye as b,w as bt,Ue as c,M as ct,ct as d,ce as dt,Se as et,De as f,I as ft,ze as g,D as gt,Le as h,W as ht,tt as i,x as it,mt as j,Je as k,st as l,j as lt,Re as m,L as mt,rt as n,se as nt,Fe as o,le as ot,X as p,ve as pt,Ze as q,it as r,v as rt,Ie as s,oe as st,ht as t,y as tt,lt as u,b as ut,ft as v,ge as vt,Ve as w,E as wt,bt as x,S as xt,vt as y,T as yt,ke as z};
|
|
@@ -1 +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"./ConfirmDialog.D5qXeML0.js";import{t as i}from"./OverflowHint.pvo2Xc8R.js";import{t as ee}from"./SelectDropdown.Dmk5n225.js";import{m as a}from"./PmShared.D6iq_Z9g.js";import{showToast as o}from"./Toast.BO2NFckG.js";import{c as s,d as c,i as l,l as u,n as d,o as f,t as p}from"./ColumnResize.CkE59sGq.js";import{t as m}from"./NamePromptDialog.Csfnh5eM.js";import{$ as h,A as te,B as g,C as ne,E as _,G as re,H as v,J as y,L as b,M as x,N as S,O as C,Q as w,S as T,T as E,U as D,V as O,X as ie,Y as ae,Z as oe,_ as se,b as k,bt as ce,c as le,et as ue,f as A,gt as de,h as j,k as fe,pt as pe,w as me,x as he,xt as ge,y as _e,yt as ve,z as M}from"./LifeShared.-pwCbSyP.js";import{c as N,l as P,n as F,t as I}from"./DrawerField.CWpOf3L_.js";import{t as ye}from"./LifePlanTypeSelect.C63oD8zZ.js";var L=e(t(),1),R=n(),z=j;function be(e){let{lifeCycles:t,value:n,onChange:s,mutate:c,flat:l,unstyled:u,pill:d,className:f,triggerClassName:p,ariaLabel:h=`人生周期`,searchPlaceholder:te=`搜索人生周期…`,placeholder:ne=z,renderTrigger:_}=e,[re,v]=(0,L.useState)(!1),[y,b]=(0,L.useState)(null),[x,S]=(0,L.useState)(``),[C,w]=(0,L.useState)(null),T=(0,L.useMemo)(()=>ce(t),[t]),E=(0,L.useMemo)(()=>T.map(e=>({value:e.id,label:e.name})),[T]),D=n&&E.some(e=>e.value===n)?n:``,O=!D,ie=O?ne:de(T,D);async function ae(e){let t=e.trim();if(!t)return;let n=T.find(e=>e.name===t);if(n)s(n.id);else{v(!0);try{let e=(await c.createItems(`lifeCycles`,[{name:t}])).items[0];e?.id&&s(e.id),o(`已新增「${t}」`,`success`)}catch(e){o(e instanceof Error?e.message:String(e),`error`)}finally{v(!1)}}}async function oe(e){let t=y;if(!t)return;let n=e.trim();if(!n||n===t.name)b(null),S(``);else{v(!0),S(``);try{await c.updateItem(`lifeCycles`,t.id,{name:n}),b(null),o(`已修改人生周期`,`success`)}catch(e){S(e instanceof Error?e.message:String(e))}finally{v(!1)}}}async function se(){let e=C;if(e){w(null),v(!0);try{await c.deleteItems(`lifeCycles`,[e.id]),D===e.id&&s(``),o(`已删除人生周期`,`success`)}catch(e){o(e instanceof Error?e.message:String(e),`error`)}finally{v(!1)}}}return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ee,{flat:l,unstyled:u,fitContent:!(!d||O),centerContent:!1,className:f,triggerClassName:(d?O?`h-8 w-full justify-start rounded-md border border-stone-200 bg-white px-2 text-left text-sm font-normal text-stone-400 hover:border-stone-300 focus:ring-2 focus:ring-[#3370ff]/30`:`h-8 w-auto max-w-full justify-start bg-transparent px-0 text-left focus:ring-0`:void 0)??p,searchable:!0,searchPlaceholder:te,ariaLabel:h,options:E,value:D,onChange:s,onSearchCreate:e=>void ae(e),renderTrigger:_?(e,t)=>_(ie,{...t,empty:O}):()=>d&&!O?(0,R.jsx)(`span`,{className:`inline-flex h-7 max-w-full items-center truncate rounded-md px-2 text-xs font-medium ${g(D)}`,children:(0,R.jsx)(i,{text:ie,className:`block min-w-0 truncate`})}):(0,R.jsx)(i,{text:ie,className:`block min-w-0 truncate ${O||E.length===0?`text-stone-400`:`text-stone-800`}`}),renderOptionAction:e=>(0,R.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:re,"aria-label":`修改 ${e.label}`,className:`rounded p-1 text-stone-400 opacity-0 transition-opacity hover:bg-stone-100 hover:text-stone-700 focus-visible:opacity-100 group-hover:opacity-100 disabled:opacity-0`,onClick:()=>{let t=T.find(t=>t.id===e.value);t&&(S(``),b(t))},children:(0,R.jsx)(a,{name:`pencil`,size:13})}),(0,R.jsx)(`button`,{type:`button`,disabled:re,"aria-label":`删除 ${e.label}`,className:`tw-icon-danger rounded p-1 opacity-0 transition-opacity focus-visible:opacity-100 group-hover:opacity-100 disabled:opacity-0 disabled:group-hover:opacity-40`,onClick:()=>{let t=T.find(t=>t.id===e.value);t&&w(t)},children:(0,R.jsx)(a,{name:`trash`,size:13})})]})}),(0,R.jsx)(m,{open:y!=null,title:`修改人生周期`,label:`人生周期`,placeholder:`例如 第一辈子(29-34)`,initialValue:y?.name??``,confirmLabel:`保存`,cancelLabel:`取消`,error:x,onClose:()=>{b(null),S(``)},onConfirm:e=>void oe(e)}),(0,R.jsx)(r,{open:C!=null,title:`删除人生周期`,message:`删除「${C?.name??``}」?已引用该周期的人生阶段会清空周期。`,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>w(null),onConfirm:()=>void se()})]})}var xe=[{key:`select`,width:36,min:32},{key:`title`,width:220,min:160},{key:`lifeCycle`,width:160,min:120},{key:`planType`,width:140,min:100},{key:`progress`,width:160,min:120},{key:`createdAt`,width:120,min:96},{key:`updatedAt`,width:120,min:96},{key:`filler`,filler:!0},{key:`action`,width:88,min:72}],Se=[{key:`lifeCycle`,label:`人生周期`},{key:`planType`,label:`计划类型`},{key:`progress`,label:`进度`},{key:`createdAt`,label:`创建日期`},{key:`updatedAt`,label:`修改日期`}],Ce=`life.stages.fields`,we=`life.stages.search`,Te=`life.stages.group`,Ee=[`lifeCycle`,`planType`,`none`],De=[{value:`none`,label:`不分组`},{value:`lifeCycle`,label:`按人生周期分组`},{value:`planType`,label:`按计划类型分组`}];function Oe(e){return{title:``,lifeCycle:e?.lifeCycle??``,planType:e?.planType??``,progress:e?.progress??0}}function ke(e){let t={},n=/(?:^|\|)lifeCycle:([^|]+)/.exec(e)?.[1];n===`unset`?t.lifeCycle=``:n&&(t.lifeCycle=n);let r=/(?:^|\|)planType:([^|]+)/.exec(e)?.[1];return r===`unset`?t.planType=``:r&&(t.planType=r),t}function Ae(e){let{open:t,item:n,planTypes:r,lifeCycles:ee,mutate:a,isVisible:o,onClose:s,onSave:c}=e,[l,u]=(0,L.useState)(Oe()),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(``);(0,L.useEffect)(()=>{t&&(m(``),f(!1),u({title:n.title,lifeCycle:n.lifeCycle||``,planType:n.planType||``,progress:n.progress}))},[t,n]);async function h(){let e=l.title.trim();if(!e)m(`请填写阶段名称`);else{f(!0);try{await c({...l,title:e,progress:Math.max(0,Math.min(100,l.progress))},n.id),s()}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(!1)}}}return(0,R.jsxs)(k,{open:t,title:`阶段详情`,onClose:s,footer:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,onClick:s,className:`h-9 rounded-lg border border-stone-200 px-4 text-sm text-stone-700 hover:bg-stone-50`,children:`取消`}),(0,R.jsx)(`button`,{type:`button`,disabled:d,onClick:()=>void h(),className:`h-9 rounded-lg bg-[#3370ff] px-4 text-sm font-medium text-white hover:bg-[#2b5fd9] disabled:opacity-40`,children:d?`保存中…`:`保存`})]}),children:[p?(0,R.jsx)(`p`,{className:`mx-6 mb-2 text-sm text-red-600`,children:p}):null,(0,R.jsx)(F,{icon:(0,R.jsx)(P,{}),label:`阶段名称`,children:(0,R.jsx)(`input`,{autoFocus:!0,value:l.title,onChange:e=>u({...l,title:e.target.value}),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),h())},placeholder:`如 第一辈子`,className:I})}),o(`lifeCycle`)?(0,R.jsx)(F,{icon:(0,R.jsx)(N,{}),label:`人生周期`,children:(0,R.jsx)(be,{flat:!0,className:`w-full`,lifeCycles:ee,value:l.lifeCycle,onChange:e=>u({...l,lifeCycle:e}),mutate:a,renderTrigger:(e,{empty:t})=>(0,R.jsx)(i,{text:e,className:`block min-w-0 flex-1 basis-0 truncate ${t?`text-stone-400`:`text-stone-800`}`})})}):null,o(`planType`)?(0,R.jsx)(F,{icon:(0,R.jsx)(N,{}),label:`计划类型`,children:(0,R.jsx)(ye,{flat:!0,className:`w-full`,planTypes:r,value:l.planType,onChange:e=>u({...l,planType:e}),mutate:a,renderTrigger:(e,{empty:t})=>(0,R.jsx)(i,{text:e,className:`block min-w-0 flex-1 basis-0 truncate ${t?`text-stone-400`:`text-stone-800`}`})})}):null,o(`progress`)?(0,R.jsx)(F,{icon:(0,R.jsx)(N,{}),label:`进度`,children:(0,R.jsx)(`div`,{className:`px-1 py-1`,children:(0,R.jsx)(C,{value:l.progress,onChange:e=>u({...l,progress:e})})})}):null,o(`createdAt`)?(0,R.jsx)(F,{icon:(0,R.jsx)(N,{}),label:`创建日期`,children:(0,R.jsx)(`div`,{className:`px-2 py-1.5 text-sm text-stone-500`,children:M(n.createdAt)})}):null,o(`updatedAt`)?(0,R.jsx)(F,{icon:(0,R.jsx)(N,{}),label:`修改日期`,children:(0,R.jsx)(`div`,{className:`px-2 py-1.5 text-sm text-stone-500`,children:M(n.updatedAt)})}):null]})}function je(){let e=w(),{store:t,live:n,error:i,setError:a,updateItem:m,createItems:k,deleteItems:N}=ue(e.ready&&e.on),P=(0,L.useMemo)(()=>({createItems:k,updateItem:m,deleteItems:N}),[k,m,N]),F=ae(Ce,Se),I=(0,L.useMemo)(()=>b(xe,F.isVisible),[F.isVisible]),[z,je]=oe(we),[B,Me]=y(Te,Ee,`none`),[Ne,Pe]=(0,L.useState)({}),Fe=D(),[V,H]=(0,L.useState)(null),[Ie,Le]=(0,L.useState)(null),[U,Re]=(0,L.useState)(!1),[W,ze]=(0,L.useState)(!1),[Be,Ve]=(0,L.useState)({}),[G,K]=(0,L.useState)(null),q=u(`life.stages.cols.v14`,I),He=c(`life.stages`),{submit:Ue}=ie({row:G,setRow:K,submitting:W,isPristine:e=>{let t=e.base;return!e.title.trim()&&e.lifeCycle===t.lifeCycle&&e.planType===t.planType&&e.progress===t.progress},onSubmit:async e=>{ze(!0);try{await k(`lifeStages`,[{title:e.title,lifeCycle:e.lifeCycle,planType:e.planType,progress:Math.max(0,Math.min(100,e.progress))}]),K(null),o(`已新增人生阶段`,`success`),a(``)}catch(e){let t=e instanceof Error?e.message:String(e);a(t),o(`新增失败:${t}`,`error`)}finally{ze(!1)}}});function J(e,t){let n=Oe(t);K({groupKey:e,...n,base:n}),Pe(t=>({...t,[e]:!1}))}let Y=(0,L.useMemo)(()=>{let e=z.trim().toLowerCase(),n=t.lifeStages;return n=e?n.filter(n=>{let r=de(t.lifeCycles,n.lifeCycle).toLowerCase(),i=ve(t.planTypes,n.planType).toLowerCase();return n.title.toLowerCase().includes(e)||r.includes(e)||i.includes(e)}):pe(n,z),re(n)},[t.lifeStages,t.lifeCycles,t.planTypes,z]),X=(0,L.useMemo)(()=>{if(B===`none`)return[{key:`all`,label:`全部阶段`,pill:`bg-stone-500 text-white`,items:Y}];if(B===`lifeCycle`){let e=ce(t.lifeCycles),n=new Set(e.map(e=>e.id)),r=e.map(e=>({key:`lifeCycle:${e.id}`,label:e.name,pill:g(e.id),items:Y.filter(t=>t.lifeCycle===e.id)})).filter(e=>e.items.length>0),i=Y.filter(e=>!e.lifeCycle||!n.has(e.lifeCycle));return i.length>0&&r.push({key:`lifeCycle:unset`,label:j,pill:g(``),items:i}),r}let e=ge(t.planTypes),n=new Set(e.map(e=>e.id)),r=e.map(e=>({key:`planType:${e.id}`,label:e.name,pill:g(e.id),items:Y.filter(t=>t.planType===e.id)})).filter(e=>e.items.length>0),i=Y.filter(e=>!e.planType||!n.has(e.planType));return i.length>0&&r.push({key:`planType:unset`,label:j,pill:g(``),items:i}),r},[B,Y,t.lifeCycles,t.planTypes]),Z=(0,L.useMemo)(()=>{let e=X.filter(e=>e.items.length>0);return e.length>0?e:B===`none`?X.length>0?X:[{key:`all`,label:`全部阶段`,pill:`bg-stone-500 text-white`,items:[]}]:B===`lifeCycle`?[{key:`lifeCycle:unset`,label:j,pill:g(``),items:[]}]:[{key:`planType:unset`,label:j,pill:g(``),items:[]}]},[B,X]),We=(0,L.useMemo)(()=>Z.flatMap(e=>e.items.map(e=>e.id)),[Z]),Q=h(We);async function Ge(e,t){try{await m(`lifeStages`,e,t),Ve(t=>{let n={...t};return delete n[e],n}),a(``)}catch(e){let t=e instanceof Error?e.message:String(e);a(t),o(`保存失败:${t}`,`error`)}}function Ke(e){return{...e,...Be[e.id]}}function qe(e,t){Ve(n=>({...n,[e]:{...n[e],...t}}))}async function Je(e){let t=Be[e.id];if(!t)return;let n=(t.title??e.title).trim();n?await Ge(e.id,{...t,title:n}):a(`阶段名称不能为空`)}async function Ye(e,t){await m(`lifeStages`,t,e),o(`已保存`,`success`)}function Xe(){return G?(0,R.jsxs)(`tr`,{className:`tw-new-row`,children:[(0,R.jsx)(`td`,{className:`px-2 py-1 align-middle`}),(0,R.jsx)(`td`,{className:d,style:Fe,children:(0,R.jsx)(`input`,{autoFocus:!0,disabled:W,value:G.title,placeholder:`输入阶段名称,回车或点空白处保存`,onChange:e=>K(t=>t&&{...t,title:e.target.value}),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),Ue()):e.key===`Escape`&&(e.preventDefault(),K(null))},className:le})}),F.isVisible(`lifeCycle`)?(0,R.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,R.jsx)(be,{unstyled:!0,pill:!0,lifeCycles:t.lifeCycles,value:G.lifeCycle,onChange:e=>K(t=>t&&{...t,lifeCycle:e}),mutate:P})}):null,F.isVisible(`planType`)?(0,R.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,R.jsx)(ye,{unstyled:!0,pill:!0,planTypes:t.planTypes,value:G.planType,onChange:e=>K(t=>t&&{...t,planType:e}),mutate:P})}):null,F.isVisible(`progress`)?(0,R.jsx)(`td`,{className:`px-2 py-1 align-middle`,children:(0,R.jsx)(C,{value:G.progress,onChange:e=>K(t=>t&&{...t,progress:e})})}):null,F.isVisible(`createdAt`)?(0,R.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,R.jsx)(x,{text:`—`,muted:!0})}):null,F.isVisible(`updatedAt`)?(0,R.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,R.jsx)(x,{text:`—`,muted:!0})}):null,(0,R.jsx)(`td`,{"aria-hidden":`true`}),(0,R.jsx)(`td`,{className:l})]}):null}async function Ze(){let e=V;if(e?.length){H(null),Re(!0);try{await N(`lifeStages`,e.map(e=>e.id)),Q.clear(),o(e.length>1?`已删除 ${e.length} 条`:`已删除`,`success`)}catch(e){a(e instanceof Error?e.message:String(e))}finally{Re(!1)}}}function Qe(e,n){let r=Ke(e),i=(Be[e.id]?.progress,r.progress);return(0,R.jsxs)(`tr`,{className:`group/row hover:bg-[#f7f8fa]`,children:[(0,R.jsx)(fe,{checked:!!Q.selected[e.id],onChange:()=>Q.toggle(e.id),label:`选择 ${e.title}`,index:n,selecting:Q.selectedIds.length>0}),(0,R.jsx)(`td`,{className:d,style:Fe,children:(0,R.jsx)(S,{value:r.title,placeholder:`如 第一辈子`,onChange:t=>qe(e.id,{title:t}),onCommit:()=>void Je(e),onCancel:()=>Ve(t=>{let n={...t};return delete n[e.id],n})})}),F.isVisible(`lifeCycle`)?(0,R.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,R.jsx)(be,{unstyled:!0,pill:!0,lifeCycles:t.lifeCycles,value:r.lifeCycle||``,onChange:t=>void Ge(e.id,{lifeCycle:t}),mutate:P})}):null,F.isVisible(`planType`)?(0,R.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,R.jsx)(ye,{unstyled:!0,pill:!0,planTypes:t.planTypes,value:r.planType,onChange:t=>void Ge(e.id,{planType:t}),mutate:P})}):null,F.isVisible(`progress`)?(0,R.jsx)(`td`,{className:`px-2 py-1 align-middle`,children:(0,R.jsx)(C,{value:i,onChange:t=>qe(e.id,{progress:t}),onCommit:t=>void Ge(e.id,{progress:t})})}):null,F.isVisible(`createdAt`)?(0,R.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,R.jsx)(x,{text:M(e.createdAt),muted:!e.createdAt})}):null,F.isVisible(`updatedAt`)?(0,R.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,R.jsx)(x,{text:M(e.updatedAt),muted:!e.updatedAt})}):null,(0,R.jsx)(`td`,{"aria-hidden":`true`}),(0,R.jsx)(`td`,{className:l,children:(0,R.jsxs)(`div`,{className:`flex justify-end gap-0.5`,children:[(0,R.jsx)(T,{label:`编辑 ${e.title}`,disabled:U,onClick:()=>Le(e)}),(0,R.jsx)(_e,{label:`删除 ${e.title}`,disabled:U,onClick:()=>H([e])})]})})]},e.id)}if(!e.ready)return(0,R.jsx)(E,{label:`正在读取插件开关`});if(!e.on)return(0,R.jsx)(_,{children:O()});if(n===null)return(0,R.jsx)(E,{label:`正在连接人生管理服务`});if(!n)return(0,R.jsx)(_,{children:`人生管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`});let $=I.length;return(0,R.jsxs)(`section`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-3 border-b border-stone-100 px-4 py-3`,children:[(0,R.jsxs)(`div`,{className:`text-sm text-stone-600`,children:[`共 `,(0,R.jsx)(`span`,{className:`font-medium text-stone-800`,children:t.lifeStages.length}),` 条`]}),(0,R.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`input`,{value:z,onChange:e=>je(e.target.value),placeholder:`搜索人生阶段…`,className:`h-9 w-52 rounded-lg border border-stone-200 px-3 text-sm text-stone-800 outline-none focus:border-[#3370ff]`}),(0,R.jsx)(ee,{flat:!0,className:`w-[168px]`,ariaLabel:`分组方式`,options:De,value:B,onChange:e=>Me(e)}),(0,R.jsx)(ne,{fields:F.fields,isVisible:F.isVisible,onToggle:F.toggle}),(0,R.jsx)(`button`,{type:`button`,disabled:U||Q.selectedIds.length===0,onClick:()=>H(t.lifeStages.filter(e=>Q.selected[e.id])),className:`h-9 shrink-0 rounded-lg border border-red-200 px-3 text-sm font-medium whitespace-nowrap text-red-600 hover:bg-red-50 disabled:opacity-40`,children:`批量删除`}),(0,R.jsx)(`button`,{type:`button`,disabled:U||W,onClick:()=>{if(B===`none`)J(`all`);else{let e=Z[0];J(e?.key??`all`,e?ke(e.key):void 0)}},className:`h-9 shrink-0 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white hover:bg-[#2b5fd9] disabled:opacity-40`,children:`+ 新建阶段`})]})]}),(0,R.jsx)(he,{error:i,onDismiss:()=>a(``)}),(0,R.jsx)(`div`,{ref:He,className:`tw-scroll-x min-h-0 flex-1 overflow-auto`,children:(0,R.jsxs)(`table`,{className:`tw-task-table tw-sticky-table w-full table-fixed text-sm`,style:q.tableStyle,children:[(0,R.jsx)(`colgroup`,{children:I.map(e=>(0,R.jsx)(`col`,{style:e.key===`select`?{width:v(!1)}:q.widthOf(e.key)?{width:q.widthOf(e.key)}:void 0},e.key))}),(0,R.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-xs text-stone-500`,children:(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(te,{checked:Q.allVisibleSelected,indeterminate:Q.selectedIds.length>0&&!Q.allVisibleSelected,onChange:()=>Q.toggleAllVisible()}),(0,R.jsxs)(`th`,{className:`${f} text-xs text-stone-500`,style:Fe,children:[`阶段名称`,(0,R.jsx)(p,{...q.resizeProps(`title`)})]}),F.isVisible(`lifeCycle`)?(0,R.jsxs)(`th`,{className:A,children:[`人生周期`,(0,R.jsx)(p,{...q.resizeProps(`lifeCycle`)})]}):null,F.isVisible(`planType`)?(0,R.jsxs)(`th`,{className:A,children:[`计划类型`,(0,R.jsx)(p,{...q.resizeProps(`planType`)})]}):null,F.isVisible(`progress`)?(0,R.jsxs)(`th`,{className:A,children:[`进度`,(0,R.jsx)(p,{...q.resizeProps(`progress`)})]}):null,F.isVisible(`createdAt`)?(0,R.jsxs)(`th`,{className:A,children:[`创建日期`,(0,R.jsx)(p,{...q.resizeProps(`createdAt`)})]}):null,F.isVisible(`updatedAt`)?(0,R.jsxs)(`th`,{className:A,children:[`修改日期`,(0,R.jsx)(p,{...q.resizeProps(`updatedAt`)})]}):null,(0,R.jsx)(`th`,{"aria-hidden":`true`}),(0,R.jsx)(`th`,{className:s,children:`操作`})]})}),(0,R.jsx)(`tbody`,{children:Y.length===0&&!G?(0,R.jsx)(`tr`,{children:(0,R.jsx)(`td`,{colSpan:$,className:`px-3 py-16 text-center text-sm text-stone-400`,children:t.lifeStages.length===0?`还没有人生阶段`:`没有匹配的记录`})}):Y.length===0&&G?Xe():B===`none`?(0,R.jsxs)(R.Fragment,{children:[Y.map((e,t)=>Qe(e,t+1)),G?Xe():(0,R.jsx)(se,{colSpan:$,disabled:U||W,onClick:()=>J(`all`)})]}):Z.map(e=>{let n=!Ne[e.key];return(0,R.jsxs)(L.Fragment,{children:[(0,R.jsx)(me,{label:e.label,pill:e.pill,count:e.items.length,open:n,kind:`tag`,colSpan:$,onToggle:()=>Pe(t=>({...t,[e.key]:!t[e.key]}))}),n?(0,R.jsxs)(R.Fragment,{children:[e.items.map((e,t)=>Qe(e,t+1)),G?.groupKey===e.key?Xe():Y.length>0||t.lifeStages.length===0?(0,R.jsx)(se,{colSpan:$,disabled:U||W,onClick:()=>J(e.key,ke(e.key))}):null]}):null]},e.key)})})]})}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-t border-stone-100 px-4 py-2.5 text-xs text-stone-500`,children:[(0,R.jsxs)(`span`,{children:[`显示 `,Y.length,` 条`,Q.selectedIds.length?` · 已选 ${Q.selectedIds.length}`:``]}),(0,R.jsx)(`span`,{className:`ml-auto text-stone-400`,children:`可添加多个阶段并分别维护进度`})]}),Ie?(0,R.jsx)(Ae,{open:!0,item:Ie,planTypes:t.planTypes,lifeCycles:t.lifeCycles,mutate:P,isVisible:F.isVisible,onClose:()=>Le(null),onSave:Ye}):null,(0,R.jsx)(r,{open:V!=null,title:V&&V.length>1?`批量删除`:`删除人生阶段`,message:V&&V.length>1?`删除选中的 ${V.length} 条阶段?`:`删除「${V?.[0]?.title??``}」?`,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>H(null),onConfirm:()=>void Ze()})]})}export{je as default};
|
|
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"./ConfirmDialog.D5qXeML0.js";import{t as i}from"./OverflowHint.pvo2Xc8R.js";import{t as ee}from"./SelectDropdown.Dmk5n225.js";import{m as a}from"./PmShared.86HEsdd_.js";import{showToast as o}from"./Toast.BO2NFckG.js";import{c as s,d as c,i as l,l as u,n as d,o as f,t as p}from"./ColumnResize.CkE59sGq.js";import{t as m}from"./NamePromptDialog.Csfnh5eM.js";import{$ as h,A as te,B as g,C as ne,E as _,G as re,H as v,J as y,L as b,M as x,N as S,O as C,Q as w,S as T,T as E,U as D,V as O,X as ie,Y as ae,Z as oe,_ as se,b as k,bt as ce,c as le,et as ue,f as A,gt as de,h as j,k as fe,pt as pe,w as me,x as he,xt as ge,y as _e,yt as ve,z as M}from"./LifeShared.CtdsQI43.js";import{c as N,l as P,n as F,t as I}from"./DrawerField.CWpOf3L_.js";import{t as ye}from"./LifePlanTypeSelect.CdKQmlEK.js";var L=e(t(),1),R=n(),z=j;function be(e){let{lifeCycles:t,value:n,onChange:s,mutate:c,flat:l,unstyled:u,pill:d,className:f,triggerClassName:p,ariaLabel:h=`人生周期`,searchPlaceholder:te=`搜索人生周期…`,placeholder:ne=z,renderTrigger:_}=e,[re,v]=(0,L.useState)(!1),[y,b]=(0,L.useState)(null),[x,S]=(0,L.useState)(``),[C,w]=(0,L.useState)(null),T=(0,L.useMemo)(()=>ce(t),[t]),E=(0,L.useMemo)(()=>T.map(e=>({value:e.id,label:e.name})),[T]),D=n&&E.some(e=>e.value===n)?n:``,O=!D,ie=O?ne:de(T,D);async function ae(e){let t=e.trim();if(!t)return;let n=T.find(e=>e.name===t);if(n)s(n.id);else{v(!0);try{let e=(await c.createItems(`lifeCycles`,[{name:t}])).items[0];e?.id&&s(e.id),o(`已新增「${t}」`,`success`)}catch(e){o(e instanceof Error?e.message:String(e),`error`)}finally{v(!1)}}}async function oe(e){let t=y;if(!t)return;let n=e.trim();if(!n||n===t.name)b(null),S(``);else{v(!0),S(``);try{await c.updateItem(`lifeCycles`,t.id,{name:n}),b(null),o(`已修改人生周期`,`success`)}catch(e){S(e instanceof Error?e.message:String(e))}finally{v(!1)}}}async function se(){let e=C;if(e){w(null),v(!0);try{await c.deleteItems(`lifeCycles`,[e.id]),D===e.id&&s(``),o(`已删除人生周期`,`success`)}catch(e){o(e instanceof Error?e.message:String(e),`error`)}finally{v(!1)}}}return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ee,{flat:l,unstyled:u,fitContent:!(!d||O),centerContent:!1,className:f,triggerClassName:(d?O?`h-8 w-full justify-start rounded-md border border-stone-200 bg-white px-2 text-left text-sm font-normal text-stone-400 hover:border-stone-300 focus:ring-2 focus:ring-[#3370ff]/30`:`h-8 w-auto max-w-full justify-start bg-transparent px-0 text-left focus:ring-0`:void 0)??p,searchable:!0,searchPlaceholder:te,ariaLabel:h,options:E,value:D,onChange:s,onSearchCreate:e=>void ae(e),renderTrigger:_?(e,t)=>_(ie,{...t,empty:O}):()=>d&&!O?(0,R.jsx)(`span`,{className:`inline-flex h-7 max-w-full items-center truncate rounded-md px-2 text-xs font-medium ${g(D)}`,children:(0,R.jsx)(i,{text:ie,className:`block min-w-0 truncate`})}):(0,R.jsx)(i,{text:ie,className:`block min-w-0 truncate ${O||E.length===0?`text-stone-400`:`text-stone-800`}`}),renderOptionAction:e=>(0,R.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:re,"aria-label":`修改 ${e.label}`,className:`rounded p-1 text-stone-400 opacity-0 transition-opacity hover:bg-stone-100 hover:text-stone-700 focus-visible:opacity-100 group-hover:opacity-100 disabled:opacity-0`,onClick:()=>{let t=T.find(t=>t.id===e.value);t&&(S(``),b(t))},children:(0,R.jsx)(a,{name:`pencil`,size:13})}),(0,R.jsx)(`button`,{type:`button`,disabled:re,"aria-label":`删除 ${e.label}`,className:`tw-icon-danger rounded p-1 opacity-0 transition-opacity focus-visible:opacity-100 group-hover:opacity-100 disabled:opacity-0 disabled:group-hover:opacity-40`,onClick:()=>{let t=T.find(t=>t.id===e.value);t&&w(t)},children:(0,R.jsx)(a,{name:`trash`,size:13})})]})}),(0,R.jsx)(m,{open:y!=null,title:`修改人生周期`,label:`人生周期`,placeholder:`例如 第一辈子(29-34)`,initialValue:y?.name??``,confirmLabel:`保存`,cancelLabel:`取消`,error:x,onClose:()=>{b(null),S(``)},onConfirm:e=>void oe(e)}),(0,R.jsx)(r,{open:C!=null,title:`删除人生周期`,message:`删除「${C?.name??``}」?已引用该周期的人生阶段会清空周期。`,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>w(null),onConfirm:()=>void se()})]})}var xe=[{key:`select`,width:36,min:32},{key:`title`,width:220,min:160},{key:`lifeCycle`,width:160,min:120},{key:`planType`,width:140,min:100},{key:`progress`,width:160,min:120},{key:`createdAt`,width:120,min:96},{key:`updatedAt`,width:120,min:96},{key:`filler`,filler:!0},{key:`action`,width:88,min:72}],Se=[{key:`lifeCycle`,label:`人生周期`},{key:`planType`,label:`计划类型`},{key:`progress`,label:`进度`},{key:`createdAt`,label:`创建日期`},{key:`updatedAt`,label:`修改日期`}],Ce=`life.stages.fields`,we=`life.stages.search`,Te=`life.stages.group`,Ee=[`lifeCycle`,`planType`,`none`],De=[{value:`none`,label:`不分组`},{value:`lifeCycle`,label:`按人生周期分组`},{value:`planType`,label:`按计划类型分组`}];function Oe(e){return{title:``,lifeCycle:e?.lifeCycle??``,planType:e?.planType??``,progress:e?.progress??0}}function ke(e){let t={},n=/(?:^|\|)lifeCycle:([^|]+)/.exec(e)?.[1];n===`unset`?t.lifeCycle=``:n&&(t.lifeCycle=n);let r=/(?:^|\|)planType:([^|]+)/.exec(e)?.[1];return r===`unset`?t.planType=``:r&&(t.planType=r),t}function Ae(e){let{open:t,item:n,planTypes:r,lifeCycles:ee,mutate:a,isVisible:o,onClose:s,onSave:c}=e,[l,u]=(0,L.useState)(Oe()),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(``);(0,L.useEffect)(()=>{t&&(m(``),f(!1),u({title:n.title,lifeCycle:n.lifeCycle||``,planType:n.planType||``,progress:n.progress}))},[t,n]);async function h(){let e=l.title.trim();if(!e)m(`请填写阶段名称`);else{f(!0);try{await c({...l,title:e,progress:Math.max(0,Math.min(100,l.progress))},n.id),s()}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(!1)}}}return(0,R.jsxs)(k,{open:t,title:`阶段详情`,onClose:s,footer:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,onClick:s,className:`h-9 rounded-lg border border-stone-200 px-4 text-sm text-stone-700 hover:bg-stone-50`,children:`取消`}),(0,R.jsx)(`button`,{type:`button`,disabled:d,onClick:()=>void h(),className:`h-9 rounded-lg bg-[#3370ff] px-4 text-sm font-medium text-white hover:bg-[#2b5fd9] disabled:opacity-40`,children:d?`保存中…`:`保存`})]}),children:[p?(0,R.jsx)(`p`,{className:`mx-6 mb-2 text-sm text-red-600`,children:p}):null,(0,R.jsx)(F,{icon:(0,R.jsx)(P,{}),label:`阶段名称`,children:(0,R.jsx)(`input`,{autoFocus:!0,value:l.title,onChange:e=>u({...l,title:e.target.value}),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),h())},placeholder:`如 第一辈子`,className:I})}),o(`lifeCycle`)?(0,R.jsx)(F,{icon:(0,R.jsx)(N,{}),label:`人生周期`,children:(0,R.jsx)(be,{flat:!0,className:`w-full`,lifeCycles:ee,value:l.lifeCycle,onChange:e=>u({...l,lifeCycle:e}),mutate:a,renderTrigger:(e,{empty:t})=>(0,R.jsx)(i,{text:e,className:`block min-w-0 flex-1 basis-0 truncate ${t?`text-stone-400`:`text-stone-800`}`})})}):null,o(`planType`)?(0,R.jsx)(F,{icon:(0,R.jsx)(N,{}),label:`计划类型`,children:(0,R.jsx)(ye,{flat:!0,className:`w-full`,planTypes:r,value:l.planType,onChange:e=>u({...l,planType:e}),mutate:a,renderTrigger:(e,{empty:t})=>(0,R.jsx)(i,{text:e,className:`block min-w-0 flex-1 basis-0 truncate ${t?`text-stone-400`:`text-stone-800`}`})})}):null,o(`progress`)?(0,R.jsx)(F,{icon:(0,R.jsx)(N,{}),label:`进度`,children:(0,R.jsx)(`div`,{className:`px-1 py-1`,children:(0,R.jsx)(C,{value:l.progress,onChange:e=>u({...l,progress:e})})})}):null,o(`createdAt`)?(0,R.jsx)(F,{icon:(0,R.jsx)(N,{}),label:`创建日期`,children:(0,R.jsx)(`div`,{className:`px-2 py-1.5 text-sm text-stone-500`,children:M(n.createdAt)})}):null,o(`updatedAt`)?(0,R.jsx)(F,{icon:(0,R.jsx)(N,{}),label:`修改日期`,children:(0,R.jsx)(`div`,{className:`px-2 py-1.5 text-sm text-stone-500`,children:M(n.updatedAt)})}):null]})}function je(){let e=w(),{store:t,live:n,error:i,setError:a,updateItem:m,createItems:k,deleteItems:N}=ue(e.ready&&e.on),P=(0,L.useMemo)(()=>({createItems:k,updateItem:m,deleteItems:N}),[k,m,N]),F=ae(Ce,Se),I=(0,L.useMemo)(()=>b(xe,F.isVisible),[F.isVisible]),[z,je]=oe(we),[B,Me]=y(Te,Ee,`none`),[Ne,Pe]=(0,L.useState)({}),Fe=D(),[V,H]=(0,L.useState)(null),[Ie,Le]=(0,L.useState)(null),[U,Re]=(0,L.useState)(!1),[W,ze]=(0,L.useState)(!1),[Be,Ve]=(0,L.useState)({}),[G,K]=(0,L.useState)(null),q=u(`life.stages.cols.v14`,I),He=c(`life.stages`),{submit:Ue}=ie({row:G,setRow:K,submitting:W,isPristine:e=>{let t=e.base;return!e.title.trim()&&e.lifeCycle===t.lifeCycle&&e.planType===t.planType&&e.progress===t.progress},onSubmit:async e=>{ze(!0);try{await k(`lifeStages`,[{title:e.title,lifeCycle:e.lifeCycle,planType:e.planType,progress:Math.max(0,Math.min(100,e.progress))}]),K(null),o(`已新增人生阶段`,`success`),a(``)}catch(e){let t=e instanceof Error?e.message:String(e);a(t),o(`新增失败:${t}`,`error`)}finally{ze(!1)}}});function J(e,t){let n=Oe(t);K({groupKey:e,...n,base:n}),Pe(t=>({...t,[e]:!1}))}let Y=(0,L.useMemo)(()=>{let e=z.trim().toLowerCase(),n=t.lifeStages;return n=e?n.filter(n=>{let r=de(t.lifeCycles,n.lifeCycle).toLowerCase(),i=ve(t.planTypes,n.planType).toLowerCase();return n.title.toLowerCase().includes(e)||r.includes(e)||i.includes(e)}):pe(n,z),re(n)},[t.lifeStages,t.lifeCycles,t.planTypes,z]),X=(0,L.useMemo)(()=>{if(B===`none`)return[{key:`all`,label:`全部阶段`,pill:`bg-stone-500 text-white`,items:Y}];if(B===`lifeCycle`){let e=ce(t.lifeCycles),n=new Set(e.map(e=>e.id)),r=e.map(e=>({key:`lifeCycle:${e.id}`,label:e.name,pill:g(e.id),items:Y.filter(t=>t.lifeCycle===e.id)})).filter(e=>e.items.length>0),i=Y.filter(e=>!e.lifeCycle||!n.has(e.lifeCycle));return i.length>0&&r.push({key:`lifeCycle:unset`,label:j,pill:g(``),items:i}),r}let e=ge(t.planTypes),n=new Set(e.map(e=>e.id)),r=e.map(e=>({key:`planType:${e.id}`,label:e.name,pill:g(e.id),items:Y.filter(t=>t.planType===e.id)})).filter(e=>e.items.length>0),i=Y.filter(e=>!e.planType||!n.has(e.planType));return i.length>0&&r.push({key:`planType:unset`,label:j,pill:g(``),items:i}),r},[B,Y,t.lifeCycles,t.planTypes]),Z=(0,L.useMemo)(()=>{let e=X.filter(e=>e.items.length>0);return e.length>0?e:B===`none`?X.length>0?X:[{key:`all`,label:`全部阶段`,pill:`bg-stone-500 text-white`,items:[]}]:B===`lifeCycle`?[{key:`lifeCycle:unset`,label:j,pill:g(``),items:[]}]:[{key:`planType:unset`,label:j,pill:g(``),items:[]}]},[B,X]),We=(0,L.useMemo)(()=>Z.flatMap(e=>e.items.map(e=>e.id)),[Z]),Q=h(We);async function Ge(e,t){try{await m(`lifeStages`,e,t),Ve(t=>{let n={...t};return delete n[e],n}),a(``)}catch(e){let t=e instanceof Error?e.message:String(e);a(t),o(`保存失败:${t}`,`error`)}}function Ke(e){return{...e,...Be[e.id]}}function qe(e,t){Ve(n=>({...n,[e]:{...n[e],...t}}))}async function Je(e){let t=Be[e.id];if(!t)return;let n=(t.title??e.title).trim();n?await Ge(e.id,{...t,title:n}):a(`阶段名称不能为空`)}async function Ye(e,t){await m(`lifeStages`,t,e),o(`已保存`,`success`)}function Xe(){return G?(0,R.jsxs)(`tr`,{className:`tw-new-row`,children:[(0,R.jsx)(`td`,{className:`px-2 py-1 align-middle`}),(0,R.jsx)(`td`,{className:d,style:Fe,children:(0,R.jsx)(`input`,{autoFocus:!0,disabled:W,value:G.title,placeholder:`输入阶段名称,回车或点空白处保存`,onChange:e=>K(t=>t&&{...t,title:e.target.value}),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),Ue()):e.key===`Escape`&&(e.preventDefault(),K(null))},className:le})}),F.isVisible(`lifeCycle`)?(0,R.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,R.jsx)(be,{unstyled:!0,pill:!0,lifeCycles:t.lifeCycles,value:G.lifeCycle,onChange:e=>K(t=>t&&{...t,lifeCycle:e}),mutate:P})}):null,F.isVisible(`planType`)?(0,R.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,R.jsx)(ye,{unstyled:!0,pill:!0,planTypes:t.planTypes,value:G.planType,onChange:e=>K(t=>t&&{...t,planType:e}),mutate:P})}):null,F.isVisible(`progress`)?(0,R.jsx)(`td`,{className:`px-2 py-1 align-middle`,children:(0,R.jsx)(C,{value:G.progress,onChange:e=>K(t=>t&&{...t,progress:e})})}):null,F.isVisible(`createdAt`)?(0,R.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,R.jsx)(x,{text:`—`,muted:!0})}):null,F.isVisible(`updatedAt`)?(0,R.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,R.jsx)(x,{text:`—`,muted:!0})}):null,(0,R.jsx)(`td`,{"aria-hidden":`true`}),(0,R.jsx)(`td`,{className:l})]}):null}async function Ze(){let e=V;if(e?.length){H(null),Re(!0);try{await N(`lifeStages`,e.map(e=>e.id)),Q.clear(),o(e.length>1?`已删除 ${e.length} 条`:`已删除`,`success`)}catch(e){a(e instanceof Error?e.message:String(e))}finally{Re(!1)}}}function Qe(e,n){let r=Ke(e),i=(Be[e.id]?.progress,r.progress);return(0,R.jsxs)(`tr`,{className:`group/row hover:bg-[#f7f8fa]`,children:[(0,R.jsx)(fe,{checked:!!Q.selected[e.id],onChange:()=>Q.toggle(e.id),label:`选择 ${e.title}`,index:n,selecting:Q.selectedIds.length>0}),(0,R.jsx)(`td`,{className:d,style:Fe,children:(0,R.jsx)(S,{value:r.title,placeholder:`如 第一辈子`,onChange:t=>qe(e.id,{title:t}),onCommit:()=>void Je(e),onCancel:()=>Ve(t=>{let n={...t};return delete n[e.id],n})})}),F.isVisible(`lifeCycle`)?(0,R.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,R.jsx)(be,{unstyled:!0,pill:!0,lifeCycles:t.lifeCycles,value:r.lifeCycle||``,onChange:t=>void Ge(e.id,{lifeCycle:t}),mutate:P})}):null,F.isVisible(`planType`)?(0,R.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,R.jsx)(ye,{unstyled:!0,pill:!0,planTypes:t.planTypes,value:r.planType,onChange:t=>void Ge(e.id,{planType:t}),mutate:P})}):null,F.isVisible(`progress`)?(0,R.jsx)(`td`,{className:`px-2 py-1 align-middle`,children:(0,R.jsx)(C,{value:i,onChange:t=>qe(e.id,{progress:t}),onCommit:t=>void Ge(e.id,{progress:t})})}):null,F.isVisible(`createdAt`)?(0,R.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,R.jsx)(x,{text:M(e.createdAt),muted:!e.createdAt})}):null,F.isVisible(`updatedAt`)?(0,R.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,R.jsx)(x,{text:M(e.updatedAt),muted:!e.updatedAt})}):null,(0,R.jsx)(`td`,{"aria-hidden":`true`}),(0,R.jsx)(`td`,{className:l,children:(0,R.jsxs)(`div`,{className:`flex justify-end gap-0.5`,children:[(0,R.jsx)(T,{label:`编辑 ${e.title}`,disabled:U,onClick:()=>Le(e)}),(0,R.jsx)(_e,{label:`删除 ${e.title}`,disabled:U,onClick:()=>H([e])})]})})]},e.id)}if(!e.ready)return(0,R.jsx)(E,{label:`正在读取插件开关`});if(!e.on)return(0,R.jsx)(_,{children:O()});if(n===null)return(0,R.jsx)(E,{label:`正在连接人生管理服务`});if(!n)return(0,R.jsx)(_,{children:`人生管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`});let $=I.length;return(0,R.jsxs)(`section`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-3 border-b border-stone-100 px-4 py-3`,children:[(0,R.jsxs)(`div`,{className:`text-sm text-stone-600`,children:[`共 `,(0,R.jsx)(`span`,{className:`font-medium text-stone-800`,children:t.lifeStages.length}),` 条`]}),(0,R.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`input`,{value:z,onChange:e=>je(e.target.value),placeholder:`搜索人生阶段…`,className:`h-9 w-52 rounded-lg border border-stone-200 px-3 text-sm text-stone-800 outline-none focus:border-[#3370ff]`}),(0,R.jsx)(ee,{flat:!0,className:`w-[168px]`,ariaLabel:`分组方式`,options:De,value:B,onChange:e=>Me(e)}),(0,R.jsx)(ne,{fields:F.fields,isVisible:F.isVisible,onToggle:F.toggle}),(0,R.jsx)(`button`,{type:`button`,disabled:U||Q.selectedIds.length===0,onClick:()=>H(t.lifeStages.filter(e=>Q.selected[e.id])),className:`h-9 shrink-0 rounded-lg border border-red-200 px-3 text-sm font-medium whitespace-nowrap text-red-600 hover:bg-red-50 disabled:opacity-40`,children:`批量删除`}),(0,R.jsx)(`button`,{type:`button`,disabled:U||W,onClick:()=>{if(B===`none`)J(`all`);else{let e=Z[0];J(e?.key??`all`,e?ke(e.key):void 0)}},className:`h-9 shrink-0 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white hover:bg-[#2b5fd9] disabled:opacity-40`,children:`+ 新建阶段`})]})]}),(0,R.jsx)(he,{error:i,onDismiss:()=>a(``)}),(0,R.jsx)(`div`,{ref:He,className:`tw-scroll-x min-h-0 flex-1 overflow-auto`,children:(0,R.jsxs)(`table`,{className:`tw-task-table tw-sticky-table w-full table-fixed text-sm`,style:q.tableStyle,children:[(0,R.jsx)(`colgroup`,{children:I.map(e=>(0,R.jsx)(`col`,{style:e.key===`select`?{width:v(!1)}:q.widthOf(e.key)?{width:q.widthOf(e.key)}:void 0},e.key))}),(0,R.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-xs text-stone-500`,children:(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(te,{checked:Q.allVisibleSelected,indeterminate:Q.selectedIds.length>0&&!Q.allVisibleSelected,onChange:()=>Q.toggleAllVisible()}),(0,R.jsxs)(`th`,{className:`${f} text-xs text-stone-500`,style:Fe,children:[`阶段名称`,(0,R.jsx)(p,{...q.resizeProps(`title`)})]}),F.isVisible(`lifeCycle`)?(0,R.jsxs)(`th`,{className:A,children:[`人生周期`,(0,R.jsx)(p,{...q.resizeProps(`lifeCycle`)})]}):null,F.isVisible(`planType`)?(0,R.jsxs)(`th`,{className:A,children:[`计划类型`,(0,R.jsx)(p,{...q.resizeProps(`planType`)})]}):null,F.isVisible(`progress`)?(0,R.jsxs)(`th`,{className:A,children:[`进度`,(0,R.jsx)(p,{...q.resizeProps(`progress`)})]}):null,F.isVisible(`createdAt`)?(0,R.jsxs)(`th`,{className:A,children:[`创建日期`,(0,R.jsx)(p,{...q.resizeProps(`createdAt`)})]}):null,F.isVisible(`updatedAt`)?(0,R.jsxs)(`th`,{className:A,children:[`修改日期`,(0,R.jsx)(p,{...q.resizeProps(`updatedAt`)})]}):null,(0,R.jsx)(`th`,{"aria-hidden":`true`}),(0,R.jsx)(`th`,{className:s,children:`操作`})]})}),(0,R.jsx)(`tbody`,{children:Y.length===0&&!G?(0,R.jsx)(`tr`,{children:(0,R.jsx)(`td`,{colSpan:$,className:`px-3 py-16 text-center text-sm text-stone-400`,children:t.lifeStages.length===0?`还没有人生阶段`:`没有匹配的记录`})}):Y.length===0&&G?Xe():B===`none`?(0,R.jsxs)(R.Fragment,{children:[Y.map((e,t)=>Qe(e,t+1)),G?Xe():(0,R.jsx)(se,{colSpan:$,disabled:U||W,onClick:()=>J(`all`)})]}):Z.map(e=>{let n=!Ne[e.key];return(0,R.jsxs)(L.Fragment,{children:[(0,R.jsx)(me,{label:e.label,pill:e.pill,count:e.items.length,open:n,kind:`tag`,colSpan:$,onToggle:()=>Pe(t=>({...t,[e.key]:!t[e.key]}))}),n?(0,R.jsxs)(R.Fragment,{children:[e.items.map((e,t)=>Qe(e,t+1)),G?.groupKey===e.key?Xe():Y.length>0||t.lifeStages.length===0?(0,R.jsx)(se,{colSpan:$,disabled:U||W,onClick:()=>J(e.key,ke(e.key))}):null]}):null]},e.key)})})]})}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-t border-stone-100 px-4 py-2.5 text-xs text-stone-500`,children:[(0,R.jsxs)(`span`,{children:[`显示 `,Y.length,` 条`,Q.selectedIds.length?` · 已选 ${Q.selectedIds.length}`:``]}),(0,R.jsx)(`span`,{className:`ml-auto text-stone-400`,children:`可添加多个阶段并分别维护进度`})]}),Ie?(0,R.jsx)(Ae,{open:!0,item:Ie,planTypes:t.planTypes,lifeCycles:t.lifeCycles,mutate:P,isVisible:F.isVisible,onClose:()=>Le(null),onSave:Ye}):null,(0,R.jsx)(r,{open:V!=null,title:V&&V.length>1?`批量删除`:`删除人生阶段`,message:V&&V.length>1?`删除选中的 ${V.length} 条阶段?`:`删除「${V?.[0]?.title??``}」?`,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>H(null),onConfirm:()=>void Ze()})]})}export{je as default};
|
|
@@ -1 +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"./ConfirmDialog.D5qXeML0.js";import{t as i}from"./OverflowHint.pvo2Xc8R.js";import{t as a}from"./SelectDropdown.Dmk5n225.js";import{m as o}from"./PmShared.
|
|
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"./ConfirmDialog.D5qXeML0.js";import{t as i}from"./OverflowHint.pvo2Xc8R.js";import{t as a}from"./SelectDropdown.Dmk5n225.js";import{m as o}from"./PmShared.86HEsdd_.js";import{showToast as s}from"./Toast.BO2NFckG.js";import{t as c}from"./NamePromptDialog.Csfnh5eM.js";import{B as l,St as u,h as d,wt as f}from"./LifeShared.CtdsQI43.js";var p=e(t(),1),m=n(),h=d;function g(e){let{yearCycles:t,value:n,onChange:d,mutate:g,flat:_,unstyled:v,pill:y,className:b,triggerClassName:x,ariaLabel:S=`年度周期`,searchPlaceholder:C=`搜索年度…`,placeholder:w=h,renderTrigger:T}=e,[E,D]=(0,p.useState)(!1),[O,k]=(0,p.useState)(null),[A,j]=(0,p.useState)(``),[M,N]=(0,p.useState)(null),P=(0,p.useMemo)(()=>u(t),[t]),F=(0,p.useMemo)(()=>P.map(e=>({value:e.id,label:e.name})),[P]),I=n&&F.some(e=>e.value===n)?n:``,L=!I,R=L?w:f(P,I);async function z(e){let t=e.trim();if(!t)return;let n=P.find(e=>e.name===t);if(n)d(n.id);else{D(!0);try{let e=(await g.createItems(`yearCycles`,[{name:t}])).items[0];e?.id&&d(e.id),s(`已新增「${t}」`,`success`)}catch(e){s(e instanceof Error?e.message:String(e),`error`)}finally{D(!1)}}}async function B(e){let t=O;if(!t)return;let n=e.trim();if(!n||n===t.name)k(null),j(``);else{D(!0),j(``);try{await g.updateItem(`yearCycles`,t.id,{name:n}),k(null),s(`已修改年度周期`,`success`)}catch(e){j(e instanceof Error?e.message:String(e))}finally{D(!1)}}}async function V(){let e=M;if(e){N(null),D(!0);try{await g.deleteItems(`yearCycles`,[e.id]),I===e.id&&d(``),s(`已删除年度周期`,`success`)}catch(e){s(e instanceof Error?e.message:String(e),`error`)}finally{D(!1)}}}return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(a,{flat:_,unstyled:v,fitContent:!(!y||L),centerContent:!1,className:b,triggerClassName:(y?L?`h-8 w-full justify-start rounded-md border border-stone-200 bg-white px-2 text-left text-sm font-normal text-stone-400 hover:border-stone-300 focus:ring-2 focus:ring-[#3370ff]/30`:`h-8 w-auto max-w-full justify-start bg-transparent px-0 text-left focus:ring-0`:void 0)??x,searchable:!0,searchPlaceholder:C,ariaLabel:S,options:F,value:I,onChange:d,onSearchCreate:e=>void z(e),renderTrigger:T?(e,t)=>T(R,{...t,empty:L}):()=>y&&!L?(0,m.jsx)(`span`,{className:`inline-flex h-7 max-w-full items-center truncate rounded-md px-2 text-xs font-medium ${l(I)}`,children:(0,m.jsx)(i,{text:R,className:`block min-w-0 truncate`})}):(0,m.jsx)(i,{text:R,className:`block min-w-0 truncate ${L||F.length===0?`text-stone-400`:`text-stone-800`}`}),renderOptionAction:e=>(0,m.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,m.jsx)(`button`,{type:`button`,disabled:E,"aria-label":`修改 ${e.label}`,className:`rounded p-1 text-stone-400 opacity-0 transition-opacity hover:bg-stone-100 hover:text-stone-700 focus-visible:opacity-100 group-hover:opacity-100 disabled:opacity-0`,onClick:()=>{let t=P.find(t=>t.id===e.value);t&&(j(``),k(t))},children:(0,m.jsx)(o,{name:`pencil`,size:13})}),(0,m.jsx)(`button`,{type:`button`,disabled:E,"aria-label":`删除 ${e.label}`,className:`tw-icon-danger rounded p-1 opacity-0 transition-opacity focus-visible:opacity-100 group-hover:opacity-100 disabled:opacity-0 disabled:group-hover:opacity-40`,onClick:()=>{let t=P.find(t=>t.id===e.value);t&&N(t)},children:(0,m.jsx)(o,{name:`trash`,size:13})})]})}),(0,m.jsx)(c,{open:O!=null,title:`修改年度周期`,label:`年度周期`,placeholder:`例如 2026年`,initialValue:O?.name??``,confirmLabel:`保存`,cancelLabel:`取消`,error:A,onClose:()=>{k(null),j(``)},onConfirm:e=>void B(e)}),(0,m.jsx)(r,{open:M!=null,title:`删除年度周期`,message:`删除「${M?.name??``}」?已引用该周期的年度计划与 Objective 会清空周期。`,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>N(null),onConfirm:()=>void V()})]})}export{g as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{t as n}from"./react-dom.DLW9pGCF.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"./OverflowHint.pvo2Xc8R.js";import{t as o}from"./SelectDropdown.Dmk5n225.js";import{showToast as s}from"./Toast.BO2NFckG.js";import{c,d as l,i as u,l as d,n as f,o as p,t as m}from"./ColumnResize.CkE59sGq.js";import{$ as h,A as g,B as _,C as v,E as ee,F as y,H as te,J as ne,K as re,L as ie,M as b,N as ae,P as oe,Q as se,S as ce,St as le,T as ue,U as de,V as fe,X as pe,Y as me,Z as he,_ as ge,b as x,c as _e,dt as S,et as ve,f as C,g as ye,k as be,pt as xe,ut as w,w as Se,x as Ce,y as we,z as T}from"./LifeShared.-pwCbSyP.js";import{c as E,l as D,n as O,r as k,s as A,t as j}from"./DrawerField.CWpOf3L_.js";import{t as M}from"./LifePlanTypeSelect.C63oD8zZ.js";import{t as Te}from"./LifeYearCycleSelect.CObXQA5s.js";var N=e(t(),1),P=e(n(),1),F=r(),Ee=[{key:`select`,width:36,min:32},{key:`title`,width:220,min:160},{key:`yearCycle`,width:120,min:88},{key:`planType`,width:112,min:88},{key:`status`,width:104,min:76},{key:`objectives`,width:280,min:180},{key:`createdAt`,width:120,min:96},{key:`updatedAt`,width:120,min:96},{key:`filler`,filler:!0},{key:`action`,width:88,min:72}],De=[{key:`yearCycle`,label:`年度周期`},{key:`planType`,label:`计划类型`},{key:`status`,label:`状态`},{key:`objectives`,label:`关联 Objective`},{key:`createdAt`,label:`创建日期`},{key:`updatedAt`,label:`修改日期`}],Oe=`life.year-plans.fields`,ke=`life.year-plans.search`,Ae=`life.year-plans.group`,je=[`status`,`yearCycle`,`none`],I=w.map(e=>({value:e,label:S[e]})),Me={in_progress:`bg-[#e1eaff] text-[#1f4ec2]`,incomplete:`bg-[#fff1e3] text-[#a85b00]`,done:`bg-[#d9f5d2] text-[#1d7a12]`},Ne=[{value:`none`,label:`不分组`},{value:`status`,label:`按状态分组`},{value:`yearCycle`,label:`按年度分组`}];function L(e){return{title:``,yearCycle:e?.yearCycle??``,planType:e?.planType??``,status:e?.status??`in_progress`,objectiveIds:e?.objectiveIds??[]}}function Pe(e){let t=(0,N.useMemo)(()=>{let t=new Set(e.values);return e.objectives.filter(n=>t.has(n.id)||!!e.yearPlanId&&n.yearPlanId===e.yearPlanId)},[e.objectives,e.values,e.yearPlanId]),n=!e.yearCycle,r=t.length===0,i=n?`先选年度周期`:r?`暂无关联 Objective`:`已关联 ${t.length} 个目标`,[o,s]=(0,N.useState)(!1),[c,l]=(0,N.useState)({left:0,top:0,width:280,openUp:!1}),u=(0,N.useRef)(null),d=(0,N.useRef)(null),f=n;(0,N.useEffect)(()=>{if(!o)return;function e(e){let t=e.target;u.current?.contains(t)||d.current?.contains(t)||s(!1)}function t(e){e.target instanceof Node&&d.current?.contains(e.target)||s(!1)}function n(){s(!1)}return document.addEventListener(`mousedown`,e),window.addEventListener(`scroll`,t,!0),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`mousedown`,e),window.removeEventListener(`scroll`,t,!0),window.removeEventListener(`resize`,n)}},[o]);function p(){if(f)return;if(o){s(!1);return}let e=u.current;if(!e)return;let t=e.getBoundingClientRect(),n=Math.max(t.width,260),r=Math.min(t.left,Math.max(8,window.innerWidth-n-8)),i=t.bottom+4,a=i+200>window.innerHeight&&t.top>200;l({left:r,top:a?t.top-4:i,width:n,openUp:a}),s(!0)}function m(n,r){r.stopPropagation(),e.onChange(t.filter(e=>e.id!==n).map(e=>e.id))}let h=f?`w-full min-h-8 flex items-center justify-start rounded-lg border border-stone-200 bg-stone-50 px-2.5 py-1.5 text-sm text-left text-stone-400 cursor-not-allowed`:e.flat?`tw-field-trigger w-full min-h-9 flex items-center justify-start 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`:`tw-field-trigger w-full min-h-8 flex items-center justify-start rounded-lg border border-stone-200 bg-white px-2.5 py-1.5 text-sm text-left text-stone-800 outline-none hover:border-stone-300 focus:ring-1 focus:ring-[#3370ff]/30`,g=null;return o&&typeof document<`u`&&(g=(0,P.createPortal)((0,F.jsx)(`div`,{ref:d,className:`tw-select-menu tw-popover-anim fixed z-[1000] overflow-hidden rounded-lg shadow-lg ring-1 ring-stone-200`,style:{left:c.left,width:c.width,...c.openUp?{bottom:window.innerHeight-c.top}:{top:c.top}},children:(0,F.jsx)(`div`,{className:`tw-dsh-scroll max-h-[120px] overflow-y-auto bg-white px-2.5 py-2`,onWheel:e=>e.stopPropagation(),children:r?(0,F.jsx)(`p`,{className:`px-1 py-1 text-sm text-stone-400`,children:n?`先选年度周期`:`暂无关联 Objective,可在 Objective 里选年度计划`}):(0,F.jsx)(`div`,{className:`flex flex-wrap content-start gap-1.5`,children:t.map(e=>(0,F.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1 rounded-full bg-[#e8f0fe] px-2.5 py-0.5 text-[12px] leading-5 text-[#1f4ec2]`,children:[(0,F.jsx)(`span`,{className:`min-w-0 break-words whitespace-pre-wrap`,children:e.title}),(0,F.jsx)(`span`,{role:`button`,tabIndex:-1,"aria-label":`移除 ${e.title}`,className:`shrink-0 rounded-full px-0.5 text-[#5b7fd4] hover:bg-[#d2e3fc] hover:text-[#1f4ec2]`,onClick:t=>m(e.id,t),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),m(e.id,t))},children:`×`})]},e.id))})})}),document.body)),(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(`button`,{ref:u,type:`button`,disabled:f,"aria-expanded":o,onClick:p,className:h,children:r||f?(0,F.jsx)(`span`,{className:`text-stone-400`,children:i}):(0,F.jsx)(a,{text:t.map(e=>e.title).join(`、`),className:`block min-w-0 flex-1 truncate text-left text-stone-700`})}),g]})}function Fe(e){let t={},n=/(?:^|\|)status:([^|]+)/.exec(e)?.[1];n&&w.includes(n)&&(t.status=n);let r=/(?:^|\|)year:([^|]+)/.exec(e)?.[1];return r&&r!==`unset`&&(t.yearCycle=r),t}function Ie(e){let{open:t,item:n,yearCycles:r,yearCycleMutate:i,objectives:o,planTypes:s,planTypeMutate:c,isVisible:l,onClose:u,onSave:d}=e,[f,p]=(0,N.useState)(L()),[m,h]=(0,N.useState)(!1),[g,_]=(0,N.useState)(``);(0,N.useEffect)(()=>{t&&(_(``),h(!1),p({title:n.title,yearCycle:n.yearCycle,planType:n.planType||``,status:n.status,objectiveIds:n.objectiveIds??[]}))},[t,n]);async function v(){let e=f.title.trim();if(!e)_(`请填写计划标题`);else{h(!0);try{await d({...f,title:e,yearCycle:f.yearCycle,objectiveIds:f.objectiveIds},n.id),u()}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}}}return(0,F.jsxs)(x,{open:t,title:`计划详情`,onClose:u,footer:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`button`,{type:`button`,onClick:u,className:`h-9 rounded-lg border border-stone-200 px-4 text-sm text-stone-700 hover:bg-stone-50`,children:`取消`}),(0,F.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>void v(),className:`h-9 rounded-lg bg-[#3370ff] px-4 text-sm font-medium text-white hover:bg-[#2b5fd9] disabled:opacity-40`,children:m?`保存中…`:`保存`})]}),children:[g?(0,F.jsx)(`p`,{className:`mx-6 mb-2 text-sm text-red-600`,children:g}):null,(0,F.jsx)(O,{icon:(0,F.jsx)(D,{}),label:`标题`,children:(0,F.jsx)(`input`,{autoFocus:!0,value:f.title,onChange:e=>p({...f,title:e.target.value}),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),v())},placeholder:`请输入内容`,className:j})}),l(`yearCycle`)?(0,F.jsx)(O,{icon:(0,F.jsx)(E,{}),label:`年度周期`,children:(0,F.jsx)(Te,{flat:!0,className:`w-full`,yearCycles:r,value:f.yearCycle,onChange:e=>p({...f,yearCycle:e}),mutate:i,renderTrigger:(e,{empty:t})=>(0,F.jsx)(a,{text:e,className:`block min-w-0 flex-1 basis-0 truncate ${t?`text-stone-400`:`text-stone-800`}`})})}):null,l(`planType`)?(0,F.jsx)(O,{icon:(0,F.jsx)(E,{}),label:`计划类型`,children:(0,F.jsx)(M,{flat:!0,className:`w-full`,planTypes:s,value:f.planType,onChange:e=>p({...f,planType:e}),mutate:c,renderTrigger:(e,{empty:t})=>(0,F.jsx)(a,{text:e,className:`block min-w-0 flex-1 basis-0 truncate ${t?`text-stone-400`:`text-stone-800`}`})})}):null,l(`status`)?(0,F.jsx)(O,{icon:(0,F.jsx)(A,{}),label:`状态`,children:(0,F.jsx)(k,{ariaLabel:`计划状态`,options:I,value:f.status,onChange:e=>p({...f,status:e}),label:S[f.status],optionDotClassName:e=>y[e]})}):null,l(`objectives`)?(0,F.jsx)(O,{icon:(0,F.jsx)(E,{}),label:`关联 Objective`,children:(0,F.jsxs)(`div`,{className:`w-full px-0.5 py-0.5`,children:[(0,F.jsx)(Pe,{flat:!0,yearCycle:f.yearCycle,yearPlanId:n.id,objectives:o,values:f.objectiveIds,onChange:e=>p({...f,objectiveIds:e})}),(0,F.jsx)(`p`,{className:`mt-1 px-1.5 text-[11px] leading-4 text-stone-400`,children:`点击查看已关联目标;在 Objective 里选「年度计划」后会自动出现。`})]})}):null,l(`createdAt`)?(0,F.jsx)(O,{icon:(0,F.jsx)(E,{}),label:`创建日期`,children:(0,F.jsx)(`div`,{className:`px-2 py-1.5 text-sm text-stone-500`,children:T(n.createdAt)})}):null,l(`updatedAt`)?(0,F.jsx)(O,{icon:(0,F.jsx)(E,{}),label:`修改日期`,children:(0,F.jsx)(`div`,{className:`px-2 py-1.5 text-sm text-stone-500`,children:T(n.updatedAt)})}):null]})}function Le(){let e=se(),{store:t,live:n,error:r,setError:x,updateItem:E,createItems:D,deleteItems:O}=ve(e.ready&&e.on),k=(0,N.useMemo)(()=>({createItems:D,updateItem:E,deleteItems:O}),[D,E,O]),A=(0,N.useMemo)(()=>({createItems:D,updateItem:E,deleteItems:O}),[D,E,O]),j=me(Oe,De),P=(0,N.useMemo)(()=>ie(Ee,j.isVisible),[j.isVisible]),[L,Le]=he(ke),Re=de(),[R,ze]=ne(Ae,je,`none`),[Be,Ve]=(0,N.useState)({}),[z,B]=(0,N.useState)(null),[He,Ue]=(0,N.useState)(null),[V,We]=(0,N.useState)(!1),[H,Ge]=(0,N.useState)(!1),[Ke,U]=(0,N.useState)({}),[W,G]=(0,N.useState)(null),K=d(`life.year-plans.cols.v13`,P),qe=l(`life.year-plans`),q=(0,N.useMemo)(()=>re(xe(t.yearPlans,L),w),[t.yearPlans,L]),J=(0,N.useMemo)(()=>{if(R===`none`)return[{key:`all`,label:`全部计划`,pill:`bg-stone-500 text-white`,items:q}];if(R===`yearCycle`){let e=le(t.yearCycles),n=new Set(e.map(e=>e.id)),r=e.map(e=>({key:`year:${e.id}`,label:e.name,pill:_(e.id),items:q.filter(t=>t.yearCycle===e.id)})).filter(e=>e.items.length>0),i=q.filter(e=>!e.yearCycle||!n.has(e.yearCycle));return i.length>0&&r.push({key:`year:unset`,label:ye,pill:_(``),items:i}),r}return w.map(e=>({key:`status:${e}`,label:S[e],pill:Me[e],items:q.filter(t=>t.status===e)}))},[R,q,t.yearCycles]),Y=(0,N.useMemo)(()=>{if(R===`status`)return J;let e=J.filter(e=>e.items.length>0);return e.length>0?e:R===`none`?J.length>0?J:[{key:`all`,label:`全部计划`,pill:`bg-stone-500 text-white`,items:[]}]:[{key:`year:unset`,label:ye,pill:`bg-stone-300 text-stone-600`,items:[]}]},[R,J]),Je=(0,N.useMemo)(()=>Y.flatMap(e=>e.items.map(e=>e.id)),[Y]),X=h(Je),{submit:Ye}=pe({row:W,setRow:G,submitting:H,isPristine:e=>!e.title.trim()&&e.yearCycle===e.baseYearCycle&&e.planType===e.basePlanType&&e.status===e.baseStatus&&e.objectiveIds.join(`|`)===e.baseObjectiveIds.join(`|`),onSubmit:async e=>{Ge(!0);try{await D(`yearPlans`,[{title:e.title,yearCycle:e.yearCycle,planType:e.planType,status:e.status,objectiveIds:e.objectiveIds}]),G(null),s(`已新增年度计划`,`success`),x(``)}catch(e){let t=e instanceof Error?e.message:String(e);x(t),s(`新增失败:${t}`,`error`)}finally{Ge(!1)}}});function Xe(e,t){let n=t?.planType??``,r=t?.status??`in_progress`,i=t?.yearCycle??``;G({groupKey:e,title:``,yearCycle:i,planType:n,status:r,objectiveIds:[],baseYearCycle:i,basePlanType:n,baseStatus:r,baseObjectiveIds:[]}),Ve(t=>({...t,[e]:!1}))}async function Z(e,t){try{await E(`yearPlans`,e,t),U(t=>{let n={...t};return delete n[e],n}),x(``)}catch(e){let t=e instanceof Error?e.message:String(e);x(t),s(`保存失败:${t}`,`error`)}}function Ze(e){return{...e,...Ke[e.id]}}function Qe(e,t){U(n=>({...n,[e]:{...n[e],...t}}))}async function $e(e){let t=Ke[e.id];if(!t)return;let n=(t.title??e.title).trim();n?await Z(e.id,{...t,title:n}):x(`标题不能为空`)}async function et(e,t){await E(`yearPlans`,t,e),s(`已保存`,`success`)}function Q(){return W?(0,F.jsxs)(`tr`,{className:`tw-new-row`,children:[(0,F.jsx)(`td`,{className:`px-2 py-1 align-middle`}),(0,F.jsx)(`td`,{className:f,style:Re,children:(0,F.jsx)(`input`,{autoFocus:!0,disabled:H,value:W.title,placeholder:`输入计划名称,回车或点空白处保存`,onChange:e=>G(t=>t&&{...t,title:e.target.value}),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),Ye()):e.key===`Escape`&&(e.preventDefault(),G(null))},className:_e})}),j.isVisible(`yearCycle`)?(0,F.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,F.jsx)(Te,{unstyled:!0,pill:!0,yearCycles:t.yearCycles,value:W.yearCycle,onChange:e=>G(t=>t&&{...t,yearCycle:e}),mutate:A})}):null,j.isVisible(`planType`)?(0,F.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,F.jsx)(M,{unstyled:!0,pill:!0,planTypes:t.planTypes,value:W.planType,onChange:e=>G(t=>t&&{...t,planType:e}),mutate:k})}):null,j.isVisible(`status`)?(0,F.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,F.jsx)(o,{unstyled:!0,fitContent:!0,hideChevron:!0,centerContent:!0,ariaLabel:`计划状态`,menuMinWidth:120,options:I,value:W.status,onChange:e=>G(t=>t&&{...t,status:e}),triggerClassName:`h-7 max-w-full rounded-md px-2 text-center text-xs font-medium focus:ring-2 focus:ring-[#3370ff]/30 ${oe[W.status]}`,renderTrigger:()=>(0,F.jsx)(a,{text:S[W.status],className:`block min-w-0 truncate`}),renderOptionPrefix:e=>(0,F.jsx)(`span`,{className:`h-2 w-2 rounded-full ${y[e.value]}`})})}):null,j.isVisible(`objectives`)?(0,F.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,F.jsx)(Pe,{yearCycle:W.yearCycle,objectives:t.objectives,values:W.objectiveIds,onChange:e=>G(t=>t&&{...t,objectiveIds:e})})}):null,j.isVisible(`createdAt`)?(0,F.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,F.jsx)(b,{text:`—`,muted:!0})}):null,j.isVisible(`updatedAt`)?(0,F.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,F.jsx)(b,{text:`—`,muted:!0})}):null,(0,F.jsx)(`td`,{"aria-hidden":`true`}),(0,F.jsx)(`td`,{className:u})]}):null}async function tt(){let e=z;if(e?.length){B(null),We(!0);try{await O(`yearPlans`,e.map(e=>e.id)),X.clear(),s(e.length>1?`已删除 ${e.length} 条`:`已删除`,`success`)}catch(e){x(e instanceof Error?e.message:String(e))}finally{We(!1)}}}function nt(e,n){let r=Ze(e);return(0,F.jsxs)(`tr`,{className:`group/row tw-life-group-body hover:bg-[#f7f8fa]`,children:[(0,F.jsx)(be,{checked:!!X.selected[e.id],onChange:()=>X.toggle(e.id),label:`选择 ${e.title}`,index:n,selecting:X.selectedIds.length>0}),(0,F.jsx)(`td`,{className:f,style:Re,children:(0,F.jsx)(ae,{value:r.title,placeholder:`标题`,onChange:t=>Qe(e.id,{title:t}),onCommit:()=>void $e(e),onCancel:()=>U(t=>{let n={...t};return delete n[e.id],n})})}),j.isVisible(`yearCycle`)?(0,F.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,F.jsx)(Te,{unstyled:!0,pill:!0,yearCycles:t.yearCycles,value:r.yearCycle,onChange:t=>void Z(e.id,{yearCycle:t}),mutate:A})}):null,j.isVisible(`planType`)?(0,F.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,F.jsx)(M,{unstyled:!0,pill:!0,planTypes:t.planTypes,value:r.planType,onChange:t=>void Z(e.id,{planType:t}),mutate:k})}):null,j.isVisible(`status`)?(0,F.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,F.jsx)(o,{unstyled:!0,fitContent:!0,hideChevron:!0,centerContent:!0,ariaLabel:`计划状态`,menuMinWidth:120,options:I,value:r.status,onChange:t=>void Z(e.id,{status:t}),triggerClassName:`h-7 max-w-full rounded-md px-2 text-center text-xs font-medium focus:ring-2 focus:ring-[#3370ff]/30 ${oe[r.status]}`,renderTrigger:()=>(0,F.jsx)(a,{text:S[r.status],className:`block min-w-0 truncate`}),renderOptionPrefix:e=>(0,F.jsx)(`span`,{className:`h-2 w-2 rounded-full ${y[e.value]}`})})}):null,j.isVisible(`objectives`)?(0,F.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,F.jsx)(Pe,{yearCycle:r.yearCycle,yearPlanId:e.id,objectives:t.objectives,values:r.objectiveIds??[],onChange:t=>void Z(e.id,{objectiveIds:t})})}):null,j.isVisible(`createdAt`)?(0,F.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,F.jsx)(b,{text:T(e.createdAt),muted:!e.createdAt})}):null,j.isVisible(`updatedAt`)?(0,F.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,F.jsx)(b,{text:T(e.updatedAt),muted:!e.updatedAt})}):null,(0,F.jsx)(`td`,{"aria-hidden":`true`}),(0,F.jsx)(`td`,{className:u,children:(0,F.jsxs)(`div`,{className:`flex justify-end gap-0.5`,children:[(0,F.jsx)(ce,{label:`编辑 ${e.title}`,disabled:V,onClick:()=>Ue(e)}),(0,F.jsx)(we,{label:`删除 ${e.title}`,disabled:V,onClick:()=>B([e])})]})})]},e.id)}if(!e.ready)return(0,F.jsx)(ue,{label:`正在读取插件开关`});if(!e.on)return(0,F.jsx)(ee,{children:fe()});if(n===null)return(0,F.jsx)(ue,{label:`正在连接人生管理服务`});if(!n)return(0,F.jsx)(ee,{children:`人生管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`});let $=P.length;return(0,F.jsxs)(`section`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,F.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-3 border-b border-stone-100 px-4 py-3`,children:[(0,F.jsxs)(`div`,{className:`text-sm text-stone-600`,children:[`共 `,(0,F.jsx)(`span`,{className:`font-medium text-stone-800`,children:t.yearPlans.length}),` 条`]}),(0,F.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(`input`,{value:L,onChange:e=>Le(e.target.value),placeholder:`搜索年度计划…`,className:`h-9 w-52 rounded-lg border border-stone-200 px-3 text-sm text-stone-800 outline-none focus:border-[#3370ff]`}),(0,F.jsx)(o,{flat:!0,className:`w-[132px]`,ariaLabel:`分组方式`,options:Ne,value:R,onChange:e=>ze(e)}),(0,F.jsx)(v,{fields:j.fields,isVisible:j.isVisible,onToggle:j.toggle}),(0,F.jsx)(`button`,{type:`button`,disabled:V||X.selectedIds.length===0,onClick:()=>B(t.yearPlans.filter(e=>X.selected[e.id])),className:`h-9 shrink-0 rounded-lg border border-red-200 px-3 text-sm font-medium whitespace-nowrap text-red-600 hover:bg-red-50 disabled:opacity-40`,children:`批量删除`}),(0,F.jsx)(`button`,{type:`button`,disabled:V||H,onClick:()=>{let e=Y[0];Xe(e?.key??`all`,e?Fe(e.key):void 0)},className:`h-9 shrink-0 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white hover:bg-[#2b5fd9] disabled:opacity-40`,children:`+ 新建计划`})]})]}),(0,F.jsx)(Ce,{error:r,onDismiss:()=>x(``)}),(0,F.jsx)(`div`,{ref:qe,className:`tw-scroll-x min-h-0 flex-1 overflow-auto`,children:(0,F.jsxs)(`table`,{className:`tw-task-table tw-sticky-table w-full table-fixed text-sm`,style:K.tableStyle,children:[(0,F.jsx)(`colgroup`,{children:P.map(e=>(0,F.jsx)(`col`,{style:e.key===`select`?{width:te(!1)}:K.widthOf(e.key)?{width:K.widthOf(e.key)}:void 0},e.key))}),(0,F.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-xs text-stone-500`,children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(g,{checked:X.allVisibleSelected,indeterminate:X.selectedIds.length>0&&!X.allVisibleSelected,onChange:()=>X.toggleAllVisible()}),(0,F.jsxs)(`th`,{className:`${p} text-xs text-stone-500`,style:Re,children:[`标题`,(0,F.jsx)(m,{...K.resizeProps(`title`)})]}),j.isVisible(`yearCycle`)?(0,F.jsxs)(`th`,{className:C,children:[`年度周期`,(0,F.jsx)(m,{...K.resizeProps(`yearCycle`)})]}):null,j.isVisible(`planType`)?(0,F.jsxs)(`th`,{className:C,children:[`计划类型`,(0,F.jsx)(m,{...K.resizeProps(`planType`)})]}):null,j.isVisible(`status`)?(0,F.jsxs)(`th`,{className:C,children:[`状态`,(0,F.jsx)(m,{...K.resizeProps(`status`)})]}):null,j.isVisible(`objectives`)?(0,F.jsxs)(`th`,{className:C,children:[`关联 Objective`,(0,F.jsx)(m,{...K.resizeProps(`objectives`)})]}):null,j.isVisible(`createdAt`)?(0,F.jsxs)(`th`,{className:C,children:[`创建日期`,(0,F.jsx)(m,{...K.resizeProps(`createdAt`)})]}):null,j.isVisible(`updatedAt`)?(0,F.jsxs)(`th`,{className:C,children:[`修改日期`,(0,F.jsx)(m,{...K.resizeProps(`updatedAt`)})]}):null,(0,F.jsx)(`th`,{"aria-hidden":`true`}),(0,F.jsx)(`th`,{className:c,children:`操作`})]})}),(0,F.jsx)(`tbody`,{children:q.length===0&&!W?(0,F.jsx)(`tr`,{children:(0,F.jsx)(`td`,{colSpan:$,className:`px-3 py-16 text-center text-sm text-stone-400`,children:t.yearPlans.length===0?`还没有年度计划`:`没有匹配的记录`})}):q.length===0&&W?Q():R===`none`?(0,F.jsxs)(F.Fragment,{children:[q.map((e,t)=>nt(e,t+1)),W?Q():(0,F.jsx)(ge,{colSpan:$,disabled:V||H,onClick:()=>Xe(`all`)})]}):Y.length===0?W?Q():null:Y.map(e=>{let t=!Be[e.key];return(0,F.jsxs)(N.Fragment,{children:[(0,F.jsx)(Se,{label:e.label,pill:e.pill,count:e.items.length,open:t,kind:`tag`,colSpan:$,onToggle:()=>Ve(t=>({...t,[e.key]:!t[e.key]}))}),t?(0,F.jsxs)(F.Fragment,{children:[e.items.map((e,t)=>nt(e,t+1)),W?.groupKey===e.key?Q():q.length>0?(0,F.jsx)(ge,{colSpan:$,disabled:V||H,onClick:()=>Xe(e.key,Fe(e.key))}):null]}):null]},e.key)})})]})}),(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-t border-stone-100 px-4 py-2.5 text-xs text-stone-500`,children:[(0,F.jsxs)(`span`,{children:[`显示 `,q.length,` 条`,X.selectedIds.length?` · 已选 ${X.selectedIds.length}`:``]}),(0,F.jsx)(`span`,{className:`ml-auto text-stone-400`,children:`关联 Objective:点击弹出胶囊框;在 Objective 选年度计划后自动带出`})]}),He?(0,F.jsx)(Ie,{open:!0,item:He,yearCycles:t.yearCycles,yearCycleMutate:A,objectives:t.objectives,planTypes:t.planTypes,planTypeMutate:k,isVisible:j.isVisible,onClose:()=>Ue(null),onSave:et}):null,(0,F.jsx)(i,{open:z!=null,title:z&&z.length>1?`批量删除`:`删除年度计划`,message:z&&z.length>1?`删除选中的 ${z.length} 条计划?`:`删除「${z?.[0]?.title??``}」?`,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>B(null),onConfirm:()=>void tt()})]})}export{Le as default};
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{t as n}from"./react-dom.DLW9pGCF.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"./OverflowHint.pvo2Xc8R.js";import{t as o}from"./SelectDropdown.Dmk5n225.js";import{showToast as s}from"./Toast.BO2NFckG.js";import{c,d as l,i as u,l as d,n as f,o as p,t as m}from"./ColumnResize.CkE59sGq.js";import{$ as h,A as g,B as _,C as v,E as ee,F as y,H as te,J as ne,K as re,L as ie,M as b,N as ae,P as oe,Q as se,S as ce,St as le,T as ue,U as de,V as fe,X as pe,Y as me,Z as he,_ as ge,b as x,c as _e,dt as S,et as ve,f as C,g as ye,k as be,pt as xe,ut as w,w as Se,x as Ce,y as we,z as T}from"./LifeShared.CtdsQI43.js";import{c as E,l as D,n as O,r as k,s as A,t as j}from"./DrawerField.CWpOf3L_.js";import{t as M}from"./LifePlanTypeSelect.CdKQmlEK.js";import{t as Te}from"./LifeYearCycleSelect.BILJOKXK.js";var N=e(t(),1),P=e(n(),1),F=r(),Ee=[{key:`select`,width:36,min:32},{key:`title`,width:220,min:160},{key:`yearCycle`,width:120,min:88},{key:`planType`,width:112,min:88},{key:`status`,width:104,min:76},{key:`objectives`,width:280,min:180},{key:`createdAt`,width:120,min:96},{key:`updatedAt`,width:120,min:96},{key:`filler`,filler:!0},{key:`action`,width:88,min:72}],De=[{key:`yearCycle`,label:`年度周期`},{key:`planType`,label:`计划类型`},{key:`status`,label:`状态`},{key:`objectives`,label:`关联 Objective`},{key:`createdAt`,label:`创建日期`},{key:`updatedAt`,label:`修改日期`}],Oe=`life.year-plans.fields`,ke=`life.year-plans.search`,Ae=`life.year-plans.group`,je=[`status`,`yearCycle`,`none`],I=w.map(e=>({value:e,label:S[e]})),Me={in_progress:`bg-[#e1eaff] text-[#1f4ec2]`,incomplete:`bg-[#fff1e3] text-[#a85b00]`,done:`bg-[#d9f5d2] text-[#1d7a12]`},Ne=[{value:`none`,label:`不分组`},{value:`status`,label:`按状态分组`},{value:`yearCycle`,label:`按年度分组`}];function L(e){return{title:``,yearCycle:e?.yearCycle??``,planType:e?.planType??``,status:e?.status??`in_progress`,objectiveIds:e?.objectiveIds??[]}}function Pe(e){let t=(0,N.useMemo)(()=>{let t=new Set(e.values);return e.objectives.filter(n=>t.has(n.id)||!!e.yearPlanId&&n.yearPlanId===e.yearPlanId)},[e.objectives,e.values,e.yearPlanId]),n=!e.yearCycle,r=t.length===0,i=n?`先选年度周期`:r?`暂无关联 Objective`:`已关联 ${t.length} 个目标`,[o,s]=(0,N.useState)(!1),[c,l]=(0,N.useState)({left:0,top:0,width:280,openUp:!1}),u=(0,N.useRef)(null),d=(0,N.useRef)(null),f=n;(0,N.useEffect)(()=>{if(!o)return;function e(e){let t=e.target;u.current?.contains(t)||d.current?.contains(t)||s(!1)}function t(e){e.target instanceof Node&&d.current?.contains(e.target)||s(!1)}function n(){s(!1)}return document.addEventListener(`mousedown`,e),window.addEventListener(`scroll`,t,!0),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`mousedown`,e),window.removeEventListener(`scroll`,t,!0),window.removeEventListener(`resize`,n)}},[o]);function p(){if(f)return;if(o){s(!1);return}let e=u.current;if(!e)return;let t=e.getBoundingClientRect(),n=Math.max(t.width,260),r=Math.min(t.left,Math.max(8,window.innerWidth-n-8)),i=t.bottom+4,a=i+200>window.innerHeight&&t.top>200;l({left:r,top:a?t.top-4:i,width:n,openUp:a}),s(!0)}function m(n,r){r.stopPropagation(),e.onChange(t.filter(e=>e.id!==n).map(e=>e.id))}let h=f?`w-full min-h-8 flex items-center justify-start rounded-lg border border-stone-200 bg-stone-50 px-2.5 py-1.5 text-sm text-left text-stone-400 cursor-not-allowed`:e.flat?`tw-field-trigger w-full min-h-9 flex items-center justify-start 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`:`tw-field-trigger w-full min-h-8 flex items-center justify-start rounded-lg border border-stone-200 bg-white px-2.5 py-1.5 text-sm text-left text-stone-800 outline-none hover:border-stone-300 focus:ring-1 focus:ring-[#3370ff]/30`,g=null;return o&&typeof document<`u`&&(g=(0,P.createPortal)((0,F.jsx)(`div`,{ref:d,className:`tw-select-menu tw-popover-anim fixed z-[1000] overflow-hidden rounded-lg shadow-lg ring-1 ring-stone-200`,style:{left:c.left,width:c.width,...c.openUp?{bottom:window.innerHeight-c.top}:{top:c.top}},children:(0,F.jsx)(`div`,{className:`tw-dsh-scroll max-h-[120px] overflow-y-auto bg-white px-2.5 py-2`,onWheel:e=>e.stopPropagation(),children:r?(0,F.jsx)(`p`,{className:`px-1 py-1 text-sm text-stone-400`,children:n?`先选年度周期`:`暂无关联 Objective,可在 Objective 里选年度计划`}):(0,F.jsx)(`div`,{className:`flex flex-wrap content-start gap-1.5`,children:t.map(e=>(0,F.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1 rounded-full bg-[#e8f0fe] px-2.5 py-0.5 text-[12px] leading-5 text-[#1f4ec2]`,children:[(0,F.jsx)(`span`,{className:`min-w-0 break-words whitespace-pre-wrap`,children:e.title}),(0,F.jsx)(`span`,{role:`button`,tabIndex:-1,"aria-label":`移除 ${e.title}`,className:`shrink-0 rounded-full px-0.5 text-[#5b7fd4] hover:bg-[#d2e3fc] hover:text-[#1f4ec2]`,onClick:t=>m(e.id,t),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),m(e.id,t))},children:`×`})]},e.id))})})}),document.body)),(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(`button`,{ref:u,type:`button`,disabled:f,"aria-expanded":o,onClick:p,className:h,children:r||f?(0,F.jsx)(`span`,{className:`text-stone-400`,children:i}):(0,F.jsx)(a,{text:t.map(e=>e.title).join(`、`),className:`block min-w-0 flex-1 truncate text-left text-stone-700`})}),g]})}function Fe(e){let t={},n=/(?:^|\|)status:([^|]+)/.exec(e)?.[1];n&&w.includes(n)&&(t.status=n);let r=/(?:^|\|)year:([^|]+)/.exec(e)?.[1];return r&&r!==`unset`&&(t.yearCycle=r),t}function Ie(e){let{open:t,item:n,yearCycles:r,yearCycleMutate:i,objectives:o,planTypes:s,planTypeMutate:c,isVisible:l,onClose:u,onSave:d}=e,[f,p]=(0,N.useState)(L()),[m,h]=(0,N.useState)(!1),[g,_]=(0,N.useState)(``);(0,N.useEffect)(()=>{t&&(_(``),h(!1),p({title:n.title,yearCycle:n.yearCycle,planType:n.planType||``,status:n.status,objectiveIds:n.objectiveIds??[]}))},[t,n]);async function v(){let e=f.title.trim();if(!e)_(`请填写计划标题`);else{h(!0);try{await d({...f,title:e,yearCycle:f.yearCycle,objectiveIds:f.objectiveIds},n.id),u()}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}}}return(0,F.jsxs)(x,{open:t,title:`计划详情`,onClose:u,footer:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`button`,{type:`button`,onClick:u,className:`h-9 rounded-lg border border-stone-200 px-4 text-sm text-stone-700 hover:bg-stone-50`,children:`取消`}),(0,F.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>void v(),className:`h-9 rounded-lg bg-[#3370ff] px-4 text-sm font-medium text-white hover:bg-[#2b5fd9] disabled:opacity-40`,children:m?`保存中…`:`保存`})]}),children:[g?(0,F.jsx)(`p`,{className:`mx-6 mb-2 text-sm text-red-600`,children:g}):null,(0,F.jsx)(O,{icon:(0,F.jsx)(D,{}),label:`标题`,children:(0,F.jsx)(`input`,{autoFocus:!0,value:f.title,onChange:e=>p({...f,title:e.target.value}),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),v())},placeholder:`请输入内容`,className:j})}),l(`yearCycle`)?(0,F.jsx)(O,{icon:(0,F.jsx)(E,{}),label:`年度周期`,children:(0,F.jsx)(Te,{flat:!0,className:`w-full`,yearCycles:r,value:f.yearCycle,onChange:e=>p({...f,yearCycle:e}),mutate:i,renderTrigger:(e,{empty:t})=>(0,F.jsx)(a,{text:e,className:`block min-w-0 flex-1 basis-0 truncate ${t?`text-stone-400`:`text-stone-800`}`})})}):null,l(`planType`)?(0,F.jsx)(O,{icon:(0,F.jsx)(E,{}),label:`计划类型`,children:(0,F.jsx)(M,{flat:!0,className:`w-full`,planTypes:s,value:f.planType,onChange:e=>p({...f,planType:e}),mutate:c,renderTrigger:(e,{empty:t})=>(0,F.jsx)(a,{text:e,className:`block min-w-0 flex-1 basis-0 truncate ${t?`text-stone-400`:`text-stone-800`}`})})}):null,l(`status`)?(0,F.jsx)(O,{icon:(0,F.jsx)(A,{}),label:`状态`,children:(0,F.jsx)(k,{ariaLabel:`计划状态`,options:I,value:f.status,onChange:e=>p({...f,status:e}),label:S[f.status],optionDotClassName:e=>y[e]})}):null,l(`objectives`)?(0,F.jsx)(O,{icon:(0,F.jsx)(E,{}),label:`关联 Objective`,children:(0,F.jsxs)(`div`,{className:`w-full px-0.5 py-0.5`,children:[(0,F.jsx)(Pe,{flat:!0,yearCycle:f.yearCycle,yearPlanId:n.id,objectives:o,values:f.objectiveIds,onChange:e=>p({...f,objectiveIds:e})}),(0,F.jsx)(`p`,{className:`mt-1 px-1.5 text-[11px] leading-4 text-stone-400`,children:`点击查看已关联目标;在 Objective 里选「年度计划」后会自动出现。`})]})}):null,l(`createdAt`)?(0,F.jsx)(O,{icon:(0,F.jsx)(E,{}),label:`创建日期`,children:(0,F.jsx)(`div`,{className:`px-2 py-1.5 text-sm text-stone-500`,children:T(n.createdAt)})}):null,l(`updatedAt`)?(0,F.jsx)(O,{icon:(0,F.jsx)(E,{}),label:`修改日期`,children:(0,F.jsx)(`div`,{className:`px-2 py-1.5 text-sm text-stone-500`,children:T(n.updatedAt)})}):null]})}function Le(){let e=se(),{store:t,live:n,error:r,setError:x,updateItem:E,createItems:D,deleteItems:O}=ve(e.ready&&e.on),k=(0,N.useMemo)(()=>({createItems:D,updateItem:E,deleteItems:O}),[D,E,O]),A=(0,N.useMemo)(()=>({createItems:D,updateItem:E,deleteItems:O}),[D,E,O]),j=me(Oe,De),P=(0,N.useMemo)(()=>ie(Ee,j.isVisible),[j.isVisible]),[L,Le]=he(ke),Re=de(),[R,ze]=ne(Ae,je,`none`),[Be,Ve]=(0,N.useState)({}),[z,B]=(0,N.useState)(null),[He,Ue]=(0,N.useState)(null),[V,We]=(0,N.useState)(!1),[H,Ge]=(0,N.useState)(!1),[Ke,U]=(0,N.useState)({}),[W,G]=(0,N.useState)(null),K=d(`life.year-plans.cols.v13`,P),qe=l(`life.year-plans`),q=(0,N.useMemo)(()=>re(xe(t.yearPlans,L),w),[t.yearPlans,L]),J=(0,N.useMemo)(()=>{if(R===`none`)return[{key:`all`,label:`全部计划`,pill:`bg-stone-500 text-white`,items:q}];if(R===`yearCycle`){let e=le(t.yearCycles),n=new Set(e.map(e=>e.id)),r=e.map(e=>({key:`year:${e.id}`,label:e.name,pill:_(e.id),items:q.filter(t=>t.yearCycle===e.id)})).filter(e=>e.items.length>0),i=q.filter(e=>!e.yearCycle||!n.has(e.yearCycle));return i.length>0&&r.push({key:`year:unset`,label:ye,pill:_(``),items:i}),r}return w.map(e=>({key:`status:${e}`,label:S[e],pill:Me[e],items:q.filter(t=>t.status===e)}))},[R,q,t.yearCycles]),Y=(0,N.useMemo)(()=>{if(R===`status`)return J;let e=J.filter(e=>e.items.length>0);return e.length>0?e:R===`none`?J.length>0?J:[{key:`all`,label:`全部计划`,pill:`bg-stone-500 text-white`,items:[]}]:[{key:`year:unset`,label:ye,pill:`bg-stone-300 text-stone-600`,items:[]}]},[R,J]),Je=(0,N.useMemo)(()=>Y.flatMap(e=>e.items.map(e=>e.id)),[Y]),X=h(Je),{submit:Ye}=pe({row:W,setRow:G,submitting:H,isPristine:e=>!e.title.trim()&&e.yearCycle===e.baseYearCycle&&e.planType===e.basePlanType&&e.status===e.baseStatus&&e.objectiveIds.join(`|`)===e.baseObjectiveIds.join(`|`),onSubmit:async e=>{Ge(!0);try{await D(`yearPlans`,[{title:e.title,yearCycle:e.yearCycle,planType:e.planType,status:e.status,objectiveIds:e.objectiveIds}]),G(null),s(`已新增年度计划`,`success`),x(``)}catch(e){let t=e instanceof Error?e.message:String(e);x(t),s(`新增失败:${t}`,`error`)}finally{Ge(!1)}}});function Xe(e,t){let n=t?.planType??``,r=t?.status??`in_progress`,i=t?.yearCycle??``;G({groupKey:e,title:``,yearCycle:i,planType:n,status:r,objectiveIds:[],baseYearCycle:i,basePlanType:n,baseStatus:r,baseObjectiveIds:[]}),Ve(t=>({...t,[e]:!1}))}async function Z(e,t){try{await E(`yearPlans`,e,t),U(t=>{let n={...t};return delete n[e],n}),x(``)}catch(e){let t=e instanceof Error?e.message:String(e);x(t),s(`保存失败:${t}`,`error`)}}function Ze(e){return{...e,...Ke[e.id]}}function Qe(e,t){U(n=>({...n,[e]:{...n[e],...t}}))}async function $e(e){let t=Ke[e.id];if(!t)return;let n=(t.title??e.title).trim();n?await Z(e.id,{...t,title:n}):x(`标题不能为空`)}async function et(e,t){await E(`yearPlans`,t,e),s(`已保存`,`success`)}function Q(){return W?(0,F.jsxs)(`tr`,{className:`tw-new-row`,children:[(0,F.jsx)(`td`,{className:`px-2 py-1 align-middle`}),(0,F.jsx)(`td`,{className:f,style:Re,children:(0,F.jsx)(`input`,{autoFocus:!0,disabled:H,value:W.title,placeholder:`输入计划名称,回车或点空白处保存`,onChange:e=>G(t=>t&&{...t,title:e.target.value}),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),Ye()):e.key===`Escape`&&(e.preventDefault(),G(null))},className:_e})}),j.isVisible(`yearCycle`)?(0,F.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,F.jsx)(Te,{unstyled:!0,pill:!0,yearCycles:t.yearCycles,value:W.yearCycle,onChange:e=>G(t=>t&&{...t,yearCycle:e}),mutate:A})}):null,j.isVisible(`planType`)?(0,F.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,F.jsx)(M,{unstyled:!0,pill:!0,planTypes:t.planTypes,value:W.planType,onChange:e=>G(t=>t&&{...t,planType:e}),mutate:k})}):null,j.isVisible(`status`)?(0,F.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,F.jsx)(o,{unstyled:!0,fitContent:!0,hideChevron:!0,centerContent:!0,ariaLabel:`计划状态`,menuMinWidth:120,options:I,value:W.status,onChange:e=>G(t=>t&&{...t,status:e}),triggerClassName:`h-7 max-w-full rounded-md px-2 text-center text-xs font-medium focus:ring-2 focus:ring-[#3370ff]/30 ${oe[W.status]}`,renderTrigger:()=>(0,F.jsx)(a,{text:S[W.status],className:`block min-w-0 truncate`}),renderOptionPrefix:e=>(0,F.jsx)(`span`,{className:`h-2 w-2 rounded-full ${y[e.value]}`})})}):null,j.isVisible(`objectives`)?(0,F.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,F.jsx)(Pe,{yearCycle:W.yearCycle,objectives:t.objectives,values:W.objectiveIds,onChange:e=>G(t=>t&&{...t,objectiveIds:e})})}):null,j.isVisible(`createdAt`)?(0,F.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,F.jsx)(b,{text:`—`,muted:!0})}):null,j.isVisible(`updatedAt`)?(0,F.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,F.jsx)(b,{text:`—`,muted:!0})}):null,(0,F.jsx)(`td`,{"aria-hidden":`true`}),(0,F.jsx)(`td`,{className:u})]}):null}async function tt(){let e=z;if(e?.length){B(null),We(!0);try{await O(`yearPlans`,e.map(e=>e.id)),X.clear(),s(e.length>1?`已删除 ${e.length} 条`:`已删除`,`success`)}catch(e){x(e instanceof Error?e.message:String(e))}finally{We(!1)}}}function nt(e,n){let r=Ze(e);return(0,F.jsxs)(`tr`,{className:`group/row tw-life-group-body hover:bg-[#f7f8fa]`,children:[(0,F.jsx)(be,{checked:!!X.selected[e.id],onChange:()=>X.toggle(e.id),label:`选择 ${e.title}`,index:n,selecting:X.selectedIds.length>0}),(0,F.jsx)(`td`,{className:f,style:Re,children:(0,F.jsx)(ae,{value:r.title,placeholder:`标题`,onChange:t=>Qe(e.id,{title:t}),onCommit:()=>void $e(e),onCancel:()=>U(t=>{let n={...t};return delete n[e.id],n})})}),j.isVisible(`yearCycle`)?(0,F.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,F.jsx)(Te,{unstyled:!0,pill:!0,yearCycles:t.yearCycles,value:r.yearCycle,onChange:t=>void Z(e.id,{yearCycle:t}),mutate:A})}):null,j.isVisible(`planType`)?(0,F.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,F.jsx)(M,{unstyled:!0,pill:!0,planTypes:t.planTypes,value:r.planType,onChange:t=>void Z(e.id,{planType:t}),mutate:k})}):null,j.isVisible(`status`)?(0,F.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,F.jsx)(o,{unstyled:!0,fitContent:!0,hideChevron:!0,centerContent:!0,ariaLabel:`计划状态`,menuMinWidth:120,options:I,value:r.status,onChange:t=>void Z(e.id,{status:t}),triggerClassName:`h-7 max-w-full rounded-md px-2 text-center text-xs font-medium focus:ring-2 focus:ring-[#3370ff]/30 ${oe[r.status]}`,renderTrigger:()=>(0,F.jsx)(a,{text:S[r.status],className:`block min-w-0 truncate`}),renderOptionPrefix:e=>(0,F.jsx)(`span`,{className:`h-2 w-2 rounded-full ${y[e.value]}`})})}):null,j.isVisible(`objectives`)?(0,F.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,F.jsx)(Pe,{yearCycle:r.yearCycle,yearPlanId:e.id,objectives:t.objectives,values:r.objectiveIds??[],onChange:t=>void Z(e.id,{objectiveIds:t})})}):null,j.isVisible(`createdAt`)?(0,F.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,F.jsx)(b,{text:T(e.createdAt),muted:!e.createdAt})}):null,j.isVisible(`updatedAt`)?(0,F.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,F.jsx)(b,{text:T(e.updatedAt),muted:!e.updatedAt})}):null,(0,F.jsx)(`td`,{"aria-hidden":`true`}),(0,F.jsx)(`td`,{className:u,children:(0,F.jsxs)(`div`,{className:`flex justify-end gap-0.5`,children:[(0,F.jsx)(ce,{label:`编辑 ${e.title}`,disabled:V,onClick:()=>Ue(e)}),(0,F.jsx)(we,{label:`删除 ${e.title}`,disabled:V,onClick:()=>B([e])})]})})]},e.id)}if(!e.ready)return(0,F.jsx)(ue,{label:`正在读取插件开关`});if(!e.on)return(0,F.jsx)(ee,{children:fe()});if(n===null)return(0,F.jsx)(ue,{label:`正在连接人生管理服务`});if(!n)return(0,F.jsx)(ee,{children:`人生管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`});let $=P.length;return(0,F.jsxs)(`section`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,F.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-3 border-b border-stone-100 px-4 py-3`,children:[(0,F.jsxs)(`div`,{className:`text-sm text-stone-600`,children:[`共 `,(0,F.jsx)(`span`,{className:`font-medium text-stone-800`,children:t.yearPlans.length}),` 条`]}),(0,F.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(`input`,{value:L,onChange:e=>Le(e.target.value),placeholder:`搜索年度计划…`,className:`h-9 w-52 rounded-lg border border-stone-200 px-3 text-sm text-stone-800 outline-none focus:border-[#3370ff]`}),(0,F.jsx)(o,{flat:!0,className:`w-[132px]`,ariaLabel:`分组方式`,options:Ne,value:R,onChange:e=>ze(e)}),(0,F.jsx)(v,{fields:j.fields,isVisible:j.isVisible,onToggle:j.toggle}),(0,F.jsx)(`button`,{type:`button`,disabled:V||X.selectedIds.length===0,onClick:()=>B(t.yearPlans.filter(e=>X.selected[e.id])),className:`h-9 shrink-0 rounded-lg border border-red-200 px-3 text-sm font-medium whitespace-nowrap text-red-600 hover:bg-red-50 disabled:opacity-40`,children:`批量删除`}),(0,F.jsx)(`button`,{type:`button`,disabled:V||H,onClick:()=>{let e=Y[0];Xe(e?.key??`all`,e?Fe(e.key):void 0)},className:`h-9 shrink-0 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white hover:bg-[#2b5fd9] disabled:opacity-40`,children:`+ 新建计划`})]})]}),(0,F.jsx)(Ce,{error:r,onDismiss:()=>x(``)}),(0,F.jsx)(`div`,{ref:qe,className:`tw-scroll-x min-h-0 flex-1 overflow-auto`,children:(0,F.jsxs)(`table`,{className:`tw-task-table tw-sticky-table w-full table-fixed text-sm`,style:K.tableStyle,children:[(0,F.jsx)(`colgroup`,{children:P.map(e=>(0,F.jsx)(`col`,{style:e.key===`select`?{width:te(!1)}:K.widthOf(e.key)?{width:K.widthOf(e.key)}:void 0},e.key))}),(0,F.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-xs text-stone-500`,children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(g,{checked:X.allVisibleSelected,indeterminate:X.selectedIds.length>0&&!X.allVisibleSelected,onChange:()=>X.toggleAllVisible()}),(0,F.jsxs)(`th`,{className:`${p} text-xs text-stone-500`,style:Re,children:[`标题`,(0,F.jsx)(m,{...K.resizeProps(`title`)})]}),j.isVisible(`yearCycle`)?(0,F.jsxs)(`th`,{className:C,children:[`年度周期`,(0,F.jsx)(m,{...K.resizeProps(`yearCycle`)})]}):null,j.isVisible(`planType`)?(0,F.jsxs)(`th`,{className:C,children:[`计划类型`,(0,F.jsx)(m,{...K.resizeProps(`planType`)})]}):null,j.isVisible(`status`)?(0,F.jsxs)(`th`,{className:C,children:[`状态`,(0,F.jsx)(m,{...K.resizeProps(`status`)})]}):null,j.isVisible(`objectives`)?(0,F.jsxs)(`th`,{className:C,children:[`关联 Objective`,(0,F.jsx)(m,{...K.resizeProps(`objectives`)})]}):null,j.isVisible(`createdAt`)?(0,F.jsxs)(`th`,{className:C,children:[`创建日期`,(0,F.jsx)(m,{...K.resizeProps(`createdAt`)})]}):null,j.isVisible(`updatedAt`)?(0,F.jsxs)(`th`,{className:C,children:[`修改日期`,(0,F.jsx)(m,{...K.resizeProps(`updatedAt`)})]}):null,(0,F.jsx)(`th`,{"aria-hidden":`true`}),(0,F.jsx)(`th`,{className:c,children:`操作`})]})}),(0,F.jsx)(`tbody`,{children:q.length===0&&!W?(0,F.jsx)(`tr`,{children:(0,F.jsx)(`td`,{colSpan:$,className:`px-3 py-16 text-center text-sm text-stone-400`,children:t.yearPlans.length===0?`还没有年度计划`:`没有匹配的记录`})}):q.length===0&&W?Q():R===`none`?(0,F.jsxs)(F.Fragment,{children:[q.map((e,t)=>nt(e,t+1)),W?Q():(0,F.jsx)(ge,{colSpan:$,disabled:V||H,onClick:()=>Xe(`all`)})]}):Y.length===0?W?Q():null:Y.map(e=>{let t=!Be[e.key];return(0,F.jsxs)(N.Fragment,{children:[(0,F.jsx)(Se,{label:e.label,pill:e.pill,count:e.items.length,open:t,kind:`tag`,colSpan:$,onToggle:()=>Ve(t=>({...t,[e.key]:!t[e.key]}))}),t?(0,F.jsxs)(F.Fragment,{children:[e.items.map((e,t)=>nt(e,t+1)),W?.groupKey===e.key?Q():q.length>0?(0,F.jsx)(ge,{colSpan:$,disabled:V||H,onClick:()=>Xe(e.key,Fe(e.key))}):null]}):null]},e.key)})})]})}),(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-t border-stone-100 px-4 py-2.5 text-xs text-stone-500`,children:[(0,F.jsxs)(`span`,{children:[`显示 `,q.length,` 条`,X.selectedIds.length?` · 已选 ${X.selectedIds.length}`:``]}),(0,F.jsx)(`span`,{className:`ml-auto text-stone-400`,children:`关联 Objective:点击弹出胶囊框;在 Objective 选年度计划后自动带出`})]}),He?(0,F.jsx)(Ie,{open:!0,item:He,yearCycles:t.yearCycles,yearCycleMutate:A,objectives:t.objectives,planTypes:t.planTypes,planTypeMutate:k,isVisible:j.isVisible,onClose:()=>Ue(null),onSave:et}):null,(0,F.jsx)(i,{open:z!=null,title:z&&z.length>1?`批量删除`:`删除年度计划`,message:z&&z.length>1?`删除选中的 ${z.length} 条计划?`:`删除「${z?.[0]?.title??``}」?`,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>B(null),onConfirm:()=>void tt()})]})}export{Le as default};
|
|
@@ -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.C4rpn1Ix.js";import{a as O,i as k,o as ie}from"./plugins.C0NrHGZv.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.BJeTr39S.js";import{n as oe}from"./hydrate-cache.DI6vqM0o.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};
|
|
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.DwpFFa5D.js";import{a as O,i as k,o as ie}from"./plugins.BmKRnp4a.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.vo2aElR9.js";import{n as oe}from"./hydrate-cache.CoD1FB3T.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.D2OrUGY3.js";
|