@agent-spaces/server 0.3.0 → 0.3.2
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/dist/adapters/claude-code-runtime/index.js +48 -6
- package/dist/adapters/claude-code-runtime/message-format.js +3 -3
- package/dist/adapters/git.js +140 -2
- package/dist/agents/agent-designer.js +334 -0
- package/dist/agents/agent-message-parts.js +8 -0
- package/dist/agents/commit-agent.js +9 -2
- package/dist/agents/issue-agent-runner.js +0 -1
- package/dist/agents/issue-task-controller.js +14 -4
- package/dist/app.js +51 -1
- package/dist/package.json +1 -1
- package/dist/routes/agent-sse.js +4 -1
- package/dist/routes/agent.js +15 -0
- package/dist/routes/channel.js +1 -1
- package/dist/routes/file.js +97 -1
- package/dist/routes/git.js +122 -1
- package/dist/routes/iframe-bookmarks.js +33 -0
- package/dist/routes/issue.js +12 -0
- package/dist/routes/speech-recognition.js +99 -0
- package/dist/services/agent.js +48 -5
- package/dist/services/builtin-tools.js +67 -1
- package/dist/services/channel.js +2 -0
- package/dist/services/command-process-manager.js +14 -1
- package/dist/services/file.js +86 -6
- package/dist/services/gitignore.js +65 -0
- package/dist/services/issue-retry.js +2 -1
- package/dist/services/issue.js +13 -4
- package/dist/services/notification-hub/bot-agent.js +9 -1
- package/dist/services/persistent-agent-context.js +155 -0
- package/dist/services/pty.js +47 -2
- package/dist/services/search.js +11 -3
- package/dist/services/speech-recognition/base.js +3 -0
- package/dist/services/speech-recognition/index.js +16 -0
- package/dist/services/speech-recognition/tencent.js +117 -0
- package/dist/storage/iframe-bookmarks-store.js +46 -0
- package/dist/storage/speech-recognition-store.js +61 -0
- package/dist/web/404.html +1 -1
- package/dist/web/__next.__PAGE__.txt +4 -4
- package/dist/web/__next._full.txt +31 -26
- package/dist/web/__next._head.txt +4 -4
- package/dist/web/__next._index.txt +17 -13
- package/dist/web/__next._tree.txt +2 -2
- package/dist/web/_next/static/chunks/00amm3dvu3po9.js +31 -0
- package/dist/web/_next/static/chunks/01hrib8z5bn-6.js +5 -0
- package/dist/web/_next/static/chunks/08nbjuc5i-ewu.js +3 -0
- package/dist/web/_next/static/chunks/0anuxr11yn5iv.js +2 -0
- package/dist/web/_next/static/chunks/0cxrev-hb8gkk.js +2 -0
- package/dist/web/_next/static/chunks/0egot8y~i-ge3.js +1 -0
- package/dist/web/_next/static/chunks/0e~0o6v_awcod.js +1 -0
- package/dist/web/_next/static/chunks/0f_dcx0nu5z7o.js +1 -0
- package/dist/web/_next/static/chunks/0fpf.rso9mhc0.js +1 -0
- package/dist/web/_next/static/chunks/0jc-4igj54z00.js +189 -0
- package/dist/web/_next/static/chunks/0plreh4_gkxf9.js +1 -0
- package/dist/web/_next/static/chunks/0u7_qd9hzqwac.js +1 -0
- package/dist/web/_next/static/chunks/0uo5x.bu.5u2-.css +1 -0
- package/dist/web/_next/static/chunks/0utxlfbckz4f5.js +1 -0
- package/dist/web/_next/static/chunks/0vesz93a98px4.js +1 -0
- package/dist/web/_next/static/chunks/0w1iudd1d46sw.js +8 -0
- package/dist/web/_next/static/chunks/0w3o.7vi.dlm6.js +1 -0
- package/dist/web/_next/static/chunks/0xtmr0y4vo-~p.js +1 -0
- package/dist/web/_next/static/chunks/11ozf700niy2z.js +1 -0
- package/dist/web/_next/static/chunks/{0jmsjlawtg6oa.js → 145gbwitjxamg.js} +1 -1
- package/dist/web/_next/static/chunks/{turbopack-0lxiiw.jhevml.js → turbopack-0kcwat8.leugk.js} +1 -1
- package/dist/web/_not-found/__next._full.txt +34 -30
- package/dist/web/_not-found/__next._head.txt +4 -4
- package/dist/web/_not-found/__next._index.txt +17 -13
- package/dist/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/dist/web/_not-found/__next._not-found.txt +3 -3
- package/dist/web/_not-found/__next._tree.txt +2 -2
- package/dist/web/_not-found.html +1 -1
- package/dist/web/_not-found.txt +34 -30
- package/dist/web/index.html +1 -1
- package/dist/web/index.txt +31 -26
- package/dist/web/login/__next._full.txt +35 -29
- package/dist/web/login/__next._head.txt +4 -4
- package/dist/web/login/__next._index.txt +17 -13
- package/dist/web/login/__next._tree.txt +2 -2
- package/dist/web/login/__next.login.__PAGE__.txt +4 -4
- package/dist/web/login/__next.login.txt +3 -3
- package/dist/web/login.html +1 -1
- package/dist/web/login.txt +35 -29
- package/dist/web/settings/__next._full.txt +36 -34
- package/dist/web/settings/__next._head.txt +4 -4
- package/dist/web/settings/__next._index.txt +17 -13
- package/dist/web/settings/__next._tree.txt +2 -2
- package/dist/web/settings/__next.settings.__PAGE__.txt +4 -4
- package/dist/web/settings/__next.settings.txt +5 -5
- package/dist/web/settings/agents/__next._full.txt +38 -35
- package/dist/web/settings/agents/__next._head.txt +4 -4
- package/dist/web/settings/agents/__next._index.txt +17 -13
- package/dist/web/settings/agents/__next._tree.txt +2 -2
- package/dist/web/settings/agents/__next.settings.agents.__PAGE__.txt +4 -4
- package/dist/web/settings/agents/__next.settings.agents.txt +3 -3
- package/dist/web/settings/agents/__next.settings.txt +5 -5
- package/dist/web/settings/agents.html +1 -1
- package/dist/web/settings/agents.txt +38 -35
- package/dist/web/settings/mcps/__next._full.txt +38 -35
- package/dist/web/settings/mcps/__next._head.txt +4 -4
- package/dist/web/settings/mcps/__next._index.txt +17 -13
- package/dist/web/settings/mcps/__next._tree.txt +2 -2
- package/dist/web/settings/mcps/__next.settings.mcps.__PAGE__.txt +4 -4
- package/dist/web/settings/mcps/__next.settings.mcps.txt +3 -3
- package/dist/web/settings/mcps/__next.settings.txt +5 -5
- package/dist/web/settings/mcps.html +1 -1
- package/dist/web/settings/mcps.txt +38 -35
- package/dist/web/settings/models/__next._full.txt +38 -35
- package/dist/web/settings/models/__next._head.txt +4 -4
- package/dist/web/settings/models/__next._index.txt +17 -13
- package/dist/web/settings/models/__next._tree.txt +2 -2
- package/dist/web/settings/models/__next.settings.models.__PAGE__.txt +4 -4
- package/dist/web/settings/models/__next.settings.models.txt +3 -3
- package/dist/web/settings/models/__next.settings.txt +5 -5
- package/dist/web/settings/models.html +1 -1
- package/dist/web/settings/models.txt +38 -35
- package/dist/web/settings/providers/__next._full.txt +38 -35
- package/dist/web/settings/providers/__next._head.txt +4 -4
- package/dist/web/settings/providers/__next._index.txt +17 -13
- package/dist/web/settings/providers/__next._tree.txt +2 -2
- package/dist/web/settings/providers/__next.settings.providers.__PAGE__.txt +4 -4
- package/dist/web/settings/providers/__next.settings.providers.txt +3 -3
- package/dist/web/settings/providers/__next.settings.txt +5 -5
- package/dist/web/settings/providers.html +1 -1
- package/dist/web/settings/providers.txt +38 -35
- package/dist/web/settings/skills/__next._full.txt +38 -35
- package/dist/web/settings/skills/__next._head.txt +4 -4
- package/dist/web/settings/skills/__next._index.txt +17 -13
- package/dist/web/settings/skills/__next._tree.txt +2 -2
- package/dist/web/settings/skills/__next.settings.skills.__PAGE__.txt +4 -4
- package/dist/web/settings/skills/__next.settings.skills.txt +3 -3
- package/dist/web/settings/skills/__next.settings.txt +5 -5
- package/dist/web/settings/skills.html +1 -1
- package/dist/web/settings/skills.txt +38 -35
- package/dist/web/settings.html +1 -1
- package/dist/web/settings.txt +36 -34
- package/dist/web/workflows/__next._full.txt +36 -31
- package/dist/web/workflows/__next._head.txt +4 -4
- package/dist/web/workflows/__next._index.txt +17 -13
- package/dist/web/workflows/__next._tree.txt +2 -2
- package/dist/web/workflows/__next.workflows.__PAGE__.txt +4 -4
- package/dist/web/workflows/__next.workflows.txt +3 -3
- package/dist/web/workflows.html +1 -1
- package/dist/web/workflows.txt +36 -31
- package/dist/web/workspace/_/__next._full.txt +39 -34
- package/dist/web/workspace/_/__next._head.txt +4 -4
- package/dist/web/workspace/_/__next._index.txt +17 -13
- package/dist/web/workspace/_/__next._tree.txt +2 -2
- package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +3 -3
- package/dist/web/workspace/_/__next.workspace.$d$id.txt +3 -3
- package/dist/web/workspace/_/__next.workspace.txt +3 -3
- package/dist/web/workspace/_.html +1 -1
- package/dist/web/workspace/_.txt +39 -34
- package/dist/web/workspaces/__next._full.txt +35 -30
- package/dist/web/workspaces/__next._head.txt +4 -4
- package/dist/web/workspaces/__next._index.txt +17 -13
- package/dist/web/workspaces/__next._tree.txt +2 -2
- package/dist/web/workspaces/__next.workspaces.__PAGE__.txt +4 -4
- package/dist/web/workspaces/__next.workspaces.txt +3 -3
- package/dist/web/workspaces.html +1 -1
- package/dist/web/workspaces.txt +35 -30
- package/dist/ws/agent-prompt.js +48 -18
- package/dist/ws/agent-runner.js +10 -3
- package/dist/ws/message-parts.js +8 -0
- package/dist/ws/terminal-handler.js +1 -1
- package/package.json +1 -1
- package/public/avatars/1778953228323-5je54x-user.jpg +0 -0
- package/public/avatars/1778954057880-g01q6y-user.jpg +0 -0
- package/dist/web/_next/static/chunks/002-dxhags4dj.js +0 -2
- package/dist/web/_next/static/chunks/00fu7sjtftd3f.js +0 -1
- package/dist/web/_next/static/chunks/00s_1ft2-qz0r.js +0 -1
- package/dist/web/_next/static/chunks/02wkg1tjv~_t2.js +0 -1
- package/dist/web/_next/static/chunks/03jy~o.gx._e-.js +0 -3
- package/dist/web/_next/static/chunks/07bs5ds68tg38.js +0 -2
- package/dist/web/_next/static/chunks/0b1w9_ne4c2ez.js +0 -1
- package/dist/web/_next/static/chunks/0bzechrx76-ix.js +0 -1
- package/dist/web/_next/static/chunks/0csqa76ud3h4d.js +0 -1
- package/dist/web/_next/static/chunks/0fxdvo63ywaa~.js +0 -1
- package/dist/web/_next/static/chunks/0k5bmi-es-2nj.js +0 -1
- package/dist/web/_next/static/chunks/0pep4mkvt3.rh.js +0 -31
- package/dist/web/_next/static/chunks/0tqwdxb-8t_n1.js +0 -1
- package/dist/web/_next/static/chunks/0y5ipuqgqfrob.js +0 -8
- package/dist/web/_next/static/chunks/0yc41k980zabo.js +0 -1
- package/dist/web/_next/static/chunks/0zhhkzv4.0koq.js +0 -183
- package/dist/web/_next/static/chunks/0zl19l5tuoppw.js +0 -1
- package/dist/web/_next/static/chunks/102lz3yanx8i~.css +0 -1
- package/dist/web/_next/static/chunks/13wm9.vry~.lh.js +0 -5
- /package/dist/web/_next/static/{XzP71HbFE1fuE_bLT-x7i → 9X6R42UNn3h4WL_zj_Yh4}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{XzP71HbFE1fuE_bLT-x7i → 9X6R42UNn3h4WL_zj_Yh4}/_clientMiddlewareManifest.js +0 -0
- /package/dist/web/_next/static/{XzP71HbFE1fuE_bLT-x7i → 9X6R42UNn3h4WL_zj_Yh4}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,788010,e=>{"use strict";var a=e.i(344180),t=e.i(465458);e.s(["Textarea",0,function({className:e,...s}){return(0,a.jsx)("textarea",{"data-slot":"textarea",className:(0,t.cn)("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...s})}])},562918,928542,e=>{"use strict";var a=e.i(370383),t=e.i(969490);function s(e){return(0,t.useRenderElement)(e.defaultTagName??"div",e,e)}e.s(["useRender",0,s],928542);var i=e.i(294237),r=e.i(465458);let n=(0,i.cva)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});e.s(["Badge",0,function({className:e,variant:t="default",render:i,...l}){return s({defaultTagName:"span",props:(0,a.mergeProps)({className:(0,r.cn)(n({variant:t}),e)},l),render:i,state:{slot:"badge",variant:t}})}],562918)},368942,e=>{"use strict";let a=(0,e.i(816709).create)((e,a)=>({models:[],providers:[],loaded:!1,ensure:async()=>{if(!a().loaded)try{let[a,t]=await Promise.all([fetch("/api/models").then(e=>e.json()),fetch("/api/providers").then(e=>e.json())]);e({models:a,providers:t,loaded:!0})}catch{}},addModel:a=>e(e=>({models:[...e.models,a]})),updateModel:a=>e(e=>({models:e.models.map(e=>e.id===a.id?a:e)})),removeModel:a=>e(e=>({models:e.models.filter(e=>e.id!==a)})),addProvider:a=>e(e=>({providers:[...e.providers,a]})),updateProvider:a=>e(e=>({providers:e.providers.map(e=>e.id===a.id?a:e)})),removeProvider:a=>e(e=>({providers:e.providers.filter(e=>e.id!==a)}))}));e.s(["useLLMStore",0,a])},226624,e=>{"use strict";var a,t=e.i(344180);e.s([],916562),e.i(916562),e.i(8890);var s=e.i(764556),i=e.i(535270),r=e.i(29905),n=e.i(204133),l=e.i(277642),d=e.i(236706),o=e.i(863728),c=e.i(969490),u=e.i(370383),p=e.i(139236),m=e.i(931709),h=e.i(267805);let g=s.createContext(void 0);var x=e.i(438904);let v=((a={}).checked="data-checked",a.unchecked="data-unchecked",a.disabled="data-disabled",a.readonly="data-readonly",a.required="data-required",a.valid="data-valid",a.invalid="data-invalid",a.touched="data-touched",a.dirty="data-dirty",a.filled="data-filled",a.focused="data-focused",a),f={...x.fieldValidityMapping,checked:e=>e?{[v.checked]:""}:{[v.unchecked]:""}};var b=e.i(125231),y=e.i(975698),j=e.i(380414),k=e.i(443124),N=e.i(575665),w=e.i(602453),C=e.i(742665),S=e.i(638144);let P=s.forwardRef(function(e,a){let{checked:h,className:x,defaultChecked:v,"aria-labelledby":P,form:T,id:z,inputRef:M,name:A,nativeButton:I=!1,onCheckedChange:O,readOnly:D=!1,required:B=!1,disabled:E=!1,render:K,uncheckedValue:R,value:L,style:F,..._}=e,{clearErrors:U}=(0,j.useFormContext)(),{state:q,setTouched:G,setDirty:V,validityData:W,setFilled:$,setFocused:H,shouldValidateOnChange:J,validationMode:Q,disabled:Z,name:X,validation:Y}=(0,b.useFieldRootContext)(),{labelId:ee}=(0,k.useLabelableContext)(),ea=Z||E,et=X??A,es=(0,r.useStableCallback)(O),ei=s.useRef(null),er=(0,n.useMergedRefs)(ei,M,Y.inputRef),en=s.useRef(null),el=(0,p.useBaseUiId)(),ed=(0,N.useLabelableId)({id:z,implicit:!1,controlRef:en}),eo=I?void 0:ed,[ec,eu]=(0,i.useControlled)({controlled:h,default:!!v,name:"Switch",state:"checked"});(0,y.useRegisterFieldControl)(en,{id:el,value:ec}),(0,l.useIsoLayoutEffect)(()=>{ei.current&&$(ei.current.checked)},[ei,$]),(0,S.useValueChanged)(ec,()=>{U(et),V(ec!==W.initialValue),$(ec),J()?Y.commit(ec):Y.commit(ec,!0)});let{getButtonProps:ep,buttonRef:em}=(0,m.useButton)({disabled:ea,native:I}),eh=function(e,a,t,i=!0,r){let[n,d]=s.useState(),o=(0,p.useBaseUiId)(r?`${r}-label`:void 0),c=e??a??n;return(0,l.useIsoLayoutEffect)(()=>{let s=e||a||!i?void 0:function(e,a){let t=function(e){if(!e)return;let a=e.parentElement;if(a&&"LABEL"===a.tagName)return a;let t=e.id;if(t){let a=e.nextElementSibling;if(a&&a.htmlFor===t)return a}let s=e.labels;return s&&s[0]}(e);if(t)return!t.id&&a&&(t.id=a),t.id||void 0}(t.current,o);n!==s&&d(s)}),c}(P,ee,ei,!I,eo),eg=s.useMemo(()=>(0,u.mergeProps)({checked:ec,disabled:ea,form:T,id:eo,name:et,required:B,style:et?d.visuallyHiddenInput:d.visuallyHidden,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:er,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(D)return void e.preventDefault();let a=e.currentTarget.checked,t=(0,w.createChangeEventDetails)(C.REASONS.none,e.nativeEvent);es?.(a,t),t.isCanceled||eu(a)},onFocus(){en.current?.focus()}},Y.getInputValidationProps,void 0!==L?{value:L}:o.EMPTY_OBJECT),[ec,ea,T,er,eo,et,es,D,B,eu,Y,L]),ex=s.useMemo(()=>({...q,checked:ec,disabled:ea,readOnly:D,required:B}),[q,ec,ea,D,B]),ev=(0,c.useRenderElement)("span",e,{state:ex,ref:[a,en,em],props:[{id:I?ed:el,role:"switch","aria-checked":ec,"aria-readonly":D||void 0,"aria-required":B||void 0,"aria-labelledby":eh,onFocus(){ea||H(!0)},onBlur(){let e=ei.current;e&&!ea&&(G(!0),H(!1),"onBlur"===Q&&Y.commit(e.checked))},onClick(e){D||ea||(e.preventDefault(),ei.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},Y.getValidationProps,_,ep],stateAttributesMapping:f});return(0,t.jsxs)(g.Provider,{value:ex,children:[ev,!ec&&et&&void 0!==R&&(0,t.jsx)("input",{type:"hidden",form:T,name:et,value:R}),(0,t.jsx)("input",{...eg,suppressHydrationWarning:!0})]})}),T=s.forwardRef(function(e,a){let{render:t,className:i,style:r,...n}=e,{state:l}=(0,b.useFieldRootContext)(),d=function(){let e=s.useContext(g);if(void 0===e)throw Error((0,h.default)(63));return e}(),o={...l,...d};return(0,c.useRenderElement)("span",e,{state:o,ref:a,stateAttributesMapping:f,props:n})});e.s(["Root",0,P,"Thumb",0,T],695728);var z=e.i(695728),z=z,M=e.i(465458);e.s(["Switch",0,function({className:e,size:a="default",...s}){return(0,t.jsx)(z.Root,{"data-slot":"switch","data-size":a,className:(0,M.cn)("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...s,children:(0,t.jsx)(z.Thumb,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}],226624)},673478,e=>{"use strict";let a=(0,e.i(433721).default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);e.s(["Cpu",0,a],673478)},325443,946899,e=>{"use strict";let a=(0,e.i(433721).default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);e.s(["default",0,a],946899),e.s(["Bot",0,a],325443)},415360,e=>{"use strict";let a=(0,e.i(433721).default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);e.s(["Sparkles",0,a],415360)},511588,e=>{"use strict";let a=(0,e.i(433721).default)("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);e.s(["WandSparkles",0,a],511588)},444433,e=>{"use strict";e.s(["BUILT_IN_AGENT_TOOLS",0,[{name:"CreateCurrentChannelIssue",label:"Create Current Issue",description:"Create and bind an issue for the current channel."},{name:"ViewCurrentChannelIssue",label:"View Current Issue",description:"View the issue and comments bound to the current channel."},{name:"AddCurrentChannelComment",label:"Add Current Comment",description:"Add a comment to the issue bound to the current channel."},{name:"ReadTerminalOutput",label:"Read Terminal Output",description:"Read paginated terminal output by session ID. Defaults to the newest 100 lines."},{name:"ListQuickCommands",label:"List Quick Commands",description:"List all quick commands for a workspace with their running status."},{name:"RunQuickCommand",label:"Run Quick Command",description:"Start a quick command by its ID. Returns the terminal session ID."},{name:"StopQuickCommand",label:"Stop Quick Command",description:"Stop a running quick command by its ID."}]])},282180,e=>{"use strict";var a=e.i(344180),t=e.i(444433);let s=(t.BUILT_IN_AGENT_TOOLS??[]).map(e=>e.name),i=new Set(["openai-responses-to-anthropic-messages","openai-chat-completions-to-anthropic-messages"]);function r(e){return{mcpServers:Object.fromEntries(e.map(e=>[e,{}]))}}function n(e){return e.map(e=>({name:`${e}.md`,content:`# ${e}
|
|
2
|
+
`}))}let l={agent:{name:"Agent",role:"agent",description:"通用 Agent,可在 workflow 中承担任意执行节点",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"anthropic-messages",modelId:"claude-sonnet-4-6",apiBase:"",apiKey:"",workingDir:"",mcps:r([]),skills:n(["coding","debugging","testing"]),tools:s,systemPrompt:"你是通用 Agent。根据 issue 和当前任务上下文完成被分配的工作,遵循项目规范,必要时修改代码、运行验证,并清晰汇报结果。",temperature:.3,maxTokens:8192,enabled:!0},scheduler:{name:"Scheduler",role:"scheduler",description:"任务调度者,负责任务分发和协调",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"anthropic-messages",modelId:"claude-sonnet-4-6",apiBase:"",apiKey:"",workingDir:"",mcps:r([]),skills:n(["planning","task-split"]),tools:s,systemPrompt:"你是调度者 Agent。负责接收用户任务,分析任务类型,分发给合适的执行者。你需要跟踪任务状态,确保所有子任务按时完成。",temperature:.3,maxTokens:4096,enabled:!0},task_creator:{name:"Task Creator",role:"task_creator",description:"任务创建者,负责把 issue 拆成可执行任务",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"anthropic-messages",modelId:"claude-sonnet-4-6",apiBase:"",apiKey:"",workingDir:"",mcps:r([]),skills:n(["planning","task-split"]),tools:s,systemPrompt:"你是任务创建者 Agent。负责读取 issue 上下文,把需求拆分为少量可执行任务,并用系统工具写入任务列表。只创建真正需要独立执行的任务,避免把细碎步骤拆成任务。",temperature:.3,maxTokens:4096,enabled:!0},bot:{name:"Bot Agent",role:"bot",description:"消息机器人,负责处理外部聊天平台中的用户消息",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"anthropic-messages",modelId:"claude-sonnet-4-6",apiBase:"",apiKey:"",workingDir:"",mcps:{},skills:[],tools:s,systemPrompt:"你是 Agent Spaces 的消息机器人。你会简洁回答来自外部聊天平台的用户消息。不要执行危险操作;需要用户提供更多信息时直接询问。",temperature:.3,maxTokens:4096,enabled:!0}};e.s(["FieldGroup",0,function({label:e,children:t}){return(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("label",{className:"text-xs text-muted-foreground",children:e}),t]})},"PROVIDER_OPTIONS",0,[{value:"anthropic-messages",labelKey:"anthropicMessages"},{value:"openai-chat-completions",labelKey:"openaiChatCompletions"},{value:"openai-responses",labelKey:"openaiResponses"},{value:"openai-responses-to-anthropic-messages",labelKey:"openaiResponsesToAnthropic"},{value:"openai-chat-completions-to-anthropic-messages",labelKey:"openaiChatToAnthropic"},{value:"gemini-generate-content",labelKey:"geminiGenerateContent"}],"ROLE_COLORS",0,{agent:"bg-gray-500/10 text-gray-600 border-gray-200",scheduler:"bg-blue-500/10 text-blue-600 border-blue-200",task_creator:"bg-green-500/10 text-green-600 border-green-200",bot:"bg-cyan-500/10 text-cyan-600 border-cyan-200"},"ROLE_OPTIONS",0,["agent","scheduler","task_creator","bot"],"RUNTIME_OPTIONS",0,[{value:"claude-code",labelKey:"claudeCode"},{value:"open-agent-sdk",labelKey:"openAgentSdk"},{value:"codex",labelKey:"codex"},{value:"langchain",labelKey:"langchain"}],"Section",0,function({icon:e,title:t,children:s}){return(0,a.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider",children:[e,t]}),s]})},"isAnthropicBridgeProvider",0,function(e){return!!(e&&i.has(e))},"isDraftAgent",0,function(e){return e.id.startsWith("draft-")},"newAgentDraft",0,function(e){return{id:`draft-${e}-${Date.now()}`,...l[e],mcps:structuredClone(l[e].mcps),skills:l[e].skills.map(e=>({...e})),tools:[...l[e].tools]}},"newEmptyAgent",0,function(){return{id:`draft-empty-${Date.now()}`,name:"",role:"agent",description:"",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"",modelId:"",apiBase:"",apiKey:"",workingDir:"",mcps:{},skills:[],tools:s,systemPrompt:"",temperature:.3,maxTokens:4096,enabled:!0}},"normalizeAgent",0,function(e){var a,i;return{...e,name:e.name||"New Agent",description:e.description||"",avatarUrl:e.avatarUrl||"",runtimeKind:e.runtimeKind||"open-agent-sdk",modelProvider:e.modelProvider||"",modelId:e.modelId||"claude-sonnet-4-6",apiBase:e.apiBase||"",apiKey:e.apiKey||"",workingDir:e.workingDir||"",mcps:(a=e.mcps)||{},skills:Array.isArray(i=e.skills)?i.map(e=>"string"==typeof e?{name:e.endsWith(".md")?e:`${e}.md`}:e):[],tools:function(e){if(!Array.isArray(e))return s;let a=new Set((t.BUILT_IN_AGENT_TOOLS??[]).map(e=>e.name));return e.filter(e=>a.has(e))}(e.tools),systemPrompt:e.systemPrompt||"",temperature:e.temperature??.3,maxTokens:e.maxTokens??4096,enabled:e.enabled??!0}},"serializeAgent",0,function(e){let{id:a,...t}=e;return{...t,modelProvider:t.modelProvider||void 0}}])},159619,839374,e=>{"use strict";let a=(0,e.i(433721).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["default",0,a],839374),e.s(["Copy",0,a],159619)},330044,92929,e=>{"use strict";var a=e.i(344180),t=e.i(244073),s=e.i(611176),i=e.i(260218),r=e.i(562918),n=e.i(226624),l=e.i(325443),d=e.i(159619),o=e.i(137340),c=e.i(465458);e.s(["AgentList",0,function({agents:e,onSelect:u,onDelete:p,onToggleEnabled:m}){let h=(0,t.useTranslations)("agent");return(0,a.jsxs)("div",{className:"flex flex-col p-2",children:[e.map(e=>{let t="agent-generator"===e.id;return(0,a.jsxs)("div",{className:(0,c.cn)("group flex items-center gap-3 rounded-lg px-3 py-2.5 hover:bg-muted/50 cursor-pointer transition-colors",!e.enabled&&!t&&"opacity-50"),onClick:()=>u(e),children:[(0,a.jsx)(s.AgentIcon,{name:e.name,avatarUrl:e.avatarUrl,apiBase:e.apiBase,className:"size-8"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,a.jsx)(r.Badge,{variant:"outline",className:"text-[10px] h-4 px-1.5",children:t?"system":e.role})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:e.description||h("list.noDescription")})]}),(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground font-mono",children:e.modelId.split("-").slice(0,2).join("-")}),(0,a.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,a.jsx)(n.Switch,{size:"sm",checked:t||e.enabled,disabled:t,onCheckedChange:()=>m?.(e.id)})}),(0,a.jsx)(i.Button,{variant:"ghost",size:"icon-xs",className:"opacity-0 group-hover:opacity-100 transition-opacity",onClick:a=>{a.stopPropagation(),navigator.clipboard.writeText(e.id)},children:(0,a.jsx)(d.Copy,{className:"size-3"})}),!t&&(0,a.jsx)(i.Button,{variant:"ghost",size:"icon-xs",className:"opacity-0 group-hover:opacity-100 transition-opacity",onClick:a=>{a.stopPropagation(),p(e.id)},children:(0,a.jsx)(o.Trash2,{className:"size-3 text-destructive"})})]},e.id)}),0===e.length&&(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,a.jsx)(l.Bot,{className:"size-10 mb-2 opacity-30"}),(0,a.jsx)("p",{className:"text-sm",children:h("list.empty")})]})]})}],330044);let u=(0,e.i(433721).default)("plug-zap",[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]]);e.s(["PlugZap",0,u],92929)},212068,e=>{"use strict";let a=(0,e.i(433721).default)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]);e.s(["default",0,a])},119211,e=>{"use strict";var a=e.i(212068);e.s(["Wrench",()=>a.default])},426022,e=>{"use strict";let a=(0,e.i(433721).default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]);e.s(["MessageSquare",0,a],426022)},588591,e=>{"use strict";var a=e.i(344180),t=e.i(764556),s=e.i(244073),i=e.i(355819),r=e.i(209988),n=e.i(260218),l=e.i(788010),d=e.i(917955),o=e.i(465458),c=e.i(767467),u=e.i(325443),p=e.i(650654),m=e.i(953700),h=e.i(511588),g=e.i(282180),x=e.i(330044),v=e.i(368942),f=e.i(444433),b=e.i(611176),y=e.i(681622),j=e.i(188815),k=e.i(972846),N=e.i(673478),w=e.i(92929),C=e.i(451534),S=e.i(119211),P=e.i(415360),T=e.i(426022);let z=(0,e.i(433721).default)("sliders-vertical",[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]]);var M=e.i(129981);function A({agent:e,roleOptions:i,testing:r,testResult:d,onChange:c,onMcpChange:u,onAddSkillFiles:p,onRemoveSkill:m,onTestConnection:h}){let x=(0,s.useTranslations)("agent"),[I,O]=(0,t.useState)(()=>JSON.stringify(e.mcps,null,2)),[D,B]=(0,t.useState)(null),[E,K]=(0,t.useState)([]),{models:R,providers:L,ensure:F}=(0,v.useLLMStore)(),_=R.filter(e=>!e.embedding);(0,t.useEffect)(()=>{F()},[F]);let U=(0,t.useCallback)(e=>{c("apiBase",e.apiBase),c("apiKey",e.apiKey);let a=_.filter(a=>a.provider===e.name).map(e=>({value:e.modelId,label:e.name}));K(a),a.length>0&&c("modelId",a[0].value)},[_,c]),q=async e=>{if(!e?.length)return;let a=Array.from(e).filter(e=>e.name.toLowerCase().endsWith(".md"));p(await Promise.all(a.map(async e=>({name:e.name,content:await e.text()}))))};return(0,a.jsxs)("div",{className:"flex flex-col gap-5 p-5",children:[(0,a.jsxs)(g.Section,{icon:(0,a.jsx)(T.MessageSquare,{className:"size-3.5"}),title:x("detail.basic"),children:[(0,a.jsxs)("div",{className:"flex items-start gap-4",children:[(0,a.jsxs)("div",{className:"flex flex-col items-center gap-1.5",children:[(0,a.jsx)(b.AgentIcon,{name:e.name,avatarUrl:e.avatarUrl,apiBase:e.apiBase,className:"size-16 rounded-xl border border-input"}),(0,a.jsxs)("label",{className:"text-[10px] text-primary cursor-pointer hover:underline",children:[x("detail.uploadAvatar"),(0,a.jsx)("input",{type:"file",accept:"image/*",className:"hidden",onChange:async e=>{let a=e.target.files?.[0];if(!a)return;let t=new FileReader;t.onload=async()=>{try{let e=await fetch("/api/upload/avatar",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataUrl:t.result,filename:a.name})}),s=await e.json();s.url&&c("avatarUrl",s.url)}catch{}},t.readAsDataURL(a),e.target.value=""}})]}),e.avatarUrl&&(0,a.jsx)("button",{type:"button",className:"text-[10px] text-destructive hover:underline",onClick:()=>c("avatarUrl",""),children:x("detail.removeAvatar")})]}),(0,a.jsxs)("div",{className:"flex-1 flex flex-col gap-2.5",children:[(0,a.jsx)(g.FieldGroup,{label:x("detail.name"),children:(0,a.jsx)(y.Input,{value:e.name,onChange:e=>c("name",e.target.value)})}),(0,a.jsx)(g.FieldGroup,{label:x("detail.role"),children:(0,a.jsx)("select",{value:e.role,onChange:e=>c("role",e.target.value),className:"h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring dark:bg-input/30",children:i.map(e=>(0,a.jsx)("option",{value:e,children:e},e))})})]})]}),(0,a.jsx)(g.FieldGroup,{label:x("detail.description"),children:(0,a.jsx)(y.Input,{value:e.description,onChange:e=>c("description",e.target.value)})}),(0,a.jsx)(g.FieldGroup,{label:x("detail.agentRuntime"),children:(0,a.jsx)(j.SearchSelect,{value:e.runtimeKind??"",onChange:e=>c("runtimeKind",e),options:g.RUNTIME_OPTIONS.map(e=>({value:e.value,label:x(`runtime.${e.labelKey}`)})),placeholder:x("detail.runtimePlaceholder"),searchPlaceholder:x("detail.runtimeSearchPlaceholder"),allowCustom:!1})})]}),(0,a.jsx)(g.Section,{icon:(0,a.jsx)(C.FolderOpen,{className:"size-3.5"}),title:x("detail.workingDirectory"),children:(0,a.jsx)(y.Input,{value:e.workingDir,onChange:e=>c("workingDir",e.target.value),placeholder:x("detail.workingDirPlaceholder")})}),(0,a.jsx)(g.Section,{icon:(0,a.jsx)(P.Sparkles,{className:"size-3.5"}),title:x("detail.systemPrompt"),children:(0,a.jsx)(l.Textarea,{value:e.systemPrompt,onChange:e=>c("systemPrompt",e.target.value),placeholder:x("detail.systemPromptPlaceholder"),className:"min-h-24 text-xs"})}),(0,a.jsxs)(g.Section,{icon:(0,a.jsx)(S.Wrench,{className:"size-3.5"}),title:x("detail.mcpServers"),children:[(0,a.jsx)(l.Textarea,{value:I,onChange:e=>(e=>{O(e);try{let a=JSON.parse(e);if(!a||"object"!=typeof a||Array.isArray(a))throw Error("MCP config must be a JSON object");B(null),u(a)}catch(e){B(e instanceof Error?e.message:"Invalid JSON")}})(e.target.value),placeholder:'{\n "mcpServers": {}\n}',className:"min-h-28 font-mono text-xs"}),D&&(0,a.jsx)("div",{className:"text-xs text-destructive",children:D})]}),(0,a.jsx)(g.Section,{icon:(0,a.jsx)(S.Wrench,{className:"size-3.5"}),title:x("detail.tools"),children:(0,a.jsx)("div",{className:"grid gap-2",children:(f.BUILT_IN_AGENT_TOOLS??[]).map(t=>(0,a.jsxs)("label",{className:"flex cursor-pointer items-start gap-2 rounded-lg border border-input px-3 py-2 hover:bg-muted/50",children:[(0,a.jsx)("input",{type:"checkbox",checked:e.tools.includes(t.name),onChange:()=>{var a;let s;return a=t.name,void((s=new Set(e.tools)).has(a)?s.delete(a):s.add(a),c("tools",(f.BUILT_IN_AGENT_TOOLS??[]).map(e=>e.name).filter(e=>s.has(e))))},className:"mt-0.5 size-3.5"}),(0,a.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,a.jsx)("span",{className:"block text-xs font-medium",children:t.label}),(0,a.jsx)("span",{className:"block text-[11px] text-muted-foreground",children:t.description})]})]},t.name))})}),(0,a.jsxs)(g.Section,{icon:(0,a.jsx)(N.Cpu,{className:"size-3.5"}),title:x("detail.skills"),children:[(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5 mb-2",children:e.skills.map((e,t)=>(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground",children:[e.name,(0,a.jsx)("button",{type:"button",onClick:()=>m(t),className:"hover:text-destructive",children:(0,a.jsx)(k.X,{className:"size-2.5"})})]},t))}),(0,a.jsxs)("label",{className:"flex h-8 cursor-pointer items-center justify-center gap-2 rounded-lg border border-dashed border-input text-xs text-muted-foreground hover:bg-muted/50",children:[(0,a.jsx)(M.Upload,{className:"size-3.5"}),x("detail.uploadSkills"),(0,a.jsx)("input",{type:"file",accept:".md,text/markdown",multiple:!0,className:"hidden",onChange:e=>{q(e.target.files),e.target.value=""}})]})]}),(0,a.jsxs)(g.Section,{icon:(0,a.jsx)(z,{className:"size-3.5"}),title:x("detail.model"),children:[(0,a.jsxs)("div",{className:"space-y-2.5",children:[(0,a.jsx)(g.FieldGroup,{label:x("detail.provider"),children:(0,a.jsx)(j.SearchSelect,{value:L.find(a=>a.apiBase===e.apiBase&&a.apiKey===e.apiKey)?.name||"",onChange:e=>{let a=L.find(a=>a.name===e);a&&U(a)},options:L.map(e=>({value:e.name,label:e.name})),placeholder:x("detail.providerPlaceholder"),searchPlaceholder:x("detail.providerSearchPlaceholder"),allowCustom:!1})}),(0,a.jsx)(g.FieldGroup,{label:x("detail.modelField"),children:(0,a.jsx)(j.SearchSelect,{value:e.modelId,onChange:e=>c("modelId",e),options:E.length>0?E:[{value:e.modelId||"",label:e.modelId||x("detail.selectProviderFirst")}],placeholder:x("detail.modelPlaceholder"),searchPlaceholder:x("detail.modelSearchPlaceholder")})}),(0,a.jsx)(g.FieldGroup,{label:x("detail.apiMessageType"),children:(0,a.jsx)(j.SearchSelect,{value:e.modelProvider||"",onChange:e=>c("modelProvider",e),options:g.PROVIDER_OPTIONS.map(e=>({value:e.value,label:x(`provider.${e.labelKey}`)})),placeholder:x("detail.apiMessageTypePlaceholder"),searchPlaceholder:x("detail.apiMessageTypeSearchPlaceholder"),allowCustom:!1})}),(0,a.jsx)(g.FieldGroup,{label:x("detail.apiBase"),children:(0,a.jsx)(y.Input,{value:e.apiBase,onChange:e=>c("apiBase",e.target.value),placeholder:x("detail.apiBasePlaceholder"),className:"h-7 text-xs"})}),(0,a.jsx)(g.FieldGroup,{label:x("detail.apiKey"),children:(0,a.jsx)(y.Input,{type:"password",value:e.apiKey,onChange:e=>c("apiKey",e.target.value),placeholder:x("detail.apiKeyPlaceholder"),className:"h-7 text-xs"})})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:x("detail.validateHelper")}),(0,a.jsxs)(n.Button,{type:"button",variant:"outline",size:"sm",onClick:h,disabled:r||!e.apiBase||!e.apiKey||!e.modelId,children:[(0,a.jsx)(w.PlugZap,{className:"size-3.5"}),r?x("detail.testing"):x("detail.test")]})]}),d&&(0,a.jsxs)("div",{className:(0,o.cn)("rounded-md border px-3 py-2 text-xs",d.success?"border-green-500/30 bg-green-500/10 text-green-700":"border-destructive/30 bg-destructive/10 text-destructive"),children:[d.message,d.debug&&(0,a.jsxs)("div",{className:"mt-2 space-y-1 font-mono text-[10px] opacity-80",children:[d.debug.status&&(0,a.jsxs)("div",{children:[x("debug.status")," ",d.debug.status]}),d.debug.provider&&(0,a.jsxs)("div",{children:[x("debug.provider")," ",d.debug.provider]}),d.debug.requestUrl&&(0,a.jsxs)("div",{children:[x("debug.url")," ",d.debug.requestUrl]}),d.debug.model&&(0,a.jsxs)("div",{children:[x("debug.model")," ",d.debug.model]}),d.debug.responseBody&&(0,a.jsxs)("div",{className:"max-h-20 overflow-auto whitespace-pre-wrap",children:[x("debug.body")," ",d.debug.responseBody]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,a.jsx)(g.FieldGroup,{label:x("detail.temperature"),children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{type:"range",min:0,max:2,step:.1,value:e.temperature,onChange:e=>c("temperature",parseFloat(e.target.value)),className:"flex-1"}),(0,a.jsx)("span",{className:"text-xs font-mono w-8 text-right",children:e.temperature})]})}),(0,a.jsx)(g.FieldGroup,{label:x("detail.maxTokens"),children:(0,a.jsx)(y.Input,{type:"number",value:e.maxTokens,onChange:e=>c("maxTokens",parseInt(e.target.value)||0),className:"h-7 text-xs"})})]})]})]})}let I="agent-generator";e.s(["AgentDialog",0,function({open:e,onOpenChange:v,roleFilter:f,initialAgentId:b,standalone:y}){let j=(0,s.useTranslations)("agent"),k=(0,s.useTranslations)("common"),[N,w]=(0,t.useState)([]),[C,S]=(0,t.useState)(null),[P,T]=(0,t.useState)(null),[z,M]=(0,t.useState)(!1),[O,D]=(0,t.useState)(!1),[B,E]=(0,t.useState)(!1),[K,R]=(0,t.useState)(!1),[L,F]=(0,t.useState)(""),[_,U]=(0,t.useState)(!1),[q,G]=(0,t.useState)(null),[V,W]=(0,t.useState)(null),$=f?new Set(Array.isArray(f)?f:[f]):null,H=$?N.filter(e=>e.id===I||$.has(e.role)):N,J=$?g.ROLE_OPTIONS.filter(e=>$.has(e)):g.ROLE_OPTIONS;(0,t.useEffect)(()=>{if(!e)return;let a=new AbortController;return queueMicrotask(()=>{M(!0),W(null)}),fetch("/api/agents/presets",{signal:a.signal}).then(async e=>{if(!e.ok)throw Error(await e.text());return e.json()}).then(e=>{let a=e.map(g.normalizeAgent);if(w(a),b){let e=a.find(e=>e.id===b);e&&(S(e),T({...e}))}}).catch(e=>{"AbortError"!==e.name&&W(j("error.loadFailed"))}).finally(()=>M(!1)),()=>a.abort()},[e,b,j]);let Q=()=>{S(null),T(null),G(null)},Z=async()=>{if(P){D(!0),W(null);try{let e=(0,g.isDraftAgent)(P),a=(0,g.serializeAgent)(P),t=await fetch(e?"/api/agents/presets":`/api/agents/presets/${P.id}`,{method:e?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e?a:P)});if(!t.ok)throw Error(await t.text());let s=await t.json(),r=(0,g.normalizeAgent)(s);w(a=>e?[...a,r]:a.map(e=>e.id===r.id?r:e)),i.useAgentStore.setState(a=>({agents:e?[...a.agents,s]:a.agents.map(e=>e.id===s.id?s:e)})),S(null),T(null)}catch{W(j("error.saveFailed"))}finally{D(!1)}}},X=async()=>{if(P){E(!0),G(null),W(null);try{let e=await fetch("/api/agents/presets/test-connection",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)}),a=await e.json();G({success:!!a.success,message:a.message||a.error||j("error.connectionTestFailed"),debug:a.debug?{...a.debug,status:e.status}:{status:e.status}})}catch(e){G({success:!1,message:e instanceof Error?e.message:j("error.connectionTestFailed")})}finally{E(!1)}}},Y=e=>{let a="empty"===e?(0,g.newEmptyAgent)():(0,g.newAgentDraft)(e);W(null),S(a),T({...a})},ee=async()=>{let e=L.trim();if(e){U(!0),W(null);try{let a=await fetch("/api/agents/presets/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e})}),t=await a.json();if(!a.ok)throw Error(t.error||"Failed to generate agent");let s=P??(J[0]?(0,g.newAgentDraft)(J[0]):(0,g.newEmptyAgent)()),i={...s,name:t.name?.trim()||s.name,description:t.description?.trim()||s.description,systemPrompt:t.systemPrompt?.trim()||s.systemPrompt};S(i),T(i),R(!1),F(""),G(null)}catch(e){W(e instanceof Error?e.message:"智能创建 Agent 失败")}finally{U(!1)}}},ea=async e=>{e!==I&&(w(a=>a.map(a=>a.id===e?{...a,enabled:!a.enabled}:a)),await i.useAgentStore.getState().toggleEnabled(e))},et=async e=>{if(e!==I){if(e.startsWith("draft-")){S(null),T(null);return}D(!0),W(null);try{let a=await fetch(`/api/agents/presets/${e}`,{method:"DELETE"});if(!a.ok)throw Error(await a.text());w(a=>a.filter(a=>a.id!==e)),i.useAgentStore.setState(a=>({agents:a.agents.filter(a=>a.id!==e)})),C?.id===e&&(S(null),T(null))}catch{W(j("error.deleteFailed"))}finally{D(!1)}}},es=(0,a.jsxs)(a.Fragment,{children:[!y&&(0,a.jsxs)("div",{className:"flex items-center gap-3 border-b px-5 pr-12 py-4",children:[C?(0,a.jsx)(n.Button,{variant:"ghost",size:"icon-sm",onClick:Q,children:(0,a.jsx)(c.ArrowLeft,{className:"size-4"})}):(0,a.jsx)("div",{className:"flex size-7 items-center justify-center rounded-lg bg-primary/10",children:(0,a.jsx)(u.Bot,{className:"size-4 text-primary"})}),(0,a.jsxs)(r.DialogHeader,{className:"flex-1 space-y-0",children:[(0,a.jsx)(r.DialogTitle,{className:"text-base",children:C?P?.name??"":j("dialog.title")}),(0,a.jsx)(r.DialogDescription,{className:"text-xs",children:C?j("dialog.editDescription"):j("dialog.listDescription")})]}),C&&(0,a.jsxs)(n.Button,{variant:"outline",size:"sm",disabled:O||_,onClick:()=>R(!0),children:[(0,a.jsx)(h.WandSparkles,{className:"size-3.5"}),"智能创建"]}),!C&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(n.Button,{variant:"outline",size:"sm",disabled:O||_,onClick:()=>R(!0),children:[(0,a.jsx)(h.WandSparkles,{className:"size-3.5"}),"智能创建"]}),(0,a.jsxs)(d.DropdownMenu,{children:[(0,a.jsx)(d.DropdownMenuTrigger,{render:(0,a.jsxs)(n.Button,{variant:"outline",size:"sm",disabled:O,children:[(0,a.jsx)(m.Plus,{className:"size-3.5"}),j("dialog.add"),(0,a.jsx)(p.ChevronDown,{className:"size-3.5"})]})}),(0,a.jsx)(d.DropdownMenuContent,{side:"bottom",align:"end",className:"w-44",children:(0,a.jsxs)(d.DropdownMenuGroup,{children:[!$&&(0,a.jsxs)(d.DropdownMenuItem,{className:"gap-2",onClick:()=>Y("empty"),children:[(0,a.jsx)("span",{className:"size-2 rounded-full bg-muted"}),(0,a.jsx)("span",{children:j("dialog.addEmpty")})]}),g.ROLE_OPTIONS.map(e=>(0,a.jsxs)(d.DropdownMenuItem,{className:"gap-2",onClick:()=>Y(e),children:[(0,a.jsx)("span",{className:(0,o.cn)("size-2 rounded-full",g.ROLE_COLORS[e].split(" ")[0])}),(0,a.jsx)("span",{className:"capitalize",children:j(`role.${e}.name`)})]},e))]})})]})]})]}),y&&!C&&(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-b",children:[(0,a.jsxs)(n.Button,{variant:"outline",size:"sm",disabled:O||_,onClick:()=>R(!0),children:[(0,a.jsx)(h.WandSparkles,{className:"size-3.5"}),"智能创建"]}),(0,a.jsxs)(d.DropdownMenu,{children:[(0,a.jsx)(d.DropdownMenuTrigger,{render:(0,a.jsxs)(n.Button,{variant:"outline",size:"sm",disabled:O,children:[(0,a.jsx)(m.Plus,{className:"size-3.5"}),j("dialog.add"),(0,a.jsx)(p.ChevronDown,{className:"size-3.5"})]})}),(0,a.jsx)(d.DropdownMenuContent,{side:"bottom",align:"end",className:"w-44",children:(0,a.jsxs)(d.DropdownMenuGroup,{children:[!$&&(0,a.jsxs)(d.DropdownMenuItem,{className:"gap-2",onClick:()=>Y("empty"),children:[(0,a.jsx)("span",{className:"size-2 rounded-full bg-muted"}),(0,a.jsx)("span",{children:j("dialog.addEmpty")})]}),g.ROLE_OPTIONS.map(e=>(0,a.jsxs)(d.DropdownMenuItem,{className:"gap-2",onClick:()=>Y(e),children:[(0,a.jsx)("span",{className:(0,o.cn)("size-2 rounded-full",g.ROLE_COLORS[e].split(" ")[0])}),(0,a.jsx)("span",{className:"capitalize",children:j(`role.${e}.name`)})]},e))]})})]})]}),y&&C&&(0,a.jsxs)("div",{className:"flex items-center gap-3 px-5 py-3 border-b",children:[(0,a.jsx)(n.Button,{variant:"ghost",size:"icon-sm",onClick:Q,children:(0,a.jsx)(c.ArrowLeft,{className:"size-4"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h2",{className:"text-base font-medium truncate",children:P?.name??""}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:j("dialog.editDescription")})]}),(0,a.jsxs)(n.Button,{variant:"outline",size:"sm",disabled:O||_,onClick:()=>R(!0),children:[(0,a.jsx)(h.WandSparkles,{className:"size-3.5"}),"智能创建"]})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[V&&(0,a.jsx)("div",{className:"mx-5 mt-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:V}),z?(0,a.jsx)("div",{className:"flex flex-col p-2 space-y-1",children:Array.from({length:5},(e,t)=>(0,a.jsxs)("div",{className:"flex items-center gap-3 rounded-lg px-3 py-2.5",children:[(0,a.jsx)("div",{className:"size-8 rounded-full bg-muted animate-pulse"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0 space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"h-4 w-20 rounded bg-muted animate-pulse"}),(0,a.jsx)("div",{className:"h-4 w-10 rounded-full bg-muted animate-pulse"})]}),(0,a.jsx)("div",{className:"h-3 w-32 rounded bg-muted animate-pulse"})]}),(0,a.jsx)("div",{className:"h-3 w-12 rounded bg-muted animate-pulse"})]},t))}):C?P?(0,a.jsx)(A,{agent:P,roleOptions:J,testing:B,testResult:q,onChange:(e,a)=>{T(t=>t?"modelProvider"===e?{...t,modelProvider:a,runtimeKind:(0,g.isAnthropicBridgeProvider)(a)?"claude-code":t.runtimeKind}:"runtimeKind"===e?{...t,runtimeKind:a}:{...t,[e]:a}:t)},onMcpChange:e=>{T(a=>a?{...a,mcps:e}:a)},onAddSkillFiles:e=>{if(!P)return;let a=new Set(P.skills.map(e=>e.name));T(t=>t?{...t,skills:[...t.skills.filter(a=>!e.some(e=>e.name===a.name)),...e.filter(e=>e.name&&!a.has(e.name)),...e.filter(e=>a.has(e.name))]}:t)},onRemoveSkill:e=>{P&&T(a=>a?{...a,skills:a.skills.filter((a,t)=>t!==e)}:a)},onTestConnection:X},P.id):null:(0,a.jsx)(x.AgentList,{agents:H,onSelect:e=>{S(e),T({...e})},onDelete:et,onToggleEnabled:ea})]}),C&&(0,a.jsxs)("div",{className:"flex justify-end gap-2 border-t px-5 py-3",children:[(0,a.jsx)(n.Button,{variant:"outline",size:"sm",onClick:Q,disabled:O,children:k("cancel")}),(0,a.jsx)(n.Button,{size:"sm",onClick:Z,disabled:O,children:k(O?"saving":"save")})]}),(0,a.jsx)(r.Dialog,{open:K,onOpenChange:R,children:(0,a.jsxs)(r.DialogContent,{className:"sm:max-w-lg",children:[(0,a.jsxs)(r.DialogHeader,{children:[(0,a.jsx)(r.DialogTitle,{children:"智能创建 Agent"}),(0,a.jsx)(r.DialogDescription,{children:"输入 Agent 的职责、使用场景和约束,系统会生成名称、描述和 Markdown 系统提示。"})]}),(0,a.jsx)(l.Textarea,{value:L,onChange:e=>F(e.target.value),placeholder:"例如:创建一个代码评审 Agent,专注发现 TypeScript/React 项目中的缺陷、回归风险和缺失测试。",className:"min-h-32 text-sm"}),(0,a.jsxs)(r.DialogFooter,{children:[(0,a.jsx)(n.Button,{variant:"outline",onClick:()=>R(!1),disabled:_,children:k("cancel")}),(0,a.jsx)(n.Button,{onClick:ee,disabled:_||!L.trim(),children:_?"生成中...":"生成"})]})]})})]});return y?(0,a.jsx)("div",{className:"h-full flex flex-col",children:es}):(0,a.jsx)(r.Dialog,{open:e,onOpenChange:e=>{e||Q(),v(e)},children:(0,a.jsx)(r.DialogContent,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 gap-0",children:es})})}],588591)}]);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,837121,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"warnOnce",{enumerable:!0,get:function(){return a}});let a=e=>{}},989484,905724,e=>{"use strict";let t=(0,e.i(433721).default)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);e.s(["default",0,t],905724),e.s(["FileText",0,t],989484)},267624,e=>{"use strict";let t=(0,e.i(433721).default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);e.s(["LayoutGrid",0,t],267624)},100694,e=>{"use strict";var t,s,a,i,n;function l(e,t,s,a){if("a"===s&&!a)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?a:"a"===s?a.call(e):a?a.value:t.get(e)}function r(e,t,s,a,i){if("m"===a)throw TypeError("Private method is not writable");if("a"===a&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,s):i?i.value=s:t.set(e,s),s}"function"==typeof SuppressedError&&SuppressedError;let o="__TAURI_TO_IPC_KEY__";function c(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class d{constructor(e){t.set(this,void 0),s.set(this,0),a.set(this,[]),i.set(this,void 0),r(this,t,e||(()=>{}),"f"),this.id=c(e=>{let n=e.index;if("end"in e)return void(n==l(this,s,"f")?this.cleanupCallback():r(this,i,n,"f"));let o=e.message;if(n==l(this,s,"f")){for(l(this,t,"f").call(this,o),r(this,s,l(this,s,"f")+1,"f");l(this,s,"f")in l(this,a,"f");){let e=l(this,a,"f")[l(this,s,"f")];l(this,t,"f").call(this,e),delete l(this,a,"f")[l(this,s,"f")],r(this,s,l(this,s,"f")+1,"f")}l(this,s,"f")===l(this,i,"f")&&this.cleanupCallback()}else l(this,a,"f")[n]=o})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(e){r(this,t,e,"f")}get onmessage(){return l(this,t,"f")}[(t=new WeakMap,s=new WeakMap,a=new WeakMap,i=new WeakMap,o)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[o]()}}class m{constructor(e,t,s){this.plugin=e,this.event=t,this.channelId=s}async unregister(){return x(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}}async function u(e,t,s){let a=new d(s);try{return await x(`plugin:${e}|register_listener`,{event:t,handler:a}),new m(e,t,a.id)}catch{return await x(`plugin:${e}|registerListener`,{event:t,handler:a}),new m(e,t,a.id)}}async function x(e,t={},s){return window.__TAURI_INTERNALS__.invoke(e,t,s)}n=new WeakMap,e.s(["Resource",0,class{get rid(){return l(this,n,"f")}constructor(e){n.set(this,void 0),r(this,n,e,"f")}async close(){return x("plugin:resources|close",{rid:this.rid})}},"SERIALIZE_TO_IPC_FN",0,o,"addPluginListener",0,u,"invoke",0,x,"transformCallback",0,c],100694)},757106,e=>{"use strict";let t=(0,e.i(433721).default)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]);e.s(["default",0,t])},990336,e=>{"use strict";var t=e.i(757106);e.s(["Brain",()=>t.default])},307858,e=>{"use strict";let t=(0,e.i(433721).default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["ExternalLink",0,t],307858)},100559,e=>{"use strict";let t=(0,e.i(433721).default)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);e.s(["Server",0,t],100559)},549705,e=>{"use strict";var t=e.i(344180),s=e.i(764556),a=e.i(244073),i=e.i(209988),n=e.i(260218),l=e.i(681622),r=e.i(562918),o=e.i(767467),c=e.i(100559),d=e.i(953700),m=e.i(137340),u=e.i(990336),x=e.i(307858),h=e.i(368942);let p={vision:"bg-blue-500/10 text-blue-600 border-blue-200",reasoning:"bg-purple-500/10 text-purple-600 border-purple-200",embedding:"bg-green-500/10 text-green-600 border-green-200"};function f({providers:e,providerModels:s,onEdit:i,onDelete:l,onAddModel:o}){let d=(0,a.useTranslations)("providers");return(0,t.jsxs)("div",{className:"flex flex-col p-2",children:[e.map(e=>{let a=s.find(t=>t.id===e.id),h=a?.models??[];return(0,t.jsxs)("div",{className:"group rounded-lg px-3 py-2.5 hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>i(e),children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex size-8 items-center justify-center rounded-lg bg-primary/10",children:(0,t.jsx)(c.Server,{className:"size-4 text-primary"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:e.apiBase||d("list.noApiBase")})]}),(0,t.jsxs)(r.Badge,{variant:"outline",className:"text-[10px] h-4 px-1.5",children:[h.length," ",d("list.modelsCount")]}),(0,t.jsx)(n.Button,{variant:"ghost",size:"icon-xs",className:"opacity-0 group-hover:opacity-100 transition-opacity",onClick:t=>{t.stopPropagation(),l(e.id)},children:(0,t.jsx)(m.Trash2,{className:"size-3 text-destructive"})})]}),h.length>0&&(0,t.jsx)("div",{className:"mt-2 ml-11 flex flex-wrap gap-1",children:h.map(e=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-[11px] text-muted-foreground",children:[(0,t.jsx)(u.Brain,{className:"size-3"}),e.name,["vision","reasoning","embedding"].map(s=>e[s]?(0,t.jsx)("span",{className:`inline-block rounded px-1 text-[9px] font-medium border ${p[s]}`,children:s[0].toUpperCase()},s):null)]},e.id))}),(0,t.jsxs)(n.Button,{variant:"ghost",size:"xs",className:"mt-1 ml-11 h-6 text-[11px] text-muted-foreground",onClick:t=>{t.stopPropagation(),o(e.name)},children:[(0,t.jsx)(x.ExternalLink,{className:"size-3"}),d("list.addModel")]})]},e.id)}),0===e.length&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,t.jsx)(c.Server,{className:"size-10 mb-2 opacity-30"}),(0,t.jsx)("p",{className:"text-sm",children:d("list.empty")})]})]})}function g({draft:e,onChange:s}){let i=(0,a.useTranslations)("providers");return(0,t.jsx)("div",{className:"flex flex-col gap-5 p-5",children:(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:i("form.connection")}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:i("form.name")}),(0,t.jsx)(l.Input,{value:e.name||"",onChange:e=>s("name",e.target.value),placeholder:i("form.namePlaceholder")})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:i("form.apiBase")}),(0,t.jsx)(l.Input,{value:e.apiBase||"",onChange:e=>s("apiBase",e.target.value),placeholder:i("form.apiBasePlaceholder")})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:i("form.apiKey")}),(0,t.jsx)(l.Input,{type:"password",value:e.apiKey||"",onChange:e=>s("apiKey",e.target.value),placeholder:i("form.apiKeyPlaceholder")})]})]})})}e.s(["ProvidersDialog",0,function({open:e,onOpenChange:l,onAddModel:r,standalone:c}){let m=(0,a.useTranslations)("providers"),u=(0,a.useTranslations)("common"),{models:x,providers:p,ensure:j,addProvider:v,updateProvider:N,removeProvider:y}=(0,h.useLLMStore)(),[b,k]=(0,s.useState)(null),[w,C]=(0,s.useState)(null),[S,T]=(0,s.useState)(!1),[z,D]=(0,s.useState)(!1),[I,P]=(0,s.useState)(null);(0,s.useEffect)(()=>{e&&(T(!0),P(null),j().finally(()=>T(!1)))},[e,j]);let $=()=>{k(null),C(null)},M=()=>{k(null),C({name:"",apiBase:"",apiKey:""})},A=async()=>{if(w&&w.name){D(!0),P(null);try{let e=!b,t=await fetch(e?"/api/providers":`/api/providers/${b.id}`,{method:e?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)});if(!t.ok)throw Error();let s=await t.json();e?v(s):N(s),$()}catch{P(m("error.saveFailed"))}finally{D(!1)}}},E=async e=>{if(confirm(m("confirm.delete"))){D(!0);try{if(!(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok)throw Error();y(e),b?.id===e&&$()}catch{P(m("error.deleteFailed"))}finally{D(!1)}}},B=(0,t.jsxs)(t.Fragment,{children:[!c&&(0,t.jsxs)("div",{className:"flex items-center gap-3 border-b px-5 py-4",children:[w&&(0,t.jsx)(n.Button,{variant:"ghost",size:"icon-sm",onClick:$,children:(0,t.jsx)(o.ArrowLeft,{className:"size-4"})}),(0,t.jsxs)(i.DialogHeader,{className:"flex-1 space-y-0",children:[(0,t.jsx)(i.DialogTitle,{className:"text-base",children:w?b?m("dialog.editTitle"):m("dialog.addTitle"):m("dialog.title")}),(0,t.jsx)(i.DialogDescription,{className:"text-xs",children:w?m("dialog.editDescription"):m("dialog.listDescription")})]}),!w&&(0,t.jsxs)(n.Button,{variant:"outline",size:"sm",onClick:M,className:"mr-6",children:[(0,t.jsx)(d.Plus,{className:"size-3.5"}),m("dialog.add")]})]}),c&&!w&&(0,t.jsx)("div",{className:"flex items-center justify-end px-5 py-3 border-b",children:(0,t.jsxs)(n.Button,{variant:"outline",size:"sm",onClick:M,children:[(0,t.jsx)(d.Plus,{className:"size-3.5"}),m("dialog.add")]})}),c&&w&&(0,t.jsxs)("div",{className:"flex items-center gap-3 px-5 py-3 border-b",children:[(0,t.jsx)(n.Button,{variant:"ghost",size:"icon-sm",onClick:$,children:(0,t.jsx)(o.ArrowLeft,{className:"size-4"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h2",{className:"text-base font-medium truncate",children:b?m("dialog.editTitle"):m("dialog.addTitle")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:m("dialog.editDescription")})]})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[I&&(0,t.jsx)("div",{className:"mx-5 mt-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:I}),S?(0,t.jsx)("div",{className:"py-12 text-center text-sm text-muted-foreground",children:m("dialog.loading")}):w?(0,t.jsx)(g,{draft:w,onChange:(e,t)=>{C(s=>s?{...s,[e]:t}:s)}}):(0,t.jsx)(f,{providers:p,providerModels:p.map(e=>{let t;return{id:e.id,models:(t=e.name,x.filter(e=>e.provider===t))}}),onEdit:e=>{k(e),C({...e})},onDelete:E,onAddModel:e=>{c||l(!1),r(e)}})]}),w&&(0,t.jsxs)("div",{className:"flex justify-end gap-2 border-t px-5 py-3",children:[(0,t.jsx)(n.Button,{variant:"outline",size:"sm",onClick:$,disabled:z,children:u("cancel")}),(0,t.jsx)(n.Button,{size:"sm",onClick:A,disabled:z||!w.name,children:u(z?"saving":"save")})]})]});return c?(0,t.jsx)("div",{className:"h-full flex flex-col",children:B}):(0,t.jsx)(i.Dialog,{open:e,onOpenChange:e=>{e||$(),l(e)},children:(0,t.jsx)(i.DialogContent,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 gap-0",children:B})})}])},86477,e=>{"use strict";var t=e.i(344180),s=e.i(764556),a=e.i(244073),i=e.i(209988),n=e.i(260218),l=e.i(681622),r=e.i(607452),o=e.i(562918),c=e.i(226624),d=e.i(767467),m=e.i(990336),u=e.i(953700),x=e.i(137340),h=e.i(368942);let p={vision:"bg-blue-500/10 text-blue-600 border-blue-200",reasoning:"bg-purple-500/10 text-purple-600 border-purple-200",embedding:"bg-green-500/10 text-green-600 border-green-200"},f=[{label:"8K",value:8192},{label:"16K",value:16384},{label:"32K",value:32768},{label:"64K",value:65536},{label:"128K",value:128e3},{label:"200K",value:2e5},{label:"256K",value:256e3},{label:"1M",value:1e6}],g=["low","medium","high"];function j({groups:e,providerNames:s,onEdit:i,onDelete:l}){let r=(0,a.useTranslations)("models"),c=s.length>0?s:["Other"],d=Object.keys(e).sort((e,t)=>{let s=c.indexOf(e),a=c.indexOf(t);return s>=0&&a>=0?s-a:s>=0?-1:a>=0?1:e.localeCompare(t)});return(0,t.jsxs)("div",{className:"flex flex-col p-4 gap-4",children:[d.map(s=>(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2 px-1",children:s}),(0,t.jsx)("div",{className:"flex flex-col gap-0.5",children:e[s].map(e=>{var s;return(0,t.jsxs)("div",{className:"group flex items-center gap-3 rounded-lg px-3 py-2 hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>i(e),children:[(0,t.jsx)(m.Brain,{className:"size-4 text-muted-foreground shrink-0"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground font-mono ml-2",children:e.modelId}),e.cost?(0,t.jsxs)("span",{className:"ml-2 text-[11px] text-muted-foreground font-mono",children:["$",y(e.cost.inputPerMillion),"/$",y(e.cost.outputPerMillion)]}):null,e.maxContextTokens?(0,t.jsxs)("span",{className:"ml-2 text-[11px] text-muted-foreground font-mono",children:[(s=e.maxContextTokens,new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1}).format(s))," ",r("list.contextAbbr")]}):null]}),(0,t.jsx)("div",{className:"flex items-center gap-1",children:["vision","reasoning","embedding"].map(s=>e[s]?(0,t.jsx)(o.Badge,{variant:"outline",className:`text-[10px] h-5 px-1.5 ${p[s]}`,children:r(`capability.${s}`)},s):null)}),(0,t.jsx)(n.Button,{variant:"ghost",size:"icon-xs",className:"opacity-0 group-hover:opacity-100 transition-opacity",onClick:t=>{t.stopPropagation(),l(e.id)},children:(0,t.jsx)(x.Trash2,{className:"size-3 text-destructive"})})]},e.id)})})]},s)),0===d.length&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,t.jsx)(m.Brain,{className:"size-10 mb-2 opacity-30"}),(0,t.jsx)("p",{className:"text-sm",children:r("list.empty")})]})]})}function v({draft:e,providerNames:i,onChange:n}){let o=(0,a.useTranslations)("models"),d=(0,s.useRef)(!1),[m,u]=(0,s.useState)(()=>(function(e){if(!e)return f.length;let t=f.findIndex(t=>t.value===e);return t>=0?t:f.length})(e.maxContextTokens)),x=i.length>0?i:["Other"];return(0,t.jsxs)("div",{className:"flex flex-col gap-5 p-5",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:o("form.details")}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:o("form.modelId")}),(0,t.jsx)(l.Input,{value:e.modelId||"",onChange:e=>{let t=e.target.value;n("modelId",t),d.current||n("name",t)},placeholder:o("form.modelIdPlaceholder")})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:o("form.displayName")}),(0,t.jsx)(l.Input,{value:e.name||"",onChange:e=>{d.current=!0,n("name",e.target.value)},placeholder:o("form.displayNamePlaceholder")})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:o("form.provider")}),(0,t.jsx)("select",{value:e.provider||"Other",onChange:e=>n("provider",e.target.value),className:"h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring dark:bg-input/30",children:x.map(e=>(0,t.jsx)("option",{value:e,children:e},e))})]})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:o("form.context")}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:o("form.maxContextTokens")}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(r.Slider,{min:0,max:f.length,step:1,value:m,onValueChange:e=>{u(e),e<f.length&&n("maxContextTokens",f[e].value)},className:"flex-1"}),m<f.length?(0,t.jsx)("span",{className:"text-sm tabular-nums min-w-[3.5rem] text-right",children:f[m].label}):(0,t.jsx)(l.Input,{type:"number",min:"1",step:"1",value:e.maxContextTokens??"",onChange:e=>n("maxContextTokens",function(e){if(!e.trim())return;let t=Number(e);return Number.isFinite(t)&&t>0?Math.floor(t):void 0}(e.target.value)),placeholder:o("form.customContextPlaceholder"),className:"h-7 w-24 text-sm tabular-nums"})]})]})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:o("form.thinking")}),(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-input px-3 py-2",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:o("form.enableThinking")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:o("form.enableThinkingHelper")})]}),(0,t.jsx)(c.Switch,{checked:e.thinkingEnabled??!0,onCheckedChange:e=>n("thinkingEnabled",e)})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:o("form.effort")}),(0,t.jsx)("select",{value:e.thinkingEffort||"medium",onChange:e=>n("thinkingEffort",e.target.value),disabled:!(e.thinkingEnabled??!0),className:"h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring disabled:cursor-not-allowed disabled:opacity-50 dark:bg-input/30",children:g.map(e=>(0,t.jsx)("option",{value:e,children:e},e))})]})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:o("form.cost")}),(0,t.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:o("form.inputPerMillion")}),(0,t.jsx)(l.Input,{type:"number",min:"0",step:"0.0001",value:e.cost?.inputPerMillion??0,onChange:t=>n("cost",{inputPerMillion:N(t.target.value),outputPerMillion:e.cost?.outputPerMillion??0}),placeholder:o("form.costPlaceholder")})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:o("form.outputPerMillion")}),(0,t.jsx)(l.Input,{type:"number",min:"0",step:"0.0001",value:e.cost?.outputPerMillion??0,onChange:t=>n("cost",{inputPerMillion:e.cost?.inputPerMillion??0,outputPerMillion:N(t.target.value)}),placeholder:o("form.costPlaceholder")})]})]})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:o("form.capabilities")}),(0,t.jsx)("div",{className:"flex items-center gap-1.5",children:["vision","reasoning","embedding"].map(s=>{let a=!!e[s];return(0,t.jsx)("button",{type:"button",onClick:()=>n(s,!a),className:`rounded-md border px-2 py-1 text-xs font-medium transition-colors cursor-pointer
|
|
2
|
+
${a?p[s]:"text-muted-foreground border-input hover:bg-muted/50"}`,children:o(`capability.${s}`)},s)})})]})]})}function N(e){let t=Number(e);return Number.isFinite(t)&&t>=0?t:0}function y(e){return new Intl.NumberFormat("en-US",{maximumFractionDigits:4}).format(e)}e.s(["ModelsDialog",0,function({open:e,onOpenChange:l,initialProvider:r,standalone:o}){let c=(0,a.useTranslations)("models"),m=(0,a.useTranslations)("common"),{models:x,providers:p,ensure:f,addModel:g,updateModel:N,removeModel:y}=(0,h.useLLMStore)(),b=p.map(e=>e.name),[k,w]=(0,s.useState)(null),[C,S]=(0,s.useState)(null),[T,z]=(0,s.useState)(!1),[D,I]=(0,s.useState)(!1),[P,$]=(0,s.useState)(null),M=(0,s.useRef)(!1);(0,s.useEffect)(()=>{if(!e){M.current=!1;return}queueMicrotask(()=>{z(!0),$(null)}),f().finally(()=>z(!1))},[e,f]),(0,s.useEffect)(()=>{e&&r&&!C&&!M.current&&(M.current=!0,queueMicrotask(()=>{w(null),S({modelId:"",name:"",provider:r,cost:{inputPerMillion:0,outputPerMillion:0},maxContextTokens:128e3,thinkingEnabled:!0,thinkingEffort:"medium",vision:!1,reasoning:!1,embedding:!1})}))},[e,r,C]);let A=()=>{w(null),S(null)},E=()=>{w(null),S({modelId:"",name:"",provider:"Other",cost:{inputPerMillion:0,outputPerMillion:0},maxContextTokens:128e3,thinkingEnabled:!0,thinkingEffort:"medium",vision:!1,reasoning:!1,embedding:!1})},B=async()=>{if(C&&C.modelId&&C.name){I(!0),$(null);try{let e=!k,t=await fetch(e?"/api/models":`/api/models/${k.id}`,{method:e?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)});if(!t.ok)throw Error();let s=await t.json();e?g(s):N(s),A()}catch{$(c("error.saveFailed"))}finally{I(!1)}}},O=async e=>{if(confirm(c("confirm.delete"))){I(!0);try{if(!(await fetch(`/api/models/${e}`,{method:"DELETE"})).ok)throw Error();y(e),k?.id===e&&A()}catch{$(c("error.deleteFailed"))}finally{I(!1)}}},L=function(e){let t={};for(let s of e){let e=s.provider||"Other";(t[e]??=[]).push(s)}return t}(x),U=(0,t.jsxs)(t.Fragment,{children:[!o&&(0,t.jsxs)("div",{className:"flex items-center gap-3 border-b px-5 py-4",children:[C&&(0,t.jsx)(n.Button,{variant:"ghost",size:"icon-sm",onClick:A,children:(0,t.jsx)(d.ArrowLeft,{className:"size-4"})}),(0,t.jsxs)(i.DialogHeader,{className:"flex-1 space-y-0",children:[(0,t.jsx)(i.DialogTitle,{className:"text-base",children:C?k?c("dialog.editTitle"):c("dialog.addTitle"):c("dialog.title")}),(0,t.jsx)(i.DialogDescription,{className:"text-xs",children:C?c("dialog.editDescription"):c("dialog.listDescription")})]}),!C&&(0,t.jsxs)(n.Button,{variant:"outline",size:"sm",onClick:E,className:"mr-6",children:[(0,t.jsx)(u.Plus,{className:"size-3.5"}),c("dialog.add")]})]}),o&&!C&&(0,t.jsx)("div",{className:"flex items-center justify-end px-5 py-3 border-b",children:(0,t.jsxs)(n.Button,{variant:"outline",size:"sm",onClick:E,children:[(0,t.jsx)(u.Plus,{className:"size-3.5"}),c("dialog.add")]})}),o&&C&&(0,t.jsxs)("div",{className:"flex items-center gap-3 px-5 py-3 border-b",children:[(0,t.jsx)(n.Button,{variant:"ghost",size:"icon-sm",onClick:A,children:(0,t.jsx)(d.ArrowLeft,{className:"size-4"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h2",{className:"text-base font-medium truncate",children:k?c("dialog.editTitle"):c("dialog.addTitle")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:c("dialog.editDescription")})]})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[P&&(0,t.jsx)("div",{className:"mx-5 mt-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:P}),T?(0,t.jsx)("div",{className:"py-12 text-center text-sm text-muted-foreground",children:c("dialog.loading")}):C?(0,t.jsx)(v,{draft:C,providerNames:b,onChange:(e,t)=>{S(s=>s?{...s,[e]:t}:s)}}):(0,t.jsx)(j,{groups:L,providerNames:b,onEdit:e=>{w(e),S({...e,thinkingEnabled:e.thinkingEnabled??!0,thinkingEffort:e.thinkingEffort??"medium"})},onDelete:O})]}),C&&(0,t.jsxs)("div",{className:"flex justify-end gap-2 border-t px-5 py-3",children:[(0,t.jsx)(n.Button,{variant:"outline",size:"sm",onClick:A,disabled:D,children:m("cancel")}),(0,t.jsx)(n.Button,{size:"sm",onClick:B,disabled:D||!C.modelId||!C.name,children:m(D?"saving":"save")})]})]});return o?(0,t.jsx)("div",{className:"h-full flex flex-col",children:U}):(0,t.jsx)(i.Dialog,{open:e,onOpenChange:e=>{e||A(),l(e)},children:(0,t.jsx)(i.DialogContent,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 gap-0",children:U})})}])},515104,e=>{"use strict";function t(){return"tauri.localhost"===window.location.hostname||"__TAURI_INTERNALS__"in window}function s(){return t()&&"u">typeof navigator&&/android/i.test(navigator.userAgent)}async function a(){return t()?c():"Notification"in window?o(Notification.permission):"unsupported"}async function i(){return t()?d():r()}async function n(e,s,a={}){var i,l;return t()?m(e,s,a):(i=e,l=s,void("Notification"in window&&"granted"===Notification.permission&&new Notification(i,{body:l,icon:"/favicon.ico"})))}async function l(e){if(s())return n("Agent Spaces",e,{id:10001,ongoing:!0})}async function r(){return"Notification"in window?o(await Notification.requestPermission()):"unsupported"}function o(e){switch(e){case"granted":return"granted";case"denied":return"denied";default:return"default"}}async function c(){try{let{isPermissionGranted:t}=await e.A(678001);return await t()?"granted":"default"}catch{return"unsupported"}}async function d(){try{let{requestPermission:t,isPermissionGranted:s}=await e.A(678001),a=await t();if("granted"===a||await s())return"granted";return"denied"}catch{return"unsupported"}}async function m(t,s,a={}){try{let{sendNotification:i,isPermissionGranted:n}=await e.A(678001);if(!await n())return;i({title:t,body:s,...a})}catch{}}e.s(["getNotificationPermission",0,a,"isTauriAndroidEnvironment",0,s,"isTauriEnvironment",0,t,"requestNotificationPermission",0,i,"sendAndroidOngoingTaskNotification",0,l,"sendNativeNotification",0,n])},437122,233297,286117,e=>{"use strict";var t=e.i(523592);function s(e){let[t,s=""]=e.split("#",2),[a,i=""]=t.split("?",2);if(!a.startsWith("/")||a.startsWith("/api/"))return e;if("/"===a)return`/${i?`?${i}`:""}${s?`#${s}`:""}`;if(a.startsWith("/workspace/")){let e=a.slice(11).split("/")[0],t=new URLSearchParams(i);return t.set("workspaceId",e),`/workspace/_.html${t.toString()?`?${t.toString()}`:""}${s?`#${s}`:""}`}let n=a.endsWith(".html")?a:`${a}.html`;return`${n}${i?`?${i}`:""}${s?`#${s}`:""}`}function a(e){return"/index.html"===e?"/":e.endsWith(".html")?e.slice(0,-5):e}function i(e){return"/login"===a(e)}e.i(8890),e.i(515104),e.s(["tauriNavigate",0,function(e,t,a=!1){t=s(t),a?window.location.replace(t):window.location.href=t},"toStaticHref",0,s],233297),e.s(["isLoginPath",0,i,"isWorkspacePath",0,function(e){return a(e).startsWith("/workspace/")},"workspaceIdFromLocation",0,function(e,t){let s=new URLSearchParams(t).get("workspaceId");if(s)return s;let i=a(e).match(/^\/workspace\/([^/]+)/);return i?.[1]??null}],286117);let n="agent-spaces-token",l="agent-spaces-auth-verified";function r(){let e=localStorage.getItem(n);if(null!==e)return e;let s=(0,t.getActiveServer)()?.secret;return void 0!==s?s:null}function o(){localStorage.removeItem(n),localStorage.removeItem(l)}function c(){let e=r();return null===e?{}:{Authorization:`Bearer ${e}`}}async function d(e,a){let n=function(e){if("string"!=typeof e||e.startsWith("http"))return e;let s=(0,t.getActiveServerUrl)();return s?`${s}${e.startsWith("/")?"":"/"}${e}`:e}(e),l={...c(),...a?.headers},r=await fetch(n,{...a,headers:l});return(401===r.status||403===r.status)&&(o(),i(window.location.pathname)||window.location.replace(s("/login"))),r}e.s(["authHeaders",0,c,"fetchWithAuth",0,d,"getToken",0,r,"isAuthenticated",0,function(){return"1"===localStorage.getItem(l)},"removeToken",0,o,"setToken",0,function(e){localStorage.setItem(n,e),localStorage.setItem(l,"1")}],437122)},962562,995684,e=>{"use strict";let t=(0,e.i(433721).default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);e.s(["default",0,t],995684),e.s(["Pencil",0,t],962562)},210,e=>{"use strict";let t=(0,e.i(433721).default)("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);e.s(["Settings2",0,t],210)},894920,e=>{"use strict";var t=e.i(344180),s=e.i(764556),a=e.i(209988),i=e.i(260218),n=e.i(681622),l=e.i(788010),r=e.i(344118),o=e.i(962562),c=e.i(953700),d=e.i(100559),m=e.i(137340);let u=(0,e.i(433721).default)("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);var x=e.i(244073);e.s(["ServerManagerDialog",0,function({open:e,onOpenChange:h,servers:p,activeId:f,onUpdate:g,onRemove:j,onSwitch:v}){let N=(0,x.useTranslations)("sidebar"),y=(0,x.useTranslations)("common"),[b,k]=s.useState(null),[w,C]=s.useState(""),[S,T]=s.useState(""),[z,D]=s.useState(""),[I,P]=s.useState(""),[$,M]=s.useState(""),[A,E]=s.useState(""),[B,O]=s.useState(""),[L,U]=s.useState(null),_=()=>{k(null),C(""),T(""),D("")},F=()=>{if(!w.trim()||!S.trim())return;let e=S.trim().replace(/\/$/,"");/^https?:\/\//.test(e)||(e="http://"+e),g(p.map(t=>t.id===b?{...t,name:w.trim(),url:e,secret:z.trim()||void 0}:t)),_()},R=s.useCallback(e=>{console.log(`[server-diagnostic] ${e}`),O(t=>`${t}${t?"\n":""}${e}`)},[]),H=async e=>{U(e.id),O("");let t=e.url.replace(/\/$/,""),s=`${t}/api/health`,a=new URL("/ws",t);a.protocol="https:"===a.protocol?"wss:":"ws:",a.searchParams.set("workspaceId","__diagnostic__"),a.searchParams.set("token",e.secret||"__diagnostic__"),R(`time: ${new Date().toISOString()}`),R(`window.origin: ${window.location.origin}`),R(`window.href: ${window.location.href}`),R(`navigator.onLine: ${navigator.onLine}`),R(`target: ${t}`),R(`health: ${s}`);let i=performance.now();try{let e=new AbortController,t=window.setTimeout(()=>e.abort(),1e4),a=await fetch(s,{method:"GET",cache:"no-store",mode:"cors",signal:e.signal});window.clearTimeout(t);let n=await a.text();R(`fetch /api/health: OK ${a.status} ${a.statusText} (${Math.round(performance.now()-i)}ms)`),R(`fetch response: ${n.slice(0,500)||"<empty>"}`)}catch(t){let e=t instanceof Error?t:Error(String(t));R(`fetch /api/health: FAILED ${e.name}: ${e.message} (${Math.round(performance.now()-i)}ms)`)}R(`websocket: ${a.toString()}`),await new Promise(e=>{let t=performance.now(),s=!1,i=(a,i)=>{if(!s){s=!0,R(`${a} (${Math.round(performance.now()-t)}ms)`);try{i?.close()}catch{}e()}};try{let e=new WebSocket(a.toString()),t=window.setTimeout(()=>i("websocket: TIMEOUT",e),1e4);e.onopen=()=>{window.clearTimeout(t),i("websocket: OPEN",e)},e.onerror=()=>{window.clearTimeout(t),i("websocket: ERROR",e)},e.onclose=s=>{window.clearTimeout(t),i(`websocket: CLOSE code=${s.code} reason=${s.reason||"<empty>"}`,e)}}catch(t){let e=t instanceof Error?t:Error(String(t));i(`websocket: FAILED ${e.name}: ${e.message}`)}}),U(null)};return(0,t.jsx)(a.Dialog,{open:e,onOpenChange:e=>{h(e),e||_()},children:(0,t.jsxs)(a.DialogContent,{className:"max-w-md",children:[(0,t.jsxs)(a.DialogHeader,{children:[(0,t.jsx)(a.DialogTitle,{children:N("server.manageServers")}),(0,t.jsx)(a.DialogDescription,{children:N("server.manageDescription")})]}),(0,t.jsx)("div",{className:"space-y-1",children:p.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-3 rounded-md border px-3 py-2",children:[(0,t.jsx)(d.Server,{className:"size-4 shrink-0 text-muted-foreground"}),b===e.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.Input,{className:"h-7 text-sm flex-1",value:w,onChange:e=>C(e.target.value),placeholder:"Name",autoFocus:!0}),(0,t.jsx)(n.Input,{className:"h-7 text-sm flex-[1.5]",value:S,onChange:e=>T(e.target.value),placeholder:"http://...",onKeyDown:e=>"Enter"===e.key&&e.preventDefault()}),(0,t.jsx)(i.Button,{size:"sm",variant:"ghost",onClick:F,className:"h-7 px-2",children:y("save")}),(0,t.jsx)(i.Button,{size:"sm",variant:"ghost",onClick:_,className:"h-7 px-2",children:y("cancel")})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0 cursor-pointer",onClick:()=>{e.id!==f&&v(e)},children:[(0,t.jsx)("div",{className:"text-sm font-medium truncate",children:e.name}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.url})]}),e.id===f?(0,t.jsx)(r.Check,{className:"size-4 shrink-0 text-primary"}):(0,t.jsx)(i.Button,{size:"sm",variant:"ghost",onClick:()=>v(e),className:"h-7 px-2 text-xs shrink-0",children:N("server.switch")}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u,{className:"size-3.5 shrink-0 text-muted-foreground cursor-pointer hover:text-foreground",onClick:()=>H(e)}),(0,t.jsx)(o.Pencil,{className:"size-3.5 shrink-0 text-muted-foreground cursor-pointer hover:text-foreground",onClick:()=>{k(e.id),C(e.name),T(e.url),D(e.secret||"")}}),"default"!==e.id&&(0,t.jsx)(m.Trash2,{className:"size-3.5 shrink-0 text-muted-foreground cursor-pointer hover:text-destructive",onClick:()=>j(e.id)})]})]})]},e.id))}),null===b&&(0,t.jsxs)("div",{className:"border-t pt-3 mt-2 space-y-2",children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground mb-2",children:N("server.newServer")}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(n.Input,{className:"h-8 text-sm",value:I,onChange:e=>P(e.target.value),placeholder:"Name"}),(0,t.jsx)(i.Button,{size:"sm",onClick:()=>{if(!I.trim()||!$.trim())return;let e=$.trim().replace(/\/$/,"");/^https?:\/\//.test(e)||(e="http://"+e),g([...p,{id:Date.now().toString(),name:I.trim(),url:e,secret:A.trim()||void 0}]),P(""),M(""),E("")},disabled:!I.trim()||!$.trim(),children:(0,t.jsx)(c.Plus,{className:"size-4"})})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(n.Input,{className:"h-8 text-sm flex-1",value:$,onChange:e=>M(e.target.value),placeholder:"http://..."})}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(n.Input,{className:"h-8 text-sm flex-1",type:"password",value:A,onChange:e=>E(e.target.value),placeholder:N("server.secretOptionalPlaceholder"),onKeyDown:e=>"Enter"===e.key&&e.preventDefault()})})]}),(0,t.jsxs)("div",{className:"border-t pt-3 mt-2 space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:"Network diagnostics"}),(0,t.jsx)(i.Button,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",disabled:!p.find(e=>e.id===f)||null!==L,onClick:()=>{let e=p.find(e=>e.id===f);e&&H(e)},children:L?"Testing...":"Test active"})]}),(0,t.jsx)(l.Textarea,{readOnly:!0,value:B||"Tap the Wi-Fi icon next to a server, or use Test active.",className:"h-36 resize-none font-mono text-[11px]"})]})]})})}],894920)},111343,e=>{"use strict";let t=(0,e.i(433721).default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);e.s(["Save",0,t],111343)},255742,973767,401058,977694,e=>{"use strict";var t=e.i(433721);let s=(0,t.default)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);e.s(["Star",0,s],255742);let a=(0,t.default)("star-off",[["path",{d:"m10.344 4.688 1.181-2.393a.53.53 0 0 1 .95 0l2.31 4.679a2.12 2.12 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.237 3.152",key:"19ctli"}],["path",{d:"m17.945 17.945.43 2.505a.53.53 0 0 1-.771.56l-4.618-2.428a2.12 2.12 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a8 8 0 0 0 .4-.099",key:"ptqqvy"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);e.s(["StarOff",0,a],973767);let i=(0,t.default)("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);e.s(["MoreVertical",0,i],401058);let n=(0,t.default)("rocket",[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]]);e.s(["Rocket",0,n],977694)},22906,191202,e=>{"use strict";var t=e.i(344180),s=e.i(764556),a=e.i(244073),i=e.i(887836),n=e.i(209988),l=e.i(260218),r=e.i(681622),o=e.i(788010),c=e.i(191118),d=e.i(917955),m=e.i(996652),u=e.i(188815),x=e.i(611176),h=e.i(255742),p=e.i(973767),f=e.i(129981),g=e.i(887354);let j=(0,e.i(433721).default)("plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]]);e.s(["Plug",0,j],191202);var v=e.i(972846),N=e.i(401058),y=e.i(137340),b=e.i(977694),k=e.i(111343),w=e.i(465458);e.i(462506);let C=(0,i.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading editor..."})});e.s(["McpsDialog",0,function({open:e,onOpenChange:i,standalone:S}){let T=(0,a.useTranslations)("mcps"),z=(0,a.useTranslations)("common"),[D,I]=(0,s.useState)([]),[P,$]=(0,s.useState)([]),[M,A]=(0,s.useState)(!1),[E,B]=(0,s.useState)(""),[O,L]=(0,s.useState)("all"),[U,_]=(0,s.useState)(""),[F,R]=(0,s.useState)(!1),[H,W]=(0,s.useState)(""),[K,J]=(0,s.useState)(""),[q,V]=(0,s.useState)(null),[G,X]=(0,s.useState)([]),[Y,Z]=(0,s.useState)(null),[Q,ee]=(0,s.useState)(""),et=(0,s.useCallback)(async()=>{A(!0);try{let e=await fetch("/api/mcps");e.ok&&I(await e.json())}catch{}A(!1)},[]),es=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/agents/presets");if(e.ok){let t=await e.json();$(t.map(e=>({id:e.id,name:e.name,avatarUrl:e.avatarUrl,description:e.description})))}}catch{}},[]);(0,s.useEffect)(()=>{(e||S)&&(et(),es())},[e,S,et,es]);let ea=async e=>{try{let t=await fetch(`/api/mcps/${encodeURIComponent(e.name)}/favorite`,{method:"POST"});if(t.ok){let{favorited:s}=await t.json();I(t=>t.map(t=>t.name===e.name?{...t,favorited:s}:t))}}catch{}},ei=async()=>{J("");try{JSON.parse(H)}catch{J(T("importInvalidJson"));return}try{let e=await fetch("/api/mcps/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonText:H})});if(e.ok)W(""),R(!1),et();else{let t=await e.json();J(t.error||T("importFailed"))}}catch{J(T("importFailed"))}},en=async()=>{let e;if(Y){try{e=JSON.parse(Q)}catch{return}try{(await fetch(`/api/mcps/${encodeURIComponent(Y.name)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:e})})).ok&&(I(t=>t.map(t=>t.name===Y.name?{...t,config:e}:t)),Z(null))}catch{}}},el=async e=>{try{(await fetch(`/api/mcps/${encodeURIComponent(e.name)}`,{method:"DELETE"})).ok&&I(t=>t.filter(t=>t.name!==e.name))}catch{}},er=async()=>{if(q){for(let e of P){let t=q.boundAgents.some(t=>t.id===e.id),s=G.includes(e.id);if(t&&!s){let t=await fetch(`/api/agents/presets/${e.id}`);if(!t.ok)continue;let s=await t.json(),a=s.mcps||{},i={...a.mcpServers||{}};delete i[q.name],await fetch(`/api/agents/presets/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,mcps:{...a,mcpServers:i}})})}else if(!t&&s){let t=await fetch(`/api/agents/presets/${e.id}`);if(!t.ok)continue;let s=await t.json(),a=s.mcps||{},i={...a.mcpServers||{}};q.name in i||(i[q.name]=q.config,await fetch(`/api/agents/presets/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,mcps:{...a,mcpServers:i}})}))}}V(null),et()}},eo=e=>{X(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},ec=D.filter(e=>{if(E){let t=E.toLowerCase();if(!e.name.toLowerCase().includes(t)&&!e.description.toLowerCase().includes(t))return!1}return("favorites"!==O||!!e.favorited)&&("agent"!==O||!U||!!e.boundAgents.some(e=>e.id===U))}),ed=(S||e)&&!q&&!Y,em=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-end pr-8 pt-2",children:[(0,t.jsxs)("div",{className:"hidden md:block",children:[S?(0,t.jsx)("h2",{className:"text-base font-semibold",children:T("title")}):(0,t.jsx)(n.DialogTitle,{children:T("title")}),S?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:T("description")}):(0,t.jsx)(n.DialogDescription,{children:T("description")})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsxs)(m.Popover,{open:F,onOpenChange:R,children:[(0,t.jsx)(m.PopoverTrigger,{render:(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",children:[(0,t.jsx)(f.Upload,{className:"size-3.5 mr-1"}),T("import")]})}),(0,t.jsx)(m.PopoverContent,{className:"w-96",align:"end",children:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:T("importTitle")}),(0,t.jsx)(o.Textarea,{value:H,onChange:e=>{W(e.target.value),J("")},placeholder:'{\n "mcpServers": {\n "server-name": {\n "command": "npx",\n "args": ["-y", "package"],\n "env": {}\n }\n }\n}',className:"font-mono text-xs min-h-[180px] resize-none"}),K&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:K}),(0,t.jsx)(l.Button,{size:"sm",onClick:ei,disabled:!H.trim(),className:"w-full",children:T("importConfirm")})]})})]})})]})}),(0,t.jsxs)("div",{className:"flex flex-1 min-h-0 gap-4 pt-2",children:[(0,t.jsxs)("div",{className:"hidden md:flex w-44 shrink-0 flex-col gap-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)(l.Button,{variant:"all"===O?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{L("all"),_("")},children:[(0,t.jsx)(j,{className:"size-3.5 mr-1.5"}),T("filterAll")]}),(0,t.jsxs)(l.Button,{variant:"favorites"===O?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{L("favorites"),_("")},children:[(0,t.jsx)(h.Star,{className:"size-3.5 mr-1.5"}),T("filterFavorites")]})]}),P.length>0&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground px-2",children:T("filterByAgent")}),(0,t.jsx)(c.ScrollArea,{className:"max-h-48",children:P.map(e=>(0,t.jsxs)(l.Button,{variant:"agent"===O&&U===e.id?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{L("agent"),_(e.id)},children:[(0,t.jsx)(x.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-4 mr-1.5 rounded-full"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]},e.id))})]})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex md:hidden flex-col gap-2",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(g.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(r.Input,{value:E,onChange:e=>B(e.target.value),placeholder:T("search"),className:"pl-8"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"flex rounded-lg border border-input p-0.5",children:[(0,t.jsx)("button",{type:"button",className:(0,w.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors","all"===O?"bg-muted":"text-muted-foreground hover:text-foreground"),onClick:()=>{L("all"),_("")},children:T("filterAll")}),(0,t.jsxs)("button",{type:"button",className:(0,w.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors","favorites"===O?"bg-muted":"text-muted-foreground hover:text-foreground"),onClick:()=>{L("favorites"),_("")},children:[(0,t.jsx)(h.Star,{className:"size-3 inline-block mr-0.5 -mt-px"}),T("filterFavorites")]})]}),P.length>0&&(0,t.jsx)(u.SearchSelect,{value:"agent"===O?U:"",onChange:e=>{e?(L("agent"),_(e)):(L("all"),_(""))},options:P.map(e=>({value:e.id,label:e.name})),placeholder:T("filterByAgent"),allowCustom:!1,className:"flex-1 min-w-0"})]})]}),(0,t.jsxs)("div",{className:"hidden md:block relative",children:[(0,t.jsx)(g.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(r.Input,{value:E,onChange:e=>B(e.target.value),placeholder:T("search"),className:"pl-8"})]}),(0,t.jsx)(c.ScrollArea,{className:"flex-1",children:M?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:z("loading")}):0===ec.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:T("empty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 gap-3 pr-2",children:ec.map(e=>(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-background p-4 hover:bg-accent/30 transition-colors cursor-pointer",onClick:()=>{Z(e),ee(JSON.stringify(e.config,null,2))},children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(j,{className:"size-3.5 text-muted-foreground"}),(0,t.jsx)("span",{className:"font-medium text-sm",children:e.name}),(0,t.jsx)("button",{type:"button",className:"flex items-center justify-center size-5 rounded hover:bg-accent",onClick:t=>{t.stopPropagation(),ea(e)},children:e.favorited?(0,t.jsx)(h.Star,{className:"size-3.5 text-yellow-500 fill-yellow-500"}):(0,t.jsx)(p.StarOff,{className:"size-3.5 text-muted-foreground"})})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:e.description||e.config.command||e.config.url||JSON.stringify(e.config).slice(0,100)})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",onClick:()=>{V(e),X(e.boundAgents.map(e=>e.id))},children:[(0,t.jsx)(b.Rocket,{className:"size-3.5 mr-1"}),T("apply")]}),(0,t.jsxs)(d.DropdownMenu,{children:[(0,t.jsx)(d.DropdownMenuTrigger,{render:(0,t.jsx)(l.Button,{variant:"ghost",size:"icon",className:"size-7"}),children:(0,t.jsx)(N.MoreVertical,{className:"size-3.5"})}),(0,t.jsx)(d.DropdownMenuContent,{align:"end",children:(0,t.jsxs)(d.DropdownMenuItem,{className:"text-destructive focus:text-destructive",onClick:()=>el(e),children:[(0,t.jsx)(y.Trash2,{className:"size-3.5 mr-1.5"}),T("delete")]})})]})]})]}),e.boundAgents.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mt-2.5 pt-2.5 border-t border-border/50",children:[e.boundAgents.map(e=>(0,t.jsx)(x.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-5 rounded-full"},e.id)),(0,t.jsx)("span",{className:"text-xs text-muted-foreground ml-1",children:e.boundAgents.length})]})]},e.name))})})]})]})]});return(0,t.jsxs)(t.Fragment,{children:[S&&ed&&(0,t.jsx)("div",{className:"h-full flex flex-col",children:em}),!S&&(0,t.jsx)(n.Dialog,{open:ed,onOpenChange:i,children:(0,t.jsx)(n.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:em})}),(0,t.jsx)(n.Dialog,{open:!!Y,onOpenChange:e=>{e||Z(null)},children:(0,t.jsxs)(n.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:[(0,t.jsx)(n.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between pr-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(n.DialogTitle,{children:T("editTitle",{name:Y?.name||""})}),(0,t.jsx)(n.DialogDescription,{children:T("editDescription")})]}),(0,t.jsxs)(l.Button,{size:"sm",onClick:en,children:[(0,t.jsx)(k.Save,{className:"size-3.5 mr-1"}),z("save")]})]})}),(0,t.jsx)("div",{className:"flex-1 min-h-0 pt-2",children:(0,t.jsx)(C,{height:"100%",language:"json",value:Q,onChange:e=>ee(e||""),theme:"vs-dark",options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},renderLineHighlight:"gutter",wordWrap:"on",formatOnPaste:!0}})})]})}),(0,t.jsx)(n.Dialog,{open:!!q,onOpenChange:e=>{e||V(null)},children:(0,t.jsxs)(n.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsxs)(n.DialogHeader,{children:[(0,t.jsx)(n.DialogTitle,{children:T("bindTitle",{name:q?.name||""})}),(0,t.jsx)(n.DialogDescription,{children:T("bindDescription")})]}),(0,t.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,t.jsx)("div",{className:"max-h-52 overflow-y-auto space-y-0.5",children:P.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>eo(e.id),className:(0,w.cn)("flex items-center gap-2 w-full px-2 py-1.5 rounded-md hover:bg-muted text-left text-sm transition-colors"),children:[(0,t.jsx)(x.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-5 rounded-full"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"block truncate",children:e.name}),e.description&&(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,t.jsx)("div",{className:(0,w.cn)("flex items-center justify-center size-4 rounded border shrink-0",G.includes(e.id)?"bg-primary border-primary text-primary-foreground":"border-input")})]},e.id))}),G.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:G.map(e=>{let s=P.find(t=>t.id===e);return(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md bg-muted px-2 py-0.5 text-xs",children:[(0,t.jsx)(x.AgentIcon,{agentId:e,name:s?.name,className:"size-3.5 rounded-full"}),s?.name||e,(0,t.jsx)("button",{type:"button",onClick:()=>eo(e),className:"hover:text-destructive",children:(0,t.jsx)(v.X,{className:"size-3"})})]},e)})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,t.jsx)(l.Button,{variant:"outline",onClick:()=>V(null),children:z("cancel")}),(0,t.jsx)(l.Button,{onClick:er,children:z("confirm")})]})]})]})})]})}],22906)},625873,e=>{"use strict";var t=e.i(344180),s=e.i(764556),a=e.i(244073),i=e.i(887836),n=e.i(209988),l=e.i(260218),r=e.i(681622),o=e.i(191118),c=e.i(917955),d=e.i(996652),m=e.i(460578),u=e.i(188815),x=e.i(611176),h=e.i(255742),p=e.i(973767),f=e.i(129981),g=e.i(887354),j=e.i(989484),v=e.i(972846),N=e.i(401058),y=e.i(137340),b=e.i(977694),k=e.i(111343),w=e.i(601039),C=e.i(465458);e.i(462506);let S=(0,i.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading editor..."})});e.s(["SkillsDialog",0,function({open:e,onOpenChange:i,standalone:T}){let z=(0,a.useTranslations)("skills"),D=(0,a.useTranslations)("common"),[I,P]=(0,s.useState)([]),[$,M]=(0,s.useState)([]),[A,E]=(0,s.useState)(!1),[B,O]=(0,s.useState)(""),[L,U]=(0,s.useState)("all"),[_,F]=(0,s.useState)(""),[R,H]=(0,s.useState)(!1),[W,K]=(0,s.useState)([]),[J,q]=(0,s.useState)(null),[V,G]=(0,s.useState)([]),[X,Y]=(0,s.useState)(null),[Z,Q]=(0,s.useState)(""),[ee,et]=(0,s.useState)([]),[es,ea]=(0,s.useState)(new Set),[ei,en]=(0,s.useState)(!1),[el,er]=(0,s.useState)(!1),eo=(0,s.useCallback)(async()=>{E(!0);try{let e=await fetch("/api/skills");e.ok&&P(await e.json())}catch{}E(!1)},[]),ec=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/agents/presets");if(e.ok){let t=await e.json();M(t.map(e=>({id:e.id,name:e.name,avatarUrl:e.avatarUrl,description:e.description})))}}catch{}},[]);(0,s.useEffect)(()=>{(e||T)&&(eo(),ec())},[e,T,eo,ec]);let ed=async e=>{try{let t=await fetch(`/api/skills/${encodeURIComponent(e.name)}/favorite`,{method:"POST"});if(t.ok){let{favorited:s}=await t.json();P(t=>t.map(t=>t.name===e.name?{...t,favorited:s}:t))}}catch{}},em=async()=>{for(let e of W){let t=await e.file.text();await fetch("/api/skills/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:e.file.name,content:t})})}K([]),H(!1),eo()},eu=async()=>{if(X)try{(await fetch(`/api/skills/${encodeURIComponent(X.name)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:Z})})).ok&&(P(e=>e.map(e=>e.name===X.name?{...e,content:Z}:e)),Y(null))}catch{}},ex=async e=>{try{(await fetch(`/api/skills/${encodeURIComponent(e.name)}`,{method:"DELETE"})).ok&&P(t=>t.filter(t=>t.name!==e.name))}catch{}},eh=async()=>{if(J){for(let e of $){let t=J.boundAgents.some(t=>t.id===e.id),s=V.includes(e.id);if(t&&!s){let t=await fetch(`/api/agents/presets/${e.id}`);if(!t.ok)continue;let s=await t.json(),a=(s.skills||[]).filter(e=>e.replace(/\.md$/i,"")!==J.name);console.log("[skills] remove skill",J.name,"from agent",e.name,"updatedSkills:",a),await fetch(`/api/agents/presets/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,skills:a})})}else if(!t&&s){let t=await fetch(`/api/agents/presets/${e.id}`);if(!t.ok)continue;let s=await t.json();if(!(s.skills||[]).map(e=>e.replace(/\.md$/i,"")).includes(J.name)){let t=[...s.skills||[],`${J.name}.md`];console.log("[skills] add skill",J.name,"to agent",e.name,"updatedSkills:",t),await fetch(`/api/agents/presets/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,skills:t})})}}}q(null),eo()}},ep=e=>{G(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},ef=async()=>{er(!0);try{let e=await fetch("/api/skills/sync-check");if(e.ok){let t=await e.json();et(t),ea(new Set(t.map(e=>`${e.agentId}::${e.skillName}`))),en(!0)}}catch{}er(!1)},eg=async()=>{let e=ee.filter(e=>es.has(`${e.agentId}::${e.skillName}`));if(0!==e.length)try{(await fetch("/api/skills/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:e.map(e=>({agentId:e.agentId,skillName:e.skillName}))})})).ok&&(en(!1),eo())}catch{}},ej=I.filter(e=>{if(B){let t=B.toLowerCase();if(!e.name.toLowerCase().includes(t)&&!e.content.toLowerCase().includes(t))return!1}return("favorites"!==L||!!e.favorited)&&("agent"!==L||!_||!!e.boundAgents.some(e=>e.id===_))}),ev=(T||e)&&!J&&!X,eN=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between pr-8",children:[(0,t.jsxs)("div",{className:"hidden md:block",children:[T?(0,t.jsx)("h2",{className:"text-base font-semibold",children:z("title")}):(0,t.jsx)(n.DialogTitle,{children:z("title")}),T?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:z("description")}):(0,t.jsx)(n.DialogDescription,{children:z("description")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 ml-auto shrink-0 pt-2",children:[(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",onClick:ef,disabled:el,children:[(0,t.jsx)(w.RefreshCw,{className:(0,C.cn)("size-3.5 mr-1",el&&"animate-spin")}),z("syncToAgents")]}),(0,t.jsxs)(d.Popover,{open:R,onOpenChange:H,children:[(0,t.jsx)(d.PopoverTrigger,{render:(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",children:[(0,t.jsx)(f.Upload,{className:"size-3.5 mr-1"}),z("import")]})}),(0,t.jsx)(d.PopoverContent,{className:"w-80",align:"end",children:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:z("importTitle")}),(0,t.jsx)(m.FileUpload,{value:W,onChange:K,accept:{"text/markdown":[".md"],"":[".md"]},placeholder:z("importPlaceholder"),maxFiles:10}),(0,t.jsx)(l.Button,{size:"sm",onClick:em,disabled:0===W.length,className:"w-full",children:z("importConfirm")})]})})]})]})]})}),(0,t.jsxs)("div",{className:"flex flex-1 min-h-0 gap-4 pt-2",children:[(0,t.jsxs)("div",{className:"hidden md:flex w-44 shrink-0 flex-col gap-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)(l.Button,{variant:"all"===L?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{U("all"),F("")},children:[(0,t.jsx)(j.FileText,{className:"size-3.5 mr-1.5"}),z("filterAll")]}),(0,t.jsxs)(l.Button,{variant:"favorites"===L?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{U("favorites"),F("")},children:[(0,t.jsx)(h.Star,{className:"size-3.5 mr-1.5"}),z("filterFavorites")]})]}),$.length>0&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground px-2",children:z("filterByAgent")}),(0,t.jsx)(o.ScrollArea,{className:"max-h-48",children:$.map(e=>(0,t.jsxs)(l.Button,{variant:"agent"===L&&_===e.id?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{U("agent"),F(e.id)},children:[(0,t.jsx)(x.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-4 mr-1.5 rounded-full"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]},e.id))})]})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex md:hidden flex-col gap-2",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(g.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(r.Input,{value:B,onChange:e=>O(e.target.value),placeholder:z("search"),className:"pl-8"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"flex rounded-lg border border-input p-0.5",children:[(0,t.jsx)("button",{type:"button",className:(0,C.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors","all"===L?"bg-muted":"text-muted-foreground hover:text-foreground"),onClick:()=>{U("all"),F("")},children:z("filterAll")}),(0,t.jsxs)("button",{type:"button",className:(0,C.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors","favorites"===L?"bg-muted":"text-muted-foreground hover:text-foreground"),onClick:()=>{U("favorites"),F("")},children:[(0,t.jsx)(h.Star,{className:"size-3 inline-block mr-0.5 -mt-px"}),z("filterFavorites")]})]}),$.length>0&&(0,t.jsx)(u.SearchSelect,{value:"agent"===L?_:"",onChange:e=>{e?(U("agent"),F(e)):(U("all"),F(""))},options:$.map(e=>({value:e.id,label:e.name})),placeholder:z("filterByAgent"),allowCustom:!1,className:"flex-1 min-w-0"})]})]}),(0,t.jsxs)("div",{className:"hidden md:block relative",children:[(0,t.jsx)(g.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(r.Input,{value:B,onChange:e=>O(e.target.value),placeholder:z("search"),className:"pl-8"})]}),(0,t.jsx)(o.ScrollArea,{className:"flex-1",children:A?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:D("loading")}):0===ej.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:z("empty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 gap-3 pr-2",children:ej.map(e=>(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-background p-4 hover:bg-accent/30 transition-colors cursor-pointer",onClick:()=>{Y(e),Q(e.content)},children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{className:"font-medium text-sm",children:e.name}),(0,t.jsx)("button",{type:"button",className:"flex items-center justify-center size-5 rounded hover:bg-accent",onClick:t=>{t.stopPropagation(),ed(e)},children:e.favorited?(0,t.jsx)(h.Star,{className:"size-3.5 text-yellow-500 fill-yellow-500"}):(0,t.jsx)(p.StarOff,{className:"size-3.5 text-muted-foreground"})})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:e.description||e.content.slice(0,120).replace(/^#\s+/,"")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",onClick:()=>{q(e),G(e.boundAgents.map(e=>e.id))},children:[(0,t.jsx)(b.Rocket,{className:"size-3.5 mr-1"}),z("apply")]}),(0,t.jsxs)(c.DropdownMenu,{children:[(0,t.jsx)(c.DropdownMenuTrigger,{render:(0,t.jsx)(l.Button,{variant:"ghost",size:"icon",className:"size-7"}),children:(0,t.jsx)(N.MoreVertical,{className:"size-3.5"})}),(0,t.jsx)(c.DropdownMenuContent,{align:"end",children:(0,t.jsxs)(c.DropdownMenuItem,{className:"text-destructive focus:text-destructive",onClick:()=>ex(e),children:[(0,t.jsx)(y.Trash2,{className:"size-3.5 mr-1.5"}),z("delete")]})})]})]})]}),e.boundAgents.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mt-2.5 pt-2.5 border-t border-border/50",children:[e.boundAgents.map(e=>(0,t.jsx)(x.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-5 rounded-full"},e.id)),(0,t.jsx)("span",{className:"text-xs text-muted-foreground ml-1",children:e.boundAgents.length})]})]},e.name))})})]})]})]});return(0,t.jsxs)(t.Fragment,{children:[T&&ev&&(0,t.jsx)("div",{className:"h-full flex flex-col",children:eN}),!T&&(0,t.jsx)(n.Dialog,{open:ev,onOpenChange:i,children:(0,t.jsx)(n.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:eN})}),(0,t.jsx)(n.Dialog,{open:!!X,onOpenChange:e=>{e||Y(null)},children:(0,t.jsxs)(n.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:[(0,t.jsx)(n.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between pr-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(n.DialogTitle,{children:z("editTitle",{name:X?.name||""})}),(0,t.jsx)(n.DialogDescription,{children:z("editDescription")})]}),(0,t.jsxs)(l.Button,{size:"sm",onClick:eu,children:[(0,t.jsx)(k.Save,{className:"size-3.5 mr-1"}),D("save")]})]})}),(0,t.jsx)("div",{className:"flex-1 min-h-0 pt-2",children:(0,t.jsx)(S,{height:"100%",language:"markdown",value:Z,onChange:e=>Q(e||""),theme:"vs-dark",options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},renderLineHighlight:"gutter",wordWrap:"on"}})})]})}),(0,t.jsx)(n.Dialog,{open:!!J,onOpenChange:e=>{e||q(null)},children:(0,t.jsxs)(n.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsxs)(n.DialogHeader,{children:[(0,t.jsx)(n.DialogTitle,{children:z("bindTitle",{name:J?.name||""})}),(0,t.jsx)(n.DialogDescription,{children:z("bindDescription")})]}),(0,t.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,t.jsx)("div",{className:"max-h-52 overflow-y-auto space-y-0.5",children:$.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>ep(e.id),className:(0,C.cn)("flex items-center gap-2 w-full px-2 py-1.5 rounded-md hover:bg-muted text-left text-sm transition-colors"),children:[(0,t.jsx)(x.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-5 rounded-full"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"block truncate",children:e.name}),e.description&&(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,t.jsx)("div",{className:(0,C.cn)("flex items-center justify-center size-4 rounded border shrink-0",V.includes(e.id)?"bg-primary border-primary text-primary-foreground":"border-input")})]},e.id))}),V.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:V.map(e=>{let s=$.find(t=>t.id===e);return(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md bg-muted px-2 py-0.5 text-xs",children:[(0,t.jsx)(x.AgentIcon,{agentId:e,name:s?.name,className:"size-3.5 rounded-full"}),s?.name||e,(0,t.jsx)("button",{type:"button",onClick:()=>ep(e),className:"hover:text-destructive",children:(0,t.jsx)(v.X,{className:"size-3"})})]},e)})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,t.jsx)(l.Button,{variant:"outline",onClick:()=>q(null),children:D("cancel")}),(0,t.jsx)(l.Button,{onClick:eh,children:D("confirm")})]})]})]})}),(0,t.jsx)(n.Dialog,{open:ei,onOpenChange:en,children:(0,t.jsxs)(n.DialogContent,{className:"sm:max-w-lg",children:[(0,t.jsxs)(n.DialogHeader,{children:[(0,t.jsx)(n.DialogTitle,{children:z("syncTitle")}),(0,t.jsx)(n.DialogDescription,{children:z("syncDescription")})]}),(0,t.jsxs)("div",{className:"space-y-3 pt-2",children:[0===ee.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-8 text-muted-foreground text-sm",children:z("syncEmpty")}):(0,t.jsx)(o.ScrollArea,{className:"max-h-72",children:(0,t.jsx)("div",{className:"space-y-1",children:ee.map(e=>{let s=`${e.agentId}::${e.skillName}`;return(0,t.jsxs)("button",{type:"button",onClick:()=>{var t,s;let a;return t=e.agentId,s=e.skillName,a=`${t}::${s}`,void ea(e=>{let t=new Set(e);return t.has(a)?t.delete(a):t.add(a),t})},className:"flex items-center gap-3 w-full px-2 py-1.5 rounded-md hover:bg-muted text-left text-sm transition-colors",children:[(0,t.jsx)("div",{className:(0,C.cn)("flex items-center justify-center size-4 rounded border shrink-0",es.has(s)?"bg-primary border-primary text-primary-foreground":"border-input")}),(0,t.jsx)(x.AgentIcon,{agentId:e.agentId,name:e.agentName,className:"size-5 rounded-full"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.agentName}),(0,t.jsxs)("span",{className:"text-muted-foreground text-xs shrink-0",children:[e.skillName,".md"]})]},s)})})}),ee.length>0&&(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,t.jsx)(l.Button,{variant:"outline",onClick:()=>en(!1),children:D("cancel")}),(0,t.jsx)(l.Button,{onClick:eg,disabled:0===es.size,children:z("syncConfirm")})]})]})]})})]})}])},678001,e=>{e.v(t=>Promise.all(["static/chunks/0vesz93a98px4.js"].map(t=>e.l(t))).then(()=>t(228394)))},863812,e=>{e.v(t=>Promise.all(["static/chunks/168ojsxhm7ypc.js"].map(t=>e.l(t))).then(()=>t(158480)))}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,362962,e=>{"use strict";var t=e.i(764556),n=e.i(969490);let r=t.forwardRef(function(e,t){let{className:r,render:o,orientation:i="horizontal",style:a,...s}=e;return(0,n.useRenderElement)("div",e,{state:{orientation:i},ref:t,props:[{role:"separator","aria-orientation":i},s]})});e.s(["Separator",0,r])},676185,922528,35359,324573,e=>{"use strict";e.s([],676185),e.i(8890);var t=e.i(764556),n=e.i(267805);let r=t.createContext(void 0);function o(e){let o=t.useContext(r);if(void 0===o&&!e)throw Error((0,n.default)(33));return o}e.s(["MenuPositionerContext",0,r,"useMenuPositionerContext",0,o],922528);let i=t.createContext(void 0);function a(e){let r=t.useContext(i);if(void 0===r&&!e)throw Error((0,n.default)(36));return r}e.s(["MenuRootContext",0,i,"useMenuRootContext",0,a],35359);var s=e.i(969490),u=e.i(817955);let l=t.forwardRef(function(e,t){let{className:n,render:r,style:i,...l}=e,{store:c}=a(),{arrowRef:d,side:p,align:f,arrowUncentered:m,arrowStyles:g}=o(),v=c.useState("open");return(0,s.useRenderElement)("div",e,{ref:[d,t],stateAttributesMapping:u.popupStateMapping,state:{open:v,side:p,align:f,uncentered:m},props:{style:g,"aria-hidden":!0,...l}})});e.s(["MenuArrow",0,l],324573)},174465,e=>{"use strict";var t=e.i(267805),n=e.i(764556);let r=n.createContext(void 0);e.s(["ContextMenuRootContext",0,r,"useContextMenuRootContext",0,function(e=!0){let o=n.useContext(r);if(void 0===o&&!e)throw Error((0,t.default)(25));return o}])},487455,287591,28051,597375,582883,277658,349204,81752,33427,293209,503662,59354,300637,281478,517510,9952,149292,65255,530909,87709,989479,743303,e=>{"use strict";e.i(8890);var t,n,r=e.i(764556),o=e.i(35359),i=e.i(969490),a=e.i(817955),s=e.i(282458),u=e.i(174465),l=e.i(742665);let c={...a.popupStateMapping,...s.transitionStatusMapping},d=r.forwardRef(function(e,t){let{className:n,render:r,style:a,...s}=e,{store:d}=(0,o.useMenuRootContext)(),p=d.useState("open"),f=d.useState("mounted"),m=d.useState("transitionStatus"),g=d.useState("lastOpenChangeReason"),v=(0,u.useContextMenuRootContext)();return(0,i.useRenderElement)("div",e,{ref:v?.backdropRef?[t,v.backdropRef]:t,state:{open:p,transitionStatus:m},stateAttributesMapping:c,props:[{role:"presentation",hidden:!f,style:{pointerEvents:g===l.REASONS.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},s]})});e.s(["MenuBackdrop",0,d],487455);var p=e.i(29905),f=e.i(535270),m=e.i(267805);let g=r.createContext(void 0);var v=e.i(204133),x=e.i(931709),h=e.i(370383),R=e.i(454889);function b(e){let{closeOnClick:t,highlighted:n,id:o,nodeId:i,store:a,typingRef:s,itemRef:c,itemMetadata:d}=e,{events:p}=a.useState("floatingTreeRoot"),f=(0,u.useContextMenuRootContext)(!0),m=void 0!==f;return r.useMemo(()=>({id:o,role:"menuitem",tabIndex:n?0:-1,onKeyDown(e){" "===e.key&&s?.current&&e.preventDefault()},onMouseMove(e){i&&p.emit("itemhover",{nodeId:i,target:e.currentTarget})},onClick(e){t&&p.emit("close",{domEvent:e,reason:l.REASONS.itemPress})},onMouseUp(e){if(f){let t=f.initialCursorPointRef.current;if(f.initialCursorPointRef.current=null,m&&t&&1>=Math.abs(e.clientX-t.x)&&1>=Math.abs(e.clientY-t.y)||m&&!R.isMac&&2===e.button)return}c.current&&a.context.allowMouseUpTriggerRef.current&&(!m||2===e.button)&&(!d||"regular-item"===d.type)&&c.current.click()}}),[t,n,o,p,i,a,s,c,f,m,d])}let S={type:"regular-item"};function C(e){let{closeOnClick:t,disabled:n=!1,highlighted:o,id:i,store:a,typingRef:s=a.context.typingRef,nativeButton:u,itemMetadata:l,nodeId:c}=e,d=r.useRef(null),{getButtonProps:p,buttonRef:f}=(0,x.useButton)({disabled:n,focusableWhenDisabled:!0,native:u,composite:!0}),m=b({closeOnClick:t,highlighted:o,id:i,nodeId:c,store:a,typingRef:s,itemRef:d,itemMetadata:l}),g=r.useCallback(e=>(0,h.mergeProps)(m,{onMouseEnter(){"submenu-trigger"===l.type&&l.setActive()}},e,p),[m,p,l]),R=(0,v.useMergedRefs)(d,f);return r.useMemo(()=>({getItemProps:g,itemRef:R}),[g,R])}e.s(["REGULAR_ITEM",0,S,"useMenuItem",0,C],287591);var M=e.i(296615),y=e.i(139236);let E=((t={}).checked="data-checked",t.unchecked="data-unchecked",t.disabled="data-disabled",t.highlighted="data-highlighted",t),I={checked:e=>e?{[E.checked]:""}:{[E.unchecked]:""},...s.transitionStatusMapping};var w=e.i(922528),k=e.i(602453),O=e.i(344180);let T=r.forwardRef(function(e,t){let{render:n,className:a,id:s,label:u,nativeButton:c=!1,disabled:d=!1,closeOnClick:m=!1,checked:v,defaultChecked:x,onCheckedChange:h,style:R,...b}=e,E=(0,M.useCompositeListItem)({label:u}),T=(0,w.useMenuPositionerContext)(!0),P=(0,y.useBaseUiId)(s),{store:A}=(0,o.useMenuRootContext)(),N=A.useState("isActive",E.index),L=A.useState("itemProps"),[D,F]=(0,f.useControlled)({controlled:v,default:x??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:j,itemRef:_}=C({closeOnClick:m,disabled:d,highlighted:N,id:P,store:A,nativeButton:c,nodeId:T?.context.nodeId,itemMetadata:S}),U=r.useMemo(()=>({disabled:d,highlighted:N,checked:D}),[d,N,D]),H=(0,p.useStableCallback)(e=>{let t={...(0,k.createChangeEventDetails)(l.REASONS.itemPress,e.nativeEvent),preventUnmountOnClose:()=>{}};h?.(!D,t),t.isCanceled||F(e=>!e)}),B=(0,i.useRenderElement)("div",e,{state:U,stateAttributesMapping:I,props:[L,{role:"menuitemcheckbox","aria-checked":D,onClick:H},b,j],ref:[_,t,E.ref]});return(0,O.jsx)(g.Provider,{value:U,children:B})});e.s(["MenuCheckboxItem",0,T],28051);var P=e.i(254891),A=e.i(273598);let N=r.forwardRef(function(e,t){let{render:n,className:o,style:a,keepMounted:s=!1,...u}=e,l=function(){let e=r.useContext(g);if(void 0===e)throw Error((0,m.default)(30));return e}(),c=r.useRef(null),{transitionStatus:d,setMounted:p}=(0,P.useTransitionStatus)(l.checked);(0,A.useOpenChangeComplete)({open:l.checked,ref:c,onComplete(){l.checked||p(!1)}});let f={checked:l.checked,disabled:l.disabled,highlighted:l.highlighted,transitionStatus:d};return(0,i.useRenderElement)("span",e,{state:f,ref:[t,c],stateAttributesMapping:I,props:{"aria-hidden":!0,...u},enabled:s||l.checked})});e.s(["MenuCheckboxItemIndicator",0,N],597375);let L=r.createContext(void 0),D=r.forwardRef(function(e,t){let{render:n,className:o,style:a,...s}=e,[u,l]=r.useState(void 0),c=r.useMemo(()=>({setLabelId:l}),[l]),d=(0,i.useRenderElement)("div",e,{ref:t,props:{role:"group","aria-labelledby":u,...s}});return(0,O.jsx)(L.Provider,{value:c,children:d})});e.s(["MenuGroup",0,D],582883);var F=e.i(277642);let j=r.forwardRef(function(e,t){let{className:n,render:o,id:a,style:s,...u}=e,l=(0,y.useBaseUiId)(a),{setLabelId:c}=function(){let e=r.useContext(L);if(void 0===e)throw Error((0,m.default)(31));return e}();return(0,F.useIsoLayoutEffect)(()=>(c(l),()=>{c(void 0)}),[c,l]),(0,i.useRenderElement)("div",e,{ref:t,props:{id:l,role:"presentation",...u}})});e.s(["MenuGroupLabel",0,j],277658);let _=r.forwardRef(function(e,t){let{render:n,className:r,id:a,label:s,nativeButton:u=!1,disabled:l=!1,closeOnClick:c=!0,style:d,...p}=e,f=(0,M.useCompositeListItem)({label:s}),m=(0,w.useMenuPositionerContext)(!0),g=(0,y.useBaseUiId)(a),{store:v}=(0,o.useMenuRootContext)(),x=v.useState("isActive",f.index),h=v.useState("itemProps"),{getItemProps:R,itemRef:b}=C({closeOnClick:c,disabled:l,highlighted:x,id:g,store:v,nativeButton:u,nodeId:m?.context.nodeId,itemMetadata:S});return(0,i.useRenderElement)("div",e,{state:{disabled:l,highlighted:x},props:[h,p,R],ref:[b,t,f.ref]})});e.s(["MenuItem",0,_],349204);let U=r.forwardRef(function(e,t){let{render:n,className:a,id:s,label:u,closeOnClick:l=!1,style:c,...d}=e,p=r.useRef(null),f=(0,M.useCompositeListItem)({label:u}),m=(0,w.useMenuPositionerContext)(!0),g=m?.context.nodeId,v=(0,y.useBaseUiId)(s),{store:R}=(0,o.useMenuRootContext)(),S=R.useState("isActive",f.index),C=R.useState("itemProps"),E=R.context.typingRef,{getButtonProps:I,buttonRef:k}=(0,x.useButton)({native:!1,composite:!0}),O=b({closeOnClick:l,highlighted:S,id:v,nodeId:g,store:R,typingRef:E,itemRef:p}),T=r.useMemo(()=>({highlighted:S}),[S]);return(0,i.useRenderElement)("a",e,{state:T,props:[C,d,function(e){return(0,h.mergeProps)(O,e,I)}],ref:[p,k,t,f.ref]})});e.s(["MenuLinkItem",0,U],81752);var H=e.i(583289),B=e.i(795914),G=e.i(971109),W=e.i(100229),V=e.i(328657);let z={...a.popupStateMapping,...s.transitionStatusMapping},K=r.forwardRef(function(e,t){let{render:n,className:a,style:s,finalFocus:u,...c}=e,{store:d}=(0,o.useMenuRootContext)(),{side:p,align:f}=(0,w.useMenuPositionerContext)(),m=null!=(0,G.useToolbarRootContext)(!0),g=d.useState("open"),v=d.useState("transitionStatus"),x=d.useState("popupProps"),h=d.useState("mounted"),R=d.useState("instantType"),b=d.useState("activeTriggerElement"),S=d.useState("parent"),C=d.useState("lastOpenChangeReason"),M=d.useState("rootId"),y=d.useState("floatingRootContext"),E=d.useState("floatingTreeRoot"),I=d.useState("closeDelay"),T=d.useState("activeTriggerElement"),P="context-menu"===S.type;(0,A.useOpenChangeComplete)({open:g,ref:d.context.popupRef,onComplete(){g&&d.context.onOpenChangeComplete?.(!0)}}),r.useEffect(()=>{function e(e){d.setOpen(!1,(0,k.createChangeEventDetails)(e.reason,e.domEvent))}return E.events.on("close",e),()=>{E.events.off("close",e)}},[E.events,d]);let N=d.useState("hoverEnabled"),L=d.useState("disabled");(0,B.useHoverFloatingInteraction)(y,{enabled:N&&!L&&!P&&"menubar"!==S.type,closeDelay:I});let D={transitionStatus:v,side:p,align:f,open:g,nested:"menu"===S.type,instant:R},F=r.useCallback(e=>{d.set("popupElement",e)},[d]),j=(0,i.useRenderElement)("div",e,{state:D,ref:[t,d.context.popupRef,F],stateAttributesMapping:z,props:[x,{onKeyDown(e){m&&W.COMPOSITE_KEYS.has(e.key)&&e.stopPropagation()}},(0,V.getDisabledMountTransitionStyles)(v),c,{"data-rootownerid":M}]}),_=void 0===S.type||P;return(b||"menubar"===S.type&&C!==l.REASONS.outsidePress)&&(_=!0),(0,O.jsx)(H.FloatingFocusManager,{context:y,modal:P,disabled:!h,returnFocus:void 0===u?_:u,initialFocus:"menu"!==S.type,restoreFocus:!0,externalTree:"menubar"!==S.type?E:void 0,previousFocusableElement:T,nextFocusableElement:void 0===S.type?d.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:void 0===S.type?d.context.beforeContentFocusGuardRef:void 0,children:j})});e.s(["MenuPopup",0,K],33427);var Y=e.i(128108);let q=r.createContext(void 0),$=r.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=(0,o.useMenuRootContext)();return i.useState("mounted")||n?(0,O.jsx)(q.Provider,{value:n,children:(0,O.jsx)(Y.FloatingPortal,{ref:t,...r})}):null});e.s(["MenuPortal",0,$],293209);var J=e.i(677822),X=e.i(232449),Q=e.i(389124),Z=e.i(576557),ee=e.i(756432),et=e.i(251817),en=e.i(576487),er=e.i(909852),eo=e.i(427708),ei=e.i(263635),ea=e.i(900587);let es=r.forwardRef(function(e,t){let{anchor:n,positionMethod:i="absolute",className:a,render:s,side:c,align:d,sideOffset:p=0,alignOffset:f=0,collisionBoundary:g="clipping-ancestors",collisionPadding:v=5,arrowPadding:x=5,sticky:h=!1,disableAnchorTracking:R=!1,collisionAvoidance:b=en.DROPDOWN_COLLISION_AVOIDANCE,style:S,...C}=e,{store:M}=(0,o.useMenuRootContext)(),y=function(){let e=r.useContext(q);if(void 0===e)throw Error((0,m.default)(32));return e}(),E=(0,u.useContextMenuRootContext)(!0),I=M.useState("parent"),T=M.useState("floatingRootContext"),P=M.useState("floatingTreeRoot"),A=M.useState("mounted"),N=M.useState("open"),L=M.useState("modal"),D=M.useState("openMethod"),j=M.useState("activeTriggerElement"),_=M.useState("transitionStatus"),U=M.useState("positionerElement"),H=M.useState("instantType"),B=M.useState("hasViewport"),G=M.useState("lastOpenChangeReason"),W=M.useState("floatingNodeId"),V=M.useState("floatingParentNodeId"),z=T.useState("domReferenceElement"),K=r.useRef(null),Y=(0,eo.useAnimationsFinished)(U,!1,!1),$=n,es=p,eu=f,el=d,ec=b;"context-menu"===I.type&&($=n??I.context?.anchor,el=el??"start",c||"center"===el||(eu=e.alignOffset??2,es=e.sideOffset??-5));let ed=c,ep=el;"menu"===I.type?(ed=ed??"inline-end",ep=ep??"start",ec=e.collisionAvoidance??en.POPUP_COLLISION_AVOIDANCE):"menubar"===I.type&&(ed=ed??"bottom",ep=ep??"start");let ef="context-menu"===I.type,em=(0,Z.useAnchorPositioning)({anchor:$,floatingRootContext:T,positionMethod:E?"fixed":i,mounted:A,side:ed,sideOffset:es,align:ep,alignOffset:eu,arrowPadding:ef?0:x,collisionBoundary:g,collisionPadding:v,sticky:h,nodeId:W,keepMounted:y,disableAnchorTracking:R,collisionAvoidance:ec,shiftCrossAxis:ef&&!("side"in ec&&"flip"===ec.side),externalTree:P,adaptiveOrigin:B?er.adaptiveOrigin:void 0});r.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===W&&M.set("hoverEnabled",!1),e.nodeId!==W&&e.parentNodeId===M.select("floatingParentNodeId")&&M.setOpen(!1,(0,k.createChangeEventDetails)(l.REASONS.siblingOpen)))}return P.events.on("menuopenchange",e),()=>{P.events.off("menuopenchange",e)}},[M,P.events,W]),r.useEffect(()=>{if(null!=M.select("floatingParentNodeId"))return P.events.on("menuopenchange",e),()=>{P.events.off("menuopenchange",e)};function e(e){if(e.open||e.nodeId!==M.select("floatingParentNodeId"))return;let t=e.reason??l.REASONS.siblingOpen;M.setOpen(!1,(0,k.createChangeEventDetails)(t))}},[P.events,M]);let eg=(0,X.useTimeout)();r.useEffect(()=>{N||eg.clear()},[N,eg]),r.useEffect(()=>{function e(e){if(N&&e.nodeId===M.select("floatingParentNodeId"))if(e.target&&j&&j!==e.target){let e=M.select("closeDelay");e>0?eg.isStarted()||eg.start(e,()=>{M.setOpen(!1,(0,k.createChangeEventDetails)(l.REASONS.siblingOpen))}):M.setOpen(!1,(0,k.createChangeEventDetails)(l.REASONS.siblingOpen))}else eg.clear()}return P.events.on("itemhover",e),()=>{P.events.off("itemhover",e)}},[P.events,N,j,M,eg]),r.useEffect(()=>{let e={open:N,nodeId:W,parentNodeId:V,reason:M.select("lastOpenChangeReason")};P.events.emit("menuopenchange",e)},[P.events,N,M,W,V]),(0,F.useIsoLayoutEffect)(()=>{let e=K.current;if(z&&(K.current=z),e&&z&&z!==e){M.set("instantType",void 0);let e=new AbortController;return Y(()=>{M.set("instantType","trigger-change")},e.signal),()=>{e.abort()}}},[z,Y,M]);let ev={open:N,side:em.side,align:em.align,anchorHidden:em.anchorHidden,nested:"menu"===I.type,instant:H},ex="menubar"===I.type&&I.context.modal,eh=L&&G!==l.REASONS.triggerHover;(0,ea.useAnchoredPopupScrollLock)(N&&(ex||eh),"touch"===D,U,j);let eR=(0,ei.usePositioner)(e,ev,{styles:em.positionerStyles,transitionStatus:_,props:C,refs:[t,M.useStateSetter("positionerElement")],hidden:!A,inert:!N}),eb=A&&"menu"!==I.type&&("menubar"!==I.type&&L&&G!==l.REASONS.triggerHover||"menubar"===I.type&&I.context.modal),eS=null;return"menubar"===I.type?eS=I.context.contentElement:void 0===I.type&&(eS=j),(0,O.jsxs)(w.MenuPositionerContext.Provider,{value:em,children:[eb&&(0,O.jsx)(et.InternalBackdrop,{ref:"context-menu"===I.type||"nested-context-menu"===I.type?I.context.internalBackdropRef:null,inert:(0,J.inertValue)(!N),cutout:eS}),(0,O.jsx)(Q.FloatingNode,{id:W,children:(0,O.jsx)(ee.CompositeList,{elementsRef:M.context.itemDomElements,labelsRef:M.context.itemLabels,children:eR})})]})});e.s(["MenuPositioner",0,es],503662);let eu=r.createContext(void 0),el=r.memo(r.forwardRef(function(e,t){let{render:n,className:o,value:a,defaultValue:s,onValueChange:u,disabled:l=!1,style:c,...d}=e,[m,g]=(0,f.useControlled)({controlled:a,default:s,name:"MenuRadioGroup"}),v=(0,p.useStableCallback)(u),x=(0,p.useStableCallback)((e,t)=>{v?.(e,t),t.isCanceled||g(e)}),h=(0,i.useRenderElement)("div",e,{state:{disabled:l},ref:t,props:{role:"group","aria-disabled":l||void 0,...d}}),R=r.useMemo(()=>({value:m,setValue:x,disabled:l}),[m,x,l]);return(0,O.jsx)(eu.Provider,{value:R,children:h})}));e.s(["MenuRadioGroup",0,el],59354);let ec=r.createContext(void 0),ed=r.forwardRef(function(e,t){let{render:n,className:a,id:s,label:u,nativeButton:c=!1,disabled:d=!1,closeOnClick:f=!1,value:g,style:v,...x}=e,h=(0,M.useCompositeListItem)({label:u}),R=(0,w.useMenuPositionerContext)(!0),b=(0,y.useBaseUiId)(s),{store:E}=(0,o.useMenuRootContext)(),T=E.useState("isActive",h.index),P=E.useState("itemProps"),{value:A,setValue:N,disabled:L}=function(){let e=r.useContext(eu);if(void 0===e)throw Error((0,m.default)(34));return e}(),D=L||d,F=A===g,{getItemProps:j,itemRef:_}=C({closeOnClick:f,disabled:D,highlighted:T,id:b,store:E,nativeButton:c,nodeId:R?.context.nodeId,itemMetadata:S}),U=r.useMemo(()=>({disabled:D,highlighted:T,checked:F}),[D,T,F]),H=(0,p.useStableCallback)(e=>{N(g,{...(0,k.createChangeEventDetails)(l.REASONS.itemPress,e.nativeEvent),preventUnmountOnClose:()=>{}})}),B=(0,i.useRenderElement)("div",e,{state:U,stateAttributesMapping:I,props:[P,{role:"menuitemradio","aria-checked":F,onClick:H},x,j],ref:[_,t,h.ref]});return(0,O.jsx)(ec.Provider,{value:U,children:B})});e.s(["MenuRadioItem",0,ed],300637);let ep=r.forwardRef(function(e,t){let{render:n,className:o,style:a,keepMounted:s=!1,...u}=e,l=function(){let e=r.useContext(ec);if(void 0===e)throw Error((0,m.default)(35));return e}(),c=r.useRef(null),{transitionStatus:d,setMounted:p}=(0,P.useTransitionStatus)(l.checked);(0,A.useOpenChangeComplete)({open:l.checked,ref:c,onComplete(){l.checked||p(!1)}});let f={checked:l.checked,disabled:l.disabled,highlighted:l.highlighted,transitionStatus:d};return(0,i.useRenderElement)("span",e,{state:f,stateAttributesMapping:I,ref:[t,c],props:{"aria-hidden":!0,...u},enabled:s||l.checked})});e.s(["MenuRadioItemIndicator",0,ep],281478);var ef=e.i(394822),em=e.i(166392),eg=e.i(863728),ev=e.i(155461),ex=e.i(538501),eh=e.i(427396),eR=e.i(92615),eb=e.i(106045),eS=e.i(526850),eC=e.i(410421),eM=e.i(922970),ey=e.i(150129),eE=e.i(877580),eI=e.i(913652),ew=e.i(118214);function ek(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function eO(e,t){return ek(t,e===ew.ARROW_UP||e===ew.ARROW_DOWN,e===ew.ARROW_LEFT||e===ew.ARROW_RIGHT)}function eT(e,t,n){return ek(t,e===ew.ARROW_DOWN,n?e===ew.ARROW_LEFT:e===ew.ARROW_RIGHT)||"Enter"===e||" "===e||""===e}var eP=e.i(974578),eA=e.i(107164);let eN=r.createContext(null);function eL(e){let t=r.useContext(eN);if(null===t&&!e)throw Error((0,m.default)(5));return t}var eD=e.i(189131),eF=e.i(564846),ej=e.i(332976),e_=e.i(493696),eU=e.i(549154),eH=e.i(478333),eB=e.i(695011),eG=e.i(561213);let eW={...eB.popupStoreSelectors,disabled:(0,ej.createSelector)(e=>"menubar"===e.parent.type&&e.parent.context.disabled||e.disabled),modal:(0,ej.createSelector)(e=>(void 0===e.parent.type||"context-menu"===e.parent.type)&&(e.modal??!0)),openMethod:(0,ej.createSelector)(e=>e.openMethod),allowMouseEnter:(0,ej.createSelector)(e=>e.allowMouseEnter),stickIfOpen:(0,ej.createSelector)(e=>e.stickIfOpen),parent:(0,ej.createSelector)(e=>e.parent),rootId:(0,ej.createSelector)(e=>"menu"===e.parent.type?e.parent.store.select("rootId"):void 0!==e.parent.type?e.parent.context.rootId:e.rootId),activeIndex:(0,ej.createSelector)(e=>e.activeIndex),isActive:(0,ej.createSelector)((e,t)=>e.activeIndex===t),hoverEnabled:(0,ej.createSelector)(e=>e.hoverEnabled),instantType:(0,ej.createSelector)(e=>e.instantType),lastOpenChangeReason:(0,ej.createSelector)(e=>e.openChangeReason),floatingTreeRoot:(0,ej.createSelector)(e=>"menu"===e.parent.type?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:(0,ej.createSelector)(e=>e.floatingNodeId),floatingParentNodeId:(0,ej.createSelector)(e=>e.floatingParentNodeId),itemProps:(0,ej.createSelector)(e=>e.itemProps),closeDelay:(0,ej.createSelector)(e=>e.closeDelay),hasViewport:(0,ej.createSelector)(e=>e.hasViewport),keyboardEventRelay:(0,ej.createSelector)(e=>e.keyboardEventRelay?e.keyboardEventRelay:"menu"===e.parent.type?e.parent.store.select("keyboardEventRelay"):void 0)};class eV extends e_.ReactStore{constructor(e){super({...{...(0,eB.createInitialPopupStoreState)(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new eH.FloatingTreeStore,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:eg.EMPTY_OBJECT,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1},...e},{positionerRef:r.createRef(),popupRef:r.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:r.createRef(),beforeContentFocusGuardRef:r.createRef(),onOpenChangeComplete:void 0,triggerElements:new eG.PopupTriggerMap},eW),this.unsubscribeParentListener=this.observe("parent",e=>{if(this.unsubscribeParentListener?.(),"menu"===e.type){let t=e.store.select("rootId"),n=e.store.select("floatingTreeRoot"),r=e.store.select("keyboardEventRelay");this.unsubscribeParentListener=e.store.subscribe(()=>{let o=e.store.select("rootId"),i=e.store.select("floatingTreeRoot"),a=e.store.select("keyboardEventRelay");(t!==o||n!==i||r!==a)&&(t=o,n=i,r=a,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}void 0!==e.type&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit("setOpen",{open:e,eventDetails:t})}static useStore(e,t){let n=(0,eU.useRefWithInit)(()=>new eV(t)).current;return e??n}unsubscribeParentListener=null}e.s(["MenuStore",0,eV],517510);var ez=e.i(279501);let eK=r.createContext(void 0);function eY(){return r.useContext(eK)}e.s(["MenuSubmenuRootContext",0,eK,"useMenuSubmenuRootContext",0,eY],9952);let eq=(0,ev.fastComponent)(function(e){let t,{children:n,open:i,onOpenChange:a,onOpenChangeComplete:s,defaultOpen:c=!1,disabled:d=!1,modal:f,loopFocus:m=!0,orientation:g="vertical",actionsRef:v,closeParentOnEsc:x=!1,handle:R,triggerId:b,defaultTriggerId:S=null,highlightItemOnHover:C=!0}=e,M=(0,u.useContextMenuRootContext)(!0),y=(0,o.useMenuRootContext)(!0),E=eL(!0),I=eY(),w=r.useMemo(()=>I&&y?{type:"menu",store:y.store}:E?{type:"menubar",context:E}:M&&!y?{type:"context-menu",context:M}:{type:void 0},[M,y,E,I]),T=eV.useStore(R?.store,{open:c,openProp:i,activeTriggerId:S,triggerIdProp:b,parent:w});(0,em.useOnFirstRender)(()=>{void 0===i&&!1===T.state.open&&!0===c&&T.update({open:!0,activeTriggerId:S})}),T.useControlledProp("openProp",i),T.useControlledProp("triggerIdProp",b),T.useContextCallback("onOpenChangeComplete",s);let P=T.useState("floatingTreeRoot"),A=(0,Q.useFloatingNodeId)(P),N=(0,Q.useFloatingParentNodeId)();(0,F.useIsoLayoutEffect)(()=>{M&&!y?T.update({parent:{type:"context-menu",context:M},floatingNodeId:A,floatingParentNodeId:N}):y&&T.update({floatingNodeId:A,floatingParentNodeId:N})},[M,y,A,N,T]);let L=T.useState("open"),D=T.useState("activeTriggerElement"),j=T.useState("positionerElement"),_=T.useState("hoverEnabled"),U=T.useState("disabled"),H=T.useState("lastOpenChangeReason"),B=T.useState("parent"),G=T.useState("activeIndex"),W=T.useState("payload"),V=T.useState("floatingParentNodeId"),z=r.useRef(null),K=null!=V,{openMethod:Y,triggerProps:q}=(0,eF.useOpenInteractionType)(L);T.useSyncedValues({disabled:d,modal:void 0===B.type?f:void 0,openMethod:Y,rootId:(0,ef.useId)()}),(0,ez.useImplicitActiveTrigger)(T);let{forceUnmount:$}=(0,ez.useOpenStateTransitions)(L,T,()=>{T.update({allowMouseEnter:!1,stickIfOpen:!0})}),J=r.useRef("context-menu"!==B.type),Z=(0,X.useTimeout)();r.useEffect(()=>{if(L||(z.current=null),"context-menu"===B.type){if(!L){Z.clear(),J.current=!1;return}Z.start(500,()=>{J.current=!0})}},[Z,L,B.type]),(0,F.useIsoLayoutEffect)(()=>{L||_||T.set("hoverEnabled",!0)},[L,_,T]);let ee=r.useRef(!0),et=(0,X.useTimeout)(),er=(0,p.useStableCallback)((e,t)=>{let n=t.reason;if(L===e&&t.trigger===D&&H===n||(t.preventUnmountOnClose=()=>{T.set("preventUnmountingOnClose",!0)},e||null!=t.trigger||(t.trigger=D??void 0),a?.(e,t),t.isCanceled))return;T.state.floatingRootContext.dispatchOpenChange(e,t);let r=t.event;if(!1===e&&r?.type==="click"&&"touch"===r.pointerType&&!ee.current)return;if(!e&&null!==G){let e=T.context.itemDomElements.current[G];queueMicrotask(()=>{e?.setAttribute("tabindex","-1")})}e&&n===l.REASONS.triggerFocus?(ee.current=!1,et.start(300,()=>{ee.current=!0})):(ee.current=!0,et.clear());let o=(n===l.REASONS.triggerPress||n===l.REASONS.itemPress)&&0===r.detail&&r?.isTrusted,i=!e&&(n===l.REASONS.escapeKey||null==n),s={open:e,openChangeReason:n};z.current=t.event??null;let u=t.trigger?.id??null;(u||e)&&(s.activeTriggerId=u,s.activeTriggerElement=t.trigger??null),T.update(s),"menubar"===B.type&&(n===l.REASONS.triggerFocus||n===l.REASONS.focusOut||n===l.REASONS.triggerHover||n===l.REASONS.listNavigation||n===l.REASONS.siblingOpen)?T.set("instantType","group"):o||i?T.set("instantType",o?"click":"dismiss"):T.set("instantType",void 0)}),eo=r.useCallback(()=>{T.setOpen(!1,(0,k.createChangeEventDetails)(l.REASONS.imperativeAction))},[T]);r.useImperativeHandle(v,()=>({unmount:$,close:eo}),[$,eo]),"context-menu"===B.type&&(t=B.context),r.useImperativeHandle(t?.positionerRef,()=>j,[j]),r.useImperativeHandle(t?.actionsRef,()=>({setOpen:er}),[er]);let ei=(0,eA.useSyncedFloatingRootContext)({popupStore:T,onOpenChange:er}),ea=ei.context.events;r.useEffect(()=>{let e=({open:e,eventDetails:t})=>er(e,t);return ea.on("setOpen",e),()=>{ea?.off("setOpen",e)}},[ea,er]);let es=(0,ex.useDismiss)(ei,{enabled:!U,bubbles:{escapeKey:x&&"menu"===B.type},outsidePress:()=>"context-menu"!==B.type||z.current?.type==="contextmenu"||J.current,externalTree:K?P:void 0}),eu=(0,eP.useRole)(ei,{role:"menu"}),el=(0,eD.useDirection)(),ec=r.useCallback(e=>{T.select("activeIndex")!==e&&T.set("activeIndex",e)},[T]),ed=function(e,t){let n="rootStore"in e?e.rootStore:e,o=n.useState("open"),i=n.useState("floatingElement"),a=n.useState("domReferenceElement"),s=n.context.dataRef,{listRef:u,activeIndex:c,onNavigate:d=()=>{},enabled:f=!0,selectedIndex:m=null,allowEscape:g=!1,loopFocus:v=!1,nested:x=!1,rtl:h=!1,virtual:R=!1,focusItemOnOpen:b="auto",focusItemOnHover:S=!0,openOnArrowKeyDown:C=!0,disabledIndices:M,orientation:y="vertical",parentOrientation:E,cols:I=1,id:w,resetOnPointerLeave:O=!0,externalTree:T}=t,P=(0,eM.getFloatingFocusElement)(i),A=(0,eb.useValueAsRef)(P),N=(0,Q.useFloatingParentNodeId)(),L=(0,Q.useFloatingTree)(T);(0,F.useIsoLayoutEffect)(()=>{s.current.orientation=y},[s,y]);let D=(0,eM.isTypeableCombobox)(a),j=r.useRef(b),_=r.useRef(m??-1),U=r.useRef(null),H=r.useRef(!0),B=(0,p.useStableCallback)(e=>{d(-1===_.current?null:_.current,e)}),G=r.useRef(B),W=r.useRef(!!i),V=r.useRef(o),z=r.useRef(!1),K=r.useRef(!1),Y=r.useRef(null),q=(0,eb.useValueAsRef)(M),$=(0,eb.useValueAsRef)(o),J=(0,eb.useValueAsRef)(m),X=(0,eb.useValueAsRef)(O),Z=(0,p.useStableCallback)(()=>{function e(e){R?L?.events.emit("virtualfocus",e):Y.current=(0,eI.enqueueFocus)(e,{sync:z.current,preventScroll:!0})}let t=u.current[_.current],n=K.current;t&&e(t),(z.current?e=>e():requestAnimationFrame)(()=>{let r=u.current[_.current]||t;!r||(t||e(r),en&&(n||!H.current)&&r.scrollIntoView?.({block:"nearest",inline:"nearest"}))})});(0,F.useIsoLayoutEffect)(()=>{f&&(o&&i?(_.current=m??-1,j.current&&null!=m&&(K.current=!0,B())):W.current&&(_.current=-1,G.current()))},[f,o,i,m,B]),(0,F.useIsoLayoutEffect)(()=>{if(f){if(!o){z.current=!1;return}if(i)if(null==c){if(z.current=!1,null!=J.current)return;if(W.current&&(_.current=-1,Z()),(!V.current||!W.current)&&j.current&&(null!=U.current||!0===j.current&&null==U.current)){let e=0,t=()=>{null==u.current[0]?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(_.current=null==U.current||eT(U.current,y,h)||x?(0,eE.getMinListIndex)(u):(0,eE.getMaxListIndex)(u),U.current=null,B())};t()}}else(0,eE.isIndexOutOfListBounds)(u.current,c)||(_.current=c,Z(),K.current=!1)}},[f,o,i,c,J,x,u,y,h,B,Z,q]),(0,F.useIsoLayoutEffect)(()=>{if(!f||i||!L||R||!W.current)return;let e=L.nodesRef.current,t=e.find(e=>e.id===N)?.context?.elements.floating,n=(0,eC.activeElement)((0,eS.ownerDocument)(i)),r=e.some(e=>e.context&&(0,eC.contains)(e.context.elements.floating,n));t&&!r&&H.current&&t.focus({preventScroll:!0})},[f,i,L,N,R]),(0,F.useIsoLayoutEffect)(()=>{G.current=B,V.current=o,W.current=!!i}),(0,F.useIsoLayoutEffect)(()=>{o||(U.current=null,j.current=b)},[o,b]);let ee=null!=c,et=(0,p.useStableCallback)(e=>{if(!$.current)return;let t=u.current.indexOf(e.currentTarget);-1!==t&&(_.current!==t||c!==t)&&(_.current=t,B(e))}),en=r.useMemo(()=>({onFocus(e){z.current=!0,et(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){z.current=!0,K.current=!1,S&&et(e)},onPointerLeave(e){if(!$.current||!H.current||"touch"===e.pointerType)return;z.current=!0;let t=e.relatedTarget;if(!(!S||u.current.includes(t))&&X.current&&(Y.current?.(),Y.current=null,_.current=-1,B(e),!R)){let e=A.current,t=(0,eC.activeElement)((0,eS.ownerDocument)(e));e&&(0,eC.contains)(e,t)&&e.focus({preventScroll:!0})}}}),[et,$,A,S,u,B,X,R]),er=r.useCallback(()=>E??L?.nodesRef.current.find(e=>e.id===N)?.context?.dataRef?.current.orientation,[N,L,E]),eo=(0,p.useStableCallback)(e=>{var t;let r,i;if(H.current=!1,z.current=!0,229===e.which||!$.current&&e.currentTarget===A.current)return;if(x&&(t=e.key,r=h?t===ew.ARROW_RIGHT:t===ew.ARROW_LEFT,i=t===ew.ARROW_UP,"both"===y||"horizontal"===y&&I&&I>1?"Escape"===t:ek(y,r,i))){eO(e.key,er())||(0,ey.stopEvent)(e),n.setOpen(!1,(0,k.createChangeEventDetails)(l.REASONS.listNavigation,e.nativeEvent)),(0,eR.isHTMLElement)(a)&&(R?L?.events.emit("virtualfocus",a):a.focus());return}let s=_.current,c=(0,eE.getMinListIndex)(u,M),d=(0,eE.getMaxListIndex)(u,M);if(D||("Home"===e.key&&((0,ey.stopEvent)(e),_.current=c,B(e)),"End"===e.key&&((0,ey.stopEvent)(e),_.current=d,B(e))),I>1){let t=Array.from({length:u.current.length},()=>({width:1,height:1})),n=(0,eE.createGridCellMap)(t,I,!1),r=n.findIndex(e=>null!=e&&!(0,eE.isListIndexDisabled)(u.current,e,M)),o=n.reduce((e,t,n)=>null==t||(0,eE.isListIndexDisabled)(u.current,t,M)?e:n,-1),i=n[(0,eE.getGridNavigatedIndex)(n.map(e=>null!=e?u.current[e]:null),{event:e,orientation:y,loopFocus:v,rtl:h,cols:I,disabledIndices:(0,eE.getGridCellIndices)([...("function"!=typeof M?M:null)||u.current.map((e,t)=>(0,eE.isListIndexDisabled)(u.current,t,M)?t:void 0),void 0],n),minIndex:r,maxIndex:o,prevIndex:(0,eE.getGridCellIndexOfCorner)(_.current>d?c:_.current,t,n,I,e.key===ew.ARROW_DOWN?"bl":e.key===(h?ew.ARROW_LEFT:ew.ARROW_RIGHT)?"tr":"tl"),stopEvent:!0})];if(null!=i&&(_.current=i,B(e)),"both"===y)return}if(eO(e.key,y)){if((0,ey.stopEvent)(e),o&&!R&&(0,eC.activeElement)(e.currentTarget.ownerDocument)===e.currentTarget){_.current=eT(e.key,y,h)?c:d,B(e);return}eT(e.key,y,h)?v?s>=d?g&&s!==u.current.length?_.current=-1:(z.current=!1,_.current=c):_.current=(0,eE.findNonDisabledListIndex)(u.current,{startingIndex:s,disabledIndices:M}):_.current=Math.min(d,(0,eE.findNonDisabledListIndex)(u.current,{startingIndex:s,disabledIndices:M})):v?s<=c?g&&-1!==s?_.current=u.current.length:(z.current=!1,_.current=d):_.current=(0,eE.findNonDisabledListIndex)(u.current,{startingIndex:s,decrement:!0,disabledIndices:M}):_.current=Math.max(c,(0,eE.findNonDisabledListIndex)(u.current,{startingIndex:s,decrement:!0,disabledIndices:M})),(0,eE.isIndexOutOfListBounds)(u.current,_.current)&&(_.current=-1),B(e)}}),ei=r.useMemo(()=>R&&o&&ee&&{"aria-activedescendant":`${w}-${c}`},[R,o,ee,w,c]),ea=r.useMemo(()=>({"aria-orientation":"both"===y?void 0:y,...!D?ei:{},onKeyDown(e){if("Tab"===e.key&&e.shiftKey&&o&&!R){let t=(0,eC.getTarget)(e.nativeEvent);if(t&&!(0,eC.contains)(A.current,t))return;(0,ey.stopEvent)(e),n.setOpen(!1,(0,k.createChangeEventDetails)(l.REASONS.focusOut,e.nativeEvent)),(0,eR.isHTMLElement)(a)&&a.focus();return}eo(e)},onPointerMove(){H.current=!0}}),[ei,eo,A,y,D,n,o,R,a]),es=r.useMemo(()=>{function e(e){"auto"===b&&(0,ey.isVirtualClick)(e.nativeEvent)&&(j.current=!R)}function t(e){j.current=b,"auto"===b&&(0,ey.isVirtualPointerEvent)(e.nativeEvent)&&(j.current=!0)}return{onKeyDown(e){var t,r;let o=n.select("open");H.current=!1;let i=e.key.startsWith("Arrow"),a=(t=e.key,r=er(),ek(r,h?t===ew.ARROW_LEFT:t===ew.ARROW_RIGHT,t===ew.ARROW_DOWN)),s=eO(e.key,y),c=(x?a:s)||"Enter"===e.key||""===e.key.trim();if(R&&o)return eo(e);if(o||C||!i){if(c){let t=eO(e.key,er());U.current=x&&t?null:e.key}if(x){a&&((0,ey.stopEvent)(e),o?(_.current=(0,eE.getMinListIndex)(u,q.current),B(e)):n.setOpen(!0,(0,k.createChangeEventDetails)(l.REASONS.listNavigation,e.nativeEvent,e.currentTarget)));return}s&&(null!=J.current&&(_.current=J.current),(0,ey.stopEvent)(e),!o&&C?n.setOpen(!0,(0,k.createChangeEventDetails)(l.REASONS.listNavigation,e.nativeEvent,e.currentTarget)):eo(e),o&&B(e))}},onFocus(e){n.select("open")&&!R&&(_.current=-1,B(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[eo,q,b,u,x,B,n,C,y,er,h,J,R]),eu=r.useMemo(()=>({...ei,...es}),[ei,es]);return r.useMemo(()=>f?{reference:eu,floating:ea,item:en,trigger:es}:{},[f,eu,ea,es,en])}(ei,{enabled:!U,listRef:T.context.itemDomElements,activeIndex:G,nested:void 0!==B.type,loopFocus:m,orientation:g,parentOrientation:"menubar"===B.type?B.context.orientation:void 0,rtl:"rtl"===el,disabledIndices:eg.EMPTY_ARRAY,onNavigate:ec,openOnArrowKeyDown:"context-menu"!==B.type,externalTree:K?P:void 0,focusItemOnHover:C}),ep=r.useCallback(e=>{T.context.typingRef.current=e},[T]),ev=function(e,t){let n="rootStore"in e?e.rootStore:e,o=n.context.dataRef,i=n.useState("open"),{listRef:a,elementsRef:s,activeIndex:u,onMatch:l,onTypingChange:c,enabled:d=!0,resetMs:f=750,selectedIndex:m=null}=t,g=(0,X.useTimeout)(),v=r.useRef(""),x=r.useRef(m??u??-1),h=r.useRef(null);(0,F.useIsoLayoutEffect)(()=>{(i||null===m)&&(g.clear(),h.current=null,""!==v.current&&(v.current=""))},[i,m,g]),(0,F.useIsoLayoutEffect)(()=>{i&&""===v.current&&(x.current=m??u??-1)},[i,m,u]);let R=(0,p.useStableCallback)(e=>{e?o.current.typing||(o.current.typing=e,c?.(e)):o.current.typing&&(o.current.typing=e,c?.(e))}),b=(0,p.useStableCallback)(e=>{function t(e,n,r=0){if(0===e.length)return -1;let o=(r%e.length+e.length)%e.length,i=n.toLocaleLowerCase();for(let t=0;t<e.length;t+=1){let n=(o+t)%e.length,r=e[n];if(r?.toLocaleLowerCase().startsWith(i)&&function(e){let t=s?.current[e];return!t||(0,eE.isElementVisible)(t)}(n))return n}return -1}let n=a.current;if(v.current.length>0&&" "===e.key&&((0,ey.stopEvent)(e),R(!0)),v.current.length>0&&" "!==v.current[0]&&-1===t(n,v.current)&&" "!==e.key&&R(!1),null==n||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey)return;i&&" "!==e.key&&((0,ey.stopEvent)(e),R(!0));let r=""===v.current;r&&(x.current=m??u??-1),n.every(e=>!e||e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase())&&v.current===e.key&&(v.current="",x.current=h.current),v.current+=e.key,g.start(f,()=>{v.current="",x.current=h.current,R(!1)});let o=r?m??u??-1:x.current,c=t(n,v.current,(o??0)+1);-1!==c?(l?.(c),h.current=c):" "!==e.key&&(v.current="",R(!1))}),S=(0,p.useStableCallback)(e=>{let t=e.relatedTarget,r=n.select("domReferenceElement"),o=n.select("floatingElement"),i=(0,eC.contains)(r,t),a=(0,eC.contains)(o,t);i||a||(g.clear(),v.current="",x.current=h.current,R(!1))}),C=r.useMemo(()=>({onKeyDown:b,onBlur:S}),[b,S]),M=r.useMemo(()=>({onKeyDown:b,onBlur:S}),[b,S]);return r.useMemo(()=>d?{reference:C,floating:M}:{},[d,C,M])}(ei,{listRef:T.context.itemLabels,elementsRef:T.context.itemDomElements,activeIndex:G,resetMs:en.TYPEAHEAD_RESET_MS,onMatch:e=>{L&&e!==G&&T.set("activeIndex",e)},onTypingChange:ep}),{getReferenceProps:eN,getFloatingProps:ej,getItemProps:e_,getTriggerProps:eU}=(0,eh.useInteractions)([es,eu,ed,ev]),eH=r.useMemo(()=>{let e=(0,h.mergeProps)(eN(),{onMouseMove(){T.set("allowMouseEnter",!0)}},q);return delete e.role,e},[eN,T,q]),eB=r.useMemo(()=>{let e=eU();if(!e)return e;let t=(0,h.mergeProps)(e,q);return delete t.role,delete t["aria-controls"],t},[eU,q]),eG=r.useMemo(()=>ej({onMouseMove(){T.set("allowMouseEnter",!0),"menu"===B.type&&T.set("hoverEnabled",!1)},onClick(){T.select("hoverEnabled")&&T.set("hoverEnabled",!1)},onKeyDown(e){let t=T.select("keyboardEventRelay");t&&!e.isPropagationStopped()&&t(e)}}),[ej,B.type,T]),eW=r.useMemo(()=>e_(),[e_]);T.useSyncedValues({floatingRootContext:ei,activeTriggerProps:eH,inactiveTriggerProps:eB,popupProps:eG,itemProps:eW});let eK=r.useMemo(()=>({store:T,parent:w}),[T,w]),eq=(0,O.jsx)(o.MenuRootContext.Provider,{value:eK,children:"function"==typeof n?n({payload:W}):n});return void 0===B.type||"context-menu"===B.type?(0,O.jsx)(Q.FloatingTree,{externalTree:P,children:eq}):eq});e.s(["MenuRoot",0,eq],149292),e.s(["MenuSubmenuRoot",0,function(e){let t=(0,o.useMenuRootContext)().store,n=r.useMemo(()=>({parentMenu:t}),[t]);return(0,O.jsx)(eK.Provider,{value:n,children:(0,O.jsx)(eq,{...e})})}],65255);var e$=e.i(499198),eJ=e.i(934940),eX=e.i(604921),eQ=e.i(480283),eZ=e.i(285182),e0=e.i(352360);function e1(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:o}=(0,e0.useCompositeRootContext)(),{ref:i,index:a}=(0,M.useCompositeListItem)(e),s=n===a,u=r.useRef(null),l=(0,v.useMergedRefs)(i,u);return{compositeProps:r.useMemo(()=>({tabIndex:s?0:-1,onFocus(){o(a)},onMouseMove(){let e=u.current;if(!t||!e)return;let n=e.hasAttribute("disabled")||"true"===e.ariaDisabled;s||n||e.focus()}}),[s,o,a,t]),compositeRef:l,index:a}}function e5(e){let{render:t,className:n,style:r,state:o=eg.EMPTY_OBJECT,props:a=eg.EMPTY_ARRAY,refs:s=eg.EMPTY_ARRAY,metadata:u,stateAttributesMapping:l,tag:c="div",...d}=e,{compositeProps:p,compositeRef:f}=e1({metadata:u});return(0,i.useRenderElement)(c,e,{state:o,ref:[...s,f],props:[p,...a,d],stateAttributesMapping:l})}function e2(e){return(0,eR.isHTMLElement)(e)&&e.hasAttribute("data-rootownerid")?e.getAttribute("data-rootownerid")??void 0:(0,eR.isLastTraversableNode)(e)?void 0:e2((0,eR.getParentNode)(e))}e.s(["useCompositeItem",0,e1],530909),e.s(["findRootOwnerId",0,e2],87709);var e9=e.i(660079),e3=e.i(601957);let e4=(0,ev.fastComponentRef)(function(e,t){let n,s,c,{render:d,className:f,disabled:g=!1,nativeButton:v=!0,id:h,openOnHover:R,delay:b=100,closeDelay:S=0,handle:C,payload:M,style:E,...I}=e,w=(0,o.useMenuRootContext)(!0),k=C?.store??w?.store;if(!k)throw Error((0,m.default)(85));let T=(0,y.useBaseUiId)(h),P=k.useState("isTriggerActive",T),A=k.useState("floatingRootContext"),N=k.useState("isOpenedByTrigger",T),L=r.useRef(null),D=(n=(0,u.useContextMenuRootContext)(!0),s=(0,o.useMenuRootContext)(!0),c=eL(!0),r.useMemo(()=>c?{type:"menubar",context:c}:n&&!s?{type:"context-menu",context:n}:{type:void 0},[n,s,c])),j=(0,e0.useCompositeRootContext)(!0),_=(0,Q.useFloatingTree)(),U=r.useMemo(()=>_??new eH.FloatingTreeStore,[_]),H=(0,Q.useFloatingNodeId)(U),B=(0,Q.useFloatingParentNodeId)(),{registerTrigger:G,isMountedByThisTrigger:W}=(0,ez.useTriggerDataForwarding)(T,L,k,{payload:M,closeDelay:S,parent:D,floatingTreeRoot:U,floatingNodeId:H,floatingParentNodeId:B,keyboardEventRelay:j?.relayKeyboardEvent}),V="menubar"===D.type,z=k.useState("disabled"),K=g||z||V&&D.context.disabled,{getButtonProps:Y,buttonRef:q}=(0,x.useButton)({disabled:K,native:v});r.useEffect(()=>{N||void 0!==D.type||(k.context.allowMouseUpTriggerRef.current=!1)},[k,N,D.type]);let $=r.useRef(null),J=(0,X.useTimeout)(),Z=(0,p.useStableCallback)(e=>{if(!$.current)return;J.clear(),k.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if((0,eC.contains)($.current,t)||(0,eC.contains)(k.select("positionerElement"),t)||t===$.current||null!=t&&e2(t)===k.select("rootId"))return;let n=function(e){let t=e.getBoundingClientRect(),n=(0,eZ.ownerWindow)(e),r=n.getComputedStyle(e,"::before"),o=n.getComputedStyle(e,"::after");if("none"===r.content&&"none"===o.content)return t;let i=parseFloat(r.width)||0,a=parseFloat(r.height)||0,s=parseFloat(o.width)||0,u=parseFloat(o.height)||0,l=Math.max(t.width,i,s),c=Math.max(t.height,a,u),d=l-t.width,p=c-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-p/2,bottom:t.bottom+p/2}}($.current);e.clientX>=n.left-2&&e.clientX<=n.right+2&&e.clientY>=n.top-2&&e.clientY<=n.bottom+2||U.events.emit("close",{domEvent:e,reason:l.REASONS.cancelOpen})});r.useEffect(()=>{N&&k.select("lastOpenChangeReason")===l.REASONS.triggerHover&&(0,eS.ownerDocument)($.current).addEventListener("mouseup",Z,{once:!0})},[N,Z,k]);let ee=V&&D.context.hasSubmenuOpen,et=R??ee,er=(0,eQ.useHoverReferenceInteraction)(A,{enabled:et&&!K&&"context-menu"!==D.type&&(!V||ee&&!W),handleClose:(0,e$.safePolygon)({blockPointerEvents:!V}),mouseOnly:!0,move:!1,restMs:void 0===D.type?b:void 0,delay:{close:S},triggerElementRef:L,externalTree:U,isActiveTrigger:P,isClosing:()=>"ending"===k.select("transitionStatus")}),eo=function(e,t){let n=(0,X.useTimeout)(),[o,i]=r.useState(!1);return(0,F.useIsoLayoutEffect)(()=>{e&&"trigger-hover"===t?(i(!0),n.start(en.PATIENT_CLICK_THRESHOLD,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),o}(N,k.select("lastOpenChangeReason")),ei=(0,eJ.useClick)(A,{enabled:!K&&"context-menu"!==D.type,event:N&&V?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:void 0===D.type&&eo}),ea=(0,eX.useFocus)(A,{enabled:!K&&ee}),es=function(e){let{enabled:t=!0,mouseDownAction:n,open:o}=e,i=r.useRef(!1);return r.useMemo(()=>t?{onMouseDown:e=>{("open"===n&&!o||"close"===n&&o)&&(i.current=!0,(0,eS.ownerDocument)(e.currentTarget).addEventListener("click",()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:eg.EMPTY_OBJECT,[t,n,o])}({open:N,enabled:V,mouseDownAction:"open"}),eu=(0,eh.useInteractions)([ei,ea]),el={disabled:K,open:N},ec=k.useState("triggerProps",W),ed=[$,t,q,G,L],ep=[eu.getReferenceProps(),er??eg.EMPTY_OBJECT,ec,{"aria-haspopup":"menu",id:T,onMouseDown:e=>{k.select("open")||(J.start(200,()=>{k.context.allowMouseUpTriggerRef.current=!0}),(0,eS.ownerDocument)(e.currentTarget).addEventListener("mouseup",Z,{once:!0}))}},V?{role:"menuitem"}:{},es,I,Y],{preFocusGuardRef:ef,handlePreFocusGuardFocus:em,handleFocusTargetFocus:ev}=(0,e9.useTriggerFocusGuards)(k,L),ex=(0,i.useRenderElement)("button",e,{enabled:!V,stateAttributesMapping:a.pressableTriggerOpenStateMapping,state:el,ref:ed,props:ep});return V?(0,O.jsx)(e5,{tag:"button",render:d,className:f,style:E,state:el,refs:ed,props:ep,stateAttributesMapping:a.pressableTriggerOpenStateMapping}):N?(0,O.jsxs)(r.Fragment,{children:[(0,O.jsx)(e3.FocusGuard,{ref:ef,onFocus:em},`${T}-pre-focus-guard`),(0,O.jsx)(r.Fragment,{children:ex},T),(0,O.jsx)(e3.FocusGuard,{ref:k.context.triggerFocusTargetRef,onFocus:ev},`${T}-post-focus-guard`)]}):(0,O.jsx)(r.Fragment,{children:ex},T)});e.s(["MenuTrigger",0,e4],989479);var e8=e.i(3310);let e7=((n={}).popupWidth="--popup-width",n.popupHeight="--popup-height",n),e6={activationDirection:e=>e?{"data-activation-direction":e}:null},te=r.forwardRef(function(e,t){let{render:n,className:r,style:a,children:s,...u}=e,{store:l}=(0,o.useMenuRootContext)(),{side:c}=(0,w.useMenuPositionerContext)(),d=l.useState("instantType"),{children:p,state:f}=(0,e8.usePopupViewport)({store:l,side:c,cssVars:e7,children:s}),m={activationDirection:f.activationDirection,transitioning:f.transitioning,instant:d};return(0,i.useRenderElement)("div",e,{state:m,ref:t,props:[u,{children:p}],stateAttributesMapping:e6})});e.s(["MenuViewport",0,te],743303)},648224,327794,299648,e=>{"use strict";e.i(676185);var t=e.i(324573),n=e.i(487455),r=e.i(28051),o=e.i(597375),i=e.i(582883),a=e.i(277658),s=e.i(349204),u=e.i(81752),l=e.i(33427),c=e.i(293209),d=e.i(503662),p=e.i(59354),f=e.i(300637),m=e.i(281478),g=e.i(149292),v=e.i(65255),x=e.i(989479),h=e.i(743303),R=e.i(362962);e.i(8890);var b=e.i(267805),S=e.i(764556),C=e.i(499198),M=e.i(934940),y=e.i(480283),E=e.i(427396),I=e.i(35359),w=e.i(139236),k=e.i(817955),O=e.i(296615),T=e.i(287591),P=e.i(969490),A=e.i(922528),N=e.i(279501),L=e.i(9952);let D=S.forwardRef(function(e,t){let{render:n,className:r,label:o,id:i,nativeButton:a=!1,openOnHover:s=!0,delay:u=100,closeDelay:l=0,disabled:c=!1,style:d,...p}=e,f=(0,O.useCompositeListItem)(),m=(0,A.useMenuPositionerContext)(),{store:g}=(0,I.useMenuRootContext)(),v=(0,w.useBaseUiId)(i),x=g.useState("open"),h=g.useState("floatingRootContext"),R=g.useState("floatingTreeRoot"),D=(0,N.useTriggerRegistration)(v,g),F=S.useCallback(e=>{let t=D(e);return null!==e&&g.select("open")&&null==g.select("activeTriggerId")&&g.update({activeTriggerId:v,activeTriggerElement:e,closeDelay:l}),t},[D,l,g,v]),j=S.useRef(null),_=S.useCallback(e=>{j.current=e,g.set("activeTriggerElement",e)},[g]),U=(0,L.useMenuSubmenuRootContext)();if(!U?.parentMenu)throw Error((0,b.default)(37));g.useSyncedValue("closeDelay",l);let H=U.parentMenu,B=H.useState("itemProps"),G=H.useState("isActive",f.index),W=S.useMemo(()=>({type:"submenu-trigger",setActive(){H.set("activeIndex",f.index)}}),[H,f.index]),V=g.useState("disabled"),z=c||V,{getItemProps:K,itemRef:Y}=(0,T.useMenuItem)({closeOnClick:!1,disabled:z,highlighted:G,id:v,store:g,typingRef:H.context.typingRef,nativeButton:a,itemMetadata:W,nodeId:m?.context.nodeId}),q=g.useState("hoverEnabled"),$=H.useState("allowMouseEnter"),J=(0,y.useHoverReferenceInteraction)(h,{enabled:q&&s&&!z,handleClose:(0,C.safePolygon)({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:u,delay:$?{open:u,close:l}:0,triggerElementRef:j,externalTree:R,isClosing:()=>"ending"===g.select("transitionStatus")}),X=(0,M.useClick)(h,{enabled:!z,event:"mousedown",toggle:!s,ignoreMouse:s,stickIfOpen:!1}),Q=(0,E.useInteractions)([X]),Z=g.useState("triggerProps",!0);return delete Z.id,(0,P.useRenderElement)("div",e,{state:{disabled:z,highlighted:G,open:x},stateAttributesMapping:k.triggerOpenStateMapping,props:[Q.getReferenceProps(),J,Z,B,{tabIndex:x||G?0:-1,onBlur(){G&&H.set("activeIndex",null)}},p,K],ref:[t,f.ref,Y,F,_]})});e.s(["MenuSubmenuTrigger",0,D],327794);var F=e.i(602453),j=e.i(517510);class _{constructor(){this.store=new j.MenuStore}open(e){let t=e?this.store.context.triggerElements.getById(e):void 0;if(e&&!t)throw Error((0,b.default)(83,e));this.store.setOpen(!0,(0,F.createChangeEventDetails)("imperative-action",void 0,t))}close(){this.store.setOpen(!1,(0,F.createChangeEventDetails)("imperative-action",void 0,void 0))}get isOpen(){return this.store.state.open}}e.s(["Arrow",()=>t.MenuArrow,"Backdrop",()=>n.MenuBackdrop,"CheckboxItem",()=>r.MenuCheckboxItem,"CheckboxItemIndicator",()=>o.MenuCheckboxItemIndicator,"Group",()=>i.MenuGroup,"GroupLabel",()=>a.MenuGroupLabel,"Handle",0,_,"Item",()=>s.MenuItem,"LinkItem",()=>u.MenuLinkItem,"Popup",()=>l.MenuPopup,"Portal",()=>c.MenuPortal,"Positioner",()=>d.MenuPositioner,"RadioGroup",()=>p.MenuRadioGroup,"RadioItem",()=>f.MenuRadioItem,"RadioItemIndicator",()=>m.MenuRadioItemIndicator,"Root",()=>g.MenuRoot,"Separator",()=>R.Separator,"SubmenuRoot",()=>v.MenuSubmenuRoot,"SubmenuTrigger",0,D,"Trigger",()=>x.MenuTrigger,"Viewport",()=>h.MenuViewport,"createHandle",0,function(){return new _}],449931);var U=e.i(449931);e.s(["Menu",0,U],648224);var H=e.i(50153);e.s(["CheckIcon",()=>H.default],299648)},917955,e=>{"use strict";var t=e.i(344180),n=e.i(648224),r=e.i(465458);e.i(932031),e.i(299648),e.s(["DropdownMenu",0,function({...e}){return(0,t.jsx)(n.Menu.Root,{"data-slot":"dropdown-menu",...e})},"DropdownMenuContent",0,function({align:e="start",alignOffset:o=0,side:i="bottom",sideOffset:a=4,className:s,...u}){return(0,t.jsx)(n.Menu.Portal,{children:(0,t.jsx)(n.Menu.Positioner,{className:"isolate z-50 outline-none",align:e,alignOffset:o,side:i,sideOffset:a,children:(0,t.jsx)(n.Menu.Popup,{"data-slot":"dropdown-menu-content",className:(0,r.cn)("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",s),...u})})})},"DropdownMenuGroup",0,function({...e}){return(0,t.jsx)(n.Menu.Group,{"data-slot":"dropdown-menu-group",...e})},"DropdownMenuItem",0,function({className:e,inset:o,variant:i="default",...a}){return(0,t.jsx)(n.Menu.Item,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":i,className:(0,r.cn)("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...a})},"DropdownMenuLabel",0,function({className:e,inset:o,...i}){return(0,t.jsx)(n.Menu.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":o,className:(0,r.cn)("px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7",e),...i})},"DropdownMenuSeparator",0,function({className:e,...o}){return(0,t.jsx)(n.Menu.Separator,{"data-slot":"dropdown-menu-separator",className:(0,r.cn)("-mx-1 my-1 h-px bg-border",e),...o})},"DropdownMenuShortcut",0,function({className:e,...n}){return(0,t.jsx)("span",{"data-slot":"dropdown-menu-shortcut",className:(0,r.cn)("ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground",e),...n})},"DropdownMenuTrigger",0,function({...e}){return(0,t.jsx)(n.Menu.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}])},650654,e=>{"use strict";var t=e.i(558680);e.s(["ChevronDown",()=>t.default])},611176,e=>{"use strict";var t=e.i(344180),n=e.i(764556),r=e.i(465458),o=e.i(523592),i=e.i(355819);let a=[[/generativelanguage\.googleapis\.com/i,"gemini"],[/aiplatform\.googleapis\.com/i,"google"],[/api\.anthropic\.com/i,"anthropic"],[/api\.openai\.com/i,"openai"],[/api\.deepseek\.com/i,"deepseek"],[/open\.bigmodel\.cn/i,"zhipu"],[/api\.moonshot\.cn/i,"kimi"],[/dashscope\.aliyuncs\.com/i,"alibaba"],[/dashscope\.com/i,"alibaba"],[/aip\.baidubce\.com/i,"baidu"],[/ark\.cn-beijing\.volces\.com/i,"doubao"],[/api\.coze\./i,"doubao"],[/api\.minimax\.chat/i,"minimax"],[/api\.minimaxi\.com/i,"minimax"],[/api\.mistral\.ai/i,"mistral"],[/api\.groq\.com/i,"xai"],[/api\.x\.ai/i,"xai"],[/openrouter\.ai/i,"openrouter"],[/api\.siliconflow\.cn/i,"siliconflow"],[/localhost.*11434/i,"ollama"],[/127\.0\.0\.1.*11434/i,"ollama"],[/api\.cohere\./i,"cohere"],[/api-inference\.huggingface\.co/i,"huggingface"],[/openai\.azure\.com/i,"azure"],[/\.openai\.azure\.com/i,"azure"],[/bedrock-runtime\..*\.amazonaws\.com/i,"aws"],[/api\.huawei\./i,"huawei"],[/hunyuan\.tencentcloudapi\.com/i,"tencent"],[/api\.01\.ai/i,"yi"],[/api\.stepfun\.com/i,"stepfun"],[/api\.novita\.ai/i,"novita"],[/integrate\.api\.nvidia\.com/i,"nvidia"],[/api\.cloudflare\.com\/client\/v4\/accounts/i,"cloudflare"],[/meta\.llama/i,"meta"]];e.s(["AgentIcon",0,function({agentId:e,name:s,avatarUrl:u,apiBase:l,className:c,onClick:d}){let p,f=(0,i.useAgentStore)(e=>e.agents),[m,g]=(0,n.useState)(!1),[v,x]=(0,n.useState)(!1),h=e?f.find(t=>t.id===e):void 0,R=s||h?.name||e||"?",b=u??h?.avatarUrl,S=l??h?.apiBase,C=!m&&(0,o.resolveServerAssetUrl)(b)||(v?"":(p=function(e){if(!e)return"";for(let[t,n]of a)if(t.test(e))return n;return""}(S))?(0,o.resolveServerAssetUrl)(`/static/provider-icons/${p}.svg`):"");(0,n.useEffect)(()=>{g(!1),x(!1)},[b,S]);let M=R.charAt(0).toUpperCase();return(0,t.jsx)("div",{onClick:d,className:(0,r.cn)("flex items-center justify-center overflow-hidden rounded-lg bg-muted shrink-0",C&&"bg-transparent",!d&&"pointer-events-none",d&&"cursor-pointer hover:opacity-80 transition-opacity",c),children:C?(0,t.jsx)("img",{src:C,alt:R,className:"size-full object-cover rounded-[inherit]",onError:()=>{!m&&b?g(!0):x(!0)}}):(0,t.jsx)("span",{className:"text-xs font-semibold select-none",children:M})})}])},188815,e=>{"use strict";var t=e.i(344180),n=e.i(764556),r=e.i(465458),o=e.i(681622),i=e.i(344118),a=e.i(650654),s=e.i(953700);e.s(["SearchSelect",0,function({value:e,onChange:u,options:l,placeholder:c="Select...",searchPlaceholder:d="Search...",allowCustom:p=!0,className:f}){let m=(0,n.useRef)(null),[g,v]=(0,n.useState)(!1),[x,h]=(0,n.useState)("");(0,n.useEffect)(()=>{let e=e=>{m.current&&!m.current.contains(e.target)&&v(!1)};return g&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[g]);let R=l.filter(e=>(e.label??e.value).toLowerCase().includes(x.toLowerCase())),b=l.some(e=>e.value.toLowerCase()===x.toLowerCase()),S=l.find(t=>t.value===e),C=e&&!l.some(t=>t.value===e),M=e=>{u(e),v(!1),h("")};return(0,t.jsxs)("div",{ref:m,className:(0,r.cn)("relative",f),children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{v(!0),h("")},className:(0,r.cn)("flex h-8 w-full items-center justify-between gap-2 rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none hover:bg-muted/50 focus-visible:border-ring dark:bg-input/30"),children:[(0,t.jsx)("span",{className:(0,r.cn)("truncate",!e&&"text-muted-foreground"),children:S?S.label??S.value:C?e:c}),(0,t.jsx)(a.ChevronDown,{className:"size-3.5 shrink-0 opacity-50"})]}),g&&(0,t.jsxs)("div",{className:"absolute inset-x-0 top-full z-50 mt-1 rounded-lg border bg-popover p-1 shadow-md",children:[(0,t.jsx)(o.Input,{value:x,onChange:e=>h(e.target.value),placeholder:d,className:"h-7 text-xs",onKeyDown:e=>{"Enter"===e.key&&p&&x.trim()&&(e.preventDefault(),M(x.trim())),"Escape"===e.key&&v(!1)},autoFocus:!0}),(0,t.jsxs)("div",{className:"mt-1 max-h-48 overflow-y-auto",children:[R.map(n=>(0,t.jsxs)("button",{type:"button",className:(0,r.cn)("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-xs hover:bg-muted/50",e===n.value&&"bg-muted"),onClick:()=>M(n.value),children:[(0,t.jsx)(i.Check,{className:(0,r.cn)("size-3 shrink-0",e===n.value?"opacity-100":"opacity-0")}),(0,t.jsx)("span",{className:"truncate",children:n.label??n.value})]},n.value)),p&&x.trim()&&!b&&(0,t.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-xs text-primary hover:bg-muted/50",onClick:()=>M(x.trim()),children:[(0,t.jsx)(s.Plus,{className:"size-3 shrink-0"}),(0,t.jsxs)("span",{className:"truncate",children:['Use "',x.trim(),'"']})]}),!R.length&&!x.trim()&&(0,t.jsx)("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No results"})]})]})]})}])},129981,e=>{"use strict";let t=(0,e.i(433721).default)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);e.s(["Upload",0,t],129981)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,767467,e=>{"use strict";let t=(0,e.i(433721).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,t],767467)},189131,e=>{"use strict";var t=e.i(764556);let r=t.createContext(void 0);e.s(["useDirection",0,function(){let e=t.useContext(r);return e?.direction??"ltr"}])},459250,e=>{"use strict";var t=e.i(764556);let r=t.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});e.s(["CompositeListContext",0,r,"useCompositeListContext",0,function(){return t.useContext(r)}])},296615,e=>{"use strict";var t,r=e.i(764556),n=e.i(277642),i=e.i(459250);let l=((t={})[t.None=0]="None",t[t.GuessFromOrder=1]="GuessFromOrder",t);e.s(["useCompositeListItem",0,function(e={}){let{label:t,metadata:u,textRef:a,indexGuessBehavior:o,index:s}=e,{register:c,unregister:d,subscribeMapChange:f,elementsRef:v,labelsRef:b,nextIndexRef:m}=(0,i.useCompositeListContext)(),h=r.useRef(-1),[p,g]=r.useState(s??(o===l.GuessFromOrder?()=>{if(-1===h.current){let e=m.current;m.current+=1,h.current=e}return h.current}:-1)),y=r.useRef(null),x=r.useCallback(e=>{if(y.current=e,-1!==p&&null!==e&&(v.current[p]=e,b)){let r=void 0!==t;b.current[p]=r?t:a?.current?.textContent??e.textContent}},[p,v,b,t,a]);return(0,n.useIsoLayoutEffect)(()=>{if(null!=s)return;let e=y.current;if(e)return c(e,u),()=>{d(e)}},[s,c,d,u]),(0,n.useIsoLayoutEffect)(()=>{if(null==s)return f(e=>{let t=y.current?e.get(y.current)?.index:null;null!=t&&g(t)})},[s,f,g]),r.useMemo(()=>({ref:x,index:p}),[p,x])}])},756432,e=>{"use strict";var t=e.i(764556),r=e.i(549154),n=e.i(29905),i=e.i(277642),l=e.i(459250),u=e.i(344180);function a(){return new Map}function o(){return new Set}function s(e,t){let r=e.compareDocumentPosition(t);return r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS?1:0}e.s(["CompositeList",0,function(e){let{children:c,elementsRef:d,labelsRef:f,onMapChange:v}=e,b=(0,n.useStableCallback)(v),m=t.useRef(0),h=(0,r.useRefWithInit)(o).current,p=(0,r.useRefWithInit)(a).current,[g,y]=t.useState(0),x=t.useRef(g),E=(0,n.useStableCallback)((e,t)=>{p.set(e,t??null),x.current+=1,y(x.current)}),C=(0,n.useStableCallback)(e=>{p.delete(e),x.current+=1,y(x.current)}),I=t.useMemo(()=>{let e=new Map;return Array.from(p.keys()).filter(e=>e.isConnected).sort(s).forEach((t,r)=>{let n=p.get(t)??{};e.set(t,{...n,index:r})}),e},[p,g]);(0,i.useIsoLayoutEffect)(()=>{if("function"!=typeof MutationObserver||0===I.size)return;let e=new MutationObserver(e=>{let t=new Set,r=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(r),e.addedNodes.forEach(r)}),0===t.size&&(x.current+=1,y(x.current))});return I.forEach((t,r)=>{r.parentElement&&e.observe(r.parentElement,{childList:!0})}),()=>{e.disconnect()}},[I]),(0,i.useIsoLayoutEffect)(()=>{x.current===g&&(d.current.length!==I.size&&(d.current.length=I.size),f&&f.current.length!==I.size&&(f.current.length=I.size),m.current=I.size),b(I)},[b,I,d,f,g]),(0,i.useIsoLayoutEffect)(()=>()=>{d.current=[]},[d]),(0,i.useIsoLayoutEffect)(()=>()=>{f&&(f.current=[])},[f]);let R=(0,n.useStableCallback)(e=>(h.add(e),()=>{h.delete(e)}));(0,i.useIsoLayoutEffect)(()=>{h.forEach(e=>e(I))},[h,I]);let S=t.useMemo(()=>({register:E,unregister:C,subscribeMapChange:R,elementsRef:d,labelsRef:f,nextIndexRef:m}),[E,C,R,d,f,m]);return(0,u.jsx)(l.CompositeListContext.Provider,{value:S,children:c})}])},464111,e=>{"use strict";e.s(["clamp",0,function(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}])},394394,e=>{"use strict";var t=e.i(764556);let r=t.createContext(void 0),n={disableStyleElements:!1};e.s(["useCSPContext",0,function(){return t.useContext(r)??n}])},517432,e=>{"use strict";var t=e.i(56032),r=e.i(863728);function n(){return r.NOOP}function i(){return!1}function l(){return!0}e.s(["useIsHydrating",0,function(){return(0,t.useSyncExternalStore)(n,i,l)}])},607452,e=>{"use strict";var t,r=e.i(344180);e.s([],885864),e.i(885864),e.i(8890);var n=e.i(764556),i=e.i(526850),l=e.i(535270),u=e.i(29905),a=e.i(106045),o=e.i(277642),s=e.i(602453),c=e.i(638144),d=e.i(139236),f=e.i(969490),v=e.i(464111);function b(e,t,r=(e,t)=>e===t){return e.length===t.length&&e.every((e,n)=>r(e,t[n]))}var m=e.i(410421),h=e.i(756432),p=e.i(125231),g=e.i(975698),y=e.i(380414),x=e.i(443124);function E(e,t){return e-t}function C(e,t,r,n,i,l){var u;let a,o=e;return o=(0,v.clamp)(o,r,n),i&&(u=(0,v.clamp)(o,l[t-1]||-1/0,l[t+1]||1/0),(a=l.slice())[t]=u,o=a.sort(E)),o}function I(e,t,r){return!Array.isArray(e)||Math.min(...e.reduce((e,t,r,n)=>(r===n.length-1||e.push(Math.abs(t-n[r+1])),e),[]))>=t*r}let R={activeThumbIndex:()=>null,max:()=>null,min:()=>null,minStepsBetweenValues:()=>null,step:()=>null,values:()=>null,...e.i(438904).fieldValidityMapping};var S=e.i(267805);let N=n.createContext(void 0);function A(){let e=n.useContext(N);if(void 0===e)throw Error((0,S.default)(62));return e}var w=e.i(742665);let M=n.forwardRef(function(e,t){let{"aria-labelledby":S,className:A,defaultValue:M,disabled:O=!1,id:T,format:P,largeStep:k=10,locale:L,render:D,max:F=100,min:_=0,minStepsBetweenValues:V=0,form:W,name:$,onValueChange:z,onValueCommitted:B,orientation:H="horizontal",step:G=1,thumbCollisionBehavior:j="push",thumbAlignment:U="center",value:K,style:q,...Y}=e,X=(0,d.useBaseUiId)(T),J=null==X?void 0:`${X}-label`,Q=(0,u.useStableCallback)(z),Z=(0,u.useStableCallback)(B),{clearErrors:ee}=(0,y.useFormContext)(),{state:et,disabled:er,name:en,setTouched:ei,setDirty:el,validityData:eu,shouldValidateOnChange:ea,validation:eo}=(0,p.useFieldRootContext)(),{labelId:es}=(0,x.useLabelableContext)(),[ec,ed]=n.useState(),ef=S??es??ec,ev=er||O,eb=en??$,[em,eh]=(0,l.useControlled)({controlled:K,default:M??_,name:"Slider"}),ep=n.useRef(null),eg=n.useRef(null),ey=n.useRef([]),ex=n.useRef(null),eE=n.useRef(null),eC=n.useRef(-1),eI=n.useRef(null),eR=n.useRef(null),eS=n.useRef("none"),eN=(0,a.useValueAsRef)(P),[eA,ew]=n.useState(-1),[eM,eO]=n.useState(-1),[eT,eP]=n.useState(!1),[ek,eL]=n.useState(()=>new Map),[eD,eF]=n.useState([void 0,void 0]),e_=(0,u.useStableCallback)(e=>{ew(e),-1!==e&&eO(e)});(0,g.useRegisterFieldControl)(eg,{id:X,value:em}),(0,c.useValueChanged)(em,()=>{ee(eb),ea()?eo.commit(em):eo.commit(em,!0);let e=eu.initialValue;el(Array.isArray(em)&&Array.isArray(e)?!b(em,e):em!==e)});let eV=(0,u.useStableCallback)(e=>{e&&(eg.current=e)}),eW=Array.isArray(em),e$=n.useMemo(()=>eW?em.slice().sort(E):[(0,v.clamp)(em,_,F)],[F,_,eW,em]),ez=(0,u.useStableCallback)((e,t)=>{if(Number.isNaN(e)||("number"==typeof e&&"number"==typeof em?e===em:!!(Array.isArray(e)&&Array.isArray(em))&&b(e,em)))return;let r=t??(0,s.createChangeEventDetails)(w.REASONS.none,void 0,void 0,{activeThumbIndex:-1});eS.current=r.reason;let n=r.event,i=new(n.constructor??Event)(n.type,n);Object.defineProperty(i,"target",{writable:!0,value:{value:e,name:eb}}),r.event=i,eR.current=e,Q(e,r),r.isCanceled||eh(e)}),eB=(0,u.useStableCallback)((e,t,r)=>{let n=C(e,t,_,F,eW,e$);if(I(n,G,V)){let e="key"in r?w.REASONS.keyboard:w.REASONS.inputChange;ez(n,(0,s.createChangeEventDetails)(e,r.nativeEvent,void 0,{activeThumbIndex:t})),ei(!0),Z(eR.current??n,(0,s.createGenericEventDetails)(e,r.nativeEvent))}});(0,o.useIsoLayoutEffect)(()=>{let e=(0,m.activeElement)((0,i.ownerDocument)(ep.current));ev&&(0,m.contains)(ep.current,e)&&e.blur()},[ev]),ev&&-1!==eA&&e_(-1);let eH=n.useMemo(()=>({...et,activeThumbIndex:eA,disabled:ev,dragging:eT,orientation:H,max:F,min:_,minStepsBetweenValues:V,step:G,values:e$}),[et,eA,ev,eT,F,_,V,H,G,e$]),eG=n.useMemo(()=>({active:eA,controlRef:eg,disabled:ev,dragging:eT,validation:eo,formatOptionsRef:eN,handleInputChange:eB,indicatorPosition:eD,inset:"center"!==U,labelId:ef,rootLabelId:J,largeStep:k,lastUsedThumbIndex:eM,lastChangedValueRef:eR,lastChangeReasonRef:eS,form:W,locale:L,max:F,min:_,minStepsBetweenValues:V,name:eb,onValueCommitted:Z,orientation:H,pressedInputRef:ex,pressedThumbCenterOffsetRef:eE,pressedThumbIndexRef:eC,pressedValuesRef:eI,registerFieldControlRef:eV,renderBeforeHydration:"edge"===U,setActive:e_,setDragging:eP,setIndicatorPosition:eF,setLabelId:ed,setValue:ez,state:eH,step:G,thumbCollisionBehavior:j,thumbMap:ek,thumbRefs:ey,values:e$}),[eA,eg,ef,J,ev,eT,eo,eN,eB,eD,k,eM,eR,eS,W,L,F,_,V,eb,Z,H,ex,eE,eC,eI,eV,e_,eP,eF,ed,ez,eH,G,j,U,ek,ey,e$]),ej=(0,f.useRenderElement)("div",e,{state:eH,ref:[t,ep],props:[{"aria-labelledby":ef,id:X,role:"group"},eo.getValidationProps,Y],stateAttributesMapping:R});return(0,r.jsx)(N.Provider,{value:eG,children:(0,r.jsx)(h.CompositeList,{elementsRef:ey,onMapChange:eL,children:ej})})});var O=e.i(92615),T=e.i(213700);let P=n.forwardRef(function(e,t){let{render:r,className:n,style:l,...u}=e;delete u.id;let{state:a,setLabelId:o,controlRef:s,rootLabelId:c}=A(),d=(0,T.useLabel)({id:c,setLabelId:o,focusControl:function(e,t){if(t){let r=(0,i.ownerDocument)(e.currentTarget).getElementById(t);if((0,O.isHTMLElement)(r))return void(0,T.focusElementWithVisible)(r)}let r=s.current?.querySelectorAll('input[type="range"]'),n=r?.length===1?r[0]:null;(0,O.isHTMLElement)(n)&&(0,T.focusElementWithVisible)(n)}});return(0,f.useRenderElement)("div",e,{ref:t,state:a,props:[d,u],stateAttributesMapping:R})});var k=e.i(842809);let L=n.forwardRef(function(e,t){let{"aria-live":r="off",render:i,className:l,children:u,style:a,...o}=e,{thumbMap:s,state:c,values:d,formatOptionsRef:v,locale:b}=A(),m=n.useMemo(()=>{let e="";for(let t of s.values())t?.inputId&&(e+=`${t.inputId} `);return""===e.trim()?void 0:e.trim()},[s]),h=n.useMemo(()=>{let e=[];for(let t=0;t<d.length;t+=1)e.push((0,k.formatNumber)(d[t],b,v.current??void 0));return e},[v,b,d]),p=n.useMemo(()=>{let e=[];for(let t=0;t<d.length;t+=1)e.push(h[t]||d[t]);return e.join(" – ")},[d,h]);return(0,f.useRenderElement)("output",e,{state:c,ref:t,props:[{"aria-live":r,children:"function"==typeof u?u(h,d):p,htmlFor:m},o],stateAttributesMapping:R})});var D=e.i(422561),F=e.i(859092),_=e.i(189131);function V(e){let t=e.getBoundingClientRect();return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function W(e){if(0===e)return 0;if(1>Math.abs(e)){let t=e.toExponential().split("e-"),r=t[0].split(".")[1];return(r?r.length:0)+parseInt(t[1],10)}let t=e.toString().split(".")[1];return t?t.length:0}function $(e,t,r){return Number((Math.round((e-r)/t)*t+r).toFixed(Math.max(W(t),W(r))))}function z({values:e,index:t,nextValue:r,min:n,max:i,step:l,minStepsBetweenValues:u,initialValues:a}){if(0===e.length)return[];let o=e.slice(),s=l*u,c=o.length-1,d=a??e;o[t]=(0,v.clamp)(r,n+t*s,i-(c-t)*s);for(let e=t+1;e<=c;e+=1){let t=o[e-1]+s,r=i-(c-e)*s,n=d[e]??o[e],l=Math.max(o[e],t);n<l&&(l=Math.max(n,t)),o[e]=(0,v.clamp)(l,t,r)}for(let e=t-1;e>=0;e-=1){let t=o[e+1]-s,r=n+e*s,i=d[e]??o[e],l=Math.min(o[e],t);i>l&&(l=Math.min(i,t)),o[e]=(0,v.clamp)(l,r,t)}for(let e=0;e<=c;e+=1)o[e]=Number(o[e].toFixed(12));return o}function B(e,t){if(null!=t.current&&e.changedTouches){for(let r=0;r<e.changedTouches.length;r+=1){let n=e.changedTouches[r];if(n.identifier===t.current)return{x:n.clientX,y:n.clientY}}return null}return{x:e.clientX,y:e.clientY}}let H=n.forwardRef(function(e,t){let{render:r,className:l,style:o,...c}=e,{disabled:d,dragging:b,inset:h,lastChangedValueRef:p,lastChangeReasonRef:g,max:y,min:x,minStepsBetweenValues:E,onValueCommitted:C,orientation:S,pressedInputRef:N,pressedThumbCenterOffsetRef:M,pressedThumbIndexRef:T,pressedValuesRef:P,registerFieldControlRef:k,renderBeforeHydration:L,setActive:W,setDragging:H,setValue:G,state:j,step:U,thumbCollisionBehavior:K,thumbRefs:q,values:Y}=A(),X=(0,_.useDirection)(),J=Y.length>1,Q="vertical"===S,Z=n.useRef(null),ee=n.useRef(null),et=(0,u.useStableCallback)(e=>{e&&null==ee.current&&null==ee.current&&(ee.current=getComputedStyle(e))}),er=n.useRef(null),en=n.useRef(0),ei=n.useRef(0),el=(0,a.useValueAsRef)(Y),eu=(0,u.useStableCallback)(e=>{T.current!==e&&(T.current=e);let t=q.current[e];if(!t){M.current=null,N.current=null;return}N.current=t.querySelector('input[type="range"]')}),ea=(0,u.useStableCallback)(e=>{let t=Z.current;if(!t)return null;let{width:r,height:n,bottom:i,left:l,right:u}=t.getBoundingClientRect(),a=function(e,t){if(!e)return{start:0,end:0};function r(e){let t=null!=e?parseFloat(e):0;return Number.isNaN(t)?0:t}let n=t?"Top":"InlineStart",i=t?"Bottom":"InlineEnd";return{start:r(e[`border${n}Width`])+r(e[`padding${n}`]),end:r(e[`border${i}Width`])+r(e[`padding${i}`])}}(ee.current,Q),o=ei.current,s=(Q?n:r)-a.start-a.end-2*o,c=M.current??0,d=e.x-c,f=e.y-c,b=Q?i-f-a.end:("rtl"===X?u-d:d-l)-a.start,m=(y-x)*(0,v.clamp)((b-o)/s,0,1)+x;if(m=$(m,U,x),m=(0,v.clamp)(m,x,y),!J)return{value:m,thumbIndex:0,didSwap:!1};let h=T.current;if(h<0)return null;let p=function({behavior:e,values:t,currentValues:r,initialValues:n,pressedIndex:i,nextValue:l,min:u,max:a,step:o,minStepsBetweenValues:s}){let c=r??t,d=n??t;if(!(c.length>1))return{value:l,thumbIndex:0,didSwap:!1};let f=o*s;switch(e){case"swap":{let e=c[i],t=c.slice(),r=t[i-1],n=t[i+1],b=null!=r?r+f:u,m=null!=n?n-f:a,h=Number((0,v.clamp)(l,b,m).toFixed(12));t[i]=h;let p=l>e,g=l<e,y=p&&null!=n&&l>=n-1e-7,x=g&&null!=r&&l<=r+1e-7;if(!y&&!x)return{value:t,thumbIndex:i,didSwap:!1};let E=y?i+1:i-1,C=t.map((e,t)=>{if(t===i)return h;let r=d[t];return null!=r?r:c[t]}),I=l;I=y?Math.max(l,t[E]):Math.min(l,t[E]);let R=z({values:t,index:E,nextValue:I,min:u,max:a,step:o,minStepsBetweenValues:s,initialValues:C}),S=y?E-1:E+1;if(S>=0&&S<R.length){let e=R[S-1],t=R[S+1],r=null!=e?e+f:u;r=Math.max(r,u+S*f);let n=null!=t?t-f:a;n=Math.min(n,a-(R.length-1-S)*f);let i=(0,v.clamp)(h,r,n);R[S]=Number(i.toFixed(12))}return{value:R,thumbIndex:E,didSwap:!0}}case"push":return{value:z({values:c,index:i,nextValue:l,min:u,max:a,step:o,minStepsBetweenValues:s}),thumbIndex:i,didSwap:!1};default:{let e=c.slice(),t=e[i-1],r=e[i+1],n=null!=t?t+f:u,o=null!=r?r-f:a,s=(0,v.clamp)(l,n,o);return e[i]=Number(s.toFixed(12)),{value:e,thumbIndex:i,didSwap:!1}}}}({behavior:K,values:Y,currentValues:el.current??Y,initialValues:P.current,pressedIndex:h,nextValue:m,min:x,max:y,step:U,minStepsBetweenValues:E});return"swap"===K&&p.didSwap?eu(p.thumbIndex):T.current=p.thumbIndex,p}),eo=(0,u.useStableCallback)(e=>{P.current=J?Y.slice():null,el.current=Y;let t=T.current,r=t;if(t>-1&&t<Y.length){if(Y[t]===y){let e=t;for(;e>0&&Y[e-1]===y;)e-=1;r=e}}else{let t,n=Q?"y":"x";r=-1;for(let i=0;i<q.current.length;i+=1){let l=q.current[i];if((0,O.isElement)(l)){let u=V(l),a=Math.abs(e[n]-u[n]);(void 0===t||a<=t)&&(r=i,t=a)}}}if(r>-1&&r!==t&&eu(r),h){let e=q.current[r];(0,O.isElement)(e)&&(ei.current=e.getBoundingClientRect()[Q?"height":"width"]/2)}}),es=(0,u.useStableCallback)(e=>{let t=q.current?.[e]?.querySelector('input[type="range"]');t&&t.focus({preventScroll:!0,focusVisible:!1})}),ec=(0,u.useStableCallback)(e=>{let t=B(e,er);if(null==t)return;if(en.current+=1,"pointermove"===e.type&&0===e.buttons)return void ed(e);let r=ea(t);null!=r&&I(r.value,U,E)&&(!b&&en.current>2&&H(!0),G(r.value,(0,s.createChangeEventDetails)(w.REASONS.drag,e,void 0,{activeThumbIndex:r.thumbIndex})),el.current=Array.isArray(r.value)?r.value:[r.value],r.didSwap&&es(r.thumbIndex))});function ed(e){W(-1),H(!1),N.current=null,M.current=null;let t=B(e,er),r=null!=t?ea(t):null;if(null!=r){let t=g.current;C(p.current??r.value,(0,s.createGenericEventDetails)(t,e))}"pointerType"in e&&Z.current?.hasPointerCapture(e.pointerId)&&Z.current?.releasePointerCapture(e.pointerId),T.current=-1,er.current=null,P.current=null,ev()}let ef=(0,u.useStableCallback)(e=>{if(d)return;let t=e.changedTouches[0];null!=t&&(er.current=t.identifier);let r=B(e,er);if(null!=r){eo(r);let t=ea(r);if(null==t)return;es(t.thumbIndex),G(t.value,(0,s.createChangeEventDetails)(w.REASONS.trackPress,e,void 0,{activeThumbIndex:t.thumbIndex})),el.current=Array.isArray(t.value)?t.value:[t.value],t.didSwap&&es(t.thumbIndex)}en.current=0;let n=(0,i.ownerDocument)(Z.current);n.addEventListener("touchmove",ec,{passive:!0}),n.addEventListener("touchend",ed,{passive:!0})}),ev=(0,u.useStableCallback)(()=>{let e=(0,i.ownerDocument)(Z.current);e.removeEventListener("pointermove",ec),e.removeEventListener("pointerup",ed),e.removeEventListener("touchmove",ec),e.removeEventListener("touchend",ed),P.current=null}),eb=(0,F.useAnimationFrame)();return n.useEffect(()=>{let e=Z.current;if(!e)return()=>ev();let t=(0,D.addEventListener)(e,"touchstart",ef,{passive:!0});return()=>{t(),eb.cancel(),ev()}},[ev,ef,Z,eb]),n.useEffect(()=>{d&&ev()},[d,ev]),(0,f.useRenderElement)("div",e,{state:j,ref:[t,k,Z,et],props:[{"data-base-ui-slider-control":L?"":void 0,onPointerDown(e){let t=Z.current,r=(0,m.getTarget)(e.nativeEvent);if(!t||d||e.defaultPrevented||!(0,O.isElement)(r)||0!==e.button)return;let n=B(e,er);if(null!=n){eo(n);let r=ea(n);if(null==r)return;(0,m.contains)(q.current[r.thumbIndex],(0,m.activeElement)((0,i.ownerDocument)(t)))?e.preventDefault():eb.request(()=>{es(r.thumbIndex)}),H(!0),null==M.current&&(G(r.value,(0,s.createChangeEventDetails)(w.REASONS.trackPress,e.nativeEvent,void 0,{activeThumbIndex:r.thumbIndex})),el.current=Array.isArray(r.value)?r.value:[r.value],r.didSwap&&es(r.thumbIndex))}e.nativeEvent.pointerId&&t.setPointerCapture(e.nativeEvent.pointerId),en.current=0;let l=(0,i.ownerDocument)(Z.current);l.addEventListener("pointermove",ec,{passive:!0}),l.addEventListener("pointerup",ed,{once:!0})}},c],stateAttributesMapping:R})}),G=n.forwardRef(function(e,t){let{render:r,className:n,style:i,...l}=e,{state:u}=A();return(0,f.useRenderElement)("div",e,{state:u,ref:t,props:[{style:{position:"relative"}},l],stateAttributesMapping:R})});var j=e.i(204133),U=e.i(236706),K=e.i(370383),q=e.i(517432),Y=e.i(203922),X=e.i(100229),J=e.i(296615),Q=e.i(394394),Z=e.i(922970),ee=e.i(575665);let et=((t={}).index="data-index",t.dragging="data-dragging",t.orientation="data-orientation",t.disabled="data-disabled",t.valid="data-valid",t.invalid="data-invalid",t.touched="data-touched",t.dirty="data-dirty",t.focused="data-focused",t),er=new Set([X.ARROW_UP,X.ARROW_DOWN,X.ARROW_LEFT,X.ARROW_RIGHT,X.HOME,X.END,X.PAGE_UP,X.PAGE_DOWN]);function en(e,t,r,n,i){let l=Number((1===r?e+t:e-t).toFixed(Math.max(W(e),W(t),W(n))));return(0,v.clamp)(l,n,i)}let ei=n.forwardRef(function(e,t){let i,{render:l,children:a,className:s,"aria-describedby":c,"aria-label":v,"aria-labelledby":b,disabled:m=!1,getAriaLabel:h,getAriaValueText:g,id:y,index:x,inputRef:E,onBlur:I,onFocus:S,onKeyDown:N,tabIndex:w,style:M,...O}=e,{nonce:T}=(0,Q.useCSPContext)(),P=(0,d.useBaseUiId)(y),{active:L,lastUsedThumbIndex:D,controlRef:F,disabled:W,validation:z,formatOptionsRef:B,handleInputChange:H,inset:G,labelId:ei,largeStep:el,locale:eu,max:ea,min:eo,minStepsBetweenValues:es,form:ec,name:ed,orientation:ef,pressedInputRef:ev,pressedThumbCenterOffsetRef:eb,pressedThumbIndexRef:em,renderBeforeHydration:eh,setActive:ep,setIndicatorPosition:eg,state:ey,step:ex,values:eE}=A(),eC=(0,_.useDirection)(),eI=eE.length>1,eR="vertical"===ef,eS="rtl"===eC,{setTouched:eN,setFocused:eA,validationMode:ew}=(0,p.useFieldRootContext)(),eM=n.useRef(null),eO=n.useRef(null),eT=n.useRef(!1),eP=(0,d.useBaseUiId)(),ek=(0,ee.useLabelableId)(),eL=eI?eP:ek,eD=n.useMemo(()=>({inputId:eL}),[eL]),{ref:eF,index:e_}=(0,J.useCompositeListItem)({metadata:eD}),eV=eI?x??e_:0,eW=eV===eE.length-1,e$=eE[eV],ez=(0,Y.valueToPercent)(e$,eo,ea),[eB,eH]=n.useState(),eG=(0,q.useIsHydrating)(),ej=D>=0&&D<eE.length?D:-1,eU=(0,u.useStableCallback)(()=>{let e=F.current,t=eM.current;if(!e||!t)return;let r=t.getBoundingClientRect(),n=e.getBoundingClientRect(),i=eR?"height":"width",l=n[i]-r[i],u=(r[i]/2+l*ez/100)/n[i]*100,a=Number.isFinite(u)?u:void 0;eH(a),0===eV?eg(e=>[a,e[1]]):eW&&eg(e=>[e[0],a])});(0,o.useIsoLayoutEffect)(()=>{G&&queueMicrotask(eU)},[eU,G]),(0,o.useIsoLayoutEffect)(()=>{G&&eU()},[eU,G,ez]),(0,o.useIsoLayoutEffect)(()=>{if(!G||"function"!=typeof ResizeObserver)return;let e=F.current,t=eM.current;if(!e||!t)return;let r=new ResizeObserver(eU);return r.observe(e),r.observe(t),()=>{r.disconnect()}},[F,eU,G]);let eK=n.useCallback(()=>{let e,t=eR?"bottom":"insetInlineStart",r=eR?"left":"top";return(eI?L===eV?e=2:ej===eV&&(e=1):L===eV&&(e=1),G)?{"--position":`${eB??0}%`,visibility:eh&&eG||void 0===eB?"hidden":void 0,position:"absolute",[t]:"var(--position)",[r]:"50%",translate:`${(eR||!eS?-1:1)*50}% ${(eR?1:-1)*50}%`,zIndex:e}:Number.isFinite(ez)?{position:"absolute",[t]:`${ez}%`,[r]:"50%",translate:`${(eR||!eS?-1:1)*50}% ${(eR?1:-1)*50}%`,zIndex:e}:U.visuallyHidden},[L,eV,G,eG,eB,eI,eh,eS,ej,ez,eR]);"vertical"===ef&&(i=eS?"vertical-rl":"vertical-lr");let eq="function"==typeof h?h(eV):v,eY=(0,K.mergeProps)({"aria-label":eq,"aria-labelledby":b??(null==eq?ei:void 0),"aria-describedby":c,"aria-orientation":ef,"aria-valuenow":e$,"aria-valuetext":"function"==typeof g?g((0,k.formatNumber)(e$,eu,B.current??void 0),e$,eV):function(e,t,r,n){if(!(t<0))return 2===e.length?0===t?`${(0,k.formatNumber)(e[t],n,r)} start range`:`${(0,k.formatNumber)(e[t],n,r)} end range`:r?(0,k.formatNumber)(e[t],n,r):void 0}(eE,eV,B.current??void 0,eu),disabled:m||W,form:ec,id:eL,max:ea,min:eo,name:ed,onChange(e){H(e.currentTarget.valueAsNumber,eV,e)},onFocus(e){let t=eT.current;eT.current=!1,ep(eV),eA(!0),t&&e.stopPropagation()},onBlur(e){eT.current?e.stopPropagation():eM.current&&(ep(-1),eN(!0),eA(!1),"onBlur"===ew&&z.commit(C(e$,eV,eo,ea,eI,eE)))},onKeyDown(e){if(!er.has(e.key))return;X.COMPOSITE_KEYS.has(e.key)&&e.stopPropagation();let t=null,r=$(e$,ex,eo);switch(e.key){case X.ARROW_UP:t=en(r,e.shiftKey?el:ex,1,eo,ea);break;case X.ARROW_RIGHT:t=en(r,e.shiftKey?el:ex,eS?-1:1,eo,ea);break;case X.ARROW_DOWN:t=en(r,e.shiftKey?el:ex,-1,eo,ea);break;case X.ARROW_LEFT:t=en(r,e.shiftKey?el:ex,eS?1:-1,eo,ea);break;case X.PAGE_UP:t=en(r,el,1,eo,ea);break;case X.PAGE_DOWN:t=en(r,el,-1,eo,ea);break;case X.END:t=ea,eI&&(t=Number.isFinite(eE[eV+1])?eE[eV+1]-ex*es:ea);break;case X.HOME:t=eo,eI&&(t=Number.isFinite(eE[eV-1])?eE[eV-1]+ex*es:eo)}if(null!==t){let r=e.currentTarget;(0,Z.matchesFocusVisible)(r)||(eT.current=!0,r.blur(),r.focus({preventScroll:!0,focusVisible:!0})),H(t,eV,e),e.preventDefault()}},step:ex,style:{...U.visuallyHidden,width:"100%",height:"100%",writingMode:i},tabIndex:w??void 0,type:"range",value:e$??""},z.getInputValidationProps),eX=(0,j.useMergedRefs)(eO,z.inputRef,E);return(0,f.useRenderElement)("div",e,{state:ey,ref:[t,eF,eM],props:[{[et.index]:eV,children:(0,r.jsxs)(n.Fragment,{children:[a,(0,r.jsx)("input",{ref:eX,...eY,suppressHydrationWarning:!0}),G&&eG&&eh&&eW&&(0,r.jsx)("script",{nonce:T,dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript?.parentElement;if(!t)return;const e=t.closest("[data-base-ui-slider-control]");if(!e)return;const r=e.querySelector("[data-base-ui-slider-indicator]"),i=e.getBoundingClientRect(),n="vertical"===e.getAttribute("data-orientation")?"height":"width",o=e.querySelectorAll(\'input[type="range"]\'),l=o.length>1,s=o.length-1;let a=null,u=null;for(let t=0;t<o.length;t+=1){const e=o[t],y=parseFloat(e.getAttribute("value")??"");if(Number.isNaN(y))return;const c=e.parentElement;if(!c)return;const p=parseFloat(e.getAttribute("max")??"100"),g=parseFloat(e.getAttribute("min")??"0"),b=c?.getBoundingClientRect(),d=i[n]-b[n],m=100*(y-g)/(p-g),v=(b[n]/2+d*m/100)/i[n]*100;c.style.setProperty("--position",`${v}%`),Number.isFinite(v)&&(c.style.removeProperty("visibility"),r&&(0===t?(a=v,r.style.setProperty("--start-position",`${v}%`),l||r.style.removeProperty("visibility")):t===s&&(u=v-(a??0),r.style.setProperty("--end-position",`${v}%`),r.style.setProperty("--relative-size",`${u}%`),r.style.removeProperty("visibility"))))}}();'},suppressHydrationWarning:!0})]}),id:P,onBlur:I,onFocus:S,onPointerDown(e){if(em.current=eV,null!=eM.current){let t="horizontal"===ef?"x":"y",r=V(eM.current);eb.current=("horizontal"===ef?e.clientX:e.clientY)-r[t]}null!=eO.current&&ev.current!==eO.current&&(ev.current=eO.current)},style:eK(),suppressHydrationWarning:eh||void 0},O],stateAttributesMapping:R})}),el=n.forwardRef(function(e,t){var r,n;let i,l,u,a,{render:o,className:s,style:c,...d}=e,{indicatorPosition:v,inset:b,max:m,min:h,orientation:p,renderBeforeHydration:g,state:y,values:x}=A(),E=(0,q.useIsHydrating)(),C="vertical"===p,I=x.length>1,S=b?(r=v[0],n=v[1],i=void 0===r||I&&void 0===n?"hidden":void 0,l=C?"bottom":"insetInlineStart",u=C?"height":"width",((a={visibility:g&&E?"hidden":i,position:C?"absolute":"relative",[C?"width":"height"]:"inherit"})["--start-position"]=`${r??0}%`,I)?(a["--relative-size"]=`${(n??0)-(r??0)}%`,a[l]="var(--start-position)",a[u]="var(--relative-size)"):(a[l]=0,a[u]="var(--start-position)"),a):function(e,t,r,n){let i=e?"bottom":"insetInlineStart",l=e?"height":"width",u={position:e?"absolute":"relative",[e?"width":"height"]:"inherit"};if(!t)return u[i]=0,u[l]=`${r}%`,u;let a=n-r;return u[i]=`${r}%`,u[l]=`${a}%`,u}(C,I,(0,Y.valueToPercent)(x[0],h,m),(0,Y.valueToPercent)(x[x.length-1],h,m));return(0,f.useRenderElement)("div",e,{state:y,ref:t,props:[{"data-base-ui-slider-indicator":g?"":void 0,style:S,suppressHydrationWarning:g||void 0},d],stateAttributesMapping:R})});e.s(["Control",0,H,"Indicator",0,el,"Label",0,P,"Root",0,M,"Thumb",0,ei,"Track",0,G,"Value",0,L],414857);var eu=e.i(414857),eu=eu,ea=e.i(465458);e.s(["Slider",0,function({className:e,defaultValue:t,value:n,min:i=0,max:l=100,...u}){let a=Array.isArray(n)?n:void 0!==n?[n]:Array.isArray(t)?t:[i,l];return(0,r.jsx)(eu.Root,{className:(0,ea.cn)("data-horizontal:w-full data-vertical:h-full",e),"data-slot":"slider",defaultValue:t,value:n,min:i,max:l,thumbAlignment:"edge",...u,children:(0,r.jsxs)(eu.Control,{className:"relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col",children:[(0,r.jsx)(eu.Track,{"data-slot":"slider-track",className:"relative grow overflow-hidden rounded-full bg-muted select-none data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1",children:(0,r.jsx)(eu.Indicator,{"data-slot":"slider-range",className:"bg-primary select-none data-horizontal:h-full data-vertical:w-full"})}),Array.from({length:a.length},(e,t)=>(0,r.jsx)(eu.Thumb,{"data-slot":"slider-thumb",className:"relative block size-3 shrink-0 rounded-full border border-ring bg-white ring-ring/50 transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50"},t))]})})}],607452)}]);
|