lantern-harness 0.1.14 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/builtin/session/lh-nav-groups.mjs +3 -0
  3. package/cli/server.mjs +3 -0
  4. package/config/app.defaults.json +2 -0
  5. package/dist/500.html +4 -4
  6. package/dist/_astro/Base.VCz1UVxQ.css +1 -0
  7. package/dist/_astro/{Base.astro_astro_type_script_index_0_lang.BS3Daz5F.js → Base.astro_astro_type_script_index_0_lang.CpzwEBjx.js} +1 -1
  8. package/dist/_astro/CaseExecBoard.cBdsZU9e.js +1 -0
  9. package/dist/_astro/CaseGenerateApp.D2ftaUXT.js +9 -0
  10. package/dist/_astro/CasesLibrary.DWXEje9u.js +19 -0
  11. package/dist/_astro/ChatApp.7piDha-y.js +226 -0
  12. package/dist/_astro/ColumnResize.BgYkV9Iy.js +1 -0
  13. package/dist/_astro/{DashboardBoard.BKtXwr_n.js → DashboardBoard.BIP9es-t.js} +1 -1
  14. package/dist/_astro/DocsFileBrowser.-dkkxR4X.js +1 -0
  15. package/dist/_astro/{DocsPager.C6R2nQ60.js → DocsPager.v4kQH163.js} +1 -1
  16. package/dist/_astro/{DrawerField.BXWvezBs.js → DrawerField.C0ehOlDt.js} +1 -1
  17. package/dist/_astro/ExcelFieldTags.ytbpKt-Z.js +5 -0
  18. package/dist/_astro/{KnowledgeLibrary.fYr4VQkZ.js → KnowledgeLibrary.Dw-IX3Zt.js} +1 -1
  19. package/dist/_astro/{NavLibraries.CpnreEwA.js → NavLibraries.D1J9BwYo.js} +1 -1
  20. package/dist/_astro/OverflowHint.pvo2Xc8R.js +1 -0
  21. package/dist/_astro/PluginsPage.DMTsFl_R.js +7 -0
  22. package/dist/_astro/PluginsPage.DMxVKmiY.js +1 -0
  23. package/dist/_astro/{PmBugsBoard.ifLSqDOs.js → PmBugsBoard.BTtm1lki.js} +1 -1
  24. package/dist/_astro/{PmIterationsBoard.CVjphcgB.js → PmIterationsBoard.Dm67iXe_.js} +1 -1
  25. package/dist/_astro/{PmProjectDetail.Dudm02Xv.js → PmProjectDetail.B7oWL7y-.js} +1 -1
  26. package/dist/_astro/{PmProjectsBoard.CKWUrQHF.js → PmProjectsBoard.8QI44RlE.js} +1 -1
  27. package/dist/_astro/PmRequirementsBoard.DMJVLCqz.js +1 -0
  28. package/dist/_astro/PmRequirementsBoard.X98441HZ.js +1 -0
  29. package/dist/_astro/{PmShared.BwVlCk92.js → PmShared.DbDseTcc.js} +1 -1
  30. package/dist/_astro/PromptMountDialog.YH2odDZx.js +58 -0
  31. package/dist/_astro/PromptsLibrary.B_qFbQGi.js +1 -0
  32. package/dist/_astro/{ReportsPage.BKcIJsLn.js → ReportsPage.BjcajHR6.js} +1 -1
  33. package/dist/_astro/ReqAnalysisBoard.hwNqRyim.js +28 -0
  34. package/dist/_astro/{RequirementsLibrary.D5iItFfK.js → RequirementsLibrary.CGCNnQQG.js} +1 -1
  35. package/dist/_astro/SearchableSelect.mvcBwegf.js +1 -0
  36. package/dist/_astro/{SelectDropdown.DqKxIust.js → SelectDropdown.Cb-QtC-D.js} +1 -1
  37. package/dist/_astro/{SettingsDialog.a99Y08tE.js → SettingsDialog.CnBZRaWE.js} +1 -1
  38. package/dist/_astro/{SpaceSwitcher.DDGfnQBp.js → SpaceSwitcher.DMoqOVpS.js} +1 -1
  39. package/dist/_astro/TasksBoard.DvfyDL76.js +1 -0
  40. package/dist/_astro/{TemplatesLibrary.C3mqFIB0.js → TemplatesLibrary.B5KmjjFw.js} +1 -1
  41. package/dist/_astro/TestStatsBoard.EIDxmU_8.js +1 -0
  42. package/dist/_astro/TodosBoard.7IptYUFY.js +1 -0
  43. package/dist/_astro/UiAutoBoard.DJljpjXT.js +9 -0
  44. package/dist/_astro/{app-config.Bm4oN4YP.js → app-config.CF1xVPmo.js} +1 -1
  45. package/dist/_astro/app-version.YyNOCGCb.js +1 -0
  46. package/dist/_astro/case-review.DYyZat83.js +3 -0
  47. package/dist/_astro/case-types.DS1EQ5yP.js +1 -0
  48. package/dist/_astro/composer-task.DJmluzPT.js +5 -0
  49. package/dist/_astro/export.joBT53eb.js +148 -0
  50. package/dist/_astro/{hydrate-cache.BJ2nzhRq.js → hydrate-cache.CmC22o_H.js} +1 -1
  51. package/dist/_astro/{i18n.m5rqL3-h.js → i18n.B3BVhlok.js} +1 -1
  52. package/dist/_astro/index.astro_astro_type_script_index_0_lang.CM78W1qz.js +1 -0
  53. package/dist/_astro/{open-docs-in-session.DPCjFUcv.js → open-docs-in-session.B6uyOxPn.js} +1 -1
  54. package/dist/_astro/{plugins.CCqu2gnf.js → plugins.DYyAjBXb.js} +1 -1
  55. package/dist/_astro/prompts-meta.C_MeYq8G.js +2 -0
  56. package/dist/_astro/req-analysis.CkLx8c9E.js +6 -0
  57. package/dist/_astro/{settings.DNkAyQxA.js → settings.BvxRxdqa.js} +2 -2
  58. package/dist/_astro/{spaces-client.D4EmN6SH.js → spaces-client.Dy3tSPta.js} +1 -1
  59. package/dist/_astro/story-review.CGcusNKf.js +10 -0
  60. package/dist/_astro/{view-prefs.Do8yjl1I.js → view-prefs.D1snIG5o.js} +1 -1
  61. package/dist/case-exec/index.html +5 -5
  62. package/dist/cases/generate/index.html +5 -5
  63. package/dist/cases/library/index.html +5 -5
  64. package/dist/dashboard/index.html +5 -5
  65. package/dist/docs/changelog/index.html +33 -5
  66. package/dist/docs/install/index.html +4 -4
  67. package/dist/docs/manual/index.html +85 -49
  68. package/dist/index.html +1 -1
  69. package/dist/knowledge/index.html +5 -5
  70. package/dist/knowledge//345/212/237/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213/347/274/226/345/206/231/350/247/204/350/214/203/index.html +4 -4
  71. package/dist/plugins/index.html +5 -5
  72. package/dist/pm/bugs/index.html +5 -5
  73. package/dist/pm/iterations/index.html +5 -5
  74. package/dist/pm/projects/detail/index.html +5 -5
  75. package/dist/pm/projects/index.html +5 -5
  76. package/dist/pm/requirements/index.html +5 -5
  77. package/dist/prompts/index.html +5 -5
  78. package/dist/reports/index.html +5 -5
  79. package/dist/requirement-analysis/index.html +5 -5
  80. package/dist/requirements/index.html +5 -5
  81. package/dist/tasks/index.html +5 -5
  82. package/dist/templates/index.html +5 -5
  83. package/dist/templates//345/212/237/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212//345/212/237/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277/index.html +4 -4
  84. package/dist/templates//346/200/247/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212//346/200/247/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277/index.html +4 -4
  85. package/dist/templates//346/200/247/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213//346/200/247/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213/346/250/241/346/235/277/index.html +4 -4
  86. package/dist/templates//346/216/245/345/217/243/346/265/213/350/257/225/346/212/245/345/221/212//346/216/245/345/217/243/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277/index.html +4 -4
  87. package/dist/templates//350/207/252/345/212/250/345/214/226/346/265/213/350/257/225/347/224/250/344/276/213//350/207/252/345/212/250/345/214/226/346/265/213/350/257/225/347/224/250/344/276/213/346/250/241/346/235/277/index.html +4 -4
  88. package/dist/test-automation/index.html +5 -5
  89. package/dist/test-stats/index.html +5 -5
  90. package/dist/todos/index.html +5 -5
  91. package/dist/workbench/index.html +5 -5
  92. package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +47 -30
  93. package/lh-plugins/case-review-prompt.mjs +181 -0
  94. package/lh-plugins/lh-case-review.mjs +627 -0
  95. package/lh-plugins/lh-req-analysis.mjs +1 -1
  96. package/lh-plugins/plugin-prompts.mjs +4 -0
  97. package/package.json +1 -1
  98. package/dist/_astro/Base.XN4RkAyb.css +0 -1
  99. package/dist/_astro/CaseExecBoard.6RFYgAq5.js +0 -1
  100. package/dist/_astro/CaseGenerateApp.BwvNF4eM.js +0 -9
  101. package/dist/_astro/CasesLibrary.LnLh6m6G.js +0 -1
  102. package/dist/_astro/ChatApp.bMYcVMLe.js +0 -226
  103. package/dist/_astro/ColumnResize.BEkEW7qw.js +0 -1
  104. package/dist/_astro/DocsFileBrowser.nSAGUo3l.js +0 -1
  105. package/dist/_astro/ExcelFieldTags.CaD64a2w.js +0 -152
  106. package/dist/_astro/OverflowHint.DI-tZ2fv.js +0 -1
  107. package/dist/_astro/PluginsPage.B56V66Kk.js +0 -7
  108. package/dist/_astro/PluginsPage.DaLeNTSR.js +0 -1
  109. package/dist/_astro/PmRequirementsBoard.CB33kbaD.js +0 -1
  110. package/dist/_astro/PmRequirementsBoard.CJFck3LB.js +0 -1
  111. package/dist/_astro/PromptMountDialog.D_94WQc3.js +0 -58
  112. package/dist/_astro/PromptsLibrary.Bn5Y9KTB.js +0 -1
  113. package/dist/_astro/ReqAnalysisBoard.D1UGCxJd.js +0 -28
  114. package/dist/_astro/SearchableSelect.BzNQ6oXG.js +0 -1
  115. package/dist/_astro/TasksBoard.BniGtf89.js +0 -1
  116. package/dist/_astro/TestStatsBoard.CyWsC1tC.js +0 -1
  117. package/dist/_astro/TodosBoard.Z4Ev2O0M.js +0 -1
  118. package/dist/_astro/UiAutoBoard.DOYiz3km.js +0 -9
  119. package/dist/_astro/app-version.6yGkRTiD.js +0 -1
  120. package/dist/_astro/index.astro_astro_type_script_index_0_lang.CPKr56B1.js +0 -1
  121. package/dist/_astro/prompts-meta.BiymOMAE.js +0 -2
  122. package/dist/_astro/story-review.a7qZTroW.js +0 -15
@@ -1 +0,0 @@
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";var i=e(t(),1),a=e(n(),1),o=r(),s=80,c=420,l=14,u=150;function d({text:e,className:t,disabled:n=!1,matchAnchorWidth:r=!1}){let d=(0,i.useRef)(null),[f,p]=(0,i.useState)(!1),[m,h]=(0,i.useState)(!1),[g,_]=(0,i.useState)(!1),[v,y]=(0,i.useState)(!1),[b,x]=(0,i.useState)(null);(0,i.useLayoutEffect)(()=>{let e=d.current;if(!e)return;let t=()=>p(e.scrollWidth>e.clientWidth+1);t();let n=typeof ResizeObserver<`u`?new ResizeObserver(t):null;return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[e]),(0,i.useLayoutEffect)(()=>{(n||!f)&&h(!1)},[n,f]),(0,i.useLayoutEffect)(()=>{if(m){_(!0);let e=0,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>y(!0))});return()=>{cancelAnimationFrame(t),e&&cancelAnimationFrame(e)}}y(!1);let e=window.setTimeout(()=>_(!1),u);return()=>window.clearTimeout(e)},[m]);let S=(0,i.useCallback)(()=>{let e=d.current;if(!e)return;let t=e.getBoundingClientRect(),n=(r?e.closest(`[data-hint-width]`)??e:e).getBoundingClientRect(),i=r?n.width:t.width,a=Math.min(Math.max(i,160),c),o=t.bottom+72>window.innerHeight-8,s=o?t.top-6:t.bottom+6,u=r?n.left:t.left,f=Math.max(8,Math.min(u,Math.max(8,window.innerWidth-a-8))),p=Math.max(l,Math.min(t.left+t.width/2-f,a-l));x(e=>e&&e.top===s&&e.left===f&&e.maxWidth===a&&e.openUp===o&&e.arrowLeft===p?e:{top:s,left:f,maxWidth:a,openUp:o,arrowLeft:p})},[r]);return(0,i.useLayoutEffect)(()=>{g?S():x(null)}),(0,i.useLayoutEffect)(()=>{if(!g)return;let e=()=>S();return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[g,S]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{ref:d,className:t,onMouseEnter:()=>{f&&!n&&h(!0)},onMouseLeave:()=>h(!1),children:e}),g&&b&&typeof document<`u`?(0,a.createPortal)((0,o.jsxs)(`div`,{role:`tooltip`,"data-closed":v?void 0:``,className:`tw-tooltip tw-tooltip-anim ${b.openUp?`is-up`:`is-down`} pointer-events-none fixed rounded-md px-2 py-1 text-[12px] leading-5 break-all text-stone-700 shadow-lg`,style:{zIndex:s,top:b.top,left:b.left,maxWidth:b.maxWidth,...r?{width:b.maxWidth}:null},children:[(0,o.jsx)(`span`,{"aria-hidden":`true`,className:`tw-tooltip-arrow ${b.openUp?`is-up`:`is-down`} absolute h-2 w-2`,style:{left:b.arrowLeft,...b.openUp?{bottom:-5}:{top:-5},transform:`translateX(-50%) rotate(45deg)`}}),e]}),document.body):null]})}export{d as t};
@@ -1,7 +0,0 @@
1
- import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.Bm4oN4YP.js";import{a as r,l as i,o as a,r as o,t as s}from"./plugins.CCqu2gnf.js";import{o as c}from"./case-exec.BipZCK6G.js";import{t as l}from"./jsx-runtime.DUg_B_vD.js";import{t as u}from"./OverflowHint.DI-tZ2fv.js";import{showToast as d}from"./Toast.BO2NFckG.js";import"./settings.DNkAyQxA.js";import{s as f}from"./fs-tools.3F9MFrLf.js";import{P as p,v as m}from"./pm.CagBA-ht.js";import{s as h,w as g}from"./tasks.otRBFydq.js";import{c as _}from"./report-prompt.CAfZ6RIo.js";import{a as v}from"./ui-auto-prompt.QcLCZoV6.js";import{A as y,U as b,o as x}from"./story-review.a7qZTroW.js";import{r as S}from"./test-stats.MEm3K2rB.js";var C=e(t(),1),w=`/__tb_memory`,T=3e3,E=`你可以使用跨会话长期记忆(本机五轨:user / memory / key / project / daily):
2
- - 系统可能已在 <memory_snapshot> 注入用户档案、全局事实与项目关键记忆;优先参考。
3
- - 查历史进展:memory_search 或 memory_read(project / daily 不自动注入)。
4
- - 用户明确要求记住偏好/全局事实/项目约定:调用 memory_suggest(进待确认,确认后才注入)。
5
- - 回合进展写入:memory_append 到 project 或 daily(无需确认)。
6
- - 不要把寒暄、一次性闲聊写入记忆。`,D=[{type:`function`,function:{name:`memory_search`,description:`在五轨记忆中按关键词搜索条目。`,parameters:{type:`object`,properties:{query:{type:`string`,description:`搜索关键词`}},required:[`query`]}}},{type:`function`,function:{name:`memory_read`,description:`读取某一轨的全部条目。target: user|memory|key|project|daily`,parameters:{type:`object`,properties:{target:{type:`string`,enum:[`user`,`memory`,`key`,`project`,`daily`]}},required:[`target`]}}},{type:`function`,function:{name:`memory_suggest`,description:`提议写入用户档案/全局事实/项目关键(user|memory|key)。写入待确认队列,用户采纳后才生效。`,parameters:{type:`object`,properties:{target:{type:`string`,enum:[`user`,`memory`,`key`]},content:{type:`string`,description:`要记住的事实(简洁)`},reason:{type:`string`,description:`为何值得记住`}},required:[`target`,`content`]}}},{type:`function`,function:{name:`memory_append`,description:`向项目日志或每日日志追加进展(直写,无需确认)。`,parameters:{type:`object`,properties:{target:{type:`string`,enum:[`project`,`daily`]},content:{type:`string`}},required:[`target`,`content`]}}}];async function O(e,t={},n){let r=await fetch(`${w}${e}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t),signal:n}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(i.error??`HTTP ${r.status}`);return i}async function k(e){let t=await fetch(`${w}${e}`),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.error??`HTTP ${t.status}`);return n}async function A(){try{let e=await fetch(`${w}/health`,{signal:AbortSignal.timeout(1500)});return e.ok?await e.json():null}catch{return null}}async function j(){try{return(await k(`/config`)).config??null}catch{return null}}async function M(e){return(await O(`/config`,e)).config}async function N(e=``){try{let t=await O(`/snapshot`,{cwd:e},AbortSignal.timeout(T));return typeof t.text==`string`?t.text:``}catch{return``}}async function P(e=``,t=`all`){let n=await O(`/tracks`,{cwd:e,target:t});return t===`all`?{tracks:n.tracks??{},projectId:n.projectId}:{tracks:{[t]:{entries:n.entries??[],path:n.path,target:t}},projectId:n.projectId}}async function F(){return(await k(`/suggestions`)).suggestions??[]}async function I(e){await O(`/suggestions/approve`,{id:e})}async function L(e){await O(`/suggestions/reject`,{id:e})}async function R(e,t,n=``){await O(`/archive`,{target:e,index:t,cwd:n})}async function z(e,t,n=``){await O(`/delete`,{target:e,index:t,cwd:n})}async function B(e,t,n=``){await O(`/archives/delete`,{target:e,index:t,cwd:n})}async function V(e,t=``){return(await O(`/archives`,{target:e,cwd:t})).entries??[]}async function H(e,t,n=``){await O(`/promote`,{target:e,index:t,cwd:n})}async function U(e,t,n=``){await O(`/manual-add`,{target:e,content:t,cwd:n})}async function W(e,t){let n=t?.cwd??``,r=t?.maxChars??8e3;try{let e=await N(n);return e.length>r&&(e=`${e.slice(0,r-20)}\n…\n</memory_snapshot>`),{context:e,hits:[]}}catch{return{context:``,hits:[]}}}var G=/记住|记下|别忘了|以后都|请记得|我喜欢|我的偏好|默认用|默认显示|默认城市|约定|不要再|以后默认/;async function K(e,t=``){let n=e.trim();if(!n||n.length<4||!G.test(n))return!1;let r=n.length>400?`${n.slice(0,400)}…`:n;try{return await O(`/suggest`,{cwd:t,target:/偏好|喜欢|习惯|称呼|默认/.test(n)?`user`:`memory`,content:r,reason:`用户话术触发自动沉淀`}),!0}catch{return!1}}async function q(e,t,n=``){let r={};try{r=JSON.parse(t||`{}`)}catch{return JSON.stringify({error:`invalid JSON arguments`})}try{switch(e){case`memory_search`:{let e=await O(`/search`,{query:r.query,cwd:n});return JSON.stringify(e)}case`memory_read`:{let e=await O(`/tracks`,{target:r.target,cwd:n});return JSON.stringify(e)}case`memory_suggest`:{let e=await O(`/suggest`,{target:r.target,content:r.content,reason:r.reason,cwd:n});return JSON.stringify(e)}case`memory_append`:{let e=await O(`/append`,{target:r.target,content:r.content,cwd:n});return JSON.stringify(e)}case`memory_create_entities`:case`memory_add_observations`:{let e=Array.isArray(r.entities)?r.entities:[],t=Array.isArray(r.observations)?r.observations:[],i=[];for(let t of e){let e=t,n=(e.observations??[]).join(`;`);i.push(n?`${e.name}: ${n}`:String(e.name??``))}for(let e of t){let t=e;i.push(`${t.entityName}: ${(t.contents??[]).join(`;`)}`)}let a=i.filter(Boolean).join(`
7
- `);if(!a)return JSON.stringify({error:`empty`});let o=await O(`/suggest`,{target:`memory`,content:a,reason:`兼容旧工具调用`,cwd:n});return JSON.stringify(o)}case`memory_create_relations`:return JSON.stringify({ok:!0,skipped:!0,note:`五轨模式不使用关系图`});case`memory_open_nodes`:{let e=await O(`/search`,{query:Array.isArray(r.names)?r.names.join(` `):``,cwd:n});return JSON.stringify(e)}default:return JSON.stringify({error:`unknown tool: ${e}`})}}catch(e){return JSON.stringify({error:e instanceof Error?e.message:String(e)})}}async function J(e){}var Y=l(),X={tasks:`侧栏「任务管理」按状态列出任务;工作台可直接增删改`,todos:`侧栏「待办事项」按状态 / 紧急程度分组;工作台可直接增删改`,projects:`侧栏「项目列表」管理项目并汇总迭代 / 需求 / 缺陷;工作台可直接增删改`,iterations:`侧栏「迭代管理」按项目维护迭代周期、进度与逾期;工作台可直接增删改`,pmRequirements:`侧栏「需求管理」维护需求编号 / 优先级 / 状态与验收标准;工作台可直接增删改`,bugs:`侧栏「缺陷管理」记录严重程度 / 重现步骤与修复状态;工作台可直接增删改`,testStats:`侧栏「测试统计」按维度记录每天的统计数量`,caseExec:`侧栏「用例执行统计」按项目记录用例执行情况`,dashboard:`侧栏「仪表盘」聚合待办 / 任务 / 测试统计;卡片可拖动排序、拖角改宽高,右上角编辑组件`},Z={tasks:h,todos:g,projects:m,iterations:m,pmRequirements:m,bugs:m,testStats:S,caseExec:c,dashboard:g},ee=[{id:`all`,label:`全部`},{id:`on`,label:`已启用`},{id:`off`,label:`未启用`}],Q=o();function te({embedded:e=!1}){let[t,o]=(0,C.useState)(()=>r()),[c,l]=(0,C.useState)(null),[u,m]=(0,C.useState)(null),[h,g]=(0,C.useState)(null),[S,w]=(0,C.useState)(!0),[T,E]=(0,C.useState)(``),[D,O]=(0,C.useState)(`all`),[k,j]=(0,C.useState)(null),[M,N]=(0,C.useState)({});async function P(){w(!0);try{let[e,t,n,r,i,a,o,s,c,u,d]=await Promise.all([A(),f(),Z.tasks(),Z.todos(),Z.projects(),Z.iterations(),Z.pmRequirements(),Z.bugs(),Z.testStats(),Z.caseExec(),Z.dashboard()]);l(e),m(t),g({tasks:n,todos:r,projects:i,iterations:a,pmRequirements:o,bugs:s,testStats:c,caseExec:u,dashboard:d})}finally{w(!1)}}(0,C.useEffect)(()=>{let e=a(e=>o(e));return n().then(()=>{o(r()),P()}),()=>{e()}},[]);function F(e){if(e===`cases`)return{available:!0,detail:`侧栏「用例管理」浏览与维护本空间用例库`};if(e===`caseGen`)return t.cases?{available:!0,detail:`对话输入 / 打开配置面板,生成用例并写入用例库`}:{available:!1,detail:`需先启用「用例管理」,生成结果才能写入用例列表`};if(e===`prompts`)return{available:!0,detail:`侧栏「提示词管理」浏览与维护本空间提示词库`};if(e===`promptGen`)return t.prompts?{available:!0,detail:`对话输入 / 打开配置面板,生成提示词并写入提示词库`}:{available:!1,detail:`需先启用「提示词管理」,生成结果才能写入提示词列表`};if(e===`knowledgeLib`)return{available:!0,detail:`侧栏「知识库管理」浏览与维护本空间知识库`};if(e===`requirements`)return{available:!0,detail:`侧栏「需求文档库」浏览与维护本空间需求文档`};if(e===`templates`)return{available:!0,detail:`侧栏「测试模板库」浏览与维护本空间用例模板`};if(e===`reports`)return{available:!0,detail:`侧栏「工作汇报」按日报 / 周报 / 月报列出汇报文件`};if(e===`tasks`||e===`todos`||e===`projects`||e===`iterations`||e===`pmRequirements`||e===`bugs`||e===`testStats`||e===`caseExec`||e===`dashboard`){let t=h?.[e];return t===void 0?{available:S?null:!1,detail:S?`探测中…`:`需本地服务`}:t?{available:!0,detail:X[e]}:{available:!1,detail:`需本地服务(npm run dev / lantern web)`}}return e===`knowledgeGen`?t.knowledgeLib?{available:!0,detail:`对话输入 / 打开配置面板,生成文档并写入知识库`}:{available:!1,detail:`需先启用「知识库管理」,生成结果才能写入知识库列表`}:e===`memory`?S&&c===null?{available:null,detail:`探测中…`}:c?.ok?{available:!0,detail:`已连接 · ${c.entryCount??c.entityCount??0} 条记忆 / 待确认 ${c.suggestionCount??0}`}:{available:!1,detail:`本地记忆服务未就绪`}:e===`knowledge`?{available:!0,detail:`对话输入 @ 可引用知识库与模板文档`}:e===`pluginDev`?S&&u===null?{available:null,detail:`探测中…`}:u?.ok?{available:!0,detail:`固定提示词开发扩展插件;先评估确认,再改代码并入「扩展插件」`}:{available:!1,detail:`需本地文件服务:开发要读写项目源码`}:{available:!1,detail:`未知`}}function I(e){let n=i(e,!t[e]),r=!!n[e],a=s.find(t=>t.id===e)?.name??e;o(n),d(r?`已启用「${a}」`:`已停用「${a}」`,`success`),e===`reports`&&_(!!n.reports).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`工作汇报提示词没生成成功:${t}`,`error`)}),e===`uiAuto`&&v(!!n.uiAuto).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`UI自动化测试提示词没生成成功:${t}`,`error`)}),e===`reqAnalysis`&&y(!!n.reqAnalysis).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`需求分析提示词没生成成功:${t}`,`error`)}),e===`storyReview`&&x(!!n.storyReview).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`用户故事审查提示词没生成成功:${t}`,`error`)}),e===`testPoints`&&b(!!n.testPoints).catch(e=>{let t=e instanceof Error?e.message:String(e);d(`测试点生成提示词没生成成功:${t}`,`error`)}),(e===`projects`||e===`iterations`||e===`pmRequirements`||e===`bugs`)&&n[e]&&p().catch(e=>{console.warn(`[pm] 同步项目管理数据目录失败`,e)})}let L=(0,C.useMemo)(()=>s.filter(e=>t[e.id]).length,[t]),R=T.trim().toLowerCase(),z=(0,C.useMemo)(()=>Q.map(e=>({...e,items:e.items.filter(e=>{let n=!R||e.name.toLowerCase().includes(R)||e.id.toLowerCase().includes(R)||e.description.toLowerCase().includes(R),r=D===`all`||(D===`on`?t[e.id]:!t[e.id]);return n&&r})})).filter(e=>e.items.length>0),[t,R,D]);return(0,Y.jsx)(`div`,{className:`tw-plugins-page overflow-y-auto ${e?`h-full min-h-0 flex-1`:`min-h-screen`}`,children:(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-[1080px] ${e?`px-6 py-5`:`px-6 py-7`}`,children:[(0,Y.jsxs)(`header`,{className:`tw-plugins-head`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-[20px] font-semibold tracking-tight text-stone-900`,children:`我的插件`}),(0,Y.jsxs)(`p`,{className:`mt-1.5 text-[13px] leading-6 text-stone-500`,children:[`按用途分组的扩展能力,开关保存在本机;会话 / 全局内置能力在`,(0,Y.jsx)(`span`,{className:`mx-1 rounded bg-stone-100 px-1 py-0.5 text-[12px] text-stone-600`,children:`设置 → 内置插件`}),`里查看。`]})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-stats`,"aria-label":`插件概览`,children:[(0,Y.jsxs)(`div`,{className:`tw-plugins-stat`,children:[(0,Y.jsx)(`span`,{className:`tw-plugins-stat-num`,children:s.length}),(0,Y.jsx)(`span`,{className:`tw-plugins-stat-label`,children:`个插件`})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-stat`,children:[(0,Y.jsx)(`span`,{className:`tw-plugins-stat-num is-on`,children:L}),(0,Y.jsx)(`span`,{className:`tw-plugins-stat-label`,children:`已启用`})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-stat`,children:[(0,Y.jsx)(`span`,{className:`tw-plugins-stat-num`,children:Q.length}),(0,Y.jsx)(`span`,{className:`tw-plugins-stat-label`,children:`个分类`})]})]})]}),(0,Y.jsxs)(`div`,{className:`tw-plugins-toolbar`,children:[(0,Y.jsxs)(`label`,{className:`relative block w-full max-w-72`,children:[(0,Y.jsxs)(`svg`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-stone-400`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:[(0,Y.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,Y.jsx)(`path`,{d:`m20 20-3.5-3.5`})]}),(0,Y.jsx)(`input`,{value:T,onChange:e=>E(e.target.value),placeholder:`搜索插件名 / 作用`,className:`h-9 w-full rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-[13px] text-stone-800 outline-none transition-colors placeholder:text-stone-400 focus:border-[#4176e6]`})]}),(0,Y.jsx)(`div`,{className:`tw-plugins-pills`,role:`group`,"aria-label":`按状态筛选`,children:ee.map(e=>(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":D===e.id,onClick:()=>O(e.id),children:e.label},e.id))})]}),(0,Y.jsxs)(`div`,{className:`mt-4 space-y-6`,children:[z.map(e=>{let n=!!M[e.category],r=e.items.filter(e=>t[e.id]).length;return(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":!n,onClick:()=>N(t=>({...t,[e.category]:!n})),className:`mb-2.5 flex w-full items-center gap-2 text-left`,children:[(0,Y.jsx)($,{className:`h-3.5 w-3.5 shrink-0 text-stone-400 transition-transform ${n?`-rotate-90`:``}`}),(0,Y.jsx)(`span`,{className:`text-[13px] font-semibold text-stone-800`,children:e.category}),(0,Y.jsxs)(`span`,{className:`rounded-full bg-stone-100 px-1.5 py-0.5 text-[11px] tabular-nums text-stone-500`,children:[r,`/`,e.items.length]}),(0,Y.jsx)(`span`,{className:`ml-1 h-px flex-1 bg-stone-200/70`,"aria-hidden":`true`})]}),n?null:(0,Y.jsx)(`ul`,{className:`tw-anim-list tw-plugin-grid`,children:e.items.map(e=>{let n=t[e.id],r=F(e.id),i=k===`ext:${e.id}`;return(0,Y.jsx)(`li`,{className:`relative z-0 min-w-0 overflow-visible hover:z-40 focus-within:z-40${i?` z-40`:``}`,children:(0,Y.jsx)(ne,{open:i,onToggleOpen:()=>j(i?null:`ext:${e.id}`),title:e.name,subtitle:e.description,badge:(0,Y.jsxs)(`span`,{className:`rounded border border-stone-200 px-1.5 py-0.5 text-[11px] tabular-nums text-stone-400`,children:[`v`,e.version]}),trailing:e.alwaysOn?(0,Y.jsx)(`span`,{className:`rounded border border-stone-200 px-1.5 py-0.5 text-[11px] text-stone-500`,children:`内置`}):(0,Y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n,"aria-label":`${n?`关闭`:`打开`} ${e.name}`,onClick:()=>I(e.id),className:`tw-toggle`,children:(0,Y.jsx)(`span`,{className:`tw-toggle-knob`})}),fullName:`@lh-plugins/${e.id}`,configLabel:e.alwaysOn?`内置常开`:n?`已启用`:`未启用`,runLabel:n&&r.available===!0?`运行中`:`已停用`,extra:r.detail})},e.id)})})]},e.category)}),z.length?null:(0,Y.jsxs)(`div`,{className:`rounded-xl border border-dashed border-stone-200 bg-white/60 px-4 py-12 text-center`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-stone-600`,children:`没有匹配的插件`}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-stone-400`,children:`换个关键词,或把状态筛选切回「全部」。`})]})]})]})})}function ne(e){let{open:t,onToggleOpen:n,title:r,subtitle:i,badge:a,trailing:o,fullName:s,configLabel:c,runLabel:l,extra:d}=e;return(0,Y.jsxs)(`div`,{className:`tw-plugin-card group/card relative z-0 self-start w-full overflow-visible rounded-xl border bg-white transition-colors hover:z-40 focus-within:z-40 ${t?`z-40 border-[#4176e6]/50 shadow-sm`:`border-stone-200 hover:border-stone-300`}`,children:[(0,Y.jsxs)(`div`,{className:`relative flex h-17 items-start gap-3 overflow-visible px-4 py-3`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:n,className:`relative h-full min-w-0 flex-1 overflow-visible text-left outline-none focus:outline-none`,"aria-expanded":t,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`min-w-0 truncate text-[14px] font-medium text-stone-900`,children:r}),a,(0,Y.jsx)($,{className:`h-3.5 w-3.5 shrink-0 text-stone-400 transition-transform duration-300 ease-out ${t?`rotate-180`:``}`})]}),(0,Y.jsx)(u,{text:i,className:`mt-1 block min-w-0 truncate text-[13px] leading-5 text-stone-500`,disabled:t})]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 self-start pt-0.5`,children:o})]}),(0,Y.jsx)(`div`,{className:`tw-collapse ${t?`is-open`:``}`,"aria-hidden":!t,children:(0,Y.jsx)(`div`,{className:`tw-collapse-inner`,children:(0,Y.jsx)(`div`,{className:`border-t border-stone-100 px-4 pb-3 pt-0`,children:(0,Y.jsxs)(`dl`,{className:`mt-2.5 space-y-1.5 text-[13px]`,children:[(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`完整名称`}),(0,Y.jsx)(`dd`,{className:`min-w-0 break-all font-mono text-[12px] text-stone-700`,children:s})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`配置状态`}),(0,Y.jsx)(`dd`,{className:`text-stone-700`,children:c})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`运行状态`}),(0,Y.jsx)(`dd`,{className:l===`运行中`?`text-emerald-600`:`text-stone-500`,children:l})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`简介`}),(0,Y.jsx)(`dd`,{className:`text-[12px] leading-5 text-stone-500`,children:i})]}),d?(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-18 shrink-0 text-stone-400`,children:`说明`}),(0,Y.jsx)(`dd`,{className:`text-[12px] leading-5 text-stone-500`,children:d})]}):null]})})})})]})}function $({className:e}){return(0,Y.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,className:e,"aria-hidden":!0,children:(0,Y.jsx)(`path`,{d:`m6 9 6 6 6-6`})})}export{W as _,R as a,M as b,J as c,A as d,P as f,H as g,K as h,I as i,V as l,U as m,E as n,B as o,F as p,D as r,z as s,te as t,j as u,L as v,q as y};
@@ -1 +0,0 @@
1
- export{t as default}from"./PluginsPage.B56V66Kk.js";
@@ -1 +0,0 @@
1
- import{s as e,t}from"./react.Blvh0GOs.js";import{s as n}from"./plugins.CCqu2gnf.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";import{t as i}from"./ConfirmDialog.CsMwWevK.js";import{n as a,t as ee}from"./DocsPager.C6R2nQ60.js";import{t as o}from"./SelectDropdown.DqKxIust.js";import{showToast as s}from"./Toast.BO2NFckG.js";import{A as c,C as l,E as u,I as d,L as f,d as p,f as m,g as h,h as g,k as _,l as v,m as y,u as b}from"./pm.CagBA-ht.js";import{C as x,D as S,E as te,O as ne,S as re,T as ie,_ as C,a as ae,c as oe,d as se,f as w,g as ce,h as T,k as le,l as ue,m as E,p as de,s as D,u as fe,w as O,y as k}from"./PmShared.BwVlCk92.js";var A=e(t(),1),j=r();function pe({value:e,onChange:t,entity:n,recordId:r=``,seenUrls:i,onError:a,onPersisted:ee}){let o=c(e),[s,l]=(0,A.useState)(!1),[p,m]=(0,A.useState)(!1),[h,g]=(0,A.useState)(null),v=(0,A.useRef)(null);(0,A.useEffect)(()=>{for(let t of c(e))i.current.add(t.url)},[e,i]);let b=(0,A.useCallback)(async n=>{if(n&&n.length){l(!0);try{let r=await f(Array.from(n));t(_([...c(e),...r])),a(``)}catch(e){a(e instanceof Error?e.message:String(e))}finally{l(!1),v.current&&(v.current.value=``)}}},[t,a,e]);(0,A.useEffect)(()=>{let e=e=>{let t=Array.from(e.clipboardData?.files??[]);t.length&&(e.preventDefault(),b(t))};return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[b]);async function x(e){let i=_(o.filter(t=>t.url!==e));if(r)try{await d(n,r,{attachment:i}),ee?.()}catch(e){a(e instanceof Error?e.message:String(e));return}t(i),y([e],r)}return(0,j.jsxs)(`div`,{className:`space-y-2 rounded-lg transition-colors ${p?`bg-[#3370ff]/5 ring-1 ring-[#3370ff]/40`:``}`,onDragOver:e=>{e.preventDefault(),m(!0)},onDragLeave:()=>m(!1),onDrop:e=>{e.preventDefault(),m(!1),b(e.dataTransfer?.files??null)},children:[o.length?(0,j.jsx)(`ul`,{className:`space-y-1.5`,children:o.map(e=>(0,j.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-stone-200 px-2 py-1.5`,children:[u(e.url)?(0,j.jsx)(`button`,{type:`button`,onClick:()=>g(e),"aria-label":`预览附件 ${e.name}`,className:`shrink-0 cursor-zoom-in`,children:(0,j.jsx)(`img`,{src:e.url,alt:e.name,className:`h-9 w-9 rounded-md border border-stone-100 object-cover`})}):(0,j.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-stone-100 text-stone-400`,children:(0,j.jsx)(E,{name:`file`,size:15})}),u(e.url)?(0,j.jsx)(`button`,{type:`button`,onClick:()=>g(e),className:`min-w-0 flex-1 truncate text-left text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}):(0,j.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`min-w-0 flex-1 truncate text-sm text-stone-700 hover:text-[#3370ff]`,children:e.name}),(0,j.jsx)(`button`,{type:`button`,"aria-label":`移除附件 ${e.name}`,onClick:()=>void x(e.url),className:`flex h-6 w-6 shrink-0 items-center justify-center rounded text-stone-300 hover:bg-red-50 hover:text-red-600`,children:`✕`})]},e.url))}):null,(0,j.jsx)(`input`,{ref:v,type:`file`,multiple:!0,className:`hidden`,onChange:e=>void b(e.target.files)}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,j.jsxs)(`button`,{type:`button`,disabled:s,onClick:()=>v.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-dashed border-stone-300 px-2.5 text-xs text-stone-500 transition-colors hover:border-stone-400 hover:text-stone-700 disabled:opacity-40`,children:[(0,j.jsx)(E,{name:s?`file`:`plus`,size:13}),s?`上传中…`:`上传文件 / 图片`]}),(0,j.jsx)(`span`,{className:`text-xs text-stone-400`,children:`可拖拽到这里,或直接粘贴截图(⌘V / Ctrl+V),支持多张`})]}),(0,j.jsx)(T,{file:h,onClose:()=>g(null)})]})}var me=20,he=`tw.pm-requirements.page-size.v1`,ge=[`all`,...p],_e=[`all`,...v],ve=`pm.requirements.project`,ye=`pm.requirements.iteration`,be=`pm.requirements.status`,xe=`pm.requirements.priority`,Se=`pm.requirements.keyword`,M=v.map(e=>({value:e,label:b[e]})),N=p.map(e=>({value:e,label:m[e]}));function Ce(e=``){return{projectId:e,iterationId:``,title:``,priority:`medium`,status:`pending`,description:``,acceptanceCriteria:[],githubIssue:``,attachment:``}}function P({scopeProjectId:e=``}={}){let t=!!e,r=ne(`pmRequirements`),{store:u,live:f,loading:p,error:_,setError:v,reload:T}=le(),[P,F]=S(ve,`all`),I=e||P,[L,R]=S(ye,`all`),[z,we]=te(be,ge,`all`),[B,Te]=te(xe,_e,`all`),[V,Ee]=S(Se),[De,H]=(0,A.useState)(1),[U,Oe]=a(me,he),[W,G]=(0,A.useState)(null),[K,q]=(0,A.useState)(!1),[J,Y]=(0,A.useState)(null),X=(0,A.useRef)(new Set),ke=(0,A.useMemo)(()=>[{value:`all`,label:`全部项目`},...u.projects.map(e=>({value:e.id,label:e.name}))],[u.projects]),Ae=(0,A.useMemo)(()=>[{value:`all`,label:`全部迭代`},...u.iterations.filter(e=>I===`all`||e.projectId===I).map(e=>({value:e.id,label:e.name}))],[u.iterations,I]),je=(0,A.useMemo)(()=>{let e=new Map(u.projects.map(e=>[e.id,e.name]));return t=>e.get(t)??`—`},[u.projects]),Me=(0,A.useMemo)(()=>{let e=new Map(u.iterations.map(e=>[e.id,e.name]));return t=>t?e.get(t)??`—`:`—`},[u.iterations]),Z=(0,A.useMemo)(()=>l(u.requirements,{projectId:I,iterationId:L,status:z,priority:B,keyword:V}),[u.requirements,I,L,z,B,V]),Q=t?u.requirements.filter(e=>e.projectId===I).length:u.requirements.length,Ne=Math.max(1,Math.ceil(Z.length/U)),$=Math.min(De,Ne),Pe=Z.slice(($-1)*U,$*U);(0,A.useEffect)(()=>{t||f===!0&&P!==`all`&&!u.projects.some(e=>e.id===P)&&F(`all`)},[f,u.projects,P,F,t]),(0,A.useEffect)(()=>{f===!0&&L!==`all`&&!u.iterations.some(e=>e.id===L&&(I===`all`||e.projectId===I))&&R(`all`)},[f,u.iterations,I,L,R]);let Fe=W?u.iterations.filter(e=>e.projectId===W.projectId):[];async function Ie(){if(!W)return;if(!W.projectId){v(`请先选择所属项目`);return}let e=W.title.trim();if(!e)v(`需求描述不能为空`);else{q(!0);try{let t={projectId:W.projectId,iterationId:W.iterationId,title:e,priority:W.priority,status:W.status,description:W.description,acceptanceCriteria:W.acceptanceCriteria.filter(e=>e.text.trim()),githubIssue:W.githubIssue,attachment:W.attachment};W.id?await d(`requirements`,W.id,t):await g(`requirements`,[t]);let n=!!W.id;G(null),X.current.clear(),v(``),await T(!0),s(n?`已保存需求`:`已新建需求`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);v(t),s(`保存需求失败:${t}`,`error`)}finally{q(!1)}}}function Le(){let e=[...X.current,...c(W?.attachment??``).map(e=>e.url)];X.current.clear(),G(null),e.length&&y(e)}async function Re(e,t){q(!0);try{await d(`requirements`,e.id,{status:t}),await T(!0),s(`已更新需求状态为「${t}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);v(t),s(`更新状态失败:${t}`,`error`)}finally{q(!1)}}async function ze(){let e=J;if(e){Y(null),q(!0);try{await h(`requirements`,[e.id]),await T(!0),s(`已删除需求`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);v(t),s(`删除需求失败:${t}`,`error`)}finally{q(!1)}}}if(!r.ready)return(0,j.jsx)(ce,{label:`正在读取插件开关`});if(!r.on)return(0,j.jsx)(C,{children:n(`pmRequirements`)});if(f===null)return(0,j.jsx)(ce,{label:`正在连接项目管理服务`});if(!f)return(0,j.jsx)(C,{children:`需求管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`});if(u.projects.length===0&&!p&&!t)return(0,j.jsx)(C,{children:`还没有项目。请先在「项目列表」里新建一个项目,再回来维护需求。`});let Be=[{value:`all`,label:`全部`},...N];return(0,j.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,j.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,j.jsxs)(`div`,{className:`text-xs text-stone-400`,children:[`共 `,(0,j.jsx)(`span`,{className:`font-medium text-stone-600`,children:Q}),` 条需求`,Z.length===Q?``:` · 筛选出 ${Z.length} 条`]}),(0,j.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[t?null:(0,j.jsx)(o,{flat:!0,showCheck:!1,ariaLabel:`按项目筛选需求`,className:`w-36`,options:ke,value:P,onChange:e=>{F(e),R(`all`),H(1)}}),(0,j.jsx)(o,{flat:!0,showCheck:!1,ariaLabel:`按迭代筛选需求`,className:`w-32`,options:Ae,value:L,onChange:e=>{R(e),H(1)}}),(0,j.jsx)(o,{flat:!0,showCheck:!1,ariaLabel:`按优先级筛选需求`,className:`w-28`,options:[{value:`all`,label:`全部优先级`},...M],value:B,onChange:e=>{Te(e),H(1)}}),(0,j.jsxs)(`label`,{className:`relative block`,children:[(0,j.jsx)(E,{name:`search`,size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-stone-400`}),(0,j.jsx)(`input`,{value:V,onChange:e=>{Ee(e.target.value),H(1)},placeholder:`搜索编号 / 名称…`,className:`h-9 w-44 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,j.jsxs)(`button`,{type:`button`,disabled:K,onClick:()=>G(Ce(I===`all`?``:I)),className:`inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:[(0,j.jsx)(E,{name:`plus`,size:14}),`新建需求`]})]})]}),(0,j.jsx)(`div`,{className:`mt-3 flex shrink-0 flex-wrap items-center gap-2`,children:(0,j.jsx)(de,{ariaLabel:`按状态筛选需求`,options:Be,value:z,onChange:e=>{we(e),H(1)}})}),_?(0,j.jsx)(se,{message:_,onClose:()=>v(``)}):null,(0,j.jsxs)(`div`,{className:`mt-3 flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,j.jsxs)(`table`,{className:`tw-data-table w-full border-collapse text-sm`,children:[(0,j.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-xs text-stone-500`,children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{className:`w-24 px-4 py-2.5 text-left font-medium whitespace-nowrap`,children:`ID`}),(0,j.jsx)(`th`,{className:`px-4 py-2.5 text-left font-medium`,children:`需求描述`}),(0,j.jsx)(`th`,{className:`w-24 px-3 py-2.5 text-left font-medium whitespace-nowrap`,children:`优先级`}),(0,j.jsx)(`th`,{className:`w-32 px-3 py-2.5 text-left font-medium whitespace-nowrap`,children:`需求状态`}),t?null:(0,j.jsx)(`th`,{className:`w-40 px-3 py-2.5 text-left font-medium whitespace-nowrap`,children:`所属项目`}),(0,j.jsx)(`th`,{className:`w-40 px-3 py-2.5 text-left font-medium whitespace-nowrap`,children:`所属迭代`}),(0,j.jsx)(`th`,{className:`w-24 px-3 py-2.5 text-center font-medium whitespace-nowrap`,children:`操作`})]})}),(0,j.jsxs)(`tbody`,{children:[p&&!u.requirements.length?(0,j.jsx)(`tr`,{children:(0,j.jsx)(`td`,{colSpan:t?6:7,className:`px-4 py-16 text-center`,children:(0,j.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):Pe.length===0?(0,j.jsx)(`tr`,{children:(0,j.jsx)(`td`,{colSpan:t?6:7,children:Q?(0,j.jsx)(ue,{children:`没有符合筛选条件的需求。`}):(0,j.jsx)(fe,{icon:`file`,title:`暂无需求`,hint:`拆出第一条需求,再关联迭代、补充描述。`,action:(0,j.jsxs)(`button`,{type:`button`,onClick:()=>G(Ce(I===`all`?``:I)),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-stone-200 px-3 text-xs text-stone-600 transition-colors hover:bg-stone-50`,children:[(0,j.jsx)(E,{name:`plus`,size:13}),`新建需求`]})})})}):null,Pe.map(e=>(0,j.jsxs)(`tr`,{className:`border-t border-stone-100 hover:bg-[#f7f8fa]`,children:[(0,j.jsx)(`td`,{className:`px-4 py-2.5 font-mono text-xs text-stone-400`,children:e.autoId}),(0,j.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,j.jsx)(`button`,{type:`button`,onClick:()=>G({id:e.id,projectId:e.projectId,iterationId:e.iterationId,title:e.title,priority:e.priority,status:e.status,description:e.description,acceptanceCriteria:e.acceptanceCriteria.map(e=>({...e})),githubIssue:e.githubIssue,attachment:e.attachment}),className:`max-w-full truncate text-left text-stone-800 hover:text-[#3370ff]`,children:e.title})}),(0,j.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,j.jsx)(re,{tone:x[e.priority],children:b[e.priority]})}),(0,j.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,j.jsx)(o,{unstyled:!0,ariaLabel:`修改 ${e.title} 的状态`,disabled:K,options:N,value:e.status,onChange:t=>void Re(e,t),renderOptionPrefix:e=>(0,j.jsx)(D,{tone:O[e.value]}),renderTrigger:()=>(0,j.jsx)(re,{tone:O[e.status],children:m[e.status]})})}),t?null:(0,j.jsx)(`td`,{className:`truncate px-3 py-2.5 text-sm text-stone-600`,children:(0,j.jsx)(`a`,{href:ie(e.projectId),className:`transition-colors hover:text-[#3370ff]`,children:je(e.projectId)})}),(0,j.jsx)(`td`,{className:`truncate px-3 py-2.5 text-sm text-stone-500`,children:Me(e.iterationId)}),(0,j.jsx)(`td`,{className:`px-3 py-2.5 text-center`,children:(0,j.jsx)(`button`,{type:`button`,"aria-label":`删除 ${e.title}`,disabled:K,onClick:()=>Y(e),className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-stone-300 transition-colors hover:bg-red-50 hover:text-red-600 disabled:opacity-40`,children:(0,j.jsx)(E,{name:`trash`,size:15})})})]},e.id))]})]})}),Z.length>0?(0,j.jsx)(ee,{page:$,totalPages:Ne,pageSize:U,busy:K,onPage:H,onPageSize:e=>{Oe(e),H(1)}}):null]}),(0,j.jsx)(oe,{open:W!==null,title:W?.id?`编辑需求`:`新建需求`,busy:K,submitLabel:W?.id?`保存`:`创建`,onClose:()=>Le(),onSubmit:()=>void Ie(),children:W?(0,j.jsxs)(`div`,{className:`space-y-1`,children:[t?null:(0,j.jsx)(w,{label:`所属项目`,required:!0,children:(0,j.jsx)(k,{ariaLabel:`所属项目`,options:u.projects.map(e=>({value:e.id,label:e.name})),value:W.projectId,onChange:e=>{let t=u.iterations.some(t=>t.id===W.iterationId&&t.projectId===e);G({...W,projectId:e,iterationId:t?W.iterationId:``})}})}),(0,j.jsx)(w,{label:`所属迭代`,children:(0,j.jsx)(k,{ariaLabel:`所属迭代`,options:[{value:``,label:`不关联迭代`},...Fe.map(e=>({value:e.id,label:e.name}))],value:W.iterationId,onChange:e=>G({...W,iterationId:e}),disabled:Fe.length===0})}),(0,j.jsx)(w,{label:`需求描述`,required:!0,children:(0,j.jsx)(`textarea`,{autoFocus:!0,value:W.title,onChange:e=>G({...W,title:e.target.value}),placeholder:`一句话写清要做什么`,rows:3,className:ae})}),(0,j.jsx)(w,{label:`优先级`,children:(0,j.jsx)(k,{ariaLabel:`优先级`,options:M,value:W.priority,onChange:e=>G({...W,priority:e}),renderOptionPrefix:e=>(0,j.jsx)(D,{tone:x[e.value]})})}),(0,j.jsx)(w,{label:`需求状态`,children:(0,j.jsx)(k,{ariaLabel:`需求状态`,options:N,value:W.status,onChange:e=>G({...W,status:e}),renderOptionPrefix:e=>(0,j.jsx)(D,{tone:O[e.value]})})}),(0,j.jsx)(w,{label:`附件`,children:(0,j.jsx)(pe,{value:W.attachment,onChange:e=>G(t=>t&&{...t,attachment:e}),entity:`requirements`,recordId:W.id??``,seenUrls:X,onError:v,onPersisted:()=>void T(!0)})}),(0,j.jsx)(w,{label:`备注`,children:(0,j.jsx)(`textarea`,{value:W.description,onChange:e=>G({...W,description:e.target.value}),placeholder:`补充背景、目标与范围(可选)`,rows:4,className:ae})})]}):null}),(0,j.jsx)(i,{open:J!==null,title:`删除需求`,message:`确定删除「${J?.title??``}」?关联的缺陷会保留,但不再关联到这条需求。`,confirmLabel:`删除`,danger:`solid`,onClose:()=>Y(null),onConfirm:()=>void ze()})]})}export{P as t};
@@ -1 +0,0 @@
1
- export{t as default}from"./PmRequirementsBoard.CB33kbaD.js";
@@ -1,58 +0,0 @@
1
- import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,n as r,r as i,t as a}from"./dialog.DZHZCe_T.js";import{t as o}from"./jsx-runtime.DUg_B_vD.js";import{t as s}from"./OverflowHint.DI-tZ2fv.js";function c(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var l=c();function u(e){l=e}var d={exec:()=>null};function f(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(p.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var p={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`)},ee=/^(?:[ \t]*(?:\n|$))+/,te=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,m=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,h=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ne=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,g=/(?:[*+-]|\d{1,9}[.)])/,_=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,v=f(_).replace(/bull/g,g).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),re=f(_).replace(/bull/g,g).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),y=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ie=/^[^\n]+/,ae=/(?!\s*\])(?:\\.|[^\[\]\\])+/,oe=f(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,ae).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),b=f(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,g).getRegex(),x=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,se=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ce=f(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,se).replace(`tag`,x).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),le=f(y).replace(`hr`,h).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,x).getRegex(),ue={blockquote:f(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,le).getRegex(),code:te,def:oe,fences:m,heading:ne,hr:h,html:ce,lheading:v,list:b,newline:ee,paragraph:le,table:d,text:ie},de=f(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,h).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,x).getRegex(),fe={...ue,lheading:re,table:de,paragraph:f(y).replace(`hr`,h).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,de).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,x).getRegex()},pe={...ue,html:f(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,se).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:d,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:f(y).replace(`hr`,h).replace(`heading`,` *#{1,6} *[^
2
- ]`).replace(`lheading`,v).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},me=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,he=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ge=/^( {2,}|\\)\n(?!\s*$)/,_e=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ve=/[\p{P}\p{S}]/u,ye=/[\s\p{P}\p{S}]/u,S=/[^\s\p{P}\p{S}]/u,be=f(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,ye).getRegex(),xe=/(?!~)[\p{P}\p{S}]/u,Se=/(?!~)[\s\p{P}\p{S}]/u,Ce=/(?:[^\s\p{P}\p{S}]|~)/u,we=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Te=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Ee=f(Te,`u`).replace(/punct/g,ve).getRegex(),De=f(Te,`u`).replace(/punct/g,xe).getRegex(),Oe=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,C=f(Oe,`gu`).replace(/notPunctSpace/g,S).replace(/punctSpace/g,ye).replace(/punct/g,ve).getRegex(),ke=f(Oe,`gu`).replace(/notPunctSpace/g,Ce).replace(/punctSpace/g,Se).replace(/punct/g,xe).getRegex(),w=f(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,S).replace(/punctSpace/g,ye).replace(/punct/g,ve).getRegex(),Ae=f(/\\(punct)/,`gu`).replace(/punct/g,ve).getRegex(),T=f(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),je=f(se).replace(`(?:-->|$)`,`-->`).getRegex(),Me=f(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,je).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),E=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Ne=f(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace(`label`,E).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Pe=f(/^!?\[(label)\]\[(ref)\]/).replace(`label`,E).replace(`ref`,ae).getRegex(),Fe=f(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,ae).getRegex(),Ie={_backpedal:d,anyPunctuation:Ae,autolink:T,blockSkip:we,br:ge,code:he,del:d,emStrongLDelim:Ee,emStrongRDelimAst:C,emStrongRDelimUnd:w,escape:me,link:Ne,nolink:Fe,punctuation:be,reflink:Pe,reflinkSearch:f(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Pe).replace(`nolink`,Fe).getRegex(),tag:Me,text:_e,url:d},D={...Ie,link:f(/^!?\[(label)\]\((.*?)\)/).replace(`label`,E).getRegex(),reflink:f(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,E).getRegex()},O={...Ie,emStrongRDelimAst:ke,emStrongLDelim:De,url:f(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,`i`).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Le={...O,br:f(ge).replace(`{2,}`,`*`).getRegex(),text:f(O.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Re={normal:ue,gfm:fe,pedantic:pe},k={normal:Ie,gfm:O,breaks:Le,pedantic:D},ze={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Be=e=>ze[e];function A(e,t){if(t){if(p.escapeTest.test(e))return e.replace(p.escapeReplace,Be)}else if(p.escapeTestNoEncode.test(e))return e.replace(p.escapeReplaceNoEncode,Be);return e}function Ve(e){try{e=encodeURI(e).replace(p.percentDecode,`%`)}catch{return null}return e}function He(e,t){let n=e.replace(p.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(p.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(p.slashPipe,`|`);return n}function Ue(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function We(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Ge(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Ke(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
3
- `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
4
- `)}var qe=class{options;rules;lexer;constructor(e){this.options=e||l}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:Ue(e,`
5
- `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Ke(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=Ue(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:Ue(t[0],`
6
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Ue(t[0],`
7
- `).split(`
8
- `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
9
- `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
10
- $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
11
- ${s}`:s,r=r?`${r}
12
- ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
13
- `+e.join(`
14
- `),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
15
- `+e.join(`
16
- `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
17
- `)}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
18
- `,1)[0].replace(this.rules.other.listReplaceTabs,e=>` `.repeat(3*e.length)),l=e.split(`
19
- `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
20
- `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d);for(;e;){let f=e.split(`
21
- `,1)[0],p;if(l=f,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),p=l):p=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||t.test(l)||n.test(l))break;if(p.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
22
- `+p.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
23
- `+l}!u&&!l.trim()&&(u=!0),r+=f+`
24
- `,e=e.substring(f.length+1),c=p.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let f=null,p;this.options.gfm&&(f=this.rules.other.listIsTask.exec(s),f&&(p=f[0]!==`[ ] `,s=s.replace(this.rules.other.listReplaceTask,``))),i.items.push({type:`list_item`,raw:r,task:!!f,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=He(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
25
- `):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(He(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
26
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Ue(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=We(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),Ge(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Ge(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(r&&!(r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:`del`,raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},j=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||l,this.options.tokenizer=this.options.tokenizer||new qe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:p,block:Re.normal,inline:k.normal};this.options.pedantic?(t.block=Re.pedantic,t.inline=k.pedantic):this.options.gfm&&(t.block=Re.gfm,t.inline=this.options.breaks?k.breaks:k.gfm),this.tokenizer.rules=t}static get rules(){return{block:Re,inline:k}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(p.carriageReturn,`
27
- `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(p.tabCharGlobal,` `).replace(p.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
28
- `:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=`
29
- `+r.raw,n.text+=`
30
- `+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if((r=this.tokenizer.fences(e))||(r=this.tokenizer.heading(e))||(r=this.tokenizer.hr(e))||(r=this.tokenizer.blockquote(e))||(r=this.tokenizer.list(e))||(r=this.tokenizer.html(e))){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=`
31
- `+r.raw,n.text+=`
32
- `+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});continue}if((r=this.tokenizer.table(e))||(r=this.tokenizer.lheading(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=`
33
- `+r.raw,a.text+=`
34
- `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length)}else if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=`
35
- `+r.raw,n.text+=`
36
- `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r)}else if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,a=``;for(;e;){i||(a=``),i=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if((r=this.tokenizer.escape(e))||(r=this.tokenizer.tag(e))||(r=this.tokenizer.link(e))){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if((r=this.tokenizer.emStrong(e,n,a))||(r=this.tokenizer.codespan(e))||(r=this.tokenizer.br(e))||(r=this.tokenizer.del(e))||(r=this.tokenizer.autolink(e))||!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(o)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(a=r.raw.slice(-1)),i=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r)}else if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return t}},M=class{options;parser;constructor(e){this.options=e||l}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(p.notSpaceStart)?.[0],i=e.replace(p.endingNewline,``)+`
37
- `;return r?`<pre><code class="language-`+A(r)+`">`+(n?i:A(i,!0))+`</code></pre>
38
- `:`<pre><code>`+(n?i:A(i,!0))+`</code></pre>
39
- `}blockquote({tokens:e}){return`<blockquote>
40
- ${this.parser.parse(e)}</blockquote>
41
- `}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
42
- `}hr(e){return`<hr>
43
- `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
44
- `+r+`</`+i+`>
45
- `}listitem(e){let t=``;if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type===`paragraph`?(e.tokens[0].text=n+` `+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type===`text`&&(e.tokens[0].tokens[0].text=n+` `+A(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:`text`,raw:n+` `,text:n+` `,escaped:!0}):t+=n+` `}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
46
- `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox">`}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
47
- `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
48
- <thead>
49
- `+t+`</thead>
50
- `+r+`</table>
51
- `}tablerow({text:e}){return`<tr>
52
- ${e}</tr>
53
- `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
54
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${A(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Ve(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+A(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Ve(e);if(i===null)return A(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${A(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:A(e.text)}},N=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}},P=class e{options;renderer;textRenderer;constructor(e){this.options=e||l,this.options.renderer=this.options.renderer||new M,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new N}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`paragraph`,`text`].includes(e.type)){n+=t||``;continue}}let a=i;switch(a.type){case`space`:n+=this.renderer.space(a);continue;case`hr`:n+=this.renderer.hr(a);continue;case`heading`:n+=this.renderer.heading(a);continue;case`code`:n+=this.renderer.code(a);continue;case`table`:n+=this.renderer.table(a);continue;case`blockquote`:n+=this.renderer.blockquote(a);continue;case`list`:n+=this.renderer.list(a);continue;case`html`:n+=this.renderer.html(a);continue;case`paragraph`:n+=this.renderer.paragraph(a);continue;case`text`:{let i=a,o=this.renderer.text(i);for(;r+1<e.length&&e[r+1].type===`text`;)i=e[++r],o+=`
55
- `+this.renderer.text(i);n+=t?this.renderer.paragraph({type:`paragraph`,raw:o,text:o,tokens:[{type:`text`,raw:o,text:o,escaped:!0}]}):o;continue}default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t=this.renderer){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Je=class{options;block;constructor(e){this.options=e||l}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?j.lex:j.lexInline}provideParser(){return this.block?P.parse:P.parseInline}},Ye=class{defaults=c();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=P;Renderer=M;TextRenderer=N;Lexer=j;Tokenizer=qe;Hooks=Je;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new M(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new qe(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Je;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=Je.passThroughHooks.has(n)?e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then(e=>a.call(t,e));let n=i.call(t,e);return a.call(t,n)}:(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return j.lex(e,t??this.defaults)}parser(e,t){return P.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(t==null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));i.hooks&&(i.hooks.options=i,i.hooks.block=e);let o=i.hooks?i.hooks.provideLexer():e?j.lex:j.lexInline,s=i.hooks?i.hooks.provideParser():e?P.parse:P.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then(e=>o(e,i)).then(e=>i.hooks?i.hooks.processAllTokens(e):e).then(e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then(()=>e):e).then(e=>s(e,i)).then(e=>i.hooks?i.hooks.postprocess(e):e).catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let e=o(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let n=s(e,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
56
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+A(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},F=new Ye;function I(e,t){return F.parse(e,t)}I.options=I.setOptions=function(e){return F.setOptions(e),I.defaults=F.defaults,u(I.defaults),I},I.getDefaults=c,I.defaults=l,I.use=function(...e){return F.use(...e),I.defaults=F.defaults,u(I.defaults),I},I.walkTokens=function(e,t){return F.walkTokens(e,t)},I.parseInline=F.parseInline,I.Parser=P,I.parser=P.parse,I.Renderer=M,I.TextRenderer=N,I.Lexer=j,I.lexer=j.lex,I.Tokenizer=qe,I.Hooks=Je,I.parse=I,I.options,I.setOptions,I.use,I.walkTokens,I.parseInline,P.parse,j.lex;function Xe(e,t){this.v=e,this.k=t}function Ze(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function L(e){if(Array.isArray(e))return e}function Qe(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function $e(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
57
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function et(e,t){return L(e)||Qe(e,t)||tt(e,t)||$e()}function tt(e,t){if(e){if(typeof e==`string`)return Ze(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ze(e,t):void 0}}function nt(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof Xe;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}nt.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},nt.prototype.next=function(e){return this._invoke(`next`,e)},nt.prototype.throw=function(e){return this._invoke(`throw`,e)},nt.prototype.return=function(e){return this._invoke(`return`,e)};var rt=Object.entries,it=Object.setPrototypeOf,at=Object.isFrozen,ot=Object.getPrototypeOf,st=Object.getOwnPropertyDescriptor,R=Object.freeze,z=Object.seal,ct=Object.create,lt=typeof Reflect<`u`&&Reflect,ut=lt.apply,B=lt.construct;R||=function(e){return e},z||=function(e){return e},ut||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},B||=function(e){return new e(...[...arguments].slice(1))};var V=G(Array.prototype.forEach);Array.prototype.indexOf;var dt=G(Array.prototype.lastIndexOf),ft=G(Array.prototype.pop),pt=G(Array.prototype.push),mt=G(Array.prototype.slice),ht=G(Array.prototype.splice),gt=Array.isArray,_t=jt(Set),vt=G(Set.prototype.add),yt=G(Set.prototype.has),bt=G(String.prototype.toLowerCase),xt=G(String.prototype.toString),St=G(String.prototype.match),Ct=G(String.prototype.replace),wt=G(String.prototype.indexOf),Tt=G(String.prototype.trim),Et=G(Number.prototype.toString),Dt=G(Boolean.prototype.toString),Ot=typeof BigInt>`u`?null:G(BigInt.prototype.toString),kt=typeof Symbol>`u`?null:G(Symbol.prototype.toString),H=G(Object.prototype.hasOwnProperty),At=G(Object.prototype.toString),U=G(RegExp.prototype.test),W=jt(TypeError);function G(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return ut(e,t,n)}}function jt(e){return function(){return B(e,[...arguments])}}function K(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:bt;if(it&&it(e,null),!gt(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(at(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Mt(e){for(let t=0;t<e.length;t++)H(e,t)||(e[t]=null);return e}function q(e){let t=ct(null);for(let r of rt(e)){var n=et(r,2);let i=n[0],a=n[1];H(e,i)&&(t[i]=gt(a)?Mt(a):a&&typeof a==`object`&&a.constructor===Object?q(a):a)}return t}function Nt(e){switch(typeof e){case`string`:return e;case`number`:return Et(e);case`boolean`:return Dt(e);case`bigint`:return Ot?Ot(e):`0`;case`symbol`:return kt?kt(e):`Symbol()`;case`undefined`:return At(e);case`function`:case`object`:{if(e===null)return At(e);let t=e,n=J(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:At(e)}return At(e)}default:return At(e)}}function J(e,t){for(;e!==null;){let n=st(e,t);if(n){if(n.get)return G(n.get);if(typeof n.value==`function`)return G(n.value)}e=ot(e)}function n(){return null}return n}function Pt(e,t){for(;e!==null;){let n=st(e,t);if(n)return n.get?G(n.get):null;e=ot(e)}return null}function Ft(e){try{return U(e,``),!0}catch{return!1}}var It=R(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Lt=R(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Rt=R([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),zt=R([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Bt=R(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Vt=R([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Ht=R([`#text`]),Ut=R(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Wt=R(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Gt=R(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Kt=R([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),qt=z(/{{[\w\W]*|^[\w\W]*}}/g),Jt=z(/<%[\w\W]*|^[\w\W]*%>/g),Yt=z(/\${[\w\W]*/g),Xt=z(/^data-[\-\w.\u00B7-\uFFFF]+$/),Zt=z(/^aria-[\-\w]+$/),Qt=z(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),$t=z(/^(?:\w+script|data):/i),en=z(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),tn=z(/^html$/i),nn=z(/^[a-z][.\w]*(-[.\w]+)+$/i),rn=z(/<[/\w!]/g),an=z(/<[/\w]/g),on=z(/<\/no(script|embed|frames)/i),sn=z(/\/>/i),Y={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},cn=R(K({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),ln=function(){return typeof window>`u`?null:window},un=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},dn=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},X=function(e,t,n,r){return H(e,t)&&gt(e[t])?K(r.base?q(r.base):{},e[t],r.transform):n},fn=function(e,t,n){let r=H(e,t)?e[t]:void 0;return r&&typeof r==`object`?q(r):n()};function pn(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ln(),t=e=>pn(e);if(t.version=`3.4.17`,t.removed=[],!e||!e.document||e.document.nodeType!==Y.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=J(d,`cloneNode`),p=J(d,`remove`),ee=J(d,`removeAttributeNode`),te=J(d,`nextSibling`),m=J(d,`childNodes`),h=J(d,`parentNode`),ne=J(d,`shadowRoot`),g=J(d,`attributes`),_=o&&o.prototype?J(o.prototype,`nodeType`):null,v=o&&o.prototype?J(o.prototype,`nodeName`):null,re=o&&o.prototype?J(o.prototype,`ownerDocument`):null,y=function(e){return _?_(e):e.nodeType},ie=function(e){return v?v(e):e.nodeName},ae=Pt(d,`namespaceURI`),oe=function(e){return ae?ae(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let b,x=``,se,ce=!1,le=0,ue=function(){if(le>0)throw W(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},de=function(e){ue(),le++;try{return b.createHTML(e)}finally{le--}},fe=function(e){ue(),le++;try{return b.createScriptURL(e)}finally{le--}},pe=function(){return ce||=(se=un(u,i),!0),se},me=n,he=me.implementation,ge=me.createNodeIterator,_e=me.createDocumentFragment,ve=me.getElementsByTagName,ye=r.importNode,S=dn();t.isSupported=typeof rt==`function`&&typeof h==`function`&&he&&he.createHTMLDocument!==void 0;let be=qt,xe=Jt,Se=Yt,Ce=Xt,we=Zt,Te=$t,Ee=en,De=nn,Oe=Qt,C=null,ke=K({},[...It,...Lt,...Rt,...Bt,...Ht]),w=null,Ae=K({},[...Ut,...Wt,...Gt,...Kt]),T=Object.seal(ct(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),je=null,Me=null,E=Object.seal(ct(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ne=!0,Pe=!0,Fe=!1,Ie=!0,D=!1,O=!0,Le=!1,Re=!1,k=null,ze=null,Be=!1,A=!1,Ve=!1,He=!1,Ue=!0,We=!1,Ge=`user-content-`,Ke=!0,qe=!1,j=null,M={},N=null,P=K({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Je=null,Ye=K({},[`audio`,`video`,`img`,`source`,`image`,`track`]),F=null,I=K({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Xe=`http://www.w3.org/1998/Math/MathML`,Ze=`http://www.w3.org/2000/svg`,L=`http://www.w3.org/1999/xhtml`,Qe=L,$e=!1,et=null,tt=K({},[Xe,Ze,L],xt),nt=R([`mi`,`mo`,`mn`,`ms`,`mtext`]),it=K({},nt),at=R([`annotation-xml`]),ot=K({},at),st=K({},[`title`,`style`,`font`,`a`,`script`]),lt=null,ut=[`application/xhtml+xml`,`text/html`],B=null,Et=null,Dt=n.createElement(`form`),Ot=function(e){return e instanceof RegExp||e instanceof Function},kt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Et&&Et===e)return;(!e||typeof e!=`object`)&&(e={}),e=q(e),lt=ut.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,B=lt===`application/xhtml+xml`?xt:bt,C=X(e,`ALLOWED_TAGS`,ke,{transform:B}),w=X(e,`ALLOWED_ATTR`,Ae,{transform:B}),et=X(e,`ALLOWED_NAMESPACES`,tt,{transform:xt}),F=X(e,`ADD_URI_SAFE_ATTR`,I,{transform:B,base:I}),Je=X(e,`ADD_DATA_URI_TAGS`,Ye,{transform:B,base:Ye}),N=X(e,`FORBID_CONTENTS`,P,{transform:B}),je=X(e,`FORBID_TAGS`,q({}),{transform:B}),Me=X(e,`FORBID_ATTR`,q({}),{transform:B}),M=H(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?q(e.USE_PROFILES):e.USE_PROFILES:!1,Ne=e.ALLOW_ARIA_ATTR!==!1,Pe=e.ALLOW_DATA_ATTR!==!1,Fe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ie=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,D=e.SAFE_FOR_TEMPLATES||!1,O=e.SAFE_FOR_XML!==!1,Le=e.WHOLE_DOCUMENT||!1,A=e.RETURN_DOM||!1,Ve=e.RETURN_DOM_FRAGMENT||!1,He=e.RETURN_TRUSTED_TYPE||!1,Be=e.FORCE_BODY||!1,Ue=e.SANITIZE_DOM!==!1,We=e.SANITIZE_NAMED_PROPS||!1,Ke=e.KEEP_CONTENT!==!1,qe=e.IN_PLACE||!1,Oe=Ft(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Qt,Qe=typeof e.NAMESPACE==`string`?e.NAMESPACE:L,it=fn(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>K({},nt)),ot=fn(e,`HTML_INTEGRATION_POINTS`,()=>K({},at));let t=fn(e,`CUSTOM_ELEMENT_HANDLING`,()=>ct(null));if(T=ct(null),H(t,`tagNameCheck`)&&Ot(t.tagNameCheck)&&(T.tagNameCheck=t.tagNameCheck),H(t,`attributeNameCheck`)&&Ot(t.attributeNameCheck)&&(T.attributeNameCheck=t.attributeNameCheck),H(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(T.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),z(T),D&&(Pe=!1),Ve&&(A=!0),M&&(C=K({},Ht),w=ct(null),M.html===!0&&(K(C,It),K(w,Ut)),M.svg===!0&&(K(C,Lt),K(w,Wt),K(w,Kt)),M.svgFilters===!0&&(K(C,Rt),K(w,Wt),K(w,Kt)),M.mathMl===!0&&(K(C,Bt),K(w,Gt),K(w,Kt))),E.tagCheck=null,E.attributeCheck=null,H(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?E.tagCheck=e.ADD_TAGS:gt(e.ADD_TAGS)&&(C===ke&&(C=q(C)),K(C,e.ADD_TAGS,B))),H(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?E.attributeCheck=e.ADD_ATTR:gt(e.ADD_ATTR)&&(w===Ae&&(w=q(w)),K(w,e.ADD_ATTR,B))),H(e,`ADD_FORBID_CONTENTS`)&&gt(e.ADD_FORBID_CONTENTS)&&(N===P&&(N=q(N)),K(N,e.ADD_FORBID_CONTENTS,B)),Ke&&(C[`#text`]=!0),Le&&K(C,[`html`,`head`,`body`]),C.table&&(K(C,[`tbody`]),delete je.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw W(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw W(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=b;b=e.TRUSTED_TYPES_POLICY;try{x=de(``)}catch(e){throw b=t,e}}else e.TRUSTED_TYPES_POLICY===null?(b=void 0,x=``):(b===void 0&&(b=pe()),b&&typeof x==`string`&&(x=de(``)));R&&R(e),Et=e},At=K({},[...Lt,...Rt,...zt]),G=K({},[...Bt,...Vt]),jt=function(e,t,n){return t.namespaceURI===L?e===`svg`:t.namespaceURI===Xe?e===`svg`&&(n===`annotation-xml`||it[n]):!!At[e]},Mt=function(e,t,n){return t.namespaceURI===L?e===`math`:t.namespaceURI===Ze?e===`math`&&ot[n]:!!G[e]},mn=function(e,t,n){return t.namespaceURI===Ze&&!ot[n]||t.namespaceURI===Xe&&!it[n]?!1:!G[e]&&(st[e]||!At[e])},hn=function(e){let t=oe(e),n=bt(ie(e)),r=h(e),i,a;return r&&y(r)===Y.element?(i={namespaceURI:oe(r)},a=bt(ie(r))):(i={namespaceURI:Qe},a=`template`),et[t]?t===Ze?jt(n,i,a):t===Xe?Mt(n,i,a):t===L?mn(n,i,a):!!(lt===`application/xhtml+xml`&&et[t]):!1},gn=function(e){pt(t.removed,{element:e});try{h(e).removeChild(e)}catch{if(p(e),!h(e))throw W(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},_n=function(e,t,n){try{ee(e,t)}catch{try{e.removeAttribute(n)}catch{}}},Z=function(e){bn(e);let t=m(e);t&&V(mt(t),e=>{try{p(e)}catch{}});let n=y(e)===Y.element?g(e):null;if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&_n(e,r,i)}},Q=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}pt(t.removed,{attribute:r||null,from:n});try{r?ee(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(A||Ve)try{gn(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},vn=function(e){let t=g(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||w[B(i)]||_n(e,r,i)}},yn=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&y(e)===Y.element){let t=ne(e);Fn(t)&&r.push(t)}let i=m(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},bn=function(e){yn(e,e=>{y(e)===Y.element&&vn(e)})},xn=function(e){let t=[];return yn(e,e=>{t.push(e)},!0),t},Sn=function(e,t){let n=_t();V(xn(e),e=>{y(e)===Y.element&&vt(n,e)}),V(t,e=>{y(e)===Y.element&&!yt(n,e)&&vn(e)})},Cn=function(e,n){let r=!1;return V(t.removed,t=>{t.element&&(r||=t.element===e,bn(t.element))}),Sn(e,n),r},wn=function(e,t){let n=j,r=null,i=()=>(r||(r=_t(),V(t,e=>{vt(r,e)})),r);for(let t=0;;t++){let r=xn(e),a=[e],o=!1;if(V(r,e=>{y(e)===Y.documentFragment?pt(a,e):!o&&!yt(n,e)&&(o=yt(i(),e))}),!o)return;if(t>=8)throw W(`the tree kept changing during in-place sanitization; refusing to return it`);V(a,(t,n)=>{Tn(t,n>0,e,i())})}},Tn=function(e,t,n,r){let i=An(e),a;for(;a=i.nextNode();)yt(r,a)&&!yt(j,a)&&(t&&$(S.uponSanitizeShadowNode,a,null),Hn(a,n),Yn(a,n),Fn(a.content)&&Xn(a.content))},En=function(e){j&&vt(j,e)},Dn=function(e,t){return O?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},On=function(e){O&&yn(e,e=>{let t=y(e);if(t===Y.processingInstruction||t===Y.comment&&U(an,e.data)){try{p(e)}catch{}return!1}if(t===Y.element){let t=e,n=B(ie(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Dn(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},kn=function(e){let t=null,r=null;if(Be)e=`<remove></remove>`+e;else{let t=St(e,/^[\r\n\t ]+/);r=t&&t[0]}lt===`application/xhtml+xml`&&Qe===L&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=b?de(e):e;if(Qe===L)try{t=new l().parseFromString(i,lt)}catch{}if(!t||!t.documentElement){t=he.createDocument(Qe,`template`,null);try{t.documentElement.innerHTML=$e?x:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Qe===L?ve.call(t,Le?`html`:`body`)[0]:Le?t.documentElement:a},An=function(e){let t=re?re(e):e.ownerDocument;return ge.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},jn=function(e){return e=Ct(e,be,` `),e=Ct(e,xe,` `),e=Ct(e,Se,` `),e},Mn=function(e){Nn(e);let t=e.querySelectorAll?.call(e,`template`);t&&V(t,e=>{Fn(e.content)&&Mn(e.content)})},Nn=function(e){e.normalize();let t=re?re(e):e.ownerDocument,n=ge.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=jn(r.data),r=n.nextNode()},Pn=function(e){let t=v?v(e):null;return typeof t!=`string`||B(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==g(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==_(e)||e.childNodes!==m(e)},Fn=function(e){if(!_||typeof e!=`object`||!e)return!1;try{return _(e)===Y.documentFragment}catch{return!1}},In=function(e){if(!_||typeof e!=`object`||!e)return!1;try{return typeof _(e)==`number`}catch{return!1}};function $(e,n,r){e.length!==0&&V(e,e=>{e.call(t,n,r,Et)})}let Ln=function(e,t){return!!(O&&e.hasChildNodes()&&!In(e.firstElementChild)&&U(rn,e.textContent)&&U(rn,e.innerHTML)||O&&cn[t]&&y(e)===Y.element&&oe(e)===L&&(In(e.firstElementChild)||typeof e.textContent==`string`&&U(rn,e.textContent))||e.nodeType===Y.processingInstruction||O&&e.nodeType===Y.comment&&U(an,e.data))},Rn=function(e,t){return e instanceof RegExp?U(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},zn=function(e,t,n){if(!je[t]&&Gn(t)&&Rn(T.tagNameCheck,t))return!1;if(Ke&&!N[t]&&!N[bt(t)]){let t=h(e),r=m(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,te(e))}}}return gn(e),!0},Bn=function(e,t,n,r){return e.length===0?t:t===n||t===r?q(t):t},Vn=function(e,t){return e===t||h(e)!==null?!1:(qe&&bn(e),!0)},Hn=function(e,n){if(En(e),$(S.beforeSanitizeElements,e,null),Vn(e,n))return!0;if(Pn(e))return gn(e),!0;let r=B(ie(e));if(C=Bn(S.uponSanitizeElement,C,ke,k),$(S.uponSanitizeElement,e,{tagName:r,allowedTags:C}),Vn(e,n))return!0;if(Ln(e,r))return gn(e),!0;if(je[r]||!(E.tagCheck instanceof Function&&E.tagCheck(r))&&!C[r]){let t=zn(e,r,n);return t===!1&&($(S.afterSanitizeElements,e,null),Vn(e,n))?!0:t}if(y(e)===Y.element&&!hn(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&U(on,e.innerHTML))return gn(e),!0;if(D&&e.nodeType===Y.text){let n=jn(e.textContent);e.textContent!==n&&(pt(t.removed,{element:e.cloneNode()}),e.textContent=n)}return $(S.afterSanitizeElements,e,null),Vn(e,n)},Un=function(e,t,r){if(Me[t]||Dn(t,e)||Ue&&(t===`id`||t===`name`)&&(r in n||r in Dt))return!1;let i=w[t]||E.attributeCheck instanceof Function&&E.attributeCheck(t,e);return Pe&&U(Ce,t)||Ne&&U(we,t)?!0:i?F[t]||U(Oe,Ct(r,Ee,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&wt(r,`data:`)===0&&Je[e]||Fe&&!U(Te,Ct(r,Ee,``))?!0:!r:Gn(e)&&Rn(T.tagNameCheck,e)&&Rn(T.attributeNameCheck,t,e)||t===`is`&&T.allowCustomizedBuiltInElements&&Rn(T.tagNameCheck,r)},Wn=K({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Gn=function(e){return!Wn[bt(e)]&&U(De,e)},Kn=function(e,t,n,r){if(b&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return de(r);case`TrustedScriptURL`:return fe(r)}return r},qn=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Pn(e)||(gn(e),!1)}catch{return Q(t,e),!1}},Jn=function(e,t){return O&&U(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:bt(e)===`attributename`&&St(t,`href`)!==null},Yn=function(e,n){if($(S.beforeSanitizeAttributes,e,null),Vn(e,n))return;let r=e.attributes;if(!r||Pn(e))return;w=Bn(S.uponSanitizeAttribute,w,Ae,ze);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:w,forceKeepAttr:void 0},a=r.length,o=B(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=B(s),d=l,f=s===`value`?d:Tt(d),p=!1;i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,$(S.uponSanitizeAttribute,e,i),f=i.attrValue,We&&(u===`id`||u===`name`)&&wt(f,Ge)!==0&&(Q(s,e,n),f=Ge+f,p=!0),Jn(s,f)?Q(s,e,n):i.forceKeepAttr||(i.keepAttr?!Ie&&U(sn,f)?Q(s,e,n):(D&&(f=jn(f)),Un(o,u,f)?(f=Kn(o,u,c,f),f!==d&&qn(e,s,c,f)&&p&&ft(t.removed)):Q(s,e,n)):Q(s,e,n))}$(S.afterSanitizeAttributes,e,null),Vn(e,n)},Xn=function(e){let t=null,n=An(e);for($(S.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if($(S.uponSanitizeShadowNode,t,null),Hn(t,e),Yn(t,e),Fn(t.content)&&Xn(t.content),y(t)===Y.element){let e=ne(t);Fn(e)&&(Zn(e),Xn(e))}D&&Nn(e),$(S.afterSanitizeShadowDOM,e,null)},Zn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Xn(e.shadow);continue}let n=e.node,r=y(n)===Y.element,i=m(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=v?v(n):null;if(typeof e==`string`&&B(e)===`template`){let e=n.content;Fn(e)&&t.push({node:e,shadow:null})}}if(r){let e=ne(n);Fn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if($e=!e,$e&&(e=`<!-->`),typeof e!=`string`&&!In(e)&&(e=Nt(e),typeof e!=`string`))throw W(`dirty is not a string, aborting`);if(!t.isSupported)return e;Re?(C=k,w=ze):kt(n),(S.uponSanitizeElement.length>0||S.uponSanitizeAttribute.length>0)&&(C=q(C)),S.uponSanitizeAttribute.length>0&&(w=q(w)),t.removed=[];let c=qe&&typeof e!=`string`&&In(e),l=[],u=j;if(c){On(e);let t=ie(e);if(typeof t==`string`){let n=B(t);if(!C[n]||je[n])throw Z(e),W(`root node is forbidden and cannot be sanitized in-place`)}if(Pn(e))throw Z(e),W(`root node is clobbered and cannot be sanitized in-place`);l=xn(e),j=_t()}else if(In(e))i=kn(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===Y.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Zn(i);else{if(!A&&!D&&!Le&&e.indexOf(`<`)===-1)return b&&He?de(e):e;if(i=kn(e),!i)return A?null:He?x:``}i&&Be&&gn(i.firstChild);let d=c?e:i;try{c&&Zn(e);let t=An(d);for(;o=t.nextNode();)Hn(o,d),Yn(o,d),Fn(o.content)&&Xn(o.content);c&&wn(e,l)}catch(t){throw c&&(Z(e),Cn(e,l)),t}finally{j=u}if(c){if(Cn(e,l))throw W(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return D&&Mn(e),e}if(A){if(D&&Mn(i),Ve)for(s=_e.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(w.shadowroot||w.shadowrootmode)&&(s=ye.call(r,s,!0)),s}let f=Le?i.outerHTML:i.innerHTML;return Le&&C[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&U(tn,i.ownerDocument.doctype.name)&&(f=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
58
- `+f),D&&(f=jn(f)),b&&He?de(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};kt(e),Re=!0,k=C,ze=w},t.clearConfig=function(){Et=null,Re=!1,k=null,ze=null,b=se,x=``},t.isValidAttribute=function(e,t,n){Et||kt({});let r=B(e),i=B(t);return typeof n==`string`&&(Jn(t,n)||!Ie&&U(sn,n))?!1:Un(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&H(S,e)&&pt(S[e],t)},t.removeHook=function(e,t){if(H(S,e)){if(t!==void 0){let n=dt(S[e],t);return n===-1?void 0:ht(S[e],n,1)[0]}return ft(S[e])}},t.removeHooks=function(e){H(S,e)&&(S[e]=[])},t.removeAllHooks=function(){S=dn()},t}var mn=pn();function hn(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}var gn=new Ye({renderer:{code({text:e,lang:t,escaped:n}){return`<div class="code-block"><div class="code-block-head"><span>${hn((t??``).trim().split(/\s+/)[0]||`代码块`)}</span><button type="button" data-copy-code>复制</button></div><pre><code>${n?e:hn(e)}</code></pre></div>`},link(e){return`<a href="${hn(e.href||``)}"${e.title?` title="${hn(e.title)}"`:``} target="_blank" rel="noopener noreferrer">${this.parser.parseInline(e.tokens??[])}</a>`}}});function _n(e){let t=gn.parse(e,{async:!1});return mn.sanitize(t,{ADD_ATTR:[`target`]})}var Z=e(t(),1),Q=o(),vn=`bg-[var(--tw-surface-panel)] border-[var(--tw-border)]`,yn=`text-[var(--tw-label-primary)]`,bn=`text-[var(--tw-label-secondary)]`,xn=`text-[var(--tw-label-tertiary)]`,Sn=`inline-flex h-8 shrink-0 items-center gap-1.5 rounded-lg bg-[#4176e6] px-3 text-sm font-medium text-white transition-colors hover:bg-[#3566d0] disabled:cursor-not-allowed disabled:opacity-50`,Cn=`inline-flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-[var(--tw-border)] px-3 text-sm text-[var(--tw-label-secondary)] transition-colors hover:bg-[var(--tw-session-hover-bg)] disabled:cursor-not-allowed disabled:opacity-50`,wn=`h-8 w-full rounded-lg border border-[var(--tw-border)] bg-[var(--tw-surface-panel)] px-2.5 text-sm text-[var(--tw-label-primary)] outline-none transition-colors placeholder:text-[var(--tw-label-tertiary)] focus:border-[#4176e6]`;function Tn({open:e,prompts:t,value:o,force:c=!1,onClose:l,onMount:u,onCreate:d,target:f=`项目`,createHint:p=`会按插件自带的模板生成(规划 / 探索 / 生成代码三段),之后可在「提示词管理」里改。`}){let[ee,te]=(0,Z.useState)(o),[m,h]=(0,Z.useState)(!1),[ne,g]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(!1),[re,y]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{e&&(te(o),h(!1),g(``),v(!1),y(``))},[e,o]);let ie=e=>{te(e),v(!1),y(``),g(``)},ae=()=>{te(``),v(!0),y(`我的提示词.md`),g(``)},oe=()=>{v(!1),y(``),g(``),te(o)},b=async()=>{if(!m&&ee){h(!0),g(``);try{await u(ee)}catch(e){g(e instanceof Error?e.message:String(e))}finally{h(!1)}}},x=async()=>{if(!d||m)return;let e=re.trim();if(!e)g(`先给新提示词起个文件名`);else{h(!0),g(``);try{await u(await d(e)),v(!1),y(``)}catch(e){g(e instanceof Error?e.message:String(e))}finally{h(!1)}}};return(0,Q.jsxs)(i,{open:e,onClose:m?()=>void 0:l,className:`relative z-110`,children:[(0,Q.jsx)(a,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":`true`}),(0,Q.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,Q.jsxs)(n,{transition:!0,className:`tw-dialog-panel-anim w-full max-w-md overflow-hidden rounded-xl border shadow-xl ${vn}`,children:[(0,Q.jsxs)(`div`,{className:`border-b border-[var(--tw-border)] px-5 py-4`,children:[(0,Q.jsx)(r,{className:`text-base font-semibold ${yn}`,children:c?`先挂载提示词`:`挂载提示词`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed ${bn}`,children:c?`这个${f}还没有挂载提示词,选一份挂上才能开始生成;也可以先取消,稍后再挂。`:`一个${f}只挂一份提示词,换新的会立即取消上一份的引用`})]}),(0,Q.jsxs)(`div`,{className:`max-h-[60vh] overflow-auto px-5 py-4`,children:[t.length?(0,Q.jsx)(`div`,{className:`space-y-1 rounded-lg border border-[var(--tw-border)] p-1`,children:t.map(e=>{let t=ee===e;return(0,Q.jsxs)(`button`,{type:`button`,disabled:m,onClick:()=>ie(e),"aria-pressed":t,className:`flex w-full min-w-0 items-center gap-2 rounded-md px-2.5 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed ${t?`bg-(--tw-accent-soft) font-medium text-(--tw-accent)`:`text-[var(--tw-label-primary)] hover:bg-[var(--tw-session-hover-bg)]`}`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-3 shrink-0 rounded-full border ${t?`border-[#4176e6] bg-[#4176e6] shadow-[inset_0_0_0_2px_var(--tw-surface-panel)]`:`border-[var(--tw-border)]`}`}),(0,Q.jsx)(s,{text:e,className:`min-w-0 flex-1 truncate`})]},e)})}):(0,Q.jsx)(`p`,{className:`rounded-lg border border-dashed border-[var(--tw-border)] px-3 py-6 text-center text-xs ${xn}`,children:`「提示词管理」里还没有可用的提示词,用下面的卡片新建一份再挂上。`}),d?_?(0,Q.jsxs)(`div`,{className:`mt-3 rounded-lg border border-[var(--tw-border)] p-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium ${yn}`,children:`新建提示词并挂载`}),(0,Q.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed ${bn}`,children:p}),(0,Q.jsx)(`input`,{className:`${wn} mt-2`,value:re,autoFocus:!0,placeholder:`文件名,例如 我的登录流程.md`,"aria-label":`新提示词文件名`,onChange:e=>y(e.target.value),onKeyDown:e=>{e.key===`Enter`&&x()}})]}):(0,Q.jsxs)(`button`,{type:`button`,disabled:m,onClick:ae,className:`mt-3 flex w-full items-center gap-3 rounded-lg border border-dashed border-[var(--tw-border)] px-3 py-3 text-left transition-colors hover:border-[#4176e6] hover:bg-[var(--tw-session-hover-bg)] disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-(--tw-accent-soft) text-(--tw-accent)`,children:(0,Q.jsx)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:(0,Q.jsx)(`path`,{d:`M12 5v14M5 12h14`})})}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium ${yn}`,children:`新建提示词并挂载`}),(0,Q.jsx)(`span`,{className:`mt-0.5 block text-[11px] ${bn}`,children:`按插件模板生成一份新的,建完直接挂到当前项目`})]})]}):null,ne?(0,Q.jsx)(`p`,{className:`mt-3 rounded-lg bg-red-50 px-3 py-2 text-[11px] leading-relaxed break-words text-red-600`,children:ne}):null]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t border-[var(--tw-border)] px-5 py-3`,children:[c&&!_?(0,Q.jsx)(`span`,{className:`mr-auto text-[11px] ${xn}`,children:`不挂载时生成会被拦下`}):null,_?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`button`,{type:`button`,className:Cn,onClick:oe,disabled:m,children:`取消`}),(0,Q.jsx)(`button`,{type:`button`,className:Sn,onClick:()=>void x(),disabled:m||!re.trim(),children:m?`创建中…`:`创建并挂载`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`button`,{type:`button`,className:Cn,onClick:l,disabled:m,children:`取消`}),(0,Q.jsx)(`button`,{type:`button`,className:Sn,onClick:()=>void b(),disabled:m||!ee||!t.length,children:m?`保存中…`:`挂载`})]})]})]})})]})}export{_n as n,Tn as t};
@@ -1 +0,0 @@
1
- import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,p as r}from"./app-config.Bm4oN4YP.js";import{a as i,i as a,n as o,o as s,s as c}from"./plugins.CCqu2gnf.js";import{t as l}from"./jsx-runtime.DUg_B_vD.js";import{t as ee}from"./ConfirmDialog.CsMwWevK.js";import{showToast as u}from"./Toast.BO2NFckG.js";import{_ as te,f as ne,l as re,m as ie,n as d,r as ae,s as f,u as p}from"./project-docs.Cd2gKPKh.js";import{n as oe}from"./doc-roots.DAJP9Svr.js";import{a as m,c as h,d as se,i as g,l as _,o as v,s as y,u as b}from"./prompts-meta.BiymOMAE.js";import{i as ce,n as le,r as ue,t as de}from"./DocsFileBrowser.nSAGUo3l.js";import{t as fe,u as pe}from"./open-docs-in-session.DPCjFUcv.js";import{r as me}from"./report-prompt.CAfZ6RIo.js";import{A as he,L as ge,U as _e,d as ve,o as ye,t as be}from"./story-review.a7qZTroW.js";import{t as x}from"./NamePromptDialog.CS1pTTVl.js";import{m as S}from"./PmShared.BwVlCk92.js";import{g as xe,s as Se}from"./ui-auto.BmC9JJ_X.js";var C=e(t(),1),w=`tw.prompts.mounted.v1`;function Ce(){try{let e=sessionStorage.getItem(r(w));if(!e)return{};let t=JSON.parse(e);if(!t||typeof t!=`object`)return{};let n={};for(let[e,r]of Object.entries(t))typeof e==`string`&&typeof r==`string`&&(n[e]=r);return n}catch{return{}}}function we(e){try{sessionStorage.setItem(r(w),JSON.stringify(e))}catch{}}var T=l(),Te=10;async function E(e=`.`){let{entries:t}=await f(`prompts`,e),n=[];for(let e of t)e.type===`file`?n.push(e):n.push(...await E(e.path));return n}function Ee({path:e,enabled:t,mounted:n}){let r=b(e,n);if(!r)return(0,T.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:`未关联`});if(r===`system`)return(0,T.jsx)(`span`,{className:`text-[11px] text-stone-600`,children:`系统默认`});let i=o(r)?.name??r,a=t[r]===!0,s=v(e,n);return(0,T.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,T.jsx)(`span`,{className:`truncate text-[11px] text-stone-600`,children:i}),s&&a?(0,T.jsx)(`span`,{className:`shrink-0 rounded bg-(--tw-accent-soft) px-1 text-[10px] text-(--tw-accent)`,children:`引用中`}):null]})}function D(){let e=ue(`prompts`),[t,r]=(0,C.useState)(!1),[l,f]=(0,C.useState)(!0),[v,w]=(0,C.useState)(e?!0:null),[D,De]=(0,C.useState)(()=>e??[]),[O,k]=(0,C.useState)(null),[A,j]=(0,C.useState)(!1),[M,N]=(0,C.useState)({}),[P,F]=(0,C.useState)(null),[I,L]=(0,C.useState)(()=>i()),[R,Oe]=(0,C.useState)(()=>Ce()),[z,B]=(0,C.useState)(null),[V,H]=(0,C.useState)(null),[U,W]=(0,C.useState)(``),G=le(D,Te,`prompts`),K=(0,C.useRef)(!1),q=(0,C.useRef)(!1),J=(0,C.useRef)(!1),Y=(0,C.useCallback)(async()=>{k(null);try{let e=await E(`.`);De(e),ce(`prompts`,e)}catch(e){k(e instanceof Error?e.message:String(e))}},[]);(0,C.useEffect)(()=>{v&&I.reqAnalysis===!0&&!K.current&&(D.some(e=>e.name===`需求分析提示词.md`)||(K.current=!0,he(!0).then(()=>Y()).catch(()=>void 0)))},[v,I.reqAnalysis,D,Y]),(0,C.useEffect)(()=>{v&&I.storyReview===!0&&!q.current&&(D.some(e=>e.name===`用户故事审查提示词.md`)||(q.current=!0,ye(!0).then(()=>Y()).catch(()=>void 0)))},[v,I.storyReview,D,Y]),(0,C.useEffect)(()=>{v&&I.testPoints===!0&&!J.current&&(D.some(e=>e.name===`测试点生成提示词.md`)||(J.current=!0,_e(!0).then(()=>Y()).catch(()=>void 0)))},[v,I.testPoints,D,Y]),(0,C.useEffect)(()=>{let e=s(e=>{f(!!e.prompts),L(e)});return n().then(()=>{f(a(`prompts`)),L(i()),r(!0)}),e},[]),(0,C.useEffect)(()=>{t&&l&&(async()=>{await ae(`prompts`)?(await pe().catch(()=>null),await Y(),w(!0)):w(!1)})()},[t,l,Y]);let X=(0,C.useCallback)(async()=>{let e=await Se(),t=a(`reports`),n=t?await me().catch(()=>null):null;Oe(r=>{let i={};if(e)for(let t of e)i[h(t)]=`uiAuto`;else for(let[e,t]of Object.entries(r))t===`uiAuto`&&(i[e]=t);if(t){if(n?.promptFile)i[h(n.promptFile)]=`reports`;else for(let[e,t]of Object.entries(r))t===`reports`&&(i[e]=t)}return I.reqAnalysis&&(i[h(ve)]=`reqAnalysis`),I.storyReview&&(i[h(be)]=`storyReview`),I.testPoints&&(i[h(ge)]=`testPoints`),we(i),i})},[I.reqAnalysis,I.storyReview,I.testPoints]);(0,C.useEffect)(()=>{if(!t||!l)return;X();let e=()=>{document.visibilityState===`visible`&&X()};document.addEventListener(`visibilitychange`,e);let n=xe(()=>void X());return()=>{document.removeEventListener(`visibilitychange`,e),n()}},[t,l,I.uiAuto,I.reports,I.reqAnalysis,I.storyReview,I.testPoints,X]);let Z=(0,C.useMemo)(()=>Object.keys(M).filter(e=>M[e]),[M]),Q=(0,C.useCallback)(e=>{let t=b(e,R);return!t||t===`system`||se(e)?``:I[t]===!0?t:``},[R,I]);async function ke(e){j(!0),k(null);try{await re(`prompts`,e.path)}catch(e){k(e instanceof Error?e.message:String(e))}finally{j(!1)}}async function Ae(e){j(!0),k(null);try{await fe(`prompts`,e)}catch(e){k(e instanceof Error?e.message:String(e)),j(!1)}}function je(e){if(y(e.path)){k(`默认提示词不可删除`);return}if(g(e.path,I)){k(_(e.path,I));return}let t=Q(e.path);if(t){let e=o(t)?.name??t;k(`这份提示词正被「${e}」的项目挂载,先在那里换一份再删除`)}else F({kind:`one`,entry:e})}function Me(e){if(y(e.path)){k(`默认提示词不可改名`);return}if(g(e.path,I)){k(_(e.path,I));return}let t=Q(e.path);if(t){let e=o(t)?.name??t;k(`这份提示词正被「${e}」的项目挂载,先在那里换一份再改名`)}else B(e),W(``)}function Ne(e){H(e),W(``)}async function Pe(){let e=P;if(e){F(null),j(!0),k(null);try{if(e.kind===`one`)await d(`prompts`,e.entry.path);else{let t=0;for(let n of e.paths)y(n)||g(n,I)||Q(n)?t+=1:await d(`prompts`,n);t&&k(`有 ${t} 个提示词仍被插件或项目引用,已跳过;先解除引用再删。`),N({})}await Y(),u(e.kind===`one`?`已删除「${e.entry.name}」`:`已删除 ${e.paths.length} 个提示词`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);k(t),u(`删除失败:${t}`,`error`)}finally{j(!1)}}}function Fe(){a(`promptGen`)?window.location.href=`/workbench/?plugin=promptGen`:k(c(`promptGen`))}let $=(0,C.useCallback)((e,t,n=``)=>{let r=(e===`.`?t:`${e}/${t}`).toLowerCase(),i=D.find(e=>e.path.toLowerCase()===r&&e.path.toLowerCase()!==n.toLowerCase());return i?i.name:``},[D]);async function Ie(e){let t=z;if(!t)return;let n=e.trim();if(!n||n===t.name){B(null),W(``);return}let r=$(p(t.path),n,t.path);if(r)W(`已存在同名文件「${r}」,换个名字再试`);else{j(!0),W(``);try{await ie(`prompts`,t.path,n),B(null),await Y(),u(`已重命名为「${n}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);W(t),u(`重命名失败:${t}`,`error`)}finally{j(!1)}}}async function Le(e){let t=V;if(!t)return;let n=e.trim();if(!n)return;let r=$(p(t.path),n);if(r)W(`已存在同名文件「${r}」,换个名字再试`);else{j(!0),W(``);try{let{content:e}=await ne(`prompts`,t.path);await te(`prompts`,p(t.path)===`.`?n:`${p(t.path)}/${n}`,e),H(null),await Y(),u(`已复制为「${n}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);W(t),u(`复制失败:${t}`,`error`)}finally{j(!1)}}}let Re=P?.kind===`one`?`删除「${P.entry.name}」?将从 ${oe(`prompts`)} 中移除。`:P?.kind===`batch`?`确认删除已选中的 ${P.paths.length} 个提示词?此操作不可恢复。`:``;return t?l?v===null?(0,T.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,T.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,T.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):v?(0,T.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,children:[(0,T.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,T.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0`,children:[G.query.trim()?(0,T.jsxs)(T.Fragment,{children:[`匹配 `,(0,T.jsx)(`span`,{className:`font-medium text-stone-800`,children:G.filtered.length}),` 个`,(0,T.jsxs)(`span`,{className:`text-stone-400`,children:[` · 共 `,D.length]})]}):(0,T.jsxs)(T.Fragment,{children:[`共 `,(0,T.jsx)(`span`,{className:`font-medium text-stone-800`,children:D.length}),` 个提示词`]}),Z.length>0?(0,T.jsxs)(`span`,{className:`text-stone-400`,children:[` · 已选 `,Z.length]}):null]}),(0,T.jsx)(`button`,{type:`button`,disabled:A||Z.length===0,onClick:()=>F({kind:`batch`,paths:Z}),className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-red-600 border border-red-200 rounded-lg hover:bg-red-50 disabled:opacity-40`,children:`批量删除`}),(0,T.jsx)(`button`,{type:`button`,disabled:A,onClick:Fe,className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40`,children:`生成提示词`})]}),O?(0,T.jsx)(`div`,{className:`shrink-0 mx-4 mt-3 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:O}):null,(0,T.jsx)(de,{files:D,filtered:G.filtered,pageFiles:G.pageFiles,query:G.query,onQuery:G.setQuery,sortBy:G.sortBy,onSortBy:G.setSortBy,page:G.page,totalPages:G.totalPages,pageSize:G.pageSize,onPage:G.setPage,onPageSize:G.setPageSize,busy:A,emptyText:`暂无提示词,点击「生成提示词」前往我的工作台。`,searchPlaceholder:`搜索文件名或路径…`,selectable:e=>!m(e.path,I)&&!Q(e.path),selected:M,onToggleRow:e=>N(t=>({...t,[e]:!t[e]})),onSelectPage:(e,t)=>N(n=>{let r={...n};for(let n of e)t?r[n]=!0:delete r[n];return r}),onRowDoubleClick:e=>void ke(e),extraColumn:{header:`关联插件`,className:`w-32 shrink-0`,render:e=>(0,T.jsx)(Ee,{path:e.path,enabled:I,mounted:R})},actionsClassName:`w-36 shrink-0`,renderNameAction:e=>(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`button`,{type:`button`,disabled:A,"aria-label":`重命名 ${e.name}`,onClick:()=>Me(e),className:`rounded p-1 text-stone-400 transition-colors hover:bg-[#e8f0fe] hover:text-[#4176e6] disabled:opacity-40`,children:(0,T.jsx)(S,{name:`pencil`,size:12})}),(0,T.jsx)(`button`,{type:`button`,disabled:A,"aria-label":`复制 ${e.name}`,onClick:()=>Ne(e),className:`rounded p-1 text-stone-400 transition-colors hover:bg-[#e8f0fe] hover:text-[#4176e6] disabled:opacity-40`,children:(0,T.jsx)(S,{name:`copy`,size:12})})]}),renderActions:e=>{let t=m(e.path,I)||!!Q(e.path);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`button`,{type:`button`,disabled:A,onClick:()=>void Ae(e),className:`inline-flex h-6 items-center whitespace-nowrap rounded bg-[#4176e6] px-2 text-xs text-white hover:bg-[#3565c7] cursor-pointer disabled:opacity-40`,children:`在会话中打开`}),(0,T.jsx)(`button`,{type:`button`,disabled:A||t,"aria-label":`删除 ${e.name}`,onClick:()=>je(e),className:`inline-flex h-6 items-center rounded p-1 text-red-600 transition-colors hover:bg-red-50 disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent`,children:(0,T.jsx)(S,{name:`trash`,size:12})})]})}}),(0,T.jsx)(x,{open:z!=null,title:`重命名提示词`,label:`文件名称`,initialValue:z?.name??``,lockExtension:!0,confirmLabel:`保存`,error:U,onClose:()=>{B(null),W(``)},onConfirm:e=>void Ie(e)}),(0,T.jsx)(x,{open:V!=null,title:`复制提示词`,label:`新文件名称`,initialValue:V?V.name.replace(/(\.[^.]+)?$/,e=>`(副本)${e}`):``,lockExtension:!0,confirmLabel:`复制`,error:U,onClose:()=>{H(null),W(``)},onConfirm:e=>void Le(e)}),(0,T.jsx)(ee,{open:P!=null,title:P?.kind===`batch`?`批量删除`:`删除提示词`,message:Re,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>F(null),onConfirm:()=>void Pe()})]}):(0,T.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:`提示词管理需要本地文档服务,当前未就绪。`}):(0,T.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:c(`prompts`)}):(0,T.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,T.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,T.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{D as default};
@@ -1,28 +0,0 @@
1
- import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.Bm4oN4YP.js";import{s as r}from"./plugins.CCqu2gnf.js";import{a as i,i as a,n as o,o as s,r as c,t as l}from"./view-prefs.Do8yjl1I.js";import{t as u}from"./jsx-runtime.DUg_B_vD.js";import{t as d}from"./ConfirmDialog.CsMwWevK.js";import{t as f}from"./OverflowHint.DI-tZ2fv.js";import{t as ee}from"./SelectDropdown.DqKxIust.js";import{showToast as p}from"./Toast.BO2NFckG.js";import{s as m}from"./llm.BZEzE0x2.js";import{f as te,l as ne,p as re}from"./settings.DNkAyQxA.js";import{A as h,B as ie,C as ae,D as oe,E as se,F as g,H as _,I as v,L as ce,M as y,N as le,O as ue,P as b,R as de,S as fe,T as pe,U as me,V as he,_ as ge,a as _e,b as ve,c as ye,d as be,f as xe,g as Se,h as Ce,i as we,j as Te,l as Ee,m as De,n as Oe,o as ke,p as Ae,r as je,s as x,u as Me,v as Ne,w as Pe,x as Fe,y as Ie,z as Le}from"./story-review.a7qZTroW.js";import{t as Re}from"./hydrate-cache.BJ2nzhRq.js";import{O as ze,S,_ as Be,g as Ve,m as C,u as He}from"./PmShared.BwVlCk92.js";var w=e(t(),1),Ue=`可用工具(只调用这些,不要自己编工具名):
2
- - req_set_outline:提交本批「需求条目」,返回每个条目的 id。
3
- - req_set_stories:提交「用户故事」;补写时提交合并后的完整故事集(带原 id 原地更新)。
4
- - req_save_check:提交体检结果(缺口清单 + 结论)。
5
- - req_save_test_points:提交测试点(功能 / 边界值 / 异常 / 业务规则 / 非功能五维,P0–P3)。
6
-
7
- 提交后不要重复提交同样的内容;工具返回 ok 之后再写最终回答。`,We=[`missing-scenario`,`missing-dimension`,`untestable-acceptance`,`conflict`,`over-split`,`other`];function Ge(e){try{let t=JSON.parse(e||`{}`);return t&&typeof t==`object`?t:{}}catch{return{}}}function T(e,t=500){return typeof e==`string`?e.trim().slice(0,t):``}function E(e){return String(e??``).toLowerCase().replace(/[\s\p{P}\p{S}]+/gu,``)}function Ke(e){let t=T(e,10);return t===`high`||t===`medium`||t===`low`?t:`medium`}function D(e){let t=T(e,40);return We.includes(t)?t:`other`}var O=[`functional`,`boundary`,`exception`,`business`,`nonfunctional`];function k(e){let t=T(e,40);if(O.includes(t))return t;let n=T(e,20);return O.find(e=>le[e]===n)??`functional`}function A(e){let t=T(e,4).toUpperCase();return v.includes(t)?t:`P1`}function j(e,t){if(!e||typeof e!=`object`)return null;let n=e,r=T(n.title,200);if(!r)return null;let i=T(n.storyId,20);return{id:``,storyId:t.has(i)?i:``,dimension:k(n.dimension),priority:A(n.priority),title:r,precondition:T(n.precondition,1e3),steps:Array.isArray(n.steps)?n.steps.map(e=>T(e,500)).filter(Boolean).slice(0,20):[],expected:T(n.expected,1e3)}}var qe=[{type:`function`,function:{name:`req_set_outline`,description:`提交本批从原始需求里抽出的需求条目(一条 = 一个可独立验收的能力点)。返回每个条目的 id,供 sourceRefs 引用。`,parameters:{type:`object`,properties:{items:{type:`array`,items:{type:`object`,properties:{title:{type:`string`,description:`一句话概括`},quote:{type:`string`,description:`原文关键句,不超过 80 字`}},required:[`title`]}}},required:[`items`]}}},{type:`function`,function:{name:`req_set_stories`,description:`提交用户故事。拆解时只提交这一批新故事;补写时提交合并后的完整故事集(带原 id 的原地更新,新故事不带 id)。`,parameters:{type:`object`,properties:{stories:{type:`array`,items:{type:`object`,properties:{id:{type:`string`,description:`已有故事才带(US-001 这种)`},title:{type:`string`,description:`一句话说明这条故事做什么`},role:{type:`string`,description:`角色(来自原文;推断的要在 value 里注明)`},goal:{type:`string`,description:`用户想达成的目标`},value:{type:`string`,description:`业务价值 / 补充说明(角色为推断时写在这里)`},sourceRefs:{type:`array`,items:{type:`string`},description:`对应的需求条目 id(req_set_outline 返回的真实 id)`},priority:{type:`string`,enum:[`P0`,`P1`,`P2`]},preconditions:{type:`array`,items:{type:`string`}},mainFlow:{type:`array`,items:{type:`object`,properties:{actor:{type:`string`},action:{type:`string`,description:`动词开头的一步`},result:{type:`string`,description:`用户能看到的变化`}},required:[`action`]}},altFlows:{type:`array`,items:{type:`object`,properties:{name:{type:`string`},trigger:{type:`string`,description:`什么情况下走这条替代路径`},steps:{type:`array`,items:{type:`string`}}},required:[`name`,`trigger`]}},exceptions:{type:`array`,items:{type:`object`,properties:{scenario:{type:`string`,description:`异常场景`},expected:{type:`string`,description:`系统应有的表现`}},required:[`scenario`,`expected`]}},postconditions:{type:`array`,items:{type:`string`}},acceptance:{type:`array`,items:{type:`object`,properties:{given:{type:`string`},when:{type:`string`},then:{type:`string`,description:`必须可判定`}},required:[`given`,`when`,`then`]}},dimensions:{type:`array`,items:{type:`string`},description:`权限 / 边界值 / 并发与幂等 / 空数据 / 超时与失败 / 国际化与时区`}},required:[`title`,`role`,`mainFlow`,`acceptance`]}}},required:[`stories`]}}},{type:`function`,function:{name:`req_save_check`,description:`提交需求体检结果:语义类缺口清单 + 两三句话结论。只出问题,不改写故事。`,parameters:{type:`object`,properties:{summary:{type:`string`,description:`整体结论,两三句话`},gaps:{type:`array`,items:{type:`object`,properties:{storyTitle:{type:`string`,description:`相关故事标题;全局问题填空串`},type:{type:`string`,enum:We},severity:{type:`string`,enum:[`high`,`medium`,`low`]},title:{type:`string`},detail:{type:`string`,description:`位置 + 原因`},suggestion:{type:`string`,description:`建议补写什么`}},required:[`title`,`detail`]}}},required:[`gaps`]}}},{type:`function`,function:{name:`req_save_test_points`,description:`提交基于用户故事拆出的测试点:功能 / 边界值 / 异常 / 业务规则 / 非功能五个维度全覆盖,每条标 P0–P3。一次提交全部,不要分多次。`,parameters:{type:`object`,properties:{summary:{type:`string`,description:`整体结论:几条、五维覆盖情况、最该先测什么`},points:{type:`array`,items:{type:`object`,properties:{storyId:{type:`string`,description:`对应故事 id(US-001 这种);全局测试点填空串`},dimension:{type:`string`,enum:O,description:`functional 功能 / boundary 边界值 / exception 异常 / business 业务规则 / nonfunctional 非功能`},priority:{type:`string`,enum:v},title:{type:`string`,description:`一句话说清测什么(动词开头,带条件)`},precondition:{type:`string`,description:`执行前需要的数据 / 角色 / 状态`},steps:{type:`array`,items:{type:`string`},description:`可执行步骤,一步一个动作`},expected:{type:`string`,description:`可判定的预期结果,有阈值写具体数值`}},required:[`dimension`,`priority`,`title`]}}},required:[`points`]}}}];async function Je(e,t,n){let r=Ge(t),i=n.getDoc();if(!i)return JSON.stringify({ok:!1,error:`当前还没有打开分析文档`});if(e===`req_set_outline`){let e=Array.isArray(r.items)?r.items:[];if(!e.length)return JSON.stringify({ok:!0,added:0,total:i.outline.length,items:i.outline.map(({id:e,title:t})=>({id:e,title:t})),note:`没有提交新条目,需求条目保持不变。`});let t=i.outline,a=new Set(t.map(e=>E(e.title))),o=new Set(t.map(e=>e.id)),s=[];for(let t of e){let e=t&&typeof t==`object`?t:{},r=T(e.title,200)||T(e.quote,200);if(!r||a.has(E(r)))continue;a.add(E(r));let i=`RO-${n.batch+1}-${s.length+1}`,c=i,l=1;for(;o.has(c);)c=`${i}-${l++}`;o.add(c),s.push({id:c,title:r,quote:T(e.quote,500)})}let c=[...t,...s],l=await n.saveOutline(c);return JSON.stringify({ok:!0,added:s.length,total:l.length,items:l.map(({id:e,title:t})=>({id:e,title:t})),note:s.length>0?`条目已保存。接下来用 req_set_stories 提交故事,sourceRefs 只能引用上面返回的 id。`:`这些条目已经存在,没有重复写入;继续提交故事即可。`})}if(e===`req_set_stories`){let e=Array.isArray(r.stories)?r.stories:[];if(!e.length)return JSON.stringify({ok:!0,added:0,total:i.stories.length,note:`没有提交故事,故事集保持不变。`});let t=i.stories.length,a=Pe(i.stories,e),o=await n.saveStories(a),s=new Set(i.outline.map(e=>e.id)),c=o.stories.flatMap(e=>e.sourceRefs).filter(e=>!s.has(e));return JSON.stringify({ok:!0,added:Math.max(0,o.stories.length-t),total:o.stories.length,stories:o.stories.map(({id:e,title:t,priority:n})=>({id:e,title:t,priority:n})),danglingSourceRefs:Array.from(new Set(c)).slice(0,10),note:c.length>0?`有些 sourceRefs 不在需求条目里,覆盖率会算不到;需要的话用真实条目 id 修正。`:`故事已保存。`})}if(e===`req_save_check`){let e=De(i),t=new Map(i.stories.filter(e=>e.title).map(e=>[E(e.title),e.id])),a=new Set(i.stories.map(e=>e.id)),o=Array.isArray(r.gaps)?r.gaps:[],s=[];for(let e of o){let n=e&&typeof e==`object`?e:{},r=T(n.title,200);if(!r)continue;let i=T(n.storyId,20),o=a.has(i)&&i||t.get(E(T(n.storyTitle,200)))||``,c=D(n.type);s.push({id:ve(c,o,r),storyId:o,type:c,severity:Ke(n.severity),title:r,detail:T(n.detail,1e3),suggestion:T(n.suggestion,1e3),origin:`model`,selected:!1})}let c=ae(e.gaps,s),l=T(r.summary,1500)||e.summary;return await n.saveCheck({...e,summary:l,gaps:c}),JSON.stringify({ok:!0,gaps:c.length,high:c.filter(e=>e.severity===`high`).length,coverage:e.coverage,dimensions:e.dimensions.map(e=>({label:e.label,covered:e.covered})),note:`体检报告已保存:整体 ${c.length} 个缺口(高 ${c.filter(e=>e.severity===`high`).length} 个),覆盖率 ${Math.round(e.coverage.rate*100)}%。用户可以在页面上勾选缺口补写。`})}if(e===`req_save_test_points`){let e=Array.isArray(r.points)?r.points:[];if(!e.length)return JSON.stringify({ok:!0,total:i.testPoints?.points.length??0,note:`没有提交测试点,原结果保持不变。`});if(typeof n.saveTestPoints!=`function`)return JSON.stringify({ok:!1,error:`当前上下文不支持保存测试点`});let t=new Set(i.stories.map(e=>e.id)),a=e.slice(0,500).map(e=>j(e,t)).filter(e=>e!==null);if(!a.length)return JSON.stringify({ok:!1,error:`测试点都缺少标题,没有保存`});let o=(await n.saveTestPoints({at:new Date().toISOString(),summary:T(r.summary,2e3),points:a})).testPoints?.points??a,s=O.map(e=>({dimension:le[e],count:o.filter(t=>t.dimension===e).length})),c=v.map(e=>({priority:e,count:o.filter(t=>t.priority===e).length})),l=s.filter(e=>e.count===0).map(e=>e.dimension);return JSON.stringify({ok:!0,total:o.length,byDimension:s,byPriority:c,uncoveredDimensions:l,note:l.length>0?`测试点已保存:整体 ${o.length} 条。${l.join(`、`)}还没有测试点,如确实不适用请在回答里说明。`:`测试点已保存:整体 ${o.length} 条,五个维度都有覆盖。`})}return JSON.stringify({ok:!1,error:`未知工具:${e}`})}function M(e){let t=[],n=/```json\s*([\s\S]*?)```/gi,r;for(;(r=n.exec(e))!==null;)r[1]?.trim()&&t.push(r[1].trim());return t}function Ye(e){let t=M(String(e??``));for(let e of t)try{let t=JSON.parse(e),n=Array.isArray(t)?t:t&&typeof t==`object`&&Array.isArray(t.stories)?t.stories:null;if(!n?.length)continue;let r=n.filter(e=>!!(e&&typeof e==`object`&&typeof e.title==`string`));if(r.length)return r}catch{}return[]}function Xe(e,t=[]){let n=new Set(t),r=M(String(e??``));for(let e of r)try{let t=JSON.parse(e),r=Array.isArray(t)?t:t&&typeof t==`object`&&Array.isArray(t.points)?t.points:null;if(!r?.length)continue;let i=r.map(e=>j(e,n)).filter(e=>e!==null);if(!i.length)continue;let a=t&&typeof t==`object`&&!Array.isArray(t)?T(t.summary,2e3):``;return{at:new Date().toISOString(),summary:a,points:i}}catch{}return null}var N=u(),Ze=`text-xs font-semibold tracking-wide text-stone-500`,P=`inline-flex h-7 items-center justify-center rounded-md bg-[#3370ff] px-2.5 text-xs font-medium text-white transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50`,F=`inline-flex h-7 items-center justify-center rounded-md border border-stone-200 bg-white px-2 text-xs text-stone-600 transition-colors hover:bg-stone-50 disabled:cursor-not-allowed disabled:opacity-50`;function Qe({check:e,stories:t,busy:n,onToggleGap:r,onToggleAll:i,onFix:a,onReview:o,onExport:s}){if(!e)return(0,N.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-xl border border-dashed border-stone-200 px-4 py-16 text-center`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-stone-600`,children:`还没有审查结果`}),(0,N.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-relaxed text-stone-400`,children:`审查会先用固定规则核对覆盖率与字段完整性,再让模型专查场景遗漏与维度缺失(替代流程不成立、验收不可测也会一并报)。`}),(0,N.jsx)(`button`,{type:`button`,className:`mt-4 h-9 rounded-md bg-[#3370ff] px-4 text-sm font-medium text-white transition-opacity hover:opacity-90 disabled:opacity-50`,disabled:n||!t.length,onClick:o,children:`开始审查`})]});let c=_e(e.gaps),l=e.gaps.filter(e=>e.selected).length,u=e.coverage.total?Math.round(e.coverage.rate*100):0,d=Oe(e.gaps),ee=new Map(t.map(e=>[e.id,e.title]));return(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl border border-stone-200 bg-white px-4 py-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:Ze,children:`需求条目覆盖率`}),(0,N.jsxs)(`p`,{className:`mt-0.5 text-lg font-semibold text-stone-800`,children:[e.coverage.covered,(0,N.jsxs)(`span`,{className:`text-sm font-normal text-stone-400`,children:[` / `,e.coverage.total]}),(0,N.jsxs)(`span`,{className:`ml-2 text-sm font-normal text-stone-500`,children:[u,`%`]})]})]}),(0,N.jsxs)(`div`,{className:`min-w-[160px] flex-1`,children:[(0,N.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-stone-100`,children:(0,N.jsx)(`div`,{className:`h-full rounded-full transition-all ${u>=90?`bg-emerald-500`:u>=60?`bg-amber-500`:`bg-red-500`}`,style:{width:`${Math.max(u,e.coverage.total?2:0)}%`}})}),(0,N.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:e.coverage.total?`有故事引用的条目算覆盖;sourceRefs 为空的故事不会计入`:`还没有需求条目,先回「需求分析」做一次拆解`})]}),(0,N.jsxs)(`div`,{className:`text-right`,children:[(0,N.jsx)(`p`,{className:Ze,children:`缺口`}),(0,N.jsxs)(`p`,{className:`mt-0.5 text-lg font-semibold text-stone-800`,children:[e.gaps.length,(0,N.jsxs)(`span`,{className:`ml-1.5 text-xs font-normal text-stone-400`,children:[`高 `,d.high,` · 中 `,d.medium,` · 低 `,d.low]})]})]})]}),e.summary?(0,N.jsx)(`p`,{className:`mt-3 border-t border-stone-100 pt-2 text-xs leading-relaxed text-stone-500`,children:e.summary}):null]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-stone-200 bg-white px-4 py-3`,children:[(0,N.jsx)(`p`,{className:Ze,children:`维度覆盖`}),(0,N.jsx)(`div`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2 lg:grid-cols-3`,children:e.dimensions.map(e=>{let t=e.stories.join(`, `);return(0,N.jsxs)(`div`,{"data-hint-width":!0,className:`min-w-0 rounded-lg border px-2.5 py-1.5 text-xs ${e.covered?`border-emerald-200 bg-emerald-50/60`:`border-stone-200 bg-stone-50`}`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,N.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 ${e.covered?`text-emerald-600`:`text-stone-400`}`,children:e.covered?`✓`:`—`}),(0,N.jsx)(`span`,{className:`shrink-0 whitespace-nowrap font-medium ${e.covered?`text-emerald-800`:`text-stone-500`}`,children:e.label}),(0,N.jsx)(`span`,{className:`ml-auto shrink-0 text-[11px] tabular-nums text-stone-400`,children:e.stories.length?`${e.stories.length} 条`:`未覆盖`})]}),(0,N.jsx)(`div`,{className:`mt-0.5 min-w-0 pl-[18px]`,children:t?(0,N.jsx)(f,{text:t,matchAnchorWidth:!0,className:`block truncate text-[11px] text-stone-400`}):(0,N.jsx)(`span`,{className:`text-[11px] text-stone-300`,children:`没有故事覆盖`})})]},e.key)})})]}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-stone-200 bg-white`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-stone-100 px-4 py-2.5`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-stone-700`,children:`缺口清单`}),(0,N.jsxs)(`span`,{className:`text-xs text-stone-400`,children:[`已选 `,l,` 条`]})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`button`,{type:`button`,className:F,onClick:s,children:`导出 Markdown`}),(0,N.jsx)(`button`,{type:`button`,className:F,onClick:()=>i(l!==e.gaps.length),children:l===e.gaps.length&&e.gaps.length?`清空选择`:`全选`}),(0,N.jsx)(`button`,{type:`button`,className:P,disabled:n||!l,onClick:a,children:`补写选中缺口`})]})]}),c.length?(0,N.jsx)(`div`,{className:`divide-y divide-stone-100`,children:c.map(e=>(0,N.jsxs)(`section`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 bg-stone-50/60 px-4 py-1.5`,children:[(0,N.jsx)(`p`,{className:`text-xs font-semibold text-stone-600`,children:e.label}),(0,N.jsx)(`span`,{className:`rounded bg-white px-1.5 py-0.5 text-[11px] text-stone-500`,children:e.gaps.length}),(0,N.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:e.hint})]}),(0,N.jsx)(`ul`,{className:`divide-y divide-stone-100`,children:e.gaps.map(e=>(0,N.jsx)(I,{gap:e,storyTitle:ee.get(e.storyId)??``,onToggle:r},e.id))})]},e.key))}):(0,N.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-stone-400`,children:`没有发现缺口。覆盖率与维度都过了,可以再人工过一遍验收标准。`})]})]})}function I({gap:e,storyTitle:t,onToggle:n}){return(0,N.jsxs)(`li`,{className:`flex items-start gap-2.5 px-4 py-2.5`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`mt-1 h-3.5 w-3.5 shrink-0 accent-[#3370ff]`,checked:e.selected,onChange:t=>n(e.id,t.target.checked)}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,N.jsx)(S,{tone:ye[e.severity],children:x[e.severity]}),(0,N.jsx)(`span`,{className:`rounded bg-stone-100 px-1.5 py-0.5 text-[11px] text-stone-500`,children:Ee[e.type]}),e.storyId?(0,N.jsxs)(`span`,{className:`font-mono text-[11px] text-stone-400`,children:[e.storyId,t?` · ${t}`:``]}):(0,N.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:`全局`}),(0,N.jsx)(`span`,{className:`text-[11px] text-stone-300`,children:e.origin===`model`?`模型`:`规则`})]}),(0,N.jsx)(`p`,{className:`mt-0.5 text-sm text-stone-800`,children:e.title}),e.detail?(0,N.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-stone-500`,children:e.detail}):null,e.suggestion?(0,N.jsxs)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-amber-700`,children:[`建议:`,e.suggestion]}):null]})]})}var L=`inline-flex h-7 items-center justify-center rounded-md border border-stone-200 bg-white px-2 text-xs text-stone-600 transition-colors hover:bg-stone-50 disabled:cursor-not-allowed disabled:opacity-50`,R=`text-xs font-semibold tracking-wide text-stone-500`;function $e({point:e}){return(0,N.jsxs)(`div`,{className:`space-y-1 text-[11px] leading-relaxed text-stone-500`,children:[e.precondition?(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`span`,{className:`text-stone-400`,children:`前置:`}),e.precondition]}):null,e.steps.length?(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`text-stone-400`,children:`步骤:`}),(0,N.jsx)(`ol`,{className:`mt-0.5 list-decimal space-y-0.5 pl-4`,children:e.steps.map((e,t)=>(0,N.jsx)(`li`,{children:e},t))})]}):null,e.expected?(0,N.jsxs)(`p`,{children:[(0,N.jsx)(`span`,{className:`text-stone-400`,children:`预期:`}),e.expected]}):null]})}function et({doc:e}){let t=_(e.testPoints);return(0,N.jsx)(`div`,{className:`overflow-x-auto pb-1`,children:(0,N.jsxs)(`div`,{className:`min-w-[860px]`,children:[(0,N.jsx)(`div`,{className:`flex justify-center`,children:(0,N.jsxs)(`div`,{className:`rounded-xl border border-stone-200 bg-white px-4 py-2.5 text-center shadow-sm`,children:[(0,N.jsx)(`p`,{className:`text-sm font-semibold text-stone-800`,children:e.title||`未命名分析`}),(0,N.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-stone-400`,children:[`测试点 `,e.testPoints?.points.length??0,` 条 · 五维覆盖`]})]})}),(0,N.jsx)(`div`,{className:`mx-auto h-4 w-px bg-stone-200`,"aria-hidden":`true`}),(0,N.jsxs)(`div`,{className:`relative`,children:[(0,N.jsx)(`div`,{className:`absolute top-0 right-[10%] left-[10%] h-px bg-stone-200`,"aria-hidden":`true`}),(0,N.jsx)(`div`,{className:`grid grid-cols-5 gap-3`,children:t.map(e=>{let t=b[e.key];return(0,N.jsxs)(`div`,{className:`flex flex-col`,children:[(0,N.jsx)(`div`,{className:`mx-auto h-4 w-px bg-stone-200`,"aria-hidden":`true`}),(0,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col rounded-xl border border-stone-200 bg-white`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-1 border-b border-stone-100 px-2.5 py-2`,children:[(0,N.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${t.accent}`,"aria-hidden":`true`}),(0,N.jsx)(`span`,{className:`truncate text-xs font-medium text-stone-700`,children:t.label})]}),(0,N.jsx)(`span`,{className:`shrink-0 text-[10px] tabular-nums text-stone-400`,children:e.points.length})]}),(0,N.jsx)(`div`,{className:`space-y-1.5 px-2 py-2`,children:e.points.length?e.points.map(e=>(0,N.jsxs)(`div`,{className:`rounded-lg border border-stone-100 bg-stone-50/60 px-2 py-1.5`,children:[(0,N.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,N.jsx)(S,{tone:g[e.priority].tone,children:e.priority}),(0,N.jsx)(`p`,{className:`min-w-0 flex-1 text-[11px] leading-snug text-stone-700`,children:e.title})]}),(0,N.jsx)(f,{text:`${e.storyId||`全局`}${e.expected?` · ${e.expected}`:``}`,className:`mt-1 block truncate text-[10px] text-stone-400`})]},e.id)):(0,N.jsx)(`p`,{className:`py-2 text-center text-[11px] text-stone-300`,children:`无`})})]})]},e.key)})})]}),(0,N.jsx)(`p`,{className:`mt-3 text-center text-[11px] text-stone-400`,children:`分支 = 五个维度,叶子 = 测试点;左侧标签为优先级。需要完整结构可导出 XMind。`})]})})}function tt({doc:e}){let t=_(e.testPoints);return(0,N.jsx)(`div`,{className:`space-y-3`,children:t.map(e=>(0,N.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-stone-100 px-3.5 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${b[e.key].accent}`,"aria-hidden":`true`}),(0,N.jsx)(`span`,{className:`text-sm font-medium text-stone-700`,children:e.label}),(0,N.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-stone-400`,children:e.hint})]}),(0,N.jsx)(`span`,{className:`shrink-0 text-[11px] tabular-nums text-stone-400`,children:e.points.length})]}),e.points.length?(0,N.jsx)(`ul`,{className:`divide-y divide-stone-100`,children:e.points.map(e=>(0,N.jsx)(`li`,{children:(0,N.jsxs)(`details`,{className:`group px-3.5 py-2`,children:[(0,N.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-start gap-2`,children:[(0,N.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:(0,N.jsx)(S,{tone:g[e.priority].tone,children:e.priority})}),(0,N.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,N.jsx)(`span`,{className:`block text-sm text-stone-800`,children:e.title}),(0,N.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1.5 text-[11px] text-stone-400`,children:[(0,N.jsx)(`span`,{className:`font-mono`,children:e.storyId||`全局`}),(0,N.jsx)(`span`,{className:`text-stone-300`,children:`·`}),(0,N.jsxs)(`span`,{children:[e.steps.length,` 步`]}),e.expected?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{className:`text-stone-300`,children:`·`}),(0,N.jsx)(f,{text:e.expected,className:`min-w-0 flex-1 truncate`})]}):null]})]}),(0,N.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[11px] text-stone-300 group-open:hidden`,children:`展开`}),(0,N.jsx)(`span`,{className:`mt-0.5 hidden shrink-0 text-[11px] text-stone-300 group-open:inline`,children:`收起`})]}),(0,N.jsx)(`div`,{className:`mt-1.5 border-l-2 border-stone-100 pl-2.5`,children:(0,N.jsx)($e,{point:e})})]})},e.id))}):(0,N.jsx)(`p`,{className:`px-3.5 py-3 text-xs text-stone-400`,children:`本维度没有测试点。`})]},e.key))})}function nt({doc:e,generating:t,busy:n,promptReady:r,onGenerate:i,onExportXmind:a,onExportMarkdown:o}){let[s,c]=(0,w.useState)(`map`),l=e.testPoints,u=de(l);if(!l){let n=e.stories.length?r?``:`「测试点生成提示词.md」还没就绪,重新打开插件会自动补齐`:`还没有用户故事,先做一次拆解`;return(0,N.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-xl border border-dashed border-stone-200 px-4 py-16 text-center`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-stone-600`,children:`还没有测试点`}),(0,N.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-relaxed text-stone-400`,children:`基于拆好的用户故事,按功能 / 边界值 / 异常 / 业务规则 / 非功能五个维度拆测试点,每条标 P0–P3;结果可看导图、可下载 XMind。`}),n?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-amber-700`,children:n}):null,(0,N.jsx)(`p`,{className:`mt-3 text-xs text-stone-400`,children:t?`正在生成测试点,完成后会自动出现在这里。`:`用左栏的「生成测试点」开始拆。`})]})}return(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 rounded-xl border border-stone-200 bg-white px-3.5 py-2`,children:[(0,N.jsxs)(`span`,{className:`text-xs text-stone-500`,children:[`共 `,(0,N.jsx)(`span`,{className:`font-medium text-stone-700`,children:u.total}),` 条`]}),(0,N.jsx)(`span`,{className:`flex items-center gap-1`,children:v.map(e=>(0,N.jsxs)(S,{tone:g[e].tone,children:[e,` `,u.byPriority[e]]},e))}),(0,N.jsxs)(`span`,{className:`text-xs text-stone-400`,children:[`维度覆盖 `,u.coveredDimensions,`/5`]}),(0,N.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`flex overflow-hidden rounded-md border border-stone-200`,children:[{id:`map`,label:`导图`},{id:`list`,label:`列表`}].map(e=>(0,N.jsx)(`button`,{type:`button`,className:`h-7 px-2.5 text-xs transition-colors ${s===e.id?`bg-[#eef3ff] font-medium text-[#1f4fd8]`:`bg-white text-stone-500 hover:bg-stone-50`}`,onClick:()=>c(e.id),children:e.label},e.id))}),(0,N.jsx)(`button`,{type:`button`,className:L,disabled:n,onClick:i,children:t?`生成中…`:`重新生成`}),(0,N.jsx)(`button`,{type:`button`,className:L,disabled:n,onClick:a,children:`导出 XMind`}),(0,N.jsx)(`button`,{type:`button`,className:L,disabled:n,onClick:o,children:`导出 Markdown`})]})]}),s===`map`?(0,N.jsx)(et,{doc:e}):(0,N.jsx)(tt,{doc:e}),(0,N.jsxs)(`div`,{className:`rounded-xl border border-stone-200 bg-white px-3.5 py-2.5`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,N.jsx)(`p`,{className:R,children:`生成说明`}),(0,N.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:l.at})]}),(0,N.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-xs leading-relaxed text-stone-600`,children:l.summary||`(模型没有给整体结论)`})]})]})}var rt=[{value:`P0`,label:`P0 · 必须做`},{value:`P1`,label:`P1 · 应该做`},{value:`P2`,label:`P2 · 可以做`}],z=`h-9 w-full rounded-md border border-stone-200 bg-white px-2 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff] placeholder:text-stone-400`,B=`w-full resize-y rounded-md border border-stone-200 bg-white px-2 py-1.5 text-sm text-stone-800 outline-none transition-colors focus:border-[#3370ff] placeholder:text-stone-400`,V=`text-xs font-semibold tracking-wide text-stone-500`,H=`text-[11px] font-medium tracking-wide text-stone-400`,it={P0:`bg-red-400`,P1:`bg-amber-400`,P2:`bg-stone-300`};function U({label:e,children:t}){return(0,N.jsxs)(`div`,{className:`grid gap-1 sm:grid-cols-[88px_minmax(0,1fr)] sm:gap-3`,children:[(0,N.jsx)(`p`,{className:`${H} pt-0.5`,children:e}),(0,N.jsx)(`div`,{className:`min-w-0 text-[13px] leading-relaxed text-stone-700`,children:t})]})}function W(e){return e.split(`
8
- `).map(e=>e.trim()).filter(Boolean)}function at({label:e,value:t,placeholder:n,onChange:r}){return(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsxs)(`span`,{className:V,children:[e,`(一行一条)`]}),(0,N.jsx)(`textarea`,{className:`${B} mt-1 min-h-[64px]`,value:t.join(`
9
- `),placeholder:n,onChange:e=>r(W(e.target.value))})]})}function ot({value:e,onChange:t}){return(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsx)(`span`,{className:V,children:`主流程(一行一步:动作 -> 结果)`}),(0,N.jsx)(`textarea`,{className:`${B} mt-1 min-h-[80px]`,value:e.map(e=>e.result?`${e.action} -> ${e.result}`:e.action).join(`
10
- `),placeholder:`填写申请单 -> 进入待审批`,onChange:e=>t(W(e.target.value).map(e=>{let t=e.indexOf(`->`)>=0?e.indexOf(`->`):e.indexOf(`→`);return t<0?{action:e}:{action:e.slice(0,t).trim(),result:e.slice(t+(e.startsWith(`->`,t)?2:1)).trim()}}))})]})}function st({value:e,onChange:t}){let n=e.map(e=>[`${e.name} | ${e.trigger}`,...e.steps.map((e,t)=>`${t+1}. ${e}`)].join(`
11
- `)).join(`
12
-
13
- `);return(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsx)(`span`,{className:V,children:`替代流程(空行分段:名称 | 触发条件,下面写步骤)`}),(0,N.jsx)(`textarea`,{className:`${B} mt-1 min-h-[80px]`,value:n,placeholder:`转人工审批 | 金额超过 5 万
14
- 1. 提交后进入人工队列
15
- 2. 审批通过再继续`,onChange:e=>t(e.target.value.split(/\n{2,}/).map(e=>{let t=e.split(`
16
- `).map(e=>e.trim()).filter(Boolean),[n,r]=(t.shift()??``).split(`|`);return{name:(n??``).trim()||`替代流程`,trigger:(r??``).trim(),steps:t.map(e=>e.replace(/^\d+[.、)]\s*/,``))}}).filter(e=>e.name!==`替代流程`||e.steps.length||e.trigger))})]})}function ct({value:e,onChange:t}){return(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsx)(`span`,{className:V,children:`异常场景(一行一条:场景 -> 预期)`}),(0,N.jsx)(`textarea`,{className:`${B} mt-1 min-h-[80px]`,value:e.map(e=>e.expected?`${e.scenario} -> ${e.expected}`:e.scenario).join(`
17
- `),placeholder:`提交时网络中断 -> 提示重试并保留草稿`,onChange:e=>t(W(e.target.value).map(e=>{let t=e.indexOf(`->`)>=0?e.indexOf(`->`):e.indexOf(`→`);return t<0?{scenario:e,expected:``}:{scenario:e.slice(0,t).trim(),expected:e.slice(t+(e.startsWith(`->`,t)?2:1)).trim()}}))})]})}function lt({value:e,onChange:t}){return(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsx)(`span`,{className:V,children:`验收标准(一行一条:Given | When | Then)`}),(0,N.jsx)(`textarea`,{className:`${B} mt-1 min-h-[80px]`,value:e.map(e=>`${e.given} | ${e.when} | ${e.then}`).join(`
18
- `),placeholder:`已登录且有权限 | 提交申请单 | 列表里出现一条待审批记录`,onChange:e=>t(W(e.target.value).map(e=>{let[t=``,n=``,r=``]=e.split(`|`).map(e=>e.trim());return{given:t,when:n,then:r}}))})]})}function ut({story:e,index:t,total:n,gaps:r,busy:i,onSave:a,onDelete:o,onMove:s,domId:c}){let[l,u]=(0,w.useState)(!1),[d,f]=(0,w.useState)(!1),[p,m]=(0,w.useState)(e),[te,ne]=(0,w.useState)(!1);(0,w.useEffect)(()=>{if(l||d){ne(!0);return}let e=window.setTimeout(()=>ne(!1),200);return()=>window.clearTimeout(e)},[l,d]);let re=()=>{m({...e}),f(!0),u(!0)},h=e=>m(t=>({...t,...e})),ie=r.filter(e=>e.severity===`high`).length;return(0,N.jsxs)(`li`,{id:c,className:`overflow-hidden rounded-xl border bg-white transition-colors ${l||d?`border-stone-200 shadow-sm`:`border-stone-200 hover:border-stone-300`}`,children:[(0,N.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":l,"aria-label":l?`收起 ${e.id}`:`展开 ${e.id}`,className:`flex cursor-pointer items-start gap-3 px-3.5 py-3 outline-none transition-colors hover:bg-stone-50/70 focus-visible:bg-stone-50/70`,onClick:()=>u(e=>!e),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u(e=>!e))},children:[(0,N.jsx)(`span`,{className:`mt-1 h-9 w-[3px] shrink-0 rounded-full ${it[e.priority]}`,"aria-hidden":`true`}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`rounded bg-stone-100 px-1.5 py-0.5 font-mono text-[11px] text-stone-500`,children:e.id||`待编号`}),(0,N.jsx)(S,{tone:xe[e.priority],children:e.priority}),(0,N.jsx)(`span`,{className:`truncate text-sm font-medium text-stone-800`,children:e.title}),r.length>0?(0,N.jsxs)(S,{tone:ie?`red`:`amber`,children:[r.length,` 个缺口`,ie?` · 高 ${ie}`:``]}):null]}),(0,N.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs text-stone-500`,children:[e.role&&`角色:${e.role}`,e.goal&&`目标:${e.goal}`].filter(Boolean).join(` · `)||`还没有写角色与目标`}),l?null:(0,N.jsxs)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:[`验收 `,e.acceptance.length,` · 异常 `,e.exceptions.length,` · 维度`,` `,e.dimensions.length]})]}),(0,N.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[(0,N.jsx)(`button`,{type:`button`,className:`rounded p-1 text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-600 disabled:opacity-30`,"aria-label":`上移`,disabled:i||t===0,onClick:()=>s(-1),children:(0,N.jsx)(C,{name:`chevronRight`,size:14,className:`-rotate-90`})}),(0,N.jsx)(`button`,{type:`button`,className:`rounded p-1 text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-600 disabled:opacity-30`,"aria-label":`下移`,disabled:i||t>=n-1,onClick:()=>s(1),children:(0,N.jsx)(C,{name:`chevronRight`,size:14,className:`rotate-90`})}),(0,N.jsx)(`button`,{type:`button`,className:`rounded p-1 text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-600`,"aria-label":d?`取消编辑`:`编辑`,onClick:()=>d?f(!1):re(),children:(0,N.jsx)(C,{name:`pencil`,size:14})}),(0,N.jsx)(`button`,{type:`button`,className:`rounded p-1 text-stone-400 transition-colors hover:bg-red-50 hover:text-red-500 disabled:opacity-30`,"aria-label":`删除`,disabled:i,onClick:o,children:(0,N.jsx)(C,{name:`trash`,size:14})}),(0,N.jsx)(C,{name:`chevronRight`,size:14,className:`ml-1 text-stone-300 transition-transform duration-150 ${l||d?`rotate-90`:``}`})]})]}),(0,N.jsx)(`div`,{className:`grid transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none ${l||d?`grid-rows-[1fr]`:`grid-rows-[0fr]`}`,children:(0,N.jsxs)(`div`,{className:`min-h-0 overflow-hidden`,children:[te&&d?(0,N.jsxs)(`div`,{className:`space-y-3 border-t border-stone-100 px-4 py-3`,children:[(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsx)(`span`,{className:V,children:`标题`}),(0,N.jsx)(`input`,{className:`${z} mt-1`,value:p.title,onChange:e=>h({title:e.target.value})})]}),(0,N.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsx)(`span`,{className:V,children:`角色`}),(0,N.jsx)(`input`,{className:`${z} mt-1`,value:p.role,onChange:e=>h({role:e.target.value})})]}),(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsx)(`span`,{className:V,children:`优先级`}),(0,N.jsx)(`div`,{className:`mt-1`,children:(0,N.jsx)(ee,{options:rt,value:p.priority,onChange:e=>h({priority:e}),ariaLabel:`优先级`,flat:!0})})]})]}),(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsx)(`span`,{className:V,children:`目标`}),(0,N.jsx)(`input`,{className:`${z} mt-1`,value:p.goal,onChange:e=>h({goal:e.target.value})})]}),(0,N.jsxs)(`label`,{className:`block`,children:[(0,N.jsx)(`span`,{className:V,children:`价值 / 备注`}),(0,N.jsx)(`input`,{className:`${z} mt-1`,value:p.value,onChange:e=>h({value:e.target.value})})]}),(0,N.jsx)(at,{label:`前置条件`,value:p.preconditions,placeholder:`已登录且拥有申请权限`,onChange:e=>h({preconditions:e})}),(0,N.jsx)(ot,{value:p.mainFlow,onChange:e=>h({mainFlow:e})}),(0,N.jsx)(st,{value:p.altFlows,onChange:e=>h({altFlows:e})}),(0,N.jsx)(ct,{value:p.exceptions,onChange:e=>h({exceptions:e})}),(0,N.jsx)(at,{label:`后置条件`,value:p.postconditions,placeholder:`申请单状态变为待审批`,onChange:e=>h({postconditions:e})}),(0,N.jsx)(lt,{value:p.acceptance,onChange:e=>h({acceptance:e})}),(0,N.jsx)(at,{label:`覆盖维度`,value:p.dimensions,placeholder:`权限、边界值、超时与失败`,onChange:e=>h({dimensions:e})}),(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,N.jsxs)(`span`,{className:`text-xs text-stone-400`,children:[`来源条目:`,e.sourceRefs.join(`、`)||`(未关联)`]}),(0,N.jsxs)(`div`,{className:`flex gap-2`,children:[(0,N.jsx)(`button`,{type:`button`,className:`h-8 rounded-md border border-stone-200 px-3 text-xs text-stone-600 transition-colors hover:bg-stone-50`,onClick:()=>f(!1),children:`取消`}),(0,N.jsx)(`button`,{type:`button`,className:`h-8 rounded-md bg-[#3370ff] px-3 text-xs font-medium text-white transition-opacity hover:opacity-90 disabled:opacity-50`,disabled:i||!p.title.trim(),onClick:()=>{a(p),f(!1)},children:`保存`})]})]})]}):null,te&&!d?(0,N.jsxs)(`div`,{className:`border-t border-stone-100 bg-stone-50/50 px-3.5 py-3.5`,children:[(0,N.jsxs)(`div`,{className:`space-y-3.5`,children:[e.value?(0,N.jsx)(U,{label:`价值`,children:e.value}):null,e.preconditions.length?(0,N.jsx)(U,{label:`前置条件`,children:(0,N.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-4`,children:e.preconditions.map((e,t)=>(0,N.jsx)(`li`,{children:e},t))})}):null,e.mainFlow.length?(0,N.jsx)(U,{label:`主流程`,children:(0,N.jsx)(`ol`,{className:`list-decimal space-y-0.5 pl-4`,children:e.mainFlow.map((e,t)=>(0,N.jsxs)(`li`,{children:[e.actor?(0,N.jsxs)(`span`,{className:`text-stone-500`,children:[e.actor,`:`]}):null,e.action,e.result?(0,N.jsxs)(`span`,{className:`text-stone-500`,children:[` → `,e.result]}):null]},t))})}):null,e.altFlows.length?(0,N.jsx)(U,{label:`替代流程`,children:(0,N.jsx)(`ul`,{className:`space-y-1.5`,children:e.altFlows.map((e,t)=>(0,N.jsxs)(`li`,{children:[(0,N.jsxs)(`p`,{className:`font-medium text-stone-700`,children:[e.name,e.trigger?(0,N.jsxs)(`span`,{className:`font-normal text-stone-500`,children:[`(触发:`,e.trigger,`)`]}):null]}),(0,N.jsx)(`ol`,{className:`mt-0.5 list-decimal space-y-0.5 pl-4 text-stone-600`,children:e.steps.map((e,t)=>(0,N.jsx)(`li`,{children:e},t))})]},t))})}):null,e.exceptions.length?(0,N.jsx)(U,{label:`异常场景`,children:(0,N.jsx)(`ul`,{className:`space-y-0.5`,children:e.exceptions.map((e,t)=>(0,N.jsxs)(`li`,{children:[e.scenario,e.expected?(0,N.jsxs)(`span`,{className:`text-stone-500`,children:[` → `,e.expected]}):null]},t))})}):null,e.postconditions.length?(0,N.jsx)(U,{label:`后置条件`,children:(0,N.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-4`,children:e.postconditions.map((e,t)=>(0,N.jsx)(`li`,{children:e},t))})}):null,e.acceptance.length?(0,N.jsx)(U,{label:`验收标准`,children:(0,N.jsx)(`ul`,{className:`space-y-1`,children:e.acceptance.map((e,t)=>(0,N.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 rounded-md bg-white px-2 py-1 ring-1 ring-stone-100`,children:[(0,N.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:`Given`}),(0,N.jsx)(`span`,{children:e.given||`—`}),(0,N.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:`When`}),(0,N.jsx)(`span`,{children:e.when||`—`}),(0,N.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:`Then`}),(0,N.jsx)(`span`,{className:e.then?`text-stone-800`:`text-red-500`,children:e.then||`(未写)`})]},t))})}):null,e.dimensions.length?(0,N.jsx)(U,{label:`覆盖维度`,children:(0,N.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.dimensions.map(e=>(0,N.jsx)(`span`,{className:`rounded bg-white px-1.5 py-0.5 text-[11px] text-stone-500 ring-1 ring-stone-100`,children:e},e))})}):null,(0,N.jsx)(U,{label:`来源条目`,children:(0,N.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.sourceRefs.length?e.sourceRefs.map(e=>(0,N.jsx)(`span`,{className:`rounded bg-white px-1.5 py-0.5 font-mono text-[11px] text-stone-500 ring-1 ring-stone-100`,children:e},e)):(0,N.jsx)(`span`,{className:`text-amber-600`,children:`未关联(覆盖率会算不到)`})})})]}),r.length?(0,N.jsxs)(`div`,{className:`mt-3 rounded-lg border border-amber-200 bg-amber-50/70 px-3 py-2`,children:[(0,N.jsx)(`p`,{className:`text-xs font-medium text-amber-900`,children:`审查发现的问题`}),(0,N.jsx)(`ul`,{className:`mt-1 space-y-1`,children:r.map(e=>(0,N.jsxs)(`li`,{className:`flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,N.jsx)(S,{tone:ye[e.severity],children:x[e.severity]}),(0,N.jsx)(`span`,{className:`text-stone-500`,children:Ee[e.type]}),(0,N.jsx)(`span`,{className:`text-stone-700`,children:e.title})]},e.id))})]}):null]}):null]})})]})}var dt=`reqanalysis.doc`,ft=`reqanalysis.listmode`,pt=`reqanalysis.view`,mt=`reqanalysis.tab`,ht=`reqanalysis.storykeyword`,gt=[`list`,`work`],_t=[`stories`,`check`,`outline`,`points`],vt=`reqanalysis.activity`,yt=[`info`,`tool`,`done`,`error`];function bt(e){return`${vt}.${e}`}function xt(e){if(!e)return[];let t=l(bt(e),[]);return Array.isArray(t)?t.filter(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`number`&&typeof t.text==`string`&&typeof t.at==`string`&&yt.includes(t.kind)}).slice(-200):[]}var St=/\.[a-z0-9]+$/i,Ct={md:`Markdown`,markdown:`Markdown`,txt:`文本`,csv:`CSV`,docx:`Word`,xlsx:`Excel`,xls:`Excel`,doc:`Word(旧版)`,pdf:`PDF`,ppt:`PPT`,pptx:`PPT`},wt=`inline-flex h-9 items-center justify-center gap-1.5 rounded-md bg-[#3370ff] px-3.5 text-sm font-medium text-white transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50`,Tt=`inline-flex h-9 items-center justify-center gap-1.5 rounded-md border border-stone-200 bg-white px-3 text-sm text-stone-700 transition-colors hover:bg-stone-50 disabled:cursor-not-allowed disabled:opacity-50`,Et=`text-xs font-semibold tracking-wide text-stone-500`;function Dt(e){return e.split(`/`).pop()||e}function Ot(e){return e.replace(St,``)}function kt(e){return(e.format||Dt(e.path).split(`.`).pop()||``).toLowerCase()}function At(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return`—`;let n=e=>String(e).padStart(2,`0`),r=`${n(t.getMonth()+1)}/${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`;return t.getFullYear()===new Date().getFullYear()?r:`${t.getFullYear()}/${r}`}function jt(e){return[...e].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))}function Mt({name:e,ready:t}){return(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(f,{text:e,className:`min-w-0 flex-1 truncate text-xs text-stone-500`}),(0,N.jsx)(`span`,{className:`shrink-0 text-[11px] ${t?`text-emerald-600`:`text-stone-400`}`,children:t?`已就绪`:`未就绪`})]})}function Nt(){let e=ze(`reqAnalysis`),t=ze(`storyReview`),l=ze(`testPoints`),[u,ae]=(0,w.useState)(null),[g,_]=(0,w.useState)([]),[v,le]=(0,w.useState)(``),[b,de]=(0,w.useState)(null),[_e,ve]=(0,w.useState)([]),[ye,xe]=(0,w.useState)(``),[Ee,Oe]=(0,w.useState)(``),[x,We]=(0,w.useState)(null),[Ge,T]=(0,w.useState)(null),[E,Ke]=(0,w.useState)(null),[D,O]=(0,w.useState)(null),[k,A]=(0,w.useState)(null),[j,M]=(0,w.useState)([]),[Ze,P]=(0,w.useState)(``),[F,I]=(0,w.useState)(``),[L,R]=(0,w.useState)(()=>o(mt,_t,`stories`));(0,w.useEffect)(()=>{i(mt,L)},[L]);let[$e,et]=(0,w.useState)(`list`),tt=(0,w.useRef)(o(pt,gt,`list`)),[rt,z]=(0,w.useState)(()=>tt.current===`work`),[B,V]=(0,w.useState)(()=>o(ft,[`doc`,`story`],`doc`)),[H,it]=(0,w.useState)(()=>c(ht,``));(0,w.useEffect)(()=>{s(ht,H)},[H]);let[U,W]=(0,w.useState)(null),[at,ot]=(0,w.useState)([]),st=(0,w.useRef)(``),[ct,lt]=(0,w.useState)(``),[vt,yt]=(0,w.useState)(!1),[St,Nt]=(0,w.useState)(!1),G=(0,w.useRef)(null),K=(0,w.useRef)(null),Pt=(0,w.useRef)(0),Ft=(0,w.useRef)(null),It=(0,w.useRef)(null),Lt=(0,w.useCallback)(e=>t.on||e!==`checked`&&e!==`accepted`?Ae[e]:Ae.decomposed,[t.on]),Rt=(0,w.useMemo)(()=>{let e=e=>+!e.supported;return[..._e].sort((t,n)=>e(t)-e(n)||t.path.localeCompare(n.path,`zh`)).map(e=>{let t=kt(e),n=Ct[t]??t.toUpperCase();return{value:e.path,label:e.path,secondary:e.supported?t:`${n} · 暂不支持,请另存为 .docx / .xlsx / .md`,disabled:!e.supported}})},[_e]),q=(0,w.useCallback)(e=>{G.current=e,de(e),_(t=>jt(t.map(t=>t.id===e.id?e:t)))},[]),J=(0,w.useCallback)((e,t=`info`)=>{Pt.current+=1,M(n=>[...n,{id:Pt.current,kind:t,text:e,at:new Date().toISOString()}])},[]),zt=(0,w.useRef)(!1);(0,w.useEffect)(()=>{if(!v){zt.current=!0,M([]);return}let e=xt(v);Pt.current=e.reduce((e,t)=>Math.max(e,t.id),0),zt.current=!0,M(e)},[v]),(0,w.useEffect)(()=>{zt.current?zt.current=!1:v&&a(bt(v),j.slice(-200))},[j,v]);let Y=(0,w.useCallback)(e=>{G.current=e,de(e),le(e?.id??``),s(dt,e?.id??``),e?.sourcePath&&xe(e.sourcePath)},[]),X=(0,w.useCallback)(e=>{et(e),i(pt,e)},[]),Z=(0,w.useCallback)((e,t=`stories`)=>{Y(e),R(t),X(`work`),Re(`req-analysis`)},[X,Y]),Bt=(0,w.useCallback)((e,t)=>{st.current=t,Z(e,`stories`)},[Z]);(0,w.useEffect)(()=>{if($e!==`work`||!st.current)return;let e=st.current;st.current=``;let t=0,n=requestAnimationFrame(()=>{let n=document.getElementById(`req-story-${e}`);n&&(n.scrollIntoView({block:`center`,behavior:`smooth`}),n.classList.add(`tw-req-story-focus`),t=window.setTimeout(()=>n.classList.remove(`tw-req-story-focus`),1600))});return()=>{cancelAnimationFrame(n),t&&window.clearTimeout(t)}},[$e,b?.id]);let Vt=(0,w.useMemo)(()=>g.flatMap(e=>e.stories.map(t=>({doc:e,story:t}))),[g]),Ht=Vt.length,Ut=(0,w.useMemo)(()=>{let e=H.trim().toLowerCase(),t=t=>String(t??``).toLowerCase().includes(e),n=e?Vt.filter(({doc:e,story:n})=>t(n.id)||t(n.title)||t(n.role)||t(n.goal)||t(e.title)):Vt,r=[],i=new Map;for(let e of n){let t=i.get(e.doc.id);t===void 0?(i.set(e.doc.id,r.length),r.push({doc:e.doc,rows:[e]})):r[t].rows.push(e)}return r.sort((e,t)=>t.doc.updatedAt.localeCompare(e.doc.updatedAt))},[Vt,H]),Wt=(0,w.useMemo)(()=>new Set(U?.ids??[]),[U]),Gt=(0,w.useCallback)((e,t)=>{W(n=>{if(!n||n.docId!==e)return{docId:e,ids:[t]};let r=n.ids.includes(t)?n.ids.filter(e=>e!==t):[...n.ids,t];return r.length?{docId:e,ids:r}:null})},[]),Kt=(0,w.useCallback)((e,t)=>{W(n=>n?.docId===e&&t.every(e=>n.ids.includes(e))?null:t.length?{docId:e,ids:t}:null)},[]),qt=(0,w.useCallback)(e=>{V(e),i(ft,e)},[]);(0,w.useEffect)(()=>{let e=!0;(async()=>{if(await n(),!e)return;We(ne());let t=await Ne();if(e&&(ae(t),t))try{let[t,n,r,i]=await Promise.all([Fe(),Ie(),we(),he()]);if(!e)return;let a=n;if((!n.exists||!n.decompose.trim())&&(await h(!0).catch(()=>void 0),a=await Ie()),!e)return;T(a);let o=r;if((!r.exists||!r.review.trim())&&(await ke(!0).catch(()=>void 0),o=await we()),!e)return;o.exists&&Ke(o),i.exists&&O(i);let s=jt(t);_(s);let l=c(dt,``),u=s.find(e=>e.id===l)??s[0]??null;Y(u);let d=tt.current;tt.current=`list`,d===`work`&&u&&l&&u.id===l&&(X(`work`),Re(`req-analysis`)),z(!1)}catch(t){e&&(z(!1),I(t instanceof Error?t.message:String(t)))}})();let t=te(()=>We(ne()));return()=>{e=!1,t()}},[X,Y]),(0,w.useEffect)(()=>{if(!t.ready)return;if(!t.on){Ke(null),R(e=>e===`check`?`stories`:e);return}if(!u||E!==null)return;let e=!0;return(async()=>{let t=await we();(!t.exists||!t.review.trim())&&(await ke(!0).catch(()=>void 0),t=await we()),e&&Ke(t)})(),()=>{e=!1}},[t.ready,t.on,u,E]),(0,w.useEffect)(()=>{if(!l.ready)return;if(!l.on){O(null),R(e=>e===`points`?`stories`:e);return}if(!u||D!==null)return;let e=!0;return(async()=>{let t=await he();(!t.exists||!t.generate.trim())&&(await me(!0).catch(()=>void 0),t=await he()),e&&O(t)})(),()=>{e=!1}},[l.ready,l.on,u,D]),(0,w.useEffect)(()=>{if(!u)return;let e=!0;return fe().then(t=>{e&&ve(t)}).catch(t=>{e&&Oe(t instanceof Error?t.message:String(t))}),()=>{e=!1}},[u]),(0,w.useEffect)(()=>{let e=b?.sourcePath;if(!e){lt(``);return}let t=!0;return se(e).then(e=>{t&&lt(oe(e))}).catch(()=>{t&&lt(``)}),()=>{t=!1}},[b?.sourcePath,b?.sourceHash]),(0,w.useEffect)(()=>{let e=Ft.current;e&&(e.scrollTop=e.scrollHeight)},[j]);let Jt=!!(b?.sourceHash&&ct&&b.sourceHash!==ct),Yt=(0,w.useMemo)(()=>new Set((b?.stories??[]).flatMap(e=>e.sourceRefs)),[b?.stories]),Xt=Ge??null,Zt=!!Xt?.decompose.trim(),Qt=(0,w.useMemo)(()=>(b?.check?.gaps??[]).filter(e=>e.selected).length,[b?.check]),Q=(0,w.useCallback)(async(e,t)=>{let n=t??G.current;if(!n)throw Error(`还没有分析文档`);let r=await y(n.id,e);return q(r),r},[q]),$t=(0,w.useCallback)(()=>{It.current&&window.clearTimeout(It.current),It.current=window.setTimeout(()=>{let e=G.current;e?.check&&y(e.id,{check:e.check}).catch(()=>void 0)},600)},[]),en=(0,w.useCallback)(async e=>{if(!e)return null;let t=g.find(t=>t.sourcePath===e);if(t)return Z(t,`stories`),t;try{let t=await se(e),n=Dt(e),r=await Ce({sourcePath:e,sourceTitle:n,sourceHash:oe(t),title:Ot(n)});return _(e=>jt([r,...e])),Z(r,`stories`),J(`新建分析:${r.title}`),r}catch(e){let t=e instanceof Error?e.message:String(e);return I(t),p(t,`error`),xe(G.current?.sourcePath??``),null}},[g,Z,J]),tn=!!(x?.baseURL&&x.apiKey&&x.model),nn=(0,w.useCallback)(()=>!tn||!x?(p(`请先在设置里配置模型`,`error`),re(`model`),null):x,[tn,x]),$=(0,w.useCallback)((e,t)=>({getDoc:()=>G.current,batch:t,saveOutline:async t=>{let n=await y(e.id,{outline:t});return q(n),n.outline},saveStories:async t=>{let n=await y(e.id,{stories:t});return q(n),J(`已写入 ${n.stories.length} 个用户故事`),n},saveCheck:async t=>{let n=G.current?.check,r={...t,gaps:pe(n?.gaps??[],t.gaps)},i=await y(e.id,{check:r,status:`checked`});return q(i),i},saveTestPoints:async t=>{let n=await y(e.id,{testPoints:t});return q(n),n}}),[q,J]),rn=(0,w.useCallback)(async()=>{let e=G.current,n=nn();if(!e||!n)return;let r=Xt?.decompose.trim()??``;if(!r){p(`没有读到「${be}」的「## 拆解」段落`,`error`);return}I(``),P(``),M([]),A(`decompose`);let i=new AbortController;K.current=i;try{let a=await y(e.id,{status:`draft`,progress:{stage:`stories`,done:0,total:0,message:`正在读取来源文档`,at:new Date().toISOString()}});q(a);let o=await se(e.sourcePath);if(!o.trim())throw Error(`来源文档是空的`);let s=ue(o);if(!s.length)throw Error(`来源文档没有可拆解的内容`);J(s.length>1?`来源 ${o.length} 字,已分 ${s.length} 批拆解`:`来源 ${o.length} 字,单批拆解`);let c=await y(e.id,{replaceStories:!0,stories:[],outline:[],check:null,status:`draft`,sourceHash:oe(o)});q(c);for(let t of s){if(i.signal.aborted)break;let a=G.current?.stories.length??0,o=[r,``,Ue,``,`## 已抽取的需求条目(sourceRefs 只能引用这些 id)`,(G.current?.outline??[]).map(e=>`- ${e.id} ${e.title}${e.quote?`(原文:${e.quote})`:``}`).join(`
19
- `)||`(本批还没有条目,先调用 req_set_outline)`].join(`
20
- `),c=[`这一批是原始需求的第 ${t.index+1}/${s.length} 段${t.title?`(章节:${t.title})`:``}。只处理这一段的条目与故事,已完成的部分不要重写。`,``,`## 原始需求`,``,t.text].join(`
21
- `);await Q({progress:{stage:`stories`,done:t.index,total:s.length,message:`正在拆第 ${t.index+1}/${s.length} 批`,at:new Date().toISOString()}},G.current).catch(()=>void 0);let l=``;for await(let r of m(n,[{role:`system`,content:o},{role:`user`,content:c}],i.signal,{tools:qe,maxToolRounds:20,runTool:(n,r)=>Je(n,r,$(e,t.index))}))r.type===`content`?(l+=r.delta,P(e=>e+r.delta)):r.type===`tool`&&r.status===`running`&&J(`调用 ${r.name}`,`tool`);if((G.current?.stories.length??0)===a){let n=Ye(l);if(n.length){let t=Pe(G.current?.stories??[],n),r=await y(e.id,{stories:t});q(r),J(`模型没调工具,已从回答里兜底解析 ${n.length} 个故事`,`info`)}else J(`第 ${t.index+1} 批没有拿到结构化故事`,`error`)}}if(i.signal.aborted){J(`已中断:已经写入的故事保留`,`info`);return}let l=await y(e.id,{status:`decomposed`,progress:{stage:`done`,done:s.length,total:s.length,message:`拆解完成`,at:new Date().toISOString()}});q(l),J(`拆解完成:${l.outline.length} 条需求条目、${l.stories.length} 个用户故事`,`done`),R(`stories`),t.on&&!i.signal.aborted?(p(`拆解完成,接着做用户故事审查`,`success`),await on.current?.(!0)):p(`拆解完成`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);i.signal.aborted?J(`已中断:已经写入的故事保留`,`info`):(I(t),J(`拆解失败:${t}`,`error`))}finally{A(null),K.current=null}},[$,q,J,Xt,nn,t.on,Q]),an=(0,w.useCallback)(async(e=!1)=>{let t=G.current;if(!t)return;if(!t.stories.length){e||p(`还没有用户故事,先做一次拆解`,`info`);return}I(``),e||(P(``),M([])),A(`audit`);let n=new AbortController;K.current=n;try{let e=De(t),r=await y(t.id,{check:{...e,gaps:pe(t.check?.gaps??[],e.gaps)},status:`checked`,progress:{stage:`audit`,done:0,total:1,message:`规则体检完成,等待模型评审`,at:new Date().toISOString()}});q(r),J(`规则体检:覆盖率 ${Math.round(e.coverage.rate*100)}%,${e.gaps.length} 个缺口`);let i=E?.review.trim()??``,a=tn?x:null;if(!a||!i){J(a?`「用户故事审查提示词.md」缺少「## 审查」段落,只保留规则结果`:`没有配置模型,只保留规则结果`,`info`),R(`check`);return}let o=!1,s=$(t,90),c=s.saveCheck;s.saveCheck=async e=>{o=!0;let t=await c(e);return J(`模型体检:整体 ${t.check?.gaps.length??0} 个缺口`,`done`),t};let l=G.current??r,u=[`## 需求条目`,l.outline.length?l.outline.map(e=>`- ${e.id} ${e.title}${e.quote?`(原文:${e.quote})`:``}`).join(`
22
- `):`(无)`,``,`## 用户故事(${l.stories.length} 条)`,"```json",JSON.stringify(l.stories,null,2),"```"].join(`
23
- `);for await(let e of m(a,[{role:`system`,content:`${i}\n\n${Ue}`},{role:`user`,content:u}],n.signal,{tools:qe.filter(e=>e.function.name===`req_save_check`),maxToolRounds:8,runTool:(e,t)=>Je(e,t,s)}))e.type===`content`?P(t=>t+e.delta):e.type===`tool`&&e.status===`running`&&J(`调用 ${e.name}`,`tool`);o||(J(`模型没有提交体检结果,当前只保留规则结果`,`error`),p(`模型没有提交体检结果,只保留了规则检查`,`error`)),R(`check`)}catch(e){let t=e instanceof Error?e.message:String(e);n.signal.aborted?J(`已中断:规则体检结果已保留`,`info`):(I(t),J(`体检失败:${t}`,`error`))}finally{A(null),K.current=null}},[$,tn,q,J,E,x]),on=(0,w.useRef)(null);on.current=an;let sn=(0,w.useCallback)(async()=>{let e=G.current,t=nn();if(!e||!t)return;let n=(e.check?.gaps??[]).filter(e=>e.selected);if(!n.length){p(`先在缺口清单里勾选要补写的条目`,`info`);return}let r=E?.fix.trim()??``;if(!r){p(`「用户故事审查提示词.md」缺少「## 补写」段落`,`error`);return}I(``),P(``),M([]),A(`fix`);let i=new AbortController;K.current=i;try{J(`按 ${n.length} 个勾选缺口补写`,`info`);let a=new Map(e.stories.map(e=>[e.id,e.title])),o=[`## 当前故事集(${e.stories.length} 条,没被点名的必须原样保留)`,"```json",JSON.stringify(e.stories,null,2),"```",``,`## 勾选待补写的缺口`,n.map(e=>{let t=e.storyId?`${e.storyId} ${a.get(e.storyId)??``}`:`全局问题`;return[`- [${e.severity}] ${t}|${e.title}`,e.detail?` 原因:${e.detail}`:``,e.suggestion?` 建议:${e.suggestion}`:``].filter(Boolean).join(`
24
- `)}).join(`
25
- `)].join(`
26
- `),s=$(e,90),c=!1,l=s.saveStories;s.saveStories=async e=>(c=!0,l(e));for await(let e of m(t,[{role:`system`,content:`${r}\n\n${Ue}`},{role:`user`,content:o}],i.signal,{tools:qe.filter(e=>e.function.name===`req_set_stories`),maxToolRounds:10,runTool:(e,t)=>Je(e,t,s)}))e.type===`content`?P(t=>t+e.delta):e.type===`tool`&&e.status===`running`&&J(`调用 ${e.name}`,`tool`);if(!c){J(`模型没有提交补写结果,故事集保持不变`,`error`),p(`模型没有提交补写结果`,`error`);return}let u=G.current;if(u){let e=De(u),t=await y(u.id,{check:e,status:`decomposed`});q(t)}J(`补写完成,已按规则重算覆盖率;建议再跑一次体检`,`done`),R(`check`),p(`补写完成,建议再跑一次体检`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);i.signal.aborted?J(`已中断:已经写入的改动保留`,`info`):(I(t),J(`补写失败:${t}`,`error`))}finally{A(null),K.current=null}},[$,q,J,nn,E]),cn=(0,w.useCallback)(async()=>{let e=G.current,t=nn();if(!e||!t)return;if(!e.stories.length){p(`还没有用户故事,先做一次拆解`,`info`);return}let n=D?.generate.trim()??``;if(!n){p(`没有读到「${ce}」的「## 生成」段落`,`error`);return}I(``),P(``),M([]),A(`testpoints`),J(`开始生成测试点(五维覆盖,P0–P3)`,`info`);let r=new AbortController;K.current=r;try{let i=$(e,90),a=!1,o=i.saveTestPoints;i.saveTestPoints=async e=>{a=!0;let t=await o(e);return J(`测试点已写入:${t.testPoints?.points.length??0} 条`,`done`),t};let s=[`## 分析标题\n${e.title||`未命名分析`}`,``,`## 需求条目`,e.outline.length?e.outline.map(e=>`- ${e.id} ${e.title}${e.quote?`(原文:${e.quote})`:``}`).join(`
27
- `):`(无)`,``,`## 用户故事(${e.stories.length} 条)`,"```json",JSON.stringify(e.stories,null,2),"```"].join(`
28
- `),c=``;for await(let e of m(t,[{role:`system`,content:`${n}\n\n${Ue}`},{role:`user`,content:s}],r.signal,{tools:qe.filter(e=>e.function.name===`req_save_test_points`),maxToolRounds:8,runTool:(e,t)=>Je(e,t,i)}))e.type===`content`?(c+=e.delta,P(t=>t+e.delta)):e.type===`tool`&&e.status===`running`&&J(`调用 ${e.name}`,`tool`);if(!a){let t=Xe(c,e.stories.map(e=>e.id));t&&(await i.saveTestPoints(t),a=!0,J(`模型没调工具,已从回答里兜底解析 ${t.points.length} 条`,`info`))}if(!a)J(`模型没有提交测试点,原结果保持不变`,`error`),p(`模型没有提交测试点,原结果保持不变`,`error`);else{let e=G.current?.testPoints?.points??[],t=t=>e.filter(e=>e.priority===t).length;J(`测试点完成:${e.length} 条(P0 ${t(`P0`)} / P1 ${t(`P1`)} / P2 ${t(`P2`)} / P3 ${t(`P3`)})`,`done`),p(`测试点已生成`,`success`)}R(`points`)}catch(e){let t=e instanceof Error?e.message:String(e);r.signal.aborted?J(`已中断:已经生成的测试点保留`,`info`):(I(t),J(`生成测试点失败:${t}`,`error`))}finally{A(null),K.current=null}},[$,J,nn,D]),ln=(0,w.useCallback)(async()=>{let e=G.current;if(!e?.testPoints)p(`还没有测试点可导出`,`info`);else try{let t=await ie(e);J(`已导出 ${t}`,`done`)}catch(e){p(`导出失败:${e instanceof Error?e.message:String(e)}`,`error`)}},[J]),un=(0,w.useCallback)(()=>{let e=G.current;if(!e?.testPoints){p(`还没有测试点可导出`,`info`);return}let t=Le(e);J(`已导出 ${t}`,`done`)},[J]),dn=(0,w.useCallback)(async e=>{let t=G.current;if(t)try{await Q({stories:e},t)}catch(e){p(`保存失败:${e instanceof Error?e.message:String(e)}`,`error`)}},[Q]),fn=(0,w.useCallback)((e,t)=>{let n=G.current;if(!n)return;let r=n.stories.map((n,r)=>r===e?{...t,id:n.id}:n);dn(r)},[dn]),pn=(0,w.useCallback)(e=>{let t=G.current;t&&dn(t.stories.filter((t,n)=>n!==e))},[dn]),mn=(0,w.useCallback)((e,t)=>{let n=G.current;if(!n)return;let r=e+t;if(r<0||r>=n.stories.length)return;let i=[...n.stories],a=i[e],o=i[r];a&&o&&(i[e]=o,i[r]=a,dn(i))},[dn]),hn=(0,w.useCallback)((e,t)=>{let n=G.current;if(!n?.check)return;let r={...n,check:{...n.check,gaps:n.check.gaps.map(n=>n.id===e?{...n,selected:t}:n)}};q(r),$t()},[q,$t]),gn=(0,w.useCallback)(e=>{let t=G.current;if(!t?.check)return;let n={...t,check:{...t.check,gaps:t.check.gaps.map(t=>({...t,selected:e}))}};q(n),$t()},[q,$t]),_n=(0,w.useCallback)(e=>{let t=G.current,n=e.trim();t&&n&&n!==t.title&&Q({title:n},t).catch(()=>void 0)},[Q]),vn=(0,w.useCallback)(async()=>{let e=G.current;if(e)try{await Se(e.id);let t=g.filter(t=>t.id!==e.id);_(t),Y(t[0]??null),X(`list`),p(`已删除分析记录`,`success`)}catch(e){p(`删除失败:${e instanceof Error?e.message:String(e)}`,`error`)}finally{yt(!1)}},[X,g,Y]),yn=(0,w.useCallback)(()=>{let e=G.current;if(!e)return;let t=new Blob([Te(e)],{type:`text/markdown;charset=utf-8`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=ge(e),document.body.appendChild(r),r.click(),r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3),p(`已导出 Markdown`,`success`)},[]),bn=(0,w.useCallback)(()=>{let e=G.current;if(!e?.check)return;let t=je(e,e.check);p(`已导出 ${t}`,`success`)},[]),xn=(0,w.useCallback)(()=>{K.current?.abort()},[]);if(!e.ready)return(0,N.jsx)(Ve,{label:`正在读取插件开关`});if(!e.on)return(0,N.jsx)(Be,{children:r(`reqAnalysis`)});if(u===null)return(0,N.jsx)(Ve,{label:`正在连接需求分析服务`});if(!u)return(0,N.jsx)(Be,{children:"需求分析需要本地服务,当前未就绪:确认服务已升级到最新版本并重启(`lantern` 一体服务或 `npm run dev`),静态部署的页面用不了。"});if(rt)return(0,N.jsx)(Ve,{label:`正在回到上次的分析`});let Sn=b?.outline.filter(e=>Yt.has(e.id)).length??0,Cn=b?.check?.gaps??[],wn=b?.progress,Tn=(0,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,N.jsxs)(`section`,{className:`shrink-0 rounded-xl border border-stone-200 bg-white px-4 py-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,N.jsxs)(`div`,{className:`min-w-[240px] flex-1`,children:[(0,N.jsx)(`p`,{className:Et,children:`新建分析`}),(0,N.jsx)(`div`,{className:`mt-1.5 max-w-[440px]`,children:(0,N.jsx)(ee,{options:Rt,value:ye,onChange:e=>{xe(e),e&&en(e)},triggerTitle:ye||`选择来源需求文档…`,ariaLabel:`选择来源需求文档`,searchable:!0,searchPlaceholder:`搜索文件名或路径…`,flat:!0})})]}),(0,N.jsxs)(`span`,{className:`pb-1 text-[11px] text-stone-400`,children:[`共 `,g.length,` 份分析`]})]}),Ee?(0,N.jsxs)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-700`,children:[`读不到需求文档库:`,Ee,(0,N.jsx)(`br`,{}),`请先启用「需求文档库」插件,或确认 `,Me,` 之外的内容目录没有被移动。`]}):null]}),F?(0,N.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700`,children:[(0,N.jsx)(`span`,{className:`break-all`,children:F}),(0,N.jsx)(`button`,{type:`button`,className:`shrink-0 text-red-400`,onClick:()=>I(``),children:`✕`})]}):null,(0,N.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,N.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-stone-100 px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`inline-flex rounded-lg border border-stone-200 bg-stone-50 p-0.5`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>qt(`doc`),className:`h-7 rounded-md px-2.5 text-xs transition-colors ${B===`doc`?`bg-white text-stone-900 shadow-sm`:`text-stone-500 hover:text-stone-700`}`,children:`按需求说明书`}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>qt(`story`),className:`h-7 rounded-md px-2.5 text-xs transition-colors ${B===`story`?`bg-white text-stone-900 shadow-sm`:`text-stone-500 hover:text-stone-700`}`,children:`按用户故事`})]}),B===`story`?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`label`,{className:`relative block`,children:[(0,N.jsx)(C,{name:`search`,size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-stone-400`}),(0,N.jsx)(`input`,{value:H,onChange:e=>it(e.target.value),placeholder:`搜索编号 / 标题 / 角色…`,className:`h-8 w-52 rounded-lg border border-stone-200 bg-white pl-8 pr-3 text-xs text-stone-800 outline-none transition-colors focus:border-[#3370ff]`})]}),(0,N.jsxs)(`span`,{className:`text-[11px] text-stone-400`,children:[Ht,` 个故事`,U?` · 已选 ${U.ids.length}`:``]}),(0,N.jsx)(`button`,{type:`button`,disabled:!U,onClick:()=>{if(!U)return;let e=new URLSearchParams({plugin:`caseGen`,reqDoc:U.docId,stories:U.ids.join(`,`)});window.location.href=`/workbench/?${e.toString()}`},className:`${wt} ml-auto h-8 text-xs`,children:`用选中故事生成用例`})]}):(0,N.jsxs)(`span`,{className:`ml-auto text-[11px] text-stone-400`,children:[g.length,` 份分析 · `,Ht,` 个故事`]})]}),(0,N.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:B===`doc`?g.length?(0,N.jsx)(`ul`,{className:`divide-y divide-stone-100`,children:g.map(e=>{let t=Lt(e.status);return(0,N.jsxs)(`li`,{className:`flex items-center gap-3 px-4 py-3 transition-colors hover:bg-stone-50`,children:[(0,N.jsx)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center text-left`,onClick:()=>Z(e,`stories`),children:(0,N.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,N.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`truncate text-sm font-medium text-stone-800`,children:e.title}),(0,N.jsx)(S,{tone:t.tone,children:t.label})]}),(0,N.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-stone-400`,children:[(0,N.jsx)(`span`,{className:`truncate`,children:e.sourcePath||`(未指定来源)`}),(0,N.jsxs)(`span`,{children:[`用户故事 `,e.stories.length]}),(0,N.jsxs)(`span`,{children:[`需求条目 `,e.outline.length]}),(0,N.jsx)(`span`,{children:At(e.updatedAt)})]})]})}),(0,N.jsxs)(`button`,{type:`button`,className:`inline-flex h-8 shrink-0 items-center gap-1 rounded-md border border-stone-200 bg-white px-2.5 text-xs text-stone-700 transition-colors hover:border-[#3370ff] hover:text-[#3370ff]`,onClick:()=>Z(e,`stories`),children:[`用户故事`,(0,N.jsx)(C,{name:`chevronRight`,size:13})]}),(0,N.jsx)(`button`,{type:`button`,"aria-label":`删除 ${e.title}`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-stone-400 transition-colors hover:bg-red-50 hover:text-red-600`,onClick:()=>{Y(e),yt(!0)},children:(0,N.jsx)(C,{name:`trash`,size:14})})]},e.id)})}):(0,N.jsx)(He,{icon:`file`,title:`还没有分析记录`,hint:`上面选一份需求文档,系统会新建一份分析并进入用户故事拆解。`}):Ut.length?(0,N.jsx)(`div`,{className:`divide-y divide-stone-100`,children:Ut.map(({doc:e,rows:t})=>{let n=at.includes(e.id),r=t.map(e=>e.story.id),i=U?.docId===e.id&&r.length>0&&r.every(e=>Wt.has(e));return(0,N.jsxs)(`section`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 bg-stone-50/70 px-3 py-1.5`,children:[(0,N.jsx)(`input`,{type:`checkbox`,"aria-label":`选中 ${e.title} 的全部故事`,checked:i,onChange:()=>Kt(e.id,r)}),(0,N.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left`,onClick:()=>ot(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id]),children:[(0,N.jsx)(C,{name:n?`chevronRight`:`chevronDown`,size:13,className:`shrink-0 text-stone-400`}),(0,N.jsx)(`span`,{className:`truncate text-xs font-medium text-stone-700`,children:e.title}),(0,N.jsxs)(`span`,{className:`shrink-0 text-[11px] text-stone-400`,children:[t.length,` 个故事 · `,At(e.updatedAt)]})]}),(0,N.jsx)(`button`,{type:`button`,className:`shrink-0 text-[11px] text-[#3370ff] hover:underline`,onClick:()=>Z(e,`stories`),children:`打开拆解`})]}),n?null:(0,N.jsx)(`ul`,{className:`divide-y divide-stone-50`,children:t.map(({story:t})=>(0,N.jsxs)(`li`,{className:`flex items-start gap-2 px-4 py-2 transition-colors hover:bg-stone-50`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`mt-1`,"aria-label":`选中 ${t.id}`,checked:Wt.has(t.id)&&U?.docId===e.id,onChange:()=>Gt(e.id,t.id)}),(0,N.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left`,onClick:()=>Bt(e,t.id),children:[(0,N.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-stone-400`,children:t.id}),(0,N.jsx)(`span`,{className:`truncate text-sm text-stone-800`,children:t.title})]}),(0,N.jsxs)(`span`,{className:`mt-0.5 flex flex-wrap items-center gap-x-2.5 gap-y-0.5 text-[11px] text-stone-400`,children:[t.role?(0,N.jsxs)(`span`,{children:[`角色:`,t.role]}):null,(0,N.jsxs)(`span`,{children:[`优先级 `,t.priority]}),(0,N.jsxs)(`span`,{children:[`验收 `,t.acceptance.length]}),(0,N.jsxs)(`span`,{children:[`异常 `,t.exceptions.length]}),(0,N.jsxs)(`span`,{children:[`维度 `,t.dimensions.length]})]})]})]},`${e.id}-${t.id}`))})]},e.id)})}):(0,N.jsx)(He,{icon:`file`,title:H?`没有匹配的用户故事`:`还没有用户故事`,hint:H?`换个编号、标题或角色再试。`:`先按「需求说明书」选中一份文档拆解,故事会自动出现在这里。`})})]})]});return(0,N.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col p-3`,children:[$e===`list`?Tn:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`div`,{className:`mb-2 flex shrink-0 items-center gap-2`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`inline-flex h-8 items-center gap-1 rounded-md border border-stone-200 bg-white px-2.5 text-xs text-stone-600 transition-colors hover:border-stone-300 hover:text-stone-800`,onClick:()=>{xe(``),I(``),X(`list`)},children:[(0,N.jsx)(C,{name:`arrowLeft`,size:14}),`返回列表`]}),(0,N.jsx)(`span`,{className:`min-w-0 truncate text-xs text-stone-400`,children:b?.title?`用户故事 · ${b.title}`:`用户故事`})]}),(0,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-4`,children:[(0,N.jsxs)(`aside`,{className:`flex w-[280px] shrink-0 flex-col gap-3 overflow-y-auto pb-1`,children:[(0,N.jsxs)(`section`,{"data-hint-width":!0,className:`rounded-xl border border-stone-200 bg-white`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between border-b border-stone-100 px-3.5 py-2.5`,children:[(0,N.jsx)(`p`,{className:Et,children:`分析记录`}),(0,N.jsx)(`span`,{className:`text-[11px] tabular-nums text-stone-400`,children:g.length})]}),(0,N.jsx)(`div`,{className:`px-2 py-2`,children:g.length?(0,N.jsx)(`ul`,{className:`space-y-0.5`,children:g.map(e=>{let t=e.id===v,n=Lt(e.status);return(0,N.jsx)(`li`,{children:(0,N.jsx)(`button`,{type:`button`,className:`flex w-full items-start gap-2 rounded-lg px-2 py-1.5 text-left transition-colors ${t?`bg-[#eef3ff]`:`hover:bg-stone-50`}`,onClick:()=>Y(e),children:(0,N.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,N.jsx)(f,{text:e.title,matchAnchorWidth:!0,className:`block truncate text-xs ${t?`font-medium text-[#1f4fd8]`:`text-stone-700`}`}),(0,N.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1 text-[11px] text-stone-400`,children:[(0,N.jsx)(S,{tone:n.tone,children:n.label}),(0,N.jsxs)(`span`,{children:[e.stories.length,` 个故事`]})]})]})})},e.id)})}):(0,N.jsx)(`p`,{className:`px-1.5 py-1 text-xs text-stone-400`,children:`还没有分析记录,选一份来源文档开始。`})})]}),(0,N.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white`,children:[(0,N.jsx)(`div`,{className:`border-b border-stone-100 px-3.5 py-2.5`,children:(0,N.jsx)(`p`,{className:Et,children:`提示词`})}),(0,N.jsxs)(`div`,{className:`px-3.5 py-3`,children:[(0,N.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,N.jsx)(Mt,{name:be,ready:Zt}),(0,N.jsx)(Mt,{name:E?.file??`用户故事审查提示词.md`,ready:t.on&&!!E?.review.trim()&&!!E?.fix.trim()}),(0,N.jsx)(Mt,{name:ce,ready:l.on&&!!D?.generate.trim()})]}),(0,N.jsx)(`p`,{className:`mt-2 text-[11px] ${tn?`text-stone-400`:`text-amber-700`}`,children:tn?`模型:${x?.model}`:`还没配置模型`})]})]}),(0,N.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white`,children:[(0,N.jsx)(`div`,{className:`border-b border-stone-100 px-3.5 py-2.5`,children:(0,N.jsx)(`p`,{className:Et,children:`动作`})}),(0,N.jsxs)(`div`,{className:`space-y-2 px-3.5 py-3`,children:[(0,N.jsx)(`button`,{type:`button`,className:`${wt} w-full`,disabled:!b||!!k||!b.sourcePath,onClick:()=>{b?.stories.length?Nt(!0):rn()},children:k===`decompose`?`拆解中…`:b?.stories.length?`重新拆解`:`开始拆解`}),t.on?(0,N.jsx)(`button`,{type:`button`,className:`${Tt} w-full`,disabled:!b||!!k||!b.stories.length,onClick:()=>void an(),children:k===`audit`?`审查中…`:b?.check?`重新审查用户故事`:`用户故事审查`}):null,l.on?(0,N.jsx)(`button`,{type:`button`,className:`${Tt} w-full`,disabled:!b||!!k||!b.stories.length,onClick:()=>void cn(),children:k===`testpoints`?`生成中…`:b?.testPoints?`重新生成测试点`:`生成测试点`}):null,k?(0,N.jsx)(`button`,{type:`button`,className:`${Tt} w-full`,onClick:xn,children:`中断`}):(0,N.jsx)(`button`,{type:`button`,className:`${Tt} w-full`,disabled:!b,onClick:yn,children:`导出 Markdown`}),b&&!k?(0,N.jsx)(`button`,{type:`button`,className:`h-8 w-full rounded-md text-xs text-stone-400 transition-colors hover:bg-red-50 hover:text-red-500`,onClick:()=>yt(!0),children:`删除这份分析`}):null]})]}),(0,N.jsxs)(`section`,{className:`flex min-h-[140px] flex-1 flex-col rounded-xl border border-stone-200 bg-white`,children:[(0,N.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-stone-100 px-3.5 py-2.5`,children:[(0,N.jsx)(`p`,{className:Et,children:`活动日志`}),j.length?(0,N.jsx)(`button`,{type:`button`,className:`text-[11px] text-stone-400 transition-colors hover:text-stone-600`,onClick:()=>M([]),children:`清空`}):null]}),(0,N.jsx)(`div`,{ref:Ft,className:`min-h-0 flex-1 space-y-1 overflow-y-auto px-3.5 py-2.5`,children:j.length?j.map(e=>(0,N.jsxs)(`p`,{className:`flex gap-1.5 text-[11px] leading-relaxed`,children:[(0,N.jsx)(`span`,{className:`mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full ${e.kind===`error`?`bg-red-500`:e.kind===`done`?`bg-emerald-500`:e.kind===`tool`?`bg-[#3370ff]`:`bg-stone-300`}`,"aria-hidden":`true`}),(0,N.jsx)(`span`,{className:e.kind===`error`?`text-red-600`:`text-stone-500`,children:e.text})]},e.id)):(0,N.jsx)(`p`,{className:`text-[11px] leading-relaxed text-stone-400`,children:`拆解 / 审查的过程会记在这里:抽取需求条目、写故事、跑审查与补写。`})})]})]}),(0,N.jsxs)(`section`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[F?(0,N.jsxs)(`div`,{className:`mb-2 flex items-start justify-between gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700`,children:[(0,N.jsx)(`span`,{className:`break-all`,children:F}),(0,N.jsx)(`button`,{type:`button`,className:`shrink-0 text-red-400`,onClick:()=>I(``),children:`✕`})]}):null,b?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`header`,{className:`shrink-0 rounded-xl border border-stone-200 bg-white`,children:[(0,N.jsxs)(`div`,{className:`px-4 pt-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`input`,{className:`min-w-0 flex-1 rounded-md border border-transparent bg-transparent px-1 py-0.5 text-[15px] font-semibold text-stone-800 outline-none transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white`,defaultValue:b.title,"aria-label":`分析标题`,onBlur:e=>_n(e.target.value)},b.id),k?(0,N.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1.5 text-xs text-stone-500`,children:[(0,N.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`}),wn?.message||(k===`decompose`?`拆解中`:k===`audit`?`审查中`:k===`testpoints`?`生成测试点中`:`补写中`)]}):null,(0,N.jsx)(S,{tone:Lt(b.status).tone,children:Lt(b.status).label})]}),(0,N.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-2.5 text-[11px] text-stone-400`,children:[(0,N.jsxs)(`span`,{className:`shrink-0`,children:[`故事`,` `,(0,N.jsx)(`span`,{className:`font-medium text-stone-600`,children:b.stories.length})]}),(0,N.jsx)(`span`,{className:`h-3 w-px shrink-0 bg-stone-200`,"aria-hidden":`true`}),(0,N.jsxs)(`span`,{className:`shrink-0`,children:[`条目`,` `,(0,N.jsxs)(`span`,{className:`font-medium text-stone-600`,children:[Sn,`/`,b.outline.length]}),` `,`覆盖`]}),t.on?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{className:`h-3 w-px shrink-0 bg-stone-200`,"aria-hidden":`true`}),(0,N.jsxs)(`span`,{className:`shrink-0`,children:[`缺口`,` `,(0,N.jsx)(`span`,{className:`font-medium text-stone-600`,children:Cn.length}),Qt?` · 已选 ${Qt}`:``]}),b.check?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{className:`h-3 w-px shrink-0 bg-stone-200`,"aria-hidden":`true`}),(0,N.jsxs)(`span`,{className:`shrink-0`,children:[`覆盖率`,` `,(0,N.jsx)(`span`,{className:`font-medium text-stone-600`,children:b.check.coverage.total?`${Math.round(b.check.coverage.rate*100)}%`:`—`})]})]}):null]}):null,l.on?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{className:`h-3 w-px shrink-0 bg-stone-200`,"aria-hidden":`true`}),(0,N.jsxs)(`span`,{className:`shrink-0`,children:[`测试点`,` `,(0,N.jsx)(`span`,{className:`font-medium text-stone-600`,children:b.testPoints?.points.length??0})]})]}):null,(0,N.jsxs)(`span`,{className:`ml-auto min-w-0 truncate pl-2`,children:[`来源:`,b.sourcePath]}),Jt?(0,N.jsx)(`span`,{className:`shrink-0 rounded bg-amber-50 px-1.5 py-0.5 text-[10px] text-amber-700`,children:`源文档已更新`}):null]})]}),(0,N.jsx)(`div`,{role:`tablist`,"aria-label":`需求分析视图`,className:`mt-2.5 flex items-center gap-1 border-b border-stone-100 px-2`,children:[{id:`stories`,label:`用户故事`,count:b.stories.length},{id:`check`,label:`审查结果`,count:Cn.length},{id:`outline`,label:`需求条目`,count:b.outline.length},{id:`points`,label:`测试点`,count:b.testPoints?.points.length??0}].filter(e=>(e.id!==`check`||t.on)&&(e.id!==`points`||l.on)).map(e=>{let t=L===e.id;return(0,N.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t,className:`-mb-px flex items-center gap-1.5 border-b-2 px-3 py-2 text-xs transition-colors ${t?`border-[#3370ff] font-medium text-[#3370ff]`:`border-transparent text-stone-500 hover:text-stone-800`}`,onClick:()=>R(e.id),children:[e.label,(0,N.jsx)(`span`,{className:`rounded-full px-1.5 text-[10px] leading-4 tabular-nums ${t?`bg-[#eaf1ff] text-[#3370ff]`:`bg-stone-100 text-stone-400`}`,children:e.count})]},e.id)})})]}),(0,N.jsxs)(`div`,{className:`mt-3 min-h-0 flex-1 overflow-y-auto pr-1`,children:[L===`stories`?b.stories.length?(0,N.jsx)(`ul`,{className:`space-y-2`,children:b.stories.map((e,t)=>(0,N.jsx)(ut,{story:e,index:t,total:b.stories.length,gaps:Cn.filter(t=>t.storyId===e.id),busy:!!k,onSave:e=>fn(t,e),onDelete:()=>pn(t),onMove:e=>mn(t,e),domId:e.id?`req-story-${e.id}`:void 0},`${e.id}-${t}`))}):(0,N.jsx)(`div`,{className:`flex items-center justify-center rounded-xl border border-stone-200 bg-white`,children:(0,N.jsx)(He,{icon:`file`,title:`还没有用户故事`,hint:`点左侧「开始拆解」,会先抽需求条目再拆故事。`})}):null,L===`check`&&t.on?(0,N.jsx)(Qe,{check:b.check,stories:b.stories,busy:!!k,onToggleGap:hn,onToggleAll:gn,onFix:()=>void sn(),onReview:()=>void an(),onExport:bn}):null,L===`points`&&l.on?(0,N.jsx)(nt,{doc:b,generating:k===`testpoints`,busy:!!k,promptReady:!!D?.generate.trim(),onGenerate:()=>void cn(),onExportXmind:()=>void ln(),onExportMarkdown:un}):null,L===`outline`?b.outline.length?(0,N.jsx)(`ul`,{className:`space-y-2`,children:b.outline.map(e=>{let t=Yt.has(e.id);return(0,N.jsx)(`li`,{className:`rounded-xl border border-stone-200 bg-white px-4 py-2.5`,children:(0,N.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,N.jsx)(`span`,{className:`mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full ${t?`bg-emerald-500`:`bg-amber-400`}`,"aria-hidden":`true`}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsxs)(`p`,{className:`text-sm text-stone-800`,children:[(0,N.jsx)(`span`,{className:`mr-1.5 rounded bg-stone-100 px-1.5 py-0.5 font-mono text-[11px] text-stone-500`,children:e.id}),e.title]}),e.quote?(0,N.jsx)(`p`,{className:`mt-1 border-l-2 border-stone-200 pl-2 text-xs leading-relaxed text-stone-400`,children:e.quote}):null]}),(0,N.jsx)(`span`,{className:`shrink-0 text-[11px] ${t?`text-emerald-600`:`text-amber-600`}`,children:t?`已覆盖`:`未覆盖`})]})},e.id)})}):(0,N.jsx)(`div`,{className:`flex items-center justify-center rounded-xl border border-stone-200 bg-white`,children:(0,N.jsx)(He,{icon:`file`,title:`还没有需求条目`,hint:`拆解时模型会先抽条目,覆盖率按条目统计。`})}):null]}),Ze?(0,N.jsxs)(`details`,{className:`mt-2 shrink-0 rounded-xl border border-stone-200 bg-white px-3 py-2`,children:[(0,N.jsx)(`summary`,{className:`cursor-pointer text-xs text-stone-500`,children:`模型说明(本轮)`}),(0,N.jsx)(`pre`,{className:`mt-1 max-h-[180px] overflow-y-auto whitespace-pre-wrap break-words text-[11px] leading-relaxed text-stone-600`,children:Ze})]}):null]}):(0,N.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center rounded-xl border border-stone-200 bg-white`,children:(0,N.jsx)(He,{icon:`file`,title:`还没有选来源`,hint:`左侧选一份「需求文档库」里的 Word / Excel / Markdown / txt,系统会新建一份分析。`})})]})]})]}),(0,N.jsx)(d,{open:vt,title:`删除分析记录`,message:`确认删除「${b?.title??``}」?故事、需求条目、体检报告与测试点都会一起删掉,来源需求文档不受影响。`,confirmLabel:`删除`,danger:`solid`,onClose:()=>yt(!1),onConfirm:()=>void vn()}),(0,N.jsx)(d,{open:St,title:`重新拆解`,message:`重新拆解会用模型结果替换当前 ${b?.stories.length??0} 个用户故事,旧体检报告、测试点与需求条目也会一起清掉,编号从 US-001 重新开始。`,confirmLabel:`重新拆解`,onClose:()=>Nt(!1),onConfirm:()=>{Nt(!1),rn()}})]})}export{Nt as default};