@co0ontty/wand 4.90.2 → 4.91.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/agent-dispatch.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/conversation-service.d.ts +4 -1
- package/dist/conversation-service.js +35 -6
- package/dist/employee-text.js +3 -3
- package/dist/pi-auto-resources.js +1 -1
- package/dist/pi-cli-runtime.d.ts +8 -0
- package/dist/pi-cli-runtime.js +105 -0
- package/dist/pi-extension-resources.d.ts +3 -2
- package/dist/pi-extension-resources.js +6 -20
- package/dist/pi-openrouter-free-bridge.d.ts +1 -1
- package/dist/pi-openrouter-free-bridge.js +7 -3
- package/dist/pi-resource-bridge.d.ts +1 -1
- package/dist/pi-resource-bridge.js +17 -3
- package/dist/pi-resource-catalog.d.ts +3 -3
- package/dist/pi-resource-catalog.js +13 -28
- package/dist/pi-resource-run.js +1 -1
- package/dist/pi-user-resources.d.ts +5 -0
- package/dist/pi-user-resources.js +37 -0
- package/dist/server-session-context.js +6 -4
- package/dist/server-session-lifecycle-routes.js +5 -3
- package/dist/server-workspace-routes.js +1 -0
- package/dist/server.js +3 -9
- package/dist/storage/conversations-repository.d.ts +4 -1
- package/dist/storage/conversations-repository.js +40 -0
- package/dist/structured-session-manager.d.ts +1 -1
- package/dist/structured-session-manager.js +11 -8
- package/dist/web-ui/content/module-manifest.json +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/chat-render-OGSERP3P.js → d70a22b9c0aa5244/chat-render-QXOBJZYF.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/chunk-DJAVXJ5F.js → d70a22b9c0aa5244/chunk-2SZRSM2C.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/chunk-T7ARYEMC.js → d70a22b9c0aa5244/chunk-LKQKEUHR.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/chunk-IEK55PZU.js → d70a22b9c0aa5244/chunk-NRYBDZJQ.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/employee-card-FDPCQJSS.js → d70a22b9c0aa5244/employee-card-JRCEGKOW.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/host-C3IWMIFZ.js → d70a22b9c0aa5244/host-3YSTASO7.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/host-Q47YC3FG.js → d70a22b9c0aa5244/host-EAFCE2FW.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/host-3OXG7VBJ.js → d70a22b9c0aa5244/host-HSG7HCKW.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/host-WL7ZZS7E.js → d70a22b9c0aa5244/host-O3FQO2WF.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/host-Z6HYEEDJ.js → d70a22b9c0aa5244/host-PULYRKUO.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/host-R2PN4PWJ.js → d70a22b9c0aa5244/host-QKLN6BQT.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/host-YZ2YF43V.js → d70a22b9c0aa5244/host-TFWV4EL3.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/host-5JX4XA3B.js → d70a22b9c0aa5244/host-TOKT2KEL.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/host-QECJ4JY2.js → d70a22b9c0aa5244/host-UHPSRXOS.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/host-IOQX22WS.js → d70a22b9c0aa5244/host-VQKHZ4XY.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/host-QLTSBAD7.js → d70a22b9c0aa5244/host-VSUTKITC.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/host-X5JHUBCU.js → d70a22b9c0aa5244/host-XTI24R46.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/host-PL4SWWF5.js → d70a22b9c0aa5244/host-ZTK4NJBZ.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/host-bridge-KMY7UWDM.js → d70a22b9c0aa5244/host-bridge-YU4CDKM6.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/library-bridge-CRHLRGUS.js → d70a22b9c0aa5244/library-bridge-E4G3TTAM.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/page-5YCNWWVQ.js → d70a22b9c0aa5244/page-EL25SU2L.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/panel-6VM3TZD3.js → d70a22b9c0aa5244/panel-5FP5SRNS.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a → d70a22b9c0aa5244}/runtime.js +130 -129
- package/dist/web-ui/content/modules/{74fb50402b39f99a/task-board-host-OGNS7ZZX.js → d70a22b9c0aa5244/task-board-host-EYEPEKBJ.js} +1 -1
- package/dist/web-ui/content/modules/{74fb50402b39f99a/workspace-agent-picker-KWY5JOSF.js → d70a22b9c0aa5244/workspace-agent-picker-TA2VJ2QW.js} +1 -1
- package/dist/web-ui/content/styles.css +1 -1
- package/dist/web-ui/embedded-assets.d.ts +27 -27
- package/dist/web-ui/embedded-assets.js +3 -3
- package/package.json +8 -1
- /package/dist/web-ui/content/modules/{74fb50402b39f99a/chunk-JAYB4SD7.js → d70a22b9c0aa5244/chunk-4OECFENI.js} +0 -0
- /package/dist/web-ui/content/modules/{74fb50402b39f99a/chunk-W62HMLPT.js → d70a22b9c0aa5244/chunk-4RVBPCZ2.js} +0 -0
- /package/dist/web-ui/content/modules/{74fb50402b39f99a/chunk-YF6I5MJN.js → d70a22b9c0aa5244/chunk-4TWMU7ZU.js} +0 -0
- /package/dist/web-ui/content/modules/{74fb50402b39f99a/chunk-CUQQJPJA.js → d70a22b9c0aa5244/chunk-A3PREDLN.js} +0 -0
- /package/dist/web-ui/content/modules/{74fb50402b39f99a/chunk-GUG57JJQ.js → d70a22b9c0aa5244/chunk-AN34B6OX.js} +0 -0
- /package/dist/web-ui/content/modules/{74fb50402b39f99a/chunk-35637AFU.js → d70a22b9c0aa5244/chunk-LROINIFZ.js} +0 -0
- /package/dist/web-ui/content/modules/{74fb50402b39f99a/chunk-TJEUKQ34.js → d70a22b9c0aa5244/chunk-PFPY4NTX.js} +0 -0
- /package/dist/web-ui/content/modules/{74fb50402b39f99a → d70a22b9c0aa5244}/chunk-XGVT4ZWT.js +0 -0
- /package/dist/web-ui/content/modules/{74fb50402b39f99a → d70a22b9c0aa5244}/chunk-YOXXNXOX.js +0 -0
- /package/dist/web-ui/content/modules/{74fb50402b39f99a → d70a22b9c0aa5244}/chunk-YX475LXO.js +0 -0
- /package/dist/web-ui/content/modules/{74fb50402b39f99a → d70a22b9c0aa5244}/host-5QOHKHNC.js +0 -0
- /package/dist/web-ui/content/modules/{74fb50402b39f99a → d70a22b9c0aa5244}/sha256-ANXV72UC.js +0 -0
- /package/dist/web-ui/content/modules/{74fb50402b39f99a/workspace-window-UUFMGL25.js → d70a22b9c0aa5244/workspace-window-QDI7YABJ.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as mt,b as We,c as oe,d as ut,e as ft}from"./chunk-T7ARYEMC.js";import{a as lt,b as dt}from"./chunk-JAYB4SD7.js";import{shared35_b as gt}from"./runtime.js";import{shared36_c as pt,shared36_d as Ae,shared36_g as ct}from"./runtime.js";import{shared32_a as M,shared32_b as S}from"./runtime.js";import{shared13_a as Me}from"./runtime.js";import "./runtime.js";import{a as at}from"./chunk-XGVT4ZWT.js";import{shared49_g as we,shared49_h as it,shared49_i as st}from"./runtime.js";import{shared63_b as ge}from"./runtime.js";import{shared14_a as Re}from"./runtime.js";import{shared77_a as Ee}from"./runtime.js";import{a as rt}from"./chunk-YX475LXO.js";import{shared51_a as H}from"./runtime.js";import "./runtime.js";import{shared37_h as ue,shared37_i as nt,shared37_m as Oe}from"./runtime.js";import "./runtime.js";import{shared18_a as tt}from"./runtime.js";import{shared55_l as ot}from"./runtime.js";import "./runtime.js";import "./runtime.js";import "./runtime.js";import "./runtime.js";import{shared19_k as $e,shared19_l as Ne,shared19_m as Z,shared19_n as Se}from"./runtime.js";import "./runtime.js";import "./runtime.js";import "./runtime.js";import{shared68_c as $}from"./runtime.js";import "./runtime.js";import "./runtime.js";import{shared53_b as b}from"./runtime.js";import "./runtime.js";import "./runtime.js";import{shared10_a as fe}from"./runtime.js";import "./runtime.js";import "./runtime.js";import "./runtime.js";import{shared27_a as et}from"./runtime.js";import{shared58_a as ee}from"./runtime.js";import{shared7_C as de,shared7_Dd as u,shared7_Ed as Qe,shared7_F as qe,shared7_Fd as me,shared7_Ld as Xe,shared7_M as Pe,shared7_Sc as ce,shared7_Zd as te,shared7_be as Ze,shared7_cc as Fe,shared7_ld as N,shared7_od as Je,shared7_ra as Ue,shared7_vc as pe,shared7_wb as Ye,shared7_yd as g}from"./runtime.js";import{shared8_a as Ve}from"./runtime.js";import{shared9_c as G}from"./runtime.js";function wt({provider:o,mode:s,kind:l,engine:w}){return o==="codex"?"Codex \u81EA\u52A8\u6279\u51C6\u5DE5\u5177\u8C03\u7528\uFF0C\u5E76\u5173\u95ED Codex \u7684\u6C99\u76D2\u9650\u5236\u3002":o==="opencode"?s==="full-access"||s==="managed"||s==="auto-edit"?"OpenCode \u81EA\u52A8\u6279\u51C6\u672A\u663E\u5F0F\u62D2\u7EDD\u7684\u6743\u9650\u8BF7\u6C42\u3002":l==="structured"?"OpenCode \u4F7F\u7528\u81EA\u8EAB\u6743\u9650\u914D\u7F6E\uFF1B\u5BF9\u8BDD\u4E2D\u672A\u6279\u51C6\u7684\u5DE5\u5177\u8C03\u7528\u4F1A\u88AB\u62D2\u7EDD\u3002":"OpenCode \u4F7F\u7528\u81EA\u8EAB\u6743\u9650\u914D\u7F6E\uFF0C\u5728\u7EC8\u7AEF\u4E2D\u5904\u7406\u6743\u9650\u786E\u8BA4\u3002":o==="grok"?s==="full-access"||s==="managed"?"Grok \u81EA\u52A8\u6279\u51C6\u5DE5\u5177\u6743\u9650\u8BF7\u6C42\u3002":"Grok \u4F7F\u7528\u81EA\u8EAB\u6743\u9650\u914D\u7F6E\uFF1B\u9700\u8981\u786E\u8BA4\u7684\u64CD\u4F5C\u53EF\u80FD\u7B49\u5F85\u6216\u88AB\u963B\u6B62\u3002":o==="qoder"?"Qoder \u5728\u6240\u6709\u6A21\u5F0F\u4E0B\u90FD\u8DF3\u8FC7\u5DE5\u5177\u6743\u9650\u786E\u8BA4\u3002":o==="pi"?w==="sdk"?"Wand Agent \u5728 Wand \u5185\u6267\u884C\uFF0C\u4F7F\u7528\u5F53\u524D\u4F1A\u8BDD\u914D\u7F6E\u7684\u5DE5\u5177\u4E0E\u6269\u5C55\u3002":"Pi CLI \u4F7F\u7528\u81EA\u8EAB\u5DE5\u5177\u4E0E\u6269\u5C55\u914D\u7F6E\uFF1B\u8FD9\u91CC\u7684\u6A21\u5F0F\u4E0D\u4F1A\u589E\u52A0\u9010\u9879\u6743\u9650\u786E\u8BA4\u3002":o==="gemini"?s==="full-access"||s==="managed"||l==="pty"&&s==="auto-edit"?"Gemini \u81EA\u52A8\u6279\u51C6\u5168\u90E8\u5DE5\u5177\u8C03\u7528\u3002":s==="auto-edit"?"Gemini \u81EA\u52A8\u6279\u51C6\u7F16\u8F91\u5DE5\u5177\uFF1B\u5176\u4ED6\u5DE5\u5177\u4ECD\u9075\u5FAA\u81EA\u8EAB\u6743\u9650\u914D\u7F6E\u3002":l==="structured"?"Gemini \u4F7F\u7528\u81EA\u8EAB\u6743\u9650\u914D\u7F6E\uFF1B\u5BF9\u8BDD\u4E2D\u672A\u6279\u51C6\u7684\u5DE5\u5177\u8C03\u7528\u4F1A\u88AB\u62D2\u7EDD\u3002":"Gemini \u4F7F\u7528\u81EA\u8EAB\u6743\u9650\u914D\u7F6E\uFF0C\u5728\u7EC8\u7AEF\u4E2D\u5904\u7406\u6743\u9650\u786E\u8BA4\u3002":s==="full-access"?"Claude \u81EA\u52A8\u6279\u51C6\u5DE5\u5177\u6743\u9650\u8BF7\u6C42\uFF0C\u53EF\u8FDE\u7EED\u6267\u884C\u4FEE\u6539\u3002":s==="auto-edit"?"Claude \u81EA\u52A8\u6279\u51C6\u6587\u4EF6\u7F16\u8F91\uFF1B\u5176\u4ED6\u5DE5\u5177\u6309\u5F53\u524D\u4F1A\u8BDD\u6743\u9650\u7B56\u7565\u5904\u7406\u3002":s==="managed"?"Claude \u6309\u76EE\u6807\u8FDE\u7EED\u6267\u884C\uFF0C\u5E76\u81EA\u52A8\u6279\u51C6\u5DE5\u5177\u6743\u9650\u8BF7\u6C42\uFF1B\u7F3A\u5C11\u5FC5\u8981\u4FE1\u606F\u6216\u5DE5\u5177\u5931\u8D25\u65F6\u4ECD\u53EF\u80FD\u505C\u6B62\u3002":"Claude \u4FDD\u7559\u5DE5\u5177\u6267\u884C\u65B9\u5F0F\uFF0C\u64CD\u4F5C\u8BF7\u6C42\u6309\u5F53\u524D\u4F1A\u8BDD\u6743\u9650\u7B56\u7565\u5904\u7406\u3002"}function De(o){return o.kind!=="shell"&&(o.mode==="full-access"||o.mode==="managed"||o.provider==="codex"||o.provider==="qoder"||o.provider==="gemini"&&o.kind==="pty"&&o.mode==="auto-edit")}var y=G(Ve());var{Option:yt}=$;function ht(o){return o?.type&&(o.type.isSelectOption||o.type.isSelectOptGroup)}var At=(o,s)=>{let{prefixCls:l,className:w,style:e,popupClassName:d,dropdownClassName:B,children:E,dataSource:f,rootClassName:x,dropdownStyle:h,dropdownRender:m,popupRender:p,onDropdownVisibleChange:L,onOpenChange:V,styles:q,classNames:K,popupMatchSelectWidth:ye,dropdownMatchSelectWidth:ne}=o,O=qe(E),A=p||m,U=V||L,ie=ye??ne,W;O.length===1&&y.isValidElement(O[0])&&!ht(O[0])&&([W]=O);let se=W?()=>W:void 0,Y;O.length&&ht(O[0])?Y=E:Y=f?f.map(v=>{if(y.isValidElement(v))return v;switch(typeof v){case"string":return y.createElement(yt,{key:v,value:v},v);case"object":{let{value:J}=v;return y.createElement(yt,{key:J,value:J},v.text)}default:return}}):[];let{getPrefixCls:he}=y.useContext(Ue),k=he("select",l),z={...o,popupRender:A,onOpenChange:U,popupMatchSelectWidth:ie},[I,C]=Ye([K],[q],{props:z},{popup:{_default:"root"}}),ae=y.useMemo(()=>({root:Pe(`${k}-auto-complete`,w,x,I.root,{[`${k}-customize`]:W}),prefix:I.prefix,input:I.input,placeholder:I.placeholder,content:I.content,clear:I.clear,popup:{root:Pe(d,B,I.popup.root),list:I.popup.list,listItem:I.popup.listItem}}),[k,w,x,I,d,B]),re=y.useMemo(()=>({root:{...C.root,...e},input:C.input,prefix:C.prefix,placeholder:C.placeholder,content:C.content,clear:C.clear,popup:{root:{...h,...C.popup.root},list:C.popup.list,listItem:C.popup.listItem}}),[C,e,h]);return y.createElement($,{ref:s,suffixIcon:null,...de(o,["dataSource","dropdownClassName","popupClassName","onDropdownVisibleChange","onOpenChange"]),prefixCls:k,classNames:ae,styles:re,mode:$.SECRET_COMBOBOX_MODE_DO_NOT_USE,popupRender:A,onOpenChange:U,popupMatchSelectWidth:ie,getInputElement:se},Y)},Wt=y.forwardRef(At),Be=Wt;var{Option:Dt}=$,Bt=Je(Be,"popupAlign",o=>de(o,["visible"])),Le=Be;Le.Option=Dt;Le._InternalPanelDoNotUseOrYouWillBeFired=Bt;var kt=Le;var r=G(Ve(),1);function It(o,s,l){if(o.length===0)return s;if(l==="Home")return o[0];if(l==="End")return o[o.length-1];let w=Math.max(0,o.indexOf(s));return o[(w+(l==="ArrowRight"||l==="ArrowDown"?1:-1)+o.length)%o.length]}var P=G(ce(),1);function Ct({form:o,initialName:s,disabled:l,cwd:w,onChange:e}){let{groups:d,loading:B,error:E,reload:f}=gt(),x=d.flatMap(m=>m.tasks.filter(p=>!p.archived).map(p=>({task:p,group:m}))),h=x.find(({task:m})=>m.id===o.workspaceTaskId);return(0,P.jsxs)(g,{vertical:!0,gap:8,children:[(0,P.jsx)(b.Item,{label:"\u6240\u5C5E\u4EFB\u52A1",style:{marginBottom:0},children:(0,P.jsx)(te,{ariaLabel:"\u6240\u5C5E\u4EFB\u52A1",className:"wand-new-session-model-select",disabled:l,searchable:!0,searchPlaceholder:"\u641C\u7D22\u4EFB\u52A1",value:o.workspaceTaskId||(o.taskName!==void 0?"new":""),options:[{value:"",label:"\u4E0D\u5206\u7EC4"},{value:"new",label:"\u65B0\u5EFA\u4EFB\u52A1\u2026"},...o.workspaceTaskId&&!h?[{value:o.workspaceTaskId,label:o.taskName||s||"\u5F53\u524D\u4EFB\u52A1"}]:[],...x.map(({task:m,group:p})=>({value:m.id,label:m.name,group:p.workspaceName}))],onValueChange:m=>{let p=x.find(({task:L})=>L.id===m);p?e({...o,workspaceTaskId:p.task.id,workspaceId:p.task.workspaceId,taskName:void 0,cwd:p.task.worktree?.path||p.task.cwd||p.group.workspaceCwd}):(m===""||m==="new")&&e({...o,workspaceTaskId:void 0,workspaceId:h&&!h.group.synthetic&&!h.group.global?h.group.workspaceId:o.workspaceId,cwd:h?.group.workspaceCwd||w,taskName:m==="new"?o.taskName??"":void 0})}})}),o.taskName!==void 0&&!o.workspaceTaskId?(0,P.jsx)(b.Item,{label:"\u4EFB\u52A1\u540D\u79F0",htmlFor:"wand-new-session-task-name",required:!0,style:{marginBottom:0},extra:"\u5148\u521B\u5EFA\u4EFB\u52A1\uFF0C\u518D\u5728\u4EFB\u52A1\u4E2D\u542F\u52A8\u4F1A\u8BDD\u3002",children:(0,P.jsx)(me,{id:"wand-new-session-task-name",value:o.taskName,disabled:l,maxLength:200,placeholder:"\u8F93\u5165\u4EFB\u52A1\u540D\u79F0",onChange:m=>e({...o,taskName:m.currentTarget.value})})}):null,B?(0,P.jsx)("span",{role:"status",children:"\u6B63\u5728\u52A0\u8F7D\u5DF2\u6709\u4EFB\u52A1\u2026"}):null,E?(0,P.jsx)(ee,{type:"warning",title:E,action:(0,P.jsx)(N,{size:"small",onClick:()=>{f()},children:"\u91CD\u8BD5"})}):null]})}async function vt(o,s,l){if(o.workspaceTaskId||o.taskName===void 0)return o;let w=o.taskName.trim();if(!w)throw new Error("\u8BF7\u8F93\u5165\u4EFB\u52A1\u540D\u79F0\u3002");let e={name:w,cwd:s,worktree:!1},d=o.workspaceId?await l.createTask(o.workspaceId,e):await l.createStandaloneTask(e);if(!d.id)throw new Error("\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE\u65B0\u4EFB\u52A1 ID\uFF0C\u8BF7\u5237\u65B0\u4EFB\u52A1\u5217\u8868\u6838\u5BF9\u540E\u518D\u521B\u5EFA\u4F1A\u8BDD\u3002");return{...o,taskName:w,workspaceId:d.workspaceId,workspaceTaskId:d.id,cwd:d.cwd}}var n=G(ce(),1);function Tt(o){return o?Ne(Z(o.provider,o.engine)):null}var Ke=[{value:"managed",label:"\u6258\u7BA1",description:"\u6309\u76EE\u6807\u8FDE\u7EED\u6267\u884C"},{value:"full-access",label:"\u5B8C\u5168\u8BBF\u95EE",description:"\u81EA\u52A8\u786E\u8BA4\u6743\u9650"},{value:"auto-edit",label:"\u81EA\u52A8\u7F16\u8F91",description:"\u81EA\u52A8\u786E\u8BA4\u4FEE\u6539"},{value:"default",label:"\u6807\u51C6",description:"\u4F7F\u7528\u5DE5\u5177\u9ED8\u8BA4\u6743\u9650\u914D\u7F6E"},{value:"native",label:"\u539F\u751F",description:"\u4FDD\u7559\u5DE5\u5177\u539F\u751F\u6267\u884C\u65B9\u5F0F"}];function D(o){return(o??"").trim()||ue}function Lt(o){return o.kind==="pty"?"\u7EC8\u7AEF\u4F7F\u7528 PTY\uFF0C\u76F4\u63A5\u5448\u73B0\u547D\u4EE4\u884C\u5DE5\u5177\u7684\u4EA4\u4E92\u754C\u9762\u4E0E\u539F\u59CB\u8F93\u51FA\u3002":o.engine==="sdk"?"Wand Agent \u4F7F\u7528 Wand \u8FDB\u7A0B\u5185 SDK\uFF0C\u4E0D\u542F\u52A8 Pi CLI\u3002":o.provider==="codex"?"\u5BF9\u8BDD\u89E3\u6790 Codex \u7684 JSONL \u4E8B\u4EF6\u3002":o.provider==="pi"||o.provider==="opencode"?"\u5BF9\u8BDD\u89E3\u6790\u547D\u4EE4\u884C\u5DE5\u5177\u7684 JSON \u4E8B\u4EF6\u3002":o.provider==="grok"?"\u5BF9\u8BDD\u89E3\u6790 Grok \u7684 streaming-json \u4E8B\u4EF6\u3002":"\u5BF9\u8BDD\u89E3\u6790\u547D\u4EE4\u884C\u5DE5\u5177\u7684 stream-json \u4E8B\u4EF6\u3002"}function Kt({provider:o,kind:s,engine:l}){return s==="shell"?"\u65E0\u6CD5\u542F\u52A8\u7A7A\u767D\u7EC8\u7AEF\uFF0C\u8BF7\u68C0\u67E5\u670D\u52A1\u7AEF Shell \u914D\u7F6E\u3002":l==="sdk"?"\u65E0\u6CD5\u542F\u52A8 Wand Agent \u5BF9\u8BDD\uFF0C\u8BF7\u68C0\u67E5\u670D\u52A1\u7AEF Agent \u914D\u7F6E\u4E0E\u6A21\u578B\u53EF\u7528\u6027\u3002":s==="structured"?"\u65E0\u6CD5\u542F\u52A8\u5BF9\u8BDD\uFF0C\u8BF7\u68C0\u67E5\u6240\u9009\u5DE5\u5177\u662F\u5426\u53EF\u7528\u53CA\u6A21\u578B\u914D\u7F6E\u3002":o==="codex"?"\u65E0\u6CD5\u542F\u52A8 Codex \u4F1A\u8BDD\uFF0C\u8BF7\u786E\u8BA4 codex \u5DF2\u6B63\u786E\u5B89\u88C5\u5E76\u53EF\u5728\u7EC8\u7AEF\u4E2D\u6267\u884C\u3002":o==="opencode"?"\u65E0\u6CD5\u542F\u52A8 OpenCode \u4F1A\u8BDD\uFF0C\u8BF7\u786E\u8BA4 opencode-ai \u5DF2\u6B63\u786E\u5B89\u88C5\u3002":o==="grok"?"\u65E0\u6CD5\u542F\u52A8 Grok \u4F1A\u8BDD\uFF0C\u8BF7\u786E\u8BA4 Grok Build CLI \u5DF2\u6B63\u786E\u5B89\u88C5\u3002":o==="qoder"?"\u65E0\u6CD5\u542F\u52A8 Qoder \u4F1A\u8BDD\uFF0C\u8BF7\u786E\u8BA4 @qoder-ai/qodercli \u5DF2\u6B63\u786E\u5B89\u88C5\u3002":o==="pi"?"\u65E0\u6CD5\u542F\u52A8 Pi \u4F1A\u8BDD\uFF0C\u8BF7\u786E\u8BA4 Pi CLI \u5DF2\u6B63\u786E\u5B89\u88C5\u3002":o==="gemini"?"\u65E0\u6CD5\u542F\u52A8 Gemini \u4F1A\u8BDD\uFF0C\u8BF7\u786E\u8BA4 Gemini CLI \u5DF2\u6B63\u786E\u5B89\u88C5\u3002":"\u65E0\u6CD5\u542F\u52A8 Claude \u4F1A\u8BDD\uFF0C\u8BF7\u786E\u8BA4 Claude \u5DF2\u6B63\u786E\u5B89\u88C5\u3002"}function bt(o){return o.trim().replace(/\/+$/,"")||"/"}var zt=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"]);function Go({repository:o=ft}){let s=(0,r.useSyncExternalStore)(S.subscribe,S.getSnapshot,S.getSnapshot),[l,w]=(0,r.useState)(null),[e,d]=(0,r.useState)(null),[B,E]=(0,r.useState)(!1),[f,x]=(0,r.useState)(!1),h=(0,r.useRef)(!1),[m,p]=(0,r.useState)(""),[L,V]=(0,r.useState)([]),[q,K]=(0,r.useState)(!1),[ye,ne]=(0,r.useState)(!1),[O,A]=(0,r.useState)(!1),U=(0,r.useRef)(null),[ie,W]=(0,r.useState)(!1),se=at(s.open),Y=rt(s.open),{employees:he}=ot({includeArchived:!0,enabled:s.open}),[k,z]=(0,r.useState)(!1),I=(0,r.useRef)({}),C=(0,r.useRef)(null);(0,r.useEffect)(()=>{e?.employeeId&&C.current?.focus({preventScroll:!0})},[e?.employeeId]);let[ae,re]=(0,r.useState)(""),v=(0,r.useRef)(null),[J,ke]=(0,r.useState)([]),Q=!!(s.open&&e&&!e.workspaceTaskId&&e.taskName===void 0),Ie=st(Q),xt=(0,r.useMemo)(()=>Ie?.map(it)??null,[Ie]);(0,r.useEffect)(()=>{if(!s.open)return;let t=new AbortController,i=S.getRuntime();return E(!0),x(!1),p(""),w(null),d(null),V([]),K(!1),ne(!1),A(!1),W(!1),z(!1),re(""),o.load({signal:t.signal}).then(a=>{if(t.signal.aborted)return;let c=i?.getContext();w(a);let T=a.config.defaultProvider;d({provider:T,engine:T==="pi"?a.config.defaultEngine??"cli":void 0,employeeId:s.initialKind==="shell"?void 0:s.initialEmployeeId||void 0,kind:s.initialKind?s.initialKind:s.initialEmployeeId?"structured":a.config.defaultSessionKind,mode:oe(a.config.defaultProvider,a.config.defaultMode,a.config.defaultMode),cwd:s.initialCwd,worktreeEnabled:!1,model:D(c?.selectedModels?.[a.config.defaultProvider]),specifiedCli:!1,workspaceId:s.workspaceId||void 0,workspaceTaskId:s.workspaceTaskId||void 0,taskName:s.newTask?"":void 0}),c||p("\u65B0\u5EFA\u4F1A\u8BDD\u8FD0\u884C\u73AF\u5883\u5C1A\u672A\u5C31\u7EEA\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u540E\u91CD\u8BD5\u3002")}).catch(a=>{t.signal.aborted||p(fe(a,"\u65E0\u6CD5\u52A0\u8F7D\u65B0\u5EFA\u4F1A\u8BDD\u914D\u7F6E\u3002"))}).finally(()=>{t.signal.aborted||E(!1)}),()=>t.abort()},[s.initialCwd,s.initialEmployeeId,s.initialKind,s.open,s.revision,s.taskName,s.workspaceId,s.workspaceTaskId,s.newTask,o]),(0,r.useEffect)(()=>{if(!Q)return;let t=!0;return Me.list().then(i=>{t&&ke(i)},()=>{t&&ke([])}),()=>{t=!1}},[Q]),(0,r.useEffect)(()=>{if(!s.open||!e||!q)return;let t=new AbortController,i=window.setTimeout(()=>{o.suggestPaths(e.cwd,{signal:t.signal}).then(a=>{t.signal.aborted||V(a)}).catch(()=>{t.signal.aborted||V([])})},120);return()=>{window.clearTimeout(i),t.abort()}},[s.open,e?.cwd,o,q]);let Ce=(0,r.useCallback)(t=>{let i=Ne(t);if(!l||!i)return;let a=i.provider,c=i.engine,T=D(S.getRuntime()?.getContext().selectedModels?.[a]);d(F=>F&&{...F,provider:a,engine:c,kind:c==="sdk"?"structured":F.kind,model:T,mode:oe(a,F.mode,l.config.defaultMode)});let R=e?oe(a,e.mode,l.config.defaultMode):oe(a,l.config.defaultMode,l.config.defaultMode);o.savePreferences({defaultProvider:a,defaultEngine:c??"cli",defaultMode:R}).catch(F=>console.warn("[wand] Failed to persist new-session defaults",F))},[l,e,o]),ze=(0,r.useCallback)(t=>{d(i=>i&&{...i,kind:t,model:t!=="structured"&&i.model.startsWith("wand-openrouter-free/")?"default":i.model}),t!=="shell"&&o.savePreferences({defaultSessionKind:t}).catch(i=>console.warn("[wand] Failed to persist new-session defaults",i))},[o]),_e=(0,r.useCallback)(t=>{!e||!We(e.provider).includes(t)||(d(i=>i&&{...i,mode:t}),o.savePreferences({defaultMode:t}).catch(i=>console.warn("[wand] Failed to persist new-session defaults",i)))},[e,o]),ve=(0,r.useCallback)(t=>{d(i=>i&&{...i,model:t}),S.getRuntime()?.rememberModel(e?.provider??"claude",nt(t))},[e?.provider]),Te=(0,r.useMemo)(()=>e?We(e.provider):[],[e?.provider]),je=(0,r.useMemo)(()=>new Set(Te),[Te]),Nt=e?.cwd.trim()||S.getRuntime()?.getContext().effectiveCwd||l?.config.defaultCwd||"\u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55",St=e?Ke.find(t=>t.value===e.mode):void 0,X=e?.employeeId?he.find(t=>t.id===e.employeeId):null,Pt=e?.teamId?Ie?.find(t=>t.id===e.teamId)??null:null,_=X?.agents??[],j=!!(e&&!e.teamId&&(e.employeeId&&!e.specifiedCli?_.some(t=>De(t)):De(e))),Ge=e?.teamId?Pt?.name??"AI \u56E2\u961F":e?.employeeId?X?.name??"\u7845\u57FA\u5458\u5DE5":e?.kind==="shell"?"\u7A7A\u767D\u7EC8\u7AEF":Tt(e)?.label??e?.provider??"",He=!e||e.kind==="shell"?"\u4E0D\u4F7F\u7528\u6A21\u578B":e.teamId?"\u8DDF\u968F\u6210\u5458\u5458\u5DE5\u914D\u7F6E":e.employeeId&&!e.specifiedCli?_.length?_.map(t=>`${Se(t.provider,t.engine)} \xB7 ${t.model===ue?"\u670D\u52A1\u7AEF\u9ED8\u8BA4":t.model}`).join("\uFF1B"):"\u8DDF\u968F\u5458\u5DE5\u914D\u7F6E":D(e.model)===ue?"\u8DDF\u968F\u670D\u52A1\u7AEF\u9ED8\u8BA4":D(e.model),Ft=e?e.teamId?"\u8DDF\u968F\u6210\u5458\u5458\u5DE5\u914D\u7F6E":e.employeeId&&!e.specifiedCli?`\u8DDF\u968F\u5458\u5DE5\u5019\u9009\u914D\u7F6E${j?" \xB7 \u542B\u81EA\u52A8\u6388\u6743":""}`:e.kind==="shell"?"\u7CFB\u7EDF Shell \u6743\u9650":`${St?.label??"\u6807\u51C6"}${e.mode==="full-access"?" \xB7 full access":j?" \xB7 \u81EA\u52A8\u6388\u6743":""}`:"",Et=e?e.teamId?"\u8D1F\u8D23\u4EBA\u62C6\u89E3\u4EFB\u52A1\uFF0C\u5404\u6210\u5458\u4F7F\u7528\u81EA\u5DF1\u7684\u5DE5\u5177\u4E0E\u6743\u9650\u914D\u7F6E\u3002":e.employeeId&&!e.specifiedCli?_.length?_.map(t=>{let i=t.provider==="codex"?"\u5B8C\u5168\u8BBF\u95EE \xB7 full access":Ke.find(a=>a.value===t.mode)?.label??"\u6807\u51C6";return`${Se(t.provider,t.engine)} \xB7 ${i}`}).join("\uFF1B")+(_.some(t=>t.provider==="codex")?"\u3002Codex \u81EA\u52A8\u6279\u51C6\u5DE5\u5177\u8C03\u7528\u5E76\u5173\u95ED\u6C99\u76D2\u9650\u5236\uFF1B\u5DE5\u4F5C\u76EE\u5F55\u4E0D\u662F\u6743\u9650\u6C99\u76D2\u3002":j?"\u3002\u90E8\u5206\u5019\u9009\u4F7F\u7528\u81EA\u52A8\u6388\u6743\uFF0C\u542F\u52A8\u4F1A\u6CBF\u7528\u6240\u7528\u5019\u9009\u7684\u6743\u9650\uFF1B\u5DE5\u4F5C\u76EE\u5F55\u4E0D\u662F\u6743\u9650\u6C99\u76D2\u3002":"\u3002\u542F\u52A8\u4F1A\u6CBF\u7528\u6240\u7528\u5019\u9009\u7684\u6743\u9650\uFF0C\u5DE5\u4F5C\u76EE\u5F55\u4E0D\u662F\u6743\u9650\u6C99\u76D2\u3002"):"\u5458\u5DE5\u914D\u7F6E\u5C1A\u672A\u52A0\u8F7D\uFF1B\u542F\u52A8\u65F6\u4F7F\u7528\u8BE5\u5458\u5DE5\u7684\u5DE5\u5177\u4E0E\u6743\u9650\u914D\u7F6E\u3002":e.kind==="shell"?"\u76F4\u63A5\u4F7F\u7528\u7CFB\u7EDF Shell\uFF0C\u4E0D\u542F\u52A8 AI \u5DE5\u5177\uFF1B\u5DE5\u4F5C\u76EE\u5F55\u4E0D\u662F\u6743\u9650\u6C99\u76D2\u3002":`${wt(e)} \u5DE5\u4F5C\u76EE\u5F55\u4E0D\u662F\u6743\u9650\u6C99\u76D2\u3002`:"",be=e?.cwd.trim()||S.getRuntime()?.getContext().effectiveCwd||l?.config.defaultCwd||"",le=J.find(t=>bt(t.cwd)===bt(be)),xe=e?.workspaceTaskId?"":Ae(e?.workspaceId??le?.id,le?.kind);(0,r.useEffect)(()=>{!e?.teamId||xe||d(t=>t&&{...t,teamId:void 0})},[e?.teamId,xe]),(0,r.useEffect)(()=>{e?.teamId&&v.current?.focus()},[e?.teamId]);function Ot(t,i,a,c,T){if(!zt.has(t.key))return;t.preventDefault();let R=It(a,i,t.key);c(R),window.requestAnimationFrame(()=>T.current[R]?.focus())}async function Rt(t){let i=t.teamId??"";if(!i)return;let a=t.workspaceTaskId?"":Ae(t.workspaceId??le?.id,le?.kind);if(!a){p(pt);return}let c=ae.trim();if(!c){p("\u5148\u5199\u4E00\u53E5\u672C\u8F6E\u8BF4\u660E\uFF1A\u56E2\u961F\u8981\u6709\u660E\u786E\u76EE\u6807\u624D\u80FD\u5F00\u5DE5\u3002"),v.current?.focus();return}try{let T=await we.startDirect(i,{note:c,workspaceId:a}),R=T.run.chatSessionId;await we.settle("success"),ge.close(),M.close(),R?ge.open("","","teamchat",T.run.id):ge.open("","","teams"),Re()}catch(T){p(fe(T,"\u5F00\u5DE5\u5931\u8D25\uFF0C\u8BF7\u9009\u62E9\u5DF2\u6709\u9879\u76EE\u540E\u91CD\u8BD5\u3002")),await we.settle("error")}}async function Mt(t){if(t.preventDefault(),t.nativeEvent.isComposing||!e||!l||h.current)return;let i=S.getRuntime();if(!i){p("\u65B0\u5EFA\u4F1A\u8BDD\u8FD0\u884C\u73AF\u5883\u5C1A\u672A\u5C31\u7EEA\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u540E\u91CD\u8BD5\u3002");return}M.setDismissable(!1),h.current=!0,x(!0),p("");try{if(e.teamId){await Rt(e);return}let a=await vt(e,be,Me);a!==e&&(d(a),Re());let c=ut(a,l.config,i.getContext()),T=await i.prepareCreate(c.kind,c);c.kind!=="structured"&&Object.assign(c,T),o.savePreferences({...c.kind==="shell"?{}:{...e.employeeId?{}:{defaultProvider:c.provider},...c.kind==="structured"&&c.provider==="pi"?{defaultEngine:e.engine??"cli"}:{},defaultSessionKind:c.kind,defaultMode:c.mode}}).catch(F=>console.warn("[wand] Failed to persist new-session defaults",F));let R=await o.create(c);await i.completeCreate(c,R),M.close()}catch(a){p(fe(a,Kt(e)))}finally{h.current=!1,M.setDismissable(!0),x(!1)}}return(0,n.jsx)(Xe,{open:s.open,onOpenChange:t=>{t||M.close()},title:s.taskName?`\u65B0\u5BF9\u8BDD \xB7 ${s.taskName}`:"\u65B0\u5BF9\u8BDD",description:"\u5148\u9009\u62E9\u6267\u884C\u65B9\u5F0F\uFF0C\u518D\u786E\u8BA4\u6A21\u578B\u4E0E\u5DE5\u4F5C\u76EE\u5F55\u3002\u9009\u62E9\u4F1A\u8BB0\u4E3A\u4E0B\u6B21\u65B0\u5EFA\u504F\u597D\u3002",className:"wand-task-library-dialog wand-new-session-library-dialog",closeLabel:"\u5173\u95ED\u65B0\u5EFA\u4F1A\u8BDD",testId:"new-session-dialog",dismissable:!f,children:B||s.open&&Y===null?(0,n.jsx)(et,{tip:"\u6B63\u5728\u52A0\u8F7D\u65B0\u5EFA\u4F1A\u8BDD\u914D\u7F6E\u2026",children:(0,n.jsx)("div",{style:{minHeight:100},role:"status",children:"\u6B63\u5728\u52A0\u8F7D\u65B0\u5EFA\u4F1A\u8BDD\u914D\u7F6E\u2026"})}):e&&l?(0,n.jsx)(dt,{noValidate:!0,"aria-busy":f,onSubmit:t=>{Mt(t)},children:(0,n.jsxs)(g,{vertical:!0,gap:12,children:[(0,n.jsx)("section",{className:"wand-new-session-summary","aria-label":"\u6267\u884C\u8BBE\u7F6E",children:(0,n.jsxs)(g,{vertical:!0,gap:12,children:[(0,n.jsx)(b.Item,{label:"\u6267\u884C\u5BF9\u8C61",style:{marginBottom:0},children:e.employeeId?(0,n.jsxs)("div",{className:"wand-new-session-employee-section",children:[(0,n.jsxs)(g,{align:"center",justify:"space-between",gap:12,className:"wand-new-session-logo-bar",style:{padding:"8px 0",borderBottom:"1px solid var(--border-subtle)"},children:[(0,n.jsxs)(g,{align:"center",gap:12,style:{minWidth:0,flex:1},children:[(0,n.jsx)("button",{type:"button",className:"wand-new-session-logo-toggle",ref:C,title:k?"\u6536\u8D77\u5DE5\u5177\u5207\u6362":"\u5207\u6362\u6267\u884C\u5DE5\u5177\u548C\u6A21\u578B","aria-label":k?"\u6536\u8D77\u5DE5\u5177\u5207\u6362":"\u5207\u6362\u6267\u884C\u5DE5\u5177\u548C\u6A21\u578B","aria-expanded":k,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center"},onClick:t=>{t.stopPropagation(),z(!k)},children:(0,n.jsx)(Ee,{employee:X||{id:e.employeeId,name:"\u5458\u5DE5"},provider:e.specifiedCli?e.provider:void 0,size:"md"})}),(0,n.jsxs)(g,{vertical:!0,style:{minWidth:0,flex:1},children:[(0,n.jsxs)(g,{align:"center",gap:8,children:[(0,n.jsx)(u.Text,{strong:!0,ellipsis:!0,style:{fontSize:13},children:X?.name||"\u7845\u57FA\u5458\u5DE5"}),(0,n.jsx)(u.Text,{type:"secondary",style:{fontSize:12,padding:"1px 6px",borderRadius:4,background:e.specifiedCli?"var(--accent-muted)":"var(--bg-secondary)",color:e.specifiedCli?"var(--accent)":"var(--text-secondary)"},children:e.specifiedCli?"\u5DF2\u6307\u5B9A\u5DE5\u5177":"\u6309\u5458\u5DE5\u914D\u7F6E\u542F\u52A8"})]}),(0,n.jsx)(u.Text,{type:"secondary",ellipsis:!0,style:{fontSize:12},children:e.specifiedCli?`\u5DE5\u5177\uFF1A${Tt(e)?.label||e.provider} \xB7 \u6A21\u578B\uFF1A${D(e.model)}`:"\u6309\u5458\u5DE5\u914D\u7F6E\u7684\u5DE5\u5177\u4E0E\u6A21\u578B\u5019\u9009\u987A\u5E8F\u542F\u52A8"})]})]}),(0,n.jsx)(N,{kind:"ghost",size:"small",type:"button","aria-expanded":k,onClick:t=>{t.stopPropagation(),z(!k)},children:k?"\u6536\u8D77":"\u6307\u5B9A\u5DE5\u5177 / \u6A21\u578B"})]}),k?(0,n.jsxs)(g,{vertical:!0,gap:12,className:"wand-new-session-custom-cli-panel",style:{marginTop:8,padding:"8px 0"},children:[(0,n.jsx)(b.Item,{label:"\u9009\u62E9\u6267\u884C\u5DE5\u5177",style:{marginBottom:0},children:(0,n.jsx)(H.Group,{value:e.specifiedCli?Z(e.provider,e.engine):"default_dispatch",disabled:f,style:{width:"100%"},onChange:t=>{let i=t.target.value;i==="default_dispatch"?d(a=>a&&{...a,specifiedCli:!1}):(d(a=>a&&{...a,specifiedCli:!0}),Ce(i))},children:(0,n.jsxs)("div",{className:"wand-execution-subject-grid",children:[(0,n.jsx)(H,{value:"default_dispatch",children:(0,n.jsxs)(g,{align:"center",gap:8,children:[(0,n.jsx)(Ee,{employee:X||{id:e.employeeId,name:"\u5458\u5DE5"},size:"sm"}),(0,n.jsxs)(g,{vertical:!0,children:[(0,n.jsx)(u.Text,{strong:!0,children:"\u5458\u5DE5\u9ED8\u8BA4\u6D3E\u53D1"}),(0,n.jsx)(u.Text,{type:"secondary",style:{fontSize:12},children:"\u6309\u5458\u5DE5\u914D\u7F6E\u7684\u5019\u9009\u987A\u5E8F\u5C1D\u8BD5\u5DE5\u5177\u4E0E\u6A21\u578B"})]})]})}),$e.map(t=>(0,n.jsx)(H,{value:t.id,children:(0,n.jsxs)(g,{align:"center",gap:8,children:[t.engine==="sdk"?(0,n.jsx)(Qe,{name:"spark",size:18}):(0,n.jsx)(tt,{provider:t.provider,className:"wand-subject-provider"}),(0,n.jsxs)(g,{vertical:!0,children:[(0,n.jsx)(u.Text,{strong:!0,children:t.label}),(0,n.jsx)(u.Text,{type:"secondary",style:{fontSize:12},children:t.description})]})]})},t.id))]})})}),e.specifiedCli?(0,n.jsx)(b.Item,{label:"\u6307\u5B9A\u6A21\u578B",style:{marginBottom:0},extra:"\u6240\u9009\u6A21\u578B\u968F\u4F1A\u8BDD\u542F\u52A8\u4E00\u8D77\u63D0\u4EA4\uFF1B\u300C\u8DDF\u968F\u670D\u52A1\u7AEF\u9ED8\u8BA4\u300D\u6CBF\u7528\u670D\u52A1\u7AEF\u914D\u7F6E\u7684\u9ED8\u8BA4\u6A21\u578B\u3002",children:(0,n.jsx)(te,{value:D(e.model),options:Oe(se,e.provider).filter(t=>e.kind==="structured"||!t.value.startsWith("wand-openrouter-free/")),ariaLabel:"\u6A21\u578B",searchable:!0,searchPlaceholder:"\u641C\u7D22\u6A21\u578B",disabled:f,className:"wand-new-session-model-select",onValueChange:ve})}):null,(0,n.jsxs)(g,{justify:"space-between",align:"center",style:{paddingTop:4},children:[(0,n.jsx)(N,{kind:"ghost",size:"small",type:"button",onClick:()=>{d(t=>t&&{...t,employeeId:void 0,specifiedCli:void 0}),z(!1),A(!0)},children:"\u9009\u62E9\u5176\u4ED6\u6267\u884C\u8005"}),e.specifiedCli?(0,n.jsx)(N,{kind:"ghost",size:"small",type:"button",onClick:()=>{d(t=>t&&{...t,specifiedCli:!1})},children:"\u6062\u590D\u5458\u5DE5\u9ED8\u8BA4\u6D3E\u53D1"}):null]})]}):null]}):(0,n.jsx)(pe,{ref:U,className:"wand-new-session-subject-collapse",destroyOnHidden:!0,activeKey:O?["subject"]:[],onChange:t=>A(t.includes("subject")),items:[{key:"subject",label:(0,n.jsxs)(g,{justify:"space-between",align:"center",gap:12,children:[(0,n.jsx)(u.Text,{strong:!0,ellipsis:!0,title:Ge,children:Ge}),(0,n.jsx)(u.Text,{type:"secondary",children:"\u66F4\u6362\u6267\u884C\u5BF9\u8C61"})]}),children:(0,n.jsx)(mt,{selectedSubject:e.teamId?{type:"team",id:e.teamId}:e.employeeId?{type:"employee",id:e.employeeId}:{type:"cli",id:e.kind==="shell"?"shell":e.provider,...e.engine?{engine:e.engine}:{}},kind:e.kind==="shell"?"pty":e.kind,model:e.model,showModel:!1,showKind:!1,teams:Q?xt:null,teamWorkspaceId:xe,disabled:f,onSubjectChange:t=>{if(t.type!=="employee"&&U.current?.querySelector(".ant-collapse-header")?.focus({preventScroll:!0}),A(!1),t.type==="team"){d(i=>i&&{...i,teamId:t.id,employeeId:void 0,specifiedCli:void 0});return}t.type==="cli"?t.id==="shell"?d(i=>i&&{...i,teamId:void 0,employeeId:void 0,kind:"shell",specifiedCli:void 0}):(d(i=>i&&{...i,teamId:void 0,employeeId:void 0,kind:i.kind==="shell"?"pty":i.kind,specifiedCli:void 0}),Ce(Z(t.id,t.engine))):t.type==="employee"&&d(i=>i&&{...i,teamId:void 0,employeeId:t.id,kind:"structured",specifiedCli:!1})},onKindChange:t=>{t==="pty"&&d(i=>i&&{...i,teamId:void 0,employeeId:void 0,specifiedCli:void 0}),ze(t)},onModelChange:t=>ve(t)})}]})}),(0,n.jsxs)(b.Item,{label:"\u4F1A\u8BDD\u7C7B\u578B",style:{marginBottom:0},children:[(0,n.jsx)(Ze,{block:!0,"aria-label":"\u4F1A\u8BDD\u7C7B\u578B",value:e.kind==="shell"?"pty":e.kind,disabled:f,options:ct.map(t=>({value:t.value,label:(0,n.jsx)("span",{title:t.description,children:t.label})})),onChange:t=>{t==="pty"&&(d(i=>i&&{...i,teamId:void 0,employeeId:void 0,specifiedCli:void 0,engine:i.engine==="sdk"?"cli":i.engine}),e.engine==="sdk"&&Ce(Z(e.provider,"cli"))),ze(t)}}),e.employeeId||e.teamId||e.engine==="sdk"?(0,n.jsx)(u.Text,{type:"secondary",children:"\u7EC8\u7AEF\u76F4\u63A5\u4F7F\u7528\u547D\u4EE4\u884C\u5DE5\u5177\uFF1B\u5207\u6362\u540E\u4E0D\u4F7F\u7528\u5458\u5DE5\u3001\u56E2\u961F\u6216 Wand Agent\u3002"}):null]}),!e.teamId&&!(e.employeeId&&!e.specifiedCli)&&e.kind!=="shell"?(0,n.jsx)(b.Item,{label:"\u6743\u9650\u4E0E\u6267\u884C\u6A21\u5F0F",style:{marginBottom:0},children:(0,n.jsx)(H.Group,{"aria-label":"\u6267\u884C\u6A21\u5F0F",value:e.mode,disabled:f,onChange:t=>_e(t.target.value),children:(0,n.jsx)(Fe,{wrap:!0,children:Ke.filter(t=>je.has(t.value)).map(t=>(0,n.jsx)(H.Button,{value:t.value,disabled:!je.has(t.value),title:t.description,ref:i=>{I.current[t.value]=i?.input??null},onKeyDown:i=>Ot(i,e.mode,Te,_e,I),children:t.label},t.value))})})}):null,(0,n.jsxs)("div",{className:"wand-new-session-permission-context","aria-live":"polite",children:[e.teamId||e.employeeId&&!e.specifiedCli?(0,n.jsx)("dl",{children:(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:"\u6A21\u578B"}),(0,n.jsx)("dd",{title:He,children:He})]})}):null,j||e.teamId||e.employeeId||e.kind==="shell"?(0,n.jsx)(u.Text,{strong:!0,className:j?"wand-new-session-permission-warning":void 0,children:Ft}):null,(0,n.jsx)(u.Paragraph,{className:"wand-new-session-permission-detail",type:j?"danger":"secondary",children:Et})]})]})}),e.teamId?(0,n.jsx)(b.Item,{label:"\u672C\u8F6E\u8BF4\u660E",htmlFor:"wand-new-session-team-note",extra:(0,n.jsx)(u.Text,{id:"wand-new-session-team-note-hint",type:"secondary",children:"\u56E2\u961F\u6309\u8FD9\u53E5\u8BDD\u62C6\u89E3\u4E0E\u9A8C\u6536\uFF1B\u5F00\u5DE5\u540E\u9996\u5C4F\u76F4\u63A5\u8FDB\u7FA4\u804A\u9875\u770B\u8FDB\u5C55\u3002"}),children:(0,n.jsx)(lt,{className:"resize-none",id:"wand-new-session-team-note",ref:v,rows:3,maxLength:4e3,required:!0,value:ae,disabled:f,"aria-describedby":"wand-new-session-team-note-hint",placeholder:"\u4E00\u53E5\u8BDD\u8BF4\u6E05\u8981\u4ED6\u4EEC\u505A\u4EC0\u4E48",onChange:t=>re(t.currentTarget.value)})}):null,(0,n.jsxs)("div",{className:`wand-new-session-primary-fields${e.kind==="shell"||e.employeeId||e.teamId?" is-single":""}`,children:[(0,n.jsxs)(b.Item,{htmlFor:"wand-new-session-cwd",label:"\u5DE5\u4F5C\u76EE\u5F55",extra:(0,n.jsx)(u.Text,{id:"wand-new-session-cwd-hint",type:"secondary",children:e.workspaceTaskId?"\u4F7F\u7528\u6240\u9009\u4EFB\u52A1\u7684\u8FD0\u884C\u76EE\u5F55\uFF1B\u5207\u6362\u4EFB\u52A1\u53EF\u66F4\u6362\u76EE\u5F55\u3002":"\u7559\u7A7A\u5219\u4F7F\u7528\u5F53\u524D\u76EE\u5F55\uFF0C\u652F\u6301\u8DEF\u5F84\u81EA\u52A8\u8865\u5168\u3002"}),children:[(0,n.jsx)(kt,{style:{width:"100%"},value:e.cwd,disabled:f||!!e.workspaceTaskId,open:q&&L.length>0,options:L.map(t=>({value:t.path,label:(0,n.jsxs)(g,{vertical:!0,children:[(0,n.jsx)(u.Text,{strong:!0,children:t.name}),(0,n.jsx)(u.Text,{type:"secondary",children:t.path})]})})),onChange:t=>d({...e,cwd:t,workspaceId:void 0}),onSelect:t=>{d({...e,cwd:t,workspaceId:void 0}),K(!1)},onFocus:()=>K(!0),onBlur:()=>K(!1),children:(0,n.jsx)(me,{id:"wand-new-session-cwd",type:"text",placeholder:Nt,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"aria-invalid":m.includes("\u76EE\u5F55")||void 0,"aria-describedby":"wand-new-session-cwd-hint"})}),l.recentPaths.length>0?(0,n.jsx)(pe,{className:"wand-new-session-recent-paths",ghost:!0,size:"small",activeKey:ie?["recent"]:[],onChange:t=>W(t.includes("recent")),items:[{key:"recent",label:`\u6700\u8FD1\u4F7F\u7528\u7684\u76EE\u5F55 \xB7 ${l.recentPaths.length}`,children:(0,n.jsx)(Fe,{wrap:!0,"aria-label":"\u6700\u8FD1\u4F7F\u7528\u7684\u5DE5\u4F5C\u76EE\u5F55",children:l.recentPaths.map(t=>(0,n.jsx)(N,{kind:e.cwd===t.path?"outline":"ghost",size:"small",disabled:f||!!e.workspaceTaskId,type:"button",title:t.path,"aria-pressed":e.cwd===t.path,onClick:()=>d({...e,cwd:t.path,workspaceId:void 0}),children:(0,n.jsx)(u.Text,{ellipsis:!0,style:{maxWidth:180},children:t.path})},t.path))})}]}):null]}),e.kind!=="shell"&&!e.employeeId&&!e.teamId?(0,n.jsx)(b.Item,{label:"\u6A21\u578B",extra:"\u9009\u62E9\u9ED8\u8BA4\u65F6\uFF0C\u6CBF\u7528\u670D\u52A1\u7AEF\u9ED8\u8BA4\u6A21\u578B\u3002",children:(0,n.jsx)(te,{value:D(e.model),options:Oe(se,e.provider).filter(t=>e.kind==="structured"||!t.value.startsWith("wand-openrouter-free/")),ariaLabel:"\u6A21\u578B",searchable:!0,searchPlaceholder:"\u641C\u7D22\u6A21\u578B",disabled:f,className:"wand-new-session-model-select",onValueChange:ve})}):null]}),e.teamId?null:(0,n.jsx)(Ct,{form:e,initialName:s.taskName,disabled:f,cwd:be,onChange:d}),(0,n.jsx)(pe,{activeKey:ye?["advanced"]:[],onChange:t=>ne(t.includes("advanced")),items:[{key:"advanced",label:"\u6267\u884C\u8BF4\u660E",children:e.teamId?(0,n.jsx)(u.Text,{type:"secondary",children:"\u56E2\u961F\u5F00\u5DE5\u4E0D\u53E6\u9009\u6A21\u5F0F\u4E0E\u6A21\u578B\uFF1A\u8D1F\u8D23\u4EBA\u62C6\u89E3\uFF0C\u6210\u5458\u5404\u7528\u81EA\u5DF1\u7684\u5458\u5DE5\u914D\u7F6E\u4E0E\u5019\u9009\u94FE\u6267\u884C\u3002"}):e.employeeId&&!e.specifiedCli?(0,n.jsx)(u.Text,{type:"secondary",children:"\u6A21\u578B\u3001\u6743\u9650\u4E0E\u5019\u9009\u987A\u5E8F\u7531\u5458\u5DE5\u914D\u7F6E\u51B3\u5B9A\u3002\u53EF\u5728\u7845\u57FA\u5458\u5DE5\u9875\u4FEE\u6539\u3002"}):e.kind!=="shell"?(0,n.jsx)(u.Text,{type:"secondary",children:Lt(e)}):(0,n.jsx)(u.Text,{type:"secondary",children:"\u7A7A\u767D\u7EC8\u7AEF\u4F7F\u7528\u670D\u52A1\u7AEF\u914D\u7F6E\u7684\u767B\u5F55 Shell\uFF0C\u4E0D\u5E94\u7528 AI \u6743\u9650\u6A21\u5F0F\u3002"})}]}),m?(0,n.jsx)(ee,{type:"error",showIcon:!0,role:"alert",title:m}):null,(0,n.jsxs)(g,{justify:"flex-end",gap:8,className:"wand-dialog-sticky-actions",children:[(0,n.jsx)(N,{kind:"ghost",type:"button",disabled:f,onClick:()=>M.close(),children:"\u53D6\u6D88"}),(0,n.jsx)(N,{className:"wand-new-session-submit",kind:"primary",type:"submit",disabled:f,children:f?e.teamId?"\u6B63\u5728\u5F00\u5DE5\u2026":"\u6B63\u5728\u542F\u52A8\u2026":e.teamId?"\u76F4\u63A5\u5F00\u5DE5":e.kind==="shell"?"\u542F\u52A8\u7A7A\u767D\u7EC8\u7AEF":e.employeeId?"\u542F\u52A8\u5458\u5DE5\u4F1A\u8BDD":"\u542F\u52A8\u4F1A\u8BDD"})]})]})}):m?(0,n.jsx)(ee,{type:"error",showIcon:!0,role:"alert",title:m,action:(0,n.jsx)(N,{kind:"primary",onClick:()=>M.open(),children:"\u91CD\u8BD5"})}):null})}export{Go as NewSessionHost};
|
|
1
|
+
import{a as mt,b as We,c as oe,d as ut,e as ft}from"./chunk-LKQKEUHR.js";import{a as lt,b as dt}from"./chunk-4OECFENI.js";import{shared35_b as gt}from"./runtime.js";import{shared36_c as pt,shared36_d as Ae,shared36_g as ct}from"./runtime.js";import{shared32_a as M,shared32_b as S}from"./runtime.js";import{shared13_a as Me}from"./runtime.js";import "./runtime.js";import{a as at}from"./chunk-XGVT4ZWT.js";import{shared49_g as we,shared49_h as it,shared49_i as st}from"./runtime.js";import{shared63_b as ge}from"./runtime.js";import{shared14_a as Re}from"./runtime.js";import{shared77_a as Ee}from"./runtime.js";import{a as rt}from"./chunk-YX475LXO.js";import{shared51_a as H}from"./runtime.js";import "./runtime.js";import{shared37_h as ue,shared37_i as nt,shared37_m as Oe}from"./runtime.js";import "./runtime.js";import{shared18_a as tt}from"./runtime.js";import{shared55_l as ot}from"./runtime.js";import "./runtime.js";import "./runtime.js";import "./runtime.js";import "./runtime.js";import{shared19_k as $e,shared19_l as Ne,shared19_m as Z,shared19_n as Se}from"./runtime.js";import "./runtime.js";import "./runtime.js";import "./runtime.js";import{shared68_c as $}from"./runtime.js";import "./runtime.js";import "./runtime.js";import{shared53_b as b}from"./runtime.js";import "./runtime.js";import "./runtime.js";import{shared10_a as fe}from"./runtime.js";import "./runtime.js";import "./runtime.js";import "./runtime.js";import{shared27_a as et}from"./runtime.js";import{shared58_a as ee}from"./runtime.js";import{shared7_C as de,shared7_Dd as u,shared7_Ed as Qe,shared7_F as qe,shared7_Fd as me,shared7_M as Pe,shared7_Md as Xe,shared7_Sc as ce,shared7__d as te,shared7_cc as Fe,shared7_ce as Ze,shared7_ld as N,shared7_od as Je,shared7_ra as Ue,shared7_vc as pe,shared7_wb as Ye,shared7_yd as g}from"./runtime.js";import{shared8_a as Ve}from"./runtime.js";import{shared9_c as G}from"./runtime.js";function wt({provider:o,mode:s,kind:l,engine:w}){return o==="codex"?"Codex \u81EA\u52A8\u6279\u51C6\u5DE5\u5177\u8C03\u7528\uFF0C\u5E76\u5173\u95ED Codex \u7684\u6C99\u76D2\u9650\u5236\u3002":o==="opencode"?s==="full-access"||s==="managed"||s==="auto-edit"?"OpenCode \u81EA\u52A8\u6279\u51C6\u672A\u663E\u5F0F\u62D2\u7EDD\u7684\u6743\u9650\u8BF7\u6C42\u3002":l==="structured"?"OpenCode \u4F7F\u7528\u81EA\u8EAB\u6743\u9650\u914D\u7F6E\uFF1B\u5BF9\u8BDD\u4E2D\u672A\u6279\u51C6\u7684\u5DE5\u5177\u8C03\u7528\u4F1A\u88AB\u62D2\u7EDD\u3002":"OpenCode \u4F7F\u7528\u81EA\u8EAB\u6743\u9650\u914D\u7F6E\uFF0C\u5728\u7EC8\u7AEF\u4E2D\u5904\u7406\u6743\u9650\u786E\u8BA4\u3002":o==="grok"?s==="full-access"||s==="managed"?"Grok \u81EA\u52A8\u6279\u51C6\u5DE5\u5177\u6743\u9650\u8BF7\u6C42\u3002":"Grok \u4F7F\u7528\u81EA\u8EAB\u6743\u9650\u914D\u7F6E\uFF1B\u9700\u8981\u786E\u8BA4\u7684\u64CD\u4F5C\u53EF\u80FD\u7B49\u5F85\u6216\u88AB\u963B\u6B62\u3002":o==="qoder"?"Qoder \u5728\u6240\u6709\u6A21\u5F0F\u4E0B\u90FD\u8DF3\u8FC7\u5DE5\u5177\u6743\u9650\u786E\u8BA4\u3002":o==="pi"?w==="sdk"?"Wand Agent \u5728 Wand \u5185\u6267\u884C\uFF0C\u4F7F\u7528\u5F53\u524D\u4F1A\u8BDD\u914D\u7F6E\u7684\u5DE5\u5177\u4E0E\u6269\u5C55\u3002":"Pi CLI \u4F7F\u7528\u81EA\u8EAB\u5DE5\u5177\u4E0E\u6269\u5C55\u914D\u7F6E\uFF1B\u8FD9\u91CC\u7684\u6A21\u5F0F\u4E0D\u4F1A\u589E\u52A0\u9010\u9879\u6743\u9650\u786E\u8BA4\u3002":o==="gemini"?s==="full-access"||s==="managed"||l==="pty"&&s==="auto-edit"?"Gemini \u81EA\u52A8\u6279\u51C6\u5168\u90E8\u5DE5\u5177\u8C03\u7528\u3002":s==="auto-edit"?"Gemini \u81EA\u52A8\u6279\u51C6\u7F16\u8F91\u5DE5\u5177\uFF1B\u5176\u4ED6\u5DE5\u5177\u4ECD\u9075\u5FAA\u81EA\u8EAB\u6743\u9650\u914D\u7F6E\u3002":l==="structured"?"Gemini \u4F7F\u7528\u81EA\u8EAB\u6743\u9650\u914D\u7F6E\uFF1B\u5BF9\u8BDD\u4E2D\u672A\u6279\u51C6\u7684\u5DE5\u5177\u8C03\u7528\u4F1A\u88AB\u62D2\u7EDD\u3002":"Gemini \u4F7F\u7528\u81EA\u8EAB\u6743\u9650\u914D\u7F6E\uFF0C\u5728\u7EC8\u7AEF\u4E2D\u5904\u7406\u6743\u9650\u786E\u8BA4\u3002":s==="full-access"?"Claude \u81EA\u52A8\u6279\u51C6\u5DE5\u5177\u6743\u9650\u8BF7\u6C42\uFF0C\u53EF\u8FDE\u7EED\u6267\u884C\u4FEE\u6539\u3002":s==="auto-edit"?"Claude \u81EA\u52A8\u6279\u51C6\u6587\u4EF6\u7F16\u8F91\uFF1B\u5176\u4ED6\u5DE5\u5177\u6309\u5F53\u524D\u4F1A\u8BDD\u6743\u9650\u7B56\u7565\u5904\u7406\u3002":s==="managed"?"Claude \u6309\u76EE\u6807\u8FDE\u7EED\u6267\u884C\uFF0C\u5E76\u81EA\u52A8\u6279\u51C6\u5DE5\u5177\u6743\u9650\u8BF7\u6C42\uFF1B\u7F3A\u5C11\u5FC5\u8981\u4FE1\u606F\u6216\u5DE5\u5177\u5931\u8D25\u65F6\u4ECD\u53EF\u80FD\u505C\u6B62\u3002":"Claude \u4FDD\u7559\u5DE5\u5177\u6267\u884C\u65B9\u5F0F\uFF0C\u64CD\u4F5C\u8BF7\u6C42\u6309\u5F53\u524D\u4F1A\u8BDD\u6743\u9650\u7B56\u7565\u5904\u7406\u3002"}function De(o){return o.kind!=="shell"&&(o.mode==="full-access"||o.mode==="managed"||o.provider==="codex"||o.provider==="qoder"||o.provider==="gemini"&&o.kind==="pty"&&o.mode==="auto-edit")}var y=G(Ve());var{Option:yt}=$;function ht(o){return o?.type&&(o.type.isSelectOption||o.type.isSelectOptGroup)}var At=(o,s)=>{let{prefixCls:l,className:w,style:e,popupClassName:d,dropdownClassName:B,children:E,dataSource:f,rootClassName:x,dropdownStyle:h,dropdownRender:m,popupRender:p,onDropdownVisibleChange:L,onOpenChange:V,styles:q,classNames:K,popupMatchSelectWidth:ye,dropdownMatchSelectWidth:ne}=o,O=qe(E),A=p||m,U=V||L,ie=ye??ne,W;O.length===1&&y.isValidElement(O[0])&&!ht(O[0])&&([W]=O);let se=W?()=>W:void 0,Y;O.length&&ht(O[0])?Y=E:Y=f?f.map(v=>{if(y.isValidElement(v))return v;switch(typeof v){case"string":return y.createElement(yt,{key:v,value:v},v);case"object":{let{value:J}=v;return y.createElement(yt,{key:J,value:J},v.text)}default:return}}):[];let{getPrefixCls:he}=y.useContext(Ue),k=he("select",l),z={...o,popupRender:A,onOpenChange:U,popupMatchSelectWidth:ie},[I,C]=Ye([K],[q],{props:z},{popup:{_default:"root"}}),ae=y.useMemo(()=>({root:Pe(`${k}-auto-complete`,w,x,I.root,{[`${k}-customize`]:W}),prefix:I.prefix,input:I.input,placeholder:I.placeholder,content:I.content,clear:I.clear,popup:{root:Pe(d,B,I.popup.root),list:I.popup.list,listItem:I.popup.listItem}}),[k,w,x,I,d,B]),re=y.useMemo(()=>({root:{...C.root,...e},input:C.input,prefix:C.prefix,placeholder:C.placeholder,content:C.content,clear:C.clear,popup:{root:{...h,...C.popup.root},list:C.popup.list,listItem:C.popup.listItem}}),[C,e,h]);return y.createElement($,{ref:s,suffixIcon:null,...de(o,["dataSource","dropdownClassName","popupClassName","onDropdownVisibleChange","onOpenChange"]),prefixCls:k,classNames:ae,styles:re,mode:$.SECRET_COMBOBOX_MODE_DO_NOT_USE,popupRender:A,onOpenChange:U,popupMatchSelectWidth:ie,getInputElement:se},Y)},Wt=y.forwardRef(At),Be=Wt;var{Option:Dt}=$,Bt=Je(Be,"popupAlign",o=>de(o,["visible"])),Le=Be;Le.Option=Dt;Le._InternalPanelDoNotUseOrYouWillBeFired=Bt;var kt=Le;var r=G(Ve(),1);function It(o,s,l){if(o.length===0)return s;if(l==="Home")return o[0];if(l==="End")return o[o.length-1];let w=Math.max(0,o.indexOf(s));return o[(w+(l==="ArrowRight"||l==="ArrowDown"?1:-1)+o.length)%o.length]}var P=G(ce(),1);function Ct({form:o,initialName:s,disabled:l,cwd:w,onChange:e}){let{groups:d,loading:B,error:E,reload:f}=gt(),x=d.flatMap(m=>m.tasks.filter(p=>!p.archived).map(p=>({task:p,group:m}))),h=x.find(({task:m})=>m.id===o.workspaceTaskId);return(0,P.jsxs)(g,{vertical:!0,gap:8,children:[(0,P.jsx)(b.Item,{label:"\u6240\u5C5E\u4EFB\u52A1",style:{marginBottom:0},children:(0,P.jsx)(te,{ariaLabel:"\u6240\u5C5E\u4EFB\u52A1",className:"wand-new-session-model-select",disabled:l,searchable:!0,searchPlaceholder:"\u641C\u7D22\u4EFB\u52A1",value:o.workspaceTaskId||(o.taskName!==void 0?"new":""),options:[{value:"",label:"\u4E0D\u5206\u7EC4"},{value:"new",label:"\u65B0\u5EFA\u4EFB\u52A1\u2026"},...o.workspaceTaskId&&!h?[{value:o.workspaceTaskId,label:o.taskName||s||"\u5F53\u524D\u4EFB\u52A1"}]:[],...x.map(({task:m,group:p})=>({value:m.id,label:m.name,group:p.workspaceName}))],onValueChange:m=>{let p=x.find(({task:L})=>L.id===m);p?e({...o,workspaceTaskId:p.task.id,workspaceId:p.task.workspaceId,taskName:void 0,cwd:p.task.worktree?.path||p.task.cwd||p.group.workspaceCwd}):(m===""||m==="new")&&e({...o,workspaceTaskId:void 0,workspaceId:h&&!h.group.synthetic&&!h.group.global?h.group.workspaceId:o.workspaceId,cwd:h?.group.workspaceCwd||w,taskName:m==="new"?o.taskName??"":void 0})}})}),o.taskName!==void 0&&!o.workspaceTaskId?(0,P.jsx)(b.Item,{label:"\u4EFB\u52A1\u540D\u79F0",htmlFor:"wand-new-session-task-name",required:!0,style:{marginBottom:0},extra:"\u5148\u521B\u5EFA\u4EFB\u52A1\uFF0C\u518D\u5728\u4EFB\u52A1\u4E2D\u542F\u52A8\u4F1A\u8BDD\u3002",children:(0,P.jsx)(me,{id:"wand-new-session-task-name",value:o.taskName,disabled:l,maxLength:200,placeholder:"\u8F93\u5165\u4EFB\u52A1\u540D\u79F0",onChange:m=>e({...o,taskName:m.currentTarget.value})})}):null,B?(0,P.jsx)("span",{role:"status",children:"\u6B63\u5728\u52A0\u8F7D\u5DF2\u6709\u4EFB\u52A1\u2026"}):null,E?(0,P.jsx)(ee,{type:"warning",title:E,action:(0,P.jsx)(N,{size:"small",onClick:()=>{f()},children:"\u91CD\u8BD5"})}):null]})}async function vt(o,s,l){if(o.workspaceTaskId||o.taskName===void 0)return o;let w=o.taskName.trim();if(!w)throw new Error("\u8BF7\u8F93\u5165\u4EFB\u52A1\u540D\u79F0\u3002");let e={name:w,cwd:s,worktree:!1},d=o.workspaceId?await l.createTask(o.workspaceId,e):await l.createStandaloneTask(e);if(!d.id)throw new Error("\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE\u65B0\u4EFB\u52A1 ID\uFF0C\u8BF7\u5237\u65B0\u4EFB\u52A1\u5217\u8868\u6838\u5BF9\u540E\u518D\u521B\u5EFA\u4F1A\u8BDD\u3002");return{...o,taskName:w,workspaceId:d.workspaceId,workspaceTaskId:d.id,cwd:d.cwd}}var n=G(ce(),1);function Tt(o){return o?Ne(Z(o.provider,o.engine)):null}var Ke=[{value:"managed",label:"\u6258\u7BA1",description:"\u6309\u76EE\u6807\u8FDE\u7EED\u6267\u884C"},{value:"full-access",label:"\u5B8C\u5168\u8BBF\u95EE",description:"\u81EA\u52A8\u786E\u8BA4\u6743\u9650"},{value:"auto-edit",label:"\u81EA\u52A8\u7F16\u8F91",description:"\u81EA\u52A8\u786E\u8BA4\u4FEE\u6539"},{value:"default",label:"\u6807\u51C6",description:"\u4F7F\u7528\u5DE5\u5177\u9ED8\u8BA4\u6743\u9650\u914D\u7F6E"},{value:"native",label:"\u539F\u751F",description:"\u4FDD\u7559\u5DE5\u5177\u539F\u751F\u6267\u884C\u65B9\u5F0F"}];function D(o){return(o??"").trim()||ue}function Lt(o){return o.kind==="pty"?"\u7EC8\u7AEF\u4F7F\u7528 PTY\uFF0C\u76F4\u63A5\u5448\u73B0\u547D\u4EE4\u884C\u5DE5\u5177\u7684\u4EA4\u4E92\u754C\u9762\u4E0E\u539F\u59CB\u8F93\u51FA\u3002":o.engine==="sdk"?"Wand Agent \u4F7F\u7528 Wand \u8FDB\u7A0B\u5185 SDK\uFF0C\u4E0D\u542F\u52A8 Pi CLI\u3002":o.provider==="codex"?"\u5BF9\u8BDD\u89E3\u6790 Codex \u7684 JSONL \u4E8B\u4EF6\u3002":o.provider==="pi"||o.provider==="opencode"?"\u5BF9\u8BDD\u89E3\u6790\u547D\u4EE4\u884C\u5DE5\u5177\u7684 JSON \u4E8B\u4EF6\u3002":o.provider==="grok"?"\u5BF9\u8BDD\u89E3\u6790 Grok \u7684 streaming-json \u4E8B\u4EF6\u3002":"\u5BF9\u8BDD\u89E3\u6790\u547D\u4EE4\u884C\u5DE5\u5177\u7684 stream-json \u4E8B\u4EF6\u3002"}function Kt({provider:o,kind:s,engine:l}){return s==="shell"?"\u65E0\u6CD5\u542F\u52A8\u7A7A\u767D\u7EC8\u7AEF\uFF0C\u8BF7\u68C0\u67E5\u670D\u52A1\u7AEF Shell \u914D\u7F6E\u3002":l==="sdk"?"\u65E0\u6CD5\u542F\u52A8 Wand Agent \u5BF9\u8BDD\uFF0C\u8BF7\u68C0\u67E5\u670D\u52A1\u7AEF Agent \u914D\u7F6E\u4E0E\u6A21\u578B\u53EF\u7528\u6027\u3002":s==="structured"?"\u65E0\u6CD5\u542F\u52A8\u5BF9\u8BDD\uFF0C\u8BF7\u68C0\u67E5\u6240\u9009\u5DE5\u5177\u662F\u5426\u53EF\u7528\u53CA\u6A21\u578B\u914D\u7F6E\u3002":o==="codex"?"\u65E0\u6CD5\u542F\u52A8 Codex \u4F1A\u8BDD\uFF0C\u8BF7\u786E\u8BA4 codex \u5DF2\u6B63\u786E\u5B89\u88C5\u5E76\u53EF\u5728\u7EC8\u7AEF\u4E2D\u6267\u884C\u3002":o==="opencode"?"\u65E0\u6CD5\u542F\u52A8 OpenCode \u4F1A\u8BDD\uFF0C\u8BF7\u786E\u8BA4 opencode-ai \u5DF2\u6B63\u786E\u5B89\u88C5\u3002":o==="grok"?"\u65E0\u6CD5\u542F\u52A8 Grok \u4F1A\u8BDD\uFF0C\u8BF7\u786E\u8BA4 Grok Build CLI \u5DF2\u6B63\u786E\u5B89\u88C5\u3002":o==="qoder"?"\u65E0\u6CD5\u542F\u52A8 Qoder \u4F1A\u8BDD\uFF0C\u8BF7\u786E\u8BA4 @qoder-ai/qodercli \u5DF2\u6B63\u786E\u5B89\u88C5\u3002":o==="pi"?"\u65E0\u6CD5\u542F\u52A8 Pi \u4F1A\u8BDD\uFF0C\u8BF7\u786E\u8BA4 Pi CLI \u5DF2\u6B63\u786E\u5B89\u88C5\u3002":o==="gemini"?"\u65E0\u6CD5\u542F\u52A8 Gemini \u4F1A\u8BDD\uFF0C\u8BF7\u786E\u8BA4 Gemini CLI \u5DF2\u6B63\u786E\u5B89\u88C5\u3002":"\u65E0\u6CD5\u542F\u52A8 Claude \u4F1A\u8BDD\uFF0C\u8BF7\u786E\u8BA4 Claude \u5DF2\u6B63\u786E\u5B89\u88C5\u3002"}function bt(o){return o.trim().replace(/\/+$/,"")||"/"}var zt=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"]);function Go({repository:o=ft}){let s=(0,r.useSyncExternalStore)(S.subscribe,S.getSnapshot,S.getSnapshot),[l,w]=(0,r.useState)(null),[e,d]=(0,r.useState)(null),[B,E]=(0,r.useState)(!1),[f,x]=(0,r.useState)(!1),h=(0,r.useRef)(!1),[m,p]=(0,r.useState)(""),[L,V]=(0,r.useState)([]),[q,K]=(0,r.useState)(!1),[ye,ne]=(0,r.useState)(!1),[O,A]=(0,r.useState)(!1),U=(0,r.useRef)(null),[ie,W]=(0,r.useState)(!1),se=at(s.open),Y=rt(s.open),{employees:he}=ot({includeArchived:!0,enabled:s.open}),[k,z]=(0,r.useState)(!1),I=(0,r.useRef)({}),C=(0,r.useRef)(null);(0,r.useEffect)(()=>{e?.employeeId&&C.current?.focus({preventScroll:!0})},[e?.employeeId]);let[ae,re]=(0,r.useState)(""),v=(0,r.useRef)(null),[J,ke]=(0,r.useState)([]),Q=!!(s.open&&e&&!e.workspaceTaskId&&e.taskName===void 0),Ie=st(Q),xt=(0,r.useMemo)(()=>Ie?.map(it)??null,[Ie]);(0,r.useEffect)(()=>{if(!s.open)return;let t=new AbortController,i=S.getRuntime();return E(!0),x(!1),p(""),w(null),d(null),V([]),K(!1),ne(!1),A(!1),W(!1),z(!1),re(""),o.load({signal:t.signal}).then(a=>{if(t.signal.aborted)return;let c=i?.getContext();w(a);let T=a.config.defaultProvider;d({provider:T,engine:T==="pi"?a.config.defaultEngine??"cli":void 0,employeeId:s.initialKind==="shell"?void 0:s.initialEmployeeId||void 0,kind:s.initialKind?s.initialKind:s.initialEmployeeId?"structured":a.config.defaultSessionKind,mode:oe(a.config.defaultProvider,a.config.defaultMode,a.config.defaultMode),cwd:s.initialCwd,worktreeEnabled:!1,model:D(c?.selectedModels?.[a.config.defaultProvider]),specifiedCli:!1,workspaceId:s.workspaceId||void 0,workspaceTaskId:s.workspaceTaskId||void 0,taskName:s.newTask?"":void 0}),c||p("\u65B0\u5EFA\u4F1A\u8BDD\u8FD0\u884C\u73AF\u5883\u5C1A\u672A\u5C31\u7EEA\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u540E\u91CD\u8BD5\u3002")}).catch(a=>{t.signal.aborted||p(fe(a,"\u65E0\u6CD5\u52A0\u8F7D\u65B0\u5EFA\u4F1A\u8BDD\u914D\u7F6E\u3002"))}).finally(()=>{t.signal.aborted||E(!1)}),()=>t.abort()},[s.initialCwd,s.initialEmployeeId,s.initialKind,s.open,s.revision,s.taskName,s.workspaceId,s.workspaceTaskId,s.newTask,o]),(0,r.useEffect)(()=>{if(!Q)return;let t=!0;return Me.list().then(i=>{t&&ke(i)},()=>{t&&ke([])}),()=>{t=!1}},[Q]),(0,r.useEffect)(()=>{if(!s.open||!e||!q)return;let t=new AbortController,i=window.setTimeout(()=>{o.suggestPaths(e.cwd,{signal:t.signal}).then(a=>{t.signal.aborted||V(a)}).catch(()=>{t.signal.aborted||V([])})},120);return()=>{window.clearTimeout(i),t.abort()}},[s.open,e?.cwd,o,q]);let Ce=(0,r.useCallback)(t=>{let i=Ne(t);if(!l||!i)return;let a=i.provider,c=i.engine,T=D(S.getRuntime()?.getContext().selectedModels?.[a]);d(F=>F&&{...F,provider:a,engine:c,kind:c==="sdk"?"structured":F.kind,model:T,mode:oe(a,F.mode,l.config.defaultMode)});let R=e?oe(a,e.mode,l.config.defaultMode):oe(a,l.config.defaultMode,l.config.defaultMode);o.savePreferences({defaultProvider:a,defaultEngine:c??"cli",defaultMode:R}).catch(F=>console.warn("[wand] Failed to persist new-session defaults",F))},[l,e,o]),ze=(0,r.useCallback)(t=>{d(i=>i&&{...i,kind:t,model:t!=="structured"&&i.model.startsWith("wand-openrouter-free/")?"default":i.model}),t!=="shell"&&o.savePreferences({defaultSessionKind:t}).catch(i=>console.warn("[wand] Failed to persist new-session defaults",i))},[o]),_e=(0,r.useCallback)(t=>{!e||!We(e.provider).includes(t)||(d(i=>i&&{...i,mode:t}),o.savePreferences({defaultMode:t}).catch(i=>console.warn("[wand] Failed to persist new-session defaults",i)))},[e,o]),ve=(0,r.useCallback)(t=>{d(i=>i&&{...i,model:t}),S.getRuntime()?.rememberModel(e?.provider??"claude",nt(t))},[e?.provider]),Te=(0,r.useMemo)(()=>e?We(e.provider):[],[e?.provider]),je=(0,r.useMemo)(()=>new Set(Te),[Te]),Nt=e?.cwd.trim()||S.getRuntime()?.getContext().effectiveCwd||l?.config.defaultCwd||"\u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55",St=e?Ke.find(t=>t.value===e.mode):void 0,X=e?.employeeId?he.find(t=>t.id===e.employeeId):null,Pt=e?.teamId?Ie?.find(t=>t.id===e.teamId)??null:null,_=X?.agents??[],j=!!(e&&!e.teamId&&(e.employeeId&&!e.specifiedCli?_.some(t=>De(t)):De(e))),Ge=e?.teamId?Pt?.name??"AI \u56E2\u961F":e?.employeeId?X?.name??"\u7845\u57FA\u5458\u5DE5":e?.kind==="shell"?"\u7A7A\u767D\u7EC8\u7AEF":Tt(e)?.label??e?.provider??"",He=!e||e.kind==="shell"?"\u4E0D\u4F7F\u7528\u6A21\u578B":e.teamId?"\u8DDF\u968F\u6210\u5458\u5458\u5DE5\u914D\u7F6E":e.employeeId&&!e.specifiedCli?_.length?_.map(t=>`${Se(t.provider,t.engine)} \xB7 ${t.model===ue?"\u670D\u52A1\u7AEF\u9ED8\u8BA4":t.model}`).join("\uFF1B"):"\u8DDF\u968F\u5458\u5DE5\u914D\u7F6E":D(e.model)===ue?"\u8DDF\u968F\u670D\u52A1\u7AEF\u9ED8\u8BA4":D(e.model),Ft=e?e.teamId?"\u8DDF\u968F\u6210\u5458\u5458\u5DE5\u914D\u7F6E":e.employeeId&&!e.specifiedCli?`\u8DDF\u968F\u5458\u5DE5\u5019\u9009\u914D\u7F6E${j?" \xB7 \u542B\u81EA\u52A8\u6388\u6743":""}`:e.kind==="shell"?"\u7CFB\u7EDF Shell \u6743\u9650":`${St?.label??"\u6807\u51C6"}${e.mode==="full-access"?" \xB7 full access":j?" \xB7 \u81EA\u52A8\u6388\u6743":""}`:"",Et=e?e.teamId?"\u8D1F\u8D23\u4EBA\u62C6\u89E3\u4EFB\u52A1\uFF0C\u5404\u6210\u5458\u4F7F\u7528\u81EA\u5DF1\u7684\u5DE5\u5177\u4E0E\u6743\u9650\u914D\u7F6E\u3002":e.employeeId&&!e.specifiedCli?_.length?_.map(t=>{let i=t.provider==="codex"?"\u5B8C\u5168\u8BBF\u95EE \xB7 full access":Ke.find(a=>a.value===t.mode)?.label??"\u6807\u51C6";return`${Se(t.provider,t.engine)} \xB7 ${i}`}).join("\uFF1B")+(_.some(t=>t.provider==="codex")?"\u3002Codex \u81EA\u52A8\u6279\u51C6\u5DE5\u5177\u8C03\u7528\u5E76\u5173\u95ED\u6C99\u76D2\u9650\u5236\uFF1B\u5DE5\u4F5C\u76EE\u5F55\u4E0D\u662F\u6743\u9650\u6C99\u76D2\u3002":j?"\u3002\u90E8\u5206\u5019\u9009\u4F7F\u7528\u81EA\u52A8\u6388\u6743\uFF0C\u542F\u52A8\u4F1A\u6CBF\u7528\u6240\u7528\u5019\u9009\u7684\u6743\u9650\uFF1B\u5DE5\u4F5C\u76EE\u5F55\u4E0D\u662F\u6743\u9650\u6C99\u76D2\u3002":"\u3002\u542F\u52A8\u4F1A\u6CBF\u7528\u6240\u7528\u5019\u9009\u7684\u6743\u9650\uFF0C\u5DE5\u4F5C\u76EE\u5F55\u4E0D\u662F\u6743\u9650\u6C99\u76D2\u3002"):"\u5458\u5DE5\u914D\u7F6E\u5C1A\u672A\u52A0\u8F7D\uFF1B\u542F\u52A8\u65F6\u4F7F\u7528\u8BE5\u5458\u5DE5\u7684\u5DE5\u5177\u4E0E\u6743\u9650\u914D\u7F6E\u3002":e.kind==="shell"?"\u76F4\u63A5\u4F7F\u7528\u7CFB\u7EDF Shell\uFF0C\u4E0D\u542F\u52A8 AI \u5DE5\u5177\uFF1B\u5DE5\u4F5C\u76EE\u5F55\u4E0D\u662F\u6743\u9650\u6C99\u76D2\u3002":`${wt(e)} \u5DE5\u4F5C\u76EE\u5F55\u4E0D\u662F\u6743\u9650\u6C99\u76D2\u3002`:"",be=e?.cwd.trim()||S.getRuntime()?.getContext().effectiveCwd||l?.config.defaultCwd||"",le=J.find(t=>bt(t.cwd)===bt(be)),xe=e?.workspaceTaskId?"":Ae(e?.workspaceId??le?.id,le?.kind);(0,r.useEffect)(()=>{!e?.teamId||xe||d(t=>t&&{...t,teamId:void 0})},[e?.teamId,xe]),(0,r.useEffect)(()=>{e?.teamId&&v.current?.focus()},[e?.teamId]);function Ot(t,i,a,c,T){if(!zt.has(t.key))return;t.preventDefault();let R=It(a,i,t.key);c(R),window.requestAnimationFrame(()=>T.current[R]?.focus())}async function Rt(t){let i=t.teamId??"";if(!i)return;let a=t.workspaceTaskId?"":Ae(t.workspaceId??le?.id,le?.kind);if(!a){p(pt);return}let c=ae.trim();if(!c){p("\u5148\u5199\u4E00\u53E5\u672C\u8F6E\u8BF4\u660E\uFF1A\u56E2\u961F\u8981\u6709\u660E\u786E\u76EE\u6807\u624D\u80FD\u5F00\u5DE5\u3002"),v.current?.focus();return}try{let T=await we.startDirect(i,{note:c,workspaceId:a}),R=T.run.chatSessionId;await we.settle("success"),ge.close(),M.close(),R?ge.open("","","teamchat",T.run.id):ge.open("","","teams"),Re()}catch(T){p(fe(T,"\u5F00\u5DE5\u5931\u8D25\uFF0C\u8BF7\u9009\u62E9\u5DF2\u6709\u9879\u76EE\u540E\u91CD\u8BD5\u3002")),await we.settle("error")}}async function Mt(t){if(t.preventDefault(),t.nativeEvent.isComposing||!e||!l||h.current)return;let i=S.getRuntime();if(!i){p("\u65B0\u5EFA\u4F1A\u8BDD\u8FD0\u884C\u73AF\u5883\u5C1A\u672A\u5C31\u7EEA\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u540E\u91CD\u8BD5\u3002");return}M.setDismissable(!1),h.current=!0,x(!0),p("");try{if(e.teamId){await Rt(e);return}let a=await vt(e,be,Me);a!==e&&(d(a),Re());let c=ut(a,l.config,i.getContext()),T=await i.prepareCreate(c.kind,c);c.kind!=="structured"&&Object.assign(c,T),o.savePreferences({...c.kind==="shell"?{}:{...e.employeeId?{}:{defaultProvider:c.provider},...c.kind==="structured"&&c.provider==="pi"?{defaultEngine:e.engine??"cli"}:{},defaultSessionKind:c.kind,defaultMode:c.mode}}).catch(F=>console.warn("[wand] Failed to persist new-session defaults",F));let R=await o.create(c);await i.completeCreate(c,R),M.close()}catch(a){p(fe(a,Kt(e)))}finally{h.current=!1,M.setDismissable(!0),x(!1)}}return(0,n.jsx)(Xe,{open:s.open,onOpenChange:t=>{t||M.close()},title:s.taskName?`\u65B0\u5BF9\u8BDD \xB7 ${s.taskName}`:"\u65B0\u5BF9\u8BDD",description:"\u5148\u9009\u62E9\u6267\u884C\u65B9\u5F0F\uFF0C\u518D\u786E\u8BA4\u6A21\u578B\u4E0E\u5DE5\u4F5C\u76EE\u5F55\u3002\u9009\u62E9\u4F1A\u8BB0\u4E3A\u4E0B\u6B21\u65B0\u5EFA\u504F\u597D\u3002",className:"wand-task-library-dialog wand-new-session-library-dialog",closeLabel:"\u5173\u95ED\u65B0\u5EFA\u4F1A\u8BDD",testId:"new-session-dialog",dismissable:!f,children:B||s.open&&Y===null?(0,n.jsx)(et,{tip:"\u6B63\u5728\u52A0\u8F7D\u65B0\u5EFA\u4F1A\u8BDD\u914D\u7F6E\u2026",children:(0,n.jsx)("div",{style:{minHeight:100},role:"status",children:"\u6B63\u5728\u52A0\u8F7D\u65B0\u5EFA\u4F1A\u8BDD\u914D\u7F6E\u2026"})}):e&&l?(0,n.jsx)(dt,{noValidate:!0,"aria-busy":f,onSubmit:t=>{Mt(t)},children:(0,n.jsxs)(g,{vertical:!0,gap:12,children:[(0,n.jsx)("section",{className:"wand-new-session-summary","aria-label":"\u6267\u884C\u8BBE\u7F6E",children:(0,n.jsxs)(g,{vertical:!0,gap:12,children:[(0,n.jsx)(b.Item,{label:"\u6267\u884C\u5BF9\u8C61",style:{marginBottom:0},children:e.employeeId?(0,n.jsxs)("div",{className:"wand-new-session-employee-section",children:[(0,n.jsxs)(g,{align:"center",justify:"space-between",gap:12,className:"wand-new-session-logo-bar",style:{padding:"8px 0",borderBottom:"1px solid var(--border-subtle)"},children:[(0,n.jsxs)(g,{align:"center",gap:12,style:{minWidth:0,flex:1},children:[(0,n.jsx)("button",{type:"button",className:"wand-new-session-logo-toggle",ref:C,title:k?"\u6536\u8D77\u5DE5\u5177\u5207\u6362":"\u5207\u6362\u6267\u884C\u5DE5\u5177\u548C\u6A21\u578B","aria-label":k?"\u6536\u8D77\u5DE5\u5177\u5207\u6362":"\u5207\u6362\u6267\u884C\u5DE5\u5177\u548C\u6A21\u578B","aria-expanded":k,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center"},onClick:t=>{t.stopPropagation(),z(!k)},children:(0,n.jsx)(Ee,{employee:X||{id:e.employeeId,name:"\u5458\u5DE5"},provider:e.specifiedCli?e.provider:void 0,size:"md"})}),(0,n.jsxs)(g,{vertical:!0,style:{minWidth:0,flex:1},children:[(0,n.jsxs)(g,{align:"center",gap:8,children:[(0,n.jsx)(u.Text,{strong:!0,ellipsis:!0,style:{fontSize:13},children:X?.name||"\u7845\u57FA\u5458\u5DE5"}),(0,n.jsx)(u.Text,{type:"secondary",style:{fontSize:12,padding:"1px 6px",borderRadius:4,background:e.specifiedCli?"var(--accent-muted)":"var(--bg-secondary)",color:e.specifiedCli?"var(--accent)":"var(--text-secondary)"},children:e.specifiedCli?"\u5DF2\u6307\u5B9A\u5DE5\u5177":"\u6309\u5458\u5DE5\u914D\u7F6E\u542F\u52A8"})]}),(0,n.jsx)(u.Text,{type:"secondary",ellipsis:!0,style:{fontSize:12},children:e.specifiedCli?`\u5DE5\u5177\uFF1A${Tt(e)?.label||e.provider} \xB7 \u6A21\u578B\uFF1A${D(e.model)}`:"\u6309\u5458\u5DE5\u914D\u7F6E\u7684\u5DE5\u5177\u4E0E\u6A21\u578B\u5019\u9009\u987A\u5E8F\u542F\u52A8"})]})]}),(0,n.jsx)(N,{kind:"ghost",size:"small",type:"button","aria-expanded":k,onClick:t=>{t.stopPropagation(),z(!k)},children:k?"\u6536\u8D77":"\u6307\u5B9A\u5DE5\u5177 / \u6A21\u578B"})]}),k?(0,n.jsxs)(g,{vertical:!0,gap:12,className:"wand-new-session-custom-cli-panel",style:{marginTop:8,padding:"8px 0"},children:[(0,n.jsx)(b.Item,{label:"\u9009\u62E9\u6267\u884C\u5DE5\u5177",style:{marginBottom:0},children:(0,n.jsx)(H.Group,{value:e.specifiedCli?Z(e.provider,e.engine):"default_dispatch",disabled:f,style:{width:"100%"},onChange:t=>{let i=t.target.value;i==="default_dispatch"?d(a=>a&&{...a,specifiedCli:!1}):(d(a=>a&&{...a,specifiedCli:!0}),Ce(i))},children:(0,n.jsxs)("div",{className:"wand-execution-subject-grid",children:[(0,n.jsx)(H,{value:"default_dispatch",children:(0,n.jsxs)(g,{align:"center",gap:8,children:[(0,n.jsx)(Ee,{employee:X||{id:e.employeeId,name:"\u5458\u5DE5"},size:"sm"}),(0,n.jsxs)(g,{vertical:!0,children:[(0,n.jsx)(u.Text,{strong:!0,children:"\u5458\u5DE5\u9ED8\u8BA4\u6D3E\u53D1"}),(0,n.jsx)(u.Text,{type:"secondary",style:{fontSize:12},children:"\u6309\u5458\u5DE5\u914D\u7F6E\u7684\u5019\u9009\u987A\u5E8F\u5C1D\u8BD5\u5DE5\u5177\u4E0E\u6A21\u578B"})]})]})}),$e.map(t=>(0,n.jsx)(H,{value:t.id,children:(0,n.jsxs)(g,{align:"center",gap:8,children:[t.engine==="sdk"?(0,n.jsx)(Qe,{name:"spark",size:18}):(0,n.jsx)(tt,{provider:t.provider,className:"wand-subject-provider"}),(0,n.jsxs)(g,{vertical:!0,children:[(0,n.jsx)(u.Text,{strong:!0,children:t.label}),(0,n.jsx)(u.Text,{type:"secondary",style:{fontSize:12},children:t.description})]})]})},t.id))]})})}),e.specifiedCli?(0,n.jsx)(b.Item,{label:"\u6307\u5B9A\u6A21\u578B",style:{marginBottom:0},extra:"\u6240\u9009\u6A21\u578B\u968F\u4F1A\u8BDD\u542F\u52A8\u4E00\u8D77\u63D0\u4EA4\uFF1B\u300C\u8DDF\u968F\u670D\u52A1\u7AEF\u9ED8\u8BA4\u300D\u6CBF\u7528\u670D\u52A1\u7AEF\u914D\u7F6E\u7684\u9ED8\u8BA4\u6A21\u578B\u3002",children:(0,n.jsx)(te,{value:D(e.model),options:Oe(se,e.provider).filter(t=>e.kind==="structured"||!t.value.startsWith("wand-openrouter-free/")),ariaLabel:"\u6A21\u578B",searchable:!0,searchPlaceholder:"\u641C\u7D22\u6A21\u578B",disabled:f,className:"wand-new-session-model-select",onValueChange:ve})}):null,(0,n.jsxs)(g,{justify:"space-between",align:"center",style:{paddingTop:4},children:[(0,n.jsx)(N,{kind:"ghost",size:"small",type:"button",onClick:()=>{d(t=>t&&{...t,employeeId:void 0,specifiedCli:void 0}),z(!1),A(!0)},children:"\u9009\u62E9\u5176\u4ED6\u6267\u884C\u8005"}),e.specifiedCli?(0,n.jsx)(N,{kind:"ghost",size:"small",type:"button",onClick:()=>{d(t=>t&&{...t,specifiedCli:!1})},children:"\u6062\u590D\u5458\u5DE5\u9ED8\u8BA4\u6D3E\u53D1"}):null]})]}):null]}):(0,n.jsx)(pe,{ref:U,className:"wand-new-session-subject-collapse",destroyOnHidden:!0,activeKey:O?["subject"]:[],onChange:t=>A(t.includes("subject")),items:[{key:"subject",label:(0,n.jsxs)(g,{justify:"space-between",align:"center",gap:12,children:[(0,n.jsx)(u.Text,{strong:!0,ellipsis:!0,title:Ge,children:Ge}),(0,n.jsx)(u.Text,{type:"secondary",children:"\u66F4\u6362\u6267\u884C\u5BF9\u8C61"})]}),children:(0,n.jsx)(mt,{selectedSubject:e.teamId?{type:"team",id:e.teamId}:e.employeeId?{type:"employee",id:e.employeeId}:{type:"cli",id:e.kind==="shell"?"shell":e.provider,...e.engine?{engine:e.engine}:{}},kind:e.kind==="shell"?"pty":e.kind,model:e.model,showModel:!1,showKind:!1,teams:Q?xt:null,teamWorkspaceId:xe,disabled:f,onSubjectChange:t=>{if(t.type!=="employee"&&U.current?.querySelector(".ant-collapse-header")?.focus({preventScroll:!0}),A(!1),t.type==="team"){d(i=>i&&{...i,teamId:t.id,employeeId:void 0,specifiedCli:void 0});return}t.type==="cli"?t.id==="shell"?d(i=>i&&{...i,teamId:void 0,employeeId:void 0,kind:"shell",specifiedCli:void 0}):(d(i=>i&&{...i,teamId:void 0,employeeId:void 0,kind:i.kind==="shell"?"pty":i.kind,specifiedCli:void 0}),Ce(Z(t.id,t.engine))):t.type==="employee"&&d(i=>i&&{...i,teamId:void 0,employeeId:t.id,kind:"structured",specifiedCli:!1})},onKindChange:t=>{t==="pty"&&d(i=>i&&{...i,teamId:void 0,employeeId:void 0,specifiedCli:void 0}),ze(t)},onModelChange:t=>ve(t)})}]})}),(0,n.jsxs)(b.Item,{label:"\u4F1A\u8BDD\u7C7B\u578B",style:{marginBottom:0},children:[(0,n.jsx)(Ze,{block:!0,"aria-label":"\u4F1A\u8BDD\u7C7B\u578B",value:e.kind==="shell"?"pty":e.kind,disabled:f,options:ct.map(t=>({value:t.value,label:(0,n.jsx)("span",{title:t.description,children:t.label})})),onChange:t=>{t==="pty"&&(d(i=>i&&{...i,teamId:void 0,employeeId:void 0,specifiedCli:void 0,engine:i.engine==="sdk"?"cli":i.engine}),e.engine==="sdk"&&Ce(Z(e.provider,"cli"))),ze(t)}}),e.employeeId||e.teamId||e.engine==="sdk"?(0,n.jsx)(u.Text,{type:"secondary",children:"\u7EC8\u7AEF\u76F4\u63A5\u4F7F\u7528\u547D\u4EE4\u884C\u5DE5\u5177\uFF1B\u5207\u6362\u540E\u4E0D\u4F7F\u7528\u5458\u5DE5\u3001\u56E2\u961F\u6216 Wand Agent\u3002"}):null]}),!e.teamId&&!(e.employeeId&&!e.specifiedCli)&&e.kind!=="shell"?(0,n.jsx)(b.Item,{label:"\u6743\u9650\u4E0E\u6267\u884C\u6A21\u5F0F",style:{marginBottom:0},children:(0,n.jsx)(H.Group,{"aria-label":"\u6267\u884C\u6A21\u5F0F",value:e.mode,disabled:f,onChange:t=>_e(t.target.value),children:(0,n.jsx)(Fe,{wrap:!0,children:Ke.filter(t=>je.has(t.value)).map(t=>(0,n.jsx)(H.Button,{value:t.value,disabled:!je.has(t.value),title:t.description,ref:i=>{I.current[t.value]=i?.input??null},onKeyDown:i=>Ot(i,e.mode,Te,_e,I),children:t.label},t.value))})})}):null,(0,n.jsxs)("div",{className:"wand-new-session-permission-context","aria-live":"polite",children:[e.teamId||e.employeeId&&!e.specifiedCli?(0,n.jsx)("dl",{children:(0,n.jsxs)("div",{children:[(0,n.jsx)("dt",{children:"\u6A21\u578B"}),(0,n.jsx)("dd",{title:He,children:He})]})}):null,j||e.teamId||e.employeeId||e.kind==="shell"?(0,n.jsx)(u.Text,{strong:!0,className:j?"wand-new-session-permission-warning":void 0,children:Ft}):null,(0,n.jsx)(u.Paragraph,{className:"wand-new-session-permission-detail",type:j?"danger":"secondary",children:Et})]})]})}),e.teamId?(0,n.jsx)(b.Item,{label:"\u672C\u8F6E\u8BF4\u660E",htmlFor:"wand-new-session-team-note",extra:(0,n.jsx)(u.Text,{id:"wand-new-session-team-note-hint",type:"secondary",children:"\u56E2\u961F\u6309\u8FD9\u53E5\u8BDD\u62C6\u89E3\u4E0E\u9A8C\u6536\uFF1B\u5F00\u5DE5\u540E\u9996\u5C4F\u76F4\u63A5\u8FDB\u7FA4\u804A\u9875\u770B\u8FDB\u5C55\u3002"}),children:(0,n.jsx)(lt,{className:"resize-none",id:"wand-new-session-team-note",ref:v,rows:3,maxLength:4e3,required:!0,value:ae,disabled:f,"aria-describedby":"wand-new-session-team-note-hint",placeholder:"\u4E00\u53E5\u8BDD\u8BF4\u6E05\u8981\u4ED6\u4EEC\u505A\u4EC0\u4E48",onChange:t=>re(t.currentTarget.value)})}):null,(0,n.jsxs)("div",{className:`wand-new-session-primary-fields${e.kind==="shell"||e.employeeId||e.teamId?" is-single":""}`,children:[(0,n.jsxs)(b.Item,{htmlFor:"wand-new-session-cwd",label:"\u5DE5\u4F5C\u76EE\u5F55",extra:(0,n.jsx)(u.Text,{id:"wand-new-session-cwd-hint",type:"secondary",children:e.workspaceTaskId?"\u4F7F\u7528\u6240\u9009\u4EFB\u52A1\u7684\u8FD0\u884C\u76EE\u5F55\uFF1B\u5207\u6362\u4EFB\u52A1\u53EF\u66F4\u6362\u76EE\u5F55\u3002":"\u7559\u7A7A\u5219\u4F7F\u7528\u5F53\u524D\u76EE\u5F55\uFF0C\u652F\u6301\u8DEF\u5F84\u81EA\u52A8\u8865\u5168\u3002"}),children:[(0,n.jsx)(kt,{style:{width:"100%"},value:e.cwd,disabled:f||!!e.workspaceTaskId,open:q&&L.length>0,options:L.map(t=>({value:t.path,label:(0,n.jsxs)(g,{vertical:!0,children:[(0,n.jsx)(u.Text,{strong:!0,children:t.name}),(0,n.jsx)(u.Text,{type:"secondary",children:t.path})]})})),onChange:t=>d({...e,cwd:t,workspaceId:void 0}),onSelect:t=>{d({...e,cwd:t,workspaceId:void 0}),K(!1)},onFocus:()=>K(!0),onBlur:()=>K(!1),children:(0,n.jsx)(me,{id:"wand-new-session-cwd",type:"text",placeholder:Nt,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"aria-invalid":m.includes("\u76EE\u5F55")||void 0,"aria-describedby":"wand-new-session-cwd-hint"})}),l.recentPaths.length>0?(0,n.jsx)(pe,{className:"wand-new-session-recent-paths",ghost:!0,size:"small",activeKey:ie?["recent"]:[],onChange:t=>W(t.includes("recent")),items:[{key:"recent",label:`\u6700\u8FD1\u4F7F\u7528\u7684\u76EE\u5F55 \xB7 ${l.recentPaths.length}`,children:(0,n.jsx)(Fe,{wrap:!0,"aria-label":"\u6700\u8FD1\u4F7F\u7528\u7684\u5DE5\u4F5C\u76EE\u5F55",children:l.recentPaths.map(t=>(0,n.jsx)(N,{kind:e.cwd===t.path?"outline":"ghost",size:"small",disabled:f||!!e.workspaceTaskId,type:"button",title:t.path,"aria-pressed":e.cwd===t.path,onClick:()=>d({...e,cwd:t.path,workspaceId:void 0}),children:(0,n.jsx)(u.Text,{ellipsis:!0,style:{maxWidth:180},children:t.path})},t.path))})}]}):null]}),e.kind!=="shell"&&!e.employeeId&&!e.teamId?(0,n.jsx)(b.Item,{label:"\u6A21\u578B",extra:"\u9009\u62E9\u9ED8\u8BA4\u65F6\uFF0C\u6CBF\u7528\u670D\u52A1\u7AEF\u9ED8\u8BA4\u6A21\u578B\u3002",children:(0,n.jsx)(te,{value:D(e.model),options:Oe(se,e.provider).filter(t=>e.kind==="structured"||!t.value.startsWith("wand-openrouter-free/")),ariaLabel:"\u6A21\u578B",searchable:!0,searchPlaceholder:"\u641C\u7D22\u6A21\u578B",disabled:f,className:"wand-new-session-model-select",onValueChange:ve})}):null]}),e.teamId?null:(0,n.jsx)(Ct,{form:e,initialName:s.taskName,disabled:f,cwd:be,onChange:d}),(0,n.jsx)(pe,{activeKey:ye?["advanced"]:[],onChange:t=>ne(t.includes("advanced")),items:[{key:"advanced",label:"\u6267\u884C\u8BF4\u660E",children:e.teamId?(0,n.jsx)(u.Text,{type:"secondary",children:"\u56E2\u961F\u5F00\u5DE5\u4E0D\u53E6\u9009\u6A21\u5F0F\u4E0E\u6A21\u578B\uFF1A\u8D1F\u8D23\u4EBA\u62C6\u89E3\uFF0C\u6210\u5458\u5404\u7528\u81EA\u5DF1\u7684\u5458\u5DE5\u914D\u7F6E\u4E0E\u5019\u9009\u94FE\u6267\u884C\u3002"}):e.employeeId&&!e.specifiedCli?(0,n.jsx)(u.Text,{type:"secondary",children:"\u6A21\u578B\u3001\u6743\u9650\u4E0E\u5019\u9009\u987A\u5E8F\u7531\u5458\u5DE5\u914D\u7F6E\u51B3\u5B9A\u3002\u53EF\u5728\u7845\u57FA\u5458\u5DE5\u9875\u4FEE\u6539\u3002"}):e.kind!=="shell"?(0,n.jsx)(u.Text,{type:"secondary",children:Lt(e)}):(0,n.jsx)(u.Text,{type:"secondary",children:"\u7A7A\u767D\u7EC8\u7AEF\u4F7F\u7528\u670D\u52A1\u7AEF\u914D\u7F6E\u7684\u767B\u5F55 Shell\uFF0C\u4E0D\u5E94\u7528 AI \u6743\u9650\u6A21\u5F0F\u3002"})}]}),m?(0,n.jsx)(ee,{type:"error",showIcon:!0,role:"alert",title:m}):null,(0,n.jsxs)(g,{justify:"flex-end",gap:8,className:"wand-dialog-sticky-actions",children:[(0,n.jsx)(N,{kind:"ghost",type:"button",disabled:f,onClick:()=>M.close(),children:"\u53D6\u6D88"}),(0,n.jsx)(N,{className:"wand-new-session-submit",kind:"primary",type:"submit",disabled:f,children:f?e.teamId?"\u6B63\u5728\u5F00\u5DE5\u2026":"\u6B63\u5728\u542F\u52A8\u2026":e.teamId?"\u76F4\u63A5\u5F00\u5DE5":e.kind==="shell"?"\u542F\u52A8\u7A7A\u767D\u7EC8\u7AEF":e.employeeId?"\u542F\u52A8\u5458\u5DE5\u4F1A\u8BDD":"\u542F\u52A8\u4F1A\u8BDD"})]})]})}):m?(0,n.jsx)(ee,{type:"error",showIcon:!0,role:"alert",title:m,action:(0,n.jsx)(N,{kind:"primary",onClick:()=>M.open(),children:"\u91CD\u8BD5"})}):null})}export{Go as NewSessionHost};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{shared80_a as w}from"./runtime.js";import{shared53_b as n}from"./runtime.js";import "./runtime.js";import "./runtime.js";import{shared83_d as l,shared83_e as f}from"./runtime.js";import{shared70_a as y}from"./runtime.js";import "./runtime.js";import{shared58_a as m}from"./runtime.js";import{shared7_Dd as r,shared7_Fd as c,
|
|
1
|
+
import{shared80_a as w}from"./runtime.js";import{shared53_b as n}from"./runtime.js";import "./runtime.js";import "./runtime.js";import{shared83_d as l,shared83_e as f}from"./runtime.js";import{shared70_a as y}from"./runtime.js";import "./runtime.js";import{shared58_a as m}from"./runtime.js";import{shared7_Dd as r,shared7_Fd as c,shared7_Md as u,shared7_Sc as p,shared7_ce as v,shared7_ld as s,shared7_yd as d}from"./runtime.js";import{shared8_a as g}from"./runtime.js";import{shared9_c as i}from"./runtime.js";var h=i(g(),1);var e=i(p(),1),b=[{value:"url",label:"Web \u670D\u52A1"},{value:"file",label:"\u672C\u5730\u6587\u4EF6"}];function x({mode:o,onMode:t}){return(0,e.jsx)(v,{className:"wand-local-preview-modes","aria-label":"\u9884\u89C8\u7C7B\u578B",value:o,options:b.map(a=>({value:a.value,label:a.label})),onChange:a=>t(a)})}function C(){let o=(0,h.useSyncExternalStore)(l.subscribe,l.getSnapshot,l.getSnapshot);function t(a){a.preventDefault(),l.submit()}return(0,e.jsxs)(u,{open:o.open,onOpenChange:a=>{a||l.close()},title:"\u672C\u5730\u9884\u89C8",description:"\u628A\u672C\u673A HTTP \u670D\u52A1\u6216 HTML \u76EE\u5F55\u5B89\u5168\u5730\u663E\u793A\u5728 Wand \u5F53\u524D\u9875\u9762\u3002",className:"wand-local-preview-content",width:{xs:"calc(100vw - 16px)",md:960,xl:1180},styles:{body:{display:"flex",flexDirection:"column",gap:12,height:"min(75dvh, 760px)",minHeight:0}},closeLabel:"\u5173\u95ED\u9884\u89C8",children:[(0,e.jsxs)(n,{noValidate:!0,layout:"vertical",className:"wand-local-preview-form",onSubmitCapture:t,children:[(0,e.jsx)(x,{mode:o.mode,onMode:a=>l.setMode(a)}),(0,e.jsx)(n.Item,{className:"wand-local-preview-field",label:o.mode==="url"?"\u7AEF\u53E3\u6216\u5730\u5740":"\u6587\u4EF6 / \u76EE\u5F55",style:{marginBlock:12},children:(0,e.jsx)(c,{"aria-label":o.mode==="url"?"\u7AEF\u53E3\u6216\u5730\u5740":"\u6587\u4EF6 / \u76EE\u5F55","data-wand-autofocus":!0,value:o.value,placeholder:o.mode==="url"?"3000 \u6216 localhost:3000/path":"/path/to/dist/index.html",onChange:a=>l.setValue(a.currentTarget.value)})}),o.error&&(0,e.jsx)(m,{className:"wand-local-preview-error",type:"error",showIcon:!0,title:o.error}),(0,e.jsx)(d,{className:"wand-local-preview-actions",gap:"small",children:(0,e.jsx)(s,{kind:"primary",type:"submit",size:"small",children:o.previewUrl?"\u91CD\u65B0\u6253\u5F00":"\u6253\u5F00\u9884\u89C8"})})]}),o.previewUrl?(0,e.jsx)("iframe",{className:"wand-local-preview-frame",style:{flex:1,minHeight:0,width:"100%",border:0},src:o.previewUrl,title:`\u672C\u5730\u9884\u89C8\uFF1A${o.sourceLabel}`,sandbox:f},o.previewUrl):(0,e.jsx)(w,{className:"wand-local-preview-empty",style:{flex:1,minHeight:0},styles:{body:{display:"grid",placeItems:"center",height:"100%"}},children:(0,e.jsx)(y,{description:(0,e.jsxs)(r.Text,{type:"secondary",children:["\u8F93\u5165\u5F00\u53D1\u670D\u52A1\u7AEF\u53E3\uFF0C\u4F8B\u5982 ",(0,e.jsx)(r.Text,{code:!0,children:"3000"}),"\uFF1B\u4E5F\u53EF\u4EE5\u9009\u62E9\u4E00\u4E2A\u5305\u542B ",(0,e.jsx)(r.Text,{code:!0,children:"index.html"})," \u7684\u76EE\u5F55\u3002"]})})})]})}export{C as LocalPreviewHost};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{shared42_a as u}from"./runtime.js";import{shared15_d as C}from"./runtime.js";import "./runtime.js";import{shared58_a as v}from"./runtime.js";import{shared7_Ac as P,
|
|
1
|
+
import{shared42_a as u}from"./runtime.js";import{shared15_d as C}from"./runtime.js";import "./runtime.js";import{shared58_a as v}from"./runtime.js";import{shared7_Ac as P,shared7_Md as I,shared7_Sc as w,shared7_ld as E}from"./runtime.js";import{shared8_a as F}from"./runtime.js";import{shared9_c as y}from"./runtime.js";var r=y(F(),1);function T(t,n,a){return C(`/api/sessions/${encodeURIComponent(t)}/pi-execution/${encodeURIComponent(n)}`,{credentials:"same-origin",cache:"no-store",signal:a})}var e=y(w(),1),j={pending:"\u5F85\u6267\u884C",running:"\u6267\u884C\u4E2D",background:"\u5DF2\u6D3E\u53D1\u540E\u53F0",completed:"\u5DF2\u5B8C\u6210",failed:"\u5931\u8D25",paused:"\u5DF2\u6682\u505C",stopped:"\u5DF2\u505C\u6B62",detached:"\u5DF2\u8131\u79BB",rejected:"\u672A\u901A\u8FC7",skipped:"\u5DF2\u8DF3\u8FC7",partial:"\u90E8\u5206\u5B8C\u6210",unknown:"\u72B6\u6001\u672A\u77E5"},b=new Set(["pending","running","background"]);function S({state:t}){return(0,e.jsx)(P,{className:`pi-execution-state is-${t}`,color:t==="completed"?"success":t==="failed"||t==="rejected"?"error":b.has(t)?"processing":void 0,children:j[t]})}function $(t){return t<1e3?`${Math.round(t)} ms`:`${(t/1e3).toFixed(1)} s`}function O({node:t}){if(!t)return(0,e.jsx)("p",{className:"pi-execution-empty",children:"\u6267\u884C\u5668\u5C1A\u672A\u63D0\u4F9B\u5B50\u4EFB\u52A1\u6E05\u5355\u3002"});let n=[["\u5458\u5DE5",t.agent],["\u6A21\u578B",t.model],["\u9636\u6BB5",t.phase],["\u8FD0\u884C ID",t.runId],["\u5F53\u524D\u5DE5\u5177",t.currentTool],["\u8017\u65F6",t.durationMs===void 0?void 0:$(t.durationMs)],["Tokens",t.tokens],["\u5DE5\u5177\u8C03\u7528",t.toolCount]];return(0,e.jsxs)("section",{className:"pi-execution-detail","aria-label":"\u5B50\u4EFB\u52A1\u8BE6\u60C5",children:[(0,e.jsx)("h3",{children:t.label}),(0,e.jsx)(S,{state:t.state}),(0,e.jsx)("dl",{children:n.filter(([,a])=>a!==void 0).map(([a,p])=>(0,e.jsxs)(r.Fragment,{children:[(0,e.jsx)("dt",{children:a}),(0,e.jsx)("dd",{children:p})]},String(a)))}),t.task&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("h4",{children:"\u4EFB\u52A1"}),(0,e.jsx)("pre",{children:t.task})]}),t.error&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("h4",{children:"\u9519\u8BEF"}),(0,e.jsx)("pre",{className:"pi-execution-error",children:t.error})]}),t.output&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("h4",{children:"\u6700\u8FD1\u8F93\u51FA"}),(0,e.jsx)("pre",{children:t.output})]})]})}function q({target:t}){let[n,a]=r.useState(null),[p,k]=r.useState(""),[g,R]=r.useState(!0),[A,L]=r.useState(0),[W,M]=r.useState("");r.useEffect(()=>{let o=!1,i,d,f=0;async function h(){let x=++f;d?.abort(),d=new AbortController,R(!0);try{let l=await T(t.sessionId,t.toolId,d.signal);if(o||x!==f)return;a(l),k(""),l.snapshot&&!l.notice&&(b.has(l.snapshot.state)||l.snapshot.nodes.some(D=>b.has(D.state)))&&(i=setTimeout(()=>{document.hidden||h()},2e3))}catch(l){!o&&x===f&&k(l instanceof Error?l.message:"\u8BFB\u53D6\u6267\u884C\u7ED3\u6784\u5931\u8D25")}finally{!o&&x===f&&R(!1)}}let N=()=>{document.hidden||(clearTimeout(i),d?.abort(),h())};return h(),document.addEventListener("visibilitychange",N),()=>{o=!0,clearTimeout(i),d?.abort(),document.removeEventListener("visibilitychange",N)}},[t.sessionId,t.toolId,A]);let s=n?.snapshot,c=s?.nodes??[],m=c.find(o=>o.id===W)??c.find(o=>o.state==="running")??c[0],B=[...new Set(c.map(o=>o.phase??"\u5B50\u4EFB\u52A1"))];return(0,e.jsxs)("div",{className:"pi-execution-window-body",children:[(0,e.jsxs)("div",{className:"pi-execution-toolbar",children:[(0,e.jsx)("span",{children:s?`${s.source==="status-file"?"\u540E\u53F0\u8FD0\u884C\u5FEB\u7167":s.source==="tool-progress"?"\u5DE5\u5177\u8FDB\u5EA6\u5FEB\u7167":"\u5DE5\u5177\u7ED3\u679C\u5FEB\u7167"} \xB7 ${s.mode}`:"\u8BFB\u53D6\u771F\u5B9E\u6267\u884C\u6570\u636E"}),(0,e.jsx)(E,{size:"small",disabled:g,onClick:()=>L(o=>o+1),children:g?"\u8BFB\u53D6\u4E2D\u2026":"\u5237\u65B0"})]}),p&&(0,e.jsx)(v,{role:"alert",type:"error",title:`${p}${n?"\uFF08\u4FDD\u7559\u4E0A\u6B21\u5FEB\u7167\uFF09":""}`}),n?.notice&&(0,e.jsx)(v,{role:"status",type:"info",title:n.notice}),s&&(0,e.jsxs)("div",{className:"pi-execution-root",children:[(0,e.jsx)("strong",{children:s.name??(s.mode==="workflow"?"\u5DE5\u4F5C\u6D41":"\u5B50 Agent \u6267\u884C")}),(0,e.jsx)(S,{state:s.state}),s.runId&&(0,e.jsx)("code",{children:s.runId}),(0,e.jsxs)("span",{children:[c.filter(o=>o.kind!=="parallel-group"&&o.kind!=="dynamic-parallel-group").length," \u4E2A\u8282\u70B9 \xB7 ",s.inventoryComplete?"\u6E05\u5355\u5DF2\u7ED3\u675F":"\u6E05\u5355\u4ECD\u53EF\u80FD\u589E\u52A0"]})]}),(0,e.jsxs)("div",{className:"pi-execution-layout",children:[(0,e.jsxs)("nav",{className:"pi-execution-tree","aria-label":"\u6267\u884C\u7ED3\u6784",children:[B.map(o=>(0,e.jsxs)("section",{children:[(0,e.jsx)("h3",{children:o}),c.filter(i=>(i.phase??"\u5B50\u4EFB\u52A1")===o).map(i=>(0,e.jsxs)(E,{kind:i.id===m?.id?"soft":"ghost",className:`pi-execution-node${i.id===m?.id?" is-selected":""}`,"aria-pressed":i.id===m?.id,onClick:()=>M(i.id),children:[i.parentId&&(0,e.jsxs)("small",{children:["\u21B3 ",c.find(d=>d.id===i.parentId)?.label??i.parentId]}),(0,e.jsx)("strong",{children:i.label}),(0,e.jsx)(S,{state:i.state}),i.agent&&i.agent!==i.label&&(0,e.jsx)("small",{children:i.agent})]},i.id))]},o)),!c.length&&(0,e.jsx)("p",{className:"pi-execution-empty",children:g?"\u6B63\u5728\u8BFB\u53D6\u5B50\u4EFB\u52A1\u2026":"\u6682\u65E0\u53EF\u786E\u8BA4\u7684\u5B50\u4EFB\u52A1"}),!!s?.omittedNodes&&(0,e.jsxs)("p",{children:["\u53E6\u6709 ",s.omittedNodes," \u4E2A\u8282\u70B9\u672A\u663E\u793A"]})]}),(0,e.jsx)(O,{node:m})]}),!!s?.trace.length&&(0,e.jsxs)("section",{className:"pi-execution-evidence",children:[(0,e.jsx)("h3",{children:"\u8C03\u7528\u8F68\u8FF9"}),(0,e.jsx)("p",{children:"\u6309\u6267\u884C\u5668\u8BB0\u5F55\u7684\u4E8B\u4EF6\u987A\u5E8F\u5C55\u793A\uFF1B\u987A\u5E8F\u4E0D\u4EE3\u8868\u4EFB\u52A1\u4F9D\u8D56\u3002"}),(0,e.jsx)("ol",{children:s.trace.map((o,i)=>(0,e.jsxs)("li",{children:[(0,e.jsxs)("code",{children:[o.operation," ",o.key]})," ",(0,e.jsx)("span",{children:o.state}),o.durationMs!==void 0&&(0,e.jsx)("small",{children:$(o.durationMs)}),o.error&&(0,e.jsx)("pre",{children:o.error})]},i))}),!!s.omittedTrace&&(0,e.jsxs)("p",{children:["\u53E6\u6709 ",s.omittedTrace," \u6761\u8F83\u65E9\u4E8B\u4EF6\u672A\u663E\u793A"]})]}),n&&(0,e.jsxs)("section",{className:"pi-execution-evidence",children:[(0,e.jsx)("h3",{children:n.script?"\u7F16\u6392\u811A\u672C":"\u6D3E\u53D1\u53C2\u6570"}),!n.script&&!!n.input.workflow&&(0,e.jsxs)("p",{children:["\u811A\u672C\u6765\u6E90\uFF1A",String(n.input.workflow),"\u3002\u672C\u6B21\u6570\u636E\u672A\u5305\u542B\u811A\u672C\u6B63\u6587\u3002"]}),(0,e.jsx)("pre",{children:n.script??JSON.stringify(n.input,null,2)})]})]})}function Q(){let t=r.useSyncExternalStore(u.subscribe,u.getSnapshot,u.getSnapshot),n=r.useRef(null);return t&&(n.current=t.trigger),(0,e.jsx)(I,{open:!!t,title:"\u6267\u884C\u7ED3\u6784",description:"\u67E5\u770B Pi \u5B9E\u9645\u6D3E\u53D1\u7684\u5B50\u4EFB\u52A1\u3001\u9636\u6BB5\u3001\u8FD0\u884C\u72B6\u6001\u4E0E\u7F16\u6392\u4F9D\u636E\u3002",onAfterClose:()=>{!u.isOpen()&&n.current?.isConnected&&n.current.focus({preventScroll:!0})},className:"wand-pi-execution-content",closeLabel:"\u5173\u95ED\u6267\u884C\u7ED3\u6784",onOpenChange:a=>{a||u.close()},children:t&&(0,e.jsx)(q,{target:t},`${t.sessionId}:${t.toolId}`)})}export{Q as PiExecutionHost};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{shared45_a as w}from"./runtime.js";import{shared57_a as i}from"./runtime.js";import{shared7_Ed as m,
|
|
1
|
+
import{shared45_a as w}from"./runtime.js";import{shared57_a as i}from"./runtime.js";import{shared7_Ed as m,shared7_Kd as v,shared7_Sc as b,shared7_Yc as h,shared7_yd as g}from"./runtime.js";import{shared8_a as C}from"./runtime.js";import{shared9_c as d}from"./runtime.js";var l=d(C(),1);var t=d(b(),1);function S(){let s=(0,l.useSyncExternalStore)(i.subscribe,i.getSnapshot,i.getSnapshot),p=h(),c=(0,l.useRef)(null),f=(0,l.useRef)(()=>{});return v(s.open,()=>i.close()),(0,l.useEffect)(()=>{if(!s.open||!p)return;let n={"switch-prev":"\u4E0A\u4E00\u5F20\u56FE\u7247","switch-next":"\u4E0B\u4E00\u5F20\u56FE\u7247","actions-action-zoomIn":"\u653E\u5927\u56FE\u7247","actions-action-zoomOut":"\u7F29\u5C0F\u56FE\u7247"},r=()=>{for(let[e,a]of Object.entries(n)){let u=p.querySelector(`.wand-image-viewer .ant-image-preview-${e}`);u?.setAttribute("aria-label",a),u?.setAttribute("title",a)}};r();let o=new MutationObserver(r);return o.observe(p,{childList:!0,subtree:!0}),()=>o.disconnect()},[s.open,p]),(0,t.jsx)(w.PreviewGroup,{items:s.items.map(n=>({src:n.src,alt:n.label})),classNames:{popup:{root:"wand-image-viewer"}},styles:{popup:{root:{pointerEvents:"auto"},mask:{background:"var(--bg-terminal)"},footer:{maxWidth:"calc(100vw - 24px)",bottom:"max(24px, env(safe-area-inset-bottom))"}}},preview:{open:s.open,current:s.current,alt:s.label,getContainer:p,onOpenChange:n=>{n||i.close()},afterOpenChange:n=>{n||i.afterClosed()},onChange:n=>{c.current=null,i.select(n)},closeIcon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m,{name:"close"}),(0,t.jsx)("span",{className:"sr-only",children:"\u5173\u95ED\u56FE\u7247\u9884\u89C8"})]}),icons:{prev:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m,{name:"chevronLeft"}),(0,t.jsx)("span",{className:"sr-only",children:"\u4E0A\u4E00\u5F20"})]}),next:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m,{name:"chevron"}),(0,t.jsx)("span",{className:"sr-only",children:"\u4E0B\u4E00\u5F20"})]})},countRender:(n,r)=>(0,t.jsxs)("span",{role:"status","aria-live":"polite",className:"wand-image-viewer-caption",children:[s.label," \xB7 ",n," / ",r]}),actionsRender:(n,{actions:r,icons:o})=>(f.current=r.onActive,(0,t.jsxs)(g,{gap:"small",children:[o.zoomOutIcon,o.zoomInIcon]})),imageRender:(n,{transform:r})=>(0,t.jsx)("div",{"data-testid":"image-viewer-dialog",style:{display:"contents"},onTouchStartCapture:o=>{let e=o.touches[0];c.current=o.touches.length===1&&r.scale===1&&s.items.length>1?{id:e.identifier,x:e.clientX,y:e.clientY,endX:e.clientX,endY:e.clientY}:null},onTouchMove:o=>{let e=c.current;if(!e)return;let a=o.touches[0];if(o.touches.length!==1||a.identifier!==e.id||r.scale!==1){c.current=null;return}e.endX=a.clientX,e.endY=a.clientY},onTouchEnd:o=>{let e=c.current;if(c.current=null,!e||o.touches.length||r.scale!==1)return;let a=Array.from(o.changedTouches).find(y=>y.identifier===e.id),u=(a?.clientX??e.endX)-e.x,x=(a?.clientY??e.endY)-e.y;Math.abs(u)>=48&&Math.abs(u)>Math.abs(x)*1.5&&f.current(u<0?1:-1)},onTouchCancel:()=>{c.current=null},children:n})}})}export{S as ImageViewerHost};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as V}from"./chunk-YOXXNXOX.js";import{shared81_a as L,shared81_b as _,shared81_c as z,shared81_d as N}from"./runtime.js";import{shared82_e as q}from"./runtime.js";import{shared65_l as B,shared65_n as Q}from"./runtime.js";import "./runtime.js";import "./runtime.js";import "./runtime.js";import "./runtime.js";import "./runtime.js";import{shared26_a as j}from"./runtime.js";import{shared70_a as O}from"./runtime.js";import{shared27_a as K}from"./runtime.js";import{shared58_a as W}from"./runtime.js";import{shared7_Dd as I,shared7_Ed as R,shared7_Fd as A,shared7_Sc as $,
|
|
1
|
+
import{a as V}from"./chunk-YOXXNXOX.js";import{shared81_a as L,shared81_b as _,shared81_c as z,shared81_d as N}from"./runtime.js";import{shared82_e as q}from"./runtime.js";import{shared65_l as B,shared65_n as Q}from"./runtime.js";import "./runtime.js";import "./runtime.js";import "./runtime.js";import "./runtime.js";import "./runtime.js";import{shared26_a as j}from"./runtime.js";import{shared70_a as O}from"./runtime.js";import{shared27_a as K}from"./runtime.js";import{shared58_a as W}from"./runtime.js";import{shared7_Dd as I,shared7_Ed as R,shared7_Fd as A,shared7_Sc as $,shared7_ee as D,shared7_hd as H,shared7_ld as b,shared7_md as k,shared7_yd as E}from"./runtime.js";import{shared8_a as P}from"./runtime.js";import{shared9_c as F}from"./runtime.js";var x=F(P(),1),h=F(P(),1);var X=`.wand-code-editor-host[hidden]{display:none!important}.wand-code-editor-body{position:relative;flex:1 1 auto;min-height:0;overflow:hidden;display:flex;background:var(--bg-primary, #fff)}.wand-code-editor-lines{flex:0 0 auto;margin:0;padding:12px 8px 12px 12px;text-align:right;color:var(--text-muted, #999);font-family:var(--font-mono, ui-monospace, monospace);line-height:1.55;white-space:pre;user-select:none;overflow:hidden;tab-size:2}.wand-code-editor-area{position:relative;flex:1 1 auto;min-width:0;overflow:auto}.wand-code-editor-markdown{flex:1 1 auto;min-width:0;min-height:0;overflow:auto;background:var(--bg-primary, #fff);overscroll-behavior:contain}.wand-code-editor-markdown:focus-visible{outline:2px solid var(--accent, #2563eb);outline-offset:-2px}.wand-code-editor-content,.wand-code-editor-textarea{margin:0;padding:12px 14px;border:0;font-family:var(--font-mono, ui-monospace, monospace);font-size:inherit;line-height:1.55;white-space:pre;tab-size:2;word-break:normal;overflow-wrap:normal}.wand-code-editor-content{position:absolute;inset:0;pointer-events:none;color:var(--text-primary, #111);overflow:hidden;scrollbar-gutter:stable}.wand-code-editor-content code{font-family:inherit}.wand-code-editor-textarea{position:absolute;inset:0;width:100%;height:100%;background:transparent;color:transparent;caret-color:var(--text-primary, #111);resize:none;outline:none;overflow:auto;scrollbar-gutter:stable}.wand-code-editor-textarea::selection{background:var(--selection-bg)}.wand-code-editor-host.wrap .wand-code-editor-content,.wand-code-editor-host.wrap .wand-code-editor-textarea{white-space:pre-wrap;overflow-wrap:break-word}.wand-code-editor-content .wand-file-preview-syntax-keyword{color:var(--syntax-keyword)}.wand-code-editor-content .wand-file-preview-syntax-string{color:var(--syntax-string)}.wand-code-editor-content .wand-file-preview-syntax-number{color:var(--syntax-number)}.wand-code-editor-content .wand-file-preview-syntax-comment{color:var(--syntax-comment);font-style:italic}.wand-code-editor-content .wand-file-preview-syntax-operator{color:var(--syntax-operator)}.wand-code-editor-content mark.wand-code-editor-hit{background:var(--find-highlight-bg);color:inherit;border-radius:2px}.wand-code-editor-content mark.wand-code-editor-hit.active{background:var(--find-active-bg);box-shadow:0 0 0 1px var(--warning)}
|
|
2
2
|
`;var t=F($(),1);function s(e){z.execute(e)}function J(e,a){let u=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),d=a;for(let c=u.nextNode();c;c=u.nextNode()){let l=c.textContent?.length??0;if(d>=l){d-=l;continue}let i=e.ownerDocument.createRange();i.setStart(c,Math.min(d,l)),i.setEnd(c,Math.min(d+1,l));let o=i.getBoundingClientRect();return o.height>0||o.width>0?o:null}return null}function U({content:e,ranges:a,activeRange:u}){let d=Q(e);if(a.length===0)return(0,t.jsx)("code",{children:d.map((o,v)=>o.kind?(0,t.jsx)("span",{className:`wand-file-preview-syntax-${o.kind}`,children:o.value},v):(0,t.jsx)(h.Fragment,{children:o.value},v))});let c=[],l=0,i=0;return d.forEach((o,v)=>{let f=l,p=l+o.value.length;for(l=p;i<a.length&&a[i].end<=f;)i+=1;let w=[],m=f;for(let n=i;n<a.length&&a[n].start<p;n+=1){let r=a[n],y=Math.max(r.start,f),g=Math.min(r.end,p);y>m&&w.push({value:e.slice(m,y),hit:-1}),g>y&&w.push({value:e.slice(y,g),hit:n}),m=Math.max(m,g)}m<p&&w.push({value:e.slice(m,p),hit:-1}),w.forEach((n,r)=>{let y=n.hit>=0?(0,t.jsx)("mark",{className:`wand-code-editor-hit${n.hit===u?" active":""}`,children:n.value}):n.value,g=`${v}-${r}`;c.push(o.kind?(0,t.jsx)("span",{className:`wand-file-preview-syntax-${o.kind}`,children:y},g):(0,t.jsx)(h.Fragment,{children:y},g))})}),(0,t.jsx)("code",{children:c})}var S="wand-code-editor-panel";function Y({snapshot:e,editorRef:a,ranges:u,activeRange:d}){let c=(0,h.useRef)(null),l=(0,h.useRef)(null);if((0,h.useEffect)(()=>{let f=a.current,p=c.current,w=u[d];if(!f||!p||!w)return;let m=J(p,w.start);if(!m)return;let n=p.getBoundingClientRect(),r=m.top-n.top+p.scrollTop,y=m.left-n.left+p.scrollLeft;f.scrollTop=Math.max(0,r-f.clientHeight/2+m.height/2),f.scrollLeft=Math.max(0,y-f.clientWidth/2+m.width/2)},[a,u,d]),e.status==="loading")return(0,t.jsxs)(E,{id:S,align:"center",justify:"center",gap:"small",style:{flex:1},className:"wand-code-editor-state",role:"status",children:[(0,t.jsx)(K,{size:"small","aria-hidden":"true"}),"\u6B63\u5728\u6253\u5F00\u6587\u4EF6\u2026"]});if(e.status==="error")return(0,t.jsxs)(E,{id:S,vertical:!0,align:"center",justify:"center",gap:"small",style:{flex:1},className:"wand-code-editor-state error",role:"alert",children:[(0,t.jsx)(R,{name:"warning",size:20}),(0,t.jsx)("strong",{children:e.failure?.message||"\u6253\u5F00\u6587\u4EF6\u5931\u8D25"}),e.activePath?(0,t.jsx)(b,{kind:"ghost",size:"small",onClick:()=>{z.open(e.activePath)},children:"\u91CD\u65B0\u52A0\u8F7D"}):null]});let i=e.file;if(!i)return(0,t.jsx)(E,{id:S,justify:"center",align:"center",style:{flex:1},children:(0,t.jsx)(O,{className:"wand-code-editor-state",description:"\u9009\u62E9\u6587\u4EF6\u540E\u5C06\u5728\u8FD9\u91CC\u7F16\u8F91\u3002"})});if(e.preview&&B(i))return(0,t.jsx)("div",{id:S,className:"wand-code-editor-markdown",tabIndex:0,"aria-label":`${i.name} \u9884\u89C8`,children:(0,t.jsx)(q,{content:i.draft,fontSize:e.fontSize,wrap:e.wrap})});let o=i.draft,v=Math.max(1,o.split(`
|
|
3
3
|
`).length);return(0,t.jsxs)("div",{id:S,className:"wand-code-editor-body",style:{fontSize:`${e.fontSize}px`},children:[(0,t.jsx)("pre",{ref:l,className:"wand-code-editor-lines","aria-hidden":"true",style:{fontSize:`${e.fontSize}px`},children:Array.from({length:v},(f,p)=>p+1).join(`
|
|
4
4
|
`)}),(0,t.jsxs)("div",{className:"wand-code-editor-area",children:[(0,t.jsx)("pre",{ref:c,className:"wand-code-editor-content","aria-hidden":"true",children:(0,t.jsx)(U,{content:o,ranges:u,activeRange:d})}),(0,t.jsx)("textarea",{ref:a,className:"resize-none wand-code-editor-textarea","aria-label":`\u7F16\u8F91 ${i.name}`,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,wrap:"off",value:o,onChange:f=>s({type:"change",value:f.currentTarget.value}),onKeyDown:f=>ee(f,o),onScroll:f=>{let p=f.currentTarget,w=c.current;w&&(w.scrollTop=p.scrollTop,w.scrollLeft=p.scrollLeft);let m=l.current;m&&(m.scrollTop=p.scrollTop)}})]})]})}function Z({snapshot:e,matchCount:a,activeIndex:u,activeLine:d,inputRef:c}){let l=e.findQuery.length>0,i=a>L;return(0,t.jsxs)(E,{wrap:!0,align:"center",gap:"small",className:"wand-code-editor-find",style:{padding:"4px 12px",flexShrink:0},children:[(0,t.jsx)(R,{name:"search",size:14}),(0,t.jsx)(A,{ref:c,className:"wand-code-editor-find-input",style:{flex:"1 1 180px",minWidth:0,maxWidth:320},inputSize:"sm",type:"text",value:e.findQuery,"aria-label":"\u5728\u6587\u4EF6\u4E2D\u67E5\u627E",placeholder:"\u5728\u6587\u4EF6\u4E2D\u67E5\u627E",autoComplete:"off",spellCheck:!1,onChange:o=>s({type:"find.set",query:o.currentTarget.value}),onKeyDown:o=>{o.nativeEvent.isComposing||o.key==="Enter"&&(o.preventDefault(),s({type:"find.step",delta:o.shiftKey?-1:1}))}}),(0,t.jsx)(I.Text,{type:l&&a===0?"danger":"secondary",className:`wand-code-editor-find-count${l&&a===0?" empty":""}`,title:i?"\u5339\u914D\u8FC7\u591A\uFF0C\u53EA\u9AD8\u4EAE\u5F53\u524D\u9879":void 0,"aria-live":"polite",children:l?a===0?"\u65E0\u7ED3\u679C":`${u+1}/${a}`:""}),l&&d!==null?(0,t.jsxs)(I.Text,{type:"secondary",className:"wand-code-editor-find-line",children:["\u7B2C ",d," \u884C"]}):null,(0,t.jsx)(k,{title:"\u4E0A\u4E00\u4E2A\u5339\u914D (\u21E7\u21B5)","aria-label":"\u4E0A\u4E00\u4E2A\u5339\u914D",disabled:a===0,onClick:()=>s({type:"find.step",delta:-1}),children:"\u2191"}),(0,t.jsx)(k,{title:"\u4E0B\u4E00\u4E2A\u5339\u914D (\u21B5)","aria-label":"\u4E0B\u4E00\u4E2A\u5339\u914D",disabled:a===0,onClick:()=>s({type:"find.step",delta:1}),children:"\u2193"}),(0,t.jsx)(k,{kind:e.findCaseSensitive?"primary":"ghost",title:"\u533A\u5206\u5927\u5C0F\u5199","aria-label":"\u533A\u5206\u5927\u5C0F\u5199","aria-pressed":e.findCaseSensitive,onClick:()=>s({type:"find.case.toggle"}),children:"Aa"}),(0,t.jsx)(k,{title:"\u5173\u95ED\u67E5\u627E (Esc)","aria-label":"\u5173\u95ED\u67E5\u627E",onClick:()=>s({type:"find.close"}),children:(0,t.jsx)(R,{name:"close",size:12})})]})}function ee(e,a){if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()==="s"){e.preventDefault(),e.stopPropagation(),s({type:"save"});return}if(e.key==="Tab"){if(e.nativeEvent.isComposing)return;e.preventDefault();let u=e.currentTarget,d=u.selectionStart,c=u.selectionEnd,l=`${a.slice(0,d)} ${a.slice(c)}`;s({type:"change",value:l}),requestAnimationFrame(()=>{u.selectionStart=d+2,u.selectionEnd=d+2});return}}function ge(){let e=(0,h.useSyncExternalStore)(N.subscribe,N.getSnapshot,N.getSnapshot),a=(0,h.useRef)(null),u=(0,h.useRef)(null),d=(0,h.useRef)(!1),c=e.file,l=c?B(c):!1,i=l&&e.preview,o=c?.draft??"",v=x.useMemo(()=>{if(!e.findOpen||!e.findQuery)return{count:0,ranges:[],activeRange:-1,activeIndex:-1};let n=_(o,e.findQuery,{caseSensitive:e.findCaseSensitive});if(n.length===0)return{count:0,ranges:[],activeRange:-1,activeIndex:-1};let r=Math.min(Math.max(e.findIndex,0),n.length-1);return n.length>L?{count:n.length,ranges:[n[r]],activeRange:0,activeIndex:r}:{count:n.length,ranges:n,activeRange:r,activeIndex:r}},[e.findOpen,e.findQuery,e.findCaseSensitive,e.findIndex,o]);(0,h.useEffect)(()=>{let n=d.current&&!e.saving;d.current=e.saving,n&&e.status==="ready"&&document.activeElement===document.body&&a.current?.focus()},[e.saving,e.status]),(0,h.useEffect)(()=>{if(e.findOpen){let n=u.current;n?.focus(),n?.select();return}e.status!=="ready"||!e.file||document.activeElement?.getAttribute("role")!=="tab"&&a.current?.focus()},[e.findOpen,e.activePath,e.status,e.preview]),(0,h.useEffect)(()=>{if(e.status!=="ready")return;let n=a.current;n&&(n.scrollTop=0)},[e.activePath,e.status]);function f(){i&&s({type:"preview.toggle"}),s({type:"find.open"})}function p(n){let r=document.activeElement;z.execute({type:"close",path:n}).then(y=>{y||requestAnimationFrame(()=>{let g=document.activeElement,M=a.current?.closest(".wand-code-editor-host");r instanceof HTMLElement&&r.isConnected&&(g===document.body||g&&M?.contains(g))&&r.focus({preventScroll:!0})})})}function w(n){if(!n.nativeEvent.isComposing){if((n.ctrlKey||n.metaKey)&&n.key.toLowerCase()==="f"){n.preventDefault(),n.stopPropagation();let r=a.current,y=r&&r.selectionEnd>r.selectionStart?r.value.slice(r.selectionStart,r.selectionEnd):"";f(),y&&!y.includes(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{shared71_a as tc,shared71_b as qi,shared71_c as Wt,shared71_e as Rc,shared71_g as Nc,shared71_h as kc,shared71_i as $a,shared71_j as $c,shared71_l as Gc}from"./runtime.js";import{shared75_a as xl}from"./runtime.js";import{shared76_a as qc}from"./runtime.js";import{shared77_a as bc}from"./runtime.js";import{shared79_a as tr}from"./runtime.js";import{shared80_a as nc}from"./runtime.js";import{a as Wc,b as Uc}from"./chunk-YX475LXO.js";import{shared50_a as Vc}from"./runtime.js";import{shared51_a as ko}from"./runtime.js";import{shared61_a as Wi,shared61_b as wc}from"./runtime.js";import{shared72_a as We,shared72_b as so,shared72_c as et,shared72_d as Rt,shared72_e as mn,shared72_f as At,shared72_g as Ae,shared72_h as To,shared72_i as ot}from"./runtime.js";import{shared78_a as gc,shared78_b as hc}from"./runtime.js";import{shared37_a as xc,shared37_c as Zo,shared37_d as vc,shared37_e as Ui,shared37_f as er,shared37_g as Cc,shared37_h as Ec,shared37_o as Vi}from"./runtime.js";import{shared17_l as zi,shared17_q as uc,shared17_s as pc,shared17_v as fc}from"./runtime.js";import{shared18_a as dc}from"./runtime.js";import{shared55_e as mc,shared55_l as Sc}from"./runtime.js";import{shared20_a as sc,shared20_b as Hi,shared20_c as lc,shared20_d as cc}from"./runtime.js";import "./runtime.js";import "./runtime.js";import{shared38_b as Bi,shared38_d as _i}from"./runtime.js";import{shared19_a as la,shared19_b as bl,shared19_e as yl,shared19_k as Sl,shared19_n as wl}from"./runtime.js";import{shared15_c as yc,shared15_d as co,shared15_e as Dr}from"./runtime.js";import{shared46_a as Pc,shared46_b as Dc,shared46_c as Ic,shared46_d as Mc,shared46_e as Oc,shared46_f as or,shared46_g as Ac,shared46_h as Lc,shared46_i as Kc,shared46_j as Fc,shared46_k as Bc,shared46_l as _c,shared46_m as Hc,shared46_n as zc}from"./runtime.js";import{shared56_a as Tc,shared56_b as nr}from"./runtime.js";import "./runtime.js";import "./runtime.js";import "./runtime.js";import{shared23_a as Fi}from"./runtime.js";import{shared67_a as rc}from"./runtime.js";import{shared68_a as oc,shared68_b as Na}from"./runtime.js";import "./runtime.js";import{shared25_b as ec}from"./runtime.js";import{shared53_b as wa}from"./runtime.js";import "./runtime.js";import{shared24_a as ma,shared24_e as Bl}from"./runtime.js";import{shared6_a as ka}from"./runtime.js";import{shared10_b as kt}from"./runtime.js";import{shared11_b as bt,shared11_c as le,shared11_d as Ki}from"./runtime.js";import{shared26_a as ic}from"./runtime.js";import{shared70_a as lo}from"./runtime.js";import{shared27_a as ac}from"./runtime.js";import{shared58_a as ha}from"./runtime.js";import{shared7_$ as kl,shared7_$a as Il,shared7_$c as xa,shared7_$d as Ra,shared7_A as Un,shared7_Aa as Uo,shared7_Ac as Jo,shared7_Ad as Jl,shared7_Ba as Tl,shared7_C as no,shared7_Ca as Vo,shared7_D as Rn,shared7_Db as ba,shared7_Dd as Li,shared7_Ea as qo,shared7_Eb as ya,shared7_Ed as Xt,shared7_F as ua,shared7_Fb as Fl,shared7_G as No,shared7_Ga as Go,shared7_Gd as Ql,shared7_H as zo,shared7_K as Mi,shared7_Ld as Zl,shared7_M as O,shared7_Nc as Vl,shared7_Nd as Ea,shared7_Qa as oo,shared7_Sa as ro,shared7_Sc as Et,shared7_Ta as Mn,shared7_U as Nl,shared7_V as Nn,shared7_Va as jo,shared7_Wa as Pl,shared7_Wb as Sa,shared7_X as St,shared7_Y as He,shared7_Ya as Dl,shared7_Yb as On,shared7_Z as kr,shared7_Za as ao,shared7_Zb as Pr,shared7__ as pa,shared7__c as ql,shared7_a as lt,shared7_ad as Gl,shared7_b as vl,shared7_ba as Wo,shared7_bb as Ml,shared7_cb as Ol,shared7_cc as _l,shared7_d as Mt,shared7_db as Al,shared7_dd as jl,shared7_ed as Xl,shared7_f as Wn,shared7_g as sn,shared7_ga as $r,shared7_h as _o,shared7_ha as fa,shared7_hd as va,shared7_i as ca,shared7_j as Cl,shared7_k as da,shared7_kd as Ai,shared7_la as $l,shared7_ld as wt,shared7_m as Ti,shared7_ma as Je,shared7_md as $o,shared7_n as El,shared7_oa as B,shared7_p as Pi,shared7_qa as Tr,shared7_qc as Hl,shared7_r as Ho,shared7_ra as fn,shared7_rc as zl,shared7_s as Rl,shared7_sa as Vn,shared7_sb as Ll,shared7_sc as Wl,shared7_ta as qn,shared7_tb as Kl,shared7_ub as kn,shared7_v as pt,shared7_va as ga,shared7_vb as Oi,shared7_vc as Xo,shared7_vd as Yl,shared7_w as Di,shared7_wb as io,shared7_wc as Yo,shared7_wd as Ca,shared7_x as Ii,shared7_y as Ot,shared7_yc as Ul,shared7_yd as Qo,shared7_z as ln}from"./runtime.js";import{shared8_a as _}from"./runtime.js";import{shared9_c as D,shared9_d as oe}from"./runtime.js";var jc=D(_());var Xc=t=>{let[e,n]=(0,jc.useState)(null);return[lt((r,a,s)=>{let i=e??r,l=Math.min(i||0,r),c=Math.max(i||0,r),d=a.slice(l,c+1).map(t),p=d.some(u=>!s.has(u)),f=[];return d.forEach(u=>{p?(s.has(u)||f.push(u),s.add(u)):(s.delete(u),f.push(u))}),n(p?c:null),f}),n]};var Yc=D(_()),qf=(t,e)=>(t._antProxy=t._antProxy||{},Object.keys(e).forEach(n=>{if(!(n in t._antProxy)){let o=t[n];t._antProxy[n]=o,t[n]=e[n]}}),t),Jc=(t,e)=>(0,Yc.useImperativeHandle)(t,()=>{let n=e(),{nativeElement:o}=n;return typeof Proxy<"u"?new Proxy(o,{get(r,a){return n[a]?n[a]:Reflect.get(r,a)}}):qf(o,n)});var Qc=D(_());var Zc=t=>{let e=Qc.useRef(t),[,n]=ma();return[()=>e.current,o=>{e.current=o,n()}]};var Gf=`.wand-theme-picker{display:grid;grid-template-columns:repeat(auto-fit,minmax(104px,1fr));gap:8px;width:100%}.wand-theme-choice.ant-radio-wrapper{display:flex;align-items:flex-start;margin:0;padding:10px 8px;border:1px solid var(--border-subtle);border-radius:var(--radius-sm);background:var(--bg-surface)}.wand-theme-choice.ant-radio-wrapper-checked{border-color:var(--border-focus);background:var(--accent-muted)}.wand-theme-choice.ant-radio-wrapper:hover{border-color:var(--border-focus)}.wand-theme-choice.ant-radio-wrapper:focus-within{outline:2px solid var(--border-focus);outline-offset:2px}.wand-theme-choice>.ant-radio{margin-top:2px}.wand-theme-choice>span:last-child{flex:1;min-width:0;padding-inline-end:0}.wand-theme-preview{display:block;position:relative;height:34px;border:1px solid;border-radius:3px;overflow:hidden;margin-bottom:7px}.wand-theme-preview-sidebar{position:absolute;inset:0 auto 0 0;width:23%}.wand-theme-preview-lines{position:absolute;inset:8px 8px 8px 34%;display:flex;flex-direction:column;gap:4px}.wand-theme-preview-lines i{display:block;width:90%;height:2px;background:currentColor;opacity:.65}.wand-theme-preview-lines i:last-child{width:60%}.wand-theme-preview-selection{position:absolute;left:3px;top:9px;width:calc(23% - 6px);height:5px;border-radius:1px}.wand-theme-choice-label{display:flex;flex-wrap:wrap;gap:0 6px;font-size:12px;line-height:18px}.wand-theme-choice-status{color:var(--accent);min-height:18px;font-weight:500}.ant-modal:has(.wand-settings-library-nested-dialog){width:min(800px,calc(100vw - var(--wand-safe-left, 0px) - var(--wand-safe-right, 0px) - 32px))!important;max-width:100%}.wand-settings-library-overview{flex-shrink:0}.wand-settings-library-nested-dialog .ant-modal-body{max-height:72dvh;overflow:auto}.wand-settings-library-overview,.wand-settings-library-toggle-row,.wand-settings-library-download-row,.wand-settings-library-update-deck,.wand-settings-library-group-members li,.wand-settings-library-system-ai-owner{display:flex;align-items:center;justify-content:space-between;gap:12px}.wand-settings-library-overview{flex-wrap:wrap;font-size:12px;color:var(--text-secondary)}.wand-settings-library-overview-pills,.wand-settings-library-button-row,.wand-settings-library-group-custom,.wand-settings-library-group-tools{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.wand-settings-library-app-access,.wand-settings-library-panel,.wand-settings-library-section-body,.wand-settings-library-preset-list,.wand-settings-library-group-content{display:flex;flex-direction:column;gap:16px;min-width:0}.wand-settings-library-panel-heading h2,.wand-settings-library-panel-heading p,.wand-settings-library-section p{margin:0}.wand-settings-library-toggle-row>div:not(.wand-ui-switch-row),.wand-settings-library-download-row>div,.wand-settings-library-update-deck>div{display:flex;flex-direction:column;gap:4px;min-width:0}.wand-settings-library-toggle-row>.wand-ui-switch-row{flex-shrink:0}.wand-settings-library-group-members{padding:0;margin:0;list-style:none}.wand-settings-library-group-member-name{flex:1;min-width:0;overflow-wrap:anywhere}.wand-settings-library-group-custom>.ant-input{flex:1;min-width:120px}.wand-settings-library-system-ai-owner{align-items:flex-start;justify-content:flex-start}.wand-settings-library-system-ai-chain{padding-inline-start:24px}.wand-settings-library-route-rank{margin-inline-end:8px}.wand-settings-library-env-value,.wand-settings-library-default-summary,.wand-settings-library-connect-code,.wand-settings-library-section a,.wand-settings-library-preset-list code{overflow-wrap:anywhere}.wand-settings-library-connect-code-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.wand-settings-library-env-toolbar,.wand-settings-library-app-access-form{display:flex;gap:16px;align-items:center;flex-wrap:wrap;margin-bottom:16px}.wand-settings-library-page-heading{min-height:var(--wand-page-header-height,56px);box-sizing:border-box;padding:8px var(--wand-page-inset,20px);gap:8px 16px;background:var(--bg-primary)}.wand-settings-library-page-title{gap:8px}.wand-settings-library-page-title .wand-ui-icon-button{width:var(--wand-page-toolbar-height,36px);min-height:var(--wand-page-toolbar-height,36px);padding:0;flex-shrink:0}.wand-settings-library-page-heading h1{font-size:var(--wand-page-title-size,18px)}.wand-settings-library-page .wand-settings-library-directory{width:100%;max-width:1160px;margin-inline:auto;min-width:0;border:0;background:transparent;box-sizing:border-box;padding:16px var(--wand-page-inset,20px) 24px;container:wandsettingsdirectory / inline-size}.wand-settings-library-directory .wand-settings-library-search{max-width:560px;padding-inline:0;background:var(--bg-primary)}.wand-settings-library-directory .ant-menu-root>.ant-menu-item-group{min-width:0}.wand-settings-library-directory .ant-menu-item{min-height:44px;padding-block:8px}.wand-settings-library-nav-copy{gap:2px}.wand-settings-library-page[data-compact=true] .wand-settings-library-directory .ant-menu-item{min-height:52px}.wand-settings-library-detail-content{width:100%;max-width:1120px;box-sizing:border-box;margin-inline:auto;padding:20px var(--wand-page-inset,20px) 28px;container:wandsettings / inline-size}.wand-settings-library-page[data-compact=true] .wand-settings-library-page-heading{padding:8px var(--wand-page-inset,12px)}.wand-settings-library-page[data-compact=true] .wand-settings-library-detail-content{padding:16px var(--wand-page-inset,12px) 24px}.wand-settings-library-page[data-compact=true] .wand-settings-library-page-title .wand-ui-icon-button{min-height:var(--wand-page-toolbar-height,36px)}.wand-settings-library-panel-heading{gap:4px;padding-bottom:16px;margin-bottom:0}.wand-settings-library-panel-heading h2{font-size:18px}.wand-settings-library-panel-heading p{font-size:13px;line-height:1.55}.wand-settings-library-panel{gap:16px}.wand-settings-library-section{min-width:0;padding:20px 0;border:0;border-top:1px solid var(--border-subtle);background:transparent}.wand-settings-library-section-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}.wand-settings-library-section-heading h3{margin:0;font-size:14px;font-weight:600}.wand-settings-library-section>p{margin-bottom:16px;color:var(--text-secondary);font-size:13px;line-height:1.55}.wand-settings-library-panel-heading h2{display:none}.wand-settings-library-directory .ant-menu-item{margin:0;width:100%;border-radius:var(--radius-sm);min-height:64px}.wand-settings-library-directory .ant-menu-item-group-title{font-weight:600;padding-inline:16px}.wand-settings-library-nav-copy>span:first-child{font-weight:500}.wand-settings-library-nav-item>svg{display:block;transform:rotate(-90deg)}.wand-settings-library-nav-description{font-size:13px}.wand-settings-library-panel{gap:0}.wand-settings-library-panel>.wand-settings-library-save-bar{padding-top:16px}.wand-settings-library-section-body{gap:16px;container:wandsettingsfields / inline-size}.wand-settings-library-section-body>.ant-btn{align-self:flex-start;max-width:100%;height:auto;min-height:32px;white-space:normal}.wand-settings-library-section-heading{flex-wrap:wrap}.wand-settings-library-toggle-row{padding-block:4px;align-items:flex-start}.wand-settings-library-toggle-row>div:first-child{flex:1;overflow-wrap:anywhere}.wand-settings-library-toggle-row strong{font-size:14px;font-weight:500;line-height:1.5}.wand-settings-library-toggle-row>div:first-child>span{color:var(--text-secondary);font-size:13px;line-height:1.6}.wand-settings-library-toggle-row .wand-ui-switch-row{margin-top:2px}.wand-settings-library-panel-heading p,.wand-settings-library-section p,.wand-settings-library-field .ant-form-item-label>label{overflow-wrap:anywhere}.wand-settings-library-field .ant-form-item-label>label{height:auto}.wand-settings-library-update-deck{justify-content:flex-start}.wand-settings-library-update-deck>div{flex:1}.wand-settings-library-update-deck-icon,.wand-settings-library-update-channel{flex-shrink:0}.wand-settings-library-about-list>div{display:flex;align-items:baseline;justify-content:space-between;gap:16px}.wand-settings-library-about-overview>.wand-settings-library-section{flex:1 1 480px;min-width:0}.wand-settings-library-about-downloads>.wand-settings-library-section{flex:1 1 280px;min-width:0}.wand-settings-library-version-table .ant-table-cell{overflow-wrap:anywhere}.wand-settings-library-cli-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(280px,100%),1fr));gap:0 24px}.wand-settings-library-cli-item{min-width:0;padding-block:8px;border-bottom:1px solid var(--border-subtle)}.wand-settings-library-cli-item>span{min-width:0;overflow-wrap:anywhere;text-align:end;font-variant-numeric:tabular-nums}.wand-settings-library-connect{display:flex;flex-direction:column;gap:16px}.wand-settings-library-grid,.wand-settings-library-default-row{grid-template-columns:minmax(0,1fr);gap:12px 16px}.wand-settings-library-field .ant-form-item-label{padding-bottom:4px}.wand-settings-library-field .ant-form-item-explain{font-size:12px;line-height:1.5}.wand-settings-library-secret-toggle.ant-btn{height:24px;min-height:24px;padding-inline:6px;font-size:12px}.wand-settings-library-system-ai-owner-copy{min-width:0;overflow-wrap:anywhere}.wand-settings-library-system-ai-chain{list-style:none;padding:0;margin:8px 0}.wand-settings-library-system-ai-chain li{padding-block:3px;font-size:13px}.wand-settings-library-page[data-wide=true][data-detail=true] .wand-settings-library-directory{width:224px;max-width:224px;margin:0;padding:16px 12px 24px;border-inline-end:1px solid var(--border-subtle)}.wand-settings-library-page[data-wide=true][data-detail=true] .wand-settings-library-directory .ant-menu-item{min-height:40px;padding-block:8px}.wand-settings-library-page[data-wide=true][data-detail=true] .wand-settings-library-nav-description,.wand-settings-library-page[data-wide=true][data-detail=true] .wand-settings-library-nav-item>svg{display:none}.wand-settings-library-page[data-wide=true][data-detail=true] .wand-settings-library-directory .ant-menu-item-group-title{padding-top:16px}@container wandsettingsdirectory (min-width:800px){.wand-settings-library-directory .ant-menu-root{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));column-gap:24px;align-items:start}.wand-settings-library-directory .ant-menu-root:before,.wand-settings-library-directory .ant-menu-root:after{display:none}}@container wandsettings (min-width:820px){:is(.wand-settings-library-panel,.wand-settings-library-detail-content)>.wand-settings-library-section{display:grid;grid-template-columns:192px minmax(0,1fr);grid-template-rows:min-content minmax(0,1fr);column-gap:24px;align-content:start}:is(.wand-settings-library-panel,.wand-settings-library-detail-content)>.wand-settings-library-section>.wand-settings-library-section-heading{grid-column:1;grid-row:1;align-items:flex-start;margin-bottom:8px}:is(.wand-settings-library-panel,.wand-settings-library-detail-content)>.wand-settings-library-section>p{grid-column:1;grid-row:2;align-self:start;margin-bottom:0}:is(.wand-settings-library-panel,.wand-settings-library-detail-content)>.wand-settings-library-section>.wand-settings-library-section-body{grid-column:2;grid-row:1 / span 2;width:100%}}@container wandsettingsfields (min-width:560px){.wand-settings-library-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@container wandsettingsfields (min-width:620px){.wand-settings-library-default-row{grid-template-columns:repeat(3,minmax(0,1fr))}}@container wandsettingsfields (min-width:640px){.wand-settings-library-connect{display:grid;grid-template-columns:220px minmax(0,1fr);gap:16px 24px;align-items:start}.wand-settings-library-connect-qr{grid-column:1;grid-row:1 / span 3}.wand-settings-library-connect>:not(.wand-settings-library-connect-qr){grid-column:2}}@media(pointer:coarse){.wand-settings-library-secret-toggle.ant-btn{min-height:32px;min-width:44px}}
|
|
1
|
+
import{shared71_a as tc,shared71_b as qi,shared71_c as Wt,shared71_e as Rc,shared71_g as Nc,shared71_h as kc,shared71_i as $a,shared71_j as $c,shared71_l as Gc}from"./runtime.js";import{shared75_a as xl}from"./runtime.js";import{shared76_a as qc}from"./runtime.js";import{shared77_a as bc}from"./runtime.js";import{shared79_a as tr}from"./runtime.js";import{shared80_a as nc}from"./runtime.js";import{a as Wc,b as Uc}from"./chunk-YX475LXO.js";import{shared50_a as Vc}from"./runtime.js";import{shared51_a as ko}from"./runtime.js";import{shared61_a as Wi,shared61_b as wc}from"./runtime.js";import{shared72_a as We,shared72_b as so,shared72_c as et,shared72_d as Rt,shared72_e as mn,shared72_f as At,shared72_g as Ae,shared72_h as To,shared72_i as ot}from"./runtime.js";import{shared78_a as gc,shared78_b as hc}from"./runtime.js";import{shared37_a as xc,shared37_c as Zo,shared37_d as vc,shared37_e as Ui,shared37_f as er,shared37_g as Cc,shared37_h as Ec,shared37_o as Vi}from"./runtime.js";import{shared17_l as zi,shared17_q as uc,shared17_s as pc,shared17_v as fc}from"./runtime.js";import{shared18_a as dc}from"./runtime.js";import{shared55_e as mc,shared55_l as Sc}from"./runtime.js";import{shared20_a as sc,shared20_b as Hi,shared20_c as lc,shared20_d as cc}from"./runtime.js";import "./runtime.js";import "./runtime.js";import{shared38_b as Bi,shared38_d as _i}from"./runtime.js";import{shared19_a as la,shared19_b as bl,shared19_e as yl,shared19_k as Sl,shared19_n as wl}from"./runtime.js";import{shared15_c as yc,shared15_d as co,shared15_e as Dr}from"./runtime.js";import{shared46_a as Pc,shared46_b as Dc,shared46_c as Ic,shared46_d as Mc,shared46_e as Oc,shared46_f as or,shared46_g as Ac,shared46_h as Lc,shared46_i as Kc,shared46_j as Fc,shared46_k as Bc,shared46_l as _c,shared46_m as Hc,shared46_n as zc}from"./runtime.js";import{shared56_a as Tc,shared56_b as nr}from"./runtime.js";import "./runtime.js";import "./runtime.js";import "./runtime.js";import{shared23_a as Fi}from"./runtime.js";import{shared67_a as rc}from"./runtime.js";import{shared68_a as oc,shared68_b as Na}from"./runtime.js";import "./runtime.js";import{shared25_b as ec}from"./runtime.js";import{shared53_b as wa}from"./runtime.js";import "./runtime.js";import{shared24_a as ma,shared24_e as Bl}from"./runtime.js";import{shared6_a as ka}from"./runtime.js";import{shared10_b as kt}from"./runtime.js";import{shared11_b as bt,shared11_c as le,shared11_d as Ki}from"./runtime.js";import{shared26_a as ic}from"./runtime.js";import{shared70_a as lo}from"./runtime.js";import{shared27_a as ac}from"./runtime.js";import{shared58_a as ha}from"./runtime.js";import{shared7_$ as kl,shared7_$a as Il,shared7_$c as xa,shared7_A as Un,shared7_Aa as Uo,shared7_Ac as Jo,shared7_Ad as Jl,shared7_Ba as Tl,shared7_C as no,shared7_Ca as Vo,shared7_D as Rn,shared7_Db as ba,shared7_Dd as Li,shared7_Ea as qo,shared7_Eb as ya,shared7_Ed as Xt,shared7_F as ua,shared7_Fb as Fl,shared7_G as No,shared7_Ga as Go,shared7_Gd as Ql,shared7_H as zo,shared7_K as Mi,shared7_M as O,shared7_Md as Zl,shared7_Nc as Vl,shared7_Od as Ea,shared7_Qa as oo,shared7_Sa as ro,shared7_Sc as Et,shared7_Ta as Mn,shared7_U as Nl,shared7_V as Nn,shared7_Va as jo,shared7_Wa as Pl,shared7_Wb as Sa,shared7_X as St,shared7_Y as He,shared7_Ya as Dl,shared7_Yb as On,shared7_Z as kr,shared7_Za as ao,shared7_Zb as Pr,shared7__ as pa,shared7__c as ql,shared7_a as lt,shared7_ad as Gl,shared7_ae as Ra,shared7_b as vl,shared7_ba as Wo,shared7_bb as Ml,shared7_cb as Ol,shared7_cc as _l,shared7_d as Mt,shared7_db as Al,shared7_dd as jl,shared7_ed as Xl,shared7_f as Wn,shared7_g as sn,shared7_ga as $r,shared7_h as _o,shared7_ha as fa,shared7_hd as va,shared7_i as ca,shared7_j as Cl,shared7_k as da,shared7_kd as Ai,shared7_la as $l,shared7_ld as wt,shared7_m as Ti,shared7_ma as Je,shared7_md as $o,shared7_n as El,shared7_oa as B,shared7_p as Pi,shared7_qa as Tr,shared7_qc as Hl,shared7_r as Ho,shared7_ra as fn,shared7_rc as zl,shared7_s as Rl,shared7_sa as Vn,shared7_sb as Ll,shared7_sc as Wl,shared7_ta as qn,shared7_tb as Kl,shared7_ub as kn,shared7_v as pt,shared7_va as ga,shared7_vb as Oi,shared7_vc as Xo,shared7_vd as Yl,shared7_w as Di,shared7_wb as io,shared7_wc as Yo,shared7_wd as Ca,shared7_x as Ii,shared7_y as Ot,shared7_yc as Ul,shared7_yd as Qo,shared7_z as ln}from"./runtime.js";import{shared8_a as _}from"./runtime.js";import{shared9_c as D,shared9_d as oe}from"./runtime.js";var jc=D(_());var Xc=t=>{let[e,n]=(0,jc.useState)(null);return[lt((r,a,s)=>{let i=e??r,l=Math.min(i||0,r),c=Math.max(i||0,r),d=a.slice(l,c+1).map(t),p=d.some(u=>!s.has(u)),f=[];return d.forEach(u=>{p?(s.has(u)||f.push(u),s.add(u)):(s.delete(u),f.push(u))}),n(p?c:null),f}),n]};var Yc=D(_()),qf=(t,e)=>(t._antProxy=t._antProxy||{},Object.keys(e).forEach(n=>{if(!(n in t._antProxy)){let o=t[n];t._antProxy[n]=o,t[n]=e[n]}}),t),Jc=(t,e)=>(0,Yc.useImperativeHandle)(t,()=>{let n=e(),{nativeElement:o}=n;return typeof Proxy<"u"?new Proxy(o,{get(r,a){return n[a]?n[a]:Reflect.get(r,a)}}):qf(o,n)});var Qc=D(_());var Zc=t=>{let e=Qc.useRef(t),[,n]=ma();return[()=>e.current,o=>{e.current=o,n()}]};var Gf=`.wand-theme-picker{display:grid;grid-template-columns:repeat(auto-fit,minmax(104px,1fr));gap:8px;width:100%}.wand-theme-choice.ant-radio-wrapper{display:flex;align-items:flex-start;margin:0;padding:10px 8px;border:1px solid var(--border-subtle);border-radius:var(--radius-sm);background:var(--bg-surface)}.wand-theme-choice.ant-radio-wrapper-checked{border-color:var(--border-focus);background:var(--accent-muted)}.wand-theme-choice.ant-radio-wrapper:hover{border-color:var(--border-focus)}.wand-theme-choice.ant-radio-wrapper:focus-within{outline:2px solid var(--border-focus);outline-offset:2px}.wand-theme-choice>.ant-radio{margin-top:2px}.wand-theme-choice>span:last-child{flex:1;min-width:0;padding-inline-end:0}.wand-theme-preview{display:block;position:relative;height:34px;border:1px solid;border-radius:3px;overflow:hidden;margin-bottom:7px}.wand-theme-preview-sidebar{position:absolute;inset:0 auto 0 0;width:23%}.wand-theme-preview-lines{position:absolute;inset:8px 8px 8px 34%;display:flex;flex-direction:column;gap:4px}.wand-theme-preview-lines i{display:block;width:90%;height:2px;background:currentColor;opacity:.65}.wand-theme-preview-lines i:last-child{width:60%}.wand-theme-preview-selection{position:absolute;left:3px;top:9px;width:calc(23% - 6px);height:5px;border-radius:1px}.wand-theme-choice-label{display:flex;flex-wrap:wrap;gap:0 6px;font-size:12px;line-height:18px}.wand-theme-choice-status{color:var(--accent);min-height:18px;font-weight:500}.ant-modal:has(.wand-settings-library-nested-dialog){width:min(800px,calc(100vw - var(--wand-safe-left, 0px) - var(--wand-safe-right, 0px) - 32px))!important;max-width:100%}.wand-settings-library-overview{flex-shrink:0}.wand-settings-library-nested-dialog .ant-modal-body{max-height:72dvh;overflow:auto}.wand-settings-library-overview,.wand-settings-library-toggle-row,.wand-settings-library-download-row,.wand-settings-library-update-deck,.wand-settings-library-group-members li,.wand-settings-library-system-ai-owner{display:flex;align-items:center;justify-content:space-between;gap:12px}.wand-settings-library-overview{flex-wrap:wrap;font-size:12px;color:var(--text-secondary)}.wand-settings-library-overview-pills,.wand-settings-library-button-row,.wand-settings-library-group-custom,.wand-settings-library-group-tools{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.wand-settings-library-app-access,.wand-settings-library-panel,.wand-settings-library-section-body,.wand-settings-library-preset-list,.wand-settings-library-group-content{display:flex;flex-direction:column;gap:16px;min-width:0}.wand-settings-library-panel-heading h2,.wand-settings-library-panel-heading p,.wand-settings-library-section p{margin:0}.wand-settings-library-toggle-row>div:not(.wand-ui-switch-row),.wand-settings-library-download-row>div,.wand-settings-library-update-deck>div{display:flex;flex-direction:column;gap:4px;min-width:0}.wand-settings-library-toggle-row>.wand-ui-switch-row{flex-shrink:0}.wand-settings-library-group-members{padding:0;margin:0;list-style:none}.wand-settings-library-group-member-name{flex:1;min-width:0;overflow-wrap:anywhere}.wand-settings-library-group-custom>.ant-input{flex:1;min-width:120px}.wand-settings-library-system-ai-owner{align-items:flex-start;justify-content:flex-start}.wand-settings-library-system-ai-chain{padding-inline-start:24px}.wand-settings-library-route-rank{margin-inline-end:8px}.wand-settings-library-env-value,.wand-settings-library-default-summary,.wand-settings-library-connect-code,.wand-settings-library-section a,.wand-settings-library-preset-list code{overflow-wrap:anywhere}.wand-settings-library-connect-code-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.wand-settings-library-env-toolbar,.wand-settings-library-app-access-form{display:flex;gap:16px;align-items:center;flex-wrap:wrap;margin-bottom:16px}.wand-settings-library-page-heading{min-height:var(--wand-page-header-height,56px);box-sizing:border-box;padding:8px var(--wand-page-inset,20px);gap:8px 16px;background:var(--bg-primary)}.wand-settings-library-page-title{gap:8px}.wand-settings-library-page-title .wand-ui-icon-button{width:var(--wand-page-toolbar-height,36px);min-height:var(--wand-page-toolbar-height,36px);padding:0;flex-shrink:0}.wand-settings-library-page-heading h1{font-size:var(--wand-page-title-size,18px)}.wand-settings-library-page .wand-settings-library-directory{width:100%;max-width:1160px;margin-inline:auto;min-width:0;border:0;background:transparent;box-sizing:border-box;padding:16px var(--wand-page-inset,20px) 24px;container:wandsettingsdirectory / inline-size}.wand-settings-library-directory .wand-settings-library-search{max-width:560px;padding-inline:0;background:var(--bg-primary)}.wand-settings-library-directory .ant-menu-root>.ant-menu-item-group{min-width:0}.wand-settings-library-directory .ant-menu-item{min-height:44px;padding-block:8px}.wand-settings-library-nav-copy{gap:2px}.wand-settings-library-page[data-compact=true] .wand-settings-library-directory .ant-menu-item{min-height:52px}.wand-settings-library-detail-content{width:100%;max-width:1120px;box-sizing:border-box;margin-inline:auto;padding:20px var(--wand-page-inset,20px) 28px;container:wandsettings / inline-size}.wand-settings-library-page[data-compact=true] .wand-settings-library-page-heading{padding:8px var(--wand-page-inset,12px)}.wand-settings-library-page[data-compact=true] .wand-settings-library-detail-content{padding:16px var(--wand-page-inset,12px) 24px}.wand-settings-library-page[data-compact=true] .wand-settings-library-page-title .wand-ui-icon-button{min-height:var(--wand-page-toolbar-height,36px)}.wand-settings-library-panel-heading{gap:4px;padding-bottom:16px;margin-bottom:0}.wand-settings-library-panel-heading h2{font-size:18px}.wand-settings-library-panel-heading p{font-size:13px;line-height:1.55}.wand-settings-library-panel{gap:16px}.wand-settings-library-section{min-width:0;padding:20px 0;border:0;border-top:1px solid var(--border-subtle);background:transparent}.wand-settings-library-section-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}.wand-settings-library-section-heading h3{margin:0;font-size:14px;font-weight:600}.wand-settings-library-section>p{margin-bottom:16px;color:var(--text-secondary);font-size:13px;line-height:1.55}.wand-settings-library-panel-heading h2{display:none}.wand-settings-library-directory .ant-menu-item{margin:0;width:100%;border-radius:var(--radius-sm);min-height:64px}.wand-settings-library-directory .ant-menu-item-group-title{font-weight:600;padding-inline:16px}.wand-settings-library-nav-copy>span:first-child{font-weight:500}.wand-settings-library-nav-item>svg{display:block;transform:rotate(-90deg)}.wand-settings-library-nav-description{font-size:13px}.wand-settings-library-panel{gap:0}.wand-settings-library-panel>.wand-settings-library-save-bar{padding-top:16px}.wand-settings-library-section-body{gap:16px;container:wandsettingsfields / inline-size}.wand-settings-library-section-body>.ant-btn{align-self:flex-start;max-width:100%;height:auto;min-height:32px;white-space:normal}.wand-settings-library-section-heading{flex-wrap:wrap}.wand-settings-library-toggle-row{padding-block:4px;align-items:flex-start}.wand-settings-library-toggle-row>div:first-child{flex:1;overflow-wrap:anywhere}.wand-settings-library-toggle-row strong{font-size:14px;font-weight:500;line-height:1.5}.wand-settings-library-toggle-row>div:first-child>span{color:var(--text-secondary);font-size:13px;line-height:1.6}.wand-settings-library-toggle-row .wand-ui-switch-row{margin-top:2px}.wand-settings-library-panel-heading p,.wand-settings-library-section p,.wand-settings-library-field .ant-form-item-label>label{overflow-wrap:anywhere}.wand-settings-library-field .ant-form-item-label>label{height:auto}.wand-settings-library-update-deck{justify-content:flex-start}.wand-settings-library-update-deck>div{flex:1}.wand-settings-library-update-deck-icon,.wand-settings-library-update-channel{flex-shrink:0}.wand-settings-library-about-list>div{display:flex;align-items:baseline;justify-content:space-between;gap:16px}.wand-settings-library-about-overview>.wand-settings-library-section{flex:1 1 480px;min-width:0}.wand-settings-library-about-downloads>.wand-settings-library-section{flex:1 1 280px;min-width:0}.wand-settings-library-version-table .ant-table-cell{overflow-wrap:anywhere}.wand-settings-library-cli-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(280px,100%),1fr));gap:0 24px}.wand-settings-library-cli-item{min-width:0;padding-block:8px;border-bottom:1px solid var(--border-subtle)}.wand-settings-library-cli-item>span{min-width:0;overflow-wrap:anywhere;text-align:end;font-variant-numeric:tabular-nums}.wand-settings-library-connect{display:flex;flex-direction:column;gap:16px}.wand-settings-library-grid,.wand-settings-library-default-row{grid-template-columns:minmax(0,1fr);gap:12px 16px}.wand-settings-library-field .ant-form-item-label{padding-bottom:4px}.wand-settings-library-field .ant-form-item-explain{font-size:12px;line-height:1.5}.wand-settings-library-secret-toggle.ant-btn{height:24px;min-height:24px;padding-inline:6px;font-size:12px}.wand-settings-library-system-ai-owner-copy{min-width:0;overflow-wrap:anywhere}.wand-settings-library-system-ai-chain{list-style:none;padding:0;margin:8px 0}.wand-settings-library-system-ai-chain li{padding-block:3px;font-size:13px}.wand-settings-library-page[data-wide=true][data-detail=true] .wand-settings-library-directory{width:224px;max-width:224px;margin:0;padding:16px 12px 24px;border-inline-end:1px solid var(--border-subtle)}.wand-settings-library-page[data-wide=true][data-detail=true] .wand-settings-library-directory .ant-menu-item{min-height:40px;padding-block:8px}.wand-settings-library-page[data-wide=true][data-detail=true] .wand-settings-library-nav-description,.wand-settings-library-page[data-wide=true][data-detail=true] .wand-settings-library-nav-item>svg{display:none}.wand-settings-library-page[data-wide=true][data-detail=true] .wand-settings-library-directory .ant-menu-item-group-title{padding-top:16px}@container wandsettingsdirectory (min-width:800px){.wand-settings-library-directory .ant-menu-root{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));column-gap:24px;align-items:start}.wand-settings-library-directory .ant-menu-root:before,.wand-settings-library-directory .ant-menu-root:after{display:none}}@container wandsettings (min-width:820px){:is(.wand-settings-library-panel,.wand-settings-library-detail-content)>.wand-settings-library-section{display:grid;grid-template-columns:192px minmax(0,1fr);grid-template-rows:min-content minmax(0,1fr);column-gap:24px;align-content:start}:is(.wand-settings-library-panel,.wand-settings-library-detail-content)>.wand-settings-library-section>.wand-settings-library-section-heading{grid-column:1;grid-row:1;align-items:flex-start;margin-bottom:8px}:is(.wand-settings-library-panel,.wand-settings-library-detail-content)>.wand-settings-library-section>p{grid-column:1;grid-row:2;align-self:start;margin-bottom:0}:is(.wand-settings-library-panel,.wand-settings-library-detail-content)>.wand-settings-library-section>.wand-settings-library-section-body{grid-column:2;grid-row:1 / span 2;width:100%}}@container wandsettingsfields (min-width:560px){.wand-settings-library-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@container wandsettingsfields (min-width:620px){.wand-settings-library-default-row{grid-template-columns:repeat(3,minmax(0,1fr))}}@container wandsettingsfields (min-width:640px){.wand-settings-library-connect{display:grid;grid-template-columns:220px minmax(0,1fr);gap:16px 24px;align-items:start}.wand-settings-library-connect-qr{grid-column:1;grid-row:1 / span 3}.wand-settings-library-connect>:not(.wand-settings-library-connect-qr){grid-column:2}}@media(pointer:coarse){.wand-settings-library-secret-toggle.ant-btn{min-height:32px;min-width:44px}}
|
|
2
2
|
`;function ed(){ec("wand-settings-library-styles",Gf)}var Yt=D(_(),1);var xt=D(Et(),1);function td({admin:t}){let[e,n]=(0,Yt.useState)(Nc),[o,r]=(0,Yt.useState)(null),[a,s]=(0,Yt.useState)(null),[i,l]=(0,Yt.useState)(""),[c,d]=(0,Yt.useState)(""),[p,f]=(0,Yt.useState)(!1),u=(0,Yt.useRef)(!1),m=(0,Yt.useRef)(0),g=(0,Yt.useRef)(!0),y=a?.speech.operation,h=!!y&&!["completed","failed","cancelled"].includes(y.phase);(0,Yt.useEffect)(()=>(g.current=!0,()=>{g.current=!1}),[]),(0,Yt.useEffect)(()=>{let E=new AbortController,R;async function k(){let b=m.current;try{let[w,C]=await Promise.all([co("/api/speech/status",{signal:E.signal}),co("/api/local-models/status",{signal:E.signal})]);if(E.signal.aborted)return;!u.current&&b===m.current&&(r(w),s(C),d(""))}catch(w){!E.signal.aborted&&!u.current&&b===m.current&&d(w instanceof Error?w.message:"\u65E0\u6CD5\u8BFB\u53D6\u8BED\u97F3\u72B6\u6001\u3002")}E.signal.aborted||(R=window.setTimeout(()=>{k()},1500))}return k(),()=>{E.abort(),window.clearTimeout(R)}},[]);async function S(E){if(!u.current){u.current=!0,m.current+=1,f(!0),l("");try{let R=await E();g.current&&R&&s(R)}catch(R){g.current&&l(R instanceof Error?R.message:"\u64CD\u4F5C\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002")}finally{u.current=!1,g.current&&f(!1)}}}let v=a?.speech;return(0,xt.jsxs)(xt.Fragment,{children:[(0,xt.jsxs)(We,{title:"\u670D\u52A1\u7AEF\u8BED\u97F3\u8F93\u5165",description:"\u97F3\u9891\u53D1\u9001\u5230\u5F53\u524D\u8FDE\u63A5\u7684 Wand \u4E3B\u673A\uFF0C\u7531\u672C\u673A whisper.cpp \u6A21\u578B\u8F6C\u5199\u3002\u8F6C\u5199\u6587\u5B57\u53EF\u4EA4\u7ED9\u300C\u53E3\u8FF0\u6574\u7406\u5E08\u300D\u914D\u7F6E\u7684\u6A21\u578B\u6574\u7406\uFF0C\u662F\u5426\u53D1\u9001\u81F3\u5916\u90E8\u670D\u52A1\u53D6\u51B3\u4E8E\u5176\u6A21\u578B\u914D\u7F6E\u3002",children:[(0,xt.jsx)(Ae,{tone:v?v.supported?"success":"warning":"info",children:v?v.supported?"\u5F53\u524D\u673A\u5668\u652F\u6301\u670D\u52A1\u7AEF\u8BED\u97F3\u8BC6\u522B\u3002":`\u5F53\u524D\u673A\u5668\u6682\u4E0D\u652F\u6301\uFF1A${v.supportReason||v.reason||"\u8FD0\u884C\u73AF\u5883\u4E0D\u53EF\u7528\u3002"}`:"\u6B63\u5728\u68C0\u67E5\u672C\u673A\u652F\u6301\u60C5\u51B5\u2026"}),(0,xt.jsx)(At,{label:"\u542F\u7528\u670D\u52A1\u7AEF\u8BED\u97F3\u8F93\u5165",checked:v?.enabled===!0||h&&y?.action==="activate",disabled:!t||!v||p||!v.supported&&!v.enabled||v.busy&&!h,description:h?"\u51C6\u5907\u4E2D\uFF1B\u5173\u95ED\u5F00\u5173\u53EF\u53D6\u6D88\u3002":"\u9996\u6B21\u542F\u7528\u4F1A\u81EA\u52A8\u4E0B\u8F7D\u6A21\u578B\u5E76\u51C6\u5907\u8FD0\u884C\u73AF\u5883\uFF0C\u5B8C\u6210\u540E\u5373\u53EF\u4F7F\u7528\u3002",onCheckedChange:E=>{S(()=>co("/api/local-models/speech/settings",Dr({enabled:E},"PATCH")))}}),h?(0,xt.jsx)(Ae,{children:y.message}):y?.phase==="failed"?(0,xt.jsxs)(Ae,{tone:"error",children:[y.error||y.message," \u518D\u6B21\u5F00\u542F\u5373\u53EF\u91CD\u8BD5\u3002"]}):v?.enabled?(0,xt.jsx)(Ae,{tone:o?.ready?"success":"warning",children:o?.ready?"\u5DF2\u542F\u7528\uFF0C\u6309\u4F4F\u9EA6\u514B\u98CE\u8BF4\u8BDD\uFF0C\u677E\u624B\u8F6C\u5199\uFF1B\u6700\u957F 60 \u79D2\u3002":o?.reason||"\u6B63\u5728\u786E\u8BA4\u8BC6\u522B\u72B6\u6001\u2026"}):null,h&&y?.phase==="downloading"&&y.total?(0,xt.jsx)(tr,{percent:Math.floor(y.received/y.total*100),"aria-label":"\u8BED\u97F3\u6A21\u578B\u4E0B\u8F7D\u8FDB\u5EA6"}):null,t?null:(0,xt.jsx)(Ae,{children:"\u542F\u7528\u6216\u5173\u95ED\u9700\u8981\u670D\u52A1\u5668\u7BA1\u7406\u6743\u9650\u3002"}),i||c?(0,xt.jsx)(Ae,{tone:"error",children:i||c}):null]}),(0,xt.jsxs)(We,{title:"\u6B64\u8BBE\u5907\u7684\u8BC6\u522B\u65B9\u5F0F",description:"\u53EA\u5F71\u54CD\u5F53\u524D\u8BBE\u5907\uFF0C\u5176\u4ED6\u5BA2\u6237\u7AEF\u4FDD\u6301\u5404\u81EA\u7684\u9009\u62E9\u3002\u8BC6\u522B\u7ED3\u679C\u5199\u5165\u8F93\u5165\u8349\u7A3F\uFF0C\u7531\u4F60\u786E\u8BA4\u540E\u53D1\u9001\u3002",children:[(0,xt.jsx)(et,{label:"\u8BC6\u522B\u65B9\u5F0F",htmlFor:"settings-speech-mode",children:(0,xt.jsx)(mn,{id:"settings-speech-mode",ariaLabel:"\u8BC6\u522B\u65B9\u5F0F",value:e,options:[{value:"server",label:"\u670D\u52A1\u7AEF\u8BC6\u522B"},{value:"local",label:"\u5BA2\u6237\u7AEF\u672C\u5730\u8BC6\u522B"}],onChange:E=>{let R=E;kc(R),n(R)}})}),e==="local"?(0,xt.jsxs)(xt.Fragment,{children:[(0,xt.jsx)(Ae,{tone:$a()?"info":"warning",children:$a()?"\u4F7F\u7528\u6D4F\u89C8\u5668\u7AEF\u4FA7\u8BED\u8A00\u5305\uFF0C\u97F3\u9891\u4E0D\u4E0A\u4F20\uFF0C\u4E5F\u4E0D\u8C03\u7528\u53E3\u8FF0\u6574\u7406\u5E08\u3002\u8BED\u8A00\u5305\u4E0D\u53EF\u7528\u65F6\u4F1A\u62A5\u9519\uFF0C\u4E0D\u81EA\u52A8\u5207\u6362\u5230\u4E91\u7AEF\u8BC6\u522B\u3002":"\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u7AEF\u4FA7\u8BC6\u522B\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u5207\u6362\u8BC6\u522B\u65B9\u5F0F\u3002\u8BF7\u624B\u52A8\u9009\u62E9\u670D\u52A1\u7AEF\u8BC6\u522B\u6216\u4F7F\u7528\u539F\u751F\u5BA2\u6237\u7AEF\u3002"}),$a()?(0,xt.jsx)(ot,{kind:"secondary",pending:p,onClick:()=>S($c),children:"\u4E0B\u8F7D\u6D4F\u89C8\u5668\u8BED\u8A00\u5305"}):null]}):null]})]})}var An=D(_(),1);var je=D(Et(),1);function jf(){let[t,e]=(0,An.useState)(null),[n,o]=(0,An.useState)(""),r=(0,An.useCallback)(async a=>{try{let s=await co("/api/local-models/status",{signal:a});if(!s.laya||!s.speech)throw new Error("\u670D\u52A1\u7AEF\u5C1A\u672A\u63D0\u4F9B\u672C\u5730\u6A21\u578B\u7BA1\u7406\uFF0C\u8BF7\u5148\u66F4\u65B0 Wand\u3002");e(s),o("")}catch(s){a?.aborted||o(s instanceof Error?s.message:"\u65E0\u6CD5\u8BFB\u53D6\u672C\u5730\u6A21\u578B\u72B6\u6001\u3002")}},[]);return(0,An.useEffect)(()=>{let a=new AbortController;return r(a.signal),()=>a.abort()},[r]),(0,An.useEffect)(()=>{if(![t?.laya,t?.speech].some(i=>i?.operation&&!["completed","failed","cancelled"].includes(i.operation.phase)))return;let a=new AbortController,s=window.setTimeout(()=>{r(a.signal)},1500);return()=>{window.clearTimeout(s),a.abort()}},[t,r]),{status:t,setStatus:e,error:n,setError:o,refresh:r}}function Xf({value:t,admin:e,model:n,backend:o,downloaded:r,onStatus:a,onError:s}){let[i,l]=(0,An.useState)(""),c=t.operation,d=!!c&&!["completed","failed","cancelled"].includes(c.phase),p=r??t.downloaded;async function f(u){l(u),s("");try{let m=u==="cancel"?{}:{...n?{model:n}:{},...o&&t.kind==="speech"?{backend:o}:{}},g=await co(`/api/local-models/${t.kind}/${u}`,Dr(m));a(g)}catch(m){s(m instanceof Error?m.message:"\u6A21\u578B\u64CD\u4F5C\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002")}finally{l("")}}return(0,je.jsxs)(je.Fragment,{children:[(0,je.jsxs)(_l,{wrap:!0,children:[(0,je.jsx)(ot,{kind:"secondary",pending:i==="download"||d&&c.action==="download",disabled:!e||!t.supported||!!i||t.busy&&!d||d||p,pendingLabel:"\u4E0B\u8F7D\u4E2D\u2026",successLabel:"\u5DF2\u4E0B\u8F7D",errorLabel:"\u4E0B\u8F7D\u5931\u8D25",settled:c?.action==="download"&&c.phase==="completed"?"success":c?.action==="download"&&c.phase==="failed"?"error":null,onClick:()=>f("download"),children:p?"\u6A21\u578B\u5DF2\u4E0B\u8F7D":c?.action==="download"&&c.phase==="failed"?"\u91CD\u8BD5\u4E0B\u8F7D":`\u4E0B\u8F7D\u6A21\u578B\uFF08${Math.round(t.modelSize/1024/1024)} MiB\uFF09`}),(0,je.jsx)(ot,{kind:"primary",pending:i==="initialize"||d&&c.action==="initialize",disabled:!e||!t.supported||!p||!!i||t.busy&&!d||d,pendingLabel:"\u521D\u59CB\u5316\u4E2D\u2026",successLabel:"\u5DF2\u521D\u59CB\u5316",errorLabel:"\u521D\u59CB\u5316\u5931\u8D25",settled:c?.action==="initialize"&&c.phase==="completed"?"success":c?.action==="initialize"&&c.phase==="failed"?"error":null,onClick:()=>f("initialize"),children:c?.action==="initialize"&&c.phase==="failed"?"\u91CD\u8BD5\u521D\u59CB\u5316":"\u521D\u59CB\u5316\u8FD0\u884C\u65F6\u4E0E\u6A21\u578B"}),d&&e?(0,je.jsx)(ot,{kind:"secondary",pending:i==="cancel",onClick:()=>f("cancel"),children:"\u53D6\u6D88\u5B89\u88C5\u4EFB\u52A1"}):null]}),c?(0,je.jsx)(Ae,{tone:c.phase==="failed"?"error":c.phase==="completed"?"success":"info",children:c.message}):null,c?.phase==="downloading"&&c.total?(0,je.jsx)(tr,{percent:Math.floor(c.received/c.total*100),"aria-label":`${t.label}\u4E0B\u8F7D\u8FDB\u5EA6`}):null,e?null:(0,je.jsx)(Ae,{children:"\u4E0B\u8F7D\u3001\u521D\u59CB\u5316\u3001\u53D6\u6D88\u548C\u542F\u7528\u9700\u8981\u7BA1\u7406\u5458\u6743\u9650\uFF1B\u5F53\u524D\u8FDE\u63A5\u53EF\u67E5\u770B\u5B9E\u9645\u72B6\u6001\u3002"})]})}function nd({admin:t}){let e=jf(),[n,o]=(0,An.useState)(!1);async function r(s){o(!0),e.setError("");try{e.setStatus(await co("/api/local-models/laya/settings",Dr({enabled:s},"PATCH")))}catch(i){e.setError(i instanceof Error?i.message:"\u4FDD\u5B58\u5931\u8D25\u3002")}finally{o(!1)}}let a=e.status?.laya;return(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(We,{title:"LAYA \u672C\u5730\u51B3\u7B56\u6A21\u578B",description:"\u7528\u4E8E\u6709\u754C\u9009\u62E9\u3001\u8BC4\u5206\u4E0E\u662F\u975E\u5224\u65AD\uFF0C\u4E0D\u662F\u804A\u5929\u6A21\u578B\uFF0C\u4E5F\u4E0D\u4EE3\u66FF\u6388\u6743\u3002\u5F53\u524D\u4EC5\u652F\u6301 Apple Silicon macOS / Metal\u3002",action:(0,je.jsx)(ot,{kind:"secondary",onClick:()=>e.refresh(),children:"\u5237\u65B0\u72B6\u6001"}),children:a?(0,je.jsxs)(je.Fragment,{children:[a.hardware?(0,je.jsxs)(Ae,{tone:a.hardware.suitable?"info":"warning",children:[a.hardware.message,"\uFF08\u5185\u5B58 ",a.hardware.memoryGiB," GiB \xB7 CPU ",a.hardware.cpuCount," \u6838\uFF09"]}):null,(0,je.jsx)(qc,{admin:t}),(0,je.jsxs)(Li.Text,{type:"secondary",children:[a.model," \xB7 ",Math.round(a.modelSize/1024/1024)," MiB \xB7 ",a.downloaded?"\u6A21\u578B\u6821\u9A8C\u901A\u8FC7":"\u6A21\u578B\u672A\u5C31\u7EEA"," \xB7 ",a.runtimeAvailable?"\u5DF2\u6709\u8FD0\u884C\u65F6":"\u8FD0\u884C\u65F6\u672A\u5B89\u88C5"]}),(0,je.jsx)(At,{label:"\u542F\u7528 LAYA \u672C\u5730\u51B3\u7B56",checked:a.enabled,disabled:!t||!a.supported||a.busy||n||!a.downloaded||!a.runtimeAvailable,description:"\u4E0B\u8F7D\u4E0E\u521D\u59CB\u5316\u4E0D\u4F1A\u81EA\u52A8\u542F\u7528\uFF1B\u4E5F\u4E0D\u4F1A\u6539\u53D8\u4F1A\u8BDD\u7684\u5DE5\u5177\u3001\u8D39\u7528\u3001\u6280\u80FD\u6216\u6D3E\u5DE5\u6743\u9650\u3002",onCheckedChange:s=>{r(s)}}),(0,je.jsx)(Xf,{value:a,admin:t,onStatus:e.setStatus,onError:e.setError}),a.reason?(0,je.jsx)(Ae,{tone:"warning",children:a.reason}):null,(0,je.jsx)(Ae,{tone:"warning",children:"LAYA \u5224\u65AD\u8D28\u91CF\u4ECD\u4E3A\u5B9E\u9A8C\u6027\uFF0C\u9AD8\u6982\u7387\u4E0D\u4EE3\u8868\u6B63\u786E\u3002\u4E0D\u5F97\u7528\u5B83\u81EA\u52A8\u5BA1\u6279\u6743\u9650\u3001\u5220\u9664\u6570\u636E\u6216\u53D1\u5E03\u3002"})]}):(0,je.jsx)(Ae,{children:"\u6B63\u5728\u68C0\u67E5\u6A21\u578B\u548C\u8FD0\u884C\u65F6\u2026"})}),(0,je.jsxs)(We,{title:"\u670D\u52A1\u7AEF\u8BED\u97F3\u8F93\u5165",description:"\u5728\u300C\u8BED\u97F3\u8F93\u5165\u300D\u4E2D\u5F00\u542F\u5373\u53EF\uFF0C\u6A21\u578B\u4E0B\u8F7D\u4E0E\u8FD0\u884C\u73AF\u5883\u51C6\u5907\u4F1A\u81EA\u52A8\u5B8C\u6210\u3002",children:[e.status?(0,je.jsx)(je.Fragment,{children:(0,je.jsxs)(Li.Text,{type:"secondary",children:["Whisper ",e.status.speech.model," \xB7 ",e.status.speech.downloaded?"\u6A21\u578B\u6821\u9A8C\u901A\u8FC7":"\u672A\u4E0B\u8F7D"," \xB7 ",e.status.speech.runtimeAvailable?"\u8FD0\u884C\u65F6\u5DF2\u5B89\u88C5":"\u8FD0\u884C\u65F6\u672A\u5B89\u88C5"]})}):null,(0,je.jsx)(Ae,{children:"\u53EA\u5B89\u88C5\u72EC\u7ACB\u6A21\u578B\u7EC4\u4EF6\uFF0C\u4E0D\u8986\u76D6\u5DF2\u6709 Python \u73AF\u5883\uFF0C\u4E0D\u4E2D\u65AD\u6D3B\u52A8\u8BC6\u522B/\u51B3\u7B56\uFF0C\u4E0D\u91CD\u542F Wand \u670D\u52A1\u3002"})]}),e.error?(0,je.jsx)(Ae,{tone:"error",children:e.error}):null]})}var Qe=D(_(),1),Uf=D(_(),1);var Jt=D(Et(),1),uo={profile:{label:"\u6211\u7684\u8D44\u6599",description:"\u6D88\u606F\u7F72\u540D\u4E0E\u5934\u50CF"},notifications:{label:"\u901A\u77E5",description:"\u63D0\u793A\u97F3\u3001\u7CFB\u7EDF\u901A\u77E5\u4E0E\u89E6\u611F",keywords:"\u58F0\u97F3 \u94C3\u58F0 \u97F3\u91CF"},display:{label:"\u663E\u793A",description:"\u4E3B\u9898\u914D\u8272\u3001\u4F1A\u8BDD\u5BBD\u5EA6\u4E0E\u5361\u7247\u5C55\u5F00",keywords:"\u754C\u9762 \u6298\u53E0 \u94FA\u6EE1 \u5C45\u4E2D \u804A\u5929 \u5BF9\u8BDD"},ai:{label:"AI \u4E0E\u6A21\u578B",description:"\u9ED8\u8BA4\u5DE5\u5177\u3001\u6A21\u578B\u4E0E\u5019\u9009\u5206\u7EC4",keywords:"Claude Codex Pi OpenRouter"},"local-models":{label:"\u672C\u5730\u6A21\u578B",description:"\u79BB\u7EBF\u51B3\u7B56\u4E0E\u6A21\u578B\u8D44\u6E90",keywords:"LAYA \u4E0B\u8F7D \u521D\u59CB\u5316"},speech:{label:"\u8BED\u97F3\u8F93\u5165",description:"\u4E00\u952E\u542F\u7528\u4E0E\u672C\u673A\u652F\u6301\u60C5\u51B5",keywords:"\u9EA6\u514B\u98CE \u8BED\u8A00 sherpa"},general:{label:"\u57FA\u672C\u914D\u7F6E",description:"\u670D\u52A1\u8FDE\u63A5\u3001\u6267\u884C\u504F\u597D\u4E0E\u4FDD\u7559\u7B56\u7565",keywords:"Host \u7AEF\u53E3 HTTPS Shell \u73AF\u5883 \u76EE\u5F55 \u5F52\u6863 \u5220\u9664"},connectors:{label:"\u8FDE\u63A5\u5668",description:"GitHub \u8D26\u53F7\u4E0E\u4ED3\u5E93\u8FDE\u63A5",keywords:"token Enterprise"},security:{label:"\u5B89\u5168",description:"\u767B\u5F55\u5BC6\u7801\u4E0E SSL \u8BC1\u4E66"},presets:{label:"\u547D\u4EE4\u9884\u8BBE",description:"\u521B\u5EFA\u4F1A\u8BDD\u65F6\u53EF\u7528\u7684\u5FEB\u6377\u547D\u4EE4"},about:{label:"\u5173\u4E8E",description:"\u7248\u672C\u3001\u66F4\u65B0\u4E0E\u5BA2\u6237\u7AEF\u8FDE\u63A5",keywords:"\u4E0B\u8F7D \u8FDE\u63A5\u7801 \u4E8C\u7EF4\u7801 APK iOS macOS"}},Yf=[{label:"\u4E2A\u4EBA\u504F\u597D",tabs:["profile","notifications","display"]},{label:"AI \u80FD\u529B",tabs:["ai","local-models","speech"]},{label:"\u670D\u52A1\u7BA1\u7406",tabs:["general","connectors","security","presets","about"]}];function od({available:t,selected:e,query:n,onQuery:o,onSelect:r}){let a=n.trim().toLocaleLowerCase(),s=Yf.flatMap(i=>{let l=i.tabs.filter(c=>t.includes(c)&&(!a||`${i.label} ${uo[c].label} ${uo[c].description} ${uo[c].keywords??""}`.toLocaleLowerCase().includes(a)));return l.length?[{type:"group",key:i.label,label:i.label,children:l.map(c=>({key:c,label:(0,Jt.jsxs)("span",{className:"wand-settings-library-nav-item",children:[(0,Jt.jsxs)("span",{className:"wand-settings-library-nav-copy",children:[(0,Jt.jsx)("span",{children:uo[c].label}),(0,Jt.jsx)("span",{className:"wand-settings-library-nav-description",children:uo[c].description})]}),(0,Jt.jsx)(Xt,{name:"chevron",size:16})]})}))}]:[]});return(0,Jt.jsxs)(Jt.Fragment,{children:[(0,Jt.jsx)("div",{className:"wand-settings-library-search",children:(0,Jt.jsx)(Ra,{label:"\u67E5\u627E\u8BBE\u7F6E\u5206\u7EC4",value:n,onValueChange:o,placeholder:"\u67E5\u627E\u8BBE\u7F6E\u5206\u7EC4"})}),s.length?(0,Jt.jsx)(Ca,{mode:"inline",inlineIndent:16,selectedKeys:[e],items:s,style:{borderInlineEnd:0,background:"transparent"},"aria-label":"\u8BBE\u7F6E\u5206\u7EC4",onClick:({key:i})=>r(i)}):(0,Jt.jsx)(lo,{image:lo.PRESENTED_IMAGE_SIMPLE,description:"\u6CA1\u6709\u5339\u914D\u7684\u8BBE\u7F6E\u5206\u7EC4"})]})}function Jf(){return{autoArchiveEnabled:!0,autoArchiveDays:7,autoDeleteEnabled:!0,autoDeleteDays:7}}function Ta(t){let e=Jf();if(!t||typeof t!="object"||Array.isArray(t))return e;let n=t;return{autoArchiveEnabled:typeof n.autoArchiveEnabled=="boolean"?n.autoArchiveEnabled:e.autoArchiveEnabled,autoArchiveDays:rd(n.autoArchiveDays,e.autoArchiveDays),autoDeleteEnabled:typeof n.autoDeleteEnabled=="boolean"?n.autoDeleteEnabled:e.autoDeleteEnabled,autoDeleteDays:rd(n.autoDeleteDays,e.autoDeleteDays)}}function rd(t,e){return typeof t!="number"||!Number.isInteger(t)||t<1||t>365?e:t}var Qf=la,Xi=class{notificationPreferencesChanged(e){window.dispatchEvent(new CustomEvent("wand-settings-notifications-changed",{detail:e}))}configSaved(e){window.dispatchEvent(new CustomEvent("wand-settings-config-saved",{detail:e}))}},Zf={enabled:!1,hasArtifact:!1,fileName:null,version:null,size:null,updatedAt:null,downloadUrl:null,source:null,local:null,github:null};function Tt(t){return typeof t=="string"&&t?t:null}function em(t,e=!1){return typeof t=="boolean"?t:e}function ad(t){let e=bt(t),n=le(e.fileName),o=le(e.downloadUrl);return!n||!o?null:{fileName:n,downloadUrl:o,version:Tt(e.version),size:Ki(e.size,0),updatedAt:Tt(e.updatedAt),releaseNotes:le(e.releaseNotes)||void 0}}function Gi(t){let e=bt(t),n=ad(e.local),o=ad(e.github);return{...Zf,enabled:e.enabled!==!1,hasArtifact:em(e.hasArtifact,!!(n||o||e.fileName)),fileName:Tt(e.fileName),version:Tt(e.version),size:typeof e.size=="number"?e.size:null,updatedAt:Tt(e.updatedAt),downloadUrl:Tt(e.downloadUrl),source:e.source==="github"||e.source==="local"?e.source:null,local:n,github:o}}function cd(t){let e=bt(t);return{provider:"github",connected:e.connected===!0,apiUrl:Tt(e.apiUrl),username:Tt(e.username),connectedAt:Tt(e.connectedAt),updatedAt:Tt(e.updatedAt),scopes:Array.isArray(e.scopes)?e.scopes.filter(n=>typeof n=="string"):[]}}function tm(t){let e=Vc(t);return{name:e?.name??"",avatar:e?.avatar??""}}function po(t){let e=bt(t),n=bt(e.defaultModels),o=bt(e.cardDefaults),r=Array.isArray(e.commandPresets)?e.commandPresets:[],a=["default","assist","agent","agent-max","auto-edit","full-access","native","managed"].includes(le(e.defaultMode))?le(e.defaultMode):"default",s=e.commitCli==="codex"||e.commitCli==="opencode"?e.commitCli:"claude",i=Qf.includes(le(e.defaultProvider))?le(e.defaultProvider):"claude",l=(function(){let y=le(e.defaultThinkingEffort);return y==="off"||y==="standard"||y==="deep"||y==="max"||bl(y)?y:"off"})(),c=le(n.claude,le(e.defaultModel)),d=le(n.codex,le(e.defaultCodexModel)),p=le(n.opencode,le(e.defaultOpenCodeModel)),f=le(n.grok,le(e.defaultGrokModel)),u=le(n.qoder,le(e.defaultQoderModel)),m=le(n.pi,le(e.defaultPiModel)),g=le(n.gemini,le(e.defaultGeminiModel));return{host:le(e.host,"127.0.0.1"),port:Ki(e.port,3e3),https:e.https===!0,defaultMode:a,defaultCwd:le(e.defaultCwd),shell:le(e.shell,"/bin/zsh"),language:le(e.language),inheritEnv:e.inheritEnv!==!1,defaultModel:c,defaultCodexModel:d,defaultOpenCodeModel:p,defaultGrokModel:f,defaultQoderModel:u,defaultPiModel:m,defaultGeminiModel:g,defaultModels:{claude:c,codex:d,opencode:p,grok:f,qoder:u,pi:m,gemini:g},modelGroups:er(e.modelGroups??[]),defaultProvider:i,defaultThinkingEffort:l,commitCli:s,commitModel:le(e.commitModel),commandPresets:r.map(y=>{let h=bt(y);return{label:le(h.label),command:le(h.command),mode:le(h.mode)||void 0}}).filter(y=>y.label||y.command),cardDefaults:{editCards:o.editCards===!0,inlineTools:o.inlineTools===!0,terminal:o.terminal===!0,thinking:o.thinking===!0},taskRetention:Ta(e.taskRetention),userProfile:tm(e.userProfile)}}function nm(t){let e=bt(t),n=bt(e.build);return{packageName:le(e.packageName,"wand-local"),version:le(e.version,"-"),nodeVersion:le(e.nodeVersion,"-"),repoUrl:le(e.repoUrl),updateAvailable:e.updateAvailable===!0,latestVersion:Tt(e.latestVersion),updateChannel:e.updateChannel==="beta"?"beta":"stable",build:{commit:Tt(n.commit),shortCommit:Tt(n.shortCommit),builtAt:Tt(n.builtAt),channel:Tt(n.channel)},androidApk:Gi(e.androidApk),macosDmg:Gi(e.macosDmg),iosIpa:Gi(e.iosIpa)}}function rr(t){let e=bt(t),n=r=>Array.isArray(e[r])?e[r]:[],o=bt(e.defaultModels);return{modelGroups:er(e.modelGroups??[]),freeModels:n("freeModels"),models:n("models"),codexModels:n("codexModels"),opencodeModels:n("opencodeModels"),grokModels:n("grokModels"),qoderModels:n("qoderModels"),piModels:n("piModels"),geminiModels:n("geminiModels"),thinkingEfforts:bt(e.thinkingEfforts),claudeVersion:Tt(e.claudeVersion),opencodeVersion:Tt(e.opencodeVersion),refreshedAt:Tt(e.refreshedAt),defaultModel:le(e.defaultModel),defaultCodexModel:le(e.defaultCodexModel),defaultOpenCodeModel:le(e.defaultOpenCodeModel),defaultGrokModel:le(e.defaultGrokModel),defaultQoderModel:le(e.defaultQoderModel),defaultPiModel:le(e.defaultPiModel),defaultGeminiModel:le(e.defaultGeminiModel),defaultModels:{claude:le(o.claude,le(e.defaultModel)),codex:le(o.codex,le(e.defaultCodexModel)),opencode:le(o.opencode,le(e.defaultOpenCodeModel)),grok:le(o.grok,le(e.defaultGrokModel)),qoder:le(o.qoder,le(e.defaultQoderModel)),pi:le(o.pi,le(e.defaultPiModel)),gemini:le(o.gemini,le(e.defaultGeminiModel))}}}function id(t,e){try{let n=window.localStorage.getItem(t);return n==null?e:n==="true"}catch{return e}}function sd(t,e){try{let n=Number(window.localStorage.getItem(t));return Number.isFinite(n)&&n>=0?n:e}catch{return e}}function gn(){try{return typeof WandNative<"u"?WandNative:null}catch{return null}}function Ir(t){if(t?.getPermission)try{let e=t.getPermission();if(e==="granted"||e==="denied"||e==="default")return e}catch{}return typeof Notification>"u"?"unsupported":Notification.permission}function dd(){let t=gn(),e=navigator.userAgent||"",n=/WandPlatform\/Android/.test(e)?"android":/WandPlatform\/iOS/.test(e)?"ios":/WandPlatform\/macOS/.test(e)||window.__wandMacNative===!0?"macos":"browser",o=e.match(/WandApp\/([^\s]+)/)?.[1]||null;return{kind:n,appVersion:o,canInstallDistribution:typeof t?.downloadUpdate=="function",hasNativeNotifications:typeof t?.sendNotification=="function"}}function Mr(){let t=gn(),e=[],n=null,o=null,r=id("wand-notif-sound",!0);try{t?.getAvailableSounds&&(e=JSON.parse(t.getAvailableSounds())),t?.getNotificationSound&&(n=t.getNotificationSound()),t?.isNotificationSoundEnabled&&(r=t.isNotificationSoundEnabled()),t?.isHapticEnabled&&(o=t.isHapticEnabled())}catch{}let a=t?.getNotificationVolume?(()=>{try{return t.getNotificationVolume()}catch{return sd("wand-notif-volume",80)}})():sd("wand-notif-volume",80);return{sound:r,volume:Math.max(0,Math.min(100,a)),bubble:id("wand-notif-bubble",!0),permission:Ir(t),permissionSource:t?"native":typeof Notification>"u"?"none":"browser",nativeSounds:e,nativeSound:n,hapticsEnabled:o}}function om(t,e){let n=t==="admin";return{manageSettings:n,revealEnvironment:n,manageSecurity:n,manageUpdates:n,manageConnectCode:n,nativeSounds:e.hasNativeNotifications,haptics:Mr().hapticsEnabled!==null,installDistribution:e.canInstallDistribution,manageConnectors:n}}async function Lt(t,e={}){return yc(await fetch(t,{credentials:"same-origin",...e}))}async function _t(t,e,n){return Lt(t,{method:"POST",headers:{"Content-Type":"application/json"},body:e===void 0?void 0:JSON.stringify(e),signal:n})}function ji(t,e){let n=dd(),o=e==="admin"?po(t.config):null;return{access:e,capabilities:om(e,n),about:nm(t),config:o,desiredConfig:e==="admin"?po(t.desiredConfig||t.config):null,activeConfig:e==="admin"?po(t.activeConfig||t.config):null,restartRequired:t.restartRequired===!0,hasCert:t.hasCert===!0,autoUpdate:{web:bt(t.autoUpdate).web===!0,apk:bt(t.autoUpdate).apk===!0,dmg:bt(t.autoUpdate).dmg===!0,cli:bt(t.autoUpdate).cli===!0},openRouter:e==="admin"?t.openRouter??null:null,models:null,providerCliUpdates:null,connectCode:null,notifications:Mr(),platform:n,github:cd(t.githubConnector)}}function rm(t){let e=gn();try{typeof t.sound=="boolean"&&window.localStorage.setItem("wand-notif-sound",String(t.sound)),typeof t.bubble=="boolean"&&window.localStorage.setItem("wand-notif-bubble",String(t.bubble)),typeof t.volume=="number"&&window.localStorage.setItem("wand-notif-volume",String(t.volume))}catch{}if(typeof t.sound=="boolean"&&e?.setNotificationSoundEnabled)try{e.setNotificationSoundEnabled(t.sound)}catch{}if(typeof t.volume=="number"&&e?.setNotificationVolume)try{e.setNotificationVolume(t.volume)}catch{}return Mr()}function ld(){let t=gn();if(t?.previewSound&&t.getNotificationSound)try{return t.previewSound(t.getNotificationSound()),!0}catch{return!1}try{let e=window.AudioContext||window.webkitAudioContext;if(!e)return!1;let n=new e,o=n.createOscillator(),r=n.createGain();return r.gain.value=Mr().volume/100*.08,o.frequency.value=660,o.connect(r),r.connect(n.destination),o.start(),o.stop(n.currentTime+.12),!0}catch{return!1}}async function am(){let t=gn();return t?.requestPermission?new Promise(e=>{let n=!1,o=0,r=()=>{},a=s=>{n||(n=!0,o&&window.clearTimeout(o),typeof window.removeEventListener=="function"&&window.removeEventListener("wand-android-resume",r),delete window._onNativePermissionResult,e(s))};r=()=>a(Ir(t)),o=window.setTimeout(()=>a(Ir(t)),12e4),window._onNativePermissionResult=s=>{a(s==="granted"||s==="denied"?s:"default")},typeof window.addEventListener=="function"&&window.addEventListener("wand-android-resume",r);try{t.requestPermission()}catch{a(Ir(t))}}):typeof Notification>"u"?"unsupported":Notification.requestPermission()}function im(){let t=gn(),e=Ir(t);if(e==="denied"||e==="default")return"denied";if(e==="unsupported")return"unsupported";try{return t?.sendNotification?t.sendNotification("Wand \u6D4B\u8BD5\u901A\u77E5","\u7CFB\u7EDF\u901A\u77E5\u5DF2\u6B63\u5E38\u5DE5\u4F5C\u3002","wand-test"):new Notification("Wand \u6D4B\u8BD5\u901A\u77E5",{body:"\u7CFB\u7EDF\u901A\u77E5\u5DF2\u6B63\u5E38\u5DE5\u4F5C\u3002",tag:"wand-test"}),"passed"}catch{return"failed"}}var Yi=class{constructor(e=new Xi){oe(this,"runtime",e)}async load(e={}){if(e.canManageSettings===!1)return ji(await Lt("/api/settings/about",{signal:e.signal}),"read-only");let n;try{n=await Lt("/api/settings",{signal:e.signal})}catch(l){if(l.status===403)return ji(await Lt("/api/settings/about",{signal:e.signal}),"read-only");throw l}let o=ji(n,"admin"),r=window.location?.origin?`?origin=${encodeURIComponent(window.location.origin)}`:"",[a,s,i]=await Promise.all([Lt("/api/models",{signal:e.signal}).catch(()=>null),Lt("/api/provider-cli-updates",{signal:e.signal}).catch(()=>null),Lt(`/api/app-connect-code${r}`,{signal:e.signal}).catch(()=>null)]);return o.models=a?rr(a):null,o.providerCliUpdates=s,o.connectCode=i?{code:le(i.code),url:le(i.url)}:null,o.github=cd(n.githubConnector),o}async execute(e,n={}){let o;switch(e.type){case"admin.login":o=await _t("/api/login",{password:e.password},n.signal);break;case"general.save":o=await _t("/api/settings/config",e.value,n.signal),this.runtime.configSaved(po(bt(o).config));break;case"ai.save":o=await _t("/api/settings/config",{...e.value,defaultModels:{claude:e.value.defaultModel,codex:e.value.defaultCodexModel,opencode:e.value.defaultOpenCodeModel,grok:e.value.defaultGrokModel,qoder:e.value.defaultQoderModel,pi:e.value.defaultPiModel,gemini:e.value.defaultGeminiModel}},n.signal),this.runtime.configSaved(po(bt(o).config));break;case"modelGroups.save":{let r=await _t("/api/settings/config",{modelGroups:er(e.value),expectedModelGroups:e.expected},n.signal),a=po(bt(r).config);this.runtime.configSaved(a);let s=await Lt("/api/models",{signal:n.signal}).catch(()=>null);s&&Vi(s),o={...r,config:a,models:s?rr(s):null};break}case"display.save":o=await _t("/api/settings/config",{cardDefaults:e.value},n.signal),this.runtime.configSaved(po(bt(o).config));break;case"profile.save":o=await _t("/api/settings/config",{userProfile:{name:e.value.name.trim(),avatar:e.value.avatar}},n.signal),this.runtime.configSaved(po(bt(o).config));break;case"password.change":o=await _t("/api/set-password",{password:e.password},n.signal);break;case"certificate.upload":{o={...await _t("/api/settings/upload-cert",{key:e.key,cert:e.cert},n.signal),hasCert:!0};break}case"environment.load":o=await Lt(`/api/settings/env-preview${e.reveal?"?reveal=1":""}`,{signal:n.signal});break;case"models.refresh":o=rr(await _t("/api/models/refresh",void 0,n.signal));break;case"openrouter.save":case"openrouter.refresh":case"openrouter.clear":{let r=e.type==="openrouter.clear"?await Lt("/api/settings/openrouter",{method:"DELETE",signal:n.signal}):await _t(e.type==="openrouter.save"?"/api/settings/openrouter":"/api/settings/openrouter/refresh",e.type==="openrouter.save"?{apiKey:e.apiKey}:void 0,n.signal),a=await Lt("/api/models",{signal:n.signal}).catch(()=>null);a&&Vi(a),o={...r,...a?{models:rr(a)}:{}};break}case"webUpdate.check":o=await Lt("/api/check-update",{signal:n.signal});break;case"webUpdate.install":o=await _t("/api/update",void 0,n.signal);break;case"server.restart":o=await _t("/api/restart",void 0,n.signal);break;case"cliUpdates.load":o=await Lt(`/api/provider-cli-updates${e.force?"?refresh=1":""}`,{signal:n.signal});break;case"cliUpdates.install":o=await _t("/api/provider-cli-updates",{ids:e.ids||[]},n.signal);break;case"autoUpdate.set":{let r={[e.target]:e.enabled};o=await _t("/api/auto-update",r,n.signal);break}case"updateChannel.set":{let r=await _t("/api/update-channel",{channel:e.channel},n.signal),a=await Lt("/api/check-update",{signal:n.signal});o={channel:r.channel,update:a};break}case"github.connect":o=await _t("/api/connectors/github",e.value,n.signal);break;case"github.disconnect":o=await Lt("/api/connectors/github",{method:"DELETE",signal:n.signal});break;case"github.request":o=await Lt(`/api/github${e.path}`,{method:e.method,headers:e.body?{"Content-Type":"application/json"}:void 0,body:e.body?JSON.stringify(e.body):void 0,signal:n.signal});break;case"connectCode.load":{let r=window.location?.origin?`?origin=${encodeURIComponent(window.location.origin)}`:"";o=await Lt(`/api/app-connect-code${r}`,{signal:n.signal});break}case"distribution.download":{let r=gn(),a=dd();if((e.kind==="apk"&&a.kind==="android"||e.kind==="dmg"&&a.kind==="macos")&&r?.downloadUpdate)r.downloadUpdate(e.url,e.fileName,e.source),o={started:!0,native:!0};else if(e.source==="local"){let i=await fetch(e.url,{method:"HEAD",credentials:"same-origin",signal:n.signal});if(!i.ok)throw new Error(`\u5B89\u88C5\u5305\u4E0D\u53EF\u7528\uFF08${i.status}\uFF09\u3002`);let l=document.createElement("a");l.href=e.url,l.download=e.fileName,l.rel="noopener",document.body.appendChild(l),l.click(),l.remove(),o={started:!0,native:!1}}else window.open(e.url,"_blank","noopener"),o={started:!0,native:!1};break}case"clipboard.copy":{let r=gn();if(r?.copyToClipboard){if(r.copyToClipboard(e.text)!=="ok")throw new Error("\u590D\u5236\u5230\u7CFB\u7EDF\u526A\u8D34\u677F\u5931\u8D25\u3002")}else await navigator.clipboard.writeText(e.text);o={copied:!0};break}case"notification.preferences.set":o=rm(e.value),this.runtime.notificationPreferencesChanged(o);break;case"notification.sound.preview":o={played:ld()};break;case"notification.permission.request":o={permission:await am()};break;case"notification.settings.open":{let r=gn();r?.openNotificationSettings?(r.openNotificationSettings(),o={opened:!0,native:!0}):o={opened:!1,native:!1};break}case"notification.test":{e.delayMs&&await new Promise(s=>window.setTimeout(s,e.delayMs));let r=Mr(),a=ld();r.bubble&&ka.toast("\u6D4B\u8BD5\u901A\u77E5",{description:"\u8FD9\u662F\u4E00\u6761\u6D4B\u8BD5\u901A\u77E5\u3002"}),o={sound:a?"passed":"failed",bubble:r.bubble?"passed":"disabled",system:im()};break}case"notification.nativeSound.set":{gn()?.setNotificationSound?.(e.sound),o={sound:e.sound};break}case"notification.nativeSound.preview":{let r=!1;try{gn()?.previewSound?.(e.sound),r=!0}catch{}o={played:r};break}case"notification.haptics.set":{gn()?.setHapticEnabled?.(e.enabled),o={enabled:e.enabled};break}}return o}},ud=new Yi;var Pa=D(_(),1);var Ut=D(Et(),1);function pd(){let t=Pa.useSyncExternalStore(xa.subscribe,xa.getSnapshot,xa.getServerSnapshot),[e,n]=Pa.useState(!1);return(0,Ut.jsxs)(We,{title:"\u4E3B\u9898\u914D\u8272",description:"\u7ACB\u5373\u5E94\u7528\u5E76\u81EA\u52A8\u4FDD\u5B58\u5728\u5F53\u524D\u6D4F\u89C8\u5668\uFF1B\u4E0D\u5F71\u54CD\u5176\u4ED6\u8BBE\u5907\u3002",children:[(0,Ut.jsx)(ko.Group,{name:"wand-theme","aria-label":"\u4E3B\u9898\u914D\u8272",value:t,className:"wand-theme-picker",onChange:o=>n(!Gl(o.target.value)),children:ql.map(o=>(0,Ut.jsxs)(ko,{value:o.id,className:"wand-theme-choice",children:[(0,Ut.jsxs)("span",{className:"wand-theme-preview","aria-hidden":"true",style:{background:o.background,borderColor:o.border},children:[(0,Ut.jsx)("span",{className:"wand-theme-preview-sidebar",style:{background:o.sidebar}}),(0,Ut.jsxs)("span",{className:"wand-theme-preview-lines",style:{color:o.secondary},children:[(0,Ut.jsx)("i",{}),(0,Ut.jsx)("i",{}),(0,Ut.jsx)("i",{})]}),(0,Ut.jsx)("span",{className:"wand-theme-preview-selection",style:{background:o.primary}})]}),(0,Ut.jsxs)("span",{className:"wand-theme-choice-label",children:[o.name,(0,Ut.jsx)("span",{className:"wand-theme-choice-status","aria-hidden":"true",children:t===o.id?"\u5DF2\u9009":""})]})]},o.id))}),e&&(0,Ut.jsx)(Ae,{tone:"warning",children:"\u914D\u8272\u5DF2\u5E94\u7528\u3002\u6D4F\u89C8\u5668\u672A\u5141\u8BB8\u4FDD\u5B58\uFF0C\u5237\u65B0\u540E\u53EF\u80FD\u6062\u590D\u539F\u914D\u8272\u3002"})]})}var Or=D(_(),1);var Ln=D(Et(),1);function fd({snapshot:t,repository:e,setSnapshot:n}){let[o,r]=(0,Or.useState)(""),[a,s]=(0,Or.useState)(""),[i,l]=(0,Or.useState)(""),[c,d]=(0,Or.useState)(!1),p=t.openRouter;async function f(u){if(!a){s(u),l("");try{let m=await e.execute(u==="save"?{type:"openrouter.save",apiKey:o}:u==="clear"?{type:"openrouter.clear"}:{type:"openrouter.refresh"});n(g=>g&&{...g,openRouter:m,models:m.models??g.models}),(u==="save"||u==="clear")&&r(""),d(!!m.lastError),l(m.lastError?`${u==="save"?"Key \u5DF2\u4FDD\u5B58\u3002":""}${m.lastError} \u5F53\u524D\u5206\u7EC4\u5305\u542B ${m.modelCount} \u4E2A\u5DF2\u9A8C\u8BC1\u6A21\u578B\u3002`:u==="clear"?"Key \u5DF2\u79FB\u9664\uFF0C\u514D\u8D39\u5206\u7EC4\u5DF2\u6E05\u7A7A\u3002":`\u9A8C\u8BC1\u5B8C\u6210\uFF1A${m.modelCount} \u4E2A\u53EF\u7528\uFF0C${m.rejectedCount??0} \u4E2A\u5DF2\u79FB\u9664\u3002`)}catch(m){d(!0),l(kt(m,"OpenRouter \u914D\u7F6E\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002"))}finally{s("")}}}return(0,Ln.jsxs)(We,{title:"OpenRouter \u514D\u8D39\u6A21\u578B",description:"\u5728 Pi \u4E2D\u9009\u62E9\u300C\u514D\u8D39\u5206\u7EC4\u300D\u5373\u53EF\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u5206\u914D\u5DF2\u9A8C\u8BC1\u7684\u514D\u8D39\u8BED\u8A00\u6A21\u578B\uFF0C\u65E0\u9700\u6307\u5B9A\u5177\u4F53\u6A21\u578B\u3002\u586B\u5199 Key \u540E\u7ACB\u5373\u540C\u6B65\uFF0C\u4E4B\u540E\u6BCF 6 \u5C0F\u65F6\u81EA\u52A8\u66F4\u65B0\uFF1B\u6BCF\u6B21\u8C03\u7528\u524D\u68C0\u67E5\u4EF7\u683C\uFF0C\u5DF2\u6536\u8D39\u7684\u81EA\u52A8\u6362\u7528\u5176\u4ED6\u514D\u8D39\u6A21\u578B\u3002",children:[(0,Ln.jsx)(et,{label:"OpenRouter Key",htmlFor:"settings-openrouter-key",hint:p?.configured?"Key \u5DF2\u4FDD\u5B58\uFF1B\u586B\u5199\u65B0 Key \u53EF\u4EE5\u66FF\u6362\u3002\u5BC6\u94A5\u4E0D\u4F1A\u56DE\u663E\u3002":"\u5728 OpenRouter \u521B\u5EFA API Key \u540E\u586B\u5199\u3002",children:(0,Ln.jsx)(Rt,{id:"settings-openrouter-key",type:"password",autoComplete:"new-password",value:o,onChange:r,disabled:!!a,placeholder:p?.configured?"\u586B\u5199\u65B0 Key \u4EE5\u66FF\u6362":"sk-or-v1-\u2026"})}),(0,Ln.jsxs)("div",{className:"wand-settings-library-button-row",children:[(0,Ln.jsx)(ot,{kind:"secondary",pending:a==="save",disabled:!!a||!o.trim(),onClick:()=>{f("save")},children:"\u4FDD\u5B58\u5E76\u540C\u6B65"}),(0,Ln.jsx)(ot,{kind:"ghost",pending:a==="refresh",disabled:!!a||!p?.configured,onClick:()=>{f("refresh")},children:"\u7ACB\u5373\u540C\u6B65"}),p?.configured?(0,Ln.jsx)(ot,{kind:"ghost",pending:a==="clear",disabled:!!a,onClick:()=>{f("clear")},children:"\u79FB\u9664 Key"}):null]}),(0,Ln.jsx)(Ae,{tone:i?c?"error":"success":p?.lastError?"error":"info",children:(a?"\u6B63\u5728\u540C\u6B65\u4EF7\u683C\u5E76\u9A8C\u8BC1\u65B0\u589E\u6A21\u578B\uFF0C\u8BF7\u7A0D\u5019\u2026":i)||p?.lastError||(p?.configured?`\u514D\u8D39\u5206\u7EC4 \xB7 ${p.modelCount} \u4E2A\u5DF2\u9A8C\u8BC1\u6A21\u578B \xB7 ${p.rejectedCount??0} \u4E2A\u5DF2\u79FB\u9664${p.lastSyncedAt?` \xB7 \u4E0A\u6B21\u540C\u6B65 ${new Date(p.lastSyncedAt).toLocaleString()}`:" \xB7 \u5C1A\u672A\u540C\u6B65\u6210\u529F"}`:"\u4FDD\u5B58 Key \u540E\uFF0C\u53EF\u5728 Pi \u7684\u6A21\u578B\u9009\u62E9\u5668\u4E2D\u9009\u62E9\u300C\u514D\u8D39\u5206\u7EC4\u300D\u3002")})]})}var Qt=D(_(),1);var Ie=D(Et(),1);function sm(t,e){let n=e==="claude"?"models":`${e}Models`;return[...t?.[n]??[],...e==="pi"?t?.freeModels??[]:[]].filter(r=>r.id!=="default"&&r.id!==Bi&&!_i(r.id))}function Ji(t,e){let n=structuredClone([...t]),o=n.find(a=>a.id===Zo&&a.provider==="pi"),r=Cc((e?.freeModels??[]).map(a=>a.id),o?.models??[]);return o?o.models=r:e?.freeModels!==void 0&&n.push({id:Zo,provider:"pi",name:xc,models:r}),n}function md(t,e,n){let o=e+n;if(e<0||o<0||o>=t.models.length)return t;let r=[...t.models];return[r[e],r[o]]=[r[o],r[e]],{...t,models:r}}function lm({group:t,catalog:e,disabled:n,onChange:o,onRemove:r}){let[a,s]=(0,Qt.useState)(t.id!==Zo&&!t.models.length),[i,l]=(0,Qt.useState)(""),[c,d]=(0,Qt.useState)(!1),p=t.id===Zo,f=p?e?.freeModels??[]:sm(e,t.provider),u=f.filter(g=>!t.models.includes(g.id)),m=`${t.provider}-${t.id}`;return(0,Ie.jsx)(Xo,{activeKey:a?[m]:[],onChange:g=>{s(g.includes(m)),d(!1)},items:[{key:m,label:t.name||"\u672A\u547D\u540D\u5206\u7EC4",collapsible:n?"disabled":void 0,extra:(0,Ie.jsxs)(Jo,{children:[t.models.length," \u4E2A\u6A21\u578B"]}),children:(0,Ie.jsxs)("div",{className:"wand-settings-library-group-content",children:[p?(0,Ie.jsx)("p",{children:"\u53EA\u7528\u5DF2\u9A8C\u8BC1\u4E14\u4ECD\u514D\u8D39\u7684\u6A21\u578B\uFF1B\u65B0\u6210\u5458\u8FFD\u52A0\u5230\u672B\u5C3E\uFF0C\u6536\u8D39\u6216\u4E0B\u67B6\u7684\u81EA\u52A8\u8DF3\u8FC7\u3002"}):(0,Ie.jsx)(et,{label:"\u5206\u7EC4\u540D\u79F0",htmlFor:`name-${m}`,children:(0,Ie.jsx)(Rt,{id:`name-${m}`,value:t.name,disabled:n,onChange:g=>o({...t,name:g})})}),(0,Ie.jsx)("ol",{className:"wand-settings-library-group-members","aria-label":`${t.name} \u7684\u6A21\u578B\u987A\u5E8F`,children:t.models.map((g,y)=>(0,Ie.jsxs)("li",{children:[(0,Ie.jsxs)("span",{className:"wand-settings-library-group-member-name",children:[y===0?"\u9996\u9009":`\u5019\u9009 ${y+1}`," \xB7 ",f.find(h=>h.id===g)?.label||g]}),(0,Ie.jsxs)("div",{className:"wand-settings-library-group-tools",children:[(0,Ie.jsx)($o,{kind:"ghost",size:"small","aria-label":`\u4E0A\u79FB\u6A21\u578B ${y+1}`,disabled:n||y===0,onClick:()=>o(md(t,y,-1)),children:(0,Ie.jsx)(Xt,{name:"chevronUp",size:14})}),(0,Ie.jsx)($o,{kind:"ghost",size:"small","aria-label":`\u4E0B\u79FB\u6A21\u578B ${y+1}`,disabled:n||y===t.models.length-1,onClick:()=>o(md(t,y,1)),children:(0,Ie.jsx)(Xt,{name:"chevronDown",size:14})}),p?null:(0,Ie.jsx)($o,{kind:"ghost",size:"small","aria-label":`\u79FB\u9664\u6A21\u578B ${y+1}`,disabled:n,onClick:()=>o({...t,models:t.models.filter(h=>h!==g)}),children:(0,Ie.jsx)(Xt,{name:"close",size:14})})]})]},g))}),t.models.length?null:(0,Ie.jsx)("p",{children:p?"\u5C1A\u65E0\u5DF2\u9A8C\u8BC1\u7684\u514D\u8D39\u6A21\u578B\uFF0C\u8BF7\u5148\u914D\u7F6E OpenRouter Key \u5E76\u540C\u6B65\u3002":"\u8BF7\u6DFB\u52A0\u81F3\u5C11\u4E00\u4E2A\u5177\u4F53\u6A21\u578B\u3002"}),p?null:(0,Ie.jsxs)(Ie.Fragment,{children:[(0,Ie.jsx)(mn,{id:`add-${m}`,ariaLabel:"\u4ECE\u76EE\u5F55\u6DFB\u52A0\u6A21\u578B",value:"",searchable:!0,options:[{value:"",label:"\u4ECE\u76EE\u5F55\u6DFB\u52A0\u6A21\u578B\u2026"},...u.map(g=>({value:g.id,label:g.label}))],disabled:n||t.models.length>=Ui,onChange:g=>{g&&o({...t,models:[...t.models,g]})}}),(0,Ie.jsxs)("div",{className:"wand-settings-library-group-custom",children:[(0,Ie.jsx)(Rt,{id:`custom-${m}`,placeholder:"\u6216\u8F93\u5165\u81EA\u5B9A\u4E49\u6A21\u578B ID",value:i,disabled:n,onChange:l}),(0,Ie.jsx)(wt,{kind:"secondary",size:"small",disabled:n||!i.trim()||t.models.includes(i.trim())||_i(i.trim())||i.trim()===Bi||t.models.length>=Ui,onClick:()=>{o({...t,models:[...t.models,i.trim()]}),l("")},children:"\u6DFB\u52A0\u6A21\u578B"})]}),(0,Ie.jsxs)("div",{className:"wand-settings-library-group-custom",children:[(0,Ie.jsx)(wt,{kind:"ghost",size:"small",disabled:n,onClick:()=>d(!c),children:c?"\u53D6\u6D88\u5220\u9664":"\u5220\u9664\u5206\u7EC4"}),c?(0,Ie.jsx)(wt,{kind:"danger",size:"small",disabled:n,onClick:r,children:"\u786E\u8BA4\u5220\u9664\u5206\u7EC4"}):null]}),c?(0,Ie.jsx)("p",{children:"\u5220\u9664\u540E\u4E0D\u4F1A\u6539\u5199\u5386\u53F2\uFF1B\u4ECD\u5F15\u7528\u8BE5\u5206\u7EC4\u7684\u4F1A\u8BDD\u548C\u5458\u5DE5\u9700\u8981\u91CD\u65B0\u9009\u62E9\u3002"}):null]})]})}]})}function gd({snapshot:t,repository:e,setSnapshot:n}){let o=t.config?.modelGroups??[],[r,a]=(0,Qt.useState)(()=>structuredClone(o)),[s,i]=(0,Qt.useState)(()=>Ji(o,t.models)),[l,c]=(0,Qt.useState)("claude"),[d,p]=(0,Qt.useState)(!1),[f,u]=(0,Qt.useState)(!1),[m,g]=(0,Qt.useState)(!1),[y,h]=(0,Qt.useState)(""),[S,v]=(0,Qt.useState)("info");(0,Qt.useEffect)(()=>{!d&&!f&&(a(structuredClone(o)),i(Ji(o,t.models)))},[t.config?.modelGroups,t.models,d,f]);let E=w=>{i(w),p(!0),h(""),g(!1)},R=s.filter(w=>w.provider===l);async function k(){u(!0),h("");try{let w=await e.load();if(!w.config||!w.models)throw new Error("\u672A\u53D6\u5F97\u5B8C\u6574\u914D\u7F6E\uFF0C\u5F53\u524D\u8349\u7A3F\u5DF2\u4FDD\u7559\u3002");a(structuredClone(w.config.modelGroups??[])),i(Ji(w.config.modelGroups??[],w.models)),p(!1),g(!1),n(w),v("success"),h("\u6A21\u578B\u5206\u7EC4\u4E0E\u76EE\u5F55\u5DF2\u91CD\u65B0\u52A0\u8F7D\u3002")}catch(w){h(kt(w,"\u52A0\u8F7D\u5931\u8D25\uFF0C\u8349\u7A3F\u5DF2\u4FDD\u7559\u3002")),v("error")}finally{u(!1)}}async function b(){if(!f){u(!0),h("");try{let w=await e.execute({type:"modelGroups.save",value:er(s),expected:r});a(structuredClone(w.config.modelGroups??[])),p(!1),n(C=>C&&{...C,config:w.config,desiredConfig:w.desiredConfig,activeConfig:w.activeConfig,models:w.models??C.models}),h(w.models?"\u6A21\u578B\u5206\u7EC4\u4E0E\u987A\u5E8F\u5DF2\u4FDD\u5B58\uFF0C\u6240\u6709\u9009\u62E9\u5668\u7ACB\u5373\u751F\u6548\u3002":"\u5DF2\u4FDD\u5B58\uFF1B\u76EE\u5F55\u5237\u65B0\u5931\u8D25\uFF0C\u8BF7\u5237\u65B0\u540E\u67E5\u770B\u9009\u62E9\u5668\u3002"),v("success")}catch(w){h(kt(w,"\u4FDD\u5B58\u6A21\u578B\u5206\u7EC4\u5931\u8D25\uFF0C\u8349\u7A3F\u5DF2\u4FDD\u7559\u3002")),v("error")}finally{u(!1)}}}return(0,Ie.jsxs)(We,{title:"\u6A21\u578B\u5206\u7EC4",description:"\u6BCF\u4E2A\u5DE5\u5177\u53EF\u914D\u7F6E\u591A\u4E2A\u5206\u7EC4\uFF0C\u804A\u5929\u3001\u4EFB\u52A1\u548C\u5458\u5DE5\u7684\u6A21\u578B\u9009\u62E9\u5668\u90FD\u53EF\u76F4\u63A5\u9009\u7EC4\u3002\u9996\u9009\u5728\u524D\uFF1B\u4EC5\u660E\u786E\u672A\u63A5\u53D7\u8F93\u5165\u7684\u542F\u52A8\u5931\u8D25\u624D\u5C1D\u8BD5\u4E0B\u4E00\u9879\uFF0C\u8FD0\u884C\u4E2D\u9519\u8BEF\u4E0D\u4F1A\u81EA\u52A8\u91CD\u53D1\u3002\u7EC8\u7AEF\u53EA\u4F7F\u7528\u9996\u9009\u6A21\u578B\u3002",children:[(0,Ie.jsx)(mn,{id:"settings-model-group-provider",ariaLabel:"\u914D\u7F6E\u6A21\u578B\u5206\u7EC4\u7684\u5DE5\u5177",value:l,disabled:f,options:la.map(w=>({value:w,label:yl[w]})),onChange:w=>c(w)}),R.map(w=>(0,Ie.jsx)(lm,{group:w,catalog:t.models,disabled:f,onChange:C=>E(s.map(T=>T.id===w.id&&T.provider===l?C:T)),onRemove:()=>E(s.filter(C=>C.id!==w.id||C.provider!==l))},`${w.provider}/${w.id}`)),(0,Ie.jsx)(wt,{kind:"secondary",size:"small",disabled:f||R.filter(w=>w.id!==Zo).length>=vc,onClick:()=>{let w=1;for(;R.some(T=>T.name===`\u5206\u7EC4 ${w}`);)w++;let C=globalThis.crypto?.randomUUID?.()??`${Date.now().toString(36)}_${Math.random().toString(36).slice(2,10)}`;E([...s,{id:`g_${C}`,provider:l,name:`\u5206\u7EC4 ${w}`,models:[]}])},children:"\u6DFB\u52A0\u5206\u7EC4"}),(0,Ie.jsxs)("div",{className:"wand-settings-library-group-custom",children:[(0,Ie.jsx)(wt,{kind:"ghost",size:"small",disabled:f,onClick:()=>d?g(!m):void k(),children:d?m?"\u53D6\u6D88\u653E\u5F03":"\u653E\u5F03\u8349\u7A3F\u5E76\u91CD\u8F7D":"\u5237\u65B0\u5206\u7EC4\u4E0E\u76EE\u5F55"}),m?(0,Ie.jsx)(wt,{kind:"danger",size:"small",disabled:f,onClick:()=>{k()},children:"\u786E\u8BA4\u653E\u5F03\u5F53\u524D\u8349\u7A3F"}):null]}),(0,Ie.jsx)(To,{label:"\u4FDD\u5B58\u6A21\u578B\u5206\u7EC4",pending:f,disabled:!d||!t.models,onSave:()=>{b()},status:y,tone:S})]})}var re=D(_(),1);var Fn=D(_());var Oe=D(_());var Vt=D(_()),hd=D(Mi());function Da(t,e,n){return(t-e)/(n-e)}function ar(t,e,n,o){let r=Da(e,n,o),a={};switch(t){case"rtl":a.right=`${r*100}%`,a.transform="translateX(50%)";break;case"btt":a.bottom=`${r*100}%`,a.transform="translateY(50%)";break;case"ttb":a.top=`${r*100}%`,a.transform="translateY(-50%)";break;default:a.left=`${r*100}%`,a.transform="translateX(-50%)";break}return a}function Kn(t,e){return Array.isArray(t)?t[e]:t}var ir=D(_());var Qi=D(_()),cm=Qi.createContext({min:0,max:0,direction:"ltr",step:1,includedStart:0,includedEnd:0,tabIndex:0,keyboard:!0,styles:{},classNames:{},isHandleDisabled:()=>!1}),Zt=cm,Zi=Qi.createContext({});function es(){return es=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},es.apply(this,arguments)}var dm=ir.forwardRef((t,e)=>{let{prefixCls:n,value:o,valueIndex:r,onStartMove:a,onDelete:s,style:i,render:l,dragging:c,draggingDelete:d,onOffsetChange:p,onChangeComplete:f,onFocus:u,onMouseEnter:m,...g}=t,{min:y,max:h,direction:S,keyboard:v,range:E,tabIndex:R,ariaLabelForHandle:k,ariaLabelledByForHandle:b,ariaRequired:w,ariaValueTextFormatterForHandle:C,styles:T,classNames:N,isHandleDisabled:M}=ir.useContext(Zt),A=M(r),$=`${n}-handle`,K=Y=>{if(A){Y.stopPropagation();return}a(Y,r)},V=Y=>{u?.(Y,r)},j=Y=>{m(Y,r)},X=Y=>{if(!A&&v){let J;switch(Y.which||Y.keyCode){case pt.LEFT:J=S==="ltr"||S==="btt"?-1:1;break;case pt.RIGHT:J=S==="ltr"||S==="btt"?1:-1;break;case pt.UP:J=S!=="ttb"?1:-1;break;case pt.DOWN:J=S!=="ttb"?-1:1;break;case pt.HOME:J="min";break;case pt.END:J="max";break;case pt.PAGE_UP:J=2;break;case pt.PAGE_DOWN:J=-2;break;case pt.BACKSPACE:case pt.DELETE:s?.(r);break}J!==void 0&&(Y.preventDefault(),p(J,r))}},I=Y=>{switch(Y.which||Y.keyCode){case pt.LEFT:case pt.RIGHT:case pt.UP:case pt.DOWN:case pt.HOME:case pt.END:case pt.PAGE_UP:case pt.PAGE_DOWN:f?.();break}},P=ar(S,o,y,h),L={};r!==null&&(L={tabIndex:A?void 0:Kn(R,r)??void 0,role:"slider","aria-valuemin":y,"aria-valuemax":h,"aria-valuenow":o,"aria-disabled":A,"aria-label":Kn(k,r),"aria-labelledby":Kn(b,r),"aria-required":Kn(w,r),"aria-valuetext":Kn(C,r)?.(o),"aria-orientation":S==="ltr"||S==="rtl"?"horizontal":"vertical",onMouseDown:K,onTouchStart:K,onFocus:V,onMouseEnter:j,onKeyDown:X,onKeyUp:I});let U=ir.createElement("div",es({ref:e,className:O($,{[`${$}-${r+1}`]:r!==null&&E,[`${$}-dragging`]:c,[`${$}-dragging-delete`]:d,[`${$}-disabled`]:A},N.handle),style:{...P,...i,...T.handle}},L,g));return l&&(U=l(U,{index:r,prefixCls:n,value:o,dragging:c,draggingDelete:d})),U}),ts=dm;function Ia(){return Ia=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Ia.apply(this,arguments)}var um=Vt.forwardRef((t,e)=>{let{prefixCls:n,style:o,onStartMove:r,onOffsetChange:a,values:s,handleRender:i,activeHandleRender:l,draggingIndex:c,draggingDelete:d,onFocus:p,...f}=t,u=Vt.useRef({}),[m,g]=Vt.useState(!1),[y,h]=Vt.useState(-1),S=k=>{h(k),g(!0)},v=(k,b)=>{S(b),p?.(k)},E=(k,b)=>{S(b)};Vt.useImperativeHandle(e,()=>({focus:k=>{u.current[k]?.focus()},hideHelp:()=>{(0,hd.flushSync)(()=>{g(!1)})}}));let R={prefixCls:n,onStartMove:r,onOffsetChange:a,render:i,onFocus:v,onMouseEnter:E,...f};return Vt.createElement(Vt.Fragment,null,s.map((k,b)=>{let w=c===b;return Vt.createElement(ts,Ia({ref:C=>{C?u.current[b]=C:delete u.current[b]},dragging:w,draggingDelete:w&&d,style:Kn(o,b),key:b,value:k,valueIndex:b},R))}),l&&m&&Vt.createElement(ts,Ia({key:"a11y"},R,{value:s[y],valueIndex:null,dragging:c!==-1,draggingDelete:d,render:l,style:{pointerEvents:"none"},tabIndex:void 0,"aria-hidden":!0})))}),bd=um;var ns=D(_());var Ma=D(_());var pm=t=>{let{prefixCls:e,style:n,children:o,value:r,onClick:a}=t,{min:s,max:i,direction:l,includedStart:c,includedEnd:d,included:p}=Ma.useContext(Zt),f=`${e}-text`,u=ar(l,r,s,i);return Ma.createElement("span",{className:O(f,{[`${f}-active`]:p&&c<=r&&r<=d}),style:{...u,...n},onMouseDown:m=>{m.stopPropagation()},onClick:()=>{a(r)}},o)},yd=pm;var fm=t=>{let{prefixCls:e,marks:n=[],onClick:o}=t,r=`${e}-mark`;return n.length?ns.createElement("div",{className:r},n.map(({value:a,style:s,label:i})=>ns.createElement(yd,{key:a,prefixCls:r,style:s,value:a,onClick:o},i))):null},Sd=fm;var Po=D(_());var Oa=D(_());var mm=t=>{let{prefixCls:e,value:n,style:o,activeStyle:r}=t,{min:a,max:s,direction:i,included:l,includedStart:c,includedEnd:d}=Oa.useContext(Zt),p=`${e}-dot`,f=l&&c<=n&&n<=d,u={...ar(i,n,a,s),...typeof o=="function"?o(n):o};return f&&(u={...u,...typeof r=="function"?r(n):r}),Oa.createElement("span",{className:O(p,{[`${p}-active`]:f}),style:u})},wd=mm;var gm=t=>{let{prefixCls:e,marks:n,dots:o,style:r,activeStyle:a}=t,{min:s,max:i,step:l}=Po.useContext(Zt),c=Po.useMemo(()=>{let d=new Set;if(n.forEach(p=>{d.add(p.value)}),o&&l!==null){let p=s;for(;p<=i;)d.add(p),p+=l}return Array.from(d)},[s,i,l,o,n]);return Po.createElement("div",{className:`${e}-step`},c.map(d=>Po.createElement(wd,{prefixCls:e,key:d,value:d,style:r,activeStyle:a})))},xd=gm;var $n=D(_());var Aa=D(_());var hm=t=>{let{prefixCls:e,style:n,start:o,end:r,index:a,onStartMove:s,replaceCls:i}=t,{direction:l,min:c,max:d,disabled:p,range:f,classNames:u}=Aa.useContext(Zt),m=`${e}-track`,g=Da(o,c,d),y=Da(r,c,d),h=E=>{!p&&s&&s(E,-1)},S={};switch(l){case"rtl":S.right=`${g*100}%`,S.width=`${y*100-g*100}%`;break;case"btt":S.bottom=`${g*100}%`,S.height=`${y*100-g*100}%`;break;case"ttb":S.top=`${g*100}%`,S.height=`${y*100-g*100}%`;break;default:S.left=`${g*100}%`,S.width=`${y*100-g*100}%`}let v=i||O(m,{[`${m}-${a+1}`]:a!==null&&f,[`${e}-track-draggable`]:s},u.track);return Aa.createElement("div",{className:v,style:{...S,...n},onMouseDown:h,onTouchStart:h})},os=hm;var bm=t=>{let{prefixCls:e,style:n,values:o,startPoint:r,onStartMove:a}=t,{included:s,range:i,min:l,styles:c,classNames:d,isHandleDisabled:p}=$n.useContext(Zt),u=$n.useMemo(()=>o.some((y,h)=>p(h)),[p,o])?void 0:a,m=$n.useMemo(()=>{if(!i){if(o.length===0)return[];let h=r??l,S=o[0];return[{start:Math.min(h,S),end:Math.max(h,S)}]}let y=[];for(let h=0;h<o.length-1;h+=1)y.push({start:o[h],end:o[h+1]});return y},[o,i,r,l]);if(!s)return null;let g=m?.length&&(d.tracks||c.tracks)?$n.createElement(os,{index:null,prefixCls:e,start:m[0].start,end:m[m.length-1].end,replaceCls:O(d.tracks,`${e}-tracks`),style:c.tracks}):null;return $n.createElement($n.Fragment,null,g,m.map(({start:y,end:h},S)=>$n.createElement(os,{index:S,prefixCls:e,style:{...Kn(n,S),...c.track},start:y,end:h,key:S,onStartMove:u})))},vd=bm;var Ar=D(_()),ym=t=>{let e=Ar.useCallback(o=>typeof t=="boolean"?t:t[o]??!1,[t]),n=Ar.useCallback(o=>typeof t=="boolean"?[t,t&&o.length>0]:[o.length>0&&o.every((r,a)=>e(a)),o.some((r,a)=>e(a))],[t,e]);return Ar.useMemo(()=>[e,n],[e,n])},Cd=ym;var Ht=D(_());var Sm=130;function Ed(t){let e="targetTouches"in t?t.targetTouches[0]:t;return{pageX:e.pageX,pageY:e.pageY}}function wm(t,e,n,o,r,a,s,i,l,c,d,p){let[f,u]=Ht.useState(null),[m,g]=Ht.useState(-1),[y,h]=Ht.useState(!1),[S,v]=Ht.useState(n),[E,R]=Ht.useState(n),k=Ht.useRef(null),b=Ht.useRef(null),w=Ht.useRef(null),{onDragStart:C,onDragChange:T}=Ht.useContext(Zi);Mt(()=>{m===-1&&v(n)},[n,m]),Ht.useEffect(()=>()=>{k.current&&document.removeEventListener("mousemove",k.current),b.current&&document.removeEventListener("mouseup",b.current),w.current&&(k.current&&w.current.removeEventListener("touchmove",k.current),b.current&&w.current.removeEventListener("touchend",b.current))},[]);let N=(K,V,j)=>{V!==void 0&&u(V),v(K);let X=K;j&&(X=K.filter((I,P)=>P!==m)),s(X),T&&T({rawValues:K,deleteIndex:j?m:-1,draggingIndex:m,draggingValue:V})},M=lt((K,V,j)=>{if(K===-1){if(E.some((H,Q)=>p(Q)))return;let X=E[0],I=E[E.length-1],P=o-X,L=r-I,U=V*(r-o);U=Math.max(U,P),U=Math.min(U,L),U=a(X+U)-X;let J=E.map(H=>H+U);N(J)}else{let X=(r-o)*V,I=[...S];I[K]=E[K];let P=l(I,X,K,"dist");N(P.values,P.value,j)}}),A=(K,V,j)=>{K.stopPropagation();let X=j||n;if(p(V))return;let I=X[V];g(V),u(I),R(X),v(X),h(!1);let{pageX:P,pageY:L}=Ed(K),U=!1;C&&C({rawValues:X,draggingIndex:V,draggingValue:I});let Y=H=>{H.preventDefault();let{pageX:Q,pageY:pe}=Ed(H),ce=Q-P,se=pe-L,{width:de,height:ye}=t.current.getBoundingClientRect(),xe,Z;switch(e){case"btt":xe=-se/ye,Z=ce;break;case"ttb":xe=se/ye,Z=ce;break;case"rtl":xe=-ce/de,Z=se;break;default:xe=ce/de,Z=se}U=c?Math.abs(Z)>Sm&&d<S.length:!1,h(U),M(V,xe,U)},J=H=>{H.preventDefault(),document.removeEventListener("mouseup",J),document.removeEventListener("mousemove",Y),w.current&&(k.current&&w.current.removeEventListener("touchmove",k.current),b.current&&w.current.removeEventListener("touchend",b.current)),k.current=null,b.current=null,w.current=null,i(U),g(-1),h(!1)};document.addEventListener("mouseup",J),document.addEventListener("mousemove",Y),K.currentTarget.addEventListener("touchend",J),K.currentTarget.addEventListener("touchmove",Y),k.current=Y,b.current=J,w.current=K.currentTarget},$=Ht.useMemo(()=>{let K=[...n].sort((P,L)=>P-L),V=[...S].sort((P,L)=>P-L),j={};V.forEach(P=>{j[P]=(j[P]||0)+1}),K.forEach(P=>{j[P]=(j[P]||0)-1});let X=c?1:0;return Object.values(j).reduce((P,L)=>P+Math.abs(L),0)<=X?S:n},[n,S,c]);return[m,f,y,$,A]}var Rd=wm;var La=D(_()),sr=(t,e,n,o,r,a)=>{let s=typeof r=="number"?r:0,i=n,l=o;for(let c=e-1;c>=0;c-=1)if(a(c)){i=t[c]+s;break}for(let c=e+1;c<t.length;c+=1)if(a(c)){l=t[c]-s;break}return[i,l]},Nd=(t,e,n,o,r,a)=>{let s=-1,i=o-n;return t.forEach((l,c)=>{if(a(c))return;let[d,p]=sr(t,c,n,o,r,a);if(d<=e&&e<=p){let f=Math.abs(e-l);f<=i&&(i=f,s=c)}}),s};function rs(t,e,n,o,r,a,s){let i=La.useCallback(m=>Math.max(t,Math.min(e,m)),[t,e]),l=La.useCallback(m=>{if(n!==null){let g=t+Math.round((i(m)-t)/n)*n,y=v=>(String(v).split(".")[1]||"").length,h=Math.max(y(n),y(e),y(t)),S=Number(g.toFixed(h));return t<=S&&S<=e?S:null}return null},[n,t,e,i]),c=La.useCallback(m=>{let g=i(m),y=o.map(v=>v.value);n!==null&&y.push(l(m)),y.push(t,e);let h=y[0],S=e-t;return y.forEach(v=>{let E=Math.abs(g-v);E<=S&&(h=v,S=E)}),h},[t,e,o,n,i,l]),d=(m,g,y,h="unit")=>{if(typeof g=="number"){let S,v=m[y],E=v+g,R=[];o.forEach(C=>{R.push(C.value)}),R.push(t,e),R.push(l(v));let k=g>0?1:-1;h==="unit"?R.push(l(v+k*n)):R.push(l(E)),R=R.filter(C=>C!==null).filter(C=>g<0?C<=v:C>=v),h==="unit"&&(R=R.filter(C=>C!==v));let b=h==="unit"?v:E;S=R[0];let w=Math.abs(S-b);if(R.forEach(C=>{let T=Math.abs(C-b);T<w&&(S=C,w=T)}),S===void 0)return g<0?t:e;if(h==="dist")return S;if(Math.abs(g)>1){let C=[...m];return C[y]=S,d(C,g-k,y,h)}return S}else{if(g==="min")return t;if(g==="max")return e}return e},p=(m,g,y,h="unit")=>{let S=m[y],v=d(m,g,y,h);return{value:v,changed:v!==S}},f=m=>a===null&&m===0||typeof a=="number"&&m<a;return[c,(m,g,y,h="unit")=>{let S=m.map(c),v=S[y],[E,R]=sr(S,y,t,e,a,s),k=d(S,g,y,h);if(S[y]=k,E<=R?S[y]=Math.max(E,Math.min(R,S[y])):S[y]=v,r===!1){let b=a||0;y>0&&S[y-1]!==v&&(S[y]=Math.max(S[y],S[y-1]+b)),y<S.length-1&&S[y+1]!==v&&(S[y]=Math.min(S[y],S[y+1]-b))}else if(typeof a=="number"||a===null){for(let b=y+1;b<S.length&&!s(b);b+=1){let w=!0;for(;f(S[b]-S[b-1])&&w;)({value:S[b],changed:w}=p(S,1,b));let[,C]=sr(S,b,t,e,a,s);S[b]=Math.min(S[b],C)}for(let b=y;b>0&&!s(b-1);b-=1){let w=!0;for(;f(S[b]-S[b-1])&&w;)({value:S[b-1],changed:w}=p(S,-1,b-1));let[C]=sr(S,b-1,t,e,a,s);S[b-1]=Math.max(S[b-1],C)}for(let b=S.length-1;b>0;b-=1){if(s(b)||s(b-1))continue;let w=!0;for(;f(S[b]-S[b-1])&&w;)({value:S[b-1],changed:w}=p(S,-1,b-1));let[C]=sr(S,b-1,t,e,a,s);S[b-1]=Math.max(S[b-1],C)}for(let b=0;b<S.length-1;b+=1){if(s(b)||s(b+1))continue;let w=!0;for(;f(S[b+1]-S[b])&&w;)({value:S[b+1],changed:w}=p(S,1,b+1));let[,C]=sr(S,b+1,t,e,a,s);S[b+1]=Math.min(S[b+1],C)}}return{value:S[y],values:S}}]}var kd=D(_());function as(t){return(0,kd.useMemo)(()=>{if(t===!0||!t)return[!!t,!1,!1,0];let{editable:e,draggableTrack:n,minCount:o,maxCount:r}=t;return[!0,!!e,!e&&!!n,o||0,r]},[t])}var xm=Oe.forwardRef((t,e)=>{let{prefixCls:n="rc-slider",className:o,style:r,classNames:a,styles:s,id:i,disabled:l=!1,keyboard:c=!0,autoFocus:d,onFocus:p,onBlur:f,min:u=0,max:m=100,step:g=1,value:y,defaultValue:h,range:S,count:v,onChange:E,onBeforeChange:R,onAfterChange:k,onChangeComplete:b,allowCross:w=!0,pushable:C=!1,reverse:T,vertical:N,included:M=!0,startPoint:A,trackStyle:$,handleStyle:K,railStyle:V,dotStyle:j,activeDotStyle:X,marks:I,dots:P,handleRender:L,activeHandleRender:U,track:Y,tabIndex:J=0,ariaLabelForHandle:H,ariaLabelledByForHandle:Q,ariaRequired:pe,ariaValueTextFormatterForHandle:ce}=t,se=Oe.useRef(null),de=Oe.useRef(null),[ye,xe]=Wn(h,y),Z=Oe.useMemo(()=>N?T?"ttb":"btt":T?"rtl":"ltr",[T,N]),[q,F,W,ge,z]=as(S),ae=Oe.useMemo(()=>isFinite(u)?u:0,[u]),Ne=Oe.useMemo(()=>isFinite(m)?m:100,[m]),Me=Oe.useMemo(()=>g!==null&&g<=0?1:g,[g]),Ee=Oe.useMemo(()=>typeof C=="boolean"?C?Me:!1:C>=0?C:!1,[C,Me]),Ve=Oe.useMemo(()=>{let ue=I||{};return Object.keys(ue).map(he=>{let me=ue[he],De={value:Number(he)};return me&&typeof me=="object"&&!Oe.isValidElement(me)&&("label"in me||"style"in me)?(De.style=me.style,De.label=me.label):De.label=me,De}).filter(({label:he})=>he||typeof he=="number").sort((he,me)=>he.value-me.value)},[I]),[ze,ve]=Cd(l),[gt,G]=rs(ae,Ne,Me,Ve,w,Ee,ze),Se=Oe.useMemo(()=>{let ue=ye==null?[]:Array.isArray(ye)?ye:[ye],[he=ae]=ue,me=ye===null?[]:[he];if(q){if(me=[...ue],v||ye===void 0){let De=v!==void 0&&v>=0?v+1:2;for(me=me.slice(0,De);me.length<De;)me.push(me[me.length-1]??ae)}me.sort((De,Gt)=>De-Gt)}return me.forEach((De,Gt)=>{me[Gt]=gt(De)}),me},[ye,q,ae,v,gt]),[qe,Fe]=Oe.useMemo(()=>ve(Se),[ve,Se]),ie=F&&!Fe,$e=ue=>q?ue:ue[0],ke=lt(ue=>{let he=[...ue].sort((me,De)=>me-De);E&&!ln(he,Se,!0)&&E($e(he)),xe(he)}),Te=lt(ue=>{ue&&se.current.hideHelp();let he=$e(Se);k?.(he),Ot(!k,"[rc-slider] `onAfterChange` is deprecated. Please use `onChangeComplete` instead."),b?.(he)}),Be=ue=>{if(qe||!ie||Se.length<=ge)return;let he=[...Se];he.splice(ue,1),R?.($e(he)),ke(he);let me=Math.max(0,ue-1);se.current.hideHelp(),se.current.focus(me)},[_e,Xe,tt,Ye,vt]=Rd(de,Z,Se,ae,Ne,gt,ke,Te,G,ie,ge,ze),Bt=(ue,he)=>{if(!qe){let me=Se.length?Nd(Se,ue,ae,Ne,Ee,ze):0;if(me===-1)return;let De=[...Se],Gt=0,zn=Se.length?Math.abs(ue-Se[me]):Ne-ae;Se.forEach((Cn,pn)=>{Cn<ue&&(Gt=pn)});let Nt=me;ie&&zn!==0&&(!z||Se.length<z)?(De.splice(Gt+1,0,ue),Nt=Gt+1):(De[me]=ue,Nt=me),q&&!Se.length&&v===void 0&&De.push(ue);let vn=$e(De);R?.(vn),ke(De),he?(document.activeElement?.blur?.(),se.current.focus(Nt),vt(he,Nt,De)):(k?.(vn),Ot(!k,"[rc-slider] `onAfterChange` is deprecated. Please use `onChangeComplete` instead."),b?.(vn))}},zt=ue=>{ue.preventDefault();let{width:he,height:me,left:De,top:Gt,bottom:zn,right:Nt}=de.current.getBoundingClientRect(),{clientX:vn,clientY:Cn}=ue,pn;switch(Z){case"btt":pn=(zn-Cn)/me;break;case"ttb":pn=(Cn-Gt)/me;break;case"rtl":pn=(Nt-vn)/he;break;default:pn=(vn-De)/he}let It=ae+pn*(Ne-ae);Bt(gt(It),ue)},[Dt,Ct]=Oe.useState(null),it=(ue,he)=>{if(!qe&&!ze(he)){let me=G(Se,ue,he);R?.($e(Se)),ke(me.values),Ct({value:me.value,index:he})}};Oe.useEffect(()=>{if(Dt!==null){let{value:ue,index:he}=Dt,me=Se[he]===ue?he:Se.indexOf(ue);me>=0&&se.current.focus(me)}Ct(null)},[Dt]);let dt=Oe.useMemo(()=>W&&Me===null?!1:W,[W,Me]),rn=lt((ue,he)=>{vt(ue,he),R?.($e(Se))}),ht=_e!==-1;Oe.useEffect(()=>{if(!ht){let ue=Se.lastIndexOf(Xe);se.current.focus(ue)}},[ht]);let fe=Oe.useMemo(()=>[...Ye].sort((ue,he)=>ue-he),[Ye]),[Pe,Ze]=Oe.useMemo(()=>q?[fe[0],fe[fe.length-1]]:[ae,fe[0]],[fe,q,ae]);Oe.useImperativeHandle(e,()=>({focus:()=>{se.current.focus(0)},blur:()=>{let{activeElement:ue}=document;de.current?.contains(ue)&&ue?.blur()}}));let Re=Oe.useRef(d);Oe.useEffect(()=>{Re.current&&se.current.focus(0)},[]);let Ge=Oe.useMemo(()=>({min:ae,max:Ne,direction:Z,disabled:qe,keyboard:c,step:Me,included:M,includedStart:Pe,includedEnd:Ze,range:q,tabIndex:J,ariaLabelForHandle:H,ariaLabelledByForHandle:Q,ariaRequired:pe,ariaValueTextFormatterForHandle:ce,styles:s||{},classNames:a||{},isHandleDisabled:ze}),[ae,Ne,Z,qe,c,Me,M,Pe,Ze,q,J,H,Q,pe,ce,s,a,ze]);return Oe.createElement(Zt.Provider,{value:Ge},Oe.createElement("div",{ref:de,className:O(n,o,{[`${n}-disabled`]:qe,[`${n}-vertical`]:N,[`${n}-horizontal`]:!N,[`${n}-with-marks`]:Ve.length}),style:r,onMouseDown:zt,id:i},Oe.createElement("div",{className:O(`${n}-rail`,a?.rail),style:{...V,...s?.rail}}),Y!==!1&&Oe.createElement(vd,{prefixCls:n,style:$,values:Se,startPoint:A,onStartMove:dt?rn:void 0}),Oe.createElement(xd,{prefixCls:n,marks:Ve,dots:P,style:j,activeStyle:X}),Oe.createElement(bd,{ref:se,prefixCls:n,style:K,values:Ye,draggingIndex:_e,draggingDelete:tt,onStartMove:rn,onOffsetChange:it,onFocus:p,onBlur:f,handleRender:L,activeHandleRender:U,onChangeComplete:Te,onDelete:ie?Be:void 0}),Oe.createElement(Sd,{prefixCls:n,marks:Ve,onClick:Bt})))}),$d=xm;var Td=$d;var Pd=D(_()),vm=(0,Pd.createContext)({}),Dd=vm;var lr=D(_()),is=D(_());var Cm=lr.forwardRef((t,e)=>{let{open:n,draggingDelete:o,value:r}=t,a=(0,is.useRef)(null),s=n&&!o,i=(0,is.useRef)(null);function l(){sn.cancel(i.current),i.current=null}function c(){i.current=sn(()=>{a.current?.forceAlign(),i.current=null})}return lr.useEffect(()=>(s?c():l(),l),[s,t.title,r]),lr.createElement(On,{ref:El(a,e),...t,open:s})}),ss=Cm;var Em=t=>{let{componentCls:e,antCls:n,controlSize:o,dotSize:r,marginFull:a,marginPart:s,colorFillContentHover:i,handleColorDisabled:l,calc:c,handleSize:d,handleSizeHover:p,handleActiveColor:f,handleActiveOutlineColor:u,handleLineWidth:m,handleLineWidthHover:g,motionDurationMid:y}=t,h={backgroundColor:t.colorBgElevated,cursor:"not-allowed",width:d,height:d,boxShadow:`0 0 0 ${B(m)} ${l}`,insetInlineStart:0,insetBlockStart:0};return{[e]:{...Mn(t),position:"relative",height:o,margin:`${B(s)} ${B(a)}`,padding:0,cursor:"pointer",touchAction:"none",userSelect:"none","&-vertical":{margin:`${B(a)} ${B(s)}`},[`${e}-rail`]:{position:"absolute",backgroundColor:t.railBg,borderRadius:t.borderRadiusXS,transition:`background-color ${y}`},[`${e}-track,${e}-tracks`]:{position:"absolute",transition:`background-color ${y}`},[`${e}-track`]:{backgroundColor:t.trackBg,borderRadius:t.borderRadiusXS},[`${e}-track-draggable`]:{boxSizing:"content-box",backgroundClip:"content-box",border:"solid rgba(0,0,0,0)"},"&:hover":{[`${e}-rail`]:{backgroundColor:t.railHoverBg},[`${e}-track`]:{backgroundColor:t.trackHoverBg},[`${e}-dot`]:{borderColor:i},[`${e}-handle:not(${e}-handle-disabled)::after`]:{boxShadow:`0 0 0 ${B(m)} ${t.colorPrimaryBorderHover}`},[`${e}-dot-active`]:{borderColor:t.dotActiveBorderColor}},[`${e}-handle`]:{position:"absolute",width:d,height:d,outline:"none",userSelect:"none","&-dragging-delete":{opacity:0},"&::before":{content:'""',position:"absolute",insetInlineStart:c(m).mul(-1).equal(),insetBlockStart:c(m).mul(-1).equal(),width:c(d).add(c(m).mul(2)).equal(),height:c(d).add(c(m).mul(2)).equal(),backgroundColor:"transparent"},"&::after":{content:'""',position:"absolute",insetBlockStart:0,insetInlineStart:0,width:d,height:d,backgroundColor:t.colorBgElevated,boxShadow:`0 0 0 ${B(m)} ${t.handleColor}`,outline:"0px solid transparent",borderRadius:"50%",cursor:"pointer",transition:["inset-inline-start","inset-block-start","width","height","box-shadow","outline"].map(S=>`${S} ${y}`).join(", ")},"&:hover, &:active, &:focus":{[`&:not(${e}-handle-disabled)::before`]:{insetInlineStart:c(p).sub(d).div(2).add(g).mul(-1).equal(),insetBlockStart:c(p).sub(d).div(2).add(g).mul(-1).equal(),width:c(p).add(c(g).mul(2)).equal(),height:c(p).add(c(g).mul(2)).equal()},[`&:not(${e}-handle-disabled)::after`]:{boxShadow:`0 0 0 ${B(g)} ${f}`,outline:`6px solid ${u}`,width:p,height:p,insetInlineStart:t.calc(d).sub(p).div(2).equal(),insetBlockStart:t.calc(d).sub(p).div(2).equal()}}},[`&-lock ${e}-handle`]:{"&::before, &::after":{transition:"none"}},[`${e}-mark`]:{position:"absolute",fontSize:t.fontSize},[`${e}-mark-text`]:{position:"absolute",display:"inline-block",color:t.colorTextDescription,textAlign:"center",wordBreak:"keep-all",cursor:"pointer",userSelect:"none","&-active":{color:t.colorText}},[`${e}-step`]:{position:"absolute",background:"transparent",pointerEvents:"none"},[`${e}-dot`]:{position:"absolute",width:r,height:r,backgroundColor:t.colorBgElevated,border:`${B(m)} solid ${t.dotBorderColor}`,borderRadius:"50%",cursor:"pointer",transition:`border-color ${t.motionDurationSlow}`,pointerEvents:"auto","&-active":{borderColor:t.dotActiveBorderColor}},[`&${e}-disabled`]:{cursor:"not-allowed",[`${e}-rail`]:{backgroundColor:`${t.railBg} !important`},[`${e}-track`]:{backgroundColor:`${t.trackBgDisabled} !important`},[`
|
|
3
3
|
${e}-dot
|
|
4
4
|
`]:{backgroundColor:t.colorBgElevated,borderColor:t.trackBgDisabled,boxShadow:"none",cursor:"not-allowed"},[`${e}-handle::after`]:{...h},[`
|