@wandox/sdk 0.1.5 → 0.1.6

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 (94) hide show
  1. package/dist/{arc-B7qgVEMq.js → arc-BCEPJgEN.js} +1 -1
  2. package/dist/{arc-D5K9rSpr.cjs → arc-C3M84atd.cjs} +1 -1
  3. package/dist/{architectureDiagram-3BPJPVTR-Bo4Fy5Bk.cjs → architectureDiagram-3BPJPVTR-COknxlWF.cjs} +1 -1
  4. package/dist/{architectureDiagram-3BPJPVTR-JHW8fWcD.js → architectureDiagram-3BPJPVTR-DjeMZ0r9.js} +3 -3
  5. package/dist/{blockDiagram-GPEHLZMM-DbHcFDQt.cjs → blockDiagram-GPEHLZMM-Bs0ThzPq.cjs} +1 -1
  6. package/dist/{blockDiagram-GPEHLZMM-C6uFvC27.js → blockDiagram-GPEHLZMM-CtsVvZwi.js} +3 -3
  7. package/dist/{c4Diagram-AAUBKEIU-WiC344wU.cjs → c4Diagram-AAUBKEIU-KdUGyHtq.cjs} +1 -1
  8. package/dist/{c4Diagram-AAUBKEIU-2RQ1HjKV.js → c4Diagram-AAUBKEIU-iAeojeRO.js} +2 -2
  9. package/dist/{channel-BXNGkbdm.js → channel-BB3YsDcL.js} +1 -1
  10. package/dist/{channel-BYAOv2nC.cjs → channel-wqBv4Int.cjs} +1 -1
  11. package/dist/{chunk-2J33WTMH-DfPU4IKL.cjs → chunk-2J33WTMH-CTwBOU2N.cjs} +1 -1
  12. package/dist/{chunk-2J33WTMH-Ci1p0oZH.js → chunk-2J33WTMH-CeGEYbbr.js} +1 -1
  13. package/dist/{chunk-4BX2VUAB-D80a-B3A.cjs → chunk-4BX2VUAB-DKlY-pD8.cjs} +1 -1
  14. package/dist/{chunk-4BX2VUAB-DndGVAyB.js → chunk-4BX2VUAB-I9pgL2Ga.js} +1 -1
  15. package/dist/{chunk-55IACEB6-DrXG-2Tn.cjs → chunk-55IACEB6-C4WPDMgC.cjs} +1 -1
  16. package/dist/{chunk-55IACEB6-C4X05F9o.js → chunk-55IACEB6-DsFWdcz2.js} +1 -1
  17. package/dist/{chunk-727SXJPM-DCWuBxXm.js → chunk-727SXJPM-D8A2QNEZ.js} +5 -5
  18. package/dist/{chunk-727SXJPM-BlKAyGN6.cjs → chunk-727SXJPM-DWSRE_aV.cjs} +1 -1
  19. package/dist/{chunk-AQP2D5EJ-CHewKaAJ.cjs → chunk-AQP2D5EJ-VzPYOtfK.cjs} +1 -1
  20. package/dist/{chunk-AQP2D5EJ-C1_oBAC2.js → chunk-AQP2D5EJ-c18yOFei.js} +3 -3
  21. package/dist/{chunk-FMBD7UC4-CjfYA_B0.js → chunk-FMBD7UC4-DdKtf7Jf.js} +1 -1
  22. package/dist/{chunk-FMBD7UC4-D2USg-3o.cjs → chunk-FMBD7UC4-DqR7XTD7.cjs} +1 -1
  23. package/dist/{chunk-ND2GUHAM-BnuS9dWh.js → chunk-ND2GUHAM-CBR2brm7.js} +1 -1
  24. package/dist/{chunk-ND2GUHAM-B0TwUBiR.cjs → chunk-ND2GUHAM-amuOtIbA.cjs} +1 -1
  25. package/dist/{chunk-QZHKN3VN-C1JoZoXY.cjs → chunk-QZHKN3VN-CF-fJa5l.cjs} +1 -1
  26. package/dist/{chunk-QZHKN3VN-BSzyWeGs.js → chunk-QZHKN3VN-DJuimKaR.js} +1 -1
  27. package/dist/{classDiagram-4FO5ZUOK-CAXWXtYT.js → classDiagram-4FO5ZUOK-CBZBcl3g.js} +2 -2
  28. package/dist/{classDiagram-4FO5ZUOK-Dl95ttMv.cjs → classDiagram-4FO5ZUOK-Ce85NlvM.cjs} +1 -1
  29. package/dist/{classDiagram-v2-Q7XG4LA2-Dl95ttMv.cjs → classDiagram-v2-Q7XG4LA2-Ce85NlvM.cjs} +1 -1
  30. package/dist/{classDiagram-v2-Q7XG4LA2-DnXKiQrJ.js → classDiagram-v2-Q7XG4LA2-QeGJ2TqA.js} +2 -2
  31. package/dist/{cose-bilkent-S5V4N54A-r7DZ5fO8.cjs → cose-bilkent-S5V4N54A-BPDl5Phf.cjs} +1 -1
  32. package/dist/{cose-bilkent-S5V4N54A-Cj1Qjb-o.js → cose-bilkent-S5V4N54A-Dd1H7jda.js} +2 -2
  33. package/dist/{dagre-BM42HDAG-DxvBoF0I.cjs → dagre-BM42HDAG-Bwkf0ojp.cjs} +1 -1
  34. package/dist/{dagre-BM42HDAG-Cd0qA0LJ.js → dagre-BM42HDAG-ByOiaIIP.js} +1 -1
  35. package/dist/{diagram-2AECGRRQ-DlVA6c7N.js → diagram-2AECGRRQ-ButCPlCx.js} +2 -2
  36. package/dist/{diagram-2AECGRRQ-DC_DoGIU.cjs → diagram-2AECGRRQ-DVchJgo1.cjs} +1 -1
  37. package/dist/{diagram-5GNKFQAL-2su5Pv6h.js → diagram-5GNKFQAL-BCf5PGFH.js} +3 -3
  38. package/dist/{diagram-5GNKFQAL-DAIma7eJ.cjs → diagram-5GNKFQAL-DSFVTtjc.cjs} +1 -1
  39. package/dist/{diagram-KO2AKTUF-D8UoWAa1.js → diagram-KO2AKTUF-BWYcdtPZ.js} +2 -2
  40. package/dist/{diagram-KO2AKTUF-B5cnl2wQ.cjs → diagram-KO2AKTUF-DxonIhe4.cjs} +1 -1
  41. package/dist/{diagram-LMA3HP47-C-yR97gr.js → diagram-LMA3HP47-CkRqefSa.js} +2 -2
  42. package/dist/{diagram-LMA3HP47-C27ERK0j.cjs → diagram-LMA3HP47-iIJAbjAT.cjs} +1 -1
  43. package/dist/{diagram-OG6HWLK6-BgE7dd-s.js → diagram-OG6HWLK6-BVu58Ypm.js} +3 -3
  44. package/dist/{diagram-OG6HWLK6-DB_73PXR.cjs → diagram-OG6HWLK6-CDPAFkR1.cjs} +1 -1
  45. package/dist/{erDiagram-TEJ5UH35-CJQzz-su.js → erDiagram-TEJ5UH35-BvGaUpxJ.js} +4 -4
  46. package/dist/{erDiagram-TEJ5UH35-BGcQWhSP.cjs → erDiagram-TEJ5UH35-Cp5jsy8J.cjs} +1 -1
  47. package/dist/{flowDiagram-I6XJVG4X-BSIpz30q.cjs → flowDiagram-I6XJVG4X-BcqIG1Pp.cjs} +1 -1
  48. package/dist/{flowDiagram-I6XJVG4X-DX9sTGvA.js → flowDiagram-I6XJVG4X-OywfGkSP.js} +6 -6
  49. package/dist/{ganttDiagram-6RSMTGT7-DylFVqe4.js → ganttDiagram-6RSMTGT7-0DAi2E9c.js} +3 -3
  50. package/dist/{ganttDiagram-6RSMTGT7-C7Fd0n8M.cjs → ganttDiagram-6RSMTGT7-D4GB3sBi.cjs} +1 -1
  51. package/dist/{gitGraphDiagram-PVQCEYII-Dnrxdz7G.cjs → gitGraphDiagram-PVQCEYII-CW9oKJGp.cjs} +1 -1
  52. package/dist/{gitGraphDiagram-PVQCEYII-GzV2uUGc.js → gitGraphDiagram-PVQCEYII-dGEOgiVa.js} +3 -3
  53. package/dist/{index-4dcp6UyZ.js → index-DFJAfcD3.js} +7 -2
  54. package/dist/{index-D0_lX7rx.cjs → index-WVOaMxfj.cjs} +3 -3
  55. package/dist/{infoDiagram-5YYISTIA-DSi6DCVw.js → infoDiagram-5YYISTIA-1x6PxWPh.js} +1 -1
  56. package/dist/{infoDiagram-5YYISTIA-D4PAlJYL.cjs → infoDiagram-5YYISTIA-CCAMFpG7.cjs} +1 -1
  57. package/dist/{ishikawaDiagram-YF4QCWOH-5y6-Hc8v.js → ishikawaDiagram-YF4QCWOH-BnXIhEJ-.js} +1 -1
  58. package/dist/{ishikawaDiagram-YF4QCWOH-DO57zK1P.cjs → ishikawaDiagram-YF4QCWOH-DTttQMBx.cjs} +1 -1
  59. package/dist/{journeyDiagram-JHISSGLW-B6DXjDym.cjs → journeyDiagram-JHISSGLW-B5WLEcwt.cjs} +1 -1
  60. package/dist/{journeyDiagram-JHISSGLW-pw5TPvJN.js → journeyDiagram-JHISSGLW-BEfm66eA.js} +4 -4
  61. package/dist/{kanban-definition-UN3LZRKU-DsPvf-_O.cjs → kanban-definition-UN3LZRKU-BeyzSJxb.cjs} +1 -1
  62. package/dist/{kanban-definition-UN3LZRKU-CP0DC4_5.js → kanban-definition-UN3LZRKU-HzIenN5A.js} +2 -2
  63. package/dist/{linear-M7Hx5Hlo.cjs → linear-DCtGr5aj.cjs} +1 -1
  64. package/dist/{linear-8lr72Rcr.js → linear-DzkzcbLc.js} +1 -1
  65. package/dist/{mermaid.core-Jj_t1-FY.js → mermaid.core-Dbt7la8g.js} +35 -35
  66. package/dist/{mermaid.core-BaMmNsnH.cjs → mermaid.core-RcOf5VoJ.cjs} +3 -3
  67. package/dist/{mindmap-definition-RKZ34NQL-CThBIDP8.cjs → mindmap-definition-RKZ34NQL-B2uphtJg.cjs} +1 -1
  68. package/dist/{mindmap-definition-RKZ34NQL-BX8KwZb3.js → mindmap-definition-RKZ34NQL-BZiqJrh9.js} +3 -3
  69. package/dist/{pieDiagram-4H26LBE5-Fr6T3AhS.cjs → pieDiagram-4H26LBE5-NJ8UMe9y.cjs} +1 -1
  70. package/dist/{pieDiagram-4H26LBE5-Bl9dS1_0.js → pieDiagram-4H26LBE5-WUkKUz3U.js} +3 -3
  71. package/dist/{quadrantDiagram-W4KKPZXB-9V9Wv13D.cjs → quadrantDiagram-W4KKPZXB-D426lIYl.cjs} +1 -1
  72. package/dist/{quadrantDiagram-W4KKPZXB--3BZUjU6.js → quadrantDiagram-W4KKPZXB-DCf1-kj-.js} +2 -2
  73. package/dist/{requirementDiagram-4Y6WPE33-mfQz2rIb.cjs → requirementDiagram-4Y6WPE33-CwmAhMtW.cjs} +1 -1
  74. package/dist/{requirementDiagram-4Y6WPE33-DAu7OiXM.js → requirementDiagram-4Y6WPE33-DEZk1dpw.js} +3 -3
  75. package/dist/{sankeyDiagram-5OEKKPKP-CJz-cajv.cjs → sankeyDiagram-5OEKKPKP-BTAjmebp.cjs} +1 -1
  76. package/dist/{sankeyDiagram-5OEKKPKP-BYof-GJF.js → sankeyDiagram-5OEKKPKP-BxKWIchh.js} +1 -1
  77. package/dist/{sequenceDiagram-3UESZ5HK-DBdQdzQ4.js → sequenceDiagram-3UESZ5HK-BA5GSGEh.js} +3 -3
  78. package/dist/{sequenceDiagram-3UESZ5HK-CnCCqzBZ.cjs → sequenceDiagram-3UESZ5HK-C4M0DDTG.cjs} +1 -1
  79. package/dist/{stateDiagram-AJRCARHV-C2VwW1Ol.js → stateDiagram-AJRCARHV-DEjcrtGv.js} +2 -2
  80. package/dist/{stateDiagram-AJRCARHV-YAMNJATt.cjs → stateDiagram-AJRCARHV-DZc4Epkt.cjs} +1 -1
  81. package/dist/{stateDiagram-v2-BHNVJYJU-Seh2C45-.js → stateDiagram-v2-BHNVJYJU-Cste4iEW.js} +2 -2
  82. package/dist/{stateDiagram-v2-BHNVJYJU-DEjgz5YF.cjs → stateDiagram-v2-BHNVJYJU-DK4kdkgm.cjs} +1 -1
  83. package/dist/{timeline-definition-PNZ67QCA-D_8fOXSB.cjs → timeline-definition-PNZ67QCA-Bvgt45rW.cjs} +1 -1
  84. package/dist/{timeline-definition-PNZ67QCA-BgvPMJcq.js → timeline-definition-PNZ67QCA-M9IlxWps.js} +2 -2
  85. package/dist/{vennDiagram-CIIHVFJN-CPg2blpH.js → vennDiagram-CIIHVFJN-B4X63qS9.js} +1 -1
  86. package/dist/{vennDiagram-CIIHVFJN-C6QKCDE-.cjs → vennDiagram-CIIHVFJN-Co1AJ1Da.cjs} +1 -1
  87. package/dist/wandox.cjs +1 -1
  88. package/dist/wandox.js +1 -1
  89. package/dist/wandox.umd.js +1 -1
  90. package/dist/{wardleyDiagram-YWT4CUSO-C2klbgQ2.js → wardleyDiagram-YWT4CUSO-DJIc38jR.js} +2 -2
  91. package/dist/{wardleyDiagram-YWT4CUSO-kjD1ioIl.cjs → wardleyDiagram-YWT4CUSO-DM3KfJZw.cjs} +1 -1
  92. package/dist/{xychartDiagram-2RQKCTM6-B-eg_uDi.js → xychartDiagram-2RQKCTM6-C7Lpdrl1.js} +2 -2
  93. package/dist/{xychartDiagram-2RQKCTM6-D2R6i9jB.cjs → xychartDiagram-2RQKCTM6-YP4nGVLk.cjs} +1 -1
  94. package/package.json +1 -1
@@ -765,7 +765,7 @@ $3`).replace(/(\*\*[^*\n]+:\*\*)-/g,`$1
765
765
  `),Ie=_e.slice(ze+1),De=Ie.lastIndexOf("@");if(De!==-1&&((De>0?Ie[De-1]:" ")===" "||De===0)){const Ze=Ie.slice(De+1);if(!Ze.includes(" ")&&!Ze.includes(`
766
766
  `)){U(ze+1+De),H(Ze),j(!0);return}}j(!1)},ye=ce=>{if(F&&q.length>0){if(ce.key==="ArrowDown"){ce.preventDefault(),Q(ne=>ne<q.length-1?ne+1:0);return}if(ce.key==="ArrowUp"){ce.preventDefault(),Q(ne=>ne>0?ne-1:q.length-1);return}if(ce.key==="Enter"||ce.key==="Tab"){ce.preventDefault(),ie(q[X]);return}if(ce.key==="Escape"){ce.preventDefault(),j(!1);return}}if(ce.key==="Enter"&&!ce.shiftKey&&!n){if(!w.trim()&&$&&r&&M.length===0){ce.preventDefault(),O();return}(w.trim()||M.length>0)&&(ce.preventDefault(),ue())}if(ce.key===" "&&!n&&!w.trim()&&$&&r&&M.length===0){ce.preventDefault(),O();return}},ie=ce=>{if(j(!1),!ce.input_fields||ce.input_fields.length===0){S(""),ee(null),I(!0),s(ce.name,ce.playbook_id);return}const ne=w.slice(0,W),Ee=w.slice(W+1+V.length);if(g){S(`${ne}${Ee}`),g(ce);return}ee(ce);const _e=ce.input_fields.map(De=>`${De.label}: `).join(`
767
767
  `),ze=`${ne}${ce.name},请提供以下参数:
768
- ${_e}${Ee}`,Ie=ze.indexOf(": ")+2;S(ze),setTimeout(()=>{var De;if(_.current){_.current.focus();const Me=(De=_.current.resizableTextArea)==null?void 0:De.textArea;Me==null||Me.setSelectionRange(Ie,Ie)}},0)},me=()=>{ee(null),S("")},ue=async()=>{if(!w.trim()&&M.length===0||n)return;let ce=[];if(M.length>0){ce=await he();for(const _e of M)URL.revokeObjectURL(_e.previewUrl);L([])}const ne=w.trim(),Ee=Z==null?void 0:Z.playbook_id;S(""),ee(null),ae.clear(),I(!0),s(ne,Ee,ce.length>0?ce:void 0)};return E.jsxs("div",{className:"wandox-chat-input",style:{position:"relative"},onDragEnter:Re,onDragLeave:Ce,onDragOver:Le,onDrop:Pe,children:[R&&E.jsx("div",{className:"wandox-chat-input-drag-overlay",children:E.jsxs("div",{className:"wandox-chat-input-drag-content",children:[E.jsx(u_r,{style:{fontSize:32,marginBottom:8}}),E.jsx("div",{children:"释放以发送图片"})]})}),E.jsx("input",{ref:P,type:"file",accept:"image/png,image/jpeg,image/jpg,image/gif,image/webp,image/bmp",multiple:!0,style:{display:"none"},onChange:de}),F&&q.length>0&&E.jsx("div",{className:"wandox-mention-list",ref:T,children:E.jsx("div",{className:"wandox-mention-items",children:q.map((ce,ne)=>E.jsxs("div",{className:`wandox-mention-item ${ne===X?"wandox-mention-item--active":""}`,onClick:()=>ie(ce),onKeyDown:()=>{},onMouseEnter:()=>Q(ne),children:[E.jsx("div",{className:"wandox-mention-item-icon",children:"📋"}),E.jsxs("div",{className:"wandox-mention-item-content",children:[E.jsxs("div",{className:"wandox-mention-item-name",children:[ce.name,ce.input_fields&&ce.input_fields.length>0&&E.jsx("span",{className:"wandox-mention-item-tag",children:t("recommendation.params")})]}),ce.description&&E.jsx("div",{className:"wandox-mention-item-desc",children:ce.description})]})]},ce.playbook_id))})}),F&&q.length===0&&te.length>0&&E.jsx("div",{className:"wandox-mention-list",ref:T,children:E.jsx("div",{className:"wandox-mention-empty",children:t("chatInput.noMatchingScenarios")})}),F&&te.length===0&&E.jsx("div",{className:"wandox-mention-list",ref:T,children:E.jsx("div",{className:"wandox-mention-empty",children:t("chatInput.noAvailableScenarios")})}),E.jsx(Lmt,{open:k&&!F&&!n,rewrittenQuestion:ae.rewrittenQuestion,questions:ae.questions,loading:ae.loading,placement:"top",onSelectRewrite:ce=>{var ne;S(ce),ae.clear(),(ne=_.current)==null||ne.focus()},onSelectQuestion:ce=>{S(""),ee(null),I(!0),ae.clear(),s(ce.title)}}),Z&&E.jsx("div",{className:"wandox-chat-input-tag",children:E.jsx(io,{color:"blue",closable:!0,onClose:me,closeIcon:E.jsx(Qo,{}),children:Z.name})}),$&&r&&!n&&E.jsx("button",{className:"wandox-search-suggestion",onClick:O,onKeyDown:B,type:"button",style:{position:"absolute",top:"30px",left:"38px",color:"#999",cursor:"pointer",fontSize:"14px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"calc(100% - 80px)",zIndex:1,transition:"color 0.2s ease",background:"none",border:"none",padding:0,textAlign:"left"},onMouseEnter:ce=>{ce.currentTarget.style.color="#1890ff"},onMouseLeave:ce=>{ce.currentTarget.style.color="#999"},children:r}),M.length>0&&E.jsx("div",{className:"wandox-chat-input-previews",children:M.map(ce=>E.jsxs("div",{className:"wandox-chat-input-preview-item",children:[E.jsx("img",{src:ce.previewUrl,alt:ce.file.name,className:"wandox-chat-input-preview-img"}),E.jsx("button",{type:"button",className:"wandox-chat-input-preview-remove",onClick:()=>ve(ce.id),title:"删除",children:E.jsx(Qo,{})})]},ce.id))}),E.jsx(Vtn,{ref:_,placeholder:$&&r&&!n?"":o||t("chat.input.placeholder"),value:w,disabled:n,onChange:ge,onKeyDown:ye,onPaste:be,onFocus:()=>A(!0),onBlur:()=>window.setTimeout(()=>A(!1),120),autoSize:{minRows:1,maxRows:6},className:"wandox-chat-textarea",style:{position:"relative",zIndex:2,background:"transparent"}}),E.jsxs("div",{className:"wandox-chat-input-actions",children:[E.jsx("button",{type:"button",className:"wandox-chat-input-icon-btn",title:"上传图片",disabled:n,onClick:pe,children:E.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[E.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2",stroke:"currentColor",strokeWidth:"2"}),E.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5",fill:"currentColor"}),E.jsx("polyline",{points:"21 15 16 10 5 21",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),E.jsx("button",{type:"button",className:`wandox-chat-input-icon-btn wandox-chat-input-send-btn${n?" wandox-chat-input-stop-btn":""}`,disabled:n?i||!a:!w.trim()&&M.length===0,onClick:n?a:ue,title:n?i?"正在停止":"停止":t("chat.send"),children:n?E.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[E.jsx("circle",{cx:"12",cy:"12",r:"8",stroke:"currentColor",strokeWidth:"2"}),E.jsx("rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",fill:"currentColor"})]}):E.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:E.jsx("path",{d:"M12 19V5M12 5L5 12M12 5L19 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})}const f9=[{id:"robot",name:"机器人",description:"紫色渐变机器人头像",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsxs("g",{clipPath:"url(#clip0_2019_548)",children:[E.jsx("path",{d:"M36 0H12C5.37258 0 0 5.37258 0 12V36C0 42.6274 5.37258 48 12 48H36C42.6274 48 48 42.6274 48 36V12C48 5.37258 42.6274 0 36 0Z",fill:"url(#paint0_linear_2019_548)"}),E.jsx("path",{d:"M24 12L28 16L24 20L20 16L24 12Z",fill:"white",fillOpacity:"0.95"}),E.jsx("path",{d:"M24 30C27.3137 30 30 27.3137 30 24C30 20.6863 27.3137 18 24 18C20.6863 18 18 20.6863 18 24C18 27.3137 20.6863 30 24 30Z",fill:"white",fillOpacity:"0.95"}),E.jsx("path",{d:"M16 28L12 24L16 20L20 24L16 28Z",fill:"white",fillOpacity:"0.8"}),E.jsx("path",{d:"M32 28L28 24L32 20L36 24L32 28Z",fill:"white",fillOpacity:"0.8"}),E.jsx("path",{d:"M24 36L20 32L24 28L28 32L24 36Z",fill:"white",fillOpacity:"0.8"})]}),E.jsxs("defs",{children:[E.jsxs("linearGradient",{id:"paint0_linear_2019_548",x1:"0",y1:"0",x2:"48",y2:"48",gradientUnits:"userSpaceOnUse",children:[E.jsx("stop",{stopColor:"#8B5CF6"}),E.jsx("stop",{offset:"1",stopColor:"#6366F1"})]}),E.jsx("clipPath",{id:"clip0_2019_548",children:E.jsx("rect",{width:"48",height:"48",fill:"white"})})]})]},"icon-robot")},{id:"amazon",name:"亚马逊",description:"橙色渐变亚马逊图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("path",{d:"M36 0H12C5.37258 0 0 5.37258 0 12V36C0 42.6274 5.37258 48 12 48H36C42.6274 48 48 42.6274 48 36V12C48 5.37258 42.6274 0 36 0Z",fill:"url(#paint0_linear_2026_532)"}),E.jsx("path",{d:"M14.7195 25.2724C14.7195 29.2324 17.217 31.2124 20.4345 31.2124C23.157 31.2124 24.6195 30.5824 26.712 28.4449C27.4095 29.4574 27.6345 29.9299 28.8945 30.9874C29.187 31.1449 29.547 31.1224 29.7945 30.8974C30.5595 30.2224 31.932 29.0074 32.7195 28.3549C33.0345 28.1074 32.967 27.6799 32.742 27.3424C32.0445 26.3749 31.302 25.5874 31.302 23.8099V17.8699C31.302 15.3499 31.482 13.0324 29.6145 11.2999C28.1745 9.90491 25.7445 9.40991 23.877 9.40991C20.2545 9.40991 16.2045 10.7599 15.3495 15.2599C15.2595 15.7324 15.6195 15.9799 15.9345 16.0474L19.6245 16.4524C19.962 16.4299 20.232 16.0924 20.277 15.7549C20.592 14.2024 21.897 13.4599 23.337 13.4599C24.1245 13.4599 25.0245 13.7524 25.4745 14.4499C26.0145 15.2374 25.947 16.3174 25.947 17.2174V17.7124C23.742 17.9599 20.862 18.1174 18.792 19.0399C16.3845 20.0749 14.7195 22.1674 14.7195 25.2724ZM25.947 20.7724V21.6049C25.947 23.0899 25.992 24.3274 25.227 25.6549C24.6195 26.7349 23.652 27.3874 22.5945 27.3874C21.132 27.3874 20.277 26.2624 20.277 24.6199C20.277 21.3574 23.202 20.7724 25.947 20.7724ZM33.9795 32.6749C30.762 34.0474 27.2745 34.6999 24.102 34.6999C19.3995 34.6999 14.832 33.4174 11.1645 31.2574C10.8495 31.0774 10.602 31.3924 10.872 31.6399C14.4197 34.8374 19.0336 36.5947 23.8095 36.5674C27.387 36.5674 31.527 35.4424 34.407 33.3274C34.8795 32.9899 34.4745 32.4724 33.9795 32.6749Z",fill:"white",fillOpacity:"0.95"}),E.jsx("path",{d:"M36.8146 31.0551C36.4996 30.6726 33.8221 30.3351 32.1796 31.4826C31.9321 31.6626 31.9771 31.9101 32.2471 31.8651C33.1696 31.7526 35.2171 31.5051 35.5996 31.9776C35.9596 32.4501 35.1946 34.3851 34.8571 35.2401C34.7446 35.5101 34.9696 35.6001 35.2171 35.3976C36.7246 34.1376 37.1296 31.4376 36.8146 31.0551Z",fill:"white",fillOpacity:"0.8"}),E.jsx("defs",{children:E.jsxs("linearGradient",{id:"paint0_linear_2026_532",x1:"0",y1:"0",x2:"48",y2:"48",gradientUnits:"userSpaceOnUse",children:[E.jsx("stop",{stopColor:"#FF6B35"}),E.jsx("stop",{offset:"1",stopColor:"#F7931E"})]})})]},"icon-amazon")},{id:"star",name:"星星",description:"绿色渐变星星图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsxs("g",{clipPath:"url(#clip0_2019_574)",children:[E.jsx("path",{d:"M36 0H12C5.37258 0 0 5.37258 0 12V36C0 42.6274 5.37258 48 12 48H36C42.6274 48 48 42.6274 48 36V12C48 5.37258 42.6274 0 36 0Z",fill:"url(#paint0_linear_2019_574)"}),E.jsx("path",{d:"M18 14H14C12.8954 14 12 14.8954 12 16V20C12 21.1046 12.8954 22 14 22H18C19.1046 22 20 21.1046 20 20V16C20 14.8954 19.1046 14 18 14Z",fill:"white",fillOpacity:"0.95"}),E.jsx("path",{d:"M34 14H30C28.8954 14 28 14.8954 28 16V20C28 21.1046 28.8954 22 30 22H34C35.1046 22 36 21.1046 36 20V16C36 14.8954 35.1046 14 34 14Z",fill:"white",fillOpacity:"0.95"}),E.jsx("path",{d:"M26 26H22C20.8954 26 20 26.8954 20 28V32C20 33.1046 20.8954 34 22 34H26C27.1046 34 28 33.1046 28 32V28C28 26.8954 27.1046 26 26 26Z",fill:"white",fillOpacity:"0.95"}),E.jsx("path",{d:"M16 22V26H20M32 22V26H28M24 26V22",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeOpacity:"0.8"}),E.jsx("path",{d:"M18 30L14 34M30 30L34 34M24 34V36",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeOpacity:"0.8"}),E.jsx("path",{d:"M14 36C15.1046 36 16 35.1046 16 34C16 32.8954 15.1046 32 14 32C12.8954 32 12 32.8954 12 34C12 35.1046 12.8954 36 14 36Z",fill:"white",fillOpacity:"0.7"}),E.jsx("path",{d:"M34 36C35.1046 36 36 35.1046 36 34C36 32.8954 35.1046 32 34 32C32.8954 32 32 32.8954 32 34C32 35.1046 32.8954 36 34 36Z",fill:"white",fillOpacity:"0.7"}),E.jsx("path",{d:"M24 40C25.1046 40 26 39.1046 26 38C26 36.8954 25.1046 36 24 36C22.8954 36 22 36.8954 22 38C22 39.1046 22.8954 40 24 40Z",fill:"white",fillOpacity:"0.7"})]}),E.jsxs("defs",{children:[E.jsxs("linearGradient",{id:"paint0_linear_2019_574",x1:"0",y1:"0",x2:"48",y2:"48",gradientUnits:"userSpaceOnUse",children:[E.jsx("stop",{stopColor:"#10B981"}),E.jsx("stop",{offset:"1",stopColor:"#059669"})]}),E.jsx("clipPath",{id:"clip0_2019_574",children:E.jsx("rect",{width:"48",height:"48",fill:"white"})})]})]},"icon-star")},{id:"gear",name:"齿轮",description:"绿色渐变齿轮图标",component:E.jsxs("svg",{viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad4",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#14B8A6"}),E.jsx("stop",{offset:"100%",stopColor:"#0891B2"})]})}),E.jsx("rect",{width:"40",height:"40",rx:"12",fill:"url(#grad4)"}),E.jsx("circle",{cx:"20",cy:"20",r:"5",stroke:"white",strokeWidth:"2.5",fill:"none",strokeOpacity:"0.95"}),E.jsx("path",{d:"M20 8V12M20 28V32M8 20H12M28 20H32M11.5 11.5L14.5 14.5M25.5 25.5L28.5 28.5M28.5 11.5L25.5 14.5M14.5 25.5L11.5 28.5",stroke:"white",strokeWidth:"2.5",strokeLinecap:"round",strokeOpacity:"0.8"})]},"icon-gear")},{id:"magic",name:"魔法棒",description:"粉色渐变魔法棒图标",component:E.jsxs("svg",{viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad5",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#EC4899"}),E.jsx("stop",{offset:"100%",stopColor:"#A855F7"})]})}),E.jsx("rect",{width:"40",height:"40",rx:"12",fill:"url(#grad5)"}),E.jsx("path",{d:"M10 30L26 14L30 18L14 34L10 30Z",fill:"white",fillOpacity:"0.95"}),E.jsx("circle",{cx:"28",cy:"12",r:"2",fill:"white",fillOpacity:"0.8"}),E.jsx("circle",{cx:"32",cy:"18",r:"1.5",fill:"white",fillOpacity:"0.7"}),E.jsx("circle",{cx:"24",cy:"8",r:"1.5",fill:"white",fillOpacity:"0.7"})]},"icon-magic")},{id:"rocket",name:"火箭",description:"青色渐变火箭图标",component:E.jsxs("svg",{viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad6",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#06B6D4"}),E.jsx("stop",{offset:"100%",stopColor:"#3B82F6"})]})}),E.jsx("rect",{width:"40",height:"40",rx:"12",fill:"url(#grad6)"}),E.jsx("path",{d:"M20 8C20 8 28 12 28 22L24 26L20 24L16 26L12 22C12 12 20 8 20 8Z",fill:"white",fillOpacity:"0.95"}),E.jsx("circle",{cx:"20",cy:"17",r:"2.5",fill:"url(#grad6)"}),E.jsx("path",{d:"M16 28L14 32L18 30L16 28Z",fill:"white",fillOpacity:"0.8"}),E.jsx("path",{d:"M24 28L26 32L22 30L24 28Z",fill:"white",fillOpacity:"0.8"})]},"icon-rocket")},{id:"music",name:"音乐",description:"粉紫渐变音乐图标",component:E.jsxs("svg",{viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad7",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#EC4899"}),E.jsx("stop",{offset:"100%",stopColor:"#8B5CF6"})]})}),E.jsx("rect",{width:"40",height:"40",rx:"12",fill:"url(#grad7)"}),E.jsx("path",{d:"M26 8L14 11v11.2c-.8-.3-1.6-.5-2.5-.5-2.9 0-5.3 1.6-5.3 3.6s2.4 3.6 5.3 3.6 5.3-1.6 5.3-3.6V14.4l8.7-2.5v5.7c-.8-.3-1.6-.5-2.5-.5-2.9 0-5.3 1.6-5.3 3.6s2.4 3.6 5.3 3.6 5.3-1.6 5.3-3.6V8z",fill:"white",fillOpacity:"0.95"})]},"icon-music")},{id:"sports",name:"运动",description:"蓝绿渐变运动图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad8",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#06B6D4"}),E.jsx("stop",{offset:"100%",stopColor:"#10B981"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad8)"}),E.jsx("circle",{cx:"24",cy:"24",r:"12",stroke:"white",strokeWidth:"2",fill:"none",strokeOpacity:"0.95"}),E.jsx("path",{d:"M24 12L30 18L24 24L18 18L24 12Z",fill:"white",fillOpacity:"0.8"}),E.jsx("path",{d:"M24 24L30 30L24 36L18 30L24 24Z",fill:"white",fillOpacity:"0.8"}),E.jsx("path",{d:"M12 24L18 30L24 24L18 18L12 24Z",fill:"white",fillOpacity:"0.7"}),E.jsx("path",{d:"M24 24L30 18L36 24L30 30L24 24Z",fill:"white",fillOpacity:"0.7"})]},"icon-sports")},{id:"games",name:"游戏",description:"红橙渐变游戏图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad9",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#EF4444"}),E.jsx("stop",{offset:"100%",stopColor:"#F97316"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad9)"}),E.jsx("rect",{x:"12",y:"16",width:"8",height:"8",rx:"2",fill:"white",fillOpacity:"0.95"}),E.jsx("rect",{x:"28",y:"16",width:"8",height:"8",rx:"2",fill:"white",fillOpacity:"0.95"}),E.jsx("rect",{x:"20",y:"24",width:"8",height:"8",rx:"2",fill:"white",fillOpacity:"0.8"}),E.jsx("rect",{x:"12",y:"32",width:"8",height:"4",rx:"1",fill:"white",fillOpacity:"0.7"}),E.jsx("rect",{x:"28",y:"32",width:"8",height:"4",rx:"1",fill:"white",fillOpacity:"0.7"})]},"icon-games")},{id:"expenses",name:"财务",description:"金黄渐变财务图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad10",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#F59E0B"}),E.jsx("stop",{offset:"100%",stopColor:"#EAB308"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad10)"}),E.jsx("path",{d:"M24 12C18 12 13 17 13 23c0 4 2 7 5 9v2c0 2 2 4 4 4h4c2 0 4-2 4-4v-2c3-2 5-5 5-9 0-6-5-11-11-11z",fill:"white",fillOpacity:"0.95"}),E.jsx("rect",{x:"20",y:"34",width:"8",height:"2",rx:"1",fill:"white",fillOpacity:"0.8"}),E.jsx("circle",{cx:"21",cy:"20",r:"1.5",fill:"url(#grad10)"}),E.jsx("circle",{cx:"27",cy:"20",r:"1.5",fill:"url(#grad10)"})]},"icon-expenses")},{id:"sciences",name:"科学",description:"青蓝渐变科学图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad11",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#0EA5E9"}),E.jsx("stop",{offset:"100%",stopColor:"#3B82F6"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad11)"}),E.jsx("path",{d:"M12 36L20 28L28 36L36 28",stroke:"white",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:"0.95"}),E.jsx("circle",{cx:"24",cy:"16",r:"4",fill:"white",fillOpacity:"0.8"}),E.jsx("path",{d:"M24 20V28",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeOpacity:"0.7"}),E.jsx("circle",{cx:"16",cy:"32",r:"2",fill:"white",fillOpacity:"0.7"}),E.jsx("circle",{cx:"32",cy:"32",r:"2",fill:"white",fillOpacity:"0.7"})]},"icon-sciences")},{id:"magic-wand",name:"魔法",description:"紫粉渐变魔法图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad12",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#8B5CF6"}),E.jsx("stop",{offset:"100%",stopColor:"#EC4899"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad12)"}),E.jsx("path",{d:"M12 36L24 24L36 36L24 48L12 36Z",fill:"white",fillOpacity:"0.95"}),E.jsx("circle",{cx:"28",cy:"12",r:"2",fill:"white",fillOpacity:"0.8"}),E.jsx("circle",{cx:"36",cy:"20",r:"1.5",fill:"white",fillOpacity:"0.7"}),E.jsx("circle",{cx:"20",cy:"8",r:"1.5",fill:"white",fillOpacity:"0.7"}),E.jsx("circle",{cx:"32",cy:"4",r:"1",fill:"white",fillOpacity:"0.6"})]},"icon-magic-wand")},{id:"animals",name:"动物",description:"绿棕渐变动物图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad13",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#10B981"}),E.jsx("stop",{offset:"100%",stopColor:"#92400E"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad13)"}),E.jsx("ellipse",{cx:"24",cy:"28",rx:"10",ry:"8",fill:"white",fillOpacity:"0.95"}),E.jsx("circle",{cx:"20",cy:"26",r:"2",fill:"url(#grad13)"}),E.jsx("circle",{cx:"28",cy:"26",r:"2",fill:"url(#grad13)"}),E.jsx("path",{d:"M24 30C22 32 20 33 18 33",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeOpacity:"0.8"}),E.jsx("circle",{cx:"18",cy:"18",r:"4",fill:"white",fillOpacity:"0.8"}),E.jsx("circle",{cx:"30",cy:"18",r:"4",fill:"white",fillOpacity:"0.8"})]},"icon-animals")},{id:"travel",name:"旅行",description:"天蓝渐变旅行图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad14",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#0EA5E9"}),E.jsx("stop",{offset:"100%",stopColor:"#06B6D4"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad14)"}),E.jsx("path",{d:"M8 32L16 16L32 16L40 32L32 40L16 40L8 32Z",fill:"white",fillOpacity:"0.95"}),E.jsx("circle",{cx:"24",cy:"24",r:"3",fill:"url(#grad14)"}),E.jsx("path",{d:"M24 28V32",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeOpacity:"0.8"}),E.jsx("rect",{x:"12",y:"36",width:"4",height:"2",rx:"1",fill:"white",fillOpacity:"0.7"}),E.jsx("rect",{x:"32",y:"36",width:"4",height:"2",rx:"1",fill:"white",fillOpacity:"0.7"})]},"icon-travel")},{id:"nature",name:"自然",description:"绿色渐变自然图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad15",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#22C55E"}),E.jsx("stop",{offset:"100%",stopColor:"#10B981"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad15)"}),E.jsx("path",{d:"M24 12C20 12 16 16 16 20C16 24 18 27 20 28V36C20 38 22 40 24 40C26 40 28 38 28 36V28C30 27 32 24 32 20C32 16 28 12 24 12Z",fill:"white",fillOpacity:"0.95"}),E.jsx("path",{d:"M24 12V20",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeOpacity:"0.8"}),E.jsx("path",{d:"M24 20L20 16M24 20L28 16",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeOpacity:"0.7"})]},"icon-nature")},{id:"education",name:"教育",description:"深蓝渐变教育图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad16",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#1E40AF"}),E.jsx("stop",{offset:"100%",stopColor:"#3B82F6"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad16)"}),E.jsx("path",{d:"M24 8L8 16V24C8 32 14 38 24 40C34 38 40 32 40 24V16L24 8Z",fill:"white",fillOpacity:"0.95"}),E.jsx("circle",{cx:"24",cy:"22",r:"4",fill:"url(#grad16)"}),E.jsx("path",{d:"M24 26V30",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeOpacity:"0.8"}),E.jsx("path",{d:"M16 36L12 40L8 36",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:"0.7"})]},"icon-education")},{id:"health",name:"健康",description:"红色渐变健康图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad17",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#EF4444"}),E.jsx("stop",{offset:"100%",stopColor:"#DC2626"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad17)"}),E.jsx("rect",{x:"20",y:"12",width:"8",height:"24",rx:"4",fill:"white",fillOpacity:"0.95"}),E.jsx("rect",{x:"12",y:"20",width:"24",height:"8",rx:"4",fill:"white",fillOpacity:"0.95"}),E.jsx("circle",{cx:"24",cy:"24",r:"2",fill:"url(#grad17)"})]},"icon-health")},{id:"food",name:"美食",description:"橙色渐变美食图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad18",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#FB923C"}),E.jsx("stop",{offset:"100%",stopColor:"#F97316"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad18)"}),E.jsx("path",{d:"M16 16C16 12 20 8 24 8C28 8 32 12 32 16V32C32 36 28 40 24 40C20 40 16 36 16 32V16Z",fill:"white",fillOpacity:"0.95"}),E.jsx("circle",{cx:"20",cy:"20",r:"1.5",fill:"url(#grad18)"}),E.jsx("circle",{cx:"28",cy:"20",r:"1.5",fill:"url(#grad18)"}),E.jsx("path",{d:"M24 24C22 26 20 27 18 27",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeOpacity:"0.8"}),E.jsx("path",{d:"M12 32L8 36L12 40",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:"0.7"})]},"icon-food")}],Htn="robot",A_=e=>{if(!e){const r=f9.find(n=>n.id===Htn);return(r==null?void 0:r.component)||f9[0].component}const t=f9.find(r=>r.id===e);return(t==null?void 0:t.component)||f9[0].component},Wtn=new Map(f9.map(e=>[e.id,e]));function Gtn({active:e,agents:t,collapsed:r,onToggle:n,className:i,activeView:a="chat",onViewChange:s,onToolboxOpen:o,showLogout:l,onLogout:u,sidebarAgentMode:d=!1,onToggleSidebarMode:h,onAgentSelect:f}){const p=localStorage.getItem("sso_domain")||"",g=[{key:"chat",icon:E.jsx(IKe,{}),title:"对话"},...["maiduo","eccang"].includes(p)?[{key:"plan",icon:E.jsx(UCr,{}),title:"自动化Beta"}]:[],{key:"professional",icon:E.jsx(TKe,{}),title:"专业智能体"}],v=[...p==="yunduo"?[]:[{key:"toolbox",icon:E.jsx(M_r,{}),label:"工具箱"},{key:"goals",icon:E.jsx(vCr,{}),label:"目标追踪"}],{key:"settings",icon:E.jsx(I_r,{}),label:"系统设置"}];return E.jsx("div",{className:"wandox-aside-wrap",children:E.jsxs("div",{className:`wandox-aside ${r?"wandox-aside--collapsed":""} ${i||""}`,"aria-hidden":r,children:[E.jsxs("div",{className:"wandox-aside-header",children:[E.jsx("span",{className:"wandox-aside-header__title",children:"AI 智能体"}),n&&E.jsx("button",{type:"button",className:"wandox-aside-header-toggle",onClick:n,"aria-label":r?"展开侧边栏":"收起侧边栏",title:r?"展开侧边栏":"收起侧边栏",children:E.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 24 24",children:[E.jsx("title",{children:r?"展开侧边栏":"收起侧边栏"}),E.jsx("path",{fill:"currentColor",d:"M21 5H11v14h10zM3 5h6v14H3zm0-2a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zm2 4.25a.75.75 0 0 0 0 1.5h2a.75.75 0 0 0 0-1.5zm-.75 3.5A.75.75 0 0 1 5 10h2a.75.75 0 0 1 0 1.5H5a.75.75 0 0 1-.75-.75m.75 2a.75.75 0 0 0 0 1.5h2a.75.75 0 0 0 0-1.5z"})]})})]}),E.jsx("div",{className:"wandox-aside-main-nav",children:E.jsx("div",{className:"wandox-aside-nav-list",children:g.map(y=>{const x=a===y.key,b=y.key==="professional";return E.jsxs("div",{children:[E.jsxs("div",{className:`wandox-aside-nav-item-wrap${x?" wandox-aside-nav-item-wrap--active":""}`,children:[E.jsxs("button",{type:"button",onClick:()=>s==null?void 0:s(y.key),className:`wandox-aside-nav-item${x?" wandox-aside-nav-item--active":""}`,children:[E.jsx("span",{className:"wandox-aside-nav-icon",children:y.icon}),E.jsx("span",{className:"wandox-aside-nav-title",children:y.title})]}),b&&!r&&h&&E.jsx(ki,{title:d?"收起列表":"展开列表",placement:"right",children:E.jsx("button",{type:"button",className:`wandox-aside-mode-toggle${d?" wandox-aside-mode-toggle--active":""}`,onClick:w=>{w.stopPropagation(),h()},children:d?E.jsx(Tge,{style:{fontSize:11}}):E.jsx(u3,{style:{fontSize:11}})})})]}),b&&(d||r)&&E.jsx("div",{className:"wandox-aside-agent-list",children:t.map(w=>{const S=w.agent_id;if(!S)return null;const _=e===S&&a==="professional";return E.jsx(ki,{title:w.name,placement:"right",children:E.jsxs("button",{type:"button",className:`wandox-aside-agent-item${_?" wandox-aside-agent-item--active":""}`,onClick:()=>{f==null||f(S),a!=="professional"&&(s==null||s("professional"))},children:[E.jsx("span",{className:"wandox-aside-agent-icon",children:A_(w.icon)}),E.jsx("span",{className:"wandox-aside-agent-name",children:w.name})]})},S)})})]},y.key)})})}),E.jsxs("div",{className:"wandox-aside-bottom",children:[E.jsx("p",{className:"wandox-aside-group-label",children:"系统功能"}),E.jsxs("div",{className:"wandox-aside-nav-list wandox-aside-nav-list--bottom",children:[v.map(y=>{const x=y.key!=="toolbox"&&a===y.key;return E.jsxs("button",{type:"button",onClick:()=>{if(y.key==="toolbox"){o==null||o();return}s==null||s(y.key)},className:`wandox-aside-nav-item${x?" wandox-aside-nav-item--active":""}`,children:[E.jsx("span",{className:"wandox-aside-nav-icon",children:y.icon}),E.jsx("span",{className:"wandox-aside-nav-title",children:y.label})]},y.key)}),l&&E.jsxs("button",{type:"button",onClick:u,className:"wandox-aside-nav-item wandox-aside-nav-item--logout",children:[E.jsx("span",{className:"wandox-aside-nav-icon",children:E.jsx(g_r,{})}),E.jsx("span",{className:"wandox-aside-nav-title",children:"退出登录"})]})]}),E.jsx("div",{style:{height:8}})]})]})})}function Utn({title:e="正在进入指定智能体",description:t="正在加载智能体与剧本信息..."}){return E.jsxs("output",{className:"wandox-initial-route-loading","aria-label":e,children:[E.jsxs("div",{className:"wandox-initial-route-loading-aura","aria-hidden":"true",children:[Array.from({length:12},(r,n)=>({angle:n*30,delay:n*.08})).map(({angle:r,delay:n})=>E.jsx("span",{className:"wandox-chat-history-ray",style:{"--ray-angle":`${r}deg`,"--ray-delay":`${n}s`}},r)),E.jsx("div",{className:"wandox-chat-empty-icon",children:E.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[E.jsx("path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"}),E.jsx("path",{d:"M20 2v4"}),E.jsx("path",{d:"M22 4h-4"}),E.jsx("circle",{cx:"4",cy:"20",r:"2"})]})})]}),E.jsx("div",{className:"wandox-initial-route-loading-title",children:e}),E.jsx("div",{className:"wandox-initial-route-loading-text",children:t})]})}function qtn(e){const{children:t}=e;return E.jsx("div",{className:"wandox-layout wandox-root",children:E.jsx("main",{className:"wandox-layout-content",style:{padding:0},children:t})})}const Ytn="wandox_use_map_tree_goals_v2",Ktn=/^\?+$/;function Xtn(e){return`${Ytn}:${e||"all"}`}function Mmt(e){const t=e,r=Array.isArray(t==null?void 0:t.roles)?t:t==null?void 0:t.data;return Array.isArray(r==null?void 0:r.roles)?r.roles.map(n=>{const i=(n.goals||[]).filter(a=>a.playbook!==null).map(a=>({...a,icon:Pmt(a.icon),items:(a.items||[]).filter(s=>s.playbook_id)})).filter(a=>{var s;return(a.items||[]).length>0||!!(a.playbook_id||(s=a.playbook)!=null&&s.playbook_id)});return{...n,icon:Pmt(n.icon),goals:i,goal_count:i.length}}).filter(n=>(n.goals||[]).length>0):[]}function Pmt(e){const t=String(e||"").trim();if(!(!t||Ktn.test(t)))return t}function Ztn({agentId:e,onPlaybookClick:t,onSelectPlaybook:r,expanded:n,onExpandedChange:i}){const[a,s]=C.useState(!1),[o,l]=C.useState(!1),[u,d]=C.useState(!1),[h,f]=C.useState([]),[p,g]=C.useState(""),[m,v]=C.useState(""),y=C.useMemo(()=>e==null?"":String(e).trim(),[e]),x=n??a,b=C.useMemo(()=>h.find(_=>_.role_code===p)||h[0],[h,p]);C.useEffect(()=>{d(!1),f([]),g(""),v("")},[y]),C.useEffect(()=>{if(!x||u)return;let _=!1;const T=Xtn(y);return(async()=>{l(!0),v("");try{const A=window.localStorage.getItem(T);if(A)try{const M=Mmt(JSON.parse(A));M.length>0&&(f(M),g(M[0].role_code))}catch{window.localStorage.removeItem(T)}const $=await Rkr({agent_id:y,role_id:null});if(_)return;const I=Mmt($.data);f(I),g(M=>{var L;return M||((L=I[0])==null?void 0:L.role_code)||""}),window.localStorage.setItem(T,JSON.stringify($.data||{roles:[]}))}catch{_||v("使用地图加载失败")}finally{_||(d(!0),l(!1))}})(),()=>{_=!0}},[x,u,y]);const w=_=>{var $,I;const T=_.playbook_id||(($=_.playbook)==null?void 0:$.playbook_id),k=((I=_.playbook)==null?void 0:I.name)||_.title||_.name||"执行";if(!T)return;if(s(!1),i==null||i(!1),CCe(_).length>0&&r){r(ern(_),k);return}t({message:k,playbook_id:T})},S=()=>{const _=!x;s(_),i==null||i(_)};return E.jsxs("div",{className:`wandox-use-map${x?" wandox-use-map--expanded":""}`,children:[E.jsx("div",{className:"wandox-use-map-toolbar",children:E.jsxs("button",{type:"button",className:"wandox-use-map-toggle",onClick:S,"aria-expanded":x,children:[E.jsx("span",{className:"wandox-scene-tab-mark wandox-scene-tab-mark--use-map","aria-hidden":"true",children:E.jsx(CKe,{})}),E.jsx("span",{className:"wandox-use-map-toggle-text",children:"使用地图"}),E.jsx("span",{className:"wandox-use-map-toggle-arrow","aria-hidden":"true",children:"⌄"})]})}),x&&E.jsx("div",{className:`wandox-use-map-panel${h.length===0?" wandox-use-map-panel--compact":""}`,children:(!u||o)&&h.length===0?E.jsxs("div",{className:"wandox-use-map-loading",children:[E.jsx("span",{className:"wandox-heartbeat-loader","aria-hidden":"true",children:E.jsx("svg",{width:"48",height:"24",viewBox:"0 0 48 24",fill:"none",children:E.jsx("path",{d:"M0 12 L8 12 L10 8 L12 16 L14 4 L16 12 L20 12 L22 10 L24 14 L26 10 L28 12 L48 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),E.jsx("span",{children:"正在加载使用地图"})]}):m?E.jsxs("div",{className:"wandox-use-map-empty",children:[E.jsx("div",{className:"wandox-use-map-empty-title",children:m}),E.jsx("button",{type:"button",className:"wandox-use-map-retry",onClick:()=>d(!1),children:"重新加载"})]}):h.length===0?E.jsxs("div",{className:"wandox-use-map-empty",children:[E.jsx("div",{className:"wandox-use-map-empty-title",children:"暂无使用地图"}),E.jsx("div",{className:"wandox-use-map-empty-desc",children:"当前智能体还没有配置岗位目标剧本"})]}):E.jsxs(E.Fragment,{children:[E.jsx("div",{className:"wandox-use-map-roles",role:"tablist","aria-label":"岗位",children:h.map(_=>{var T;return E.jsxs("button",{type:"button",role:"tab","aria-selected":(b==null?void 0:b.role_code)===_.role_code,className:`wandox-use-map-role${(b==null?void 0:b.role_code)===_.role_code?" active":""}`,onClick:()=>g(_.role_code),children:[E.jsx("span",{className:"wandox-use-map-role-icon",children:_.icon||"◎"}),E.jsx("span",{className:"wandox-use-map-role-name",children:_.name}),E.jsx("span",{className:"wandox-use-map-role-count",children:_.goal_count||((T=_.goals)==null?void 0:T.length)||0})]},_.id)})}),E.jsx("div",{className:"wandox-use-map-goals",children:((b==null?void 0:b.goals)||[]).map(_=>{var T;return E.jsxs("section",{className:"wandox-use-map-goal-group",children:[E.jsxs("div",{className:"wandox-use-map-goal-group-head",children:[E.jsx("span",{className:"wandox-use-map-goal-group-icon",children:_.icon||"◇"}),E.jsx("span",{className:"wandox-use-map-goal-group-name",children:_.name}),E.jsxs("span",{className:"wandox-use-map-goal-group-count",children:[((T=_.items)==null?void 0:T.length)||0," 个剧本"]}),(_.description||_.subtitle)&&E.jsxs("span",{className:"wandox-use-map-goal-group-desc",children:["· ",_.description||_.subtitle]})]}),E.jsx("div",{className:"wandox-use-map-goal-items",children:(_.items||[]).map(k=>{var I,M,L;const A=CCe(k).length>0,$=Qtn(k.tags);return E.jsxs("button",{type:"button",className:`wandox-use-map-playbook-card${k.is_featured?" wandox-use-map-playbook-card--featured":""}`,onClick:()=>w(k),children:[E.jsx("div",{className:"wandox-use-map-playbook-title",children:E.jsx("span",{className:"wandox-use-map-playbook-name",children:k.title||k.name||((I=k.playbook)==null?void 0:I.name)||"未命名剧本"})}),(k.is_featured||A)&&E.jsxs("div",{className:"wandox-use-map-playbook-badges",children:[k.is_featured&&E.jsx(io,{color:"gold",className:"wandox-use-map-tag wandox-use-map-featured-tag",children:"精品"}),A&&E.jsx("span",{className:"wandox-use-map-param-badge",children:"参数"})]}),(k.subtitle||k.description||((M=k.playbook)==null?void 0:M.description))&&E.jsx("div",{className:"wandox-use-map-playbook-desc",children:k.subtitle||k.description||((L=k.playbook)==null?void 0:L.description)}),$.length>0&&E.jsx("div",{className:"wandox-use-map-playbook-tags",children:$.map((R,N)=>E.jsx(io,{color:R.variant==="soft"?void 0:R.color,className:"wandox-use-map-tag",style:Jtn(R),children:R.name},`${R.name}-${N}`))})]},`${_.id}-${k.id||k.playbook_id}`)})})]},_.id)})})]})})]})}function CCe(e){var t;return e.input_fields||((t=e.playbook)==null?void 0:t.input_fields)||[]}function Qtn(e){return Array.isArray(e)?e.reduce((t,r)=>{const n=typeof(r==null?void 0:r.name)=="string"?r.name.trim():"";return n&&t.push({...r,name:n}),t},[]):[]}function Jtn(e){if(!(e.variant!=="soft"||!e.color))return{color:e.color,borderColor:Dmt(e.color,.28),backgroundColor:Dmt(e.color,.08)}}function Dmt(e,t){const r=e.trim().replace("#","");if(!/^[0-9a-fA-F]{6}$/.test(r))return e;const n=Number.parseInt(r.slice(0,2),16),i=Number.parseInt(r.slice(2,4),16),a=Number.parseInt(r.slice(4,6),16);return`rgba(${n}, ${i}, ${a}, ${t})`}function ern(e){var r;const t=e.playbook||e;return{category:e.category??null,category_name:e.category_name,description:e.description||e.subtitle||t.description,domain:e.domain||"",id:Number(e.id||0),name:((r=e.playbook)==null?void 0:r.name)||e.title||e.name||"未命名剧本",playbook_id:e.playbook_id||t.playbook_id||"",scope:"",status:e.status||t.status||"",sub_category:null,tags:null,type:e.type||"",version:"",input_fields:CCe(e),video_url:e.video_url||t.video_url||void 0,video_duration:e.video_duration||t.video_duration,view_count:e.view_count,badge:e.badge||t.badge||null}}function trn(e){if(!e)return"";const t=Date.now()-new Date(e).getTime(),r=Math.floor(t/864e5),n=Math.floor(t/36e5);return r===1?"昨天":r>1?`${r} 天前`:n>=1?`${n} 小时前`:"刚刚"}const I_=e=>String(e.playbook_id||e.code||e.name);function rrn({label:e}){return E.jsxs("output",{className:"wandox-scene-list-loading","aria-label":e,children:[E.jsx("span",{className:"wandox-heartbeat-loader","aria-hidden":"true",children:E.jsx("svg",{width:"48",height:"24",viewBox:"0 0 48 24",fill:"none",children:E.jsx("path",{d:"M0 12 L8 12 L10 8 L12 16 L14 4 L16 12 L20 12 L22 10 L24 14 L26 10 L28 12 L48 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),E.jsx("span",{children:e})]})}function Omt({playbooks:e,playbookLoading:t,onPlaybookClick:r,onSelectPlaybook:n,recommendations:i=[],userPlaybooks:a=[],userPlaybooksLoading:s=!1,onLoadUserPlaybooks:o,agentId:l,recentRefreshKey:u=0}){const[d,h]=C.useState("playbooks"),[f,p]=C.useState(!1),[g,m]=C.useState(!1),[v,y]=C.useState("全部"),[x,b]=C.useState(""),[w,S]=C.useState(null),[_,T]=C.useState(""),[k,A]=C.useState(!1),[$,I]=C.useState([]),[M,L]=C.useState(!1),R=C.useMemo(()=>d==="recommendations"?t&&i.length===0:d==="user"?s:M||t&&e.length===0,[t,M,d,e.length,i.length,s]),N=C.useMemo(()=>l==null?"":String(l).trim(),[l]);C.useEffect(()=>{if(!N){I([]),L(!1);return}let X=!1;return(async()=>{L(!0);try{const K=await qEr({limit:8,agent_id:N});X||I(K.data||[])}catch{X||I([])}finally{X||L(!1)}})(),()=>{X=!0}},[N,u]);const P=C.useRef(null),[D,O]=C.useState(5),B=C.useCallback(()=>{if(!P.current)return;const X=P.current.offsetWidth;if(X===0)return;const K=Math.floor(X/(200+12));O(Math.max(2,K))},[]);C.useEffect(()=>{const X=setTimeout(B,100);return()=>clearTimeout(X)},[B,d,f]),C.useEffect(()=>{d==="recommendations"&&i.length===0&&h("playbooks")},[i.length,d]),C.useEffect(()=>{d!=="user"||!N||o==null||o()},[d,N,o]),C.useEffect(()=>{if(!P.current)return;const X=new ResizeObserver(()=>{B()});return X.observe(P.current),()=>X.disconnect()},[B]);const F=C.useMemo(()=>new Set($.map(I_)),[$]),j=C.useMemo(()=>new Set(a.map(I_)),[a]),V=C.useMemo(()=>{const X=new Map;for(const Q of $.filter(J=>!j.has(I_(J))))X.set(I_(Q),Q);for(const Q of e){const J=I_(Q);X.has(J)||X.set(J,Q)}return Array.from(X.values())},[e,$,j]),H=d==="playbooks"?V:d==="recommendations"?i:a,W=d==="playbooks"?e:H,U=H.length>(D??5)&&W.length>0,q=C.useMemo(()=>{const X=new Map;X.set("全部",W.length);for(const Q of W){const J=Q.category_name||"未分类";X.set(J,(X.get(J)||0)+1)}return Array.from(X.entries()).map(([Q,J])=>({name:Q,count:J}))},[W]),Y=C.useMemo(()=>{let X=W;if(v!=="全部"&&(X=X.filter(Q=>(Q.category_name||"未分类")===v)),x.trim()){const Q=x.trim().toLowerCase();X=X.filter(J=>{var K;return J.name.toLowerCase().includes(Q)||((K=J.description)==null?void 0:K.toLowerCase().includes(Q))})}return X},[W,v,x]);return E.jsxs("div",{className:"wandox-pro-scenes-panel",children:[E.jsxs("div",{className:"wandox-hub-section-header",children:[E.jsxs("div",{className:"wandox-scene-tabs",children:[E.jsxs("button",{type:"button",className:`wandox-scene-tab${!f&&d==="playbooks"?" active":""}`,onClick:()=>{h("playbooks"),p(!1)},children:[E.jsx("span",{className:"wandox-scene-tab-mark wandox-scene-tab-mark--playbooks","aria-hidden":"true",children:E.jsx(_Ke,{})}),E.jsx("span",{children:"默认场景"})]}),i.length>0&&E.jsxs("button",{type:"button",className:`wandox-scene-tab${!f&&d==="recommendations"?" active":""}`,onClick:()=>{h("recommendations"),p(!1)},children:[E.jsx("span",{className:"wandox-scene-tab-mark wandox-scene-tab-mark--recommendations","aria-hidden":"true",children:E.jsx(TKe,{})}),E.jsx("span",{children:"推荐场景"})]}),E.jsxs("button",{type:"button",className:`wandox-scene-tab${!f&&d==="user"?" active":""}`,onClick:()=>{h("user"),p(!1)},children:[E.jsx("span",{className:"wandox-scene-tab-mark wandox-scene-tab-mark--user","aria-hidden":"true",children:E.jsx(F_r,{})}),E.jsx("span",{children:"我的场景"})]}),E.jsx(Ztn,{agentId:N,onPlaybookClick:r,onSelectPlaybook:n,expanded:f,onExpandedChange:X=>{p(X),X&&h("playbooks")}})]}),U&&!f&&E.jsxs("button",{type:"button",className:"wandox-scene-view-all",onClick:()=>m(!0),children:["查看全部 ",W.length," 个"]})]}),E.jsx("div",{className:"wandox-tab-content",children:!f&&E.jsx("div",{className:"wandox-hub-section",children:R?E.jsx(rrn,{label:d==="user"?"正在加载我的场景":d==="recommendations"?"正在匹配推荐场景":"正在加载场景"}):H.length>0?E.jsxs("div",{className:"wandox-scroll-row",ref:P,children:[H.slice(0,D??5).map(X=>{const Q=!!(X.input_fields&&X.input_fields.length>0),J=()=>{Q&&n?n(X,X.name):r({message:X.name,playbook_id:X.playbook_id})},K=d==="playbooks"&&F.has(I_(X)),Z=d==="user"?"用户":K?"近期":X.badge==="new"?"New":X.badge==="recommend"?"推荐":X.badge==="featured"?"精选":X.category_name||X.type||"推荐",ee=X.video_duration?`${Math.floor(X.video_duration/60)}:${String(X.video_duration%60).padStart(2,"0")}`:"",te=async se=>{var ve;se.stopPropagation(),S(X),A(!0);try{const he=await nZe({playbook_id:X.playbook_id});T(((ve=he.data)==null?void 0:ve.video_url)||X.video_url||"")}catch{T(X.video_url||"")}finally{A(!1)}},ae={daily:"每日",weekly:"每周",monthly:"每月"},le=X.is_subscribed?`🔔订阅${X.execution_frequency&&X.execution_frequency!=="none"?`·${ae[X.execution_frequency]}自动跑`:""}`:"",oe=[X.description,le].filter(Boolean).join(" "),re=[X.last_executed_at&&trn(X.last_executed_at),X.execution_count!==void 0&&`已跑 ${X.execution_count} 次`].filter(Boolean).join(" · ");return E.jsxs("div",{className:"wandox-card",children:[E.jsxs("div",{className:"wandox-card-corner",children:[E.jsx("span",{className:"wandox-card-tag",children:Z}),X.video_url&&E.jsxs("button",{type:"button",className:"wandox-card-video",onClick:te,children:["▶ ",ee?` ${ee}`:"0:00"," 演示"]})]}),E.jsxs("button",{type:"button",className:"wandox-card-main",onClick:J,children:[E.jsx("div",{className:"wandox-card-title",children:X.name}),E.jsx("div",{className:"wandox-card-desc",children:K&&re||oe})]})]},I_(X))}),U&&E.jsxs("button",{type:"button",className:"wandox-card wandox-card-more",onClick:()=>m(!0),children:[E.jsxs("div",{className:"wandox-card-more-title",children:["查看全部 ",W.length," 个"]}),E.jsx("div",{className:"wandox-card-more-desc",children:"按场景浏览"})]})]}):E.jsx("div",{className:"wandox-empty-slot",children:E.jsxs("div",{className:"wandox-empty",children:[E.jsx("div",{className:"wandox-empty-text",children:d==="playbooks"?"暂无默认场景":d==="recommendations"?"暂无推荐场景":"暂无我的场景"}),E.jsx("div",{className:"wandox-empty-desc",children:d==="playbooks"?"请联系管理员添加场景剧本":d==="recommendations"?"系统会根据情况推荐相关场景":"我创建的场景会显示在这里"})]})})})}),E.jsx(Ci,{open:g,onCancel:()=>{m(!1),y("全部"),b("")},footer:null,width:900,closable:!1,centered:!0,styles:{container:{padding:0,overflow:"hidden"},body:{height:"90vh"}},zIndex:1e4,children:E.jsxs("div",{className:"wandox-playbook-browser",children:[E.jsxs("div",{className:"wandox-playbook-sidebar",children:[E.jsx("div",{className:"wandox-playbook-sidebar-title",children:"场景分类"}),E.jsx("div",{className:"wandox-playbook-categories",children:q.map(X=>E.jsxs("button",{type:"button",className:`wandox-playbook-category-item${v===X.name?" active":""}`,onClick:()=>y(X.name),children:[E.jsx("span",{className:"wandox-playbook-category-name",children:X.name}),E.jsx("span",{className:"wandox-playbook-category-count",children:X.count})]},X.name))})]}),E.jsxs("div",{className:"wandox-playbook-main",children:[E.jsx("div",{className:"wandox-playbook-search",children:E.jsx(zr,{placeholder:"搜索场景名称或描述...",prefix:E.jsx(nS,{style:{color:"#9ca3af"}}),value:x,onChange:X=>b(X.target.value),allowClear:!0})}),E.jsx("div",{className:"wandox-playbook-list",children:Y.length===0?E.jsx(is,{description:"暂无剧本",style:{marginTop:80}}):Y.map(X=>{const Q=X.input_fields&&X.input_fields.length>0,J=!!X.video_url,K=()=>{m(!1),y("全部"),b(""),Q&&n?n(X,X.name):r({message:X.name,playbook_id:X.playbook_id})},Z=X.video_duration?`${Math.floor(X.video_duration/60)}:${String(X.video_duration%60).padStart(2,"0")}`:"",ee=async()=>{var te;S(X),A(!0);try{const ae=await nZe({playbook_id:X.playbook_id});T(((te=ae.data)==null?void 0:te.video_url)||X.video_url||"")}catch{$t.error("视频加载失败"),T(X.video_url||"")}finally{A(!1)}};return E.jsx("div",{className:"wandox-playbook-list-item",children:E.jsxs("div",{className:"wandox-playbook-list-item-content",children:[E.jsx("div",{className:"wandox-playbook-list-item-icon",children:J?E.jsx("button",{className:"wandox-playbook-video-icon",title:"包含演示视频",onClick:ee,type:"button",children:E.jsx(Wp,{})}):E.jsx("div",{className:"wandox-playbook-no-video-icon",children:E.jsx(oqe,{})})}),E.jsxs("div",{className:"wandox-playbook-list-item-body",children:[E.jsx("div",{className:"wandox-playbook-list-item-header",children:E.jsxs("div",{className:"wandox-playbook-list-item-title",children:[X.name,X.badge&&E.jsx("span",{className:`wandox-scene-badge wandox-scene-badge--${X.badge}`,children:X.badge==="new"?"New":X.badge==="recommend"?"推荐":"精选"})]})}),X.description&&E.jsx("div",{className:"wandox-playbook-list-item-desc",children:X.description}),X.last_execution_remark&&E.jsxs("div",{className:"wandox-playbook-list-item-remark",children:[E.jsx("span",{className:"wandox-playbook-list-item-remark-icon",children:"💡"}),E.jsxs("span",{children:["上次:",X.last_execution_remark]})]})]}),E.jsxs("div",{className:"wandox-playbook-list-item-actions",children:[E.jsx("button",{type:"button",className:"wandox-playbook-list-item-btn",onClick:K,children:Q?"参数":"运行"}),J&&E.jsxs("button",{type:"button",className:"wandox-playbook-demo-link",onClick:ee,children:["看演示",Z?` ${Z}`:""]})]})]})},X.playbook_id)})})]})]})}),w&&E.jsx(Ci,{open:!0,onCancel:()=>{S(null),T("")},footer:null,centered:!0,width:800,title:E.jsxs("span",{children:[E.jsx(Wp,{style:{marginRight:8,color:"#7c3aed"}}),w.name," · 演示视频",w.video_duration&&E.jsxs("span",{style:{marginLeft:12,fontSize:13,color:"#9ca3af",fontWeight:"normal"},children:["时长 ",Math.floor(w.video_duration/60),":",String(w.video_duration%60).padStart(2,"0")]}),w.view_count!==void 0&&E.jsxs("span",{style:{marginLeft:12,fontSize:13,color:"#9ca3af",fontWeight:"normal"},children:["👁 ",w.view_count," 次播放"]})]}),styles:{body:{padding:"12px 0 0"}},zIndex:10001,children:k?E.jsx("div",{style:{height:400,display:"flex",alignItems:"center",justifyContent:"center",background:"#000",borderRadius:8},children:E.jsx(no.Node,{active:!0,style:{width:200,height:200}})}):E.jsx("video",{src:_,controls:!0,autoPlay:!0,style:{width:"100%",borderRadius:8,display:"block",maxHeight:"70vh",background:"#000"},children:E.jsx("track",{kind:"captions"})})})]})}const Bmt=[{name:"country",label:"国家/地区"},{name:"state",label:"州/省"},{name:"province",label:"省"},{name:"city",label:"城市"},{name:"postal_code",label:"邮政编码"},{name:"address_line1",label:"地址"}],nrn=Object.fromEntries(Bmt.map(e=>[e.name,e.label]));function p9(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function y5(e){return typeof e=="string"?e.trim():String(e??"").trim()}function irn(e,t){return!p9(e)||!Array.isArray(e[t])?[]:e[t].map(String).filter(Boolean)}function arn(e,t){if(!p9(e)||!p9(e.postal_code_patterns))return;const r=e.postal_code_patterns[t];return typeof r=="string"?r:void 0}function rQ(e){const t=String(e.type||"").toLowerCase(),r=String(e.widget||"").toLowerCase();return t==="address"||r==="address"}function srn(){return[...Bmt]}function Fmt(e,t){if(!p9(e))return"请输入有效地址";const r=irn(t,"required_fields"),n=r.length>0?r:["country","city","postal_code","address_line1"];for(const l of n)if(!y5(e[l]))return`请填写${nrn[l]||`地址字段 ${l}`}`;if(r.length===0&&!y5(e.state)&&!y5(e.province))return"请填写州/省";const i=y5(e.country).toUpperCase(),a=y5(e.postal_code),s=arn(t,i);if(a&&s)try{if(!new RegExp(s).test(a))return"邮政编码格式不正确"}catch{return"地址邮编规则配置无效"}const o=p9(t)&&typeof t.max_length=="number"?t.max_length:200;return y5(e.address_line1).length>o?`地址行不能超过 ${o} 个字符`:""}function zmt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function _Ce(e){return["array","list","tags","multi_select","multiselect"].includes(String(e||"").toLowerCase())}function jmt(e){return(e==null?void 0:e.includes("image"))??!1}function nQ(e){return(e.ui_component||e.widget||e.type||"string").toLowerCase()}function Vmt(e){return nQ(e)==="segmented"||e.type.toLowerCase()==="segmented"}function Hmt(e){var t;return(t=e.options)!=null&&t.length?e.options:(e.enum||[]).map(r=>({value:r,label:r}))}function orn(e){return e==null?"":typeof e=="string"||typeof e=="number"||typeof e=="bigint"?e:String(e)}function lrn(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function TCe(e){return typeof e=="string"||typeof e=="number"||e instanceof Date||Yr.isDayjs(e)?Yr(e):null}function crn(e){return Array.isArray(e)?e.map(t=>String(t)):e==null||e===""?[]:[String(e)]}function vy(e){return e==null||e===""||Array.isArray(e)&&e.length===0}function b5(e,t={}){const r={};for(const n of e){const i=t[n.name];i!==void 0&&i!==""?r[n.name]=i:n.default!==void 0&&n.default!==""?r[n.name]=n.default:n.type.toLowerCase()==="boolean"?r[n.name]=!1:["number","integer","float"].includes(n.type.toLowerCase())?r[n.name]=void 0:_Ce(n.type)?r[n.name]=[]:r[n.name]=""}return r}function g9(e,t){return Array.isArray(e)?e.some(r=>g9(r,t)):String(e??"")===String(t??"")}function urn(e){return Array.isArray(e)?e.filter(zmt):zmt(e)?"field"in e||"name"in e||"param"in e?[e]:Object.entries(e).map(([t,r])=>({field:t,equals:r})):[]}function drn(e,t){const r=String(e.field??e.name??e.param??"");if(!r)return!0;const n=t[r],i=e.equals!==void 0||e.value!==void 0,a=e.equals??e.value;return!(i&&!g9(n,a)||e.not_equals!==void 0&&g9(n,e.not_equals)||Array.isArray(e.in)&&!e.in.some(s=>g9(n,s))||Array.isArray(e.not_in)&&e.not_in.some(s=>g9(n,s))||e.truthy===!0&&!n||e.empty===!0&&!vy(n)||e.empty===!1&&vy(n))}function m9(e,t){return e.filter(r=>{const n=urn(r.visible_when);return n.length===0||n.every(i=>drn(i,t))})}function Wmt(e,t){return e.reduce((r,n)=>(r[n.name]=t[n.name],r),{})}function hrn(e){return Array.isArray(e)?e.map(t=>String(t)):e?[String(e)]:[]}function ECe(e){return e!=null&&e!==""}function kCe(e){return typeof e=="string"||typeof e=="number"||e instanceof Date||Yr.isDayjs(e)?Yr(e,"HH:mm"):null}function frn(e,t){const r=_Ce(e.type),n=crn(t),i=ECe(t)?String(t):void 0;return{isMulti:r,selectValue:r?n:i,isEmptySelect:r?n.length===0:i===void 0,hasCurrentSelection:r?n.length>0:i!==void 0}}function ACe({field:e,value:t,readOnly:r=!1,size:n,uploading:i=!1,imageUploadMode:a="picture",fileNameMap:s={},getOptionState:o,onChange:l,onUpload:u,onDownloadTemplate:d,draftValue:h,onDraftChange:f,onDraftCommit:p,selectSearchValue:g,onSelectSearchChange:m,onSelectAllowEmptySearch:v}){var S,_,T,k;const y=h??String(orn(t)),x=nQ(e),b=A=>l(e.name,A),w=()=>{var B,F;const A=o(e),$=e.options_from_skill?A.options:Hmt(e),I=!!(e.options_from_skill||(B=e.enum)!=null&&B.length||(F=e.options)!=null&&F.length),M=A.waitingForDependencies?"请先选择关联参数":A.placeholder||e.placeholder||"请选择",{isMulti:L,selectValue:R,isEmptySelect:N,hasCurrentSelection:P}=frn(e,t),D=m!==void 0,O=()=>{v==null||v(e.name),g&&(m==null||m(e.name,""))};return E.jsx(on,{allowClear:!r,showSearch:!r,size:n,autoClearSearchValue:!D,optionFilterProp:"label",filterOption:(j,V)=>{const H=j.trim().toLowerCase();return H?String((V==null?void 0:V.label)??(V==null?void 0:V.value)??"").toLowerCase().includes(H):!0},mode:L?I?"multiple":"tags":void 0,value:R,searchValue:r||!D?void 0:g,placeholder:N?M:void 0,options:$,loading:!r&&A.loading,disabled:!r&&A.waitingForDependencies,open:r?!1:void 0,tabIndex:r?-1:void 0,"aria-readonly":r,tokenSeparators:L&&!I?[","]:void 0,notFoundContent:A.loading?E.jsx(Yi,{size:"small"}):A.error||null,onInputKeyDown:j=>{["Backspace","Delete","Escape"].includes(j.key)&&(v==null||v(e.name))},onSearch:D?j=>m(e.name,j):void 0,onChange:j=>{b(j);const V=Array.isArray(j)?j.length>0:ECe(j);(P||V)&&O()},onClear:O,onBlur:O})};if(Vmt(e)){const A=Hmt(e);return A.length===0?w():E.jsx(zfe,{className:"wandox-agent-input-field-control__segmented",options:A,value:ECe(t)?String(t):void 0,disabled:r,onChange:b})}if(rQ(e)){const A=t&&typeof t=="object"&&!Array.isArray(t)?t:{},$=(I,M)=>{r||b({...A,[I]:M})};return E.jsxs("div",{className:"wandox-agent-input-field-control__address",children:[srn().map(({name:I,label:M})=>E.jsx(zr,{size:n,value:String(A[I]??""),readOnly:r,placeholder:M,onChange:L=>$(I,L.target.value)},I)),E.jsx(zr,{size:n,value:String(A.address_line2??""),readOnly:r,placeholder:"地址补充",onChange:I=>$("address_line2",I.target.value)})]})}switch(x){case"file":{const A=e.max_files??1,$=hrn(t),I=$.length<A,M=L=>{b(A<=1?"":$.filter((R,N)=>N!==L))};if(a==="picture"&&jmt(e.file_type)){const L=$.map((R,N)=>({uid:String(N),name:s[R]||R.split("/").pop()||`image_${N+1}`,status:"done",url:R}));return E.jsx(Hp,{className:"wandox-agent-input-field-control__picture",accept:e.file_type||void 0,listType:"picture-card",fileList:L,customRequest:r?void 0:u(e.name,A),onRemove:r?void 0:R=>(M(Number(R.uid)),!0),disabled:r||i,maxCount:A,showUploadList:{showRemoveIcon:!r},children:I&&!r&&E.jsxs("div",{children:[i?E.jsx(Yi,{size:"small"}):E.jsx(yu,{}),E.jsx("div",{className:"wandox-agent-input-field-control__upload-text",children:"上传图片"})]})})}return E.jsxs("div",{className:"wandox-agent-input-field-control__files",children:[$.map((L,R)=>E.jsxs("div",{className:"wandox-agent-input-field-control__file",children:[E.jsx("span",{children:s[L]||L.split("/").pop()||L}),!r&&E.jsx(ur,{type:"text",size:"small",danger:!0,"aria-label":"移除文件",icon:E.jsx(Lv,{}),onClick:()=>M(R)})]},L)),e.file_templates&&e.file_templates.length>0&&E.jsxs("div",{className:"wandox-agent-input-field-control__templates",children:[E.jsx("span",{children:"模板文件"}),e.file_templates.map((L,R)=>E.jsx(ur,{size:"small",onClick:()=>d==null?void 0:d(L),children:L.name||"下载模板"},`${L.path}-${L.name||R}`))]}),I&&!r&&E.jsxs(Hp.Dragger,{accept:e.file_type||void 0,showUploadList:!1,customRequest:u(e.name,A),disabled:i,children:[E.jsx("p",{className:"ant-upload-drag-icon",children:i?E.jsx(Yi,{size:"small"}):E.jsx(IO,{})}),E.jsx("p",{className:"ant-upload-text",children:i?"上传中...":"点击或拖拽文件上传"}),A>1&&E.jsxs("p",{className:"ant-upload-hint",children:["已上传 ",$.length,"/",A]})]})]})}case"boolean":return E.jsx(Lc,{size:n==="small"?"small":"default",checked:!!t,disabled:r,onChange:b});case"number":case"integer":case"float":return E.jsx(bu,{size:n,value:lrn(t),readOnly:r,placeholder:e.placeholder||"请输入",onChange:b});case"date":return E.jsx(nl,{size:n,value:TCe(t),allowClear:!r,inputReadOnly:r,open:r?!1:void 0,placeholder:e.placeholder||"请选择日期",onChange:(A,$)=>b($)});case"daterange":return E.jsx(nl.RangePicker,{size:n,value:Array.isArray(t)&&t.length===2?[TCe(t[0]),TCe(t[1])]:null,allowClear:!r,inputReadOnly:r,open:r?!1:void 0,placeholder:["请选择开始日期","请选择结束日期"],onChange:(A,$)=>b($)});case"time":return E.jsx(wu,{size:n,value:kCe(t),allowClear:!r,inputReadOnly:r,open:r?!1:void 0,format:"HH:mm",placeholder:e.placeholder||"请选择时间",onChange:(A,$)=>b($)});case"timerange":return E.jsx(wu.RangePicker,{size:n,value:Array.isArray(t)&&t.length===2?[kCe(t[0]),kCe(t[1])]:null,allowClear:!r,inputReadOnly:r,open:r?!1:void 0,format:"HH:mm",placeholder:["请选择开始时间","请选择结束时间"],onChange:(A,$)=>b($)});case"select":case"array":case"list":case"tags":case"multi_select":case"multiselect":return w();case"string":return(S=e.enum)!=null&&S.length||(_=e.options)!=null&&_.length||e.options_from_skill?w():E.jsx(zr,{size:n,value:y,readOnly:r,placeholder:e.placeholder||"请输入",onChange:r?void 0:A=>f?f(e.name,A.target.value):b(A.target.value),onBlur:r?void 0:A=>p==null?void 0:p(e.name,A.target.value)});default:return(T=e.enum)!=null&&T.length||(k=e.options)!=null&&k.length||e.options_from_skill?w():E.jsx(zr.TextArea,{value:y,readOnly:r,autoSize:{minRows:2,maxRows:8},placeholder:e.placeholder||"请输入",onChange:r?void 0:A=>f?f(e.name,A.target.value):b(A.target.value),onBlur:r?void 0:A=>p==null?void 0:p(e.name,A.target.value)})}}const Gmt=/\$\{\s*\{?\s*params\.([a-zA-Z0-9_.-]+)\s*\}?\s*\}/g,prn=/^\$\{\s*\{?\s*params\.([a-zA-Z0-9_.-]+)\s*\}?\s*\}$/;function $_(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ICe(e,t){return t.split(".").reduce((r,n)=>{if($_(r))return r[n]},e)}function grn(e){return e==null||e===""}function mrn(e){const t=new Set,r=n=>{if(typeof n=="string"){for(const i of n.matchAll(Gmt))i[1]&&t.add(i[1]);return}if(Array.isArray(n)){n.forEach(r);return}$_(n)&&Object.values(n).forEach(r)};return r(e),Array.from(t)}function vrn(e,t){const r=e.split(".")[0],n=t.find(i=>i.name===e||i.name===r);return n?!!n.required:!0}function $Ce(e,t){if(typeof e=="string"){const r=e.match(prn);return r!=null&&r[1]?ICe(t,r[1]):e.replace(Gmt,(n,i)=>{const a=ICe(t,i);return a==null?"":String(a)})}return Array.isArray(e)?e.map(r=>$Ce(r,t)):$_(e)?Object.fromEntries(Object.entries(e).map(([r,n])=>[r,$Ce(n,t)])):e}function yrn(e){const t=$_(e)&&"data"in e?e.data:e,r=[t];$_(t)&&(r.push(t.output_data,t.options,t.items,t.data,t.result,t.results,t.list),$_(t.output)&&r.push(t.output.output_data,t.output.options,t.output.items,t.output.data));for(const n of r)if(Array.isArray(n))return n;return[]}function brn(e){let t;return{options:yrn(e).map(n=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return{value:String(n),label:String(n)};if(!$_(n))return null;const i=n.value??n.key??n.code??n.id??n.name??n.label;if(i==null)return null;const a=n.label??n.name??n.title??n.text??n.value??i;if(String(i)===""){const s=String(a||"");return s&&!t&&(t=s),null}return{value:String(i),label:String(a)}}).filter(n=>!!n),placeholder:t}}function xrn(e){return(e.enum||[]).map(t=>({value:t,label:t}))}function iQ(e,t,r){const[n,i]=C.useState({}),a=C.useRef({}),s=C.useRef({}),o=C.useMemo(()=>e.filter(l=>!!l.options_from_skill),[e]);return C.useEffect(()=>{const l=new Set(o.map(u=>u.name));for(const u of Object.keys(a.current))l.has(u)||(delete a.current[u],delete s.current[u]);i(u=>{const d=Object.fromEntries(Object.entries(u).filter(([h])=>l.has(h)));return Object.keys(d).length===Object.keys(u).length?u:d})},[o]),C.useEffect(()=>{for(const l of o){if(!l.options_from_skill)continue;const d=mrn(l.options_params).filter(m=>vrn(m,e)&&grn(ICe(t,m))),h=$Ce(l.options_params||{},t),f=JSON.stringify({skill_id:l.options_from_skill,params:h,missing:d});if(a.current[l.name]===f)continue;const p=a.current[l.name]!==void 0||d.length>0;a.current[l.name]=f,s.current[l.name]=(s.current[l.name]||0)+1;const g=s.current[l.name];if(p&&r(m=>m[l.name]===void 0||m[l.name]===""?m:{...m,[l.name]:void 0}),d.length>0){i(m=>({...m,[l.name]:{options:[],loading:!1,waitingForDependencies:!0}}));continue}i(m=>{var v,y;return{...m,[l.name]:{options:((v=m[l.name])==null?void 0:v.options)||[],loading:!0,placeholder:(y=m[l.name])==null?void 0:y.placeholder,waitingForDependencies:!1}}}),oZe({},{skill_id:l.options_from_skill,params:h}).then(m=>{if(s.current[l.name]!==g)return;const v=brn(m);i(y=>({...y,[l.name]:{options:v.options,loading:!1,placeholder:v.placeholder,waitingForDependencies:!1}}))}).catch(m=>{if(s.current[l.name]!==g)return;const v=m instanceof Error?m.message:"动态选项加载失败";i(y=>({...y,[l.name]:{options:[],loading:!1,error:v,waitingForDependencies:!1}}))})}},[o,e,t,r]),{getFieldState(l){return l.options_from_skill?n[l.name]||{options:[],loading:!1,waitingForDependencies:!1}:{options:xrn(l),loading:!1,waitingForDependencies:!1}}}}function x5(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function R_(e,t=""){return typeof e=="string"?e:e==null?t:String(e)}function Qm(e){return typeof e=="string"?e:void 0}function Umt(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function wrn(e){if(!Array.isArray(e))return;const t=e.map(r=>{if(!x5(r))return null;const n=R_(r.path);return n?{name:R_(r.name,n.split("/").pop()||n),path:n}:null}).filter(r=>!!r);return t.length>0?t:void 0}function Srn(e){if(!Array.isArray(e))return;const t=e.map(r=>{if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")return{value:String(r),label:String(r)};if(!x5(r))return null;const n=r.value??r.key??r.code??r.id??r.name??r.label;return n==null||n===""?null:{value:String(n),label:R_(r.label??r.title??r.text??r.name??n,String(n))}}).filter(r=>!!r);return t.length>0?t:void 0}function RCe(e){const t=x5(e)?e:{};return{name:R_(t.name),label:R_(t.label,R_(t.name)),type:R_(t.type,"string"),required:typeof t.required=="boolean"?t.required:!0,default:t.default,mock:t.mock,enum:Array.isArray(t.enum)?t.enum.map(r=>String(r)):void 0,options:Srn(t.options),placeholder:Qm(t.placeholder),options_from_skill:Qm(t.options_from_skill),options_params:x5(t.options_params)?t.options_params:void 0,file_type:Qm(t.file_type),max_files:Umt(t.max_files),description:Qm(t.description),hint:Qm(t.hint??t.label_hint??t.helper_text),file_templates:wrn(t.file_templates),group:Qm(t.group??t.group_key??t.form_group),group_label:Qm(t.group_label??t.group_title),group_description:Qm(t.group_description??t.group_subtitle),ui_component:Qm(t.ui_component??t.component??t.render_as),widget:Qm(t.widget),address_validation:t.address_validation??t.addressValidation,span:Umt(t.span??t.col_span??t.column_span),visible_when:t.visible_when??t.visibleWhen}}function NCe(e){return Array.isArray(e)?e.map(RCe).filter(t=>!!t.name):x5(e)?Object.entries(e).map(([t,r])=>x5(r)?RCe({...r,name:r.name??t}):RCe({name:t,label:t,type:"string",default:r})).filter(t=>!!t.name):[]}function Crn(e){return e instanceof Error?e.message:"上传失败"}function _rn({open:e,playbook:t,onClose:r,onSubmit:n}){const i=C.useMemo(()=>NCe(t==null?void 0:t.input_fields),[t]),[a,s]=C.useState({}),[o,l]=C.useState({}),[u,d]=C.useState({}),h=iQ(i,a,s),f=C.useMemo(()=>m9(i,a),[i,a]);C.useEffect(()=>{e&&(s({...b5(i),...(t==null?void 0:t.initial_params)??{}}),l({}),d({}))},[i,e,t==null?void 0:t.initial_params]);const p=C.useCallback((v,y)=>{s(x=>({...x,[v]:y}))},[]),g=C.useCallback((v,y)=>async({file:x,onSuccess:b,onError:w})=>{var S,_;l(T=>({...T,[v]:!0}));try{const T=x,k=await OS(T),A=(S=k==null?void 0:k.data)==null?void 0:S.url,$=((_=k==null?void 0:k.data)==null?void 0:_.name)||T.name;if(!A)throw new Error("上传结果缺少文件地址");d(I=>({...I,[A]:$})),s(I=>{if(y<=1)return{...I,[v]:A};const M=Array.isArray(I[v])?I[v]:I[v]?[I[v]]:[];return{...I,[v]:[...M,A]}}),b==null||b(k),$t.success("上传成功")}catch(T){const k=T instanceof Error?T:new Error(Crn(T));w==null||w(k),$t.error(k.message)}finally{l(T=>({...T,[v]:!1}))}},[]),m=()=>{if(!t)return;const v=f.filter(y=>y.required&&vy(a[y.name]));if(v.length>0){$t.warning(`请填写必填参数:${v.map(y=>y.label).join("、")}`);return}n(t,a)};return E.jsxs(t3,{className:"wandox-playbook-params-drawer",title:E.jsxs("div",{className:"wandox-playbook-params-drawer__title",children:[E.jsx("span",{className:"wandox-playbook-params-drawer__title-main",children:"填写执行参数"}),E.jsx("span",{className:"wandox-playbook-params-drawer__title-sub",children:t==null?void 0:t.name})]}),open:e,width:640,destroyOnHidden:!0,maskClosable:!1,onClose:r,footer:E.jsx("div",{className:"wandox-playbook-params-drawer__footer",children:E.jsxs(il,{children:[E.jsx(ur,{onClick:r,children:"取消"}),E.jsx(ur,{type:"primary",onClick:m,children:"开始执行"})]})}),children:[E.jsxs("div",{className:"wandox-playbook-params-drawer__intro",children:[E.jsx("span",{children:"填写本次运行需要的参数"}),E.jsxs("span",{children:[f.length," 项"]})]}),E.jsxs(Sn,{layout:"vertical",className:"wandox-playbook-params-drawer__form",children:[f.map(v=>E.jsx(Sn.Item,{required:v.required,label:E.jsxs("span",{className:"wandox-playbook-params-drawer__label",children:[v.label,v.description||v.hint?E.jsx(ki,{title:v.description||v.hint,children:E.jsx(fO,{"aria-label":`${v.label}说明`})}):null]}),children:E.jsx(ACe,{field:v,value:a[v.name],uploading:!!o[v.name],fileNameMap:u,getOptionState:h.getFieldState,onChange:p,onUpload:g,onDownloadTemplate:y=>window.open(y.path,"_blank","noopener,noreferrer")})},v.name)),f.length===0?E.jsxs("div",{className:"wandox-playbook-params-drawer__empty",children:[E.jsx(Yi,{size:"small"})," 正在读取参数配置"]}):null]})]})}function Trn({playbooks:e,onPlaybookClick:t,onPlaybookDelete:r,activePlaybookId:n}){const{t:i}=fm(),[a,s]=C.useState(""),[o,l]=C.useState(!1),[u,d]=C.useState(null),[h,f]=C.useState(!1),p=e.filter(y=>{var x;return y.name.toLowerCase().includes(a.toLowerCase())||((x=y.description)==null?void 0:x.toLowerCase().includes(a.toLowerCase()))}),g=(y,x)=>{x.stopPropagation(),d(y),l(!0)},m=async()=>{if(u){f(!0);try{await GEr(u.playbook_id),r==null||r(u.playbook_id),l(!1),d(null)}catch{}finally{f(!1)}}},v=()=>{l(!1),d(null)};return E.jsxs("div",{className:"wandox-solidified-list",children:[E.jsx("div",{className:"wandox-solidified-list-search",children:E.jsx(zr.Search,{placeholder:"搜索",value:a,onChange:y=>s(y.target.value),allowClear:!0,enterButton:!1})}),E.jsx("div",{className:"wandox-solidified-list-content",children:p.length===0?E.jsx(is,{description:i(a?"noData":"solidified.empty"),image:is.PRESENTED_IMAGE_SIMPLE}):E.jsx("div",{className:"wandox-solidified-list-grid",children:p.map(y=>E.jsxs("div",{className:`wandox-solidified-card ${n===y.playbook_id?"active":""}`,onClick:()=>t==null?void 0:t(y.playbook_id),onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(t==null||t(y.playbook_id))},role:"button",tabIndex:0,children:[E.jsx("div",{className:"wandox-solidified-card-icon",children:E.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"2",fill:"none"}),E.jsx("path",{d:"M9 3v18M15 3v18M3 9h18M3 15h18",stroke:"currentColor",strokeWidth:"1.5"}),E.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor"})]})}),E.jsxs("div",{className:"wandox-solidified-card-content",children:[E.jsx("div",{className:"wandox-solidified-card-name",children:y.name}),y.description&&E.jsx("div",{className:"wandox-solidified-card-desc",children:y.description})]}),E.jsx("button",{type:"button",className:"wandox-solidified-card-delete",onClick:x=>g(y,x),title:i("solidified.delete"),children:E.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:E.jsx("path",{d:"M6 7v12a2 2 0 002 2h8a2 2 0 002-2V7M4 7h16M10 11v6M14 11v6M9 7V4a1 1 0 011-1h4a1 1 0 011 1v3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},y.playbook_id))})}),E.jsx(Ci,{title:i("solidified.deleteConfirm"),open:o,onOk:m,onCancel:v,okText:i("confirm"),cancelText:i("cancel"),okButtonProps:{danger:!0,loading:h},children:E.jsxs("p",{children:[i("solidified.deleteConfirm")," 「",u==null?void 0:u.name,"」?"]})})]})}function Ern({inputParams:e,onSearch:t,loading:r=!1}){const[n]=Sn.useForm();C.useEffect(()=>{const s={};for(const o of e)o.default!==void 0&&o.default!==null&&o.default!==""&&(s[o.name]=o.default);n.setFieldsValue(s)},[e,n]);const i=()=>{n.validateFields().then(s=>{const o={};for(const l of Object.keys(s)){const u=s[l];u!=null&&u!==""&&(o[l]=u)}t(o)})},a=s=>{const{name:o,type:l,description:u}=s,d={placeholder:u||`请输入${o}`};switch(l){case"integer":return E.jsx(bu,{...d,style:{width:"100%"}});case"array":return E.jsx(zr,{...d});case"boolean":return E.jsx(zr,{...d});case"string":default:return E.jsx(zr,{...d})}};return E.jsx("div",{className:"wandox-solidify-params-form",children:E.jsxs(Sn,{form:n,layout:"inline",onFinish:i,style:{marginBottom:16},children:[e.map(s=>E.jsx(Sn.Item,{name:s.name,label:s.description||s.name,rules:[{required:s.required,message:`请输入${s.description||s.name}`}],style:{marginBottom:8},children:a(s)},s.name)),E.jsx(Sn.Item,{style:{marginBottom:8},children:E.jsx(ur,{type:"primary",htmlType:"submit",loading:r,children:"查询"})})]})})}const w5={fontSize:13,fontWeight:600,color:"#374151",marginBottom:6};function krn({open:e,onClose:t,onSuccess:r,editingSchedule:n,webhooks:i}){const a=!n,[s,o]=C.useState(""),[l,u]=C.useState(!0),[d,h]=C.useState(""),[f,p]=C.useState(0),[g,m]=C.useState(""),[v,y]=C.useState(""),[x,b]=C.useState(""),[w,S]=C.useState([]),[_,T]=C.useState({}),[k,A]=C.useState(!1),[$,I]=C.useState({}),[M,L]=C.useState({}),[R,N]=C.useState([]),[P,D]=C.useState([]),[O,B]=C.useState(!1),[F,j]=C.useState(!1),V=C.useCallback(async(Z,ee)=>{var te;if(!Z){S([]),T({});return}A(!0);try{const{data:ae}=await fq({playbook_id:Z}),le=((te=ae==null?void 0:ae.content)==null?void 0:te.yaml_content)||"";let oe=[];if(le)try{const re=oq.parse(le),se=re==null?void 0:re.params;Array.isArray(se)&&se.length>0?oe=se:se&&typeof se=="object"&&(oe=Object.values(se))}catch{}if(S(oe),oe.length>0){const re={};for(const se of oe){const ve=ee==null?void 0:ee[se.name];ve!==void 0?re[se.name]=ve:se.default!==void 0&&se.default!==null&&(re[se.name]=se.default)}T(re)}else T({})}catch{S([])}A(!1)},[]),H=C.useCallback(async()=>{var Z,ee;B(!0);try{const[te,ae]=await Promise.all([HEr({page:1,page_size:200}),x0e({page:1,page_size:100})]),le=((Z=te==null?void 0:te.data)==null?void 0:Z.items)??(Array.isArray(te==null?void 0:te.data)?te==null?void 0:te.data:[]),oe=((ee=ae==null?void 0:ae.data)==null?void 0:ee.items)??(Array.isArray(ae==null?void 0:ae.data)?ae==null?void 0:ae.data:[]);N(le.map(re=>({value:re.playbook_id??String(re.id),label:re.name}))),D(oe.map(re=>({value:String(re.id),label:re.name})))}catch{}B(!1)},[]);C.useEffect(()=>{if(e)if(p(Z=>Z+1),I({}),L({}),n){o(n.name||""),u(n.is_active),h(n.cron_expression||"");const Z=n.playbook_params||{};T(Z),V(n.playbook_id||"",Z)}else o(""),u(!0),h(""),m(""),y(""),b(""),S([]),T({}),H()},[e,n,V,H]),C.useEffect(()=>{a&&(g?V(g):(S([]),T({})))},[g,a,V]);const W=(Z,ee)=>{T(te=>({...te,[Z]:ee}))},U=Z=>async({file:ee,onSuccess:te,onError:ae})=>{var le,oe;I(re=>({...re,[Z.name]:!0}));try{const re=ee,se=await OS(re),ve=(le=se==null?void 0:se.data)==null?void 0:le.url,he=((oe=se==null?void 0:se.data)==null?void 0:oe.name)||re.name||(ve==null?void 0:ve.split("/").pop())||"未知文件";if(!ve)throw new Error("上传失败");L(Ce=>({...Ce,[ve]:he})),(Z.max_files??1)<=1?W(Z.name,ve):T(Ce=>{const Le=Array.isArray(Ce[Z.name])?Ce[Z.name]:Ce[Z.name]?[Ce[Z.name]]:[];return{...Ce,[Z.name]:[...Le,ve]}}),te==null||te(se),$t.success("上传成功")}catch(re){ae==null||ae(re instanceof Error?re:new Error("文件上传失败")),$t.error(re instanceof Error?re.message:"文件上传失败")}finally{I(re=>({...re,[Z.name]:!1}))}},q=Z=>{if(!Z)return null;const ee=Yr(Z);return ee.isValid()?ee:null},Y=Z=>{if(!Array.isArray(Z)||Z.length!==2)return null;const ee=Yr(Z[0]),te=Yr(Z[1]);return ee.isValid()&&te.isValid()?[ee,te]:null},X=Z=>{if(!Z)return null;const ee=Yr(`2000-01-01 ${Z}`);return ee.isValid()?ee:null},Q=Z=>{if(!Array.isArray(Z)||Z.length!==2)return null;const ee=Yr(`2000-01-01 ${Z[0]}`),te=Yr(`2000-01-01 ${Z[1]}`);return ee.isValid()&&te.isValid()?[ee,te]:null},J=Z=>{const ee=_[Z.name];switch(Z.type){case"string":return E.jsx(zr.TextArea,{value:ee??"",onChange:te=>W(Z.name,te.target.value),autoSize:{minRows:1,maxRows:4},placeholder:Z.description||""});case"number":case"integer":case"float":return E.jsx(bu,{style:{width:"100%"},value:ee,onChange:te=>W(Z.name,te),placeholder:Z.description||"",precision:Z.type==="integer"?0:void 0,size:"small"});case"boolean":return E.jsx(Lc,{size:"small",checked:!!ee,onChange:te=>W(Z.name,te)});case"array":case"object":return E.jsx(zr.TextArea,{value:typeof ee=="string"?ee:ee!=null?JSON.stringify(ee):"",onChange:te=>W(Z.name,te.target.value),autoSize:{minRows:1,maxRows:4},placeholder:Z.description||"JSON 格式"});case"file":{const te=Z.max_files??1,ae=Array.isArray(ee)?ee.map(String):ee?[String(ee)]:[],le=ae.length<te,oe=re=>{te<=1?W(Z.name,""):W(Z.name,ae.filter((se,ve)=>ve!==re))};return E.jsxs("div",{children:[ae.length>0&&E.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6,marginBottom:8},children:ae.map((re,se)=>E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,minHeight:30,padding:"4px 8px",border:"1px solid #e5e7eb",borderRadius:6,background:"#fff"},children:[E.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:12},children:M[re]||re.split("/").pop()||re}),E.jsx(ur,{type:"text",size:"small",danger:!0,onClick:()=>oe(se),children:"删除"})]},re))}),le&&E.jsx(Hp,{accept:Z.file_type||void 0,showUploadList:!1,customRequest:U(Z),disabled:!!$[Z.name],children:E.jsx(ur,{size:"small",icon:E.jsx(IO,{}),loading:!!$[Z.name],children:$[Z.name]?"上传中...":"点击上传"})})]})}case"date":return E.jsx(nl,{style:{width:"100%"},value:q(ee),onChange:(te,ae)=>W(Z.name,ae),placeholder:Z.description||"选择日期"});case"dateRange":return E.jsx(nl.RangePicker,{style:{width:"100%"},value:Y(ee),onChange:(te,ae)=>W(Z.name,ae),placeholder:["开始日期","结束日期"]});case"time":return E.jsx(wu,{style:{width:"100%"},value:X(ee),format:"HH:mm",onChange:(te,ae)=>W(Z.name,ae),placeholder:Z.description||"选择时间"});case"timeRange":return E.jsx(wu.RangePicker,{style:{width:"100%"},value:Q(ee),format:"HH:mm",onChange:(te,ae)=>W(Z.name,ae),placeholder:["开始时间","结束时间"]});default:return E.jsx(zr,{value:ee??"",onChange:te=>W(Z.name,te.target.value),placeholder:Z.description||"",size:"small"})}},K=async()=>{if(!s.trim()){$t.warning("请输入任务名称");return}if(!d.trim()){$t.warning("请配置调度频率");return}if(a&&!g){$t.warning("请选择剧本");return}const Z=w.length>0?_:void 0;j(!0);try{n?(await dZe(n.schedule_id,{},{name:s,cron_expression:d,schedule_type:"custom",is_active:l,playbook_params:Z}),$t.success("更新成功")):(await cZe({},{name:s,agent_id:v,playbook_id:g,webhook_id:x,cron_expression:d,schedule_type:"custom",playbook_params:Z}),$t.success("创建成功")),r(),t()}catch(ee){$t.error((ee==null?void 0:ee.message)||"操作失败")}finally{j(!1)}};return E.jsxs(Ci,{title:null,open:e,onOk:K,onCancel:t,okText:"保存",cancelText:"取消",width:540,confirmLoading:F,closable:!1,children:[E.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:20},children:[E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[E.jsx(rl,{style:{fontSize:20,color:"#722ed1"}}),E.jsx("span",{style:{fontSize:16,fontWeight:600,color:"#111827"},children:a?"新增定时任务":"编辑定时任务"})]}),E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[E.jsx("span",{style:{fontSize:13,color:l?"#111827":"#9ca3af"},children:l?"已启用":"已禁用"}),E.jsx(Lc,{checked:l,onChange:u})]})]}),E.jsxs("div",{style:{marginBottom:16},children:[E.jsxs("div",{style:w5,children:["任务名称 ",E.jsx("span",{style:{color:"#ef4444"},children:"*"})]}),E.jsx(zr,{value:s,onChange:Z=>o(Z.target.value),placeholder:"请输入任务名称",style:{borderRadius:8}})]}),a&&E.jsxs(Yi,{spinning:O,children:[E.jsxs("div",{style:{marginBottom:16},children:[E.jsxs("div",{style:w5,children:["剧本 ",E.jsx("span",{style:{color:"#ef4444"},children:"*"})]}),E.jsx(on,{style:{width:"100%"},value:g||void 0,onChange:Z=>m(Z),options:R,placeholder:"请选择剧本",showSearch:!0,filterOption:(Z,ee)=>{var te;return(te=ee==null?void 0:ee.label)==null?void 0:te.toLowerCase().includes(Z.toLowerCase())}})]}),E.jsxs("div",{style:{marginBottom:16},children:[E.jsx("div",{style:w5,children:"智能体"}),E.jsx(on,{style:{width:"100%"},value:v||void 0,onChange:Z=>y(Z),options:P,placeholder:"请选择智能体(可选)",showSearch:!0,allowClear:!0,filterOption:(Z,ee)=>{var te;return(te=ee==null?void 0:ee.label)==null?void 0:te.toLowerCase().includes(Z.toLowerCase())}})]}),E.jsxs("div",{style:{marginBottom:16},children:[E.jsx("div",{style:w5,children:"通知 Webhook"}),E.jsx(on,{style:{width:"100%"},value:x||void 0,onChange:Z=>b(Z),options:i.map(Z=>({value:Z.webhook_id,label:Z.name})),placeholder:"请选择 Webhook(可选)",allowClear:!0})]})]}),E.jsxs("div",{style:{marginBottom:16},children:[E.jsx("div",{style:w5,children:"调度频率"}),E.jsx(bCe,{defaultValue:n==null?void 0:n.cron_expression,onChange:Z=>h(Z)},f)]}),k&&E.jsxs("div",{style:{textAlign:"center",padding:"12px 0"},children:[E.jsx(Yi,{size:"small"}),E.jsx("span",{style:{marginLeft:8,fontSize:12,color:"#9ca3af"},children:"加载参数配置..."})]}),!k&&w.length>0&&E.jsxs("div",{style:{marginBottom:16},children:[E.jsx("div",{style:w5,children:"执行参数"}),E.jsx("div",{style:{background:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:8,padding:"12px 16px"},children:w.map(Z=>E.jsxs("div",{style:{marginBottom:12},children:[E.jsxs("div",{style:{fontSize:12,fontWeight:500,color:"#374151",marginBottom:4},children:[Z.label||Z.name,Z.required&&E.jsx("span",{style:{color:"#ef4444",marginLeft:2},children:"*"})]}),Z.description&&E.jsx("div",{style:{fontSize:11,color:"#9ca3af",marginBottom:4},children:Z.description}),J(Z)]},Z.name))})]})]})}const Arn={daily:"每天",weekly:"每周",monthly:"每月",workday:"工作日",custom:"自定义"},Irn={1:"周一",2:"周二",3:"周三",4:"周四",5:"周五",6:"周六",7:"周日",0:"周日"};function $rn(e){const t=XZ(e),r=`${String(t.hour).padStart(2,"0")}:${String(t.minute).padStart(2,"0")}`;switch(t.unit){case"hour":return t.interval===1?`每小时第 ${t.minute} 分`:`每 ${t.interval} 小时`;case"week":return`每${t.weekDays.map(i=>Irn[i]||"").filter(Boolean).join("、")} ${r}`;case"month":return t.interval===1?`每月 ${t.monthDay} 号 ${r}`:`每 ${t.interval} 月 ${t.monthDay} 号 ${r}`;case"year":return`每年 ${t.yearMonth} 月 ${t.yearDay} 日 ${r}`;case"day":return t.interval===1?`每天 ${r}`:`每 ${t.interval} 天 ${r}`;case"custom":return t.customCron.trim()?`自定义:${t.customCron.trim()}`:e;default:return e}}const Rrn=({className:e})=>{const[t,r]=C.useState([]),[n,i]=C.useState(!1),[a,s]=C.useState(!1),[o,l]=C.useState(null),[u]=Sn.useForm(),[d,h]=C.useState(),[f,p]=C.useState([]),[g,m]=C.useState(!1),[v,y]=C.useState(!1),[x,b]=C.useState(null);C.useEffect(()=>{S(),M()},[]);const w=[{label:"钉钉",value:"dingtalk"},{label:"飞书",value:"feishu"},{label:"企业微信",value:"wecom"}],S=async()=>{try{i(!0);const D=await pq({});D!=null&&D.data&&r(D.data)}catch(D){$t.error((D==null?void 0:D.message)||"加载失败")}finally{i(!1)}},_=()=>{l(null),u.resetFields(),h(void 0),s(!0)},T=async D=>{try{i(!0);const O=await QEr(D.webhook_id,{}),B=(O==null?void 0:O.data)||D;l(B),h(B.platform),u.setFieldsValue({...B,notify_time:B.notify_start_time&&B.notify_end_time?[Yr(B.notify_start_time,"HH:mm:ss"),Yr(B.notify_end_time,"HH:mm:ss")]:void 0}),s(!0)}catch(O){$t.error((O==null?void 0:O.message)||"获取详情失败")}finally{i(!1)}},k=async D=>{try{i(!0),await tkr(D.webhook_id,{}),$t.success("测试消息发送成功")}catch(O){$t.error((O==null?void 0:O.message)||"测试失败")}finally{i(!1)}},A=D=>{Ci.confirm({title:"确认删除",content:`确定要删除 Webhook "${D.name}" 吗?`,okText:"确定",cancelText:"取消",onOk:async()=>{try{await ekr(D.webhook_id,{}),$t.success("删除成功"),S()}catch(O){$t.error((O==null?void 0:O.message)||"删除失败")}}})},$=async()=>{var D,O,B,F;try{const j=await u.validateFields();i(!0);const V={name:j.name,description:j.description,platform:j.platform,webhook_url:j.webhook_url,secret:j.secret,notify_start_time:(O=(D=j.notify_time)==null?void 0:D[0])==null?void 0:O.format("HH:mm:ss"),notify_end_time:(F=(B=j.notify_time)==null?void 0:B[1])==null?void 0:F.format("HH:mm:ss"),is_active:j.is_active,is_default:j.is_default};o?(await JEr(o.webhook_id,{},V),$t.success("更新成功")):(await lZe({},V),$t.success("创建成功")),s(!1),u.resetFields(),S()}catch(j){$t.error((j==null?void 0:j.message)||"操作失败")}finally{i(!1)}},I=[{title:"名称",dataIndex:"name",key:"name",width:150,render:(D,O)=>{const B={dingtalk:E.jsx(KCr,{style:{color:"#1677ff"}}),feishu:E.jsx(IKe,{style:{color:"#1677ff"}}),wecom:E.jsx(G_r,{style:{color:"#1677ff"}})};return E.jsxs(il,{size:4,children:[B[O.platform],E.jsx("span",{children:D})]})}},{title:"描述",dataIndex:"description",key:"description",ellipsis:!0},{title:"通知时段",key:"notify_time",width:150,render:(D,O)=>!O.notify_start_time||!O.notify_end_time?"全天":`${O.notify_start_time} ~ ${O.notify_end_time}`},{title:"状态",dataIndex:"is_active",key:"is_active",width:80,render:D=>E.jsx("span",{style:{color:D?"#52c41a":"#999"},children:D?"启用":"禁用"})},{title:"默认",dataIndex:"is_default",key:"is_default",width:80,render:D=>D?E.jsx("span",{style:{color:"#1890ff"},children:"是"}):"否"},{title:"操作",key:"action",width:210,render:(D,O)=>E.jsxs(il,{size:0,children:[E.jsx(ur,{type:"link",size:"small",icon:E.jsx(EO,{}),onClick:()=>T(O),className:"wandox-webhook-action-btn",children:E.jsx("span",{className:"wandox-webhook-action-text",children:"编辑"})}),E.jsx(ur,{type:"link",size:"small",icon:E.jsx(kme,{}),onClick:()=>k(O),className:"wandox-webhook-action-btn",children:E.jsx("span",{className:"wandox-webhook-action-text",children:"测试"})}),E.jsx(ur,{type:"link",size:"small",danger:!0,icon:E.jsx(Lv,{}),onClick:()=>A(O),className:"wandox-webhook-action-btn",children:E.jsx("span",{className:"wandox-webhook-action-text",children:"删除"})})]})}],M=async()=>{try{m(!0);const D=await uZe({});if(D!=null&&D.data){const O=Array.isArray(D.data)?D.data:D.data.items||[];p(O)}}catch{}finally{m(!1)}},L=D=>{if(D.cron_expression)return $rn(D.cron_expression);const O=Arn[D.schedule_type]||D.schedule_type,B=D.schedule_time||"--:--";return`${O} ${B}`},R=D=>{b(D),y(!0)},N=D=>{Ci.confirm({title:"确认删除",content:`确定要删除定时任务「${D.name}」吗?`,okText:"确定",cancelText:"取消",onOk:async()=>{try{await hZe(D.schedule_id,{}),$t.success("删除成功"),M()}catch(O){$t.error((O==null?void 0:O.message)||"删除失败")}}})},P=[{title:"任务名称",dataIndex:"name",key:"name",width:150,render:D=>E.jsxs(il,{size:4,children:[E.jsx(rl,{style:{color:"#722ed1"}}),E.jsx("span",{children:D})]})},{title:"调度规则",key:"schedule_desc",width:180,render:(D,O)=>E.jsx("span",{style:{fontFamily:"monospace",fontSize:12},children:L(O)})},{title:"Webhook",dataIndex:"webhook_name",key:"agent_name",width:120,ellipsis:!0,render:D=>D||"-"},{title:"状态",dataIndex:"is_active",key:"is_active",width:70,render:D=>E.jsx(io,{color:D?"green":"default",children:D?"启用":"禁用"})},{title:"操作",key:"action",width:140,render:(D,O)=>E.jsxs(il,{size:0,children:[E.jsx(ur,{type:"link",size:"small",icon:E.jsx(EO,{}),onClick:()=>R(O),className:"wandox-webhook-action-btn",children:E.jsx("span",{className:"wandox-webhook-action-text",children:"编辑"})}),E.jsx(ur,{type:"link",size:"small",danger:!0,icon:E.jsx(Lv,{}),onClick:()=>N(O),className:"wandox-webhook-action-btn",children:E.jsx("span",{className:"wandox-webhook-action-text",children:"删除"})})]})}];return E.jsxs("div",{className:`wandox-webhook-management ${e||""}`,children:[E.jsx("div",{className:"wandox-webhook-header",children:E.jsx(ur,{type:"primary",size:"middle",icon:E.jsx(yu,{}),onClick:_,style:{borderRadius:"6px",fontWeight:500,boxShadow:"0 2px 4px rgba(24, 144, 255, 0.2)"},children:"新增"})}),E.jsx(xu,{size:"small",columns:I,dataSource:t,rowKey:"webhook_id",loading:n,pagination:{pageSize:10,showSizeChanger:!0,showTotal:D=>`共 ${D} 条`},scroll:{x:770}}),E.jsx(Ffe,{style:{margin:"16px 0 12px"}}),E.jsx("div",{className:"wandox-schedule-section-header",style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8},children:E.jsxs("div",{className:"wandox-schedule-section-title",children:[E.jsx(rl,{style:{color:"#722ed1",marginRight:6}}),"定时任务"]})}),E.jsx(xu,{size:"small",columns:P,dataSource:f,rowKey:"schedule_id",loading:g,pagination:{pageSize:10,showSizeChanger:!0,showTotal:D=>`共 ${D} 条`},scroll:{x:780}}),E.jsx(Ci,{title:o?"编辑 Webhook":"新增 Webhook",open:a,onOk:$,onCancel:()=>{s(!1),u.resetFields()},width:600,confirmLoading:n,okText:"确定",cancelText:"取消",children:E.jsxs(Sn,{form:u,layout:"horizontal",initialValues:{is_active:!0,is_default:!1},labelCol:{flex:"0 0 80px"},style:{paddingTop:16},children:[E.jsx(Sn.Item,{label:"名称",name:"name",rules:[{required:!0,message:"请输入名称"}],children:E.jsx(zr,{placeholder:"请输入 Webhook 名称"})}),E.jsx(Sn.Item,{label:"描述",name:"description",children:E.jsx(zr.TextArea,{rows:2,placeholder:"请输入描述(可选)"})}),E.jsx(Sn.Item,{label:"平台",name:"platform",rules:[{required:!0,message:"请选择平台"}],children:E.jsx(on,{options:w,placeholder:"请选择平台",onChange:D=>h(D)})}),E.jsx(Sn.Item,{label:"URL",name:"webhook_url",rules:[{required:!0,message:"请输入 Webhook URL"},{type:"url",message:"请输入有效的 URL"}],children:E.jsx(zr,{placeholder:"https://...",autoComplete:"off"})}),d!=="wecom"&&E.jsx(Sn.Item,{label:"签名密钥",name:"secret",rules:[{required:d==="dingtalk"||d==="feishu",message:"请输入签名密钥"}],children:E.jsx(zr.Password,{placeholder:"请输入签名密钥",autoComplete:"new-password"})}),E.jsx(Sn.Item,{label:"通知时段",name:"notify_time",children:E.jsx(wu.RangePicker,{format:"HH:mm",placeholder:["开始时间","结束时间"],style:{width:"100%"}})}),E.jsx(Sn.Item,{label:"启用",name:"is_active",valuePropName:"checked",children:E.jsx(Lc,{})}),E.jsx(Sn.Item,{label:"设为默认",name:"is_default",valuePropName:"checked",children:E.jsx(Lc,{})})]})}),E.jsx(krn,{open:v,onClose:()=>{y(!1),b(null)},onSuccess:M,editingSchedule:x,webhooks:t})]})},{RangePicker:thi}=nl;function Nrn({open:e,loading:t,playbooks:r,activePlaybookId:n,onClose:i,onPlaybookClick:a,onPlaybookDelete:s}){return E.jsx(t3,{title:"工具箱",placement:"right",size:"min(440px, 100vw)",open:e,loading:t,onClose:i,getContainer:!1,rootClassName:"wandox-toolbox-drawer",styles:{body:{padding:0,overflow:"hidden"}},children:E.jsx(Trn,{playbooks:r,onPlaybookClick:a,onPlaybookDelete:s,activePlaybookId:n})})}const Lrn=["智能体对话(不限Token)","默认场景全功能","巡检机器人定时任务"],Mrn=["智能体对话","非 ASIN 查询场景","巡检机器人定时任务"];function v9(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function yy(e){return e==null?!1:typeof e=="string"?e.trim().length>0:!0}function Prn(e){if(Array.isArray(e)){if(e.length===0)return null;const t=e.find(r=>v9(r)?Object.keys(r).length>0:yy(r));return v9(t)?t:yy(t)?{value:t}:null}return v9(e)?Object.keys(e).length>0?e:null:yy(e)?{value:e}:null}function cg(e,t,r=0){if(e){for(const n of t){const i=e[n];if(yy(i))return i}if(!(r>=2))for(const n of Object.values(e)){if(v9(n)){const i=cg(n,t,r+1);if(yy(i))return i}if(Array.isArray(n))for(const i of n){if(!v9(i))continue;const a=cg(i,t,r+1);if(yy(a))return a}}}}function aQ(e){if(yy(e))return String(e).trim()}function S5(e){const t=aQ(e);if(!t)return;const r=t.match(/^(\d{4}-\d{2}-\d{2})/);return(r==null?void 0:r[1])||t}function LCe(e){if(!yy(e))return;if(typeof e=="number"&&Number.isFinite(e))return new Intl.NumberFormat("en-US").format(e);const t=String(e).trim(),r=t.replace(/,/g,""),n=Number(r);return r&&Number.isFinite(n)?new Intl.NumberFormat("en-US").format(n):t}function qmt(e,t){if(!yy(e))return t;const r=String(e).trim();return["infinite","unlimited","∞"].includes(r.toLowerCase())?"∞ 无限":LCe(e)||t}function Drn(e){const t=aQ(e==null?void 0:e.package_name);if(!(!t||t==="无限算力年卡"))return t}function Orn(e){const t=aQ(cg(e,["asin_usage","asin_usage_text","asin_used_display","usage_text"]));if(t)return t;const r=LCe(cg(e,["used_asin","asin_used","used_asin_count","asin_used_count","asin_used_num","asin_num_by_use","used_count","used_num","used","consumed_asin","query_used_count"])),n=LCe(cg(e,["total_asin","asin_total","total_asin_count","asin_total_count","asin_limit","asin_quota","asin_num","total_count","total_num","limit","quota","total"]));if(!(!r&&!n))return`${r||"-"} / ${n||"-"}`}function Brn(e){const t=cg(e,["used_asin","asin_used","used_asin_count","asin_used_count","asin_used_num","asin_num_by_use","used_count","used_num","used","consumed_asin","query_used_count"]),r=cg(e,["total_asin","asin_total","total_asin_count","asin_total_count","asin_limit","asin_quota","asin_num","total_count","total_num","limit","quota","total"]),n=Number(String(t??"").replace(/,/g,"")),i=Number(String(r??"").replace(/,/g,""));if(!(!Number.isFinite(n)||!Number.isFinite(i)||i<=0))return Math.min(Math.round(n/i*100),100)}function MCe(e){var r,n,i,a,s,o,l;if(!e)return null;const t=Prn(e.competitive_asin_info);return t?{kind:"competitiveAsin",badgeText:"包年权益",packageName:aQ(cg(t,["package_name","packageName","plan_name","benefit_name","name","title","package_type"]))||Drn(e.package_info)||"竞品智能体包年权益",subtitle:"竞品智能体专属权益",remainingLabel:"剩余算力(非ASIN查询):",remainingValue:qmt(cg(t,["token_num","tokenNum","remaining_token","token_remaining","remaining_power","power_remaining"])??((r=e.package_info)==null?void 0:r.token_num),"∞ 无限"),asinUsage:Orn(t),asinUsagePercent:Brn(t),endTime:S5(cg(t,["end_time","endTime","expire_time","expired_at","expires_at","end_date","package_end_time"]))||S5((n=e.package_info)==null?void 0:n.end_time)||"-",startTime:S5(cg(t,["start_time","startTime","open_time","opened_at","started_at","start_date","package_start_time"]))||S5((i=e.package_info)==null?void 0:i.start_time)||"-",coverageTitle:"无限算力覆盖范围",coverageItems:Mrn}:e.is_free?{kind:"free",badgeText:"无限算力",packageName:((a=e.package_info)==null?void 0:a.package_name)||"无限算力年卡",subtitle:"亚马逊智能体专属权益",remainingLabel:"剩余算力:",remainingValue:qmt((s=e.package_info)==null?void 0:s.token_num,"∞ 无限"),endTime:S5((o=e.package_info)==null?void 0:o.end_time)||"2027-03-18",startTime:S5((l=e.package_info)==null?void 0:l.start_time)||"2026-03-18",coverageTitle:"无限算力覆盖范围",coverageItems:Lrn}:null}const Frn=[{label:"钉钉",value:"dingtalk"},{label:"飞书",value:"feishu"},{label:"企业微信",value:"wecom"}];function Ymt({open:e,onClose:t,onSuccess:r}){const{t:n}=fm(),[i]=Sn.useForm(),[a,s]=C.useState(!1),[o,l]=C.useState(),u=async()=>{try{const h=await i.validateFields();s(!0);const f={name:h.name,platform:h.platform,webhook_url:h.webhook_url,secret:h.secret||void 0},p=await lZe({},f);p!=null&&p.data?($t.success(n("webhook.createSuccess")),r({webhook_id:p.data.webhook_id||p.data.id,name:h.name,platform:h.platform}),i.resetFields(),t()):$t.error(n("webhook.createFailed"))}catch(h){h instanceof Error&&$t.error(h.message||n("webhook.createFailed"))}finally{s(!1)}},d=()=>{i.resetFields(),l(void 0),t()};return E.jsx(Ci,{title:n("webhook.quickAdd"),open:e,onOk:u,onCancel:d,confirmLoading:a,width:480,destroyOnHidden:!0,zIndex:1e4,children:E.jsxs(Sn,{form:i,layout:"vertical",preserve:!1,children:[E.jsx(Sn.Item,{label:n("webhook.name"),name:"name",rules:[{required:!0,message:n("webhook.nameRequired")}],children:E.jsx(zr,{placeholder:n("webhook.namePlaceholder")})}),E.jsx(Sn.Item,{label:n("webhook.platform"),name:"platform",rules:[{required:!0,message:n("webhook.platformRequired")}],children:E.jsx(on,{options:Frn,placeholder:n("webhook.platformPlaceholder"),onChange:h=>l(h)})}),E.jsx(Sn.Item,{label:"Webhook URL",name:"webhook_url",rules:[{required:!0,message:n("webhook.urlRequired")},{type:"url",message:n("webhook.urlInvalid")}],children:E.jsx(zr,{placeholder:"https://...",autoComplete:"off"})}),o!=="wecom"&&E.jsx(Sn.Item,{label:n("webhook.secret"),name:"secret",rules:[{required:o==="dingtalk"||o==="feishu",message:n("webhook.secretRequired")}],children:E.jsx(zr.Password,{placeholder:n("webhook.secretPlaceholder"),autoComplete:"new-password"})})]})})}const zrn="https://ai.maiduox.com/#/aitools/operation/product";function jrn(e){const{title:t,widgets:r,ssoDomain:n,ssoToken:i,ssoCompany:a,onExecuteComplete:s,activeAgent:o,agents:l,childAgents:u,externalRobotName:d,externalShowPanel:h,agentSwitcher:f}=e;e.onWidgetsUpdate,e.count,fm();const[p,g]=C.useState(!1),[m,v]=C.useState(!1),[y,x]=C.useState(null),[b,w]=C.useState(null),[S,_]=C.useState("results"),[T,k]=C.useState(!1),[A,$]=C.useState([]),[I,M]=C.useState(null),[L,R]=C.useState({}),[N,P]=C.useState([]),[D,O]=C.useState(!1),[B,F]=C.useState(null),[j,V]=C.useState(void 0),[H,W]=C.useState(!1),[U,q]=C.useState(!1),Y=C.useMemo(()=>(u||[]).map(pe=>pe.name),[u]),X=C.useMemo(()=>!o||o==="default"?null:(l==null?void 0:l.find(de=>de.agent_id===o||de.agent_code===o))||null,[o,l]),Q=C.useMemo(()=>MCe(X),[X]);C.useEffect(()=>{w(null)},[o]),C.useEffect(()=>{J(),u&&u.length>0&&K()},[u]),C.useEffect(()=>{if(h&&(g(!0),d)){const pe=Y.find(de=>de===d);pe?w(pe):Y.length>0}},[h,d,Y]);const J=async()=>{try{const pe=await pq({});pe!=null&&pe.data&&P(pe.data.map(de=>({webhook_id:de.webhook_id,name:de.name,platform:de.platform})))}catch{}},K=async()=>{try{const pe={};await Promise.all(u.map(async de=>{var ge;try{const ye=await nkr(de.agent_id,{});(ge=ye==null?void 0:ye.data)!=null&&ge.webhook_id&&(pe[de.agent_id]=ye.data.webhook_id)}catch{}})),R(pe)}catch{}},Z=C.useMemo(()=>b?r.filter(pe=>{var ye;const de=(ye=pe.title)==null?void 0:ye.match(/^(.+?)\s*巡检结果$/);return(de?de[1]:pe.agent_name)===b}):r,[r,b]),ee=C.useMemo(()=>{if(!b)return"";const pe=(u||[]).find(de=>de.name===b);return(pe==null?void 0:pe.agent_id)||""},[b,u]),te=n==="maiduo"&&b==="差评监控",ae=pe=>{const de=b===pe?null:pe;w(de),de&&g(!0)},le=pe=>{F(pe),V(L[pe.agent_id]),O(!0)},oe=C.useCallback(async pe=>{if(pe){k(!0);try{const de=await jEr({agent_id:pe,limit:50});if(de!=null&&de.data&&Array.isArray(de.data)){const ge=de.data.map((ye,ie)=>({id:ye.id||ye.execute_id||`record_${ie}`,action_name:ye.action_name||ye.display_name||"未知动作",action_id:ye.action_id||"",status:ye.status||"pending",created_at:ye.created_at||"",completed_at:ye.completed_at,action_params:ye.action_params,output_type:ye.output_type,output_data:ye.output_data,outputs:ye.outputs,error:ye.error})).sort((ye,ie)=>new Date(ie.created_at).getTime()-new Date(ye.created_at).getTime());$(ge)}else $([])}catch{$([])}finally{k(!1)}}},[]),re=pe=>{if(!pe)return"";try{const de=new Date(pe),ge=de.toLocaleDateString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}),ye=de.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"});return`${ge} ${ye}`}catch{return pe}},se=pe=>({pending:"等待中",running:"执行中",success:"成功",failed:"失败"})[pe]||pe,ve=pe=>({pending:"wandox-exec-status--pending",running:"wandox-exec-status--running",success:"wandox-exec-status--success",failed:"wandox-exec-status--failed"})[pe]||"";C.useEffect(()=>{S==="history"&&ee&&oe(ee)},[S,ee,oe]);const he=async()=>{if(!B||!j){$t.warning("请选择 Webhook");return}try{W(!0),await rkr({},{agent_id:B.agent_id,webhook_id:j}),$t.success("绑定成功"),O(!1),K()}catch(pe){$t.error((pe==null?void 0:pe.message)||"绑定失败")}finally{W(!1)}},Re=async()=>{if(B)try{W(!0),await ikr(B.agent_id,{}),$t.success("解绑成功"),O(!1),V(void 0),K()}catch(pe){$t.error((pe==null?void 0:pe.message)||"解绑失败")}finally{W(!1)}},Ce=pe=>{x(pe),v(!0)},Le=()=>{v(!1),x(null)},Pe=pe=>{if(!pe)return"";try{const de=new Date(pe),ge=de.toLocaleDateString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}),ye=de.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"});return`${ge}
768
+ ${_e}${Ee}`,Ie=ze.indexOf(": ")+2;S(ze),setTimeout(()=>{var De;if(_.current){_.current.focus();const Me=(De=_.current.resizableTextArea)==null?void 0:De.textArea;Me==null||Me.setSelectionRange(Ie,Ie)}},0)},me=()=>{ee(null),S("")},ue=async()=>{if(!w.trim()&&M.length===0||n)return;let ce=[];if(M.length>0){ce=await he();for(const _e of M)URL.revokeObjectURL(_e.previewUrl);L([])}const ne=w.trim(),Ee=Z==null?void 0:Z.playbook_id;S(""),ee(null),ae.clear(),I(!0),s(ne,Ee,ce.length>0?ce:void 0)};return E.jsxs("div",{className:"wandox-chat-input",style:{position:"relative"},onDragEnter:Re,onDragLeave:Ce,onDragOver:Le,onDrop:Pe,children:[R&&E.jsx("div",{className:"wandox-chat-input-drag-overlay",children:E.jsxs("div",{className:"wandox-chat-input-drag-content",children:[E.jsx(u_r,{style:{fontSize:32,marginBottom:8}}),E.jsx("div",{children:"释放以发送图片"})]})}),E.jsx("input",{ref:P,type:"file",accept:"image/png,image/jpeg,image/jpg,image/gif,image/webp,image/bmp",multiple:!0,style:{display:"none"},onChange:de}),F&&q.length>0&&E.jsx("div",{className:"wandox-mention-list",ref:T,children:E.jsx("div",{className:"wandox-mention-items",children:q.map((ce,ne)=>E.jsxs("div",{className:`wandox-mention-item ${ne===X?"wandox-mention-item--active":""}`,onClick:()=>ie(ce),onKeyDown:()=>{},onMouseEnter:()=>Q(ne),children:[E.jsx("div",{className:"wandox-mention-item-icon",children:"📋"}),E.jsxs("div",{className:"wandox-mention-item-content",children:[E.jsxs("div",{className:"wandox-mention-item-name",children:[ce.name,ce.input_fields&&ce.input_fields.length>0&&E.jsx("span",{className:"wandox-mention-item-tag",children:t("recommendation.params")})]}),ce.description&&E.jsx("div",{className:"wandox-mention-item-desc",children:ce.description})]})]},ce.playbook_id))})}),F&&q.length===0&&te.length>0&&E.jsx("div",{className:"wandox-mention-list",ref:T,children:E.jsx("div",{className:"wandox-mention-empty",children:t("chatInput.noMatchingScenarios")})}),F&&te.length===0&&E.jsx("div",{className:"wandox-mention-list",ref:T,children:E.jsx("div",{className:"wandox-mention-empty",children:t("chatInput.noAvailableScenarios")})}),E.jsx(Lmt,{open:k&&!F&&!n,rewrittenQuestion:ae.rewrittenQuestion,questions:ae.questions,loading:ae.loading,placement:"top",onSelectRewrite:ce=>{var ne;S(ce),ae.clear(),(ne=_.current)==null||ne.focus()},onSelectQuestion:ce=>{S(""),ee(null),I(!0),ae.clear(),s(ce.title)}}),Z&&E.jsx("div",{className:"wandox-chat-input-tag",children:E.jsx(io,{color:"blue",closable:!0,onClose:me,closeIcon:E.jsx(Qo,{}),children:Z.name})}),$&&r&&!n&&E.jsx("button",{className:"wandox-search-suggestion",onClick:O,onKeyDown:B,type:"button",style:{position:"absolute",top:"30px",left:"38px",color:"#999",cursor:"pointer",fontSize:"14px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"calc(100% - 80px)",zIndex:1,transition:"color 0.2s ease",background:"none",border:"none",padding:0,textAlign:"left"},onMouseEnter:ce=>{ce.currentTarget.style.color="#1890ff"},onMouseLeave:ce=>{ce.currentTarget.style.color="#999"},children:r}),M.length>0&&E.jsx("div",{className:"wandox-chat-input-previews",children:M.map(ce=>E.jsxs("div",{className:"wandox-chat-input-preview-item",children:[E.jsx("img",{src:ce.previewUrl,alt:ce.file.name,className:"wandox-chat-input-preview-img"}),E.jsx("button",{type:"button",className:"wandox-chat-input-preview-remove",onClick:()=>ve(ce.id),title:"删除",children:E.jsx(Qo,{})})]},ce.id))}),E.jsx(Vtn,{ref:_,placeholder:$&&r&&!n?"":o||t("chat.input.placeholder"),value:w,disabled:n,onChange:ge,onKeyDown:ye,onPaste:be,onFocus:()=>A(!0),onBlur:()=>window.setTimeout(()=>A(!1),120),autoSize:{minRows:1,maxRows:6},className:"wandox-chat-textarea",style:{position:"relative",zIndex:2,background:"transparent"}}),E.jsxs("div",{className:"wandox-chat-input-actions",children:[E.jsx("button",{type:"button",className:"wandox-chat-input-icon-btn",title:"上传图片",disabled:n,onClick:pe,children:E.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[E.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2",stroke:"currentColor",strokeWidth:"2"}),E.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5",fill:"currentColor"}),E.jsx("polyline",{points:"21 15 16 10 5 21",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),E.jsx("button",{type:"button",className:`wandox-chat-input-icon-btn wandox-chat-input-send-btn${n?" wandox-chat-input-stop-btn":""}`,disabled:n?i||!a:!w.trim()&&M.length===0,onClick:n?a:ue,title:n?i?"正在停止":"停止":t("chat.send"),children:n?E.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[E.jsx("circle",{cx:"12",cy:"12",r:"8",stroke:"currentColor",strokeWidth:"2"}),E.jsx("rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",fill:"currentColor"})]}):E.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:E.jsx("path",{d:"M12 19V5M12 5L5 12M12 5L19 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})}const f9=[{id:"robot",name:"机器人",description:"紫色渐变机器人头像",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsxs("g",{clipPath:"url(#clip0_2019_548)",children:[E.jsx("path",{d:"M36 0H12C5.37258 0 0 5.37258 0 12V36C0 42.6274 5.37258 48 12 48H36C42.6274 48 48 42.6274 48 36V12C48 5.37258 42.6274 0 36 0Z",fill:"url(#paint0_linear_2019_548)"}),E.jsx("path",{d:"M24 12L28 16L24 20L20 16L24 12Z",fill:"white",fillOpacity:"0.95"}),E.jsx("path",{d:"M24 30C27.3137 30 30 27.3137 30 24C30 20.6863 27.3137 18 24 18C20.6863 18 18 20.6863 18 24C18 27.3137 20.6863 30 24 30Z",fill:"white",fillOpacity:"0.95"}),E.jsx("path",{d:"M16 28L12 24L16 20L20 24L16 28Z",fill:"white",fillOpacity:"0.8"}),E.jsx("path",{d:"M32 28L28 24L32 20L36 24L32 28Z",fill:"white",fillOpacity:"0.8"}),E.jsx("path",{d:"M24 36L20 32L24 28L28 32L24 36Z",fill:"white",fillOpacity:"0.8"})]}),E.jsxs("defs",{children:[E.jsxs("linearGradient",{id:"paint0_linear_2019_548",x1:"0",y1:"0",x2:"48",y2:"48",gradientUnits:"userSpaceOnUse",children:[E.jsx("stop",{stopColor:"#8B5CF6"}),E.jsx("stop",{offset:"1",stopColor:"#6366F1"})]}),E.jsx("clipPath",{id:"clip0_2019_548",children:E.jsx("rect",{width:"48",height:"48",fill:"white"})})]})]},"icon-robot")},{id:"amazon",name:"亚马逊",description:"橙色渐变亚马逊图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("path",{d:"M36 0H12C5.37258 0 0 5.37258 0 12V36C0 42.6274 5.37258 48 12 48H36C42.6274 48 48 42.6274 48 36V12C48 5.37258 42.6274 0 36 0Z",fill:"url(#paint0_linear_2026_532)"}),E.jsx("path",{d:"M14.7195 25.2724C14.7195 29.2324 17.217 31.2124 20.4345 31.2124C23.157 31.2124 24.6195 30.5824 26.712 28.4449C27.4095 29.4574 27.6345 29.9299 28.8945 30.9874C29.187 31.1449 29.547 31.1224 29.7945 30.8974C30.5595 30.2224 31.932 29.0074 32.7195 28.3549C33.0345 28.1074 32.967 27.6799 32.742 27.3424C32.0445 26.3749 31.302 25.5874 31.302 23.8099V17.8699C31.302 15.3499 31.482 13.0324 29.6145 11.2999C28.1745 9.90491 25.7445 9.40991 23.877 9.40991C20.2545 9.40991 16.2045 10.7599 15.3495 15.2599C15.2595 15.7324 15.6195 15.9799 15.9345 16.0474L19.6245 16.4524C19.962 16.4299 20.232 16.0924 20.277 15.7549C20.592 14.2024 21.897 13.4599 23.337 13.4599C24.1245 13.4599 25.0245 13.7524 25.4745 14.4499C26.0145 15.2374 25.947 16.3174 25.947 17.2174V17.7124C23.742 17.9599 20.862 18.1174 18.792 19.0399C16.3845 20.0749 14.7195 22.1674 14.7195 25.2724ZM25.947 20.7724V21.6049C25.947 23.0899 25.992 24.3274 25.227 25.6549C24.6195 26.7349 23.652 27.3874 22.5945 27.3874C21.132 27.3874 20.277 26.2624 20.277 24.6199C20.277 21.3574 23.202 20.7724 25.947 20.7724ZM33.9795 32.6749C30.762 34.0474 27.2745 34.6999 24.102 34.6999C19.3995 34.6999 14.832 33.4174 11.1645 31.2574C10.8495 31.0774 10.602 31.3924 10.872 31.6399C14.4197 34.8374 19.0336 36.5947 23.8095 36.5674C27.387 36.5674 31.527 35.4424 34.407 33.3274C34.8795 32.9899 34.4745 32.4724 33.9795 32.6749Z",fill:"white",fillOpacity:"0.95"}),E.jsx("path",{d:"M36.8146 31.0551C36.4996 30.6726 33.8221 30.3351 32.1796 31.4826C31.9321 31.6626 31.9771 31.9101 32.2471 31.8651C33.1696 31.7526 35.2171 31.5051 35.5996 31.9776C35.9596 32.4501 35.1946 34.3851 34.8571 35.2401C34.7446 35.5101 34.9696 35.6001 35.2171 35.3976C36.7246 34.1376 37.1296 31.4376 36.8146 31.0551Z",fill:"white",fillOpacity:"0.8"}),E.jsx("defs",{children:E.jsxs("linearGradient",{id:"paint0_linear_2026_532",x1:"0",y1:"0",x2:"48",y2:"48",gradientUnits:"userSpaceOnUse",children:[E.jsx("stop",{stopColor:"#FF6B35"}),E.jsx("stop",{offset:"1",stopColor:"#F7931E"})]})})]},"icon-amazon")},{id:"star",name:"星星",description:"绿色渐变星星图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsxs("g",{clipPath:"url(#clip0_2019_574)",children:[E.jsx("path",{d:"M36 0H12C5.37258 0 0 5.37258 0 12V36C0 42.6274 5.37258 48 12 48H36C42.6274 48 48 42.6274 48 36V12C48 5.37258 42.6274 0 36 0Z",fill:"url(#paint0_linear_2019_574)"}),E.jsx("path",{d:"M18 14H14C12.8954 14 12 14.8954 12 16V20C12 21.1046 12.8954 22 14 22H18C19.1046 22 20 21.1046 20 20V16C20 14.8954 19.1046 14 18 14Z",fill:"white",fillOpacity:"0.95"}),E.jsx("path",{d:"M34 14H30C28.8954 14 28 14.8954 28 16V20C28 21.1046 28.8954 22 30 22H34C35.1046 22 36 21.1046 36 20V16C36 14.8954 35.1046 14 34 14Z",fill:"white",fillOpacity:"0.95"}),E.jsx("path",{d:"M26 26H22C20.8954 26 20 26.8954 20 28V32C20 33.1046 20.8954 34 22 34H26C27.1046 34 28 33.1046 28 32V28C28 26.8954 27.1046 26 26 26Z",fill:"white",fillOpacity:"0.95"}),E.jsx("path",{d:"M16 22V26H20M32 22V26H28M24 26V22",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeOpacity:"0.8"}),E.jsx("path",{d:"M18 30L14 34M30 30L34 34M24 34V36",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeOpacity:"0.8"}),E.jsx("path",{d:"M14 36C15.1046 36 16 35.1046 16 34C16 32.8954 15.1046 32 14 32C12.8954 32 12 32.8954 12 34C12 35.1046 12.8954 36 14 36Z",fill:"white",fillOpacity:"0.7"}),E.jsx("path",{d:"M34 36C35.1046 36 36 35.1046 36 34C36 32.8954 35.1046 32 34 32C32.8954 32 32 32.8954 32 34C32 35.1046 32.8954 36 34 36Z",fill:"white",fillOpacity:"0.7"}),E.jsx("path",{d:"M24 40C25.1046 40 26 39.1046 26 38C26 36.8954 25.1046 36 24 36C22.8954 36 22 36.8954 22 38C22 39.1046 22.8954 40 24 40Z",fill:"white",fillOpacity:"0.7"})]}),E.jsxs("defs",{children:[E.jsxs("linearGradient",{id:"paint0_linear_2019_574",x1:"0",y1:"0",x2:"48",y2:"48",gradientUnits:"userSpaceOnUse",children:[E.jsx("stop",{stopColor:"#10B981"}),E.jsx("stop",{offset:"1",stopColor:"#059669"})]}),E.jsx("clipPath",{id:"clip0_2019_574",children:E.jsx("rect",{width:"48",height:"48",fill:"white"})})]})]},"icon-star")},{id:"gear",name:"齿轮",description:"绿色渐变齿轮图标",component:E.jsxs("svg",{viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad4",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#14B8A6"}),E.jsx("stop",{offset:"100%",stopColor:"#0891B2"})]})}),E.jsx("rect",{width:"40",height:"40",rx:"12",fill:"url(#grad4)"}),E.jsx("circle",{cx:"20",cy:"20",r:"5",stroke:"white",strokeWidth:"2.5",fill:"none",strokeOpacity:"0.95"}),E.jsx("path",{d:"M20 8V12M20 28V32M8 20H12M28 20H32M11.5 11.5L14.5 14.5M25.5 25.5L28.5 28.5M28.5 11.5L25.5 14.5M14.5 25.5L11.5 28.5",stroke:"white",strokeWidth:"2.5",strokeLinecap:"round",strokeOpacity:"0.8"})]},"icon-gear")},{id:"magic",name:"魔法棒",description:"粉色渐变魔法棒图标",component:E.jsxs("svg",{viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad5",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#EC4899"}),E.jsx("stop",{offset:"100%",stopColor:"#A855F7"})]})}),E.jsx("rect",{width:"40",height:"40",rx:"12",fill:"url(#grad5)"}),E.jsx("path",{d:"M10 30L26 14L30 18L14 34L10 30Z",fill:"white",fillOpacity:"0.95"}),E.jsx("circle",{cx:"28",cy:"12",r:"2",fill:"white",fillOpacity:"0.8"}),E.jsx("circle",{cx:"32",cy:"18",r:"1.5",fill:"white",fillOpacity:"0.7"}),E.jsx("circle",{cx:"24",cy:"8",r:"1.5",fill:"white",fillOpacity:"0.7"})]},"icon-magic")},{id:"rocket",name:"火箭",description:"青色渐变火箭图标",component:E.jsxs("svg",{viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad6",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#06B6D4"}),E.jsx("stop",{offset:"100%",stopColor:"#3B82F6"})]})}),E.jsx("rect",{width:"40",height:"40",rx:"12",fill:"url(#grad6)"}),E.jsx("path",{d:"M20 8C20 8 28 12 28 22L24 26L20 24L16 26L12 22C12 12 20 8 20 8Z",fill:"white",fillOpacity:"0.95"}),E.jsx("circle",{cx:"20",cy:"17",r:"2.5",fill:"url(#grad6)"}),E.jsx("path",{d:"M16 28L14 32L18 30L16 28Z",fill:"white",fillOpacity:"0.8"}),E.jsx("path",{d:"M24 28L26 32L22 30L24 28Z",fill:"white",fillOpacity:"0.8"})]},"icon-rocket")},{id:"music",name:"音乐",description:"粉紫渐变音乐图标",component:E.jsxs("svg",{viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad7",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#EC4899"}),E.jsx("stop",{offset:"100%",stopColor:"#8B5CF6"})]})}),E.jsx("rect",{width:"40",height:"40",rx:"12",fill:"url(#grad7)"}),E.jsx("path",{d:"M26 8L14 11v11.2c-.8-.3-1.6-.5-2.5-.5-2.9 0-5.3 1.6-5.3 3.6s2.4 3.6 5.3 3.6 5.3-1.6 5.3-3.6V14.4l8.7-2.5v5.7c-.8-.3-1.6-.5-2.5-.5-2.9 0-5.3 1.6-5.3 3.6s2.4 3.6 5.3 3.6 5.3-1.6 5.3-3.6V8z",fill:"white",fillOpacity:"0.95"})]},"icon-music")},{id:"sports",name:"运动",description:"蓝绿渐变运动图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad8",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#06B6D4"}),E.jsx("stop",{offset:"100%",stopColor:"#10B981"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad8)"}),E.jsx("circle",{cx:"24",cy:"24",r:"12",stroke:"white",strokeWidth:"2",fill:"none",strokeOpacity:"0.95"}),E.jsx("path",{d:"M24 12L30 18L24 24L18 18L24 12Z",fill:"white",fillOpacity:"0.8"}),E.jsx("path",{d:"M24 24L30 30L24 36L18 30L24 24Z",fill:"white",fillOpacity:"0.8"}),E.jsx("path",{d:"M12 24L18 30L24 24L18 18L12 24Z",fill:"white",fillOpacity:"0.7"}),E.jsx("path",{d:"M24 24L30 18L36 24L30 30L24 24Z",fill:"white",fillOpacity:"0.7"})]},"icon-sports")},{id:"games",name:"游戏",description:"红橙渐变游戏图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad9",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#EF4444"}),E.jsx("stop",{offset:"100%",stopColor:"#F97316"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad9)"}),E.jsx("rect",{x:"12",y:"16",width:"8",height:"8",rx:"2",fill:"white",fillOpacity:"0.95"}),E.jsx("rect",{x:"28",y:"16",width:"8",height:"8",rx:"2",fill:"white",fillOpacity:"0.95"}),E.jsx("rect",{x:"20",y:"24",width:"8",height:"8",rx:"2",fill:"white",fillOpacity:"0.8"}),E.jsx("rect",{x:"12",y:"32",width:"8",height:"4",rx:"1",fill:"white",fillOpacity:"0.7"}),E.jsx("rect",{x:"28",y:"32",width:"8",height:"4",rx:"1",fill:"white",fillOpacity:"0.7"})]},"icon-games")},{id:"expenses",name:"财务",description:"金黄渐变财务图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad10",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#F59E0B"}),E.jsx("stop",{offset:"100%",stopColor:"#EAB308"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad10)"}),E.jsx("path",{d:"M24 12C18 12 13 17 13 23c0 4 2 7 5 9v2c0 2 2 4 4 4h4c2 0 4-2 4-4v-2c3-2 5-5 5-9 0-6-5-11-11-11z",fill:"white",fillOpacity:"0.95"}),E.jsx("rect",{x:"20",y:"34",width:"8",height:"2",rx:"1",fill:"white",fillOpacity:"0.8"}),E.jsx("circle",{cx:"21",cy:"20",r:"1.5",fill:"url(#grad10)"}),E.jsx("circle",{cx:"27",cy:"20",r:"1.5",fill:"url(#grad10)"})]},"icon-expenses")},{id:"sciences",name:"科学",description:"青蓝渐变科学图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad11",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#0EA5E9"}),E.jsx("stop",{offset:"100%",stopColor:"#3B82F6"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad11)"}),E.jsx("path",{d:"M12 36L20 28L28 36L36 28",stroke:"white",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:"0.95"}),E.jsx("circle",{cx:"24",cy:"16",r:"4",fill:"white",fillOpacity:"0.8"}),E.jsx("path",{d:"M24 20V28",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeOpacity:"0.7"}),E.jsx("circle",{cx:"16",cy:"32",r:"2",fill:"white",fillOpacity:"0.7"}),E.jsx("circle",{cx:"32",cy:"32",r:"2",fill:"white",fillOpacity:"0.7"})]},"icon-sciences")},{id:"magic-wand",name:"魔法",description:"紫粉渐变魔法图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad12",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#8B5CF6"}),E.jsx("stop",{offset:"100%",stopColor:"#EC4899"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad12)"}),E.jsx("path",{d:"M12 36L24 24L36 36L24 48L12 36Z",fill:"white",fillOpacity:"0.95"}),E.jsx("circle",{cx:"28",cy:"12",r:"2",fill:"white",fillOpacity:"0.8"}),E.jsx("circle",{cx:"36",cy:"20",r:"1.5",fill:"white",fillOpacity:"0.7"}),E.jsx("circle",{cx:"20",cy:"8",r:"1.5",fill:"white",fillOpacity:"0.7"}),E.jsx("circle",{cx:"32",cy:"4",r:"1",fill:"white",fillOpacity:"0.6"})]},"icon-magic-wand")},{id:"animals",name:"动物",description:"绿棕渐变动物图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad13",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#10B981"}),E.jsx("stop",{offset:"100%",stopColor:"#92400E"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad13)"}),E.jsx("ellipse",{cx:"24",cy:"28",rx:"10",ry:"8",fill:"white",fillOpacity:"0.95"}),E.jsx("circle",{cx:"20",cy:"26",r:"2",fill:"url(#grad13)"}),E.jsx("circle",{cx:"28",cy:"26",r:"2",fill:"url(#grad13)"}),E.jsx("path",{d:"M24 30C22 32 20 33 18 33",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeOpacity:"0.8"}),E.jsx("circle",{cx:"18",cy:"18",r:"4",fill:"white",fillOpacity:"0.8"}),E.jsx("circle",{cx:"30",cy:"18",r:"4",fill:"white",fillOpacity:"0.8"})]},"icon-animals")},{id:"travel",name:"旅行",description:"天蓝渐变旅行图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad14",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#0EA5E9"}),E.jsx("stop",{offset:"100%",stopColor:"#06B6D4"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad14)"}),E.jsx("path",{d:"M8 32L16 16L32 16L40 32L32 40L16 40L8 32Z",fill:"white",fillOpacity:"0.95"}),E.jsx("circle",{cx:"24",cy:"24",r:"3",fill:"url(#grad14)"}),E.jsx("path",{d:"M24 28V32",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeOpacity:"0.8"}),E.jsx("rect",{x:"12",y:"36",width:"4",height:"2",rx:"1",fill:"white",fillOpacity:"0.7"}),E.jsx("rect",{x:"32",y:"36",width:"4",height:"2",rx:"1",fill:"white",fillOpacity:"0.7"})]},"icon-travel")},{id:"nature",name:"自然",description:"绿色渐变自然图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad15",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#22C55E"}),E.jsx("stop",{offset:"100%",stopColor:"#10B981"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad15)"}),E.jsx("path",{d:"M24 12C20 12 16 16 16 20C16 24 18 27 20 28V36C20 38 22 40 24 40C26 40 28 38 28 36V28C30 27 32 24 32 20C32 16 28 12 24 12Z",fill:"white",fillOpacity:"0.95"}),E.jsx("path",{d:"M24 12V20",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeOpacity:"0.8"}),E.jsx("path",{d:"M24 20L20 16M24 20L28 16",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeOpacity:"0.7"})]},"icon-nature")},{id:"education",name:"教育",description:"深蓝渐变教育图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad16",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#1E40AF"}),E.jsx("stop",{offset:"100%",stopColor:"#3B82F6"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad16)"}),E.jsx("path",{d:"M24 8L8 16V24C8 32 14 38 24 40C34 38 40 32 40 24V16L24 8Z",fill:"white",fillOpacity:"0.95"}),E.jsx("circle",{cx:"24",cy:"22",r:"4",fill:"url(#grad16)"}),E.jsx("path",{d:"M24 26V30",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeOpacity:"0.8"}),E.jsx("path",{d:"M16 36L12 40L8 36",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:"0.7"})]},"icon-education")},{id:"health",name:"健康",description:"红色渐变健康图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad17",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#EF4444"}),E.jsx("stop",{offset:"100%",stopColor:"#DC2626"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad17)"}),E.jsx("rect",{x:"20",y:"12",width:"8",height:"24",rx:"4",fill:"white",fillOpacity:"0.95"}),E.jsx("rect",{x:"12",y:"20",width:"24",height:"8",rx:"4",fill:"white",fillOpacity:"0.95"}),E.jsx("circle",{cx:"24",cy:"24",r:"2",fill:"url(#grad17)"})]},"icon-health")},{id:"food",name:"美食",description:"橙色渐变美食图标",component:E.jsxs("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"grad18",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[E.jsx("stop",{offset:"0%",stopColor:"#FB923C"}),E.jsx("stop",{offset:"100%",stopColor:"#F97316"})]})}),E.jsx("rect",{width:"48",height:"48",rx:"12",fill:"url(#grad18)"}),E.jsx("path",{d:"M16 16C16 12 20 8 24 8C28 8 32 12 32 16V32C32 36 28 40 24 40C20 40 16 36 16 32V16Z",fill:"white",fillOpacity:"0.95"}),E.jsx("circle",{cx:"20",cy:"20",r:"1.5",fill:"url(#grad18)"}),E.jsx("circle",{cx:"28",cy:"20",r:"1.5",fill:"url(#grad18)"}),E.jsx("path",{d:"M24 24C22 26 20 27 18 27",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeOpacity:"0.8"}),E.jsx("path",{d:"M12 32L8 36L12 40",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:"0.7"})]},"icon-food")}],Htn="robot",A_=e=>{if(!e){const r=f9.find(n=>n.id===Htn);return(r==null?void 0:r.component)||f9[0].component}const t=f9.find(r=>r.id===e);return(t==null?void 0:t.component)||f9[0].component},Wtn=new Map(f9.map(e=>[e.id,e]));function Gtn({active:e,agents:t,collapsed:r,onToggle:n,className:i,activeView:a="chat",onViewChange:s,onToolboxOpen:o,showLogout:l,onLogout:u,sidebarAgentMode:d=!1,onToggleSidebarMode:h,onAgentSelect:f}){const p=localStorage.getItem("sso_domain")||"",g=[{key:"chat",icon:E.jsx(IKe,{}),title:"对话"},...["maiduo","eccang"].includes(p)?[{key:"plan",icon:E.jsx(UCr,{}),title:"自动化Beta"}]:[],{key:"professional",icon:E.jsx(TKe,{}),title:"专业智能体"}],v=[...p==="yunduo"?[]:[{key:"toolbox",icon:E.jsx(M_r,{}),label:"工具箱"},{key:"goals",icon:E.jsx(vCr,{}),label:"目标追踪"}],{key:"settings",icon:E.jsx(I_r,{}),label:"系统设置"}];return E.jsx("div",{className:"wandox-aside-wrap",children:E.jsxs("div",{className:`wandox-aside ${r?"wandox-aside--collapsed":""} ${i||""}`,"aria-hidden":r,children:[E.jsxs("div",{className:"wandox-aside-header",children:[E.jsx("span",{className:"wandox-aside-header__title",children:"AI 智能体"}),n&&E.jsx("button",{type:"button",className:"wandox-aside-header-toggle",onClick:n,"aria-label":r?"展开侧边栏":"收起侧边栏",title:r?"展开侧边栏":"收起侧边栏",children:E.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 24 24",children:[E.jsx("title",{children:r?"展开侧边栏":"收起侧边栏"}),E.jsx("path",{fill:"currentColor",d:"M21 5H11v14h10zM3 5h6v14H3zm0-2a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zm2 4.25a.75.75 0 0 0 0 1.5h2a.75.75 0 0 0 0-1.5zm-.75 3.5A.75.75 0 0 1 5 10h2a.75.75 0 0 1 0 1.5H5a.75.75 0 0 1-.75-.75m.75 2a.75.75 0 0 0 0 1.5h2a.75.75 0 0 0 0-1.5z"})]})})]}),E.jsx("div",{className:"wandox-aside-main-nav",children:E.jsx("div",{className:"wandox-aside-nav-list",children:g.map(y=>{const x=a===y.key,b=y.key==="professional";return E.jsxs("div",{children:[E.jsxs("div",{className:`wandox-aside-nav-item-wrap${x?" wandox-aside-nav-item-wrap--active":""}`,children:[E.jsxs("button",{type:"button",onClick:()=>s==null?void 0:s(y.key),className:`wandox-aside-nav-item${x?" wandox-aside-nav-item--active":""}`,children:[E.jsx("span",{className:"wandox-aside-nav-icon",children:y.icon}),E.jsx("span",{className:"wandox-aside-nav-title",children:y.title})]}),b&&!r&&h&&E.jsx(ki,{title:d?"收起列表":"展开列表",placement:"right",children:E.jsx("button",{type:"button",className:`wandox-aside-mode-toggle${d?" wandox-aside-mode-toggle--active":""}`,onClick:w=>{w.stopPropagation(),h()},children:d?E.jsx(Tge,{style:{fontSize:11}}):E.jsx(u3,{style:{fontSize:11}})})})]}),b&&(d||r)&&E.jsx("div",{className:"wandox-aside-agent-list",children:t.map(w=>{const S=w.agent_id;if(!S)return null;const _=e===S&&a==="professional";return E.jsx(ki,{title:w.name,placement:"right",children:E.jsxs("button",{type:"button",className:`wandox-aside-agent-item${_?" wandox-aside-agent-item--active":""}`,onClick:()=>{f==null||f(S),a!=="professional"&&(s==null||s("professional"))},children:[E.jsx("span",{className:"wandox-aside-agent-icon",children:A_(w.icon)}),E.jsx("span",{className:"wandox-aside-agent-name",children:w.name})]})},S)})})]},y.key)})})}),E.jsxs("div",{className:"wandox-aside-bottom",children:[E.jsx("p",{className:"wandox-aside-group-label",children:"系统功能"}),E.jsxs("div",{className:"wandox-aside-nav-list wandox-aside-nav-list--bottom",children:[v.map(y=>{const x=y.key!=="toolbox"&&a===y.key;return E.jsxs("button",{type:"button",onClick:()=>{if(y.key==="toolbox"){o==null||o();return}s==null||s(y.key)},className:`wandox-aside-nav-item${x?" wandox-aside-nav-item--active":""}`,children:[E.jsx("span",{className:"wandox-aside-nav-icon",children:y.icon}),E.jsx("span",{className:"wandox-aside-nav-title",children:y.label})]},y.key)}),l&&E.jsxs("button",{type:"button",onClick:u,className:"wandox-aside-nav-item wandox-aside-nav-item--logout",children:[E.jsx("span",{className:"wandox-aside-nav-icon",children:E.jsx(g_r,{})}),E.jsx("span",{className:"wandox-aside-nav-title",children:"退出登录"})]})]}),E.jsx("div",{style:{height:8}})]})]})})}function Utn({title:e="正在进入指定智能体",description:t="正在加载智能体与剧本信息..."}){return E.jsxs("output",{className:"wandox-initial-route-loading","aria-label":e,children:[E.jsxs("div",{className:"wandox-initial-route-loading-aura","aria-hidden":"true",children:[Array.from({length:12},(r,n)=>({angle:n*30,delay:n*.08})).map(({angle:r,delay:n})=>E.jsx("span",{className:"wandox-chat-history-ray",style:{"--ray-angle":`${r}deg`,"--ray-delay":`${n}s`}},r)),E.jsx("div",{className:"wandox-chat-empty-icon",children:E.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[E.jsx("path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"}),E.jsx("path",{d:"M20 2v4"}),E.jsx("path",{d:"M22 4h-4"}),E.jsx("circle",{cx:"4",cy:"20",r:"2"})]})})]}),E.jsx("div",{className:"wandox-initial-route-loading-title",children:e}),E.jsx("div",{className:"wandox-initial-route-loading-text",children:t})]})}function qtn(e){const{children:t}=e;return E.jsx("div",{className:"wandox-layout wandox-root",children:E.jsx("main",{className:"wandox-layout-content",style:{padding:0},children:t})})}const Ytn="wandox_use_map_tree_goals_v2",Ktn=/^\?+$/;function Xtn(e){return`${Ytn}:${e||"all"}`}function Mmt(e){const t=e,r=Array.isArray(t==null?void 0:t.roles)?t:t==null?void 0:t.data;return Array.isArray(r==null?void 0:r.roles)?r.roles.map(n=>{const i=(n.goals||[]).filter(a=>a.playbook!==null).map(a=>({...a,icon:Pmt(a.icon),items:(a.items||[]).filter(s=>s.playbook_id)})).filter(a=>{var s;return(a.items||[]).length>0||!!(a.playbook_id||(s=a.playbook)!=null&&s.playbook_id)});return{...n,icon:Pmt(n.icon),goals:i,goal_count:i.length}}).filter(n=>(n.goals||[]).length>0):[]}function Pmt(e){const t=String(e||"").trim();if(!(!t||Ktn.test(t)))return t}function Ztn({agentId:e,onPlaybookClick:t,onSelectPlaybook:r,expanded:n,onExpandedChange:i}){const[a,s]=C.useState(!1),[o,l]=C.useState(!1),[u,d]=C.useState(!1),[h,f]=C.useState([]),[p,g]=C.useState(""),[m,v]=C.useState(""),y=C.useMemo(()=>e==null?"":String(e).trim(),[e]),x=n??a,b=C.useMemo(()=>h.find(_=>_.role_code===p)||h[0],[h,p]);C.useEffect(()=>{d(!1),f([]),g(""),v("")},[y]),C.useEffect(()=>{if(!x||u)return;let _=!1;const T=Xtn(y);return(async()=>{l(!0),v("");try{const A=window.localStorage.getItem(T);if(A)try{const M=Mmt(JSON.parse(A));M.length>0&&(f(M),g(M[0].role_code))}catch{window.localStorage.removeItem(T)}const $=await Rkr({agent_id:y,role_id:null});if(_)return;const I=Mmt($.data);f(I),g(M=>{var L;return M||((L=I[0])==null?void 0:L.role_code)||""}),window.localStorage.setItem(T,JSON.stringify($.data||{roles:[]}))}catch{_||v("使用地图加载失败")}finally{_||(d(!0),l(!1))}})(),()=>{_=!0}},[x,u,y]);const w=_=>{var $,I;const T=_.playbook_id||(($=_.playbook)==null?void 0:$.playbook_id),k=((I=_.playbook)==null?void 0:I.name)||_.title||_.name||"执行";if(!T)return;if(s(!1),i==null||i(!1),CCe(_).length>0&&r){r(ern(_),k);return}t({message:k,playbook_id:T})},S=()=>{const _=!x;s(_),i==null||i(_)};return E.jsxs("div",{className:`wandox-use-map${x?" wandox-use-map--expanded":""}`,children:[E.jsx("div",{className:"wandox-use-map-toolbar",children:E.jsxs("button",{type:"button",className:"wandox-use-map-toggle",onClick:S,"aria-expanded":x,children:[E.jsx("span",{className:"wandox-scene-tab-mark wandox-scene-tab-mark--use-map","aria-hidden":"true",children:E.jsx(CKe,{})}),E.jsx("span",{className:"wandox-use-map-toggle-text",children:"使用地图"}),E.jsx("span",{className:"wandox-use-map-toggle-arrow","aria-hidden":"true",children:"⌄"})]})}),x&&E.jsx("div",{className:`wandox-use-map-panel${h.length===0?" wandox-use-map-panel--compact":""}`,children:(!u||o)&&h.length===0?E.jsxs("div",{className:"wandox-use-map-loading",children:[E.jsx("span",{className:"wandox-heartbeat-loader","aria-hidden":"true",children:E.jsx("svg",{width:"48",height:"24",viewBox:"0 0 48 24",fill:"none",children:E.jsx("path",{d:"M0 12 L8 12 L10 8 L12 16 L14 4 L16 12 L20 12 L22 10 L24 14 L26 10 L28 12 L48 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),E.jsx("span",{children:"正在加载使用地图"})]}):m?E.jsxs("div",{className:"wandox-use-map-empty",children:[E.jsx("div",{className:"wandox-use-map-empty-title",children:m}),E.jsx("button",{type:"button",className:"wandox-use-map-retry",onClick:()=>d(!1),children:"重新加载"})]}):h.length===0?E.jsxs("div",{className:"wandox-use-map-empty",children:[E.jsx("div",{className:"wandox-use-map-empty-title",children:"暂无使用地图"}),E.jsx("div",{className:"wandox-use-map-empty-desc",children:"当前智能体还没有配置岗位目标剧本"})]}):E.jsxs(E.Fragment,{children:[E.jsx("div",{className:"wandox-use-map-roles",role:"tablist","aria-label":"岗位",children:h.map(_=>{var T;return E.jsxs("button",{type:"button",role:"tab","aria-selected":(b==null?void 0:b.role_code)===_.role_code,className:`wandox-use-map-role${(b==null?void 0:b.role_code)===_.role_code?" active":""}`,onClick:()=>g(_.role_code),children:[E.jsx("span",{className:"wandox-use-map-role-icon",children:_.icon||"◎"}),E.jsx("span",{className:"wandox-use-map-role-name",children:_.name}),E.jsx("span",{className:"wandox-use-map-role-count",children:_.goal_count||((T=_.goals)==null?void 0:T.length)||0})]},_.id)})}),E.jsx("div",{className:"wandox-use-map-goals",children:((b==null?void 0:b.goals)||[]).map(_=>{var T;return E.jsxs("section",{className:"wandox-use-map-goal-group",children:[E.jsxs("div",{className:"wandox-use-map-goal-group-head",children:[E.jsx("span",{className:"wandox-use-map-goal-group-icon",children:_.icon||"◇"}),E.jsx("span",{className:"wandox-use-map-goal-group-name",children:_.name}),E.jsxs("span",{className:"wandox-use-map-goal-group-count",children:[((T=_.items)==null?void 0:T.length)||0," 个剧本"]}),(_.description||_.subtitle)&&E.jsxs("span",{className:"wandox-use-map-goal-group-desc",children:["· ",_.description||_.subtitle]})]}),E.jsx("div",{className:"wandox-use-map-goal-items",children:(_.items||[]).map(k=>{var I,M,L;const A=CCe(k).length>0,$=Qtn(k.tags);return E.jsxs("button",{type:"button",className:`wandox-use-map-playbook-card${k.is_featured?" wandox-use-map-playbook-card--featured":""}`,onClick:()=>w(k),children:[E.jsx("div",{className:"wandox-use-map-playbook-title",children:E.jsx("span",{className:"wandox-use-map-playbook-name",children:k.title||k.name||((I=k.playbook)==null?void 0:I.name)||"未命名剧本"})}),(k.is_featured||A)&&E.jsxs("div",{className:"wandox-use-map-playbook-badges",children:[k.is_featured&&E.jsx(io,{color:"gold",className:"wandox-use-map-tag wandox-use-map-featured-tag",children:"精品"}),A&&E.jsx("span",{className:"wandox-use-map-param-badge",children:"参数"})]}),(k.subtitle||k.description||((M=k.playbook)==null?void 0:M.description))&&E.jsx("div",{className:"wandox-use-map-playbook-desc",children:k.subtitle||k.description||((L=k.playbook)==null?void 0:L.description)}),$.length>0&&E.jsx("div",{className:"wandox-use-map-playbook-tags",children:$.map((R,N)=>E.jsx(io,{color:R.variant==="soft"?void 0:R.color,className:"wandox-use-map-tag",style:Jtn(R),children:R.name},`${R.name}-${N}`))})]},`${_.id}-${k.id||k.playbook_id}`)})})]},_.id)})})]})})]})}function CCe(e){var t;return e.input_fields||((t=e.playbook)==null?void 0:t.input_fields)||[]}function Qtn(e){return Array.isArray(e)?e.reduce((t,r)=>{const n=typeof(r==null?void 0:r.name)=="string"?r.name.trim():"";return n&&t.push({...r,name:n}),t},[]):[]}function Jtn(e){if(!(e.variant!=="soft"||!e.color))return{color:e.color,borderColor:Dmt(e.color,.28),backgroundColor:Dmt(e.color,.08)}}function Dmt(e,t){const r=e.trim().replace("#","");if(!/^[0-9a-fA-F]{6}$/.test(r))return e;const n=Number.parseInt(r.slice(0,2),16),i=Number.parseInt(r.slice(2,4),16),a=Number.parseInt(r.slice(4,6),16);return`rgba(${n}, ${i}, ${a}, ${t})`}function ern(e){var r;const t=e.playbook||e;return{category:e.category??null,category_name:e.category_name,description:e.description||e.subtitle||t.description,domain:e.domain||"",id:Number(e.id||0),name:((r=e.playbook)==null?void 0:r.name)||e.title||e.name||"未命名剧本",playbook_id:e.playbook_id||t.playbook_id||"",scope:"",status:e.status||t.status||"",sub_category:null,tags:null,type:e.type||"",version:"",input_fields:CCe(e),video_url:e.video_url||t.video_url||void 0,video_duration:e.video_duration||t.video_duration,view_count:e.view_count,badge:e.badge||t.badge||null}}function trn(e){if(!e)return"";const t=Date.now()-new Date(e).getTime(),r=Math.floor(t/864e5),n=Math.floor(t/36e5);return r===1?"昨天":r>1?`${r} 天前`:n>=1?`${n} 小时前`:"刚刚"}const I_=e=>String(e.playbook_id||e.code||e.name);function rrn({label:e}){return E.jsxs("output",{className:"wandox-scene-list-loading","aria-label":e,children:[E.jsx("span",{className:"wandox-heartbeat-loader","aria-hidden":"true",children:E.jsx("svg",{width:"48",height:"24",viewBox:"0 0 48 24",fill:"none",children:E.jsx("path",{d:"M0 12 L8 12 L10 8 L12 16 L14 4 L16 12 L20 12 L22 10 L24 14 L26 10 L28 12 L48 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),E.jsx("span",{children:e})]})}function Omt({playbooks:e,playbookLoading:t,onPlaybookClick:r,onSelectPlaybook:n,recommendations:i=[],userPlaybooks:a=[],userPlaybooksLoading:s=!1,onLoadUserPlaybooks:o,agentId:l,recentRefreshKey:u=0}){const[d,h]=C.useState("playbooks"),[f,p]=C.useState(!1),[g,m]=C.useState(!1),[v,y]=C.useState("全部"),[x,b]=C.useState(""),[w,S]=C.useState(null),[_,T]=C.useState(""),[k,A]=C.useState(!1),[$,I]=C.useState([]),[M,L]=C.useState(!1),R=C.useMemo(()=>d==="recommendations"?t&&i.length===0:d==="user"?s:M||t&&e.length===0,[t,M,d,e.length,i.length,s]),N=C.useMemo(()=>l==null?"":String(l).trim(),[l]);C.useEffect(()=>{if(!N){I([]),L(!1);return}let X=!1;return(async()=>{L(!0);try{const K=await qEr({limit:8,agent_id:N});X||I(K.data||[])}catch{X||I([])}finally{X||L(!1)}})(),()=>{X=!0}},[N,u]);const P=C.useRef(null),[D,O]=C.useState(5),B=C.useCallback(()=>{if(!P.current)return;const X=P.current.offsetWidth;if(X===0)return;const K=Math.floor(X/(200+12));O(Math.max(2,K))},[]);C.useEffect(()=>{const X=setTimeout(B,100);return()=>clearTimeout(X)},[B,d,f]),C.useEffect(()=>{d==="recommendations"&&i.length===0&&h("playbooks")},[i.length,d]),C.useEffect(()=>{d!=="user"||!N||o==null||o()},[d,N,o]),C.useEffect(()=>{if(!P.current)return;const X=new ResizeObserver(()=>{B()});return X.observe(P.current),()=>X.disconnect()},[B]);const F=C.useMemo(()=>new Set($.map(I_)),[$]),j=C.useMemo(()=>new Set(a.map(I_)),[a]),V=C.useMemo(()=>{const X=new Map;for(const Q of $.filter(J=>!j.has(I_(J))))X.set(I_(Q),Q);for(const Q of e){const J=I_(Q);X.has(J)||X.set(J,Q)}return Array.from(X.values())},[e,$,j]),H=d==="playbooks"?V:d==="recommendations"?i:a,W=d==="playbooks"?e:H,U=H.length>(D??5)&&W.length>0,q=C.useMemo(()=>{const X=new Map;X.set("全部",W.length);for(const Q of W){const J=Q.category_name||"未分类";X.set(J,(X.get(J)||0)+1)}return Array.from(X.entries()).map(([Q,J])=>({name:Q,count:J}))},[W]),Y=C.useMemo(()=>{let X=W;if(v!=="全部"&&(X=X.filter(Q=>(Q.category_name||"未分类")===v)),x.trim()){const Q=x.trim().toLowerCase();X=X.filter(J=>{var K;return J.name.toLowerCase().includes(Q)||((K=J.description)==null?void 0:K.toLowerCase().includes(Q))})}return X},[W,v,x]);return E.jsxs("div",{className:"wandox-pro-scenes-panel",children:[E.jsxs("div",{className:"wandox-hub-section-header",children:[E.jsxs("div",{className:"wandox-scene-tabs",children:[E.jsxs("button",{type:"button",className:`wandox-scene-tab${!f&&d==="playbooks"?" active":""}`,onClick:()=>{h("playbooks"),p(!1)},children:[E.jsx("span",{className:"wandox-scene-tab-mark wandox-scene-tab-mark--playbooks","aria-hidden":"true",children:E.jsx(_Ke,{})}),E.jsx("span",{children:"默认场景"})]}),i.length>0&&E.jsxs("button",{type:"button",className:`wandox-scene-tab${!f&&d==="recommendations"?" active":""}`,onClick:()=>{h("recommendations"),p(!1)},children:[E.jsx("span",{className:"wandox-scene-tab-mark wandox-scene-tab-mark--recommendations","aria-hidden":"true",children:E.jsx(TKe,{})}),E.jsx("span",{children:"推荐场景"})]}),E.jsxs("button",{type:"button",className:`wandox-scene-tab${!f&&d==="user"?" active":""}`,onClick:()=>{h("user"),p(!1)},children:[E.jsx("span",{className:"wandox-scene-tab-mark wandox-scene-tab-mark--user","aria-hidden":"true",children:E.jsx(F_r,{})}),E.jsx("span",{children:"我的场景"})]}),E.jsx(Ztn,{agentId:N,onPlaybookClick:r,onSelectPlaybook:n,expanded:f,onExpandedChange:X=>{p(X),X&&h("playbooks")}})]}),U&&!f&&E.jsxs("button",{type:"button",className:"wandox-scene-view-all",onClick:()=>m(!0),children:["查看全部 ",W.length," 个"]})]}),E.jsx("div",{className:"wandox-tab-content",children:!f&&E.jsx("div",{className:"wandox-hub-section",children:R?E.jsx(rrn,{label:d==="user"?"正在加载我的场景":d==="recommendations"?"正在匹配推荐场景":"正在加载场景"}):H.length>0?E.jsxs("div",{className:"wandox-scroll-row",ref:P,children:[H.slice(0,D??5).map(X=>{const Q=!!(X.input_fields&&X.input_fields.length>0),J=()=>{Q&&n?n(X,X.name):r({message:X.name,playbook_id:X.playbook_id})},K=d==="playbooks"&&F.has(I_(X)),Z=d==="user"?"用户":K?"近期":X.badge==="new"?"New":X.badge==="recommend"?"推荐":X.badge==="featured"?"精选":X.category_name||X.type||"推荐",ee=X.video_duration?`${Math.floor(X.video_duration/60)}:${String(X.video_duration%60).padStart(2,"0")}`:"",te=async se=>{var ve;se.stopPropagation(),S(X),A(!0);try{const he=await nZe({playbook_id:X.playbook_id});T(((ve=he.data)==null?void 0:ve.video_url)||X.video_url||"")}catch{T(X.video_url||"")}finally{A(!1)}},ae={daily:"每日",weekly:"每周",monthly:"每月"},le=X.is_subscribed?`🔔订阅${X.execution_frequency&&X.execution_frequency!=="none"?`·${ae[X.execution_frequency]}自动跑`:""}`:"",oe=[X.description,le].filter(Boolean).join(" "),re=[X.last_executed_at&&trn(X.last_executed_at),X.execution_count!==void 0&&`已跑 ${X.execution_count} 次`].filter(Boolean).join(" · ");return E.jsxs("div",{className:"wandox-card",children:[E.jsxs("div",{className:"wandox-card-corner",children:[E.jsx("span",{className:"wandox-card-tag",children:Z}),X.video_url&&E.jsxs("button",{type:"button",className:"wandox-card-video",onClick:te,children:["▶ ",ee?` ${ee}`:"0:00"," 演示"]})]}),E.jsxs("button",{type:"button",className:"wandox-card-main",onClick:J,children:[E.jsx("div",{className:"wandox-card-title",children:X.name}),E.jsx("div",{className:"wandox-card-desc",children:K&&re||oe})]})]},I_(X))}),U&&E.jsxs("button",{type:"button",className:"wandox-card wandox-card-more",onClick:()=>m(!0),children:[E.jsxs("div",{className:"wandox-card-more-title",children:["查看全部 ",W.length," 个"]}),E.jsx("div",{className:"wandox-card-more-desc",children:"按场景浏览"})]})]}):E.jsx("div",{className:"wandox-empty-slot",children:E.jsxs("div",{className:"wandox-empty",children:[E.jsx("div",{className:"wandox-empty-text",children:d==="playbooks"?"暂无默认场景":d==="recommendations"?"暂无推荐场景":"暂无我的场景"}),E.jsx("div",{className:"wandox-empty-desc",children:d==="playbooks"?"请联系管理员添加场景剧本":d==="recommendations"?"系统会根据情况推荐相关场景":"我创建的场景会显示在这里"})]})})})}),E.jsx(Ci,{open:g,onCancel:()=>{m(!1),y("全部"),b("")},footer:null,width:900,closable:!1,centered:!0,styles:{container:{padding:0,overflow:"hidden"},body:{height:"90vh"}},zIndex:1e4,children:E.jsxs("div",{className:"wandox-playbook-browser",children:[E.jsxs("div",{className:"wandox-playbook-sidebar",children:[E.jsx("div",{className:"wandox-playbook-sidebar-title",children:"场景分类"}),E.jsx("div",{className:"wandox-playbook-categories",children:q.map(X=>E.jsxs("button",{type:"button",className:`wandox-playbook-category-item${v===X.name?" active":""}`,onClick:()=>y(X.name),children:[E.jsx("span",{className:"wandox-playbook-category-name",children:X.name}),E.jsx("span",{className:"wandox-playbook-category-count",children:X.count})]},X.name))})]}),E.jsxs("div",{className:"wandox-playbook-main",children:[E.jsx("div",{className:"wandox-playbook-search",children:E.jsx(zr,{placeholder:"搜索场景名称或描述...",prefix:E.jsx(nS,{style:{color:"#9ca3af"}}),value:x,onChange:X=>b(X.target.value),allowClear:!0})}),E.jsx("div",{className:"wandox-playbook-list",children:Y.length===0?E.jsx(is,{description:"暂无剧本",style:{marginTop:80}}):Y.map(X=>{const Q=X.input_fields&&X.input_fields.length>0,J=!!X.video_url,K=()=>{m(!1),y("全部"),b(""),Q&&n?n(X,X.name):r({message:X.name,playbook_id:X.playbook_id})},Z=X.video_duration?`${Math.floor(X.video_duration/60)}:${String(X.video_duration%60).padStart(2,"0")}`:"",ee=async()=>{var te;S(X),A(!0);try{const ae=await nZe({playbook_id:X.playbook_id});T(((te=ae.data)==null?void 0:te.video_url)||X.video_url||"")}catch{$t.error("视频加载失败"),T(X.video_url||"")}finally{A(!1)}};return E.jsx("div",{className:"wandox-playbook-list-item",children:E.jsxs("div",{className:"wandox-playbook-list-item-content",children:[E.jsx("div",{className:"wandox-playbook-list-item-icon",children:J?E.jsx("button",{className:"wandox-playbook-video-icon",title:"包含演示视频",onClick:ee,type:"button",children:E.jsx(Wp,{})}):E.jsx("div",{className:"wandox-playbook-no-video-icon",children:E.jsx(oqe,{})})}),E.jsxs("div",{className:"wandox-playbook-list-item-body",children:[E.jsx("div",{className:"wandox-playbook-list-item-header",children:E.jsxs("div",{className:"wandox-playbook-list-item-title",children:[X.name,X.badge&&E.jsx("span",{className:`wandox-scene-badge wandox-scene-badge--${X.badge}`,children:X.badge==="new"?"New":X.badge==="recommend"?"推荐":"精选"})]})}),X.description&&E.jsx("div",{className:"wandox-playbook-list-item-desc",children:X.description}),X.last_execution_remark&&E.jsxs("div",{className:"wandox-playbook-list-item-remark",children:[E.jsx("span",{className:"wandox-playbook-list-item-remark-icon",children:"💡"}),E.jsxs("span",{children:["上次:",X.last_execution_remark]})]})]}),E.jsxs("div",{className:"wandox-playbook-list-item-actions",children:[E.jsx("button",{type:"button",className:"wandox-playbook-list-item-btn",onClick:K,children:Q?"参数":"运行"}),J&&E.jsxs("button",{type:"button",className:"wandox-playbook-demo-link",onClick:ee,children:["看演示",Z?` ${Z}`:""]})]})]})},X.playbook_id)})})]})]})}),w&&E.jsx(Ci,{open:!0,onCancel:()=>{S(null),T("")},footer:null,centered:!0,width:800,title:E.jsxs("span",{children:[E.jsx(Wp,{style:{marginRight:8,color:"#7c3aed"}}),w.name," · 演示视频",w.video_duration&&E.jsxs("span",{style:{marginLeft:12,fontSize:13,color:"#9ca3af",fontWeight:"normal"},children:["时长 ",Math.floor(w.video_duration/60),":",String(w.video_duration%60).padStart(2,"0")]}),w.view_count!==void 0&&E.jsxs("span",{style:{marginLeft:12,fontSize:13,color:"#9ca3af",fontWeight:"normal"},children:["👁 ",w.view_count," 次播放"]})]}),styles:{body:{padding:"12px 0 0"}},zIndex:10001,children:k?E.jsx("div",{style:{height:400,display:"flex",alignItems:"center",justifyContent:"center",background:"#000",borderRadius:8},children:E.jsx(no.Node,{active:!0,style:{width:200,height:200}})}):E.jsx("video",{src:_,controls:!0,autoPlay:!0,style:{width:"100%",borderRadius:8,display:"block",maxHeight:"70vh",background:"#000"},children:E.jsx("track",{kind:"captions"})})})]})}const Bmt=[{name:"country",label:"国家/地区"},{name:"state",label:"州/省"},{name:"province",label:"省"},{name:"city",label:"城市"},{name:"postal_code",label:"邮政编码"},{name:"address_line1",label:"地址"}],nrn=Object.fromEntries(Bmt.map(e=>[e.name,e.label]));function p9(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function y5(e){return typeof e=="string"?e.trim():String(e??"").trim()}function irn(e,t){return!p9(e)||!Array.isArray(e[t])?[]:e[t].map(String).filter(Boolean)}function arn(e,t){if(!p9(e)||!p9(e.postal_code_patterns))return;const r=e.postal_code_patterns[t];return typeof r=="string"?r:void 0}function rQ(e){const t=String(e.type||"").toLowerCase(),r=String(e.widget||"").toLowerCase();return t==="address"||r==="address"}function srn(){return[...Bmt]}function Fmt(e,t){if(!p9(e))return"请输入有效地址";const r=irn(t,"required_fields"),n=r.length>0?r:["country","city","postal_code","address_line1"];for(const l of n)if(!y5(e[l]))return`请填写${nrn[l]||`地址字段 ${l}`}`;if(r.length===0&&!y5(e.state)&&!y5(e.province))return"请填写州/省";const i=y5(e.country).toUpperCase(),a=y5(e.postal_code),s=arn(t,i);if(a&&s)try{if(!new RegExp(s).test(a))return"邮政编码格式不正确"}catch{return"地址邮编规则配置无效"}const o=p9(t)&&typeof t.max_length=="number"?t.max_length:200;return y5(e.address_line1).length>o?`地址行不能超过 ${o} 个字符`:""}function zmt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function _Ce(e){return["array","list","tags","multi_select","multiselect"].includes(String(e||"").toLowerCase())}function jmt(e){return(e==null?void 0:e.includes("image"))??!1}function nQ(e){return(e.ui_component||e.widget||e.type||"string").toLowerCase()}function Vmt(e){return nQ(e)==="segmented"||e.type.toLowerCase()==="segmented"}function Hmt(e){var t;return(t=e.options)!=null&&t.length?e.options:(e.enum||[]).map(r=>({value:r,label:r}))}function orn(e){return e==null?"":typeof e=="string"||typeof e=="number"||typeof e=="bigint"?e:String(e)}function lrn(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function TCe(e){if(e==null||e==="")return null;if(typeof e=="string"||typeof e=="number"||e instanceof Date||Yr.isDayjs(e)){const t=Yr(e);return t.isValid()?t:null}return null}function crn(e){return Array.isArray(e)?e.map(t=>String(t)):e==null||e===""?[]:[String(e)]}function vy(e){return e==null||e===""||Array.isArray(e)&&e.length===0}function b5(e,t={}){const r={};for(const n of e){const i=t[n.name];i!==void 0&&i!==""?r[n.name]=i:n.default!==void 0&&n.default!==""?r[n.name]=n.default:n.type.toLowerCase()==="boolean"?r[n.name]=!1:["number","integer","float"].includes(n.type.toLowerCase())?r[n.name]=void 0:_Ce(n.type)?r[n.name]=[]:r[n.name]=""}return r}function g9(e,t){return Array.isArray(e)?e.some(r=>g9(r,t)):String(e??"")===String(t??"")}function urn(e){return Array.isArray(e)?e.filter(zmt):zmt(e)?"field"in e||"name"in e||"param"in e?[e]:Object.entries(e).map(([t,r])=>({field:t,equals:r})):[]}function drn(e,t){const r=String(e.field??e.name??e.param??"");if(!r)return!0;const n=t[r],i=e.equals!==void 0||e.value!==void 0,a=e.equals??e.value;return!(i&&!g9(n,a)||e.not_equals!==void 0&&g9(n,e.not_equals)||Array.isArray(e.in)&&!e.in.some(s=>g9(n,s))||Array.isArray(e.not_in)&&e.not_in.some(s=>g9(n,s))||e.truthy===!0&&!n||e.empty===!0&&!vy(n)||e.empty===!1&&vy(n))}function m9(e,t){return e.filter(r=>{const n=urn(r.visible_when);return n.length===0||n.every(i=>drn(i,t))})}function Wmt(e,t){return e.reduce((r,n)=>(r[n.name]=t[n.name],r),{})}function hrn(e){return Array.isArray(e)?e.map(t=>String(t)):e?[String(e)]:[]}function ECe(e){return e!=null&&e!==""}function kCe(e){return typeof e=="string"||typeof e=="number"||e instanceof Date||Yr.isDayjs(e)?Yr(e,"HH:mm"):null}function frn(e,t){const r=_Ce(e.type),n=crn(t),i=ECe(t)?String(t):void 0;return{isMulti:r,selectValue:r?n:i,isEmptySelect:r?n.length===0:i===void 0,hasCurrentSelection:r?n.length>0:i!==void 0}}function ACe({field:e,value:t,readOnly:r=!1,size:n,uploading:i=!1,imageUploadMode:a="picture",fileNameMap:s={},getOptionState:o,onChange:l,onUpload:u,onDownloadTemplate:d,draftValue:h,onDraftChange:f,onDraftCommit:p,selectSearchValue:g,onSelectSearchChange:m,onSelectAllowEmptySearch:v}){var S,_,T,k;const y=h??String(orn(t)),x=nQ(e),b=A=>l(e.name,A),w=()=>{var B,F;const A=o(e),$=e.options_from_skill?A.options:Hmt(e),I=!!(e.options_from_skill||(B=e.enum)!=null&&B.length||(F=e.options)!=null&&F.length),M=A.waitingForDependencies?"请先选择关联参数":A.placeholder||e.placeholder||"请选择",{isMulti:L,selectValue:R,isEmptySelect:N,hasCurrentSelection:P}=frn(e,t),D=m!==void 0,O=()=>{v==null||v(e.name),g&&(m==null||m(e.name,""))};return E.jsx(on,{allowClear:!r,showSearch:!r,size:n,autoClearSearchValue:!D,optionFilterProp:"label",filterOption:(j,V)=>{const H=j.trim().toLowerCase();return H?String((V==null?void 0:V.label)??(V==null?void 0:V.value)??"").toLowerCase().includes(H):!0},mode:L?I?"multiple":"tags":void 0,value:R,searchValue:r||!D?void 0:g,placeholder:N?M:void 0,options:$,loading:!r&&A.loading,disabled:!r&&A.waitingForDependencies,open:r?!1:void 0,tabIndex:r?-1:void 0,"aria-readonly":r,tokenSeparators:L&&!I?[","]:void 0,notFoundContent:A.loading?E.jsx(Yi,{size:"small"}):A.error||null,onInputKeyDown:j=>{["Backspace","Delete","Escape"].includes(j.key)&&(v==null||v(e.name))},onSearch:D?j=>m(e.name,j):void 0,onChange:j=>{b(j);const V=Array.isArray(j)?j.length>0:ECe(j);(P||V)&&O()},onClear:O,onBlur:O})};if(Vmt(e)){const A=Hmt(e);return A.length===0?w():E.jsx(zfe,{className:"wandox-agent-input-field-control__segmented",options:A,value:ECe(t)?String(t):void 0,disabled:r,onChange:b})}if(rQ(e)){const A=t&&typeof t=="object"&&!Array.isArray(t)?t:{},$=(I,M)=>{r||b({...A,[I]:M})};return E.jsxs("div",{className:"wandox-agent-input-field-control__address",children:[srn().map(({name:I,label:M})=>E.jsx(zr,{size:n,value:String(A[I]??""),readOnly:r,placeholder:M,onChange:L=>$(I,L.target.value)},I)),E.jsx(zr,{size:n,value:String(A.address_line2??""),readOnly:r,placeholder:"地址补充",onChange:I=>$("address_line2",I.target.value)})]})}switch(x){case"file":{const A=e.max_files??1,$=hrn(t),I=$.length<A,M=L=>{b(A<=1?"":$.filter((R,N)=>N!==L))};if(a==="picture"&&jmt(e.file_type)){const L=$.map((R,N)=>({uid:String(N),name:s[R]||R.split("/").pop()||`image_${N+1}`,status:"done",url:R}));return E.jsx(Hp,{className:"wandox-agent-input-field-control__picture",accept:e.file_type||void 0,listType:"picture-card",fileList:L,customRequest:r?void 0:u(e.name,A),onRemove:r?void 0:R=>(M(Number(R.uid)),!0),disabled:r||i,maxCount:A,showUploadList:{showRemoveIcon:!r},children:I&&!r&&E.jsxs("div",{children:[i?E.jsx(Yi,{size:"small"}):E.jsx(yu,{}),E.jsx("div",{className:"wandox-agent-input-field-control__upload-text",children:"上传图片"})]})})}return E.jsxs("div",{className:"wandox-agent-input-field-control__files",children:[$.map((L,R)=>E.jsxs("div",{className:"wandox-agent-input-field-control__file",children:[E.jsx("span",{children:s[L]||L.split("/").pop()||L}),!r&&E.jsx(ur,{type:"text",size:"small",danger:!0,"aria-label":"移除文件",icon:E.jsx(Lv,{}),onClick:()=>M(R)})]},L)),e.file_templates&&e.file_templates.length>0&&E.jsxs("div",{className:"wandox-agent-input-field-control__templates",children:[E.jsx("span",{children:"模板文件"}),e.file_templates.map((L,R)=>E.jsx(ur,{size:"small",onClick:()=>d==null?void 0:d(L),children:L.name||"下载模板"},`${L.path}-${L.name||R}`))]}),I&&!r&&E.jsxs(Hp.Dragger,{accept:e.file_type||void 0,showUploadList:!1,customRequest:u(e.name,A),disabled:i,children:[E.jsx("p",{className:"ant-upload-drag-icon",children:i?E.jsx(Yi,{size:"small"}):E.jsx(IO,{})}),E.jsx("p",{className:"ant-upload-text",children:i?"上传中...":"点击或拖拽文件上传"}),A>1&&E.jsxs("p",{className:"ant-upload-hint",children:["已上传 ",$.length,"/",A]})]})]})}case"boolean":return E.jsx(Lc,{size:n==="small"?"small":"default",checked:!!t,disabled:r,onChange:b});case"number":case"integer":case"float":return E.jsx(bu,{size:n,value:lrn(t),readOnly:r,placeholder:e.placeholder||"请输入",onChange:b});case"date":return E.jsx(nl,{size:n,value:TCe(t),allowClear:!r,inputReadOnly:r,open:r?!1:void 0,placeholder:e.placeholder||"请选择日期",onChange:(A,$)=>b($)});case"daterange":return E.jsx(nl.RangePicker,{size:n,value:Array.isArray(t)&&t.length===2?[TCe(t[0]),TCe(t[1])]:null,allowClear:!r,inputReadOnly:r,open:r?!1:void 0,placeholder:["请选择开始日期","请选择结束日期"],onChange:(A,$)=>b($)});case"time":return E.jsx(wu,{size:n,value:kCe(t),allowClear:!r,inputReadOnly:r,open:r?!1:void 0,format:"HH:mm",placeholder:e.placeholder||"请选择时间",onChange:(A,$)=>b($)});case"timerange":return E.jsx(wu.RangePicker,{size:n,value:Array.isArray(t)&&t.length===2?[kCe(t[0]),kCe(t[1])]:null,allowClear:!r,inputReadOnly:r,open:r?!1:void 0,format:"HH:mm",placeholder:["请选择开始时间","请选择结束时间"],onChange:(A,$)=>b($)});case"select":case"array":case"list":case"tags":case"multi_select":case"multiselect":return w();case"string":return(S=e.enum)!=null&&S.length||(_=e.options)!=null&&_.length||e.options_from_skill?w():E.jsx(zr,{size:n,value:y,readOnly:r,placeholder:e.placeholder||"请输入",onChange:r?void 0:A=>f?f(e.name,A.target.value):b(A.target.value),onBlur:r?void 0:A=>p==null?void 0:p(e.name,A.target.value)});default:return(T=e.enum)!=null&&T.length||(k=e.options)!=null&&k.length||e.options_from_skill?w():E.jsx(zr.TextArea,{value:y,readOnly:r,autoSize:{minRows:2,maxRows:8},placeholder:e.placeholder||"请输入",onChange:r?void 0:A=>f?f(e.name,A.target.value):b(A.target.value),onBlur:r?void 0:A=>p==null?void 0:p(e.name,A.target.value)})}}const Gmt=/\$\{\s*\{?\s*params\.([a-zA-Z0-9_.-]+)\s*\}?\s*\}/g,prn=/^\$\{\s*\{?\s*params\.([a-zA-Z0-9_.-]+)\s*\}?\s*\}$/;function $_(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ICe(e,t){return t.split(".").reduce((r,n)=>{if($_(r))return r[n]},e)}function grn(e){return e==null||e===""}function mrn(e){const t=new Set,r=n=>{if(typeof n=="string"){for(const i of n.matchAll(Gmt))i[1]&&t.add(i[1]);return}if(Array.isArray(n)){n.forEach(r);return}$_(n)&&Object.values(n).forEach(r)};return r(e),Array.from(t)}function vrn(e,t){const r=e.split(".")[0],n=t.find(i=>i.name===e||i.name===r);return n?!!n.required:!0}function $Ce(e,t){if(typeof e=="string"){const r=e.match(prn);return r!=null&&r[1]?ICe(t,r[1]):e.replace(Gmt,(n,i)=>{const a=ICe(t,i);return a==null?"":String(a)})}return Array.isArray(e)?e.map(r=>$Ce(r,t)):$_(e)?Object.fromEntries(Object.entries(e).map(([r,n])=>[r,$Ce(n,t)])):e}function yrn(e){const t=$_(e)&&"data"in e?e.data:e,r=[t];$_(t)&&(r.push(t.output_data,t.options,t.items,t.data,t.result,t.results,t.list),$_(t.output)&&r.push(t.output.output_data,t.output.options,t.output.items,t.output.data));for(const n of r)if(Array.isArray(n))return n;return[]}function brn(e){let t;return{options:yrn(e).map(n=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return{value:String(n),label:String(n)};if(!$_(n))return null;const i=n.value??n.key??n.code??n.id??n.name??n.label;if(i==null)return null;const a=n.label??n.name??n.title??n.text??n.value??i;if(String(i)===""){const s=String(a||"");return s&&!t&&(t=s),null}return{value:String(i),label:String(a)}}).filter(n=>!!n),placeholder:t}}function xrn(e){return(e.enum||[]).map(t=>({value:t,label:t}))}function iQ(e,t,r){const[n,i]=C.useState({}),a=C.useRef({}),s=C.useRef({}),o=C.useMemo(()=>e.filter(l=>!!l.options_from_skill),[e]);return C.useEffect(()=>{const l=new Set(o.map(u=>u.name));for(const u of Object.keys(a.current))l.has(u)||(delete a.current[u],delete s.current[u]);i(u=>{const d=Object.fromEntries(Object.entries(u).filter(([h])=>l.has(h)));return Object.keys(d).length===Object.keys(u).length?u:d})},[o]),C.useEffect(()=>{for(const l of o){if(!l.options_from_skill)continue;const d=mrn(l.options_params).filter(m=>vrn(m,e)&&grn(ICe(t,m))),h=$Ce(l.options_params||{},t),f=JSON.stringify({skill_id:l.options_from_skill,params:h,missing:d});if(a.current[l.name]===f)continue;const p=a.current[l.name]!==void 0||d.length>0;a.current[l.name]=f,s.current[l.name]=(s.current[l.name]||0)+1;const g=s.current[l.name];if(p&&r(m=>m[l.name]===void 0||m[l.name]===""?m:{...m,[l.name]:void 0}),d.length>0){i(m=>({...m,[l.name]:{options:[],loading:!1,waitingForDependencies:!0}}));continue}i(m=>{var v,y;return{...m,[l.name]:{options:((v=m[l.name])==null?void 0:v.options)||[],loading:!0,placeholder:(y=m[l.name])==null?void 0:y.placeholder,waitingForDependencies:!1}}}),oZe({},{skill_id:l.options_from_skill,params:h}).then(m=>{if(s.current[l.name]!==g)return;const v=brn(m);i(y=>({...y,[l.name]:{options:v.options,loading:!1,placeholder:v.placeholder,waitingForDependencies:!1}}))}).catch(m=>{if(s.current[l.name]!==g)return;const v=m instanceof Error?m.message:"动态选项加载失败";i(y=>({...y,[l.name]:{options:[],loading:!1,error:v,waitingForDependencies:!1}}))})}},[o,e,t,r]),{getFieldState(l){return l.options_from_skill?n[l.name]||{options:[],loading:!1,waitingForDependencies:!1}:{options:xrn(l),loading:!1,waitingForDependencies:!1}}}}function x5(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function R_(e,t=""){return typeof e=="string"?e:e==null?t:String(e)}function Qm(e){return typeof e=="string"?e:void 0}function Umt(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function wrn(e){if(!Array.isArray(e))return;const t=e.map(r=>{if(!x5(r))return null;const n=R_(r.path);return n?{name:R_(r.name,n.split("/").pop()||n),path:n}:null}).filter(r=>!!r);return t.length>0?t:void 0}function Srn(e){if(!Array.isArray(e))return;const t=e.map(r=>{if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")return{value:String(r),label:String(r)};if(!x5(r))return null;const n=r.value??r.key??r.code??r.id??r.name??r.label;return n==null||n===""?null:{value:String(n),label:R_(r.label??r.title??r.text??r.name??n,String(n))}}).filter(r=>!!r);return t.length>0?t:void 0}function RCe(e){const t=x5(e)?e:{};return{name:R_(t.name),label:R_(t.label,R_(t.name)),type:R_(t.type,"string"),required:typeof t.required=="boolean"?t.required:!0,default:t.default,mock:t.mock,enum:Array.isArray(t.enum)?t.enum.map(r=>String(r)):void 0,options:Srn(t.options),placeholder:Qm(t.placeholder),options_from_skill:Qm(t.options_from_skill),options_params:x5(t.options_params)?t.options_params:void 0,file_type:Qm(t.file_type),max_files:Umt(t.max_files),description:Qm(t.description),hint:Qm(t.hint??t.label_hint??t.helper_text),file_templates:wrn(t.file_templates),group:Qm(t.group??t.group_key??t.form_group),group_label:Qm(t.group_label??t.group_title),group_description:Qm(t.group_description??t.group_subtitle),ui_component:Qm(t.ui_component??t.component??t.render_as),widget:Qm(t.widget),address_validation:t.address_validation??t.addressValidation,span:Umt(t.span??t.col_span??t.column_span),visible_when:t.visible_when??t.visibleWhen}}function NCe(e){return Array.isArray(e)?e.map(RCe).filter(t=>!!t.name):x5(e)?Object.entries(e).map(([t,r])=>x5(r)?RCe({...r,name:r.name??t}):RCe({name:t,label:t,type:"string",default:r})).filter(t=>!!t.name):[]}function Crn(e){return e instanceof Error?e.message:"上传失败"}function _rn({open:e,playbook:t,onClose:r,onSubmit:n}){const i=C.useMemo(()=>NCe(t==null?void 0:t.input_fields),[t]),[a,s]=C.useState({}),[o,l]=C.useState({}),[u,d]=C.useState({}),h=iQ(i,a,s),f=C.useMemo(()=>m9(i,a),[i,a]);C.useEffect(()=>{e&&(s({...b5(i),...(t==null?void 0:t.initial_params)??{}}),l({}),d({}))},[i,e,t==null?void 0:t.initial_params]);const p=C.useCallback((v,y)=>{s(x=>({...x,[v]:y}))},[]),g=C.useCallback((v,y)=>async({file:x,onSuccess:b,onError:w})=>{var S,_;l(T=>({...T,[v]:!0}));try{const T=x,k=await OS(T),A=(S=k==null?void 0:k.data)==null?void 0:S.url,$=((_=k==null?void 0:k.data)==null?void 0:_.name)||T.name;if(!A)throw new Error("上传结果缺少文件地址");d(I=>({...I,[A]:$})),s(I=>{if(y<=1)return{...I,[v]:A};const M=Array.isArray(I[v])?I[v]:I[v]?[I[v]]:[];return{...I,[v]:[...M,A]}}),b==null||b(k),$t.success("上传成功")}catch(T){const k=T instanceof Error?T:new Error(Crn(T));w==null||w(k),$t.error(k.message)}finally{l(T=>({...T,[v]:!1}))}},[]),m=()=>{if(!t)return;const v=f.filter(y=>y.required&&vy(a[y.name]));if(v.length>0){$t.warning(`请填写必填参数:${v.map(y=>y.label).join("、")}`);return}n(t,a)};return E.jsxs(t3,{className:"wandox-playbook-params-drawer",title:E.jsxs("div",{className:"wandox-playbook-params-drawer__title",children:[E.jsx("span",{className:"wandox-playbook-params-drawer__title-main",children:"填写执行参数"}),E.jsx("span",{className:"wandox-playbook-params-drawer__title-sub",children:t==null?void 0:t.name})]}),open:e,width:640,destroyOnHidden:!0,maskClosable:!1,onClose:r,footer:E.jsx("div",{className:"wandox-playbook-params-drawer__footer",children:E.jsxs(il,{children:[E.jsx(ur,{onClick:r,children:"取消"}),E.jsx(ur,{type:"primary",onClick:m,children:"开始执行"})]})}),children:[E.jsxs("div",{className:"wandox-playbook-params-drawer__intro",children:[E.jsx("span",{children:"填写本次运行需要的参数"}),E.jsxs("span",{children:[f.length," 项"]})]}),E.jsxs(Sn,{layout:"vertical",className:"wandox-playbook-params-drawer__form",children:[f.map(v=>E.jsx(Sn.Item,{required:v.required,label:E.jsxs("span",{className:"wandox-playbook-params-drawer__label",children:[v.label,v.description||v.hint?E.jsx(ki,{title:v.description||v.hint,children:E.jsx(fO,{"aria-label":`${v.label}说明`})}):null]}),children:E.jsx(ACe,{field:v,value:a[v.name],uploading:!!o[v.name],fileNameMap:u,getOptionState:h.getFieldState,onChange:p,onUpload:g,onDownloadTemplate:y=>window.open(y.path,"_blank","noopener,noreferrer")})},v.name)),f.length===0?E.jsxs("div",{className:"wandox-playbook-params-drawer__empty",children:[E.jsx(Yi,{size:"small"})," 正在读取参数配置"]}):null]})]})}function Trn({playbooks:e,onPlaybookClick:t,onPlaybookDelete:r,activePlaybookId:n}){const{t:i}=fm(),[a,s]=C.useState(""),[o,l]=C.useState(!1),[u,d]=C.useState(null),[h,f]=C.useState(!1),p=e.filter(y=>{var x;return y.name.toLowerCase().includes(a.toLowerCase())||((x=y.description)==null?void 0:x.toLowerCase().includes(a.toLowerCase()))}),g=(y,x)=>{x.stopPropagation(),d(y),l(!0)},m=async()=>{if(u){f(!0);try{await GEr(u.playbook_id),r==null||r(u.playbook_id),l(!1),d(null)}catch{}finally{f(!1)}}},v=()=>{l(!1),d(null)};return E.jsxs("div",{className:"wandox-solidified-list",children:[E.jsx("div",{className:"wandox-solidified-list-search",children:E.jsx(zr.Search,{placeholder:"搜索",value:a,onChange:y=>s(y.target.value),allowClear:!0,enterButton:!1})}),E.jsx("div",{className:"wandox-solidified-list-content",children:p.length===0?E.jsx(is,{description:i(a?"noData":"solidified.empty"),image:is.PRESENTED_IMAGE_SIMPLE}):E.jsx("div",{className:"wandox-solidified-list-grid",children:p.map(y=>E.jsxs("div",{className:`wandox-solidified-card ${n===y.playbook_id?"active":""}`,onClick:()=>t==null?void 0:t(y.playbook_id),onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(t==null||t(y.playbook_id))},role:"button",tabIndex:0,children:[E.jsx("div",{className:"wandox-solidified-card-icon",children:E.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"2",fill:"none"}),E.jsx("path",{d:"M9 3v18M15 3v18M3 9h18M3 15h18",stroke:"currentColor",strokeWidth:"1.5"}),E.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor"})]})}),E.jsxs("div",{className:"wandox-solidified-card-content",children:[E.jsx("div",{className:"wandox-solidified-card-name",children:y.name}),y.description&&E.jsx("div",{className:"wandox-solidified-card-desc",children:y.description})]}),E.jsx("button",{type:"button",className:"wandox-solidified-card-delete",onClick:x=>g(y,x),title:i("solidified.delete"),children:E.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:E.jsx("path",{d:"M6 7v12a2 2 0 002 2h8a2 2 0 002-2V7M4 7h16M10 11v6M14 11v6M9 7V4a1 1 0 011-1h4a1 1 0 011 1v3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},y.playbook_id))})}),E.jsx(Ci,{title:i("solidified.deleteConfirm"),open:o,onOk:m,onCancel:v,okText:i("confirm"),cancelText:i("cancel"),okButtonProps:{danger:!0,loading:h},children:E.jsxs("p",{children:[i("solidified.deleteConfirm")," 「",u==null?void 0:u.name,"」?"]})})]})}function Ern({inputParams:e,onSearch:t,loading:r=!1}){const[n]=Sn.useForm();C.useEffect(()=>{const s={};for(const o of e)o.default!==void 0&&o.default!==null&&o.default!==""&&(s[o.name]=o.default);n.setFieldsValue(s)},[e,n]);const i=()=>{n.validateFields().then(s=>{const o={};for(const l of Object.keys(s)){const u=s[l];u!=null&&u!==""&&(o[l]=u)}t(o)})},a=s=>{const{name:o,type:l,description:u}=s,d={placeholder:u||`请输入${o}`};switch(l){case"integer":return E.jsx(bu,{...d,style:{width:"100%"}});case"array":return E.jsx(zr,{...d});case"boolean":return E.jsx(zr,{...d});case"string":default:return E.jsx(zr,{...d})}};return E.jsx("div",{className:"wandox-solidify-params-form",children:E.jsxs(Sn,{form:n,layout:"inline",onFinish:i,style:{marginBottom:16},children:[e.map(s=>E.jsx(Sn.Item,{name:s.name,label:s.description||s.name,rules:[{required:s.required,message:`请输入${s.description||s.name}`}],style:{marginBottom:8},children:a(s)},s.name)),E.jsx(Sn.Item,{style:{marginBottom:8},children:E.jsx(ur,{type:"primary",htmlType:"submit",loading:r,children:"查询"})})]})})}const w5={fontSize:13,fontWeight:600,color:"#374151",marginBottom:6};function krn({open:e,onClose:t,onSuccess:r,editingSchedule:n,webhooks:i}){const a=!n,[s,o]=C.useState(""),[l,u]=C.useState(!0),[d,h]=C.useState(""),[f,p]=C.useState(0),[g,m]=C.useState(""),[v,y]=C.useState(""),[x,b]=C.useState(""),[w,S]=C.useState([]),[_,T]=C.useState({}),[k,A]=C.useState(!1),[$,I]=C.useState({}),[M,L]=C.useState({}),[R,N]=C.useState([]),[P,D]=C.useState([]),[O,B]=C.useState(!1),[F,j]=C.useState(!1),V=C.useCallback(async(Z,ee)=>{var te;if(!Z){S([]),T({});return}A(!0);try{const{data:ae}=await fq({playbook_id:Z}),le=((te=ae==null?void 0:ae.content)==null?void 0:te.yaml_content)||"";let oe=[];if(le)try{const re=oq.parse(le),se=re==null?void 0:re.params;Array.isArray(se)&&se.length>0?oe=se:se&&typeof se=="object"&&(oe=Object.values(se))}catch{}if(S(oe),oe.length>0){const re={};for(const se of oe){const ve=ee==null?void 0:ee[se.name];ve!==void 0?re[se.name]=ve:se.default!==void 0&&se.default!==null&&(re[se.name]=se.default)}T(re)}else T({})}catch{S([])}A(!1)},[]),H=C.useCallback(async()=>{var Z,ee;B(!0);try{const[te,ae]=await Promise.all([HEr({page:1,page_size:200}),x0e({page:1,page_size:100})]),le=((Z=te==null?void 0:te.data)==null?void 0:Z.items)??(Array.isArray(te==null?void 0:te.data)?te==null?void 0:te.data:[]),oe=((ee=ae==null?void 0:ae.data)==null?void 0:ee.items)??(Array.isArray(ae==null?void 0:ae.data)?ae==null?void 0:ae.data:[]);N(le.map(re=>({value:re.playbook_id??String(re.id),label:re.name}))),D(oe.map(re=>({value:String(re.id),label:re.name})))}catch{}B(!1)},[]);C.useEffect(()=>{if(e)if(p(Z=>Z+1),I({}),L({}),n){o(n.name||""),u(n.is_active),h(n.cron_expression||"");const Z=n.playbook_params||{};T(Z),V(n.playbook_id||"",Z)}else o(""),u(!0),h(""),m(""),y(""),b(""),S([]),T({}),H()},[e,n,V,H]),C.useEffect(()=>{a&&(g?V(g):(S([]),T({})))},[g,a,V]);const W=(Z,ee)=>{T(te=>({...te,[Z]:ee}))},U=Z=>async({file:ee,onSuccess:te,onError:ae})=>{var le,oe;I(re=>({...re,[Z.name]:!0}));try{const re=ee,se=await OS(re),ve=(le=se==null?void 0:se.data)==null?void 0:le.url,he=((oe=se==null?void 0:se.data)==null?void 0:oe.name)||re.name||(ve==null?void 0:ve.split("/").pop())||"未知文件";if(!ve)throw new Error("上传失败");L(Ce=>({...Ce,[ve]:he})),(Z.max_files??1)<=1?W(Z.name,ve):T(Ce=>{const Le=Array.isArray(Ce[Z.name])?Ce[Z.name]:Ce[Z.name]?[Ce[Z.name]]:[];return{...Ce,[Z.name]:[...Le,ve]}}),te==null||te(se),$t.success("上传成功")}catch(re){ae==null||ae(re instanceof Error?re:new Error("文件上传失败")),$t.error(re instanceof Error?re.message:"文件上传失败")}finally{I(re=>({...re,[Z.name]:!1}))}},q=Z=>{if(!Z)return null;const ee=Yr(Z);return ee.isValid()?ee:null},Y=Z=>{if(!Array.isArray(Z)||Z.length!==2)return null;const ee=Yr(Z[0]),te=Yr(Z[1]);return ee.isValid()&&te.isValid()?[ee,te]:null},X=Z=>{if(!Z)return null;const ee=Yr(`2000-01-01 ${Z}`);return ee.isValid()?ee:null},Q=Z=>{if(!Array.isArray(Z)||Z.length!==2)return null;const ee=Yr(`2000-01-01 ${Z[0]}`),te=Yr(`2000-01-01 ${Z[1]}`);return ee.isValid()&&te.isValid()?[ee,te]:null},J=Z=>{const ee=_[Z.name];switch(Z.type){case"string":return E.jsx(zr.TextArea,{value:ee??"",onChange:te=>W(Z.name,te.target.value),autoSize:{minRows:1,maxRows:4},placeholder:Z.description||""});case"number":case"integer":case"float":return E.jsx(bu,{style:{width:"100%"},value:ee,onChange:te=>W(Z.name,te),placeholder:Z.description||"",precision:Z.type==="integer"?0:void 0,size:"small"});case"boolean":return E.jsx(Lc,{size:"small",checked:!!ee,onChange:te=>W(Z.name,te)});case"array":case"object":return E.jsx(zr.TextArea,{value:typeof ee=="string"?ee:ee!=null?JSON.stringify(ee):"",onChange:te=>W(Z.name,te.target.value),autoSize:{minRows:1,maxRows:4},placeholder:Z.description||"JSON 格式"});case"file":{const te=Z.max_files??1,ae=Array.isArray(ee)?ee.map(String):ee?[String(ee)]:[],le=ae.length<te,oe=re=>{te<=1?W(Z.name,""):W(Z.name,ae.filter((se,ve)=>ve!==re))};return E.jsxs("div",{children:[ae.length>0&&E.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6,marginBottom:8},children:ae.map((re,se)=>E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,minHeight:30,padding:"4px 8px",border:"1px solid #e5e7eb",borderRadius:6,background:"#fff"},children:[E.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:12},children:M[re]||re.split("/").pop()||re}),E.jsx(ur,{type:"text",size:"small",danger:!0,onClick:()=>oe(se),children:"删除"})]},re))}),le&&E.jsx(Hp,{accept:Z.file_type||void 0,showUploadList:!1,customRequest:U(Z),disabled:!!$[Z.name],children:E.jsx(ur,{size:"small",icon:E.jsx(IO,{}),loading:!!$[Z.name],children:$[Z.name]?"上传中...":"点击上传"})})]})}case"date":return E.jsx(nl,{style:{width:"100%"},value:q(ee),onChange:(te,ae)=>W(Z.name,ae),placeholder:Z.description||"选择日期"});case"dateRange":return E.jsx(nl.RangePicker,{style:{width:"100%"},value:Y(ee),onChange:(te,ae)=>W(Z.name,ae),placeholder:["开始日期","结束日期"]});case"time":return E.jsx(wu,{style:{width:"100%"},value:X(ee),format:"HH:mm",onChange:(te,ae)=>W(Z.name,ae),placeholder:Z.description||"选择时间"});case"timeRange":return E.jsx(wu.RangePicker,{style:{width:"100%"},value:Q(ee),format:"HH:mm",onChange:(te,ae)=>W(Z.name,ae),placeholder:["开始时间","结束时间"]});default:return E.jsx(zr,{value:ee??"",onChange:te=>W(Z.name,te.target.value),placeholder:Z.description||"",size:"small"})}},K=async()=>{if(!s.trim()){$t.warning("请输入任务名称");return}if(!d.trim()){$t.warning("请配置调度频率");return}if(a&&!g){$t.warning("请选择剧本");return}const Z=w.length>0?_:void 0;j(!0);try{n?(await dZe(n.schedule_id,{},{name:s,cron_expression:d,schedule_type:"custom",is_active:l,playbook_params:Z}),$t.success("更新成功")):(await cZe({},{name:s,agent_id:v,playbook_id:g,webhook_id:x,cron_expression:d,schedule_type:"custom",playbook_params:Z}),$t.success("创建成功")),r(),t()}catch(ee){$t.error((ee==null?void 0:ee.message)||"操作失败")}finally{j(!1)}};return E.jsxs(Ci,{title:null,open:e,onOk:K,onCancel:t,okText:"保存",cancelText:"取消",width:540,confirmLoading:F,closable:!1,children:[E.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:20},children:[E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[E.jsx(rl,{style:{fontSize:20,color:"#722ed1"}}),E.jsx("span",{style:{fontSize:16,fontWeight:600,color:"#111827"},children:a?"新增定时任务":"编辑定时任务"})]}),E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[E.jsx("span",{style:{fontSize:13,color:l?"#111827":"#9ca3af"},children:l?"已启用":"已禁用"}),E.jsx(Lc,{checked:l,onChange:u})]})]}),E.jsxs("div",{style:{marginBottom:16},children:[E.jsxs("div",{style:w5,children:["任务名称 ",E.jsx("span",{style:{color:"#ef4444"},children:"*"})]}),E.jsx(zr,{value:s,onChange:Z=>o(Z.target.value),placeholder:"请输入任务名称",style:{borderRadius:8}})]}),a&&E.jsxs(Yi,{spinning:O,children:[E.jsxs("div",{style:{marginBottom:16},children:[E.jsxs("div",{style:w5,children:["剧本 ",E.jsx("span",{style:{color:"#ef4444"},children:"*"})]}),E.jsx(on,{style:{width:"100%"},value:g||void 0,onChange:Z=>m(Z),options:R,placeholder:"请选择剧本",showSearch:!0,filterOption:(Z,ee)=>{var te;return(te=ee==null?void 0:ee.label)==null?void 0:te.toLowerCase().includes(Z.toLowerCase())}})]}),E.jsxs("div",{style:{marginBottom:16},children:[E.jsx("div",{style:w5,children:"智能体"}),E.jsx(on,{style:{width:"100%"},value:v||void 0,onChange:Z=>y(Z),options:P,placeholder:"请选择智能体(可选)",showSearch:!0,allowClear:!0,filterOption:(Z,ee)=>{var te;return(te=ee==null?void 0:ee.label)==null?void 0:te.toLowerCase().includes(Z.toLowerCase())}})]}),E.jsxs("div",{style:{marginBottom:16},children:[E.jsx("div",{style:w5,children:"通知 Webhook"}),E.jsx(on,{style:{width:"100%"},value:x||void 0,onChange:Z=>b(Z),options:i.map(Z=>({value:Z.webhook_id,label:Z.name})),placeholder:"请选择 Webhook(可选)",allowClear:!0})]})]}),E.jsxs("div",{style:{marginBottom:16},children:[E.jsx("div",{style:w5,children:"调度频率"}),E.jsx(bCe,{defaultValue:n==null?void 0:n.cron_expression,onChange:Z=>h(Z)},f)]}),k&&E.jsxs("div",{style:{textAlign:"center",padding:"12px 0"},children:[E.jsx(Yi,{size:"small"}),E.jsx("span",{style:{marginLeft:8,fontSize:12,color:"#9ca3af"},children:"加载参数配置..."})]}),!k&&w.length>0&&E.jsxs("div",{style:{marginBottom:16},children:[E.jsx("div",{style:w5,children:"执行参数"}),E.jsx("div",{style:{background:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:8,padding:"12px 16px"},children:w.map(Z=>E.jsxs("div",{style:{marginBottom:12},children:[E.jsxs("div",{style:{fontSize:12,fontWeight:500,color:"#374151",marginBottom:4},children:[Z.label||Z.name,Z.required&&E.jsx("span",{style:{color:"#ef4444",marginLeft:2},children:"*"})]}),Z.description&&E.jsx("div",{style:{fontSize:11,color:"#9ca3af",marginBottom:4},children:Z.description}),J(Z)]},Z.name))})]})]})}const Arn={daily:"每天",weekly:"每周",monthly:"每月",workday:"工作日",custom:"自定义"},Irn={1:"周一",2:"周二",3:"周三",4:"周四",5:"周五",6:"周六",7:"周日",0:"周日"};function $rn(e){const t=XZ(e),r=`${String(t.hour).padStart(2,"0")}:${String(t.minute).padStart(2,"0")}`;switch(t.unit){case"hour":return t.interval===1?`每小时第 ${t.minute} 分`:`每 ${t.interval} 小时`;case"week":return`每${t.weekDays.map(i=>Irn[i]||"").filter(Boolean).join("、")} ${r}`;case"month":return t.interval===1?`每月 ${t.monthDay} 号 ${r}`:`每 ${t.interval} 月 ${t.monthDay} 号 ${r}`;case"year":return`每年 ${t.yearMonth} 月 ${t.yearDay} 日 ${r}`;case"day":return t.interval===1?`每天 ${r}`:`每 ${t.interval} 天 ${r}`;case"custom":return t.customCron.trim()?`自定义:${t.customCron.trim()}`:e;default:return e}}const Rrn=({className:e})=>{const[t,r]=C.useState([]),[n,i]=C.useState(!1),[a,s]=C.useState(!1),[o,l]=C.useState(null),[u]=Sn.useForm(),[d,h]=C.useState(),[f,p]=C.useState([]),[g,m]=C.useState(!1),[v,y]=C.useState(!1),[x,b]=C.useState(null);C.useEffect(()=>{S(),M()},[]);const w=[{label:"钉钉",value:"dingtalk"},{label:"飞书",value:"feishu"},{label:"企业微信",value:"wecom"}],S=async()=>{try{i(!0);const D=await pq({});D!=null&&D.data&&r(D.data)}catch(D){$t.error((D==null?void 0:D.message)||"加载失败")}finally{i(!1)}},_=()=>{l(null),u.resetFields(),h(void 0),s(!0)},T=async D=>{try{i(!0);const O=await QEr(D.webhook_id,{}),B=(O==null?void 0:O.data)||D;l(B),h(B.platform),u.setFieldsValue({...B,notify_time:B.notify_start_time&&B.notify_end_time?[Yr(B.notify_start_time,"HH:mm:ss"),Yr(B.notify_end_time,"HH:mm:ss")]:void 0}),s(!0)}catch(O){$t.error((O==null?void 0:O.message)||"获取详情失败")}finally{i(!1)}},k=async D=>{try{i(!0),await tkr(D.webhook_id,{}),$t.success("测试消息发送成功")}catch(O){$t.error((O==null?void 0:O.message)||"测试失败")}finally{i(!1)}},A=D=>{Ci.confirm({title:"确认删除",content:`确定要删除 Webhook "${D.name}" 吗?`,okText:"确定",cancelText:"取消",onOk:async()=>{try{await ekr(D.webhook_id,{}),$t.success("删除成功"),S()}catch(O){$t.error((O==null?void 0:O.message)||"删除失败")}}})},$=async()=>{var D,O,B,F;try{const j=await u.validateFields();i(!0);const V={name:j.name,description:j.description,platform:j.platform,webhook_url:j.webhook_url,secret:j.secret,notify_start_time:(O=(D=j.notify_time)==null?void 0:D[0])==null?void 0:O.format("HH:mm:ss"),notify_end_time:(F=(B=j.notify_time)==null?void 0:B[1])==null?void 0:F.format("HH:mm:ss"),is_active:j.is_active,is_default:j.is_default};o?(await JEr(o.webhook_id,{},V),$t.success("更新成功")):(await lZe({},V),$t.success("创建成功")),s(!1),u.resetFields(),S()}catch(j){$t.error((j==null?void 0:j.message)||"操作失败")}finally{i(!1)}},I=[{title:"名称",dataIndex:"name",key:"name",width:150,render:(D,O)=>{const B={dingtalk:E.jsx(KCr,{style:{color:"#1677ff"}}),feishu:E.jsx(IKe,{style:{color:"#1677ff"}}),wecom:E.jsx(G_r,{style:{color:"#1677ff"}})};return E.jsxs(il,{size:4,children:[B[O.platform],E.jsx("span",{children:D})]})}},{title:"描述",dataIndex:"description",key:"description",ellipsis:!0},{title:"通知时段",key:"notify_time",width:150,render:(D,O)=>!O.notify_start_time||!O.notify_end_time?"全天":`${O.notify_start_time} ~ ${O.notify_end_time}`},{title:"状态",dataIndex:"is_active",key:"is_active",width:80,render:D=>E.jsx("span",{style:{color:D?"#52c41a":"#999"},children:D?"启用":"禁用"})},{title:"默认",dataIndex:"is_default",key:"is_default",width:80,render:D=>D?E.jsx("span",{style:{color:"#1890ff"},children:"是"}):"否"},{title:"操作",key:"action",width:210,render:(D,O)=>E.jsxs(il,{size:0,children:[E.jsx(ur,{type:"link",size:"small",icon:E.jsx(EO,{}),onClick:()=>T(O),className:"wandox-webhook-action-btn",children:E.jsx("span",{className:"wandox-webhook-action-text",children:"编辑"})}),E.jsx(ur,{type:"link",size:"small",icon:E.jsx(kme,{}),onClick:()=>k(O),className:"wandox-webhook-action-btn",children:E.jsx("span",{className:"wandox-webhook-action-text",children:"测试"})}),E.jsx(ur,{type:"link",size:"small",danger:!0,icon:E.jsx(Lv,{}),onClick:()=>A(O),className:"wandox-webhook-action-btn",children:E.jsx("span",{className:"wandox-webhook-action-text",children:"删除"})})]})}],M=async()=>{try{m(!0);const D=await uZe({});if(D!=null&&D.data){const O=Array.isArray(D.data)?D.data:D.data.items||[];p(O)}}catch{}finally{m(!1)}},L=D=>{if(D.cron_expression)return $rn(D.cron_expression);const O=Arn[D.schedule_type]||D.schedule_type,B=D.schedule_time||"--:--";return`${O} ${B}`},R=D=>{b(D),y(!0)},N=D=>{Ci.confirm({title:"确认删除",content:`确定要删除定时任务「${D.name}」吗?`,okText:"确定",cancelText:"取消",onOk:async()=>{try{await hZe(D.schedule_id,{}),$t.success("删除成功"),M()}catch(O){$t.error((O==null?void 0:O.message)||"删除失败")}}})},P=[{title:"任务名称",dataIndex:"name",key:"name",width:150,render:D=>E.jsxs(il,{size:4,children:[E.jsx(rl,{style:{color:"#722ed1"}}),E.jsx("span",{children:D})]})},{title:"调度规则",key:"schedule_desc",width:180,render:(D,O)=>E.jsx("span",{style:{fontFamily:"monospace",fontSize:12},children:L(O)})},{title:"Webhook",dataIndex:"webhook_name",key:"agent_name",width:120,ellipsis:!0,render:D=>D||"-"},{title:"状态",dataIndex:"is_active",key:"is_active",width:70,render:D=>E.jsx(io,{color:D?"green":"default",children:D?"启用":"禁用"})},{title:"操作",key:"action",width:140,render:(D,O)=>E.jsxs(il,{size:0,children:[E.jsx(ur,{type:"link",size:"small",icon:E.jsx(EO,{}),onClick:()=>R(O),className:"wandox-webhook-action-btn",children:E.jsx("span",{className:"wandox-webhook-action-text",children:"编辑"})}),E.jsx(ur,{type:"link",size:"small",danger:!0,icon:E.jsx(Lv,{}),onClick:()=>N(O),className:"wandox-webhook-action-btn",children:E.jsx("span",{className:"wandox-webhook-action-text",children:"删除"})})]})}];return E.jsxs("div",{className:`wandox-webhook-management ${e||""}`,children:[E.jsx("div",{className:"wandox-webhook-header",children:E.jsx(ur,{type:"primary",size:"middle",icon:E.jsx(yu,{}),onClick:_,style:{borderRadius:"6px",fontWeight:500,boxShadow:"0 2px 4px rgba(24, 144, 255, 0.2)"},children:"新增"})}),E.jsx(xu,{size:"small",columns:I,dataSource:t,rowKey:"webhook_id",loading:n,pagination:{pageSize:10,showSizeChanger:!0,showTotal:D=>`共 ${D} 条`},scroll:{x:770}}),E.jsx(Ffe,{style:{margin:"16px 0 12px"}}),E.jsx("div",{className:"wandox-schedule-section-header",style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8},children:E.jsxs("div",{className:"wandox-schedule-section-title",children:[E.jsx(rl,{style:{color:"#722ed1",marginRight:6}}),"定时任务"]})}),E.jsx(xu,{size:"small",columns:P,dataSource:f,rowKey:"schedule_id",loading:g,pagination:{pageSize:10,showSizeChanger:!0,showTotal:D=>`共 ${D} 条`},scroll:{x:780}}),E.jsx(Ci,{title:o?"编辑 Webhook":"新增 Webhook",open:a,onOk:$,onCancel:()=>{s(!1),u.resetFields()},width:600,confirmLoading:n,okText:"确定",cancelText:"取消",children:E.jsxs(Sn,{form:u,layout:"horizontal",initialValues:{is_active:!0,is_default:!1},labelCol:{flex:"0 0 80px"},style:{paddingTop:16},children:[E.jsx(Sn.Item,{label:"名称",name:"name",rules:[{required:!0,message:"请输入名称"}],children:E.jsx(zr,{placeholder:"请输入 Webhook 名称"})}),E.jsx(Sn.Item,{label:"描述",name:"description",children:E.jsx(zr.TextArea,{rows:2,placeholder:"请输入描述(可选)"})}),E.jsx(Sn.Item,{label:"平台",name:"platform",rules:[{required:!0,message:"请选择平台"}],children:E.jsx(on,{options:w,placeholder:"请选择平台",onChange:D=>h(D)})}),E.jsx(Sn.Item,{label:"URL",name:"webhook_url",rules:[{required:!0,message:"请输入 Webhook URL"},{type:"url",message:"请输入有效的 URL"}],children:E.jsx(zr,{placeholder:"https://...",autoComplete:"off"})}),d!=="wecom"&&E.jsx(Sn.Item,{label:"签名密钥",name:"secret",rules:[{required:d==="dingtalk"||d==="feishu",message:"请输入签名密钥"}],children:E.jsx(zr.Password,{placeholder:"请输入签名密钥",autoComplete:"new-password"})}),E.jsx(Sn.Item,{label:"通知时段",name:"notify_time",children:E.jsx(wu.RangePicker,{format:"HH:mm",placeholder:["开始时间","结束时间"],style:{width:"100%"}})}),E.jsx(Sn.Item,{label:"启用",name:"is_active",valuePropName:"checked",children:E.jsx(Lc,{})}),E.jsx(Sn.Item,{label:"设为默认",name:"is_default",valuePropName:"checked",children:E.jsx(Lc,{})})]})}),E.jsx(krn,{open:v,onClose:()=>{y(!1),b(null)},onSuccess:M,editingSchedule:x,webhooks:t})]})},{RangePicker:thi}=nl;function Nrn({open:e,loading:t,playbooks:r,activePlaybookId:n,onClose:i,onPlaybookClick:a,onPlaybookDelete:s}){return E.jsx(t3,{title:"工具箱",placement:"right",size:"min(440px, 100vw)",open:e,loading:t,onClose:i,getContainer:!1,rootClassName:"wandox-toolbox-drawer",styles:{body:{padding:0,overflow:"hidden"}},children:E.jsx(Trn,{playbooks:r,onPlaybookClick:a,onPlaybookDelete:s,activePlaybookId:n})})}const Lrn=["智能体对话(不限Token)","默认场景全功能","巡检机器人定时任务"],Mrn=["智能体对话","非 ASIN 查询场景","巡检机器人定时任务"];function v9(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function yy(e){return e==null?!1:typeof e=="string"?e.trim().length>0:!0}function Prn(e){if(Array.isArray(e)){if(e.length===0)return null;const t=e.find(r=>v9(r)?Object.keys(r).length>0:yy(r));return v9(t)?t:yy(t)?{value:t}:null}return v9(e)?Object.keys(e).length>0?e:null:yy(e)?{value:e}:null}function cg(e,t,r=0){if(e){for(const n of t){const i=e[n];if(yy(i))return i}if(!(r>=2))for(const n of Object.values(e)){if(v9(n)){const i=cg(n,t,r+1);if(yy(i))return i}if(Array.isArray(n))for(const i of n){if(!v9(i))continue;const a=cg(i,t,r+1);if(yy(a))return a}}}}function aQ(e){if(yy(e))return String(e).trim()}function S5(e){const t=aQ(e);if(!t)return;const r=t.match(/^(\d{4}-\d{2}-\d{2})/);return(r==null?void 0:r[1])||t}function LCe(e){if(!yy(e))return;if(typeof e=="number"&&Number.isFinite(e))return new Intl.NumberFormat("en-US").format(e);const t=String(e).trim(),r=t.replace(/,/g,""),n=Number(r);return r&&Number.isFinite(n)?new Intl.NumberFormat("en-US").format(n):t}function qmt(e,t){if(!yy(e))return t;const r=String(e).trim();return["infinite","unlimited","∞"].includes(r.toLowerCase())?"∞ 无限":LCe(e)||t}function Drn(e){const t=aQ(e==null?void 0:e.package_name);if(!(!t||t==="无限算力年卡"))return t}function Orn(e){const t=aQ(cg(e,["asin_usage","asin_usage_text","asin_used_display","usage_text"]));if(t)return t;const r=LCe(cg(e,["used_asin","asin_used","used_asin_count","asin_used_count","asin_used_num","asin_num_by_use","used_count","used_num","used","consumed_asin","query_used_count"])),n=LCe(cg(e,["total_asin","asin_total","total_asin_count","asin_total_count","asin_limit","asin_quota","asin_num","total_count","total_num","limit","quota","total"]));if(!(!r&&!n))return`${r||"-"} / ${n||"-"}`}function Brn(e){const t=cg(e,["used_asin","asin_used","used_asin_count","asin_used_count","asin_used_num","asin_num_by_use","used_count","used_num","used","consumed_asin","query_used_count"]),r=cg(e,["total_asin","asin_total","total_asin_count","asin_total_count","asin_limit","asin_quota","asin_num","total_count","total_num","limit","quota","total"]),n=Number(String(t??"").replace(/,/g,"")),i=Number(String(r??"").replace(/,/g,""));if(!(!Number.isFinite(n)||!Number.isFinite(i)||i<=0))return Math.min(Math.round(n/i*100),100)}function MCe(e){var r,n,i,a,s,o,l;if(!e)return null;const t=Prn(e.competitive_asin_info);return t?{kind:"competitiveAsin",badgeText:"包年权益",packageName:aQ(cg(t,["package_name","packageName","plan_name","benefit_name","name","title","package_type"]))||Drn(e.package_info)||"竞品智能体包年权益",subtitle:"竞品智能体专属权益",remainingLabel:"剩余算力(非ASIN查询):",remainingValue:qmt(cg(t,["token_num","tokenNum","remaining_token","token_remaining","remaining_power","power_remaining"])??((r=e.package_info)==null?void 0:r.token_num),"∞ 无限"),asinUsage:Orn(t),asinUsagePercent:Brn(t),endTime:S5(cg(t,["end_time","endTime","expire_time","expired_at","expires_at","end_date","package_end_time"]))||S5((n=e.package_info)==null?void 0:n.end_time)||"-",startTime:S5(cg(t,["start_time","startTime","open_time","opened_at","started_at","start_date","package_start_time"]))||S5((i=e.package_info)==null?void 0:i.start_time)||"-",coverageTitle:"无限算力覆盖范围",coverageItems:Mrn}:e.is_free?{kind:"free",badgeText:"无限算力",packageName:((a=e.package_info)==null?void 0:a.package_name)||"无限算力年卡",subtitle:"亚马逊智能体专属权益",remainingLabel:"剩余算力:",remainingValue:qmt((s=e.package_info)==null?void 0:s.token_num,"∞ 无限"),endTime:S5((o=e.package_info)==null?void 0:o.end_time)||"2027-03-18",startTime:S5((l=e.package_info)==null?void 0:l.start_time)||"2026-03-18",coverageTitle:"无限算力覆盖范围",coverageItems:Lrn}:null}const Frn=[{label:"钉钉",value:"dingtalk"},{label:"飞书",value:"feishu"},{label:"企业微信",value:"wecom"}];function Ymt({open:e,onClose:t,onSuccess:r}){const{t:n}=fm(),[i]=Sn.useForm(),[a,s]=C.useState(!1),[o,l]=C.useState(),u=async()=>{try{const h=await i.validateFields();s(!0);const f={name:h.name,platform:h.platform,webhook_url:h.webhook_url,secret:h.secret||void 0},p=await lZe({},f);p!=null&&p.data?($t.success(n("webhook.createSuccess")),r({webhook_id:p.data.webhook_id||p.data.id,name:h.name,platform:h.platform}),i.resetFields(),t()):$t.error(n("webhook.createFailed"))}catch(h){h instanceof Error&&$t.error(h.message||n("webhook.createFailed"))}finally{s(!1)}},d=()=>{i.resetFields(),l(void 0),t()};return E.jsx(Ci,{title:n("webhook.quickAdd"),open:e,onOk:u,onCancel:d,confirmLoading:a,width:480,destroyOnHidden:!0,zIndex:1e4,children:E.jsxs(Sn,{form:i,layout:"vertical",preserve:!1,children:[E.jsx(Sn.Item,{label:n("webhook.name"),name:"name",rules:[{required:!0,message:n("webhook.nameRequired")}],children:E.jsx(zr,{placeholder:n("webhook.namePlaceholder")})}),E.jsx(Sn.Item,{label:n("webhook.platform"),name:"platform",rules:[{required:!0,message:n("webhook.platformRequired")}],children:E.jsx(on,{options:Frn,placeholder:n("webhook.platformPlaceholder"),onChange:h=>l(h)})}),E.jsx(Sn.Item,{label:"Webhook URL",name:"webhook_url",rules:[{required:!0,message:n("webhook.urlRequired")},{type:"url",message:n("webhook.urlInvalid")}],children:E.jsx(zr,{placeholder:"https://...",autoComplete:"off"})}),o!=="wecom"&&E.jsx(Sn.Item,{label:n("webhook.secret"),name:"secret",rules:[{required:o==="dingtalk"||o==="feishu",message:n("webhook.secretRequired")}],children:E.jsx(zr.Password,{placeholder:n("webhook.secretPlaceholder"),autoComplete:"new-password"})})]})})}const zrn="https://ai.maiduox.com/#/aitools/operation/product";function jrn(e){const{title:t,widgets:r,ssoDomain:n,ssoToken:i,ssoCompany:a,onExecuteComplete:s,activeAgent:o,agents:l,childAgents:u,externalRobotName:d,externalShowPanel:h,agentSwitcher:f}=e;e.onWidgetsUpdate,e.count,fm();const[p,g]=C.useState(!1),[m,v]=C.useState(!1),[y,x]=C.useState(null),[b,w]=C.useState(null),[S,_]=C.useState("results"),[T,k]=C.useState(!1),[A,$]=C.useState([]),[I,M]=C.useState(null),[L,R]=C.useState({}),[N,P]=C.useState([]),[D,O]=C.useState(!1),[B,F]=C.useState(null),[j,V]=C.useState(void 0),[H,W]=C.useState(!1),[U,q]=C.useState(!1),Y=C.useMemo(()=>(u||[]).map(pe=>pe.name),[u]),X=C.useMemo(()=>!o||o==="default"?null:(l==null?void 0:l.find(de=>de.agent_id===o||de.agent_code===o))||null,[o,l]),Q=C.useMemo(()=>MCe(X),[X]);C.useEffect(()=>{w(null)},[o]),C.useEffect(()=>{J(),u&&u.length>0&&K()},[u]),C.useEffect(()=>{if(h&&(g(!0),d)){const pe=Y.find(de=>de===d);pe?w(pe):Y.length>0}},[h,d,Y]);const J=async()=>{try{const pe=await pq({});pe!=null&&pe.data&&P(pe.data.map(de=>({webhook_id:de.webhook_id,name:de.name,platform:de.platform})))}catch{}},K=async()=>{try{const pe={};await Promise.all(u.map(async de=>{var ge;try{const ye=await nkr(de.agent_id,{});(ge=ye==null?void 0:ye.data)!=null&&ge.webhook_id&&(pe[de.agent_id]=ye.data.webhook_id)}catch{}})),R(pe)}catch{}},Z=C.useMemo(()=>b?r.filter(pe=>{var ye;const de=(ye=pe.title)==null?void 0:ye.match(/^(.+?)\s*巡检结果$/);return(de?de[1]:pe.agent_name)===b}):r,[r,b]),ee=C.useMemo(()=>{if(!b)return"";const pe=(u||[]).find(de=>de.name===b);return(pe==null?void 0:pe.agent_id)||""},[b,u]),te=n==="maiduo"&&b==="差评监控",ae=pe=>{const de=b===pe?null:pe;w(de),de&&g(!0)},le=pe=>{F(pe),V(L[pe.agent_id]),O(!0)},oe=C.useCallback(async pe=>{if(pe){k(!0);try{const de=await jEr({agent_id:pe,limit:50});if(de!=null&&de.data&&Array.isArray(de.data)){const ge=de.data.map((ye,ie)=>({id:ye.id||ye.execute_id||`record_${ie}`,action_name:ye.action_name||ye.display_name||"未知动作",action_id:ye.action_id||"",status:ye.status||"pending",created_at:ye.created_at||"",completed_at:ye.completed_at,action_params:ye.action_params,output_type:ye.output_type,output_data:ye.output_data,outputs:ye.outputs,error:ye.error})).sort((ye,ie)=>new Date(ie.created_at).getTime()-new Date(ye.created_at).getTime());$(ge)}else $([])}catch{$([])}finally{k(!1)}}},[]),re=pe=>{if(!pe)return"";try{const de=new Date(pe),ge=de.toLocaleDateString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}),ye=de.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"});return`${ge} ${ye}`}catch{return pe}},se=pe=>({pending:"等待中",running:"执行中",success:"成功",failed:"失败"})[pe]||pe,ve=pe=>({pending:"wandox-exec-status--pending",running:"wandox-exec-status--running",success:"wandox-exec-status--success",failed:"wandox-exec-status--failed"})[pe]||"";C.useEffect(()=>{S==="history"&&ee&&oe(ee)},[S,ee,oe]);const he=async()=>{if(!B||!j){$t.warning("请选择 Webhook");return}try{W(!0),await rkr({},{agent_id:B.agent_id,webhook_id:j}),$t.success("绑定成功"),O(!1),K()}catch(pe){$t.error((pe==null?void 0:pe.message)||"绑定失败")}finally{W(!1)}},Re=async()=>{if(B)try{W(!0),await ikr(B.agent_id,{}),$t.success("解绑成功"),O(!1),V(void 0),K()}catch(pe){$t.error((pe==null?void 0:pe.message)||"解绑失败")}finally{W(!1)}},Ce=pe=>{x(pe),v(!0)},Le=()=>{v(!1),x(null)},Pe=pe=>{if(!pe)return"";try{const de=new Date(pe),ge=de.toLocaleDateString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}),ye=de.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"});return`${ge}
769
769
  ${ye}`}catch{return pe}},be=(pe,de)=>{const ge={high:"#ff4d4f",medium:"#faad14",low:"#52c41a"};return E.jsxs("div",{className:"wandox-timeline-item",children:[E.jsxs("div",{className:"wandox-timeline-dot-wrapper",children:[E.jsx("span",{className:"wandox-timeline-time",style:{whiteSpace:"pre-line"},children:Pe(pe.timestamp||"")}),E.jsx("div",{className:"wandox-timeline-dot",style:{background:ge[pe.priority]}}),!de&&E.jsx("div",{className:"wandox-timeline-line"})]}),E.jsxs("div",{className:"wandox-widget-card",children:[E.jsx("div",{className:"wandox-widget-title",children:pe.title}),pe.ui_payload&&E.jsx("div",{className:"wandox-widget-content wandox-markdown-content",children:E.jsx(js,{payload:pe.ui_payload})}),pe.actions&&pe.actions.length>0&&E.jsx("div",{className:"wandox-widget-actions",children:E.jsxs("button",{type:"button",className:"wandox-widget-view-detail-btn",onClick:()=>Ce(pe),children:[E.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img",children:[E.jsx("title",{children:"快速执行"}),E.jsx("path",{d:"M13 2L3 14H12L11 22L21 10H12L13 2Z",fill:"currentColor"})]}),"快速执行 (",pe.actions.length,")"]})})]})]},pe.id||`${pe.type}_${pe.title}_${pe.timestamp}`)};return E.jsxs("div",{className:"wandox-widget-section",children:[E.jsxs("div",{className:"wandox-section-header",children:[E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[f??E.jsx("span",{className:"wandox-widget-section-title",children:t}),Q&&E.jsx(B4,{title:E.jsx("div",{style:{paddingBottom:"8px",borderBottom:"1px solid #f0f0f0"},children:E.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px"},children:[E.jsxs("div",{children:[E.jsx("strong",{children:Q.packageName}),E.jsx("div",{style:{color:"#999",fontSize:"11px",fontWeight:400},children:Q.subtitle})]}),E.jsx(iS,{count:"生效中",style:{backgroundColor:"#52c41a",fontSize:"10px",lineHeight:"18px",height:"18px",minWidth:"50px"}})]})}),content:E.jsxs("div",{style:{fontSize:"12px",lineHeight:"1.6",minWidth:"280px"},children:[E.jsxs("div",{style:{marginBottom:"8px",display:"flex",justifyContent:"space-between"},children:[E.jsx("div",{style:{color:"#999"},children:"套餐类型:"}),E.jsx("strong",{children:Q.packageName})]}),Q.asinUsage&&E.jsxs("div",{style:{marginBottom:Q.asinUsagePercent!=null?"4px":"8px",display:"flex",justifyContent:"space-between",gap:"16px"},children:[E.jsx("div",{style:{color:"#999"},children:"ASIN 已用:"}),E.jsx("strong",{style:{color:"#9444f5"},children:Q.asinUsage})]}),Q.asinUsagePercent!=null&&E.jsx("div",{style:{marginBottom:"8px"},children:E.jsx("div",{style:{height:"6px",borderRadius:"3px",background:"#f0eaff",overflow:"hidden"},children:E.jsx("div",{style:{height:"100%",width:`${Q.asinUsagePercent}%`,borderRadius:"3px",background:"linear-gradient(90deg, #9444f5, #b47aff)",transition:"width 0.3s ease"}})})}),E.jsxs("div",{style:{marginBottom:"8px",display:"flex",justifyContent:"space-between"},children:[E.jsx("div",{style:{color:"#999"},children:Q.remainingLabel}),E.jsx("strong",{style:{color:"#9444f5",fontWeight:"bold"},children:Q.remainingValue})]}),E.jsxs("div",{style:{marginBottom:"8px",display:"flex",justifyContent:"space-between"},children:[E.jsx("div",{style:{color:"#999"},children:"到期时间:"}),E.jsx("strong",{children:Q.endTime})]}),E.jsxs("div",{style:{marginBottom:"8px",display:"flex",justifyContent:"space-between"},children:[E.jsx("div",{style:{color:"#999"},children:"开通时间:"}),E.jsx("strong",{children:Q.startTime})]}),E.jsxs("div",{style:{padding:"8px 12px",background:"#faf8ff",borderRadius:"8px"},children:[E.jsx("div",{style:{marginBottom:"4px",color:"#9444f5",fontSize:"13px",fontWeight:"bold"},children:Q.coverageTitle}),E.jsx("div",{style:{fontSize:"11px",color:"#666",lineHeight:"2"},children:Q.coverageItems.map(pe=>E.jsxs("div",{children:[E.jsx(Av,{style:{marginRight:"6px",color:"#9444f5"}}),pe]},pe))})]})]}),placement:"bottom",trigger:"hover",children:E.jsx(iS,{count:Q.badgeText,style:{backgroundColor:"#9444f5",cursor:"pointer"}})})]}),E.jsx("div",{className:"wandox-inspection-controls",children:E.jsxs("button",{type:"button",className:`wandox-inspection-agent-btn ${p?"wandox-inspection-agent-btn--expanded":""}`,onClick:()=>{p?(g(!1),w(null)):g(!0)},children:[E.jsxs("span",{className:"wandox-inspection-agent-icon",children:[E.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[E.jsx("circle",{cx:"12",cy:"12",r:"4",stroke:"currentColor",strokeWidth:"1.5"}),E.jsx("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor"})]}),E.jsx("span",{className:"wandox-orbit-dot wandox-orbit-dot-1"}),E.jsx("span",{className:"wandox-orbit-dot wandox-orbit-dot-2"}),E.jsx("span",{className:"wandox-orbit-dot wandox-orbit-dot-3"})]}),E.jsxs("span",{className:"wandox-inspection-agent-text",children:["巡检机器人(",Y.length,")"]})]})})]}),p&&E.jsxs("div",{className:"wandox-timeline-list",children:[E.jsxs("div",{className:"wandox-agent-filter-row wandox-agent-filter-row--with-close",children:[E.jsxs("div",{className:"wandox-agent-filter-chips",children:[u.length>0&&E.jsx("button",{type:"button",className:`wandox-agent-filter-chip ${b===null?"active":""}`,onClick:()=>w(null),children:"全部"}),u.map(pe=>{const de=!!L[pe.agent_id];return E.jsxs("div",{className:`wandox-agent-filter-chip-compound ${b===pe.name?"active":""}`,children:[E.jsx("button",{type:"button",className:"wandox-agent-filter-chip-name",onClick:()=>ae(pe.name),children:pe.name}),E.jsx("button",{type:"button",className:`wandox-agent-filter-chip-webhook ${de?"bound":""}`,onClick:()=>le(pe),title:de?"已绑定 Webhook,点击修改":"绑定 Webhook 通知",children:de?E.jsxs(E.Fragment,{children:[E.jsx("span",{className:"wandox-webhook-dot","aria-hidden":"true"}),E.jsx("span",{className:"wandox-webhook-label",children:"已通知"})]}):E.jsxs(E.Fragment,{children:[E.jsx("span",{className:"wandox-webhook-plus","aria-hidden":"true",children:"+"}),E.jsx("span",{className:"wandox-webhook-label",children:"通知"})]})})]},pe.agent_id)})]}),E.jsx("button",{type:"button",className:"wandox-timeline-list-close",onClick:()=>{g(!1),w(null),_("results")},title:"关闭",children:"✕"})]}),te&&E.jsxs("div",{className:"wandox-negative-review-notice",children:[E.jsx("span",{className:"wandox-negative-review-notice-icon","aria-hidden":"true",children:"ℹ️"}),E.jsxs("span",{children:["差评监控需要先设置需要监控的ASIN,请前往AI工具》",E.jsx("a",{href:zrn,target:"_blank",rel:"noreferrer",className:"wandox-negative-review-notice-link",children:"新老诊断"}),"进行设置。每个asin每一次都需要0.01算力。"]})]}),E.jsx("div",{className:"wandox-timeline-tabs-header",children:E.jsxs("div",{className:"wandox-timeline-tabs-nav",children:[E.jsxs("button",{type:"button",className:`wandox-timeline-tab-btn ${S==="results"?"active":""}`,onClick:()=>_("results"),children:["巡检结果",Z.length>0&&E.jsx("span",{className:"wandox-timeline-tab-badge",children:Z.length})]}),E.jsx("button",{type:"button",className:`wandox-timeline-tab-btn ${S==="history"?"active":""}`,onClick:()=>_("history"),children:"执行记录"})]})}),S==="results"?E.jsx("div",{className:"wandox-timeline-list-content",children:Z.length>0?Z.sort((pe,de)=>{const ge=pe.timestamp?new Date(pe.timestamp).getTime():0;return(de.timestamp?new Date(de.timestamp).getTime():0)-ge}).map((pe,de,ge)=>be(pe,de===ge.length-1)):E.jsxs("div",{className:"wandox-empty-state",children:[E.jsx("div",{className:"wandox-empty-icon",children:"�"}),E.jsx("div",{className:"wandox-empty-text",children:b?"没有符合筛选条件的数据":"暂无工作区数据"}),E.jsx("div",{className:"wandox-empty-desc",children:b?"请调整筛选条件":"工作区数据将在这里显示"})]})}):E.jsx("div",{className:"wandox-timeline-list-content wandox-history-panel",children:b?T?E.jsxs("div",{className:"wandox-loading-state",children:[E.jsx("span",{className:"wandox-spinner wandox-spinner--small"}),E.jsx("span",{children:"加载中..."})]}):A.length===0?E.jsx("div",{className:"wandox-empty-state",children:E.jsx("div",{className:"wandox-empty-text",children:"暂无执行记录"})}):E.jsx("div",{className:"wandox-exec-history-list",children:A.map(pe=>E.jsxs("div",{className:"wandox-exec-history-item",children:[E.jsxs("div",{className:"wandox-exec-history-header",onClick:()=>M(I===pe.id?null:pe.id),onKeyDown:de=>de.key==="Enter"&&M(I===pe.id?null:pe.id),role:"button",tabIndex:0,children:[E.jsxs("div",{className:"wandox-exec-history-info",children:[E.jsx("span",{className:"wandox-exec-history-name",children:pe.action_name}),E.jsx("span",{className:"wandox-exec-history-time",children:re(pe.created_at)})]}),E.jsxs("div",{className:"wandox-exec-history-status-wrapper",children:[E.jsx("span",{className:`wandox-exec-status ${ve(pe.status)}`,children:se(pe.status)}),E.jsx("span",{className:"wandox-exec-history-arrow","aria-hidden":"true",children:I===pe.id?"▼":"▶"})]})]}),I===pe.id&&E.jsxs("div",{className:"wandox-exec-history-detail",children:[pe.action_params&&Object.keys(pe.action_params).length>0&&E.jsxs("div",{className:"wandox-exec-params",children:[E.jsx("div",{className:"wandox-exec-section-label",children:"执行参数"}),E.jsx("div",{className:"wandox-exec-params-list",children:Object.entries(pe.action_params).map(([de,ge])=>E.jsxs("div",{className:"wandox-exec-param-item",children:[E.jsxs("span",{className:"wandox-exec-param-key",children:[de,":"]}),E.jsx("span",{className:"wandox-exec-param-value",children:typeof ge=="object"?JSON.stringify(ge):String(ge)})]},de))})]}),pe.error?E.jsxs("div",{className:"wandox-exec-error",children:[E.jsx("span",{className:"wandox-exec-error-label",children:"错误信息:"}),E.jsx("span",{className:"wandox-exec-error-msg",children:pe.error})]}):pe.output_type&&pe.output_data?E.jsxs("div",{className:"wandox-exec-outputs",children:[E.jsx("div",{className:"wandox-exec-section-label",children:"执行结果"}),E.jsx(js,{payload:{type:pe.output_type,...pe.output_data}})]}):pe.outputs?E.jsxs("div",{className:"wandox-exec-outputs",children:[E.jsx("div",{className:"wandox-exec-section-label",children:"执行结果"}),E.jsx(js,{payload:pe.outputs})]}):E.jsx("div",{className:"wandox-exec-no-output",children:"暂无输出结果"})]})]},pe.id))}):E.jsxs("div",{className:"wandox-empty-state",children:[E.jsx("div",{className:"wandox-empty-icon",children:"🤖"}),E.jsx("div",{className:"wandox-empty-text",children:"请先选择机器人"}),E.jsx("div",{className:"wandox-empty-desc",children:"在上方选择一个机器人查看执行记录"})]})})]}),E.jsx(omt,{open:m,title:(y==null?void 0:y.title)||"动作详情",actions:(y==null?void 0:y.actions)||[],widgetId:y==null?void 0:y.id,ssoToken:i,ssoDomain:n,ssoCompany:a,onClose:Le,onExecuteComplete:s}),E.jsx(Ci,{title:E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[E.jsxs("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[E.jsx("path",{d:"M12 22C10.8954 22 10 21.1046 10 20V14C10 12.8954 10.8954 12 12 12C13.1046 12 14 12.8954 14 14V20C14 21.1046 13.1046 22 12 22Z"}),E.jsx("path",{d:"M18 16C16.8954 16 16 15.1046 16 14V10C16 8.89543 16.8954 8 18 8C19.1046 8 20 8.89543 20 10V14C20 15.1046 19.1046 16 18 16Z"}),E.jsx("path",{d:"M6 16C4.89543 16 4 15.1046 4 14V10C4 8.89543 4.89543 8 6 8C7.10457 8 8 8.89543 8 10V14C8 15.1046 7.10457 16 6 16Z"}),E.jsx("path",{d:"M10.5 4C10.5 2.61929 11.6193 1.5 13 1.5H13.5C14.8807 1.5 16 2.61929 16 4V6H10.5V4Z"})]}),E.jsx("span",{children:"配置 Webhook 通知"})]}),open:D,onCancel:()=>{O(!1),F(null),V(void 0)},width:520,footer:null,centered:!0,children:E.jsxs("div",{style:{padding:"8px 0"},children:[E.jsxs("div",{style:{marginBottom:"20px",padding:"12px 16px",background:"#f5f7fa",borderRadius:"8px",border:"1px solid #e8eaed"},children:[E.jsx("div",{style:{fontSize:"13px",color:"#666",marginBottom:"4px"},children:"智能体"}),E.jsx("div",{style:{fontSize:"15px",color:"#1a1a1a",fontWeight:500},children:B==null?void 0:B.name})]}),E.jsxs("div",{style:{marginBottom:"20px"},children:[E.jsx("div",{style:{marginBottom:"8px",fontSize:"14px",color:"#333",fontWeight:500},children:"选择 通知地址"}),E.jsx(on,{style:{width:"100%"},size:"large",placeholder:"请选择 通知地址",value:j,onChange:V,options:N.map(pe=>({label:`${pe.name} (${pe.platform==="dingtalk"?"钉钉":pe.platform==="feishu"?"飞书":"企业微信"})`,value:pe.webhook_id})),disabled:H,popupRender:pe=>E.jsxs(E.Fragment,{children:[pe,E.jsx(Ffe,{style:{margin:"8px 0"}}),E.jsx(il,{style:{padding:"0 8px 4px"},children:E.jsx(ur,{type:"text",icon:E.jsx("span",{children:"+"}),onClick:()=>q(!0),children:"添加新的通知地址"})})]})}),N.length===0&&E.jsxs("div",{style:{marginTop:"8px",padding:"8px 12px",background:"#fff7e6",border:"1px solid #ffd591",borderRadius:"4px",fontSize:"13px",color:"#d46b08",display:"flex",alignItems:"center",gap:"6px"},children:[E.jsx("span",{children:"⚠️"}),E.jsx("span",{children:'暂无可用的 通知地址,请先在"通知配置"中创建'})]})]}),E.jsxs("div",{style:{padding:"12px 16px",background:"#f0f9ff",borderRadius:"8px",border:"1px solid #bae7ff",marginBottom:"20px"},children:[E.jsx("div",{style:{fontSize:"13px",color:"#0958d9",fontWeight:500,marginBottom:"8px"},children:"💡 功能说明"}),E.jsxs("div",{style:{fontSize:"13px",color:"#096dd9",lineHeight:"1.8"},children:[E.jsx("div",{children:"• 绑定后,该智能体执行完成时会自动发送通知"}),E.jsx("div",{children:"• 通知内容包含执行结果和相关信息"}),E.jsx("div",{children:"• 可随时修改或解除绑定"})]})]}),E.jsxs("div",{style:{display:"flex",gap:"12px",justifyContent:"flex-end"},children:[L[(B==null?void 0:B.agent_id)||""]&&E.jsx("button",{type:"button",onClick:Re,disabled:H,style:{marginRight:"auto",padding:"8px 20px",border:"1px solid #ff4d4f",borderRadius:"6px",background:"#fff",color:"#ff4d4f",cursor:H?"not-allowed":"pointer",fontSize:"14px",fontWeight:500,transition:"all 0.2s",opacity:H?.6:1},onMouseEnter:pe=>{H||(pe.currentTarget.style.background="#fff1f0")},onMouseLeave:pe=>{pe.currentTarget.style.background="#fff"},children:"解除绑定"}),E.jsx("button",{type:"button",onClick:()=>{O(!1),F(null),V(void 0)},disabled:H,style:{padding:"8px 24px",border:"1px solid #d9d9d9",borderRadius:"6px",background:"#fff",color:"#333",cursor:H?"not-allowed":"pointer",fontSize:"14px",fontWeight:500,transition:"all 0.2s",opacity:H?.6:1},onMouseEnter:pe=>{H||(pe.currentTarget.style.background="#fafafa")},onMouseLeave:pe=>{pe.currentTarget.style.background="#fff"},children:"取消"}),E.jsx("button",{type:"button",onClick:he,disabled:H||!j,style:{padding:"8px 24px",border:"none",borderRadius:"6px",background:H||!j?"#d9d9d9":"#1890ff",color:"#fff",cursor:H||!j?"not-allowed":"pointer",fontSize:"14px",fontWeight:500,transition:"all 0.2s"},onMouseEnter:pe=>{!H&&j&&(pe.currentTarget.style.background="#40a9ff")},onMouseLeave:pe=>{!H&&j&&(pe.currentTarget.style.background="#1890ff")},children:H?"保存中...":"保存"})]})]})}),E.jsx(Ymt,{open:U,onClose:()=>q(!1),onSuccess:pe=>{P(de=>[...de,pe]),V(pe.webhook_id)}})]})}function N_(e,t){return e.role!=="assistant"?!1:t.message_id&&e.message_id?e.message_id===t.message_id:e.id===t.id}function Kmt(e){return e.role!=="user"?!1:!!(e.outputs||e.ui_payload||e.actions&&e.actions.length>0)&&/^\s*⏳\s*Step\d+/i.test(e.content||"")}const Xmt=new Set(["completed","failed","stopped"]),Vrn=new Set(["thinking","recommend"]),sQ={running:0,completed:1,failed:2,stopped:3};function PCe(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function DCe(e){const t=typeof e=="number"?e:Number(e);return Number.isFinite(t)&&t>=0?t:void 0}function Hrn(e){const t=String(e||"").toLowerCase();return t==="running"||t==="failed"||t==="stopped"?t:"completed"}function Zmt(e,t){if(!PCe(e))return;const r=typeof e.type=="string"&&e.type.trim()?e.type.trim():void 0;if(!r)return;const n=DCe(e.sequence),i=PCe(e.data)?e.data:{};return{...typeof e.event_id=="string"&&e.event_id?{event_id:e.event_id}:{},type:r,sequence:n===void 0?t:n,...typeof e.timestamp=="string"&&e.timestamp?{timestamp:e.timestamp}:{},...typeof e.execution_id=="string"&&e.execution_id?{execution_id:e.execution_id}:{},...typeof e.execution_type=="string"&&e.execution_type?{execution_type:e.execution_type}:{},...typeof e.source=="string"&&e.source?{source:e.source}:{},data:i}}function C5(e){return e==null?"":String(e).trim()}function Wrn(e,t){const r=C5(e.data.task_id),n=C5(t.data.task_id);if(r&&n)return r===n;const i=C5(e.data.step_index),a=C5(t.data.step_index);if(i&&a)return i===a;const s=C5(e.data.step_name||e.data.title),o=C5(t.data.step_name||t.data.title);return!!(s&&o&&s===o)}function Qmt(e){return e.reduce((t,r)=>{if(r.type!=="output")return t.push(r),t;let n=-1;for(let a=t.length-1;a>=0;a-=1)if(t[a].type==="step"&&Wrn(r,t[a])){n=a;break}if(n<0)return t.push(r),t;const i=t[n];return t[n]={...i,...r,event_id:i.event_id||r.event_id,type:"step",sequence:i.sequence,data:{...i.data,...r.data}},t},[])}function OCe(e){if(!PCe(e))return;const t=Qmt((Array.isArray(e.events)?e.events:[]).map((s,o)=>Zmt(s,o+1)).filter(s=>!!s).sort((s,o)=>s.sequence-o.sequence)),r=Hrn(e.status),n=e.duration_ms===null?null:DCe(e.duration_ms),i=typeof e.started_at=="string"&&e.started_at.trim().length>0;if(t.length===0&&r!=="running"&&n==null&&!i)return;const a=DCe(e.total);return{status:r,...e.origin==="live"||e.origin==="history"?{origin:e.origin}:{},duration_ms:n,total:a===void 0?t.length:a,truncated:e.truncated===!0,events:t,...i?{started_at:e.started_at}:{}}}function BCe(e=new Date().toISOString()){return{status:"running",origin:"live",duration_ms:0,total:0,truncated:!1,events:[],started_at:e}}function FCe(e,t,r=Date.now()){const n=OCe(e.process)??BCe(e.timestamp||new Date(r).toISOString());if(Xmt.has(n.status))return e;const i=n.events.reduce((d,h)=>Math.max(d,h.sequence),0)+1,a=Zmt({...t,sequence:t.sequence??i,timestamp:t.timestamp||new Date(r).toISOString()},i);if(!a)return e;let s=[...n.events];const o=a.event_id?s.findIndex(d=>d.event_id===a.event_id):-1;o>=0?s[o]={...s[o],...a,sequence:s[o].sequence}:(s.push(a),s.sort((d,h)=>d.sequence-h.sequence)),s=Qmt(s);const l=Date.parse(n.started_at||e.timestamp),u=Number.isFinite(l)?Math.max(n.duration_ms||0,r-l):n.duration_ms;return{...e,process:{...n,status:"running",duration_ms:u,total:s.length,events:s}}}function oQ(e,t,r=Date.now()){const n=OCe(e.process);if(!n||Xmt.has(n.status)&&sQ[n.status]>=sQ[t])return e;const i=n.events.filter(u=>!Vrn.has(u.type)),a=Date.parse(n.started_at||e.timestamp),s=Number.isFinite(a)?Math.max(0,r-a):void 0,o=n.duration_ms==null?s:s===void 0?n.duration_ms:Math.max(n.duration_ms,s),l=sQ[n.status]>sQ[t]?n.status:t;return{...e,process:{...n,status:l,duration_ms:o,total:i.length,events:i}}}function zCe(e,t){return{...e,content:"",ui_payload:{type:"markdown",content:t,streaming:!0},stream_content_received:!0}}function jCe(e,t){var n;const r={message_id:t.messageId||e.message_id,execution_id:t.executionId??e.execution_id,actions:(n=t.actions)!=null&&n.length?t.actions:void 0,execution_status:"completed"};return e.stream_content_received?{...e,...r,content:"",ui_payload:e.ui_payload?{...e.ui_payload,streaming:!1}:e.ui_payload}:{...e,...r,content:t.content||"执行完成",ui_payload:t.payload}}function Grn(e){const t=String(e??"").trim().toLowerCase();return!t||["pending","running","executing","stopping","pending_async","awaiting_async"].includes(t)}function y9(e){if(Array.isArray(e))return e.map(y9);if(!e||typeof e!="object")return e;const t=e,r={...t};return Array.isArray(t.children)&&(r.children=t.children.map(y9)),(t.type==="step"||t.status!==void 0)&&Grn(t.status)&&(r.status="stopped",t.message||(r.message="任务已停止")),r}function b9(e,t,r){var s;const n=t==="stopped"?"stopped":"error",a=((s=e.process)==null?void 0:s.events.some(o=>o.type===n&&o.data.message===r))?e:FCe(e,{type:n,data:{message:r,status:t}});return oQ(a,t)}function Urn(e,t,r){return zCe(e,t)}function Jmt(e,t,r=!1){if(t.task_id)for(let n=e.length-1;n>=0;n-=1){const i=e[n];if(i.type==="step"&&i.task_id===t.task_id)return n}if(t.step_index!==void 0)for(let n=e.length-1;n>=0;n-=1){const i=e[n];if(i.type==="step"&&String(i.step_index)===String(t.step_index))return n}if(r)for(let n=e.length-1;n>=0;n-=1){const i=e[n],a=String(i.status||"").toLowerCase();if(i.type==="step"&&["running","pending","executing"].includes(a))return n}return-1}function qrn(e,t){var i;const r=Array.isArray(e.outputs)?[...e.outputs]:[];if(t.type==="step"){const a=Jmt(r,t);if(a>=0){const s=r[a];r[a]={...s,...t,children:(i=t.children)!=null&&i.length?t.children:s.children||[]}}else r.push({...t,children:t.children||[]});return{...e,outputs:r}}const n=Jmt(r,t);if(n>=0){const a=r[n],s=Array.isArray(a.children)?[...a.children]:[],o=s.findIndex(u=>u.streaming===!0&&(!t.task_id||!u.task_id||u.task_id===t.task_id)),l=t.content===null&&t.is_final===!0;return o>=0?l?s.splice(o,1):s[o]={...t,streaming:!1}:l||s.push(t),r[n]={...a,task_id:a.task_id||t.task_id,status:t.status||"done",children:s},{...e,outputs:r}}return t.content===null&&t.is_final===!0?e:(r.push(t),{...e,outputs:r})}function VCe(e){const{activeAgent:t,ssoToken:r,ssoDomain:n,ssoCompany:i,defaultParams:a,onMessagesUpdate:s,onRecommendationsUpdate:o}=e,[l,u]=C.useState(!1),[d,h]=C.useState(!1),[f,p]=C.useState(null),g=C.useRef(!1),m=C.useRef(null),v=C.useRef(null),y=C.useRef(null),x=C.useRef(null),b=C.useCallback(()=>!r||!n||!i?($t.warning("请先登录 SSO"),!1):!0,[r,n,i]),w=C.useCallback((I,M)=>({id:`msg_${Date.now()}_${Math.random()}`,role:I,content:M,timestamp:new Date().toISOString()}),[]),S=C.useCallback(async I=>{if(!b())return;if(g.current){m.current=I;return}g.current=!0;const{userMsg:M,assistantMsgId:L,assistantMsg:R}=(()=>{var V;const O=Date.now(),B={id:`msg_${O}`,role:"user",content:I.message||"",timestamp:new Date().toISOString(),...(V=I.attachments)!=null&&V.length?{attachments:I.attachments}:{}},F=`msg_${O+1}`,j={id:F,role:"assistant",content:"⏳ 正在思考...",timestamp:new Date().toISOString(),playbook_id:I.playbook_id,execution_status:"executing",process:BCe()};return{userMsg:B,assistantMsgId:F,assistantMsg:j}})(),N=I._hideUserMessage===!0;s(O=>N?[...O,R]:[...O,M,R]),u(!0),x.current={assistantMsgId:L};const P=new AbortController;y.current=P;const D=()=>{var O;return y.current===P&&((O=x.current)==null?void 0:O.assistantMsgId)===L};try{const O={...I,agent_id:t,stream:!0,playbook_params:{...I.playbook_params||{}},message:I.message||"",...a||{}},{_hideUserMessage:B,...F}=O,j=await fetch(`${So()}/api/v1/agents/chat`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`,"X-Tenant-ID":i,"X-Domain":n},body:JSON.stringify(F),signal:P.signal});if(!j.ok)throw new Error(`HTTP ${j.status}`);await KZ(j,{assistantMsgId:L,onMessageId:V=>{if(!D())return;const H=x.current;H&&(H.anchorMessageId=V)},onQueue:V=>{D()&&(p(V),V.status==="waiting"?s(H=>H.map(W=>W.id===L?{...W,content:`⏳ ${V.message}`}:W)):V.status==="ready"&&(p(null),s(H=>H.map(W=>W.id===L?{...W,content:`⏳ ${V.message}`}:W))))},onProgress:V=>{D()&&(p(null),s(H=>H.map(W=>W.id===L?{...W,content:`⏳ ${V}`}:W)))},onProcessEvent:V=>{D()&&s(H=>H.map(W=>W.id===L?FCe(W,V):W))},onContent:V=>{D()&&s(H=>H.map(W=>W.id===L?zCe(W,V):W))},onComplete:(V,H,W,U,q)=>{D()&&s(Y=>Y.map(X=>{var Q,J;return X.id!==L||((Q=X.process)==null?void 0:Q.status)==="failed"||((J=X.process)==null?void 0:J.status)==="stopped"?X:oQ(jCe(X,{content:V,payload:H,actions:W,messageId:U,executionId:q}),"completed")}))},onError:(V,H)=>{D()&&s(W=>{const U=(H==null?void 0:H.cancelled)===!0,q=U?"任务已停止":`❌ ${V}`;return W.map(Y=>Y.id===L?b9({...Y,content:Y.content.startsWith("❌")?Y.content:q,execution_status:U?"stopped":"failed",outputs:U&&Y.outputs?y9(Y.outputs):Y.outputs},U?"stopped":"failed",U?"任务已停止":V):Y)})},onRecommend:V=>{D()&&o(V)},onProposal:V=>{if(!D())return;const H={proposal_id:V.proposal_id,scene:V.scene,message:V.message,options:V.options||[],params:V.params,actions:V.actions};s(W=>W.map(U=>U.id===L?oQ({...U,content:"",proposal:H,execution_status:"completed"},"completed"):U))}})}catch(O){(O==null?void 0:O.name)!=="AbortError"&&D()&&s(B=>B.map(F=>F.id===L?b9({...F,content:`❌ 执行出错: ${O.message||"未知错误"}`,execution_status:"failed"},"failed",O.message||"未知错误"):F))}finally{if(y.current===P&&(y.current=null,x.current=null,g.current=!1,u(!1),h(!1),m.current)){const O=m.current;m.current=null,setTimeout(()=>{var B;return(B=v.current)==null?void 0:B.call(v,O)},0)}}},[t,r,n,i,b,w,s,o]);v.current=S;const _=C.useCallback(()=>{m.current=null,p(null);const I=y.current;y.current=null,x.current=null,g.current=!1,u(!1),h(!1),I&&!I.signal.aborted&&I.abort()},[]),T=C.useCallback(async()=>{const I=y.current,M=x.current;if(!I||!M)return;const L=M.assistantMsgId,R=M.anchorMessageId,N=()=>{var P;return y.current===I&&((P=x.current)==null?void 0:P.assistantMsgId)===L};if(!R){$t.warning("任务编号尚未就绪,请稍后再试");return}if(N()){h(!0),s(P=>P.map(D=>D.id===L?{...D,execution_status:"stopping",content:"正在停止..."}:D));try{const P=await fetch(`${So()}/api/v1/agents/chat/stop`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`,"X-Tenant-ID":i,"X-Domain":n},body:JSON.stringify({message_id:R})});if(!N())return;if(!P.ok)throw new Error(`HTTP ${P.status}`);const D=await P.json().catch(()=>null);if(!N())return;if(D&&D.success===!1)throw new Error(D.message||"停止失败");if(s(O=>O.map(B=>{var F;return B.id===L?b9({...B,message_id:(D==null?void 0:D.stopped_message_id)||((F=D==null?void 0:D.data)==null?void 0:F.stopped_message_id)||B.message_id,execution_status:"stopped",content:"任务已停止",outputs:B.outputs?y9(B.outputs):B.outputs},"stopped","任务已停止"):B})),!N())return;_()}catch(P){if(!N())return;h(!1),s(D=>D.map(O=>O.id===L?{...O,execution_status:"executing"}:O)),$t.error(`停止失败:${P instanceof Error?P.message:"未知错误"}`)}}},[_,s,i,n,r]),k=C.useCallback(async I=>{const M=I.message_id;if(!M||g.current)return;g.current=!0,u(!0);const L=new Date().toISOString();x.current={assistantMsgId:I.id,anchorMessageId:M};const R=new AbortController;y.current=R;const N=()=>{var P;return y.current===R&&((P=x.current)==null?void 0:P.assistantMsgId)===I.id};s(P=>P.map(D=>N_(D,I)?{...D,content:"",outputs:void 0,ui_payload:void 0,actions:void 0,execution_status:"executing",retrigger_status:"executing",retrigger_error:void 0,stream_content_received:void 0,process:BCe(L)}:D));try{const P=await fetch(`${So()}/api/v1/agents/chat/retrigger`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`,"X-Tenant-ID":i,"X-Domain":n},body:JSON.stringify({message_id:M,stream:!0}),signal:R.signal});if(!P.ok){const D=await P.json().catch(()=>null),O=[D==null?void 0:D.message,D==null?void 0:D.detail,D==null?void 0:D.error].find(B=>typeof B=="string"&&B.trim());throw P.status===409?new Error(O||"任务仍在执行,请先停止"):P.status>=500?new Error(O||"服务暂时无法完成请求,请稍后重试"):new Error(O||`请求失败(HTTP ${P.status})`)}await KZ(P,{assistantMsgId:I.id,onMessageId:D=>{if(!N())return;const O=x.current;O&&(O.anchorMessageId=D)},onProgress:D=>{N()&&s(O=>O.map(B=>N_(B,I)?{...B,content:D}:B))},onProcessEvent:D=>{N()&&s(O=>O.map(B=>N_(B,I)?FCe(B,D):B))},onContent:D=>{N()&&s(O=>O.map(B=>N_(B,I)?zCe(B,D):B))},onComplete:(D,O,B,F,j)=>{N()&&s(V=>V.map(H=>{var W,U;return!N_(H,I)||((W=H.process)==null?void 0:W.status)==="failed"||((U=H.process)==null?void 0:U.status)==="stopped"?H:oQ({...jCe(H,{content:D,payload:O,actions:B,messageId:F,executionId:j}),retrigger_status:void 0,retrigger_error:void 0},"completed")}))},onError:(D,O)=>{N()&&s(B=>B.map(F=>{if(!N_(F,I))return F;const j=(O==null?void 0:O.cancelled)===!0;return b9({...F,content:j?"任务已停止":"",execution_status:j?"stopped":"failed",retrigger_status:j?void 0:"failed",retrigger_error:j?void 0:D,outputs:j&&F.outputs?y9(F.outputs):F.outputs},j?"stopped":"failed",j?"任务已停止":D)}))},onRecommend:D=>{N()&&o(D)}})}catch(P){if(N()&&!(P instanceof DOMException&&P.name==="AbortError")){const D=P instanceof Error?P.message:"未知错误";s(O=>O.map(B=>N_(B,I)?{...b9(B,"failed",D),content:"",execution_status:"failed",retrigger_status:"failed",retrigger_error:D}:B))}}finally{y.current===R&&(y.current=null,x.current=null,g.current=!1,u(!1),h(!1))}},[s,o,i,n,r]),A=C.useCallback(async(I,M,L)=>{if(!I.trim()&&(!L||L.length===0)){$t.error("请输入消息");return}await S({message:I||"",playbook_id:M,...L!=null&&L.length?{attachments:L}:{}})},[S]),$=C.useCallback(async I=>{const{proposal_id:M,proposal_action:L,selected_option_id:R,filled_params:N,messageId:P,proposalMessage:D,optionTitle:O}=I;s(j=>j.map(V=>V.id===P?{...V,proposal_status:L==="confirm"?"confirmed":"rejected"}:V));let B="";if(L==="confirm"){const j=[];if(D&&j.push(D),O&&j.push(`${O}确认执行`),N&&Object.keys(N).length>0){const V=Object.entries(N).map(([H,W])=>`${H}: ${Array.isArray(W)?W.join(","):W}`).join(", ");j.push(`参数{${V}}`)}B=j.join(",")}const F={message:B,agent_id:t,stream:!0,proposal_id:M,proposal_action:L,_hideUserMessage:!0,...a||{}};L==="confirm"&&(F.selected_option_id=R,F.filled_params=N||{}),await S(F)},[t,a,S,s]);return{executing:l,stopping:d,executingRef:g,queueStatus:f,sendMessage:A,executePlaybook:S,respondToProposal:$,stopCurrent:T,retrigger:k,abort:_}}function hn(e){return e==null?"":String(e).trim()}function HCe(e,t){const r=hn(e),n=hn(t);return!!(r&&r===n)}function Yf(e,t){const r=hn(t);return r?HCe(e.agent_id,r)||HCe(e.agent_code,r):!1}function lQ(e,t){return e.find(r=>Yf(r,t))}function Vx(e){return hn(e==null?void 0:e.agent_id)||hn(e==null?void 0:e.agent_code)}function e0t(e,t){return HCe(e.playbook_id,t)}function t0t(e){const t=[],r=new Set,n=i=>{if(Array.isArray(i))for(const a of i){const s=hn(a==null?void 0:a.playbook_id);!s||r.has(s)||(r.add(s),t.push(a))}};if(n(e==null?void 0:e.playbooks),Array.isArray(e==null?void 0:e.playbook_groups))for(const i of e.playbook_groups)n(i.playbooks);return t}function Yrn({open:e,onClose:t,ssoToken:r,ssoDomain:n,ssoCompany:i,initialAgentId:a,initialPlaybookId:s,initialPlaybookParams:o,initialMessage:l,triggerOnce:u=!1,enableCustomerService:d=!1,onReady:h}){const[f,p]=C.useState(""),[g,m]=C.useState([]),[v,y]=C.useState([]),[x,b]=C.useState([]),[w,S]=C.useState([]),[_,T]=C.useState(0),[k,A]=C.useState(1),$=pmt,[I,M]=C.useState(!1),[L,R]=C.useState(!1),[N,P]=C.useState(null),[D,O]=C.useState("1x"),[B,F]=C.useState(!1),[j,V]=C.useState(""),[H,W]=C.useState(""),[U,q]=C.useState(null),Y=C.useRef(""),X=C.useMemo(()=>f&&g.find(be=>Yf(be,f))||null,[f,g]),Q=C.useMemo(()=>MCe(X),[X]),J=C.useCallback(be=>{P(()=>be)},[]),{executing:K,sendMessage:Z,executePlaybook:ee,respondToProposal:te,abort:ae}=VCe({activeAgent:f,ssoToken:r,ssoDomain:n,ssoCompany:i,defaultParams:o,onMessagesUpdate:S,onRecommendationsUpdate:b}),le=C.useCallback(()=>{ae(),S([]),A(1),T(0),b([]),W(""),q(null)},[ae]),oe=C.useMemo(()=>JSON.stringify({agentId:hn(a),playbookId:hn(s),playbookParams:o??null,message:l??null}),[a,s,o,l]),re=C.useRef(""),se=C.useCallback(()=>{ae(),R(!1),t()},[ae,t]),ve=C.useCallback(()=>{const be=`https://ecsapi.ecgtool.com/login/sso-login?token=${encodeURIComponent(r)}&menuName=AI智能体`;window.open(be,"_blank","noopener,noreferrer")},[r]);C.useEffect(()=>{e&&Re()},[e]),C.useEffect(()=>{e||(ae(),R(!1))},[e,ae]),C.useEffect(()=>{e&&(re.current&&re.current!==oe&&ae(),re.current=oe)},[e,oe,ae]),C.useEffect(()=>{if(!e||!a||g.length===0)return;const be=lQ(g,a);if(!be){const de=hn(a);Y.current!==de&&($t.error("指定的智能体不存在,已切换到默认智能体"),Y.current=de);const ge=Vx(g[0]);ge&&hn(f)!==ge&&(le(),p(ge));return}if(Y.current="",Yf(be,f))return;const pe=Vx(be);pe&&(le(),p(pe))},[e,a,g,f,le]),C.useEffect(()=>{f&&(V(""),Pe())},[f]),C.useEffect(()=>{F(!1)},[e,a,s,o,l]),C.useEffect(()=>{!e||!f||s||l&&(B||(Z(l),F(!0)))},[e,f,l,s,u,B,Z]);const he=C.useMemo(()=>!!o&&Object.keys(o).length>0,[o]);C.useEffect(()=>{var pe;if(!e||!f||!s||B||a&&!g.some(ge=>Yf(ge,f)&&Yf(ge,a))||!j||j!==f)return;const be=v.find(de=>e0t(de,s));if(!be){$t.error("指定的剧本不存在,已切换到智能体界面"),F(!0);return}if((((pe=be.input_fields)==null?void 0:pe.length)??0)>0&&!he){q(be);const de=(be.input_fields??[]).map(ge=>`${ge.label}: `).join(`
770
770
  `);W(`${be.name},请提供以下参数:
771
771
  ${de}`)}else ee({message:l||be.name||"",playbook_id:s,...o?{playbook_params:o}:{}});F(!0)},[e,f,j,v,a,g,s,o,he,l,B,ee]),C.useEffect(()=>{h&&h({clearMessages:()=>S([]),getMessages:()=>w,abort:ae,showInspectionResults:be=>{}})},[h,w,ae]);const Re=async()=>{M(!0);try{const{data:be}=await hq({page:1,page_size:99}),pe=be||[];if(m(pe),!a){const de=Vx(pe[0]);de&&p(de)}}catch{}M(!1)},Ce=async()=>{S([]),M(!0);try{const{data:be}=await dq({agent_id:f,page:1,page_size:$}),pe=(be==null?void 0:be.items)||[];S([...pe].reverse()),A(1),T((be==null?void 0:be.total)||0)}catch{}finally{M(!1)}},Le=async()=>{if(w.length>=_)return;const be=k+1;M(!0);try{const{data:pe}=await dq({agent_id:f,page:be,page_size:$}),de=(pe==null?void 0:pe.items)||[];if(de.length>0){const ge=[...de].reverse();S(ye=>[...ge,...ye]),A(be),T((pe==null?void 0:pe.total)||0)}}catch(pe){throw pe}finally{M(!1)}},Pe=async()=>{const be=f;M(!0);try{const{data:pe}=await b0e({agent_id:be});y(t0t(pe))}catch{}finally{M(!1),V(be)}};return e?E.jsxs(E.Fragment,{children:[E.jsx("div",{className:"wandox-floating-drawer-mask",onClick:se,onKeyDown:be=>be.key==="Escape"&&se(),role:"button",tabIndex:0,"aria-label":"关闭抽屉"}),E.jsxs("div",{className:`wandox-floating-drawer wandox-floating-drawer-${D}`,children:[E.jsxs("div",{className:"wandox-floating-drawer-header",children:[E.jsxs("div",{className:"wandox-floating-drawer-title-group",children:[E.jsx("div",{className:"wandox-floating-drawer-title",children:(X==null?void 0:X.name)||"AI 助手"}),d&&E.jsxs("button",{type:"button",className:"wandox-floating-drawer-service",onClick:ve,title:"联系客服","aria-label":"联系客服",children:[E.jsx(HCr,{}),E.jsx("span",{children:"人工客服"})]}),Q&&E.jsx(B4,{title:E.jsx("div",{style:{fontWeight:"bold"},children:E.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[E.jsx("span",{children:Q.packageName}),E.jsx(iS,{count:"生效中",style:{backgroundColor:"#52c41a",fontSize:"10px",lineHeight:"18px",height:"18px",minWidth:"50px"}})]})}),content:E.jsxs("div",{style:{fontSize:"12px",lineHeight:"1.6",minWidth:"280px"},children:[E.jsxs("div",{style:{marginBottom:"8px"},children:[E.jsx("strong",{children:"套餐类型:"}),Q.packageName]}),E.jsx("div",{style:{color:"#999",fontSize:"11px",marginTop:"-4px",marginBottom:"8px"},children:Q.subtitle}),Q.asinUsage&&E.jsxs("div",{style:{marginBottom:Q.asinUsagePercent!=null?"4px":"8px"},children:[E.jsx("strong",{children:"ASIN 已用:"}),E.jsx("span",{style:{color:"#9444f5",fontWeight:"bold"},children:Q.asinUsage})]}),Q.asinUsagePercent!=null&&E.jsx("div",{style:{marginBottom:"8px"},children:E.jsx("div",{style:{height:"6px",borderRadius:"3px",background:"#f0eaff",overflow:"hidden"},children:E.jsx("div",{style:{height:"100%",width:`${Q.asinUsagePercent}%`,borderRadius:"3px",background:"linear-gradient(90deg, #9444f5, #b47aff)",transition:"width 0.3s ease"}})})}),E.jsxs("div",{style:{marginBottom:"8px"},children:[E.jsx("strong",{children:Q.remainingLabel}),E.jsx("span",{style:{color:"#52c41a",fontWeight:"bold"},children:Q.remainingValue})]}),E.jsxs("div",{style:{marginBottom:"8px"},children:[E.jsx("strong",{children:"到期时间:"}),Q.endTime]}),E.jsxs("div",{children:[E.jsx("strong",{children:"开通时间:"}),Q.startTime]}),E.jsxs("div",{style:{marginTop:"12px",paddingTop:"8px",borderTop:"1px solid #f0f0f0"},children:[E.jsx("div",{style:{fontSize:"11px",color:"#666",marginBottom:"4px"},children:E.jsxs("strong",{children:[Q.coverageTitle,":"]})}),E.jsx("div",{style:{fontSize:"11px",color:"#666",lineHeight:"1.4"},children:Q.coverageItems.map(be=>E.jsxs("div",{children:["• ",be]},be))})]})]}),placement:"bottomLeft",trigger:"hover",children:E.jsx(iS,{count:Q.badgeText,style:{backgroundColor:"#faad14",fontSize:"10px",lineHeight:"18px",height:"18px",minWidth:"60px",cursor:"pointer"}})})]}),E.jsxs("div",{className:"wandox-floating-drawer-actions",children:[E.jsxs("div",{className:"wandox-floating-drawer-size-group",children:[E.jsx("button",{type:"button",className:`wandox-floating-drawer-size-btn ${D==="1x"?"active":""}`,onClick:()=>O("1x"),title:"1倍大小",children:"1x"}),E.jsx("button",{type:"button",className:`wandox-floating-drawer-size-btn ${D==="2x"?"active":""}`,onClick:()=>O("2x"),title:"2倍大小",children:"2x"}),E.jsx("button",{type:"button",className:`wandox-floating-drawer-size-btn ${D==="fullscreen"?"active":""}`,onClick:()=>O("fullscreen"),title:"全屏",children:E.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",children:[E.jsx("title",{children:"全屏"}),E.jsx("path",{d:"M1.5 1a.5.5 0 0 0-.5.5v4a.5.5 0 0 1-1 0v-4A1.5 1.5 0 0 1 1.5 0h4a.5.5 0 0 1 0 1h-4zM10 .5a.5.5 0 0 1 .5-.5h4A1.5 1.5 0 0 1 16 1.5v4a.5.5 0 0 1-1 0v-4a.5.5 0 0 0-.5-.5h-4a.5.5 0 0 1-.5-.5zM.5 10a.5.5 0 0 1 .5.5v4a.5.5 0 0 0 .5.5h4a.5.5 0 0 1 0 1h-4A1.5 1.5 0 0 1 0 14.5v-4a.5.5 0 0 1 .5-.5zm15 0a.5.5 0 0 1 .5.5v4a1.5 1.5 0 0 1-1.5 1.5h-4a.5.5 0 0 1 0-1h4a.5.5 0 0 0 .5-.5v-4a.5.5 0 0 1 .5-.5z"})]})})]}),E.jsx("button",{type:"button",className:"wandox-floating-drawer-close",onClick:se,"aria-label":"关闭",children:E.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"currentColor",children:[E.jsx("title",{children:"关闭"}),E.jsx("path",{d:"M14 1.41L12.59 0L7 5.59L1.41 0L0 1.41L5.59 7L0 12.59L1.41 14L7 8.41L12.59 14L14 12.59L8.41 7L14 1.41Z"})]})})]})]}),E.jsxs("div",{className:"wandox-floating-drawer-body wandox-root",children:[E.jsx(Smt,{messages:w,playbooks:v,messagesTotal:_,loadMoreMessages:Le,loading:I,executing:K,activeAgent:Vx(X)||f,onExecutePlaybook:ee,onFillPlaybookParams:be=>{var ye;const pe={playbook_id:be.playbookId,name:be.playbookName,input_fields:be.inputFields};q(pe);const de=((ye=be.inputFields)==null?void 0:ye.map(ie=>`${ie.label}: `).join(`