takumi
Version:
A coding agent CLI to enhance your development workflow.
2 lines (1 loc) • 40.4 kB
JavaScript
import{r as c,_ as B,u as Ye,C as Qe,a as ne,c as X,b as Re,d as Ee,e as fe,o as Ze,f as de,g as L,h as He,i as Te,m as De,j as Ve,k as qe,l as I,n as et,t as tt,p as nt,q as at,s as Ae,K as we,F as it,v as st,D as lt,W as ot,R as rt,I as ae,w as J,x as ct,y as Q,z as Z,A as i,T as F,B as ie,S as je,E as ge,G as dt,H as gt,J as ut,L as ht}from"./index-C0R0gBPH.js";import{F as T,S as Y,I as mt,L as ye,C as te,R as vt,a as ft,b as pt,c as oe,d as bt}from"./FolderOutlined-CWFItq5W.js";var Ce=function(t,a){if(!t)return null;var n={left:t.offsetLeft,right:t.parentElement.clientWidth-t.clientWidth-t.offsetLeft,width:t.clientWidth,top:t.offsetTop,bottom:t.parentElement.clientHeight-t.clientHeight-t.offsetTop,height:t.clientHeight};return a?{left:0,right:0,width:0,top:n.top,bottom:n.bottom,height:n.height}:{left:n.left,right:n.right,width:n.width,top:0,bottom:0,height:0}},H=function(t){return t!==void 0?"".concat(t,"px"):void 0};function St(e){var t=e.prefixCls,a=e.containerRef,n=e.value,s=e.getValueIndex,r=e.motionName,g=e.onMotionStart,l=e.onMotionEnd,o=e.direction,u=e.vertical,h=u===void 0?!1:u,x=c.useRef(null),N=c.useState(n),y=B(N,2),$=y[0],z=y[1],P=function(E){var q,K=s(E),A=(q=a.current)===null||q===void 0?void 0:q.querySelectorAll(".".concat(t,"-item"))[K];return(A==null?void 0:A.offsetParent)&&A},R=c.useState(null),f=B(R,2),m=f[0],M=f[1],D=c.useState(null),p=B(D,2),v=p[0],S=p[1];Ye(function(){if($!==n){var b=P($),E=P(n),q=Ce(b,h),K=Ce(E,h);z(n),M(q),S(K),b&&E?g():l()}},[n]);var C=c.useMemo(function(){if(h){var b;return H((b=m==null?void 0:m.top)!==null&&b!==void 0?b:0)}return H(o==="rtl"?-(m==null?void 0:m.right):m==null?void 0:m.left)},[h,o,m]),w=c.useMemo(function(){if(h){var b;return H((b=v==null?void 0:v.top)!==null&&b!==void 0?b:0)}return H(o==="rtl"?-(v==null?void 0:v.right):v==null?void 0:v.left)},[h,o,v]),W=function(){return h?{transform:"translateY(var(--thumb-start-top))",height:"var(--thumb-start-height)"}:{transform:"translateX(var(--thumb-start-left))",width:"var(--thumb-start-width)"}},V=function(){return h?{transform:"translateY(var(--thumb-active-top))",height:"var(--thumb-active-height)"}:{transform:"translateX(var(--thumb-active-left))",width:"var(--thumb-active-width)"}},k=function(){M(null),S(null),l()};return!m||!v?null:c.createElement(Qe,{visible:!0,motionName:r,motionAppear:!0,onAppearStart:W,onAppearActive:V,onVisibleChanged:k},function(b,E){var q=b.className,K=b.style,A=ne(ne({},K),{},{"--thumb-start-left":C,"--thumb-start-width":H(m==null?void 0:m.width),"--thumb-active-left":w,"--thumb-active-width":H(v==null?void 0:v.width),"--thumb-start-top":C,"--thumb-start-height":H(m==null?void 0:m.height),"--thumb-active-top":w,"--thumb-active-height":H(v==null?void 0:v.height)}),se={ref:Re(x,E),style:A,className:X("".concat(t,"-thumb"),q)};return c.createElement("div",se)})}var xt=["prefixCls","direction","vertical","options","disabled","defaultValue","value","name","onChange","className","motionName"];function $t(e){if(typeof e.title<"u")return e.title;if(He(e.label)!=="object"){var t;return(t=e.label)===null||t===void 0?void 0:t.toString()}}function wt(e){return e.map(function(t){if(He(t)==="object"&&t!==null){var a=$t(t);return ne(ne({},t),{},{title:a})}return{label:t==null?void 0:t.toString(),title:t==null?void 0:t.toString(),value:t}})}var jt=function(t){var a=t.prefixCls,n=t.className,s=t.disabled,r=t.checked,g=t.label,l=t.title,o=t.value,u=t.name,h=t.onChange,x=t.onFocus,N=t.onBlur,y=t.onKeyDown,$=t.onKeyUp,z=t.onMouseDown,P=function(f){s||h(f,o)};return c.createElement("label",{className:X(n,L({},"".concat(a,"-item-disabled"),s)),onMouseDown:z},c.createElement("input",{name:u,className:"".concat(a,"-item-input"),type:"radio",disabled:s,checked:r,onChange:P,onFocus:x,onBlur:N,onKeyDown:y,onKeyUp:$}),c.createElement("div",{className:"".concat(a,"-item-label"),title:l,"aria-selected":r},g))},yt=c.forwardRef(function(e,t){var a,n,s=e.prefixCls,r=s===void 0?"rc-segmented":s,g=e.direction,l=e.vertical,o=e.options,u=o===void 0?[]:o,h=e.disabled,x=e.defaultValue,N=e.value,y=e.name,$=e.onChange,z=e.className,P=z===void 0?"":z,R=e.motionName,f=R===void 0?"thumb-motion":R,m=Ee(e,xt),M=c.useRef(null),D=c.useMemo(function(){return Re(M,t)},[M,t]),p=c.useMemo(function(){return wt(u)},[u]),v=fe((a=p[0])===null||a===void 0?void 0:a.value,{value:N,defaultValue:x}),S=B(v,2),C=S[0],w=S[1],W=c.useState(!1),V=B(W,2),k=V[0],b=V[1],E=function(O,U){w(U),$==null||$(U)},q=Ze(m,["children"]),K=c.useState(!1),A=B(K,2),se=A[0],pe=A[1],Fe=c.useState(!1),be=B(Fe,2),We=be[0],Se=be[1],ke=function(){Se(!0)},Ke=function(){Se(!1)},_e=function(){pe(!1)},Xe=function(O){O.key==="Tab"&&pe(!0)},xe=function(O){var U=p.findIndex(function(Je){return Je.value===C}),$e=p.length,Ue=(U+O+$e)%$e,le=p[Ue];le&&(w(le.value),$==null||$(le.value))},Ge=function(O){switch(O.key){case"ArrowLeft":case"ArrowUp":xe(-1);break;case"ArrowRight":case"ArrowDown":xe(1);break}};return c.createElement("div",de({role:"radiogroup","aria-label":"segmented control",tabIndex:h?void 0:0},q,{className:X(r,(n={},L(n,"".concat(r,"-rtl"),g==="rtl"),L(n,"".concat(r,"-disabled"),h),L(n,"".concat(r,"-vertical"),l),n),P),ref:D}),c.createElement("div",{className:"".concat(r,"-group")},c.createElement(St,{vertical:l,prefixCls:r,value:C,containerRef:M,motionName:"".concat(r,"-").concat(f),direction:g,getValueIndex:function(O){return p.findIndex(function(U){return U.value===O})},onMotionStart:function(){b(!0)},onMotionEnd:function(){b(!1)}}),p.map(function(j){var O;return c.createElement(jt,de({},j,{name:y,key:j.value,prefixCls:r,className:X(j.className,"".concat(r,"-item"),(O={},L(O,"".concat(r,"-item-selected"),j.value===C&&!k),L(O,"".concat(r,"-item-focused"),We&&se&&j.value===C),O)),checked:j.value===C,onChange:E,onFocus:ke,onBlur:Ke,onKeyDown:Ge,onKeyUp:Xe,onMouseDown:_e,disabled:!!h||!!j.disabled}))})))}),Ct=yt;function Ie(e,t){return{[`${e}, ${e}:hover, ${e}:focus`]:{color:t.colorTextDisabled,cursor:"not-allowed"}}}function Me(e){return{backgroundColor:e.itemSelectedBg,boxShadow:e.boxShadowTertiary}}const It=Object.assign({overflow:"hidden"},tt),Mt=e=>{const{componentCls:t}=e,a=e.calc(e.controlHeight).sub(e.calc(e.trackPadding).mul(2)).equal(),n=e.calc(e.controlHeightLG).sub(e.calc(e.trackPadding).mul(2)).equal(),s=e.calc(e.controlHeightSM).sub(e.calc(e.trackPadding).mul(2)).equal();return{[t]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Ve(e)),{display:"inline-block",padding:e.trackPadding,color:e.itemColor,background:e.trackBg,borderRadius:e.borderRadius,transition:`all ${e.motionDurationMid} ${e.motionEaseInOut}`}),qe(e)),{[`${t}-group`]:{position:"relative",display:"flex",alignItems:"stretch",justifyItems:"flex-start",flexDirection:"row",width:"100%"},[`&${t}-rtl`]:{direction:"rtl"},[`&${t}-vertical`]:{[`${t}-group`]:{flexDirection:"column"},[`${t}-thumb`]:{width:"100%",height:0,padding:`0 ${I(e.paddingXXS)}`}},[`&${t}-block`]:{display:"flex"},[`&${t}-block ${t}-item`]:{flex:1,minWidth:0},[`${t}-item`]:{position:"relative",textAlign:"center",cursor:"pointer",transition:`color ${e.motionDurationMid} ${e.motionEaseInOut}`,borderRadius:e.borderRadiusSM,transform:"translateZ(0)","&-selected":Object.assign(Object.assign({},Me(e)),{color:e.itemSelectedColor}),"&-focused":Object.assign({},et(e)),"&::after":{content:'""',position:"absolute",zIndex:-1,width:"100%",height:"100%",top:0,insetInlineStart:0,borderRadius:"inherit",opacity:0,transition:`opacity ${e.motionDurationMid}`,pointerEvents:"none"},[`&:hover:not(${t}-item-selected):not(${t}-item-disabled)`]:{color:e.itemHoverColor,"&::after":{opacity:1,backgroundColor:e.itemHoverBg}},[`&:active:not(${t}-item-selected):not(${t}-item-disabled)`]:{color:e.itemHoverColor,"&::after":{opacity:1,backgroundColor:e.itemActiveBg}},"&-label":Object.assign({minHeight:a,lineHeight:I(a),padding:`0 ${I(e.segmentedPaddingHorizontal)}`},It),"&-icon + *":{marginInlineStart:e.calc(e.marginSM).div(2).equal()},"&-input":{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:0,height:0,opacity:0,pointerEvents:"none"}},[`${t}-thumb`]:Object.assign(Object.assign({},Me(e)),{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:0,height:"100%",padding:`${I(e.paddingXXS)} 0`,borderRadius:e.borderRadiusSM,transition:`transform ${e.motionDurationSlow} ${e.motionEaseInOut}, height ${e.motionDurationSlow} ${e.motionEaseInOut}`,[`& ~ ${t}-item:not(${t}-item-selected):not(${t}-item-disabled)::after`]:{backgroundColor:"transparent"}}),[`&${t}-lg`]:{borderRadius:e.borderRadiusLG,[`${t}-item-label`]:{minHeight:n,lineHeight:I(n),padding:`0 ${I(e.segmentedPaddingHorizontal)}`,fontSize:e.fontSizeLG},[`${t}-item, ${t}-thumb`]:{borderRadius:e.borderRadius}},[`&${t}-sm`]:{borderRadius:e.borderRadiusSM,[`${t}-item-label`]:{minHeight:s,lineHeight:I(s),padding:`0 ${I(e.segmentedPaddingHorizontalSM)}`},[`${t}-item, ${t}-thumb`]:{borderRadius:e.borderRadiusXS}}}),Ie(`&-disabled ${t}-item`,e)),Ie(`${t}-item-disabled`,e)),{[`${t}-thumb-motion-appear-active`]:{transition:`transform ${e.motionDurationSlow} ${e.motionEaseInOut}, width ${e.motionDurationSlow} ${e.motionEaseInOut}`,willChange:"transform, width"},[`&${t}-shape-round`]:{borderRadius:9999,[`${t}-item, ${t}-thumb`]:{borderRadius:9999}}})}},Nt=e=>{const{colorTextLabel:t,colorText:a,colorFillSecondary:n,colorBgElevated:s,colorFill:r,lineWidthBold:g,colorBgLayout:l}=e;return{trackPadding:g,trackBg:l,itemColor:t,itemHoverColor:a,itemHoverBg:n,itemSelectedBg:s,itemActiveBg:r,itemSelectedColor:a}},Ot=Te("Segmented",e=>{const{lineWidth:t,calc:a}=e,n=De(e,{segmentedPaddingHorizontal:a(e.controlPaddingHorizontal).sub(t).equal(),segmentedPaddingHorizontalSM:a(e.controlPaddingHorizontalSM).sub(t).equal()});return[Mt(n)]},Nt);var Ne=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(a[n[s]]=e[n[s]]);return a};function zt(e){return typeof e=="object"&&!!(e!=null&&e.icon)}const Pt=c.forwardRef((e,t)=>{const a=nt(),{prefixCls:n,className:s,rootClassName:r,block:g,options:l=[],size:o="middle",style:u,vertical:h,shape:x="default",name:N=a}=e,y=Ne(e,["prefixCls","className","rootClassName","block","options","size","style","vertical","shape","name"]),{getPrefixCls:$,direction:z,className:P,style:R}=at("segmented"),f=$("segmented",n),[m,M,D]=Ot(f),p=Ae(o),v=c.useMemo(()=>l.map(w=>{if(zt(w)){const{icon:W,label:V}=w,k=Ne(w,["icon","label"]);return Object.assign(Object.assign({},k),{label:c.createElement(c.Fragment,null,c.createElement("span",{className:`${f}-item-icon`},W),V&&c.createElement("span",null,V))})}return w}),[l,f]),S=X(s,r,P,{[`${f}-block`]:g,[`${f}-sm`]:p==="small",[`${f}-lg`]:p==="large",[`${f}-vertical`]:h,[`${f}-shape-${x}`]:x==="round"},M,D),C=Object.assign(Object.assign({},R),u);return m(c.createElement(Ct,Object.assign({},y,{name:N,className:S,style:C,options:v,ref:t,prefixCls:f,direction:z,vertical:h})))}),Rt=Pt;var Et={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656zM340 683v77c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-77c-10.1 3.3-20.8 5-32 5s-21.9-1.8-32-5zm64-198V264c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v221c10.1-3.3 20.8-5 32-5s21.9 1.8 32 5zm-64 198c10.1 3.3 20.8 5 32 5s21.9-1.8 32-5c41.8-13.5 72-52.7 72-99s-30.2-85.5-72-99c-10.1-3.3-20.8-5-32-5s-21.9 1.8-32 5c-41.8 13.5-72 52.7-72 99s30.2 85.5 72 99zm.1-115.7c.3-.6.7-1.2 1-1.8v-.1l1.2-1.8c.1-.2.2-.3.3-.5.3-.5.7-.9 1-1.4.1-.1.2-.3.3-.4.5-.6.9-1.1 1.4-1.6l.3-.3 1.2-1.2.4-.4c.5-.5 1-.9 1.6-1.4.6-.5 1.1-.9 1.7-1.3.2-.1.3-.2.5-.3.5-.3.9-.7 1.4-1 .1-.1.3-.2.4-.3.6-.4 1.2-.7 1.9-1.1.1-.1.3-.1.4-.2.5-.3 1-.5 1.6-.8l.6-.3c.7-.3 1.3-.6 2-.8.7-.3 1.4-.5 2.1-.7.2-.1.4-.1.6-.2.6-.2 1.1-.3 1.7-.4.2 0 .3-.1.5-.1.7-.2 1.5-.3 2.2-.4.2 0 .3 0 .5-.1.6-.1 1.2-.1 1.8-.2h.6c.8 0 1.5-.1 2.3-.1s1.5 0 2.3.1h.6c.6 0 1.2.1 1.8.2.2 0 .3 0 .5.1.7.1 1.5.2 2.2.4.2 0 .3.1.5.1.6.1 1.2.3 1.7.4.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-.1-.2-.3-.3-.4-.4-.4-.7-.9-1-1.4-.1-.2-.2-.3-.3-.5l-1.2-1.8v-.1c-.4-.6-.7-1.2-1-1.8-2.6-5-4.1-10.7-4.1-16.7s1.5-11.7 4.1-16.7z"}}]},name:"control",theme:"outlined"},Ht={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.4 800.9c.2-.3.5-.6.7-.9C920.6 722.1 960 621.7 960 512s-39.4-210.1-104.8-288c-.2-.3-.5-.5-.7-.8-1.1-1.3-2.1-2.5-3.2-3.7-.4-.5-.8-.9-1.2-1.4l-4.1-4.7-.1-.1c-1.5-1.7-3.1-3.4-4.6-5.1l-.1-.1c-3.2-3.4-6.4-6.8-9.7-10.1l-.1-.1-4.8-4.8-.3-.3c-1.5-1.5-3-2.9-4.5-4.3-.5-.5-1-1-1.6-1.5-1-1-2-1.9-3-2.8-.3-.3-.7-.6-1-1C736.4 109.2 629.5 64 512 64s-224.4 45.2-304.3 119.2c-.3.3-.7.6-1 1-1 .9-2 1.9-3 2.9-.5.5-1 1-1.6 1.5-1.5 1.4-3 2.9-4.5 4.3l-.3.3-4.8 4.8-.1.1c-3.3 3.3-6.5 6.7-9.7 10.1l-.1.1c-1.6 1.7-3.1 3.4-4.6 5.1l-.1.1c-1.4 1.5-2.8 3.1-4.1 4.7-.4.5-.8.9-1.2 1.4-1.1 1.2-2.1 2.5-3.2 3.7-.2.3-.5.5-.7.8C103.4 301.9 64 402.3 64 512s39.4 210.1 104.8 288c.2.3.5.6.7.9l3.1 3.7c.4.5.8.9 1.2 1.4l4.1 4.7c0 .1.1.1.1.2 1.5 1.7 3 3.4 4.6 5l.1.1c3.2 3.4 6.4 6.8 9.6 10.1l.1.1c1.6 1.6 3.1 3.2 4.7 4.7l.3.3c3.3 3.3 6.7 6.5 10.1 9.6 80.1 74 187 119.2 304.5 119.2s224.4-45.2 304.3-119.2a300 300 0 0010-9.6l.3-.3c1.6-1.6 3.2-3.1 4.7-4.7l.1-.1c3.3-3.3 6.5-6.7 9.6-10.1l.1-.1c1.5-1.7 3.1-3.3 4.6-5 0-.1.1-.1.1-.2 1.4-1.5 2.8-3.1 4.1-4.7.4-.5.8-.9 1.2-1.4a99 99 0 003.3-3.7zm4.1-142.6c-13.8 32.6-32 62.8-54.2 90.2a444.07 444.07 0 00-81.5-55.9c11.6-46.9 18.8-98.4 20.7-152.6H887c-3 40.9-12.6 80.6-28.5 118.3zM887 484H743.5c-1.9-54.2-9.1-105.7-20.7-152.6 29.3-15.6 56.6-34.4 81.5-55.9A373.86 373.86 0 01887 484zM658.3 165.5c39.7 16.8 75.8 40 107.6 69.2a394.72 394.72 0 01-59.4 41.8c-15.7-45-35.8-84.1-59.2-115.4 3.7 1.4 7.4 2.9 11 4.4zm-90.6 700.6c-9.2 7.2-18.4 12.7-27.7 16.4V697a389.1 389.1 0 01115.7 26.2c-8.3 24.6-17.9 47.3-29 67.8-17.4 32.4-37.8 58.3-59 75.1zm59-633.1c11 20.6 20.7 43.3 29 67.8A389.1 389.1 0 01540 327V141.6c9.2 3.7 18.5 9.1 27.7 16.4 21.2 16.7 41.6 42.6 59 75zM540 640.9V540h147.5c-1.6 44.2-7.1 87.1-16.3 127.8l-.3 1.2A445.02 445.02 0 00540 640.9zm0-156.9V383.1c45.8-2.8 89.8-12.5 130.9-28.1l.3 1.2c9.2 40.7 14.7 83.5 16.3 127.8H540zm-56 56v100.9c-45.8 2.8-89.8 12.5-130.9 28.1l-.3-1.2c-9.2-40.7-14.7-83.5-16.3-127.8H484zm-147.5-56c1.6-44.2 7.1-87.1 16.3-127.8l.3-1.2c41.1 15.6 85 25.3 130.9 28.1V484H336.5zM484 697v185.4c-9.2-3.7-18.5-9.1-27.7-16.4-21.2-16.7-41.7-42.7-59.1-75.1-11-20.6-20.7-43.3-29-67.8 37.2-14.6 75.9-23.3 115.8-26.1zm0-370a389.1 389.1 0 01-115.7-26.2c8.3-24.6 17.9-47.3 29-67.8 17.4-32.4 37.8-58.4 59.1-75.1 9.2-7.2 18.4-12.7 27.7-16.4V327zM365.7 165.5c3.7-1.5 7.3-3 11-4.4-23.4 31.3-43.5 70.4-59.2 115.4-21-12-40.9-26-59.4-41.8 31.8-29.2 67.9-52.4 107.6-69.2zM165.5 365.7c13.8-32.6 32-62.8 54.2-90.2 24.9 21.5 52.2 40.3 81.5 55.9-11.6 46.9-18.8 98.4-20.7 152.6H137c3-40.9 12.6-80.6 28.5-118.3zM137 540h143.5c1.9 54.2 9.1 105.7 20.7 152.6a444.07 444.07 0 00-81.5 55.9A373.86 373.86 0 01137 540zm228.7 318.5c-39.7-16.8-75.8-40-107.6-69.2 18.5-15.8 38.4-29.7 59.4-41.8 15.7 45 35.8 84.1 59.2 115.4-3.7-1.4-7.4-2.9-11-4.4zm292.6 0c-3.7 1.5-7.3 3-11 4.4 23.4-31.3 43.5-70.4 59.2-115.4 21 12 40.9 26 59.4 41.8a373.81 373.81 0 01-107.6 69.2z"}}]},name:"global",theme:"outlined"},Tt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z"}}]},name:"info-circle",theme:"outlined"},Dt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"robot",theme:"outlined"},Vt=["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"],Le=c.forwardRef(function(e,t){var a,n=e.prefixCls,s=n===void 0?"rc-switch":n,r=e.className,g=e.checked,l=e.defaultChecked,o=e.disabled,u=e.loadingIcon,h=e.checkedChildren,x=e.unCheckedChildren,N=e.onClick,y=e.onChange,$=e.onKeyDown,z=Ee(e,Vt),P=fe(!1,{value:g,defaultValue:l}),R=B(P,2),f=R[0],m=R[1];function M(S,C){var w=f;return o||(w=S,m(w),y==null||y(w,C)),w}function D(S){S.which===we.LEFT?M(!1,S):S.which===we.RIGHT&&M(!0,S),$==null||$(S)}function p(S){var C=M(!f,S);N==null||N(C,S)}var v=X(s,r,(a={},L(a,"".concat(s,"-checked"),f),L(a,"".concat(s,"-disabled"),o),a));return c.createElement("button",de({},z,{type:"button",role:"switch","aria-checked":f,disabled:o,className:v,ref:t,onKeyDown:D,onClick:p}),u,c.createElement("span",{className:"".concat(s,"-inner")},c.createElement("span",{className:"".concat(s,"-inner-checked")},h),c.createElement("span",{className:"".concat(s,"-inner-unchecked")},x)))});Le.displayName="Switch";const qt=e=>{const{componentCls:t,trackHeightSM:a,trackPadding:n,trackMinWidthSM:s,innerMinMarginSM:r,innerMaxMarginSM:g,handleSizeSM:l,calc:o}=e,u=`${t}-inner`,h=I(o(l).add(o(n).mul(2)).equal()),x=I(o(g).mul(2).equal());return{[t]:{[`&${t}-small`]:{minWidth:s,height:a,lineHeight:I(a),[`${t}-inner`]:{paddingInlineStart:g,paddingInlineEnd:r,[`${u}-checked, ${u}-unchecked`]:{minHeight:a},[`${u}-checked`]:{marginInlineStart:`calc(-100% + ${h} - ${x})`,marginInlineEnd:`calc(100% - ${h} + ${x})`},[`${u}-unchecked`]:{marginTop:o(a).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`${t}-handle`]:{width:l,height:l},[`${t}-loading-icon`]:{top:o(o(l).sub(e.switchLoadingIconSize)).div(2).equal(),fontSize:e.switchLoadingIconSize},[`&${t}-checked`]:{[`${t}-inner`]:{paddingInlineStart:r,paddingInlineEnd:g,[`${u}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${u}-unchecked`]:{marginInlineStart:`calc(100% - ${h} + ${x})`,marginInlineEnd:`calc(-100% + ${h} - ${x})`}},[`${t}-handle`]:{insetInlineStart:`calc(100% - ${I(o(l).add(n).equal())})`}},[`&:not(${t}-disabled):active`]:{[`&:not(${t}-checked) ${u}`]:{[`${u}-unchecked`]:{marginInlineStart:o(e.marginXXS).div(2).equal(),marginInlineEnd:o(e.marginXXS).mul(-1).div(2).equal()}},[`&${t}-checked ${u}`]:{[`${u}-checked`]:{marginInlineStart:o(e.marginXXS).mul(-1).div(2).equal(),marginInlineEnd:o(e.marginXXS).div(2).equal()}}}}}}},At=e=>{const{componentCls:t,handleSize:a,calc:n}=e;return{[t]:{[`${t}-loading-icon${e.iconCls}`]:{position:"relative",top:n(n(a).sub(e.fontSize)).div(2).equal(),color:e.switchLoadingIconColor,verticalAlign:"top"},[`&${t}-checked ${t}-loading-icon`]:{color:e.switchColor}}}},Lt=e=>{const{componentCls:t,trackPadding:a,handleBg:n,handleShadow:s,handleSize:r,calc:g}=e,l=`${t}-handle`;return{[t]:{[l]:{position:"absolute",top:a,insetInlineStart:a,width:r,height:r,transition:`all ${e.switchDuration} ease-in-out`,"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:n,borderRadius:g(r).div(2).equal(),boxShadow:s,transition:`all ${e.switchDuration} ease-in-out`,content:'""'}},[`&${t}-checked ${l}`]:{insetInlineStart:`calc(100% - ${I(g(r).add(a).equal())})`},[`&:not(${t}-disabled):active`]:{[`${l}::before`]:{insetInlineEnd:e.switchHandleActiveInset,insetInlineStart:0},[`&${t}-checked ${l}::before`]:{insetInlineEnd:0,insetInlineStart:e.switchHandleActiveInset}}}}},Bt=e=>{const{componentCls:t,trackHeight:a,trackPadding:n,innerMinMargin:s,innerMaxMargin:r,handleSize:g,calc:l}=e,o=`${t}-inner`,u=I(l(g).add(l(n).mul(2)).equal()),h=I(l(r).mul(2).equal());return{[t]:{[o]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:r,paddingInlineEnd:s,transition:`padding-inline-start ${e.switchDuration} ease-in-out, padding-inline-end ${e.switchDuration} ease-in-out`,[`${o}-checked, ${o}-unchecked`]:{display:"block",color:e.colorTextLightSolid,fontSize:e.fontSizeSM,transition:`margin-inline-start ${e.switchDuration} ease-in-out, margin-inline-end ${e.switchDuration} ease-in-out`,pointerEvents:"none",minHeight:a},[`${o}-checked`]:{marginInlineStart:`calc(-100% + ${u} - ${h})`,marginInlineEnd:`calc(100% - ${u} + ${h})`},[`${o}-unchecked`]:{marginTop:l(a).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`&${t}-checked ${o}`]:{paddingInlineStart:s,paddingInlineEnd:r,[`${o}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${o}-unchecked`]:{marginInlineStart:`calc(100% - ${u} + ${h})`,marginInlineEnd:`calc(-100% + ${u} - ${h})`}},[`&:not(${t}-disabled):active`]:{[`&:not(${t}-checked) ${o}`]:{[`${o}-unchecked`]:{marginInlineStart:l(n).mul(2).equal(),marginInlineEnd:l(n).mul(-1).mul(2).equal()}},[`&${t}-checked ${o}`]:{[`${o}-checked`]:{marginInlineStart:l(n).mul(-1).mul(2).equal(),marginInlineEnd:l(n).mul(2).equal()}}}}}},Ft=e=>{const{componentCls:t,trackHeight:a,trackMinWidth:n}=e;return{[t]:Object.assign(Object.assign(Object.assign(Object.assign({},Ve(e)),{position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:n,height:a,lineHeight:I(a),verticalAlign:"middle",background:e.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${e.motionDurationMid}`,userSelect:"none",[`&:hover:not(${t}-disabled)`]:{background:e.colorTextTertiary}}),qe(e)),{[`&${t}-checked`]:{background:e.switchColor,[`&:hover:not(${t}-disabled)`]:{background:e.colorPrimaryHover}},[`&${t}-loading, &${t}-disabled`]:{cursor:"not-allowed",opacity:e.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${t}-rtl`]:{direction:"rtl"}})}},Wt=e=>{const{fontSize:t,lineHeight:a,controlHeight:n,colorWhite:s}=e,r=t*a,g=n/2,l=2,o=r-l*2,u=g-l*2;return{trackHeight:r,trackHeightSM:g,trackMinWidth:o*2+l*4,trackMinWidthSM:u*2+l*2,trackPadding:l,handleBg:s,handleSize:o,handleSizeSM:u,handleShadow:`0 2px 4px 0 ${new it("#00230b").setA(.2).toRgbString()}`,innerMinMargin:o/2,innerMaxMargin:o+l+l*2,innerMinMarginSM:u/2,innerMaxMarginSM:u+l+l*2}},kt=Te("Switch",e=>{const t=De(e,{switchDuration:e.motionDurationMid,switchColor:e.colorPrimary,switchDisabledOpacity:e.opacityLoading,switchLoadingIconSize:e.calc(e.fontSizeIcon).mul(.75).equal(),switchLoadingIconColor:`rgba(0, 0, 0, ${e.opacityLoading})`,switchHandleActiveInset:"-30%"});return[Ft(t),Bt(t),Lt(t),At(t),qt(t)]},Wt);var Kt=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(a[n[s]]=e[n[s]]);return a};const _t=c.forwardRef((e,t)=>{const{prefixCls:a,size:n,disabled:s,loading:r,className:g,rootClassName:l,style:o,checked:u,value:h,defaultChecked:x,defaultValue:N,onChange:y}=e,$=Kt(e,["prefixCls","size","disabled","loading","className","rootClassName","style","checked","value","defaultChecked","defaultValue","onChange"]),[z,P]=fe(!1,{value:u??h,defaultValue:x??N}),{getPrefixCls:R,direction:f,switch:m}=c.useContext(st),M=c.useContext(lt),D=(s??M)||r,p=R("switch",a),v=c.createElement("div",{className:`${p}-handle`},r&&c.createElement(rt,{className:`${p}-loading-icon`})),[S,C,w]=kt(p),W=Ae(n),V=X(m==null?void 0:m.className,{[`${p}-small`]:W==="small",[`${p}-loading`]:r,[`${p}-rtl`]:f==="rtl"},g,l,C,w),k=Object.assign(Object.assign({},m==null?void 0:m.style),o),b=(...E)=>{P(E[0]),y==null||y.apply(void 0,E)};return S(c.createElement(ot,{component:"Switch"},c.createElement(Le,Object.assign({},$,{checked:z,onChange:b,prefixCls:p,className:V,style:k,disabled:D,ref:t,loadingIcon:v}))))}),Be=_t;Be.__ANT_SWITCH=!0;function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},ue.apply(this,arguments)}const Xt=(e,t)=>c.createElement(ae,ue({},e,{ref:t,icon:Et})),Gt=c.forwardRef(Xt);function he(){return he=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},he.apply(this,arguments)}const Ut=(e,t)=>c.createElement(ae,he({},e,{ref:t,icon:Ht})),Jt=c.forwardRef(Ut);function me(){return me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},me.apply(this,arguments)}const Yt=(e,t)=>c.createElement(ae,me({},e,{ref:t,icon:Tt})),_=c.forwardRef(Yt);function ve(){return ve=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},ve.apply(this,arguments)}const Qt=(e,t)=>c.createElement(ae,ve({},e,{ref:t,icon:Dt})),Zt=c.forwardRef(Qt),Oe=e=>J.get(`/settings?scope=${e}`),re=(e,t,a)=>J.post("/settings",{scope:e,key:t,value:a}),ze=(e,t)=>J.delete(`/settings?scope=${e}&key=${t}`),ee=()=>J.get("/settings/effective"),en=()=>J.get("/settings/models"),tn=()=>J.get("/settings/plugins"),d=ct({settings:{currentScope:"project",globalSettings:{},projectSettings:{},effectiveSettings:{language:"English",quiet:!1,approvalMode:"suggest",plugins:[]},availableModels:[],availablePlugins:[],loading:!1,loaded:!1,hasUnsavedChanges:!1}}),G={switchScope:e=>{d.settings.currentScope=e},loadSettings:async()=>{if(!d.settings.loading){d.settings.loading=!0;try{const[e,t,a,n,s]=await Promise.all([Oe("global"),Oe("project"),ee(),en(),tn()]);d.settings.globalSettings=e.data||{},d.settings.projectSettings=t.data||{},d.settings.effectiveSettings=a.data||d.settings.effectiveSettings,d.settings.availableModels=n.data||[],d.settings.availablePlugins=s.data||[],d.settings.loading=!1,d.settings.loaded=!0}catch(e){throw console.error("Failed to load settings:",e),d.settings.loading=!1,e}}},updateSettingValue:async(e,t)=>{const{currentScope:a}=d.settings;if(a==="global")if(t==null){const{[e]:n,...s}=d.settings.globalSettings;d.settings.globalSettings=s}else d.settings.globalSettings={...d.settings.globalSettings,[e]:t};else if(t==null){const{[e]:n,...s}=d.settings.projectSettings;d.settings.projectSettings=s}else d.settings.projectSettings={...d.settings.projectSettings,[e]:t};try{t==null?await ze(a,e):await re(a,e,t);const n=await ee();d.settings.effectiveSettings=n.data||d.settings.effectiveSettings}catch(n){console.error("Failed to save settings:",n)}},addPlugin:async e=>{const{currentScope:t}=d.settings,a=t==="global"?d.settings.globalSettings.plugins||[]:d.settings.projectSettings.plugins||[];if(!a.includes(e)){const n=[...a,e];t==="global"?d.settings.globalSettings={...d.settings.globalSettings,plugins:n}:d.settings.projectSettings={...d.settings.projectSettings,plugins:n};try{await re(t,"plugins",n);const s=await ee();d.settings.effectiveSettings=s.data||d.settings.effectiveSettings}catch(s){throw console.error("Failed to add plugin:",s),s}}},removePlugin:async e=>{const{currentScope:t}=d.settings,n=(t==="global"?d.settings.globalSettings.plugins||[]:d.settings.projectSettings.plugins||[]).filter(s=>s!==e);if(t==="global")if(n.length===0){const{plugins:s,...r}=d.settings.globalSettings;d.settings.globalSettings=r}else d.settings.globalSettings={...d.settings.globalSettings,plugins:n};else if(n.length===0){const{plugins:s,...r}=d.settings.projectSettings;d.settings.projectSettings=r}else d.settings.projectSettings={...d.settings.projectSettings,plugins:n};try{n.length===0?await ze(t,"plugins"):await re(t,"plugins",n);const s=await ee();d.settings.effectiveSettings=s.data||d.settings.effectiveSettings}catch(s){throw console.error("Failed to remove plugin:",s),s}}},{Text:nn}=ie,an=()=>{const{t:e,i18n:t}=Q(),{settings:a}=Z(d),n=a.currentScope==="global"?a.globalSettings:a.projectSettings,s=async(l,o)=>{try{await G.updateSettingValue(l,o)}catch(u){console.error("Failed to update behavior setting:",u)}},r=async l=>{try{const o=l==="Chinese"?"zh":"en";await t.changeLanguage(o),await G.updateSettingValue("language",l)}catch(o){console.error("Failed to update language setting:",o)}},g=l=>{switch(l){case"suggest":return e("settings.behavior.approvalModes.suggest");case"auto-edit":return e("settings.behavior.approvalModes.autoEdit");case"full-auto":return e("settings.behavior.approvalModes.fullAuto");default:return l}};return i.jsxs(T,{layout:"vertical",children:[i.jsx(T.Item,{label:i.jsxs("div",{className:"flex items-center gap-2",children:[e("settings.behavior.language"),i.jsx(F,{title:e("settings.behavior.languageTooltip"),children:i.jsx(_,{className:"text-gray-500"})})]}),children:i.jsx(Y,{value:n.language,onChange:r,options:[{value:"English",label:"English"},{value:"Chinese",label:"简体中文"}],placeholder:a.effectiveSettings.language?`${e("settings.model.defaultPrefix")}: ${a.effectiveSettings.language}`:e("settings.behavior.languagePlaceholder"),allowClear:!0})}),i.jsx(T.Item,{label:i.jsxs("div",{className:"flex items-center gap-2",children:[e("settings.behavior.approvalMode"),i.jsx(F,{title:e("settings.behavior.approvalModeTooltip"),children:i.jsx(_,{className:"text-gray-500"})})]}),children:i.jsx(Y,{value:n.approvalMode,onChange:l=>s("approvalMode",l),options:[{value:"suggest",label:e("settings.behavior.approvalModeLabels.suggest")},{value:"auto-edit",label:e("settings.behavior.approvalModeLabels.autoEdit")},{value:"full-auto",label:e("settings.behavior.approvalModeLabels.fullAuto")}],placeholder:a.effectiveSettings.approvalMode?`${e("settings.model.defaultPrefix")}: ${g(a.effectiveSettings.approvalMode)}`:e("settings.behavior.approvalModePlaceholder"),allowClear:!0})}),i.jsx(T.Item,{label:i.jsxs("div",{className:"flex items-center gap-2",children:[e("settings.behavior.quiet"),i.jsx(F,{title:e("settings.behavior.quietTooltip"),children:i.jsx(_,{className:"text-gray-500"})})]}),children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Be,{checked:n.quiet,onChange:l=>s("quiet",l)}),i.jsx(nn,{children:n.quiet!==void 0?n.quiet?e("settings.behavior.enabled"):e("settings.behavior.disabled"):`${e("settings.model.defaultPrefix")}: ${a.effectiveSettings.quiet?e("settings.behavior.enabled"):e("settings.behavior.disabled")}`})]})})]})},sn=()=>{const{t:e}=Q(),{settings:t}=Z(d),a=t.currentScope==="global"?t.globalSettings:t.projectSettings,n=async(g,l)=>{try{await G.updateSettingValue(g,l)}catch(o){console.error("Failed to update model setting:",o)}},s=()=>t.availableModels.map(g=>{const l=`${g.key}(${g.value})`;return{value:g.key,label:i.jsx(F,{title:l,placement:"right",children:i.jsx("div",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:l})})}}),r=(g,l)=>{if(!l)return!1;const o=t.availableModels.find(h=>h.key===l.value);return o?`${o.key}(${o.value})`.toLowerCase().includes(g.toLowerCase()):!1};return i.jsxs(T,{layout:"vertical",children:[i.jsx(T.Item,{label:i.jsxs("div",{className:"flex items-center gap-2",children:[e("settings.model.main"),i.jsx(F,{title:e("settings.model.mainTooltip"),children:i.jsx(_,{className:"text-gray-500"})})]}),children:i.jsx(Y,{value:a.model,onChange:g=>n("model",g),options:s(),placeholder:t.effectiveSettings.model?`${e("settings.model.defaultPrefix")}: ${t.effectiveSettings.model}`:e("settings.model.mainPlaceholder"),allowClear:!0,showSearch:!0,filterOption:r})}),i.jsx(T.Item,{label:i.jsxs("div",{className:"flex items-center gap-2",children:[e("settings.model.small"),i.jsx(F,{title:e("settings.model.smallTooltip"),children:i.jsx(_,{className:"text-gray-500"})})]}),children:i.jsx(Y,{value:a.smallModel,onChange:g=>n("smallModel",g),options:s(),placeholder:t.effectiveSettings.smallModel?`${e("settings.model.defaultPrefix")}: ${t.effectiveSettings.smallModel}`:e("settings.model.smallPlaceholder"),allowClear:!0,showSearch:!0,filterOption:r})}),i.jsx(T.Item,{label:i.jsxs("div",{className:"flex items-center gap-2",children:[e("settings.model.plan"),i.jsx(F,{title:e("settings.model.planTooltip"),children:i.jsx(_,{className:"text-gray-500"})})]}),children:i.jsx(Y,{value:a.planModel,onChange:g=>n("planModel",g),options:s(),placeholder:t.effectiveSettings.planModel?`${e("settings.model.defaultPrefix")}: ${t.effectiveSettings.planModel}`:e("settings.model.planPlaceholder"),allowClear:!0,showSearch:!0,filterOption:r})})]})},{Text:ce}=ie,ln=()=>{const{t:e}=Q(),{settings:t}=Z(d),[a,n]=c.useState(""),r=(t.currentScope==="global"?t.globalSettings:t.projectSettings).plugins||[],g=async()=>{if(a.trim())try{await G.addPlugin(a.trim()),n("")}catch(o){console.error("Failed to add plugin:",o)}},l=o=>{try{G.removePlugin(o)}catch(u){console.error("Failed to remove plugin:",u)}};return i.jsx(T,{layout:"vertical",children:i.jsx(T.Item,{label:i.jsxs("div",{className:"flex items-center gap-2",children:[e("settings.plugins.title"),i.jsx(F,{title:e("settings.plugins.tooltip"),children:i.jsx(_,{className:"text-gray-500"})})]}),children:i.jsxs(je,{direction:"vertical",className:"w-full",size:"middle",children:[i.jsxs(je.Compact,{className:"w-full",children:[i.jsx(mt,{value:a,onChange:o=>n(o.target.value),placeholder:e("settings.plugins.placeholder"),onPressEnter:g}),i.jsx(ge,{type:"primary",icon:i.jsx(dt,{}),onClick:g,children:e("settings.plugins.add")})]}),r.length>0?i.jsx(ye,{size:"small",dataSource:[...r],renderItem:o=>i.jsx(ye.Item,{actions:[i.jsx(ge,{type:"text",size:"small",icon:i.jsx(gt,{}),onClick:()=>l(o),danger:!0},"delete")],children:i.jsx(ce,{code:!0,children:o})})}):i.jsx(ce,{type:"secondary",children:e("settings.plugins.empty")}),t.effectiveSettings.plugins&&JSON.stringify(t.effectiveSettings.plugins)!==JSON.stringify(r)&&i.jsxs(ce,{type:"secondary",className:"text-xs",children:[e("settings.plugins.effective"),":"," ",[...t.effectiveSettings.plugins||[]].join(", ")||e("settings.plugins.none")]})]})})})},{Text:Pe}=ie,on=()=>{const{t:e}=Q(),{settings:t}=Z(d);return i.jsx(te,{className:"border border-gray-200",children:i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsxs("div",{children:[i.jsx(Pe,{strong:!0,children:e("settings.scope.title")}),i.jsx("div",{className:"mt-1",children:i.jsx(Pe,{type:"secondary",className:"text-xs",children:t.currentScope==="global"?e("settings.scope.globalDesc"):e("settings.scope.projectDesc")})})]}),i.jsx(Rt,{value:t.currentScope,onChange:a=>G.switchScope(a),options:[{label:i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(Jt,{}),e("settings.scope.global")]}),value:"global"},{label:i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(vt,{}),e("settings.scope.project")]}),value:"project"}]})]})})},{Text:rn}=ie,cn=()=>{const{t:e}=Q(),{settings:t}=Z(d),a=ut();c.useEffect(()=>{!t.loaded&&!t.loading&&G.loadSettings()},[t.loaded,t.loading]);const n=()=>{a({to:"/chat"})};return t.loading?i.jsxs("div",{className:"flex justify-center items-center h-[50vh] flex-col gap-4",children:[i.jsx(ht,{size:"large"}),i.jsx(rn,{type:"secondary",children:e("settings.loading")})]}):i.jsx("div",{className:"h-full w-full box-border flex flex-col py-6 gap-4",children:i.jsx("div",{className:"flex-1 overflow-auto",children:i.jsx("div",{className:"h-full",style:{paddingInline:"calc(calc(100% - 700px) / 2)"},children:i.jsxs("div",{className:"bg-white border border-gray-200 rounded-lg flex flex-col h-full",children:[i.jsxs("div",{className:"px-4 py-3 border-b border-gray-100 flex justify-between items-center flex-shrink-0",children:[i.jsx("div",{className:"text-base font-medium",children:e("settings.title")}),i.jsx(ge,{type:"text",icon:i.jsx(ft,{}),onClick:n,size:"small"})]}),i.jsx("div",{className:"flex-1 p-4 overflow-x-hidden overflow-y-auto min-h-0",children:i.jsxs("div",{className:"w-full",children:[i.jsx("div",{className:"mb-4",children:i.jsx(on,{})}),i.jsxs(pt,{gutter:[16,16],children:[i.jsx(oe,{xs:24,lg:12,children:i.jsx(te,{title:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Zt,{}),i.jsx("span",{children:e("settings.model.title")})]}),className:"h-fit border border-gray-200 [&_.ant-card-body]:p-4",children:i.jsx(sn,{})})}),i.jsx(oe,{xs:24,lg:12,children:i.jsx(te,{title:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Gt,{}),i.jsx("span",{children:e("settings.behavior.title")})]}),className:"h-fit border border-gray-200 [&_.ant-card-body]:p-4",children:i.jsx(an,{})})}),i.jsx(oe,{xs:24,children:i.jsx(te,{title:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(bt,{}),i.jsx("span",{children:e("settings.plugins.title")})]}),className:"border border-gray-200 [&_.ant-card-body]:p-4",children:i.jsx(ln,{})})})]})]})})]})})})})},un=cn;export{un as component};