nextclaw 0.9.21 → 0.9.23
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/cli/index.js +79 -10
- package/package.json +5 -5
- package/templates/USAGE.md +16 -5
- package/ui-dist/assets/ChannelsList-DBDjwf-X.js +1 -0
- package/ui-dist/assets/{ChatPage-DIx05c6s.js → ChatPage-C18sGGk1.js} +1 -1
- package/ui-dist/assets/DocBrowser-ZOplDEMS.js +1 -0
- package/ui-dist/assets/LogoBadge-2LMzEMwe.js +1 -0
- package/ui-dist/assets/{MarketplacePage-BOzko5s9.js → MarketplacePage-D4JHYcB5.js} +2 -2
- package/ui-dist/assets/ModelConfig-DZVvdLFq.js +1 -0
- package/ui-dist/assets/ProvidersList-Dum31480.js +1 -0
- package/ui-dist/assets/{RuntimeConfig-Dt9pLB9P.js → RuntimeConfig-4sb3mpkd.js} +1 -1
- package/ui-dist/assets/SearchConfig-B4u_MxRG.js +1 -0
- package/ui-dist/assets/{SecretsConfig-C1PU0Yy8.js → SecretsConfig-BQXblZvb.js} +2 -2
- package/ui-dist/assets/SessionsConfig-Jk29xjQU.js +2 -0
- package/ui-dist/assets/{card-C7Gtw2Vs.js → card-BekAnCgX.js} +1 -1
- package/ui-dist/assets/config-layout-BHnOoweL.js +1 -0
- package/ui-dist/assets/{index-nEYGCJTC.css → index-BXwjfCEO.css} +1 -1
- package/ui-dist/assets/index-Dl6t70wA.js +8 -0
- package/ui-dist/assets/{input-oBvxsnV9.js → input-MMn_Na9q.js} +1 -1
- package/ui-dist/assets/{label-C7F8lMpQ.js → label-Dg2ydpN0.js} +1 -1
- package/ui-dist/assets/{page-layout-DO8BlScF.js → page-layout-7K0rcz0I.js} +1 -1
- package/ui-dist/assets/{session-run-status-Kg0FwAPn.js → session-run-status-CAdjSqeb.js} +1 -1
- package/ui-dist/assets/{switch-C6a5GyZB.js → switch-DnDMlDVu.js} +1 -1
- package/ui-dist/assets/{tabs-custom-BatFap5k.js → tabs-custom-khLM8lWj.js} +1 -1
- package/ui-dist/assets/{useConfirmDialog-zJzVKMdu.js → useConfirmDialog-BYA1XnVU.js} +1 -1
- package/ui-dist/assets/{vendor-TlME1INH.js → vendor-d7E8OgNx.js} +1 -1
- package/ui-dist/index.html +3 -3
- package/ui-dist/assets/ChannelsList-C49JQ-Zt.js +0 -1
- package/ui-dist/assets/DocBrowser-CpOosDEI.js +0 -1
- package/ui-dist/assets/LogoBadge-CL_8ZPXU.js +0 -1
- package/ui-dist/assets/ModelConfig-BZ4ZfaQB.js +0 -1
- package/ui-dist/assets/ProvidersList-fPpJ5gl6.js +0 -1
- package/ui-dist/assets/SessionsConfig-EskBOofQ.js +0 -2
- package/ui-dist/assets/index-Cn6_2To7.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as i,an as b,aY as w,ah as ie,j as s,aj as j,am as le,ao as h,ap as D,aq as ce,ar as de,as as ue,au as fe,av as ge,aw as me,at as pe,aZ as ve,aE as xe}from"./vendor-
|
|
1
|
+
import{r as i,an as b,aY as w,ah as ie,j as s,aj as j,am as le,ao as h,ap as D,aq as ce,ar as de,as as ue,au as fe,av as ge,aw as me,at as pe,aZ as ve,aE as xe}from"./vendor-d7E8OgNx.js";import{c as N,t as x}from"./index-Dl6t70wA.js";import{B as I}from"./page-layout-7K0rcz0I.js";function Ne(e,t){return i.useReducer((o,a)=>t[o][a]??o,e)}var E=e=>{const{present:t,children:o}=e,a=De(t),r=typeof o=="function"?o({present:a.isPresent}):i.Children.only(o),n=b(a.ref,he(r));return typeof o=="function"||a.isPresent?i.cloneElement(r,{ref:n}):null};E.displayName="Presence";function De(e){const[t,o]=i.useState(),a=i.useRef(null),r=i.useRef(e),n=i.useRef("none"),l=e?"mounted":"unmounted",[c,u]=Ne(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const d=y(a.current);n.current=c==="mounted"?d:"none"},[c]),w(()=>{const d=a.current,f=r.current;if(f!==e){const C=n.current,p=y(d);e?u("MOUNT"):p==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(f&&C!==p?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,u]),w(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,m=p=>{const re=y(a.current).includes(CSS.escape(p.animationName));if(p.target===t&&re&&(u("ANIMATION_END"),!r.current)){const se=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=se)})}},C=p=>{p.target===t&&(n.current=y(a.current))};return t.addEventListener("animationstart",C),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",C),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:i.useCallback(d=>{a.current=d?getComputedStyle(d):null,o(d)},[])}}function y(e){return(e==null?void 0:e.animationName)||"none"}function he(e){var a,r;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,o=t&&"isReactWarning"in t&&t.isReactWarning;return o?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,o=t&&"isReactWarning"in t&&t.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}var O="Dialog",[M]=ce(O),[Ce,g]=M(O),T=e=>{const{__scopeDialog:t,children:o,open:a,defaultOpen:r,onOpenChange:n,modal:l=!0}=e,c=i.useRef(null),u=i.useRef(null),[d,f]=ie({prop:a,defaultProp:r??!1,onChange:n,caller:O});return s.jsx(Ce,{scope:t,triggerRef:c,contentRef:u,contentId:j(),titleId:j(),descriptionId:j(),open:d,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(m=>!m),[f]),modal:l,children:o})};T.displayName=O;var S="DialogTrigger",ye=i.forwardRef((e,t)=>{const{__scopeDialog:o,...a}=e,r=g(S,o),n=b(t,r.triggerRef);return s.jsx(h.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":_(r.open),...a,ref:n,onClick:D(e.onClick,r.onOpenToggle)})});ye.displayName=S;var A="DialogPortal",[Re,F]=M(A,{forceMount:void 0}),L=e=>{const{__scopeDialog:t,forceMount:o,children:a,container:r}=e,n=g(A,t);return s.jsx(Re,{scope:t,forceMount:o,children:i.Children.map(a,l=>s.jsx(E,{present:o||n.open,children:s.jsx(le,{asChild:!0,container:r,children:l})}))})};L.displayName=A;var R="DialogOverlay",W=i.forwardRef((e,t)=>{const o=F(R,e.__scopeDialog),{forceMount:a=o.forceMount,...r}=e,n=g(R,e.__scopeDialog);return n.modal?s.jsx(E,{present:a||n.open,children:s.jsx(Ee,{...r,ref:t})}):null});W.displayName=R;var be=pe("DialogOverlay.RemoveScroll"),Ee=i.forwardRef((e,t)=>{const{__scopeDialog:o,...a}=e,r=g(R,o);return s.jsx(ue,{as:be,allowPinchZoom:!0,shards:[r.contentRef],children:s.jsx(h.div,{"data-state":_(r.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),v="DialogContent",k=i.forwardRef((e,t)=>{const o=F(v,e.__scopeDialog),{forceMount:a=o.forceMount,...r}=e,n=g(v,e.__scopeDialog);return s.jsx(E,{present:a||n.open,children:n.modal?s.jsx(Oe,{...r,ref:t}):s.jsx(je,{...r,ref:t})})});k.displayName=v;var Oe=i.forwardRef((e,t)=>{const o=g(v,e.__scopeDialog),a=i.useRef(null),r=b(t,o.contentRef,a);return i.useEffect(()=>{const n=a.current;if(n)return de(n)},[]),s.jsx(U,{...e,ref:r,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:D(e.onCloseAutoFocus,n=>{var l;n.preventDefault(),(l=o.triggerRef.current)==null||l.focus()}),onPointerDownOutside:D(e.onPointerDownOutside,n=>{const l=n.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&n.preventDefault()}),onFocusOutside:D(e.onFocusOutside,n=>n.preventDefault())})}),je=i.forwardRef((e,t)=>{const o=g(v,e.__scopeDialog),a=i.useRef(!1),r=i.useRef(!1);return s.jsx(U,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:n=>{var l,c;(l=e.onCloseAutoFocus)==null||l.call(e,n),n.defaultPrevented||(a.current||(c=o.triggerRef.current)==null||c.focus(),n.preventDefault()),a.current=!1,r.current=!1},onInteractOutside:n=>{var u,d;(u=e.onInteractOutside)==null||u.call(e,n),n.defaultPrevented||(a.current=!0,n.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const l=n.target;((d=o.triggerRef.current)==null?void 0:d.contains(l))&&n.preventDefault(),n.detail.originalEvent.type==="focusin"&&r.current&&n.preventDefault()}})}),U=i.forwardRef((e,t)=>{const{__scopeDialog:o,trapFocus:a,onOpenAutoFocus:r,onCloseAutoFocus:n,...l}=e,c=g(v,o),u=i.useRef(null),d=b(t,u);return fe(),s.jsxs(s.Fragment,{children:[s.jsx(ge,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:r,onUnmountAutoFocus:n,children:s.jsx(me,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":_(c.open),...l,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(Ae,{titleId:c.titleId}),s.jsx(_e,{contentRef:u,descriptionId:c.descriptionId})]})]})}),P="DialogTitle",$=i.forwardRef((e,t)=>{const{__scopeDialog:o,...a}=e,r=g(P,o);return s.jsx(h.h2,{id:r.titleId,...a,ref:t})});$.displayName=P;var G="DialogDescription",B=i.forwardRef((e,t)=>{const{__scopeDialog:o,...a}=e,r=g(G,o);return s.jsx(h.p,{id:r.descriptionId,...a,ref:t})});B.displayName=G;var z="DialogClose",H=i.forwardRef((e,t)=>{const{__scopeDialog:o,...a}=e,r=g(z,o);return s.jsx(h.button,{type:"button",...a,ref:t,onClick:D(e.onClick,()=>r.onOpenChange(!1))})});H.displayName=z;function _(e){return e?"open":"closed"}var V="DialogTitleWarning",[$e,q]=ve(V,{contentName:v,titleName:P,docsSlug:"dialog"}),Ae=({titleId:e})=>{const t=q(V),o=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
2
2
|
|
|
3
3
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
4
4
|
|
|
@@ -399,4 +399,4 @@ Please change the parent <Route path="${R}"> to <Route path="${R==="/"?"*":`${R}
|
|
|
399
399
|
`)},Yh=function(){var n=parseInt(document.body.getAttribute(ei)||"0",10);return isFinite(n)?n:0},iC=function(){g.useEffect(function(){return document.body.setAttribute(ei,(Yh()+1).toString()),function(){var n=Yh()-1;n<=0?document.body.removeAttribute(ei):document.body.setAttribute(ei,n.toString())}},[])},sC=function(n){var r=n.noRelative,i=n.noImportant,l=n.gapMode,a=l===void 0?"margin":l;iC();var c=g.useMemo(function(){return nC(a)},[a]);return g.createElement(rC,{styles:oC(c,!r,a,i?"":"!important")})},jc=!1;if(typeof window<"u")try{var $l=Object.defineProperty({},"passive",{get:function(){return jc=!0,!0}});window.addEventListener("test",$l,$l),window.removeEventListener("test",$l,$l)}catch{jc=!1}var Go=jc?{passive:!1}:!1,lC=function(n){return n.tagName==="TEXTAREA"},Dv=function(n,r){if(!(n instanceof Element))return!1;var i=window.getComputedStyle(n);return i[r]!=="hidden"&&!(i.overflowY===i.overflowX&&!lC(n)&&i[r]==="visible")},aC=function(n){return Dv(n,"overflowY")},uC=function(n){return Dv(n,"overflowX")},qh=function(n,r){var i=r.ownerDocument,l=r;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var a=Fv(n,l);if(a){var c=zv(n,l),f=c[1],p=c[2];if(f>p)return!0}l=l.parentNode}while(l&&l!==i.body);return!1},cC=function(n){var r=n.scrollTop,i=n.scrollHeight,l=n.clientHeight;return[r,i,l]},dC=function(n){var r=n.scrollLeft,i=n.scrollWidth,l=n.clientWidth;return[r,i,l]},Fv=function(n,r){return n==="v"?aC(r):uC(r)},zv=function(n,r){return n==="v"?cC(r):dC(r)},fC=function(n,r){return n==="h"&&r==="rtl"?-1:1},pC=function(n,r,i,l,a){var c=fC(n,window.getComputedStyle(r).direction),f=c*l,p=i.target,h=r.contains(p),v=!1,w=f>0,x=0,E=0;do{if(!p)break;var y=zv(n,p),O=y[0],S=y[1],C=y[2],P=S-C-c*O;(O||P)&&Fv(n,p)&&(x+=P,E+=O);var M=p.parentNode;p=M&&M.nodeType===Node.DOCUMENT_FRAGMENT_NODE?M.host:M}while(!h&&p!==document.body||h&&(r.contains(p)||r===p));return(w&&Math.abs(x)<1||!w&&Math.abs(E)<1)&&(v=!0),v},Wl=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},Gh=function(n){return[n.deltaX,n.deltaY]},Xh=function(n){return n&&"current"in n?n.current:n},hC=function(n,r){return n[0]===r[0]&&n[1]===r[1]},mC=function(n){return`
|
|
400
400
|
.block-interactivity-`.concat(n,` {pointer-events: none;}
|
|
401
401
|
.allow-interactivity-`).concat(n,` {pointer-events: all;}
|
|
402
|
-
`)},vC=0,Xo=[];function yC(n){var r=g.useRef([]),i=g.useRef([0,0]),l=g.useRef(),a=g.useState(vC++)[0],c=g.useState(Av)[0],f=g.useRef(n);g.useEffect(function(){f.current=n},[n]),g.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(a));var S=z2([n.lockRef.current],(n.shards||[]).map(Xh),!0).filter(Boolean);return S.forEach(function(C){return C.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),S.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(a))})}}},[n.inert,n.lockRef.current,n.shards]);var p=g.useCallback(function(S,C){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!f.current.allowPinchZoom;var P=Wl(S),M=i.current,R="deltaX"in S?S.deltaX:M[0]-P[0],L="deltaY"in S?S.deltaY:M[1]-P[1],z,U=S.target,H=Math.abs(R)>Math.abs(L)?"h":"v";if("touches"in S&&H==="h"&&U.type==="range")return!1;var Y=window.getSelection(),Z=Y&&Y.anchorNode,te=Z?Z===U||Z.contains(U):!1;if(te)return!1;var he=qh(H,U);if(!he)return!0;if(he?z=H:(z=H==="v"?"h":"v",he=qh(H,U)),!he)return!1;if(!l.current&&"changedTouches"in S&&(R||L)&&(l.current=z),!z)return!0;var X=l.current||z;return pC(X,C,S,X==="h"?R:L)},[]),h=g.useCallback(function(S){var C=S;if(!(!Xo.length||Xo[Xo.length-1]!==c)){var P="deltaY"in C?Gh(C):Wl(C),M=r.current.filter(function(z){return z.name===C.type&&(z.target===C.target||C.target===z.shadowParent)&&hC(z.delta,P)})[0];if(M&&M.should){C.cancelable&&C.preventDefault();return}if(!M){var R=(f.current.shards||[]).map(Xh).filter(Boolean).filter(function(z){return z.contains(C.target)}),L=R.length>0?p(C,R[0]):!f.current.noIsolation;L&&C.cancelable&&C.preventDefault()}}},[]),v=g.useCallback(function(S,C,P,M){var R={name:S,delta:C,target:P,should:M,shadowParent:gC(P)};r.current.push(R),setTimeout(function(){r.current=r.current.filter(function(L){return L!==R})},1)},[]),w=g.useCallback(function(S){i.current=Wl(S),l.current=void 0},[]),x=g.useCallback(function(S){v(S.type,Gh(S),S.target,p(S,n.lockRef.current))},[]),E=g.useCallback(function(S){v(S.type,Wl(S),S.target,p(S,n.lockRef.current))},[]);g.useEffect(function(){return Xo.push(c),n.setCallbacks({onScrollCapture:x,onWheelCapture:x,onTouchMoveCapture:E}),document.addEventListener("wheel",h,Go),document.addEventListener("touchmove",h,Go),document.addEventListener("touchstart",w,Go),function(){Xo=Xo.filter(function(S){return S!==c}),document.removeEventListener("wheel",h,Go),document.removeEventListener("touchmove",h,Go),document.removeEventListener("touchstart",w,Go)}},[]);var y=n.removeScrollBar,O=n.inert;return g.createElement(g.Fragment,null,O?g.createElement(c,{styles:mC(a)}):null,y?g.createElement(sC,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function gC(n){for(var r=null;n!==null;)n instanceof ShadowRoot&&(r=n.host,n=n.host),n=n.parentNode;return r}const wC=K2(Iv,yC);var jv=g.forwardRef(function(n,r){return g.createElement(fa,Ln({},n,{ref:r,sideCar:wC}))});jv.classNames=fa.classNames;var xC=[" ","Enter","ArrowUp","ArrowDown"],SC=[" ","Enter"],xo="Select",[pa,ha,CC]=Ax(xo),[Si]=sd(xo,[CC,wv]),ma=wv(),[EC,$r]=Si(xo),[kC,bC]=Si(xo),Bv=n=>{const{__scopeSelect:r,children:i,open:l,defaultOpen:a,onOpenChange:c,value:f,defaultValue:p,onValueChange:h,dir:v,name:w,autoComplete:x,disabled:E,required:y,form:O}=n,S=ma(r),[C,P]=g.useState(null),[M,R]=g.useState(null),[L,z]=g.useState(!1),U=Fx(v),[H,Y]=Qh({prop:l,defaultProp:a??!1,onChange:c,caller:xo}),[Z,te]=Qh({prop:f,defaultProp:p,onChange:h,caller:xo}),he=g.useRef(null),X=C?O||!!C.closest("form"):!0,[ye,ce]=g.useState(new Set),xe=Array.from(ye).map(ae=>ae.props.value).join(";");return ee.jsx(k2,{...S,children:ee.jsxs(EC,{required:y,scope:r,trigger:C,onTriggerChange:P,valueNode:M,onValueNodeChange:R,valueNodeHasChildren:L,onValueNodeHasChildrenChange:z,contentId:ld(),value:Z,onValueChange:te,open:H,onOpenChange:Y,dir:U,triggerPointerDownPosRef:he,disabled:E,children:[ee.jsx(pa.Provider,{scope:r,children:ee.jsx(kC,{scope:n.__scopeSelect,onNativeOptionAdd:g.useCallback(ae=>{ce(ie=>new Set(ie).add(ae))},[]),onNativeOptionRemove:g.useCallback(ae=>{ce(ie=>{const j=new Set(ie);return j.delete(ae),j})},[]),children:i})}),X?ee.jsxs(cy,{"aria-hidden":!0,required:y,tabIndex:-1,name:w,autoComplete:x,value:Z,onChange:ae=>te(ae.target.value),disabled:E,form:O,children:[Z===void 0?ee.jsx("option",{value:""}):null,Array.from(ye)]},xe):null]})})};Bv.displayName=xo;var Uv="SelectTrigger",Hv=g.forwardRef((n,r)=>{const{__scopeSelect:i,disabled:l=!1,...a}=n,c=ma(i),f=$r(Uv,i),p=f.disabled||l,h=ct(r,f.onTriggerChange),v=ha(i),w=g.useRef("touch"),[x,E,y]=fy(S=>{const C=v().filter(R=>!R.disabled),P=C.find(R=>R.value===f.value),M=py(C,S,P);M!==void 0&&f.onValueChange(M.value)}),O=S=>{p||(f.onOpenChange(!0),y()),S&&(f.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return ee.jsx(b2,{asChild:!0,...c,children:ee.jsx(Xe.button,{type:"button",role:"combobox","aria-controls":f.contentId,"aria-expanded":f.open,"aria-required":f.required,"aria-autocomplete":"none",dir:f.dir,"data-state":f.open?"open":"closed",disabled:p,"data-disabled":p?"":void 0,"data-placeholder":dy(f.value)?"":void 0,...a,ref:h,onClick:Je(a.onClick,S=>{S.currentTarget.focus(),w.current!=="mouse"&&O(S)}),onPointerDown:Je(a.onPointerDown,S=>{w.current=S.pointerType;const C=S.target;C.hasPointerCapture(S.pointerId)&&C.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(O(S),S.preventDefault())}),onKeyDown:Je(a.onKeyDown,S=>{const C=x.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&E(S.key),!(C&&S.key===" ")&&xC.includes(S.key)&&(O(),S.preventDefault())})})})});Hv.displayName=Uv;var $v="SelectValue",Wv=g.forwardRef((n,r)=>{const{__scopeSelect:i,className:l,style:a,children:c,placeholder:f="",...p}=n,h=$r($v,i),{onValueNodeHasChildrenChange:v}=h,w=c!==void 0,x=ct(r,h.onValueNodeChange);return It(()=>{v(w)},[v,w]),ee.jsx(Xe.span,{...p,ref:x,style:{pointerEvents:"none"},children:dy(h.value)?ee.jsx(ee.Fragment,{children:f}):c})});Wv.displayName=$v;var RC="SelectIcon",Vv=g.forwardRef((n,r)=>{const{__scopeSelect:i,children:l,...a}=n;return ee.jsx(Xe.span,{"aria-hidden":!0,...a,ref:r,children:l||"▼"})});Vv.displayName=RC;var PC="SelectPortal",Qv=n=>ee.jsx(Tv,{asChild:!0,...n});Qv.displayName=PC;var So="SelectContent",Kv=g.forwardRef((n,r)=>{const i=$r(So,n.__scopeSelect),[l,a]=g.useState();if(It(()=>{a(new DocumentFragment)},[]),!i.open){const c=l;return c?xs.createPortal(ee.jsx(Yv,{scope:n.__scopeSelect,children:ee.jsx(pa.Slot,{scope:n.__scopeSelect,children:ee.jsx("div",{children:n.children})})}),c):null}return ee.jsx(qv,{...n,ref:r})});Kv.displayName=So;var cn=10,[Yv,Wr]=Si(So),TC="SelectContentImpl",MC=ea("SelectContent.RemoveScroll"),qv=g.forwardRef((n,r)=>{const{__scopeSelect:i,position:l="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:c,onPointerDownOutside:f,side:p,sideOffset:h,align:v,alignOffset:w,arrowPadding:x,collisionBoundary:E,collisionPadding:y,sticky:O,hideWhenDetached:S,avoidCollisions:C,...P}=n,M=$r(So,i),[R,L]=g.useState(null),[z,U]=g.useState(null),H=ct(r,K=>L(K)),[Y,Z]=g.useState(null),[te,he]=g.useState(null),X=ha(i),[ye,ce]=g.useState(!1),xe=g.useRef(!1);g.useEffect(()=>{if(R)return F2(R)},[R]),Yx();const ae=g.useCallback(K=>{const[fe,...Ce]=X().map(Oe=>Oe.ref.current),[be]=Ce.slice(-1),Te=document.activeElement;for(const Oe of K)if(Oe===Te||(Oe==null||Oe.scrollIntoView({block:"nearest"}),Oe===fe&&z&&(z.scrollTop=0),Oe===be&&z&&(z.scrollTop=z.scrollHeight),Oe==null||Oe.focus(),document.activeElement!==Te))return},[X,z]),ie=g.useCallback(()=>ae([Y,R]),[ae,Y,R]);g.useEffect(()=>{ye&&ie()},[ye,ie]);const{onOpenChange:j,triggerPointerDownPosRef:B}=M;g.useEffect(()=>{if(R){let K={x:0,y:0};const fe=be=>{var Te,Oe;K={x:Math.abs(Math.round(be.pageX)-(((Te=B.current)==null?void 0:Te.x)??0)),y:Math.abs(Math.round(be.pageY)-(((Oe=B.current)==null?void 0:Oe.y)??0))}},Ce=be=>{K.x<=10&&K.y<=10?be.preventDefault():R.contains(be.target)||j(!1),document.removeEventListener("pointermove",fe),B.current=null};return B.current!==null&&(document.addEventListener("pointermove",fe),document.addEventListener("pointerup",Ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",fe),document.removeEventListener("pointerup",Ce,{capture:!0})}}},[R,j,B]),g.useEffect(()=>{const K=()=>j(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[j]);const[V,_]=fy(K=>{const fe=X().filter(Te=>!Te.disabled),Ce=fe.find(Te=>Te.ref.current===document.activeElement),be=py(fe,K,Ce);be&&setTimeout(()=>be.ref.current.focus())}),F=g.useCallback((K,fe,Ce)=>{const be=!xe.current&&!Ce;(M.value!==void 0&&M.value===fe||be)&&(Z(K),be&&(xe.current=!0))},[M.value]),ne=g.useCallback(()=>R==null?void 0:R.focus(),[R]),re=g.useCallback((K,fe,Ce)=>{const be=!xe.current&&!Ce;(M.value!==void 0&&M.value===fe||be)&&he(K)},[M.value]),ve=l==="popper"?Bc:Gv,Se=ve===Bc?{side:p,sideOffset:h,align:v,alignOffset:w,arrowPadding:x,collisionBoundary:E,collisionPadding:y,sticky:O,hideWhenDetached:S,avoidCollisions:C}:{};return ee.jsx(Yv,{scope:i,content:R,viewport:z,onViewportChange:U,itemRefCallback:F,selectedItem:Y,onItemLeave:ne,itemTextRefCallback:re,focusSelectedItem:ie,selectedItemText:te,position:l,isPositioned:ye,searchRef:V,children:ee.jsx(jv,{as:MC,allowPinchZoom:!0,children:ee.jsx(ov,{asChild:!0,trapped:M.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:Je(a,K=>{var fe;(fe=M.trigger)==null||fe.focus({preventScroll:!0}),K.preventDefault()}),children:ee.jsx(nv,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>M.onOpenChange(!1),children:ee.jsx(ve,{role:"listbox",id:M.contentId,"data-state":M.open?"open":"closed",dir:M.dir,onContextMenu:K=>K.preventDefault(),...P,...Se,onPlaced:()=>ce(!0),ref:H,style:{display:"flex",flexDirection:"column",outline:"none",...P.style},onKeyDown:Je(P.onKeyDown,K=>{const fe=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!fe&&K.key.length===1&&_(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let be=X().filter(Te=>!Te.disabled).map(Te=>Te.ref.current);if(["ArrowUp","End"].includes(K.key)&&(be=be.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const Te=K.target,Oe=be.indexOf(Te);be=be.slice(Oe+1)}setTimeout(()=>ae(be)),K.preventDefault()}})})})})})})});qv.displayName=TC;var OC="SelectItemAlignedPosition",Gv=g.forwardRef((n,r)=>{const{__scopeSelect:i,onPlaced:l,...a}=n,c=$r(So,i),f=Wr(So,i),[p,h]=g.useState(null),[v,w]=g.useState(null),x=ct(r,H=>w(H)),E=ha(i),y=g.useRef(!1),O=g.useRef(!0),{viewport:S,selectedItem:C,selectedItemText:P,focusSelectedItem:M}=f,R=g.useCallback(()=>{if(c.trigger&&c.valueNode&&p&&v&&S&&C&&P){const H=c.trigger.getBoundingClientRect(),Y=v.getBoundingClientRect(),Z=c.valueNode.getBoundingClientRect(),te=P.getBoundingClientRect();if(c.dir!=="rtl"){const Te=te.left-Y.left,Oe=Z.left-Te,Ye=H.left-Oe,dt=H.width+Ye,yn=Math.max(dt,Y.width),Xt=window.innerWidth-cn,Zt=Rh(Oe,[cn,Math.max(cn,Xt-yn)]);p.style.minWidth=dt+"px",p.style.left=Zt+"px"}else{const Te=Y.right-te.right,Oe=window.innerWidth-Z.right-Te,Ye=window.innerWidth-H.right-Oe,dt=H.width+Ye,yn=Math.max(dt,Y.width),Xt=window.innerWidth-cn,Zt=Rh(Oe,[cn,Math.max(cn,Xt-yn)]);p.style.minWidth=dt+"px",p.style.right=Zt+"px"}const he=E(),X=window.innerHeight-cn*2,ye=S.scrollHeight,ce=window.getComputedStyle(v),xe=parseInt(ce.borderTopWidth,10),ae=parseInt(ce.paddingTop,10),ie=parseInt(ce.borderBottomWidth,10),j=parseInt(ce.paddingBottom,10),B=xe+ae+ye+j+ie,V=Math.min(C.offsetHeight*5,B),_=window.getComputedStyle(S),F=parseInt(_.paddingTop,10),ne=parseInt(_.paddingBottom,10),re=H.top+H.height/2-cn,ve=X-re,Se=C.offsetHeight/2,K=C.offsetTop+Se,fe=xe+ae+K,Ce=B-fe;if(fe<=re){const Te=he.length>0&&C===he[he.length-1].ref.current;p.style.bottom="0px";const Oe=v.clientHeight-S.offsetTop-S.offsetHeight,Ye=Math.max(ve,Se+(Te?ne:0)+Oe+ie),dt=fe+Ye;p.style.height=dt+"px"}else{const Te=he.length>0&&C===he[0].ref.current;p.style.top="0px";const Ye=Math.max(re,xe+S.offsetTop+(Te?F:0)+Se)+Ce;p.style.height=Ye+"px",S.scrollTop=fe-re+S.offsetTop}p.style.margin=`${cn}px 0`,p.style.minHeight=V+"px",p.style.maxHeight=X+"px",l==null||l(),requestAnimationFrame(()=>y.current=!0)}},[E,c.trigger,c.valueNode,p,v,S,C,P,c.dir,l]);It(()=>R(),[R]);const[L,z]=g.useState();It(()=>{v&&z(window.getComputedStyle(v).zIndex)},[v]);const U=g.useCallback(H=>{H&&O.current===!0&&(R(),M==null||M(),O.current=!1)},[R,M]);return ee.jsx(NC,{scope:i,contentWrapper:p,shouldExpandOnScrollRef:y,onScrollButtonChange:U,children:ee.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:L},children:ee.jsx(Xe.div,{...a,ref:x,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});Gv.displayName=OC;var _C="SelectPopperPosition",Bc=g.forwardRef((n,r)=>{const{__scopeSelect:i,align:l="start",collisionPadding:a=cn,...c}=n,f=ma(i);return ee.jsx(R2,{...f,...c,ref:r,align:l,collisionPadding:a,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Bc.displayName=_C;var[NC,vd]=Si(So,{}),Uc="SelectViewport",Xv=g.forwardRef((n,r)=>{const{__scopeSelect:i,nonce:l,...a}=n,c=Wr(Uc,i),f=vd(Uc,i),p=ct(r,c.onViewportChange),h=g.useRef(0);return ee.jsxs(ee.Fragment,{children:[ee.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:l}),ee.jsx(pa.Slot,{scope:i,children:ee.jsx(Xe.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:p,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Je(a.onScroll,v=>{const w=v.currentTarget,{contentWrapper:x,shouldExpandOnScrollRef:E}=f;if(E!=null&&E.current&&x){const y=Math.abs(h.current-w.scrollTop);if(y>0){const O=window.innerHeight-cn*2,S=parseFloat(x.style.minHeight),C=parseFloat(x.style.height),P=Math.max(S,C);if(P<O){const M=P+y,R=Math.min(O,M),L=M-R;x.style.height=R+"px",x.style.bottom==="0px"&&(w.scrollTop=L>0?L:0,x.style.justifyContent="flex-end")}}}h.current=w.scrollTop})})})]})});Xv.displayName=Uc;var Zv="SelectGroup",[LC,IC]=Si(Zv),AC=g.forwardRef((n,r)=>{const{__scopeSelect:i,...l}=n,a=ld();return ee.jsx(LC,{scope:i,id:a,children:ee.jsx(Xe.div,{role:"group","aria-labelledby":a,...l,ref:r})})});AC.displayName=Zv;var Jv="SelectLabel",ey=g.forwardRef((n,r)=>{const{__scopeSelect:i,...l}=n,a=IC(Jv,i);return ee.jsx(Xe.div,{id:a.id,...l,ref:r})});ey.displayName=Jv;var ia="SelectItem",[DC,ty]=Si(ia),ny=g.forwardRef((n,r)=>{const{__scopeSelect:i,value:l,disabled:a=!1,textValue:c,...f}=n,p=$r(ia,i),h=Wr(ia,i),v=p.value===l,[w,x]=g.useState(c??""),[E,y]=g.useState(!1),O=ct(r,M=>{var R;return(R=h.itemRefCallback)==null?void 0:R.call(h,M,l,a)}),S=ld(),C=g.useRef("touch"),P=()=>{a||(p.onValueChange(l),p.onOpenChange(!1))};if(l==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return ee.jsx(DC,{scope:i,value:l,disabled:a,textId:S,isSelected:v,onItemTextChange:g.useCallback(M=>{x(R=>R||((M==null?void 0:M.textContent)??"").trim())},[]),children:ee.jsx(pa.ItemSlot,{scope:i,value:l,disabled:a,textValue:w,children:ee.jsx(Xe.div,{role:"option","aria-labelledby":S,"data-highlighted":E?"":void 0,"aria-selected":v&&E,"data-state":v?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...f,ref:O,onFocus:Je(f.onFocus,()=>y(!0)),onBlur:Je(f.onBlur,()=>y(!1)),onClick:Je(f.onClick,()=>{C.current!=="mouse"&&P()}),onPointerUp:Je(f.onPointerUp,()=>{C.current==="mouse"&&P()}),onPointerDown:Je(f.onPointerDown,M=>{C.current=M.pointerType}),onPointerMove:Je(f.onPointerMove,M=>{var R;C.current=M.pointerType,a?(R=h.onItemLeave)==null||R.call(h):C.current==="mouse"&&M.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Je(f.onPointerLeave,M=>{var R;M.currentTarget===document.activeElement&&((R=h.onItemLeave)==null||R.call(h))}),onKeyDown:Je(f.onKeyDown,M=>{var L;((L=h.searchRef)==null?void 0:L.current)!==""&&M.key===" "||(SC.includes(M.key)&&P(),M.key===" "&&M.preventDefault())})})})})});ny.displayName=ia;var us="SelectItemText",ry=g.forwardRef((n,r)=>{const{__scopeSelect:i,className:l,style:a,...c}=n,f=$r(us,i),p=Wr(us,i),h=ty(us,i),v=bC(us,i),[w,x]=g.useState(null),E=ct(r,P=>x(P),h.onItemTextChange,P=>{var M;return(M=p.itemTextRefCallback)==null?void 0:M.call(p,P,h.value,h.disabled)}),y=w==null?void 0:w.textContent,O=g.useMemo(()=>ee.jsx("option",{value:h.value,disabled:h.disabled,children:y},h.value),[h.disabled,h.value,y]),{onNativeOptionAdd:S,onNativeOptionRemove:C}=v;return It(()=>(S(O),()=>C(O)),[S,C,O]),ee.jsxs(ee.Fragment,{children:[ee.jsx(Xe.span,{id:h.textId,...c,ref:E}),h.isSelected&&f.valueNode&&!f.valueNodeHasChildren?xs.createPortal(c.children,f.valueNode):null]})});ry.displayName=us;var oy="SelectItemIndicator",iy=g.forwardRef((n,r)=>{const{__scopeSelect:i,...l}=n;return ty(oy,i).isSelected?ee.jsx(Xe.span,{"aria-hidden":!0,...l,ref:r}):null});iy.displayName=oy;var Hc="SelectScrollUpButton",sy=g.forwardRef((n,r)=>{const i=Wr(Hc,n.__scopeSelect),l=vd(Hc,n.__scopeSelect),[a,c]=g.useState(!1),f=ct(r,l.onScrollButtonChange);return It(()=>{if(i.viewport&&i.isPositioned){let p=function(){const v=h.scrollTop>0;c(v)};const h=i.viewport;return p(),h.addEventListener("scroll",p),()=>h.removeEventListener("scroll",p)}},[i.viewport,i.isPositioned]),a?ee.jsx(ay,{...n,ref:f,onAutoScroll:()=>{const{viewport:p,selectedItem:h}=i;p&&h&&(p.scrollTop=p.scrollTop-h.offsetHeight)}}):null});sy.displayName=Hc;var $c="SelectScrollDownButton",ly=g.forwardRef((n,r)=>{const i=Wr($c,n.__scopeSelect),l=vd($c,n.__scopeSelect),[a,c]=g.useState(!1),f=ct(r,l.onScrollButtonChange);return It(()=>{if(i.viewport&&i.isPositioned){let p=function(){const v=h.scrollHeight-h.clientHeight,w=Math.ceil(h.scrollTop)<v;c(w)};const h=i.viewport;return p(),h.addEventListener("scroll",p),()=>h.removeEventListener("scroll",p)}},[i.viewport,i.isPositioned]),a?ee.jsx(ay,{...n,ref:f,onAutoScroll:()=>{const{viewport:p,selectedItem:h}=i;p&&h&&(p.scrollTop=p.scrollTop+h.offsetHeight)}}):null});ly.displayName=$c;var ay=g.forwardRef((n,r)=>{const{__scopeSelect:i,onAutoScroll:l,...a}=n,c=Wr("SelectScrollButton",i),f=g.useRef(null),p=ha(i),h=g.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return g.useEffect(()=>()=>h(),[h]),It(()=>{var w;const v=p().find(x=>x.ref.current===document.activeElement);(w=v==null?void 0:v.ref.current)==null||w.scrollIntoView({block:"nearest"})},[p]),ee.jsx(Xe.div,{"aria-hidden":!0,...a,ref:r,style:{flexShrink:0,...a.style},onPointerDown:Je(a.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(l,50))}),onPointerMove:Je(a.onPointerMove,()=>{var v;(v=c.onItemLeave)==null||v.call(c),f.current===null&&(f.current=window.setInterval(l,50))}),onPointerLeave:Je(a.onPointerLeave,()=>{h()})})}),FC="SelectSeparator",uy=g.forwardRef((n,r)=>{const{__scopeSelect:i,...l}=n;return ee.jsx(Xe.div,{"aria-hidden":!0,...l,ref:r})});uy.displayName=FC;var Wc="SelectArrow",zC=g.forwardRef((n,r)=>{const{__scopeSelect:i,...l}=n,a=ma(i),c=$r(Wc,i),f=Wr(Wc,i);return c.open&&f.position==="popper"?ee.jsx(P2,{...a,...l,ref:r}):null});zC.displayName=Wc;var jC="SelectBubbleInput",cy=g.forwardRef(({__scopeSelect:n,value:r,...i},l)=>{const a=g.useRef(null),c=ct(l,a),f=N2(r);return g.useEffect(()=>{const p=a.current;if(!p)return;const h=window.HTMLSelectElement.prototype,w=Object.getOwnPropertyDescriptor(h,"value").set;if(f!==r&&w){const x=new Event("change",{bubbles:!0});w.call(p,r),p.dispatchEvent(x)}},[f,r]),ee.jsx(Xe.select,{...i,style:{...Mv,...i.style},ref:c,defaultValue:r})});cy.displayName=jC;function dy(n){return n===""||n===void 0}function fy(n){const r=go(n),i=g.useRef(""),l=g.useRef(0),a=g.useCallback(f=>{const p=i.current+f;r(p),(function h(v){i.current=v,window.clearTimeout(l.current),v!==""&&(l.current=window.setTimeout(()=>h(""),1e3))})(p)},[r]),c=g.useCallback(()=>{i.current="",window.clearTimeout(l.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(l.current),[]),[i,a,c]}function py(n,r,i){const a=r.length>1&&Array.from(r).every(v=>v===r[0])?r[0]:r,c=i?n.indexOf(i):-1;let f=BC(n,Math.max(c,0));a.length===1&&(f=f.filter(v=>v!==i));const h=f.find(v=>v.textValue.toLowerCase().startsWith(a.toLowerCase()));return h!==i?h:void 0}function BC(n,r){return n.map((i,l)=>n[(r+l)%n.length])}var mk=Bv,vk=Hv,yk=Wv,gk=Vv,wk=Qv,xk=Kv,Sk=Xv,Ck=ey,Ek=ny,kk=ry,bk=iy,Rk=sy,Pk=ly,Tk=uy;const Zh=n=>{let r;const i=new Set,l=(v,w)=>{const x=typeof v=="function"?v(r):v;if(!Object.is(x,r)){const E=r;r=w??(typeof x!="object"||x===null)?x:Object.assign({},r,x),i.forEach(y=>y(r,E))}},a=()=>r,p={setState:l,getState:a,getInitialState:()=>h,subscribe:v=>(i.add(v),()=>i.delete(v))},h=r=n(l,a,p);return p},UC=(n=>n?Zh(n):Zh),HC=n=>n;function $C(n,r=HC){const i=G.useSyncExternalStore(n.subscribe,G.useCallback(()=>r(n.getState()),[n,r]),G.useCallback(()=>r(n.getInitialState()),[n,r]));return G.useDebugValue(i),i}const Jh=n=>{const r=UC(n),i=l=>$C(r,l);return Object.assign(i,r),i},Mk=(n=>n?Jh(n):Jh);export{ak as $,rE as A,uE as B,dE as C,Hr as D,Mk as E,ZC as F,kE as G,TE as H,gk as I,YC as J,OE as K,Ck as L,AE as M,A1 as N,c1 as O,wk as P,XC as Q,mk as R,Rk as S,vk as T,KC as U,Sk as V,VC as W,qC as X,pE as Y,EE as Z,NE as _,Wm as a,BE as a$,WE as a0,qE as a1,DE as a2,pk as a3,z2 as a4,hk as a5,fk as a6,dm as a7,ok as a8,aE as a9,wE as aA,UE as aB,ek as aC,sE as aD,sk as aE,rk as aF,KE as aG,HE as aH,VE as aI,km as aJ,QC as aK,xE as aL,SE as aM,XE as aN,hE as aO,LE as aP,PE as aQ,nk as aR,YE as aS,ME as aT,vE as aU,dk as aV,ck as aW,zE as aX,It as aY,uk as aZ,IE as a_,ik as aa,yE as ab,tk as ac,bE as ad,CE as ae,GE as af,mE as ag,Qh as ah,k2 as ai,ld as aj,b2 as ak,wv as al,Tv as am,ct as an,Xe as ao,Je as ap,sd as aq,F2 as ar,jv as as,ea as at,Yx as au,ov as av,nv as aw,R2 as ax,P2 as ay,QE as az,eE as b,iE as b0,RE as b1,tE as c,lk as d,fE as e,Pk as f,xk as g,Ek as h,bk as i,ee as j,cE as k,kk as l,Tk as m,yk as n,gE as o,JE as p,FE as q,g as r,$E as s,nE as t,JC as u,oE as v,ZE as w,jE as x,_E as y,lE as z};
|
|
402
|
+
`)},vC=0,Xo=[];function yC(n){var r=g.useRef([]),i=g.useRef([0,0]),l=g.useRef(),a=g.useState(vC++)[0],c=g.useState(Av)[0],f=g.useRef(n);g.useEffect(function(){f.current=n},[n]),g.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(a));var S=z2([n.lockRef.current],(n.shards||[]).map(Xh),!0).filter(Boolean);return S.forEach(function(C){return C.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),S.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(a))})}}},[n.inert,n.lockRef.current,n.shards]);var p=g.useCallback(function(S,C){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!f.current.allowPinchZoom;var P=Wl(S),M=i.current,R="deltaX"in S?S.deltaX:M[0]-P[0],L="deltaY"in S?S.deltaY:M[1]-P[1],z,U=S.target,H=Math.abs(R)>Math.abs(L)?"h":"v";if("touches"in S&&H==="h"&&U.type==="range")return!1;var Y=window.getSelection(),Z=Y&&Y.anchorNode,te=Z?Z===U||Z.contains(U):!1;if(te)return!1;var he=qh(H,U);if(!he)return!0;if(he?z=H:(z=H==="v"?"h":"v",he=qh(H,U)),!he)return!1;if(!l.current&&"changedTouches"in S&&(R||L)&&(l.current=z),!z)return!0;var X=l.current||z;return pC(X,C,S,X==="h"?R:L)},[]),h=g.useCallback(function(S){var C=S;if(!(!Xo.length||Xo[Xo.length-1]!==c)){var P="deltaY"in C?Gh(C):Wl(C),M=r.current.filter(function(z){return z.name===C.type&&(z.target===C.target||C.target===z.shadowParent)&&hC(z.delta,P)})[0];if(M&&M.should){C.cancelable&&C.preventDefault();return}if(!M){var R=(f.current.shards||[]).map(Xh).filter(Boolean).filter(function(z){return z.contains(C.target)}),L=R.length>0?p(C,R[0]):!f.current.noIsolation;L&&C.cancelable&&C.preventDefault()}}},[]),v=g.useCallback(function(S,C,P,M){var R={name:S,delta:C,target:P,should:M,shadowParent:gC(P)};r.current.push(R),setTimeout(function(){r.current=r.current.filter(function(L){return L!==R})},1)},[]),w=g.useCallback(function(S){i.current=Wl(S),l.current=void 0},[]),x=g.useCallback(function(S){v(S.type,Gh(S),S.target,p(S,n.lockRef.current))},[]),E=g.useCallback(function(S){v(S.type,Wl(S),S.target,p(S,n.lockRef.current))},[]);g.useEffect(function(){return Xo.push(c),n.setCallbacks({onScrollCapture:x,onWheelCapture:x,onTouchMoveCapture:E}),document.addEventListener("wheel",h,Go),document.addEventListener("touchmove",h,Go),document.addEventListener("touchstart",w,Go),function(){Xo=Xo.filter(function(S){return S!==c}),document.removeEventListener("wheel",h,Go),document.removeEventListener("touchmove",h,Go),document.removeEventListener("touchstart",w,Go)}},[]);var y=n.removeScrollBar,O=n.inert;return g.createElement(g.Fragment,null,O?g.createElement(c,{styles:mC(a)}):null,y?g.createElement(sC,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function gC(n){for(var r=null;n!==null;)n instanceof ShadowRoot&&(r=n.host,n=n.host),n=n.parentNode;return r}const wC=K2(Iv,yC);var jv=g.forwardRef(function(n,r){return g.createElement(fa,Ln({},n,{ref:r,sideCar:wC}))});jv.classNames=fa.classNames;var xC=[" ","Enter","ArrowUp","ArrowDown"],SC=[" ","Enter"],xo="Select",[pa,ha,CC]=Ax(xo),[Si]=sd(xo,[CC,wv]),ma=wv(),[EC,$r]=Si(xo),[kC,bC]=Si(xo),Bv=n=>{const{__scopeSelect:r,children:i,open:l,defaultOpen:a,onOpenChange:c,value:f,defaultValue:p,onValueChange:h,dir:v,name:w,autoComplete:x,disabled:E,required:y,form:O}=n,S=ma(r),[C,P]=g.useState(null),[M,R]=g.useState(null),[L,z]=g.useState(!1),U=Fx(v),[H,Y]=Qh({prop:l,defaultProp:a??!1,onChange:c,caller:xo}),[Z,te]=Qh({prop:f,defaultProp:p,onChange:h,caller:xo}),he=g.useRef(null),X=C?O||!!C.closest("form"):!0,[ye,ce]=g.useState(new Set),xe=Array.from(ye).map(ae=>ae.props.value).join(";");return ee.jsx(k2,{...S,children:ee.jsxs(EC,{required:y,scope:r,trigger:C,onTriggerChange:P,valueNode:M,onValueNodeChange:R,valueNodeHasChildren:L,onValueNodeHasChildrenChange:z,contentId:ld(),value:Z,onValueChange:te,open:H,onOpenChange:Y,dir:U,triggerPointerDownPosRef:he,disabled:E,children:[ee.jsx(pa.Provider,{scope:r,children:ee.jsx(kC,{scope:n.__scopeSelect,onNativeOptionAdd:g.useCallback(ae=>{ce(ie=>new Set(ie).add(ae))},[]),onNativeOptionRemove:g.useCallback(ae=>{ce(ie=>{const j=new Set(ie);return j.delete(ae),j})},[]),children:i})}),X?ee.jsxs(cy,{"aria-hidden":!0,required:y,tabIndex:-1,name:w,autoComplete:x,value:Z,onChange:ae=>te(ae.target.value),disabled:E,form:O,children:[Z===void 0?ee.jsx("option",{value:""}):null,Array.from(ye)]},xe):null]})})};Bv.displayName=xo;var Uv="SelectTrigger",Hv=g.forwardRef((n,r)=>{const{__scopeSelect:i,disabled:l=!1,...a}=n,c=ma(i),f=$r(Uv,i),p=f.disabled||l,h=ct(r,f.onTriggerChange),v=ha(i),w=g.useRef("touch"),[x,E,y]=fy(S=>{const C=v().filter(R=>!R.disabled),P=C.find(R=>R.value===f.value),M=py(C,S,P);M!==void 0&&f.onValueChange(M.value)}),O=S=>{p||(f.onOpenChange(!0),y()),S&&(f.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return ee.jsx(b2,{asChild:!0,...c,children:ee.jsx(Xe.button,{type:"button",role:"combobox","aria-controls":f.contentId,"aria-expanded":f.open,"aria-required":f.required,"aria-autocomplete":"none",dir:f.dir,"data-state":f.open?"open":"closed",disabled:p,"data-disabled":p?"":void 0,"data-placeholder":dy(f.value)?"":void 0,...a,ref:h,onClick:Je(a.onClick,S=>{S.currentTarget.focus(),w.current!=="mouse"&&O(S)}),onPointerDown:Je(a.onPointerDown,S=>{w.current=S.pointerType;const C=S.target;C.hasPointerCapture(S.pointerId)&&C.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(O(S),S.preventDefault())}),onKeyDown:Je(a.onKeyDown,S=>{const C=x.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&E(S.key),!(C&&S.key===" ")&&xC.includes(S.key)&&(O(),S.preventDefault())})})})});Hv.displayName=Uv;var $v="SelectValue",Wv=g.forwardRef((n,r)=>{const{__scopeSelect:i,className:l,style:a,children:c,placeholder:f="",...p}=n,h=$r($v,i),{onValueNodeHasChildrenChange:v}=h,w=c!==void 0,x=ct(r,h.onValueNodeChange);return It(()=>{v(w)},[v,w]),ee.jsx(Xe.span,{...p,ref:x,style:{pointerEvents:"none"},children:dy(h.value)?ee.jsx(ee.Fragment,{children:f}):c})});Wv.displayName=$v;var RC="SelectIcon",Vv=g.forwardRef((n,r)=>{const{__scopeSelect:i,children:l,...a}=n;return ee.jsx(Xe.span,{"aria-hidden":!0,...a,ref:r,children:l||"▼"})});Vv.displayName=RC;var PC="SelectPortal",Qv=n=>ee.jsx(Tv,{asChild:!0,...n});Qv.displayName=PC;var So="SelectContent",Kv=g.forwardRef((n,r)=>{const i=$r(So,n.__scopeSelect),[l,a]=g.useState();if(It(()=>{a(new DocumentFragment)},[]),!i.open){const c=l;return c?xs.createPortal(ee.jsx(Yv,{scope:n.__scopeSelect,children:ee.jsx(pa.Slot,{scope:n.__scopeSelect,children:ee.jsx("div",{children:n.children})})}),c):null}return ee.jsx(qv,{...n,ref:r})});Kv.displayName=So;var cn=10,[Yv,Wr]=Si(So),TC="SelectContentImpl",MC=ea("SelectContent.RemoveScroll"),qv=g.forwardRef((n,r)=>{const{__scopeSelect:i,position:l="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:c,onPointerDownOutside:f,side:p,sideOffset:h,align:v,alignOffset:w,arrowPadding:x,collisionBoundary:E,collisionPadding:y,sticky:O,hideWhenDetached:S,avoidCollisions:C,...P}=n,M=$r(So,i),[R,L]=g.useState(null),[z,U]=g.useState(null),H=ct(r,K=>L(K)),[Y,Z]=g.useState(null),[te,he]=g.useState(null),X=ha(i),[ye,ce]=g.useState(!1),xe=g.useRef(!1);g.useEffect(()=>{if(R)return F2(R)},[R]),Yx();const ae=g.useCallback(K=>{const[fe,...Ce]=X().map(Oe=>Oe.ref.current),[be]=Ce.slice(-1),Te=document.activeElement;for(const Oe of K)if(Oe===Te||(Oe==null||Oe.scrollIntoView({block:"nearest"}),Oe===fe&&z&&(z.scrollTop=0),Oe===be&&z&&(z.scrollTop=z.scrollHeight),Oe==null||Oe.focus(),document.activeElement!==Te))return},[X,z]),ie=g.useCallback(()=>ae([Y,R]),[ae,Y,R]);g.useEffect(()=>{ye&&ie()},[ye,ie]);const{onOpenChange:j,triggerPointerDownPosRef:B}=M;g.useEffect(()=>{if(R){let K={x:0,y:0};const fe=be=>{var Te,Oe;K={x:Math.abs(Math.round(be.pageX)-(((Te=B.current)==null?void 0:Te.x)??0)),y:Math.abs(Math.round(be.pageY)-(((Oe=B.current)==null?void 0:Oe.y)??0))}},Ce=be=>{K.x<=10&&K.y<=10?be.preventDefault():R.contains(be.target)||j(!1),document.removeEventListener("pointermove",fe),B.current=null};return B.current!==null&&(document.addEventListener("pointermove",fe),document.addEventListener("pointerup",Ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",fe),document.removeEventListener("pointerup",Ce,{capture:!0})}}},[R,j,B]),g.useEffect(()=>{const K=()=>j(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[j]);const[V,_]=fy(K=>{const fe=X().filter(Te=>!Te.disabled),Ce=fe.find(Te=>Te.ref.current===document.activeElement),be=py(fe,K,Ce);be&&setTimeout(()=>be.ref.current.focus())}),F=g.useCallback((K,fe,Ce)=>{const be=!xe.current&&!Ce;(M.value!==void 0&&M.value===fe||be)&&(Z(K),be&&(xe.current=!0))},[M.value]),ne=g.useCallback(()=>R==null?void 0:R.focus(),[R]),re=g.useCallback((K,fe,Ce)=>{const be=!xe.current&&!Ce;(M.value!==void 0&&M.value===fe||be)&&he(K)},[M.value]),ve=l==="popper"?Bc:Gv,Se=ve===Bc?{side:p,sideOffset:h,align:v,alignOffset:w,arrowPadding:x,collisionBoundary:E,collisionPadding:y,sticky:O,hideWhenDetached:S,avoidCollisions:C}:{};return ee.jsx(Yv,{scope:i,content:R,viewport:z,onViewportChange:U,itemRefCallback:F,selectedItem:Y,onItemLeave:ne,itemTextRefCallback:re,focusSelectedItem:ie,selectedItemText:te,position:l,isPositioned:ye,searchRef:V,children:ee.jsx(jv,{as:MC,allowPinchZoom:!0,children:ee.jsx(ov,{asChild:!0,trapped:M.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:Je(a,K=>{var fe;(fe=M.trigger)==null||fe.focus({preventScroll:!0}),K.preventDefault()}),children:ee.jsx(nv,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>M.onOpenChange(!1),children:ee.jsx(ve,{role:"listbox",id:M.contentId,"data-state":M.open?"open":"closed",dir:M.dir,onContextMenu:K=>K.preventDefault(),...P,...Se,onPlaced:()=>ce(!0),ref:H,style:{display:"flex",flexDirection:"column",outline:"none",...P.style},onKeyDown:Je(P.onKeyDown,K=>{const fe=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!fe&&K.key.length===1&&_(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let be=X().filter(Te=>!Te.disabled).map(Te=>Te.ref.current);if(["ArrowUp","End"].includes(K.key)&&(be=be.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const Te=K.target,Oe=be.indexOf(Te);be=be.slice(Oe+1)}setTimeout(()=>ae(be)),K.preventDefault()}})})})})})})});qv.displayName=TC;var OC="SelectItemAlignedPosition",Gv=g.forwardRef((n,r)=>{const{__scopeSelect:i,onPlaced:l,...a}=n,c=$r(So,i),f=Wr(So,i),[p,h]=g.useState(null),[v,w]=g.useState(null),x=ct(r,H=>w(H)),E=ha(i),y=g.useRef(!1),O=g.useRef(!0),{viewport:S,selectedItem:C,selectedItemText:P,focusSelectedItem:M}=f,R=g.useCallback(()=>{if(c.trigger&&c.valueNode&&p&&v&&S&&C&&P){const H=c.trigger.getBoundingClientRect(),Y=v.getBoundingClientRect(),Z=c.valueNode.getBoundingClientRect(),te=P.getBoundingClientRect();if(c.dir!=="rtl"){const Te=te.left-Y.left,Oe=Z.left-Te,Ye=H.left-Oe,dt=H.width+Ye,yn=Math.max(dt,Y.width),Xt=window.innerWidth-cn,Zt=Rh(Oe,[cn,Math.max(cn,Xt-yn)]);p.style.minWidth=dt+"px",p.style.left=Zt+"px"}else{const Te=Y.right-te.right,Oe=window.innerWidth-Z.right-Te,Ye=window.innerWidth-H.right-Oe,dt=H.width+Ye,yn=Math.max(dt,Y.width),Xt=window.innerWidth-cn,Zt=Rh(Oe,[cn,Math.max(cn,Xt-yn)]);p.style.minWidth=dt+"px",p.style.right=Zt+"px"}const he=E(),X=window.innerHeight-cn*2,ye=S.scrollHeight,ce=window.getComputedStyle(v),xe=parseInt(ce.borderTopWidth,10),ae=parseInt(ce.paddingTop,10),ie=parseInt(ce.borderBottomWidth,10),j=parseInt(ce.paddingBottom,10),B=xe+ae+ye+j+ie,V=Math.min(C.offsetHeight*5,B),_=window.getComputedStyle(S),F=parseInt(_.paddingTop,10),ne=parseInt(_.paddingBottom,10),re=H.top+H.height/2-cn,ve=X-re,Se=C.offsetHeight/2,K=C.offsetTop+Se,fe=xe+ae+K,Ce=B-fe;if(fe<=re){const Te=he.length>0&&C===he[he.length-1].ref.current;p.style.bottom="0px";const Oe=v.clientHeight-S.offsetTop-S.offsetHeight,Ye=Math.max(ve,Se+(Te?ne:0)+Oe+ie),dt=fe+Ye;p.style.height=dt+"px"}else{const Te=he.length>0&&C===he[0].ref.current;p.style.top="0px";const Ye=Math.max(re,xe+S.offsetTop+(Te?F:0)+Se)+Ce;p.style.height=Ye+"px",S.scrollTop=fe-re+S.offsetTop}p.style.margin=`${cn}px 0`,p.style.minHeight=V+"px",p.style.maxHeight=X+"px",l==null||l(),requestAnimationFrame(()=>y.current=!0)}},[E,c.trigger,c.valueNode,p,v,S,C,P,c.dir,l]);It(()=>R(),[R]);const[L,z]=g.useState();It(()=>{v&&z(window.getComputedStyle(v).zIndex)},[v]);const U=g.useCallback(H=>{H&&O.current===!0&&(R(),M==null||M(),O.current=!1)},[R,M]);return ee.jsx(NC,{scope:i,contentWrapper:p,shouldExpandOnScrollRef:y,onScrollButtonChange:U,children:ee.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:L},children:ee.jsx(Xe.div,{...a,ref:x,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});Gv.displayName=OC;var _C="SelectPopperPosition",Bc=g.forwardRef((n,r)=>{const{__scopeSelect:i,align:l="start",collisionPadding:a=cn,...c}=n,f=ma(i);return ee.jsx(R2,{...f,...c,ref:r,align:l,collisionPadding:a,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Bc.displayName=_C;var[NC,vd]=Si(So,{}),Uc="SelectViewport",Xv=g.forwardRef((n,r)=>{const{__scopeSelect:i,nonce:l,...a}=n,c=Wr(Uc,i),f=vd(Uc,i),p=ct(r,c.onViewportChange),h=g.useRef(0);return ee.jsxs(ee.Fragment,{children:[ee.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:l}),ee.jsx(pa.Slot,{scope:i,children:ee.jsx(Xe.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:p,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Je(a.onScroll,v=>{const w=v.currentTarget,{contentWrapper:x,shouldExpandOnScrollRef:E}=f;if(E!=null&&E.current&&x){const y=Math.abs(h.current-w.scrollTop);if(y>0){const O=window.innerHeight-cn*2,S=parseFloat(x.style.minHeight),C=parseFloat(x.style.height),P=Math.max(S,C);if(P<O){const M=P+y,R=Math.min(O,M),L=M-R;x.style.height=R+"px",x.style.bottom==="0px"&&(w.scrollTop=L>0?L:0,x.style.justifyContent="flex-end")}}}h.current=w.scrollTop})})})]})});Xv.displayName=Uc;var Zv="SelectGroup",[LC,IC]=Si(Zv),AC=g.forwardRef((n,r)=>{const{__scopeSelect:i,...l}=n,a=ld();return ee.jsx(LC,{scope:i,id:a,children:ee.jsx(Xe.div,{role:"group","aria-labelledby":a,...l,ref:r})})});AC.displayName=Zv;var Jv="SelectLabel",ey=g.forwardRef((n,r)=>{const{__scopeSelect:i,...l}=n,a=IC(Jv,i);return ee.jsx(Xe.div,{id:a.id,...l,ref:r})});ey.displayName=Jv;var ia="SelectItem",[DC,ty]=Si(ia),ny=g.forwardRef((n,r)=>{const{__scopeSelect:i,value:l,disabled:a=!1,textValue:c,...f}=n,p=$r(ia,i),h=Wr(ia,i),v=p.value===l,[w,x]=g.useState(c??""),[E,y]=g.useState(!1),O=ct(r,M=>{var R;return(R=h.itemRefCallback)==null?void 0:R.call(h,M,l,a)}),S=ld(),C=g.useRef("touch"),P=()=>{a||(p.onValueChange(l),p.onOpenChange(!1))};if(l==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return ee.jsx(DC,{scope:i,value:l,disabled:a,textId:S,isSelected:v,onItemTextChange:g.useCallback(M=>{x(R=>R||((M==null?void 0:M.textContent)??"").trim())},[]),children:ee.jsx(pa.ItemSlot,{scope:i,value:l,disabled:a,textValue:w,children:ee.jsx(Xe.div,{role:"option","aria-labelledby":S,"data-highlighted":E?"":void 0,"aria-selected":v&&E,"data-state":v?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...f,ref:O,onFocus:Je(f.onFocus,()=>y(!0)),onBlur:Je(f.onBlur,()=>y(!1)),onClick:Je(f.onClick,()=>{C.current!=="mouse"&&P()}),onPointerUp:Je(f.onPointerUp,()=>{C.current==="mouse"&&P()}),onPointerDown:Je(f.onPointerDown,M=>{C.current=M.pointerType}),onPointerMove:Je(f.onPointerMove,M=>{var R;C.current=M.pointerType,a?(R=h.onItemLeave)==null||R.call(h):C.current==="mouse"&&M.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Je(f.onPointerLeave,M=>{var R;M.currentTarget===document.activeElement&&((R=h.onItemLeave)==null||R.call(h))}),onKeyDown:Je(f.onKeyDown,M=>{var L;((L=h.searchRef)==null?void 0:L.current)!==""&&M.key===" "||(SC.includes(M.key)&&P(),M.key===" "&&M.preventDefault())})})})})});ny.displayName=ia;var us="SelectItemText",ry=g.forwardRef((n,r)=>{const{__scopeSelect:i,className:l,style:a,...c}=n,f=$r(us,i),p=Wr(us,i),h=ty(us,i),v=bC(us,i),[w,x]=g.useState(null),E=ct(r,P=>x(P),h.onItemTextChange,P=>{var M;return(M=p.itemTextRefCallback)==null?void 0:M.call(p,P,h.value,h.disabled)}),y=w==null?void 0:w.textContent,O=g.useMemo(()=>ee.jsx("option",{value:h.value,disabled:h.disabled,children:y},h.value),[h.disabled,h.value,y]),{onNativeOptionAdd:S,onNativeOptionRemove:C}=v;return It(()=>(S(O),()=>C(O)),[S,C,O]),ee.jsxs(ee.Fragment,{children:[ee.jsx(Xe.span,{id:h.textId,...c,ref:E}),h.isSelected&&f.valueNode&&!f.valueNodeHasChildren?xs.createPortal(c.children,f.valueNode):null]})});ry.displayName=us;var oy="SelectItemIndicator",iy=g.forwardRef((n,r)=>{const{__scopeSelect:i,...l}=n;return ty(oy,i).isSelected?ee.jsx(Xe.span,{"aria-hidden":!0,...l,ref:r}):null});iy.displayName=oy;var Hc="SelectScrollUpButton",sy=g.forwardRef((n,r)=>{const i=Wr(Hc,n.__scopeSelect),l=vd(Hc,n.__scopeSelect),[a,c]=g.useState(!1),f=ct(r,l.onScrollButtonChange);return It(()=>{if(i.viewport&&i.isPositioned){let p=function(){const v=h.scrollTop>0;c(v)};const h=i.viewport;return p(),h.addEventListener("scroll",p),()=>h.removeEventListener("scroll",p)}},[i.viewport,i.isPositioned]),a?ee.jsx(ay,{...n,ref:f,onAutoScroll:()=>{const{viewport:p,selectedItem:h}=i;p&&h&&(p.scrollTop=p.scrollTop-h.offsetHeight)}}):null});sy.displayName=Hc;var $c="SelectScrollDownButton",ly=g.forwardRef((n,r)=>{const i=Wr($c,n.__scopeSelect),l=vd($c,n.__scopeSelect),[a,c]=g.useState(!1),f=ct(r,l.onScrollButtonChange);return It(()=>{if(i.viewport&&i.isPositioned){let p=function(){const v=h.scrollHeight-h.clientHeight,w=Math.ceil(h.scrollTop)<v;c(w)};const h=i.viewport;return p(),h.addEventListener("scroll",p),()=>h.removeEventListener("scroll",p)}},[i.viewport,i.isPositioned]),a?ee.jsx(ay,{...n,ref:f,onAutoScroll:()=>{const{viewport:p,selectedItem:h}=i;p&&h&&(p.scrollTop=p.scrollTop+h.offsetHeight)}}):null});ly.displayName=$c;var ay=g.forwardRef((n,r)=>{const{__scopeSelect:i,onAutoScroll:l,...a}=n,c=Wr("SelectScrollButton",i),f=g.useRef(null),p=ha(i),h=g.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return g.useEffect(()=>()=>h(),[h]),It(()=>{var w;const v=p().find(x=>x.ref.current===document.activeElement);(w=v==null?void 0:v.ref.current)==null||w.scrollIntoView({block:"nearest"})},[p]),ee.jsx(Xe.div,{"aria-hidden":!0,...a,ref:r,style:{flexShrink:0,...a.style},onPointerDown:Je(a.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(l,50))}),onPointerMove:Je(a.onPointerMove,()=>{var v;(v=c.onItemLeave)==null||v.call(c),f.current===null&&(f.current=window.setInterval(l,50))}),onPointerLeave:Je(a.onPointerLeave,()=>{h()})})}),FC="SelectSeparator",uy=g.forwardRef((n,r)=>{const{__scopeSelect:i,...l}=n;return ee.jsx(Xe.div,{"aria-hidden":!0,...l,ref:r})});uy.displayName=FC;var Wc="SelectArrow",zC=g.forwardRef((n,r)=>{const{__scopeSelect:i,...l}=n,a=ma(i),c=$r(Wc,i),f=Wr(Wc,i);return c.open&&f.position==="popper"?ee.jsx(P2,{...a,...l,ref:r}):null});zC.displayName=Wc;var jC="SelectBubbleInput",cy=g.forwardRef(({__scopeSelect:n,value:r,...i},l)=>{const a=g.useRef(null),c=ct(l,a),f=N2(r);return g.useEffect(()=>{const p=a.current;if(!p)return;const h=window.HTMLSelectElement.prototype,w=Object.getOwnPropertyDescriptor(h,"value").set;if(f!==r&&w){const x=new Event("change",{bubbles:!0});w.call(p,r),p.dispatchEvent(x)}},[f,r]),ee.jsx(Xe.select,{...i,style:{...Mv,...i.style},ref:c,defaultValue:r})});cy.displayName=jC;function dy(n){return n===""||n===void 0}function fy(n){const r=go(n),i=g.useRef(""),l=g.useRef(0),a=g.useCallback(f=>{const p=i.current+f;r(p),(function h(v){i.current=v,window.clearTimeout(l.current),v!==""&&(l.current=window.setTimeout(()=>h(""),1e3))})(p)},[r]),c=g.useCallback(()=>{i.current="",window.clearTimeout(l.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(l.current),[]),[i,a,c]}function py(n,r,i){const a=r.length>1&&Array.from(r).every(v=>v===r[0])?r[0]:r,c=i?n.indexOf(i):-1;let f=BC(n,Math.max(c,0));a.length===1&&(f=f.filter(v=>v!==i));const h=f.find(v=>v.textValue.toLowerCase().startsWith(a.toLowerCase()));return h!==i?h:void 0}function BC(n,r){return n.map((i,l)=>n[(r+l)%n.length])}var mk=Bv,vk=Hv,yk=Wv,gk=Vv,wk=Qv,xk=Kv,Sk=Xv,Ck=ey,Ek=ny,kk=ry,bk=iy,Rk=sy,Pk=ly,Tk=uy;const Zh=n=>{let r;const i=new Set,l=(v,w)=>{const x=typeof v=="function"?v(r):v;if(!Object.is(x,r)){const E=r;r=w??(typeof x!="object"||x===null)?x:Object.assign({},r,x),i.forEach(y=>y(r,E))}},a=()=>r,p={setState:l,getState:a,getInitialState:()=>h,subscribe:v=>(i.add(v),()=>i.delete(v))},h=r=n(l,a,p);return p},UC=(n=>n?Zh(n):Zh),HC=n=>n;function $C(n,r=HC){const i=G.useSyncExternalStore(n.subscribe,G.useCallback(()=>r(n.getState()),[n,r]),G.useCallback(()=>r(n.getInitialState()),[n,r]));return G.useDebugValue(i),i}const Jh=n=>{const r=UC(n),i=l=>$C(r,l);return Object.assign(i,r),i},Mk=(n=>n?Jh(n):Jh);export{ak as $,rE as A,uE as B,dE as C,lE as D,Hr as E,Mk as F,kE as G,TE as H,gk as I,ZC as J,OE as K,Ck as L,AE as M,A1 as N,YC as O,wk as P,XC as Q,mk as R,Rk as S,vk as T,c1 as U,Sk as V,KC as W,VC as X,qC as Y,pE as Z,EE as _,Wm as a,BE as a$,NE as a0,WE as a1,DE as a2,pk as a3,z2 as a4,hk as a5,fk as a6,dm as a7,ok as a8,aE as a9,wE as aA,UE as aB,ek as aC,sE as aD,sk as aE,rk as aF,KE as aG,HE as aH,VE as aI,km as aJ,QC as aK,xE as aL,SE as aM,XE as aN,hE as aO,LE as aP,PE as aQ,nk as aR,YE as aS,ME as aT,vE as aU,dk as aV,ck as aW,zE as aX,It as aY,uk as aZ,IE as a_,ik as aa,yE as ab,tk as ac,bE as ad,CE as ae,GE as af,mE as ag,Qh as ah,k2 as ai,ld as aj,b2 as ak,wv as al,Tv as am,ct as an,Xe as ao,Je as ap,sd as aq,F2 as ar,jv as as,ea as at,Yx as au,ov as av,nv as aw,R2 as ax,P2 as ay,QE as az,eE as b,iE as b0,RE as b1,tE as c,lk as d,fE as e,Pk as f,xk as g,Ek as h,bk as i,ee as j,cE as k,kk as l,Tk as m,yk as n,gE as o,JE as p,qE as q,g as r,FE as s,nE as t,JC as u,$E as v,oE as w,ZE as x,jE as y,_E as z};
|
package/ui-dist/index.html
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/logo.svg" />
|
|
7
7
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
8
8
|
<title>NextClaw - 系统配置</title>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-
|
|
11
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-Dl6t70wA.js"></script>
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-d7E8OgNx.js">
|
|
11
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BXwjfCEO.css">
|
|
12
12
|
</head>
|
|
13
13
|
|
|
14
14
|
<body>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as v,j as a,aE as Z,z as ee,d as T,K as ae,ad as te,aP as se,aQ as ne,aR as le,w as re,a1 as oe,aA as ce,q as ie}from"./vendor-TlME1INH.js";import{t as e,c as I,K as me,u as q,a as $,b as K,N as pe,O as de,S as be,e as ue,f as xe,g as ye,h as ge}from"./index-Cn6_2To7.js";import{B as U,P as he,a as fe}from"./page-layout-DO8BlScF.js";import{I as A}from"./input-oBvxsnV9.js";import{L as we}from"./label-C7F8lMpQ.js";import{S as ve}from"./switch-C6a5GyZB.js";import{C as je,a as ke,L as H,S as J,c as Se,b as Ce}from"./LogoBadge-CL_8ZPXU.js";import{h as O}from"./config-hints-CApS3K_7.js";import{T as Ne}from"./tabs-custom-BatFap5k.js";function Pe({value:t,onChange:m,className:i,placeholder:r=""}){const[o,u]=v.useState(""),d=x=>{x.key==="Enter"&&o.trim()?(x.preventDefault(),m([...t,o.trim()]),u("")):x.key==="Backspace"&&!o&&t.length>0&&m(t.slice(0,-1))},g=x=>{m(t.filter((j,h)=>h!==x))};return a.jsxs("div",{className:I("flex flex-wrap gap-2 p-2 border rounded-md min-h-[42px]",i),children:[t.map((x,j)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-primary text-primary-foreground rounded text-sm",children:[x,a.jsx("button",{type:"button",onClick:()=>g(j),className:"hover:text-red-300 transition-colors",children:a.jsx(Z,{className:"h-3 w-3"})})]},j)),a.jsx("input",{type:"text",value:o,onChange:x=>u(x.target.value),onKeyDown:d,className:"flex-1 outline-none min-w-[100px] bg-transparent text-sm",placeholder:r||e("enterTag")})]})}function z(t){var r,o;const m=me();return((r=t.tutorialUrls)==null?void 0:r[m])||((o=t.tutorialUrls)==null?void 0:o.default)||t.tutorialUrl}const Ie={telegram:"telegram.svg",slack:"slack.svg",discord:"discord.svg",whatsapp:"whatsapp.svg",qq:"qq.svg",feishu:"feishu.svg",dingtalk:"dingtalk.svg",wecom:"wecom.svg",mochat:"mochat.svg",email:"email.svg"};function Fe(t,m){const i=m.toLowerCase(),r=t[i];return r?`/logos/${r}`:null}function Y(t){return Fe(Ie,t)}const R=[{value:"pairing",label:"pairing"},{value:"allowlist",label:"allowlist"},{value:"open",label:"open"},{value:"disabled",label:"disabled"}],B=[{value:"open",label:"open"},{value:"allowlist",label:"allowlist"},{value:"disabled",label:"disabled"}],Te=[{value:"off",label:"off"},{value:"partial",label:"partial"},{value:"block",label:"block"},{value:"progress",label:"progress"}],Ae=t=>t.includes("token")||t.includes("secret")||t.includes("password")?a.jsx(ae,{className:"h-3.5 w-3.5 text-gray-500"}):t.includes("url")||t.includes("host")?a.jsx(te,{className:"h-3.5 w-3.5 text-gray-500"}):t.includes("email")||t.includes("mail")?a.jsx(se,{className:"h-3.5 w-3.5 text-gray-500"}):t.includes("id")||t.includes("from")?a.jsx(ne,{className:"h-3.5 w-3.5 text-gray-500"}):t==="enabled"||t==="consentGranted"?a.jsx(le,{className:"h-3.5 w-3.5 text-gray-500"}):a.jsx(re,{className:"h-3.5 w-3.5 text-gray-500"});function G(){return{telegram:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"token",type:"password",label:e("botToken")},{name:"allowFrom",type:"tags",label:e("allowFrom")},{name:"proxy",type:"text",label:e("proxy")},{name:"accountId",type:"text",label:e("accountId")},{name:"dmPolicy",type:"select",label:e("dmPolicy"),options:R},{name:"groupPolicy",type:"select",label:e("groupPolicy"),options:B},{name:"groupAllowFrom",type:"tags",label:e("groupAllowFrom")},{name:"requireMention",type:"boolean",label:e("requireMention")},{name:"mentionPatterns",type:"tags",label:e("mentionPatterns")},{name:"groups",type:"json",label:e("groupRulesJson")}],discord:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"token",type:"password",label:e("botToken")},{name:"allowBots",type:"boolean",label:e("allowBotMessages")},{name:"allowFrom",type:"tags",label:e("allowFrom")},{name:"gatewayUrl",type:"text",label:e("gatewayUrl")},{name:"intents",type:"number",label:e("intents")},{name:"proxy",type:"text",label:e("proxy")},{name:"mediaMaxMb",type:"number",label:e("attachmentMaxSizeMb")},{name:"streaming",type:"select",label:e("streamingMode"),options:Te},{name:"draftChunk",type:"json",label:e("draftChunkingJson")},{name:"textChunkLimit",type:"number",label:e("textChunkLimit")},{name:"accountId",type:"text",label:e("accountId")},{name:"dmPolicy",type:"select",label:e("dmPolicy"),options:R},{name:"groupPolicy",type:"select",label:e("groupPolicy"),options:B},{name:"groupAllowFrom",type:"tags",label:e("groupAllowFrom")},{name:"requireMention",type:"boolean",label:e("requireMention")},{name:"mentionPatterns",type:"tags",label:e("mentionPatterns")},{name:"groups",type:"json",label:e("groupRulesJson")}],whatsapp:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"bridgeUrl",type:"text",label:e("bridgeUrl")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],feishu:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"appId",type:"text",label:e("appId")},{name:"appSecret",type:"password",label:e("appSecret")},{name:"encryptKey",type:"password",label:e("encryptKey")},{name:"verificationToken",type:"password",label:e("verificationToken")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],dingtalk:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"clientId",type:"text",label:e("clientId")},{name:"clientSecret",type:"password",label:e("clientSecret")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],wecom:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"corpId",type:"text",label:e("corpId")},{name:"agentId",type:"text",label:e("agentId")},{name:"secret",type:"password",label:e("secret")},{name:"token",type:"password",label:e("token")},{name:"callbackPort",type:"number",label:e("callbackPort")},{name:"callbackPath",type:"text",label:e("callbackPath")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],slack:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"mode",type:"text",label:e("mode")},{name:"webhookPath",type:"text",label:e("webhookPath")},{name:"allowBots",type:"boolean",label:e("allowBotMessages")},{name:"botToken",type:"password",label:e("botToken")},{name:"appToken",type:"password",label:e("appToken")}],email:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"consentGranted",type:"boolean",label:e("consentGranted")},{name:"imapHost",type:"text",label:e("imapHost")},{name:"imapPort",type:"number",label:e("imapPort")},{name:"imapUsername",type:"text",label:e("imapUsername")},{name:"imapPassword",type:"password",label:e("imapPassword")},{name:"fromAddress",type:"email",label:e("fromAddress")}],mochat:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"baseUrl",type:"text",label:e("baseUrl")},{name:"clawToken",type:"password",label:e("clawToken")},{name:"agentUserId",type:"text",label:e("agentUserId")},{name:"allowFrom",type:"tags",label:e("allowFrom")}],qq:[{name:"enabled",type:"boolean",label:e("enabled")},{name:"appId",type:"text",label:e("appId")},{name:"secret",type:"password",label:e("appSecret")},{name:"markdownSupport",type:"boolean",label:e("markdownSupport")},{name:"allowFrom",type:"tags",label:e("allowFrom")}]}}function D(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Q(t,m){const i={...t};for(const[r,o]of Object.entries(m)){const u=i[r];if(D(u)&&D(o)){i[r]=Q(u,o);continue}i[r]=o}return i}function De(t,m){const i=t.split("."),r={};let o=r;for(let u=0;u<i.length-1;u+=1){const d=i[u];o[d]={},o=o[d]}return o[i[i.length-1]]=m,r}function Le({channelName:t}){var _,E;const{data:m}=q(),{data:i}=$(),{data:r}=K(),o=pe(),u=de(),[d,g]=v.useState({}),[x,j]=v.useState({}),[h,f]=v.useState(null),k=t?m==null?void 0:m.channels[t]:null,w=t?G()[t]??[]:[],c=r==null?void 0:r.uiHints,p=t?`channels.${t}`:null,S=((_=r==null?void 0:r.actions)==null?void 0:_.filter(s=>s.scope===p))??[],C=t&&(((E=O(`channels.${t}`,c))==null?void 0:E.label)??t),P=i==null?void 0:i.channels.find(s=>s.name===t),F=P?z(P):void 0;v.useEffect(()=>{if(k){g({...k});const s={};(t?G()[t]??[]:[]).filter(l=>l.type==="json").forEach(l=>{const y=k[l.name];s[l.name]=JSON.stringify(y??{},null,2)}),j(s)}else g({}),j({})},[k,t]);const N=(s,n)=>{g(l=>({...l,[s]:n}))},L=s=>{if(s.preventDefault(),!t)return;const n={...d};for(const l of w){if(l.type!=="password")continue;const y=n[l.name];(typeof y!="string"||y.length===0)&&delete n[l.name]}for(const l of w){if(l.type!=="json")continue;const y=x[l.name]??"";try{n[l.name]=y.trim()?JSON.parse(y):{}}catch{T.error(`${e("invalidJson")}: ${l.name}`);return}}o.mutate({channel:t,data:n})},V=s=>{if(!s||!t)return;const n=s.channels;if(!D(n))return;const l=n[t];D(l)&&g(y=>Q(y,l))},W=async s=>{if(!(!t||!p)){f(s.id);try{let n={...d};s.saveBeforeRun&&(n={...n,...s.savePatch??{}},g(n),await o.mutateAsync({channel:t,data:n}));const l=await u.mutateAsync({actionId:s.id,data:{scope:p,draftConfig:De(p,n)}});V(l.patch),l.ok?T.success(l.message||e("success")):T.error(l.message||e("error"))}catch(n){const l=n instanceof Error?n.message:String(n);T.error(`${e("error")}: ${l}`)}finally{f(null)}}};if(!t||!P||!k)return a.jsx("div",{className:je,children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-base font-semibold text-gray-900",children:e("channelsSelectTitle")}),a.jsx("p",{className:"mt-2 text-sm text-gray-500",children:e("channelsSelectDescription")})]})});const M=!!k.enabled;return a.jsxs("div",{className:ke,children:[a.jsx("div",{className:"border-b border-gray-100 px-6 py-5",children:a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(H,{name:t,src:Y(t),className:I("h-9 w-9 rounded-lg border",M?"border-primary/30 bg-white":"border-gray-200/70 bg-white"),imgClassName:"h-5 w-5 object-contain",fallback:a.jsx("span",{className:"text-sm font-semibold uppercase text-gray-500",children:t[0]})}),a.jsx("h3",{className:"truncate text-lg font-semibold text-gray-900 capitalize",children:C})]}),a.jsx("p",{className:"mt-2 text-sm text-gray-500",children:e("channelsFormDescription")}),F&&a.jsxs("a",{href:F,className:"mt-2 inline-flex items-center gap-1.5 text-xs text-primary transition-colors hover:text-primary-hover",children:[a.jsx(ee,{className:"h-3.5 w-3.5"}),e("channelsGuideTitle")]})]}),a.jsx(J,{status:M?"active":"inactive",label:M?e("statusActive"):e("statusInactive")})]})}),a.jsxs("form",{onSubmit:L,className:"flex min-h-0 flex-1 flex-col",children:[a.jsx("div",{className:"min-h-0 flex-1 space-y-6 overflow-y-auto overscroll-contain px-6 py-5",children:w.map(s=>{const n=t?O(`channels.${t}.${s.name}`,c):void 0,l=(n==null?void 0:n.label)??s.label,y=n==null?void 0:n.placeholder;return a.jsxs("div",{className:"space-y-2.5",children:[a.jsxs(we,{htmlFor:s.name,className:"flex items-center gap-2 text-sm font-medium text-gray-900",children:[Ae(s.name),l]}),s.type==="boolean"&&a.jsxs("div",{className:"flex items-center justify-between rounded-xl bg-gray-50 p-3",children:[a.jsx("span",{className:"text-sm text-gray-500",children:d[s.name]?e("enabled"):e("disabled")}),a.jsx(ve,{id:s.name,checked:d[s.name]||!1,onCheckedChange:b=>N(s.name,b),className:"data-[state=checked]:bg-emerald-500"})]}),(s.type==="text"||s.type==="email")&&a.jsx(A,{id:s.name,type:s.type,value:d[s.name]||"",onChange:b=>N(s.name,b.target.value),placeholder:y,className:"rounded-xl"}),s.type==="password"&&a.jsx(A,{id:s.name,type:"password",value:d[s.name]||"",onChange:b=>N(s.name,b.target.value),placeholder:y??e("leaveBlankToKeepUnchanged"),className:"rounded-xl"}),s.type==="number"&&a.jsx(A,{id:s.name,type:"number",value:d[s.name]||0,onChange:b=>N(s.name,parseInt(b.target.value,10)||0),placeholder:y,className:"rounded-xl"}),s.type==="tags"&&a.jsx(Pe,{value:d[s.name]||[],onChange:b=>N(s.name,b)}),s.type==="select"&&a.jsxs(be,{value:d[s.name]||"",onValueChange:b=>N(s.name,b),children:[a.jsx(ue,{className:"rounded-xl",children:a.jsx(xe,{})}),a.jsx(ye,{children:(s.options??[]).map(b=>a.jsx(ge,{value:b.value,children:b.label},b.value))})]}),s.type==="json"&&a.jsx("textarea",{id:s.name,value:x[s.name]??"{}",onChange:b=>j(X=>({...X,[s.name]:b.target.value})),className:"min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono"})]},s.name)})}),a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t border-gray-100 px-6 py-4",children:[a.jsx("div",{className:"flex flex-wrap items-center gap-2",children:S.filter(s=>s.trigger==="manual").map(s=>a.jsx(U,{type:"button",onClick:()=>W(s),disabled:o.isPending||!!h,variant:"secondary",children:h===s.id?e("connecting"):s.title},s.id))}),a.jsx(U,{type:"submit",disabled:o.isPending||!!h,children:o.isPending?e("saving"):e("save")})]})]})]})}const Me={telegram:"channelDescTelegram",slack:"channelDescSlack",email:"channelDescEmail",webhook:"channelDescWebhook",discord:"channelDescDiscord",feishu:"channelDescFeishu"};function Ke(){const{data:t}=q(),{data:m}=$(),{data:i}=K(),[r,o]=v.useState("enabled"),[u,d]=v.useState(),[g,x]=v.useState(""),j=i==null?void 0:i.uiHints,h=m==null?void 0:m.channels,f=t==null?void 0:t.channels,k=[{id:"enabled",label:e("channelsTabEnabled"),count:(h??[]).filter(c=>{var p;return(p=f==null?void 0:f[c.name])==null?void 0:p.enabled}).length},{id:"all",label:e("channelsTabAll"),count:(h??[]).length}],w=v.useMemo(()=>{const c=g.trim().toLowerCase();return(h??[]).filter(p=>{var C;const S=((C=f==null?void 0:f[p.name])==null?void 0:C.enabled)||!1;return r==="enabled"?S:!0}).filter(p=>c?(p.displayName||p.name).toLowerCase().includes(c)||p.name.toLowerCase().includes(c):!0)},[r,f,h,g]);return v.useEffect(()=>{if(w.length===0){d(void 0);return}w.some(p=>p.name===u)||d(w[0].name)},[w,u]),!t||!m?a.jsx("div",{className:"p-8 text-gray-400",children:e("channelsLoading")}):a.jsxs(he,{className:"xl:flex xl:h-full xl:min-h-0 xl:flex-col xl:pb-0",children:[a.jsx(fe,{title:e("channelsPageTitle"),description:e("channelsPageDescription")}),a.jsxs("div",{className:I(Ce,"xl:min-h-0 xl:flex-1"),children:[a.jsxs("section",{className:Se,children:[a.jsx("div",{className:"border-b border-gray-100 px-4 pt-4",children:a.jsx(Ne,{tabs:k,activeTab:r,onChange:o,className:"mb-0"})}),a.jsx("div",{className:"border-b border-gray-100 px-4 py-3",children:a.jsxs("div",{className:"relative",children:[a.jsx(oe,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400"}),a.jsx(A,{value:g,onChange:c=>x(c.target.value),placeholder:e("channelsFilterPlaceholder"),className:"h-10 rounded-xl pl-9"})]})}),a.jsxs("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-3",children:[w.map(c=>{const p=t.channels[c.name],S=(p==null?void 0:p.enabled)||!1,C=O(`channels.${c.name}`,j),P=z(c),F=(C==null?void 0:C.help)||e(Me[c.name]||"channelDescriptionDefault"),N=u===c.name;return a.jsx("button",{type:"button",onClick:()=>d(c.name),className:I("w-full rounded-xl border p-2.5 text-left transition-all",N?"border-primary/30 bg-primary-50/40 shadow-sm":"border-gray-200/70 bg-white hover:border-gray-300 hover:bg-gray-50/70"),children:a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[a.jsx(H,{name:c.name,src:Y(c.name),className:I("h-10 w-10 rounded-lg border",S?"border-primary/30 bg-white":"border-gray-200/70 bg-white"),imgClassName:"h-5 w-5 object-contain",fallback:a.jsx("span",{className:"text-sm font-semibold uppercase text-gray-500",children:c.name[0]})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"truncate text-sm font-semibold text-gray-900",children:c.displayName||c.name}),a.jsx("p",{className:"line-clamp-1 text-[11px] text-gray-500",children:F})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[P&&a.jsx("a",{href:P,onClick:L=>L.stopPropagation(),className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-gray-300 transition-colors hover:bg-gray-100/70 hover:text-gray-500",title:e("channelsGuideTitle"),children:a.jsx(ce,{className:"h-3.5 w-3.5"})}),a.jsx(J,{status:S?"active":"inactive",label:S?e("statusActive"):e("statusInactive"),className:"min-w-[56px] justify-center"})]})]})},c.name)}),w.length===0&&a.jsxs("div",{className:"flex h-full min-h-[220px] flex-col items-center justify-center rounded-xl border border-dashed border-gray-200 bg-gray-50/70 py-10 text-center",children:[a.jsx("div",{className:"mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-white",children:a.jsx(ie,{className:"h-5 w-5 text-gray-300"})}),a.jsx("p",{className:"text-sm font-medium text-gray-700",children:e("channelsNoMatch")})]})]})]}),a.jsx(Le,{channelName:u})]})]})}export{Ke as ChannelsList};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,j as t,z as oe,a_ as ae,a$ as ne,aE as W,a0 as ie,v as le,b0 as ce,a1 as de,aA as ue,b1 as me}from"./vendor-TlME1INH.js";import{X as we,D as Y,t as i,c as X,Z as xe}from"./index-Cn6_2To7.js";function pe(){const{isOpen:T,mode:g,tabs:A,activeTabId:N,currentTab:x,currentUrl:l,navVersion:p,close:F,toggleMode:$,goBack:I,goForward:O,canGoBack:_,canGoForward:G,navigate:y,syncUrl:S,setActiveTab:V,closeTab:H,openNewTab:Z}=we(),[k,j]=s.useState(""),[E,C]=s.useState(!1),[q,h]=s.useState(!1),[d,D]=s.useState(()=>({x:Math.max(40,window.innerWidth-520),y:80})),[n,B]=s.useState({w:480,h:600}),[L,J]=s.useState(420),u=s.useRef(null),m=s.useRef(null),b=s.useRef(null),z=s.useRef(null),P=s.useRef(p),a=(x==null?void 0:x.kind)==="docs";s.useEffect(()=>{if(!a){j("");return}try{const e=new URL(l);j(e.pathname)}catch{j(l)}},[l,N,a]),s.useEffect(()=>{var e;if(a){if(p!==P.current){P.current=p;return}if((e=z.current)!=null&&e.contentWindow)try{const r=new URL(l).pathname;z.current.contentWindow.postMessage({type:"docs-navigate",path:r},"*")}catch{}}},[l,p,a]),s.useEffect(()=>{g==="floating"&&D(e=>({x:Math.max(40,window.innerWidth-n.w-40),y:e.y}))},[g,n.w]),s.useEffect(()=>{const e=r=>{var o;a&&((o=r.data)==null?void 0:o.type)==="docs-route-change"&&typeof r.data.url=="string"&&S(r.data.url)};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[S,a]);const K=s.useCallback(e=>{if(e.preventDefault(),!a)return;const r=k.trim();r&&(r.startsWith("/")?y(`${Y}${r}`):r.startsWith("http")?y(r):y(`${Y}/${r}`))},[k,y,a]),Q=s.useCallback(e=>{g==="floating"&&(C(!0),u.current={startX:e.clientX,startY:e.clientY,startPosX:d.x,startPosY:d.y})},[g,d]);s.useEffect(()=>{if(!E)return;const e=o=>{u.current&&D({x:u.current.startPosX+(o.clientX-u.current.startX),y:u.current.startPosY+(o.clientY-u.current.startY)})},r=()=>{C(!1),u.current=null};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",r),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",r)}},[E]);const M=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),h(!0);const r=e.currentTarget.dataset.axis;m.current={startX:e.clientX,startY:e.clientY,startW:n.w,startH:n.h};const o=w=>{m.current&&B(v=>({w:r==="y"?v.w:Math.max(360,m.current.startW+(w.clientX-m.current.startX)),h:r==="x"?v.h:Math.max(400,m.current.startH+(w.clientY-m.current.startY))}))},f=()=>{h(!1),m.current=null,window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",f)};window.addEventListener("mousemove",o),window.addEventListener("mouseup",f)},[n]),ee=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),h(!0),b.current={startX:e.clientX,startW:L};const r=f=>{if(!b.current)return;const w=b.current.startX-f.clientX;J(Math.max(320,Math.min(860,b.current.startW+w)))},o=()=>{h(!1),b.current=null,window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",o)};window.addEventListener("mousemove",r),window.addEventListener("mouseup",o)},[L]),te=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),h(!0);const r=e.clientX,o=n.w,f=d.x,w=re=>{const se=r-re.clientX,U=Math.max(360,o+se);B(R=>({...R,w:U})),D(R=>({...R,x:f-(U-o)}))},v=()=>{h(!1),window.removeEventListener("mousemove",w),window.removeEventListener("mouseup",v)};window.addEventListener("mousemove",w),window.addEventListener("mouseup",v)},[n.w,d.x]);if(!T)return null;const c=g==="docked";return t.jsxs("div",{className:X("flex flex-col bg-white overflow-hidden relative",c?"h-full border-l border-gray-200 shrink-0":"rounded-2xl shadow-2xl border border-gray-200"),style:c?{width:L}:{position:"fixed",left:d.x,top:d.y,width:n.w,height:n.h,zIndex:9999},children:[c&&t.jsx("div",{className:"absolute top-0 left-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors",onMouseDown:ee}),t.jsxs("div",{className:X("flex items-center justify-between px-4 py-2.5 bg-gray-50 border-b border-gray-200 shrink-0 select-none",!c&&"cursor-grab active:cursor-grabbing"),onMouseDown:c?void 0:Q,children:[t.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[t.jsx(oe,{className:"w-4 h-4 text-primary shrink-0"}),t.jsx("span",{className:"text-sm font-semibold text-gray-900 truncate",children:i("docBrowserTitle")})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("button",{onClick:$,className:"hover:bg-gray-200 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors",title:c?i("docBrowserFloatMode"):i("docBrowserDockMode"),children:c?t.jsx(ae,{className:"w-3.5 h-3.5"}):t.jsx(ne,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:F,className:"hover:bg-gray-200 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors",title:i("docBrowserClose"),children:t.jsx(W,{className:"w-3.5 h-3.5"})})]})]}),t.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-2 bg-white border-b border-gray-100 overflow-x-auto custom-scrollbar",children:[A.map(e=>{const r=e.id===N;return t.jsxs("div",{className:X("inline-flex items-center gap-1 h-7 px-1.5 rounded-lg text-xs border max-w-[220px] shrink-0 transition-colors",r?"bg-blue-50 border-blue-300 text-blue-700":"bg-gray-50 border-gray-200 text-gray-600 hover:bg-gray-100"),children:[t.jsx("button",{type:"button",onClick:()=>V(e.id),className:"truncate text-left px-1",title:e.title,children:e.title||i("docBrowserTabUntitled")}),t.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),H(e.id)},className:"rounded p-0.5 hover:bg-black/10","aria-label":i("docBrowserCloseTab"),children:t.jsx(W,{className:"w-3 h-3"})})]},e.id)}),t.jsx("button",{onClick:()=>Z(void 0,{kind:"docs",title:"Docs"}),className:"inline-flex items-center justify-center w-7 h-7 rounded-lg border border-gray-200 bg-white text-gray-600 hover:bg-gray-100 shrink-0",title:i("docBrowserNewTab"),children:t.jsx(ie,{className:"w-3.5 h-3.5"})})]}),a&&t.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-2 bg-white border-b border-gray-100 shrink-0",children:[t.jsx("button",{onClick:I,disabled:!_,className:"p-1.5 rounded-md hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed text-gray-600 transition-colors",children:t.jsx(le,{className:"w-4 h-4"})}),t.jsx("button",{onClick:O,disabled:!G,className:"p-1.5 rounded-md hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed text-gray-600 transition-colors",children:t.jsx(ce,{className:"w-4 h-4"})}),t.jsxs("form",{onSubmit:K,className:"flex-1 relative",children:[t.jsx(de,{className:"w-3.5 h-3.5 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),t.jsx("input",{type:"text",value:k,onChange:e=>j(e.target.value),placeholder:i("docBrowserSearchPlaceholder"),className:"w-full h-8 pl-8 pr-3 rounded-lg bg-gray-50 border border-gray-200 text-xs text-gray-700 focus:outline-none focus:ring-1 focus:ring-primary/30 focus:border-primary/40 transition-colors placeholder:text-gray-400"})]})]}),t.jsxs("div",{className:"flex-1 relative overflow-hidden",children:[t.jsx("iframe",{ref:z,src:l,className:"absolute inset-0 w-full h-full border-0",title:(x==null?void 0:x.title)||"NextClaw Docs",sandbox:"allow-same-origin allow-scripts allow-popups allow-forms",allow:"clipboard-read; clipboard-write"},`${N}:${p}`),(q||E)&&t.jsx("div",{className:"absolute inset-0 z-10"})]}),a&&xe(l)&&t.jsx("div",{className:"flex items-center justify-between px-4 py-2 bg-gray-50 border-t border-gray-200 shrink-0",children:t.jsxs("a",{href:l,target:"_blank",rel:"noopener noreferrer","data-doc-external":!0,className:"flex items-center gap-1.5 text-xs text-primary hover:text-primary-hover font-medium transition-colors",children:[i("docBrowserOpenExternal"),t.jsx(ue,{className:"w-3 h-3"})]})}),!c&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"absolute top-0 left-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors",onMouseDown:te}),t.jsx("div",{className:"absolute top-0 right-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors",onMouseDown:M,"data-axis":"x"}),t.jsx("div",{className:"absolute bottom-0 left-0 h-1.5 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors",onMouseDown:M,"data-axis":"y"}),t.jsx("div",{className:"absolute bottom-0 right-0 w-4 h-4 cursor-se-resize z-30 flex items-center justify-center text-gray-300 hover:text-gray-500 transition-colors",onMouseDown:M,children:t.jsx(me,{className:"w-3 h-3 rotate-[-45deg]"})})]})]})}export{pe as DocBrowser};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,r as i}from"./vendor-TlME1INH.js";import{c as r}from"./index-Cn6_2To7.js";const c={active:{dot:"bg-emerald-500",text:"text-emerald-600",bg:"bg-emerald-50"},ready:{dot:"bg-emerald-500",text:"text-emerald-600",bg:"bg-emerald-50"},inactive:{dot:"bg-gray-300",text:"text-gray-400",bg:"bg-gray-100/80"},setup:{dot:"bg-gray-300",text:"text-gray-400",bg:"bg-gray-100/80"},warning:{dot:"bg-amber-400",text:"text-amber-600",bg:"bg-amber-50"}};function h({status:a,label:l,className:n}){const t=c[a];return e.jsxs("div",{className:r("inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2 py-0.5",t.bg,n),children:[e.jsx("span",{className:r("h-1.5 w-1.5 rounded-full",t.dot)}),e.jsx("span",{className:r("text-[11px] font-medium",t.text),children:l})]})}const b="grid min-h-0 grid-cols-1 gap-5 xl:grid-cols-[340px_minmax(0,1fr)]",p="flex min-h-[520px] min-h-0 min-w-0 flex-col overflow-hidden rounded-2xl border border-gray-200/70 bg-white shadow-card xl:h-[calc(100vh-180px)] xl:min-h-[600px] xl:max-h-[860px]",f="flex min-h-[520px] min-h-0 min-w-0 flex-col overflow-hidden rounded-2xl border border-gray-200/70 bg-white shadow-card xl:h-[calc(100vh-180px)] xl:min-h-[600px] xl:max-h-[860px]",u="flex min-h-[520px] min-w-0 items-center justify-center overflow-hidden rounded-2xl border border-gray-200/70 bg-white px-6 text-center xl:h-[calc(100vh-180px)] xl:min-h-[600px] xl:max-h-[860px]";function w({name:a,src:l,className:n,imgClassName:t,fallback:s}){const[o,x]=i.useState(!1),d=!!l&&!o;return e.jsx("div",{className:r("inline-flex shrink-0 items-center justify-center overflow-hidden",n),children:d?e.jsx("img",{src:l,alt:`${a} logo`,className:r("block h-6 w-6 object-contain",t),onError:()=>x(!0),draggable:!1}):s??e.jsx("span",{className:"text-lg font-bold uppercase",children:a.slice(0,1)})})}export{u as C,w as L,h as S,f as a,b,p as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,r as i,Y,k as B,p as q,z as G,Z as K,_ as Z}from"./vendor-TlME1INH.js";import{P as $,a as J,B as Q}from"./page-layout-DO8BlScF.js";import{C as U}from"./card-C7Gtw2Vs.js";import{I as A}from"./input-oBvxsnV9.js";import{L as _}from"./label-C7F8lMpQ.js";import{c as L,u as X,a as H,b as ee,d as se,t as c,S as te,e as ae,f as le,g as re,h as ne,D as oe}from"./index-Cn6_2To7.js";import{h as R}from"./config-hints-CApS3K_7.js";import{b as ie,f as ce,t as T,c as de}from"./provider-models-y4mUDcGF.js";function h({className:o,...l}){return e.jsx("div",{className:L("animate-pulse rounded-md bg-slate-200",o),...l})}function me(o){const l=new Set;for(const u of o){const m=u.trim();m.length>0&&l.add(m)}return[...l]}function xe({id:o,value:l,onChange:u,options:m,placeholder:N,className:w,inputClassName:y,emptyText:b,createText:f,maxItems:v=Number.POSITIVE_INFINITY,onEnter:M}){const[C,r]=i.useState(!1),d=i.useMemo(()=>me(m),[m]),a=l.trim().toLowerCase(),g=i.useMemo(()=>{const s=d.map((x,j)=>({option:x,index:j}));a.length>0&&s.sort((x,j)=>{const S=x.option.toLowerCase(),k=j.option.toLowerCase(),D=S===a?0:S.startsWith(a)?1:S.includes(a)?2:3,I=k===a?0:k.startsWith(a)?1:k.includes(a)?2:3;return D!==I?D-I:x.index-j.index});const p=s.map(x=>x.option);return Number.isFinite(v)?p.slice(0,Math.max(1,v)):p},[d,a,v]),n=l.trim().length>0&&d.some(s=>s===l.trim());return e.jsxs("div",{className:L("relative",w),onBlur:()=>{setTimeout(()=>r(!1),120)},children:[e.jsx(A,{id:o,value:l,onFocus:()=>r(!0),onChange:s=>{u(s.target.value),C||r(!0)},onKeyDown:s=>{s.key==="Enter"&&(M&&(s.preventDefault(),M()),r(!1))},placeholder:N,className:L("pr-10",y)}),e.jsx("button",{type:"button",onMouseDown:s=>s.preventDefault(),onClick:()=>r(s=>!s),className:"absolute inset-y-0 right-0 inline-flex w-10 items-center justify-center text-gray-400 hover:text-gray-600","aria-label":"toggle model options",children:e.jsx(Y,{className:"h-4 w-4"})}),C&&e.jsx("div",{className:"absolute z-20 mt-1 w-full overflow-hidden rounded-xl border border-gray-200 bg-white shadow-lg",children:e.jsxs("div",{className:"max-h-60 overflow-y-auto py-1",children:[!n&&l.trim().length>0&&e.jsxs("button",{type:"button",onMouseDown:s=>s.preventDefault(),onClick:()=>{u(l.trim()),r(!1)},className:"flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-gray-50",children:[e.jsx(B,{className:"h-4 w-4 text-transparent"}),e.jsx("span",{className:"truncate text-gray-700",children:f?f.replace("{value}",l.trim()):l.trim()})]}),g.map(s=>e.jsxs("button",{type:"button",onMouseDown:p=>p.preventDefault(),onClick:()=>{u(s),r(!1)},className:"flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-gray-50",children:[e.jsx(B,{className:L("h-4 w-4",s===l.trim()?"text-primary":"text-transparent")}),e.jsx("span",{className:"truncate text-gray-700",children:s})]},s)),g.length===0&&l.trim().length===0&&e.jsx("div",{className:"px-3 py-2 text-sm text-gray-500",children:b??"No models available"})]})})]})}function ye(){const{data:o,isLoading:l}=X(),{data:u}=H(),{data:m}=ee(),N=se(),[w,y]=i.useState(""),[b,f]=i.useState(""),[v,M]=i.useState(""),C=m==null?void 0:m.uiHints,r=R("agents.defaults.model",C),d=R("agents.defaults.workspace",C),a=i.useMemo(()=>ie({meta:u,config:o}),[o,u]),g=i.useMemo(()=>new Map(a.map(t=>[t.name,t])),[a]),n=g.get(w)??a[0],s=(n==null?void 0:n.name)??"",p=i.useMemo(()=>(n==null?void 0:n.aliases)??[],[n]),x=i.useMemo(()=>(n==null?void 0:n.models)??[],[n]);i.useEffect(()=>{w||a.length===0||y(a[0].name)},[w,a]),i.useEffect(()=>{var E,F,z;if(!((E=o==null?void 0:o.agents)!=null&&E.defaults))return;const t=(o.agents.defaults.model||"").trim(),P=ce(t,a)??((F=a[0])==null?void 0:F.name)??"",W=((z=g.get(P))==null?void 0:z.aliases)??[];y(P),f(T(t,W)),M(o.agents.defaults.workspace||"")},[o,a,g]);const j=i.useMemo(()=>{const t=new Set;for(const O of x){const P=O.trim();P&&t.add(P)}return[...t]},[x]),S=i.useMemo(()=>{const t=T(b,p);return t?de((n==null?void 0:n.prefix)??"",t):""},[b,n,p]),k=c("modelIdentifierHelp")||(r==null?void 0:r.help)||"",D=t=>{y(t),f("")},I=t=>{f(T(t,p))},V=t=>{t.preventDefault(),N.mutate({model:S})};return l?e.jsxs("div",{className:"max-w-2xl space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:"h-8 w-32"}),e.jsx(h,{className:"h-4 w-48"})]}),e.jsxs(U,{className:"rounded-2xl border-gray-200 p-6",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx(h,{className:"h-12 w-12 rounded-xl"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:"h-5 w-24"}),e.jsx(h,{className:"h-3 w-32"})]})]}),e.jsx(h,{className:"h-4 w-20 mb-2"}),e.jsx(h,{className:"h-10 w-full rounded-xl"})]}),e.jsxs(U,{className:"rounded-2xl border-gray-200 p-6",children:[e.jsx(h,{className:"h-5 w-24 mb-2"}),e.jsx(h,{className:"h-10 w-full rounded-xl"})]})]}):e.jsxs($,{children:[e.jsx(J,{title:c("modelPageTitle"),description:c("modelPageDescription")}),e.jsxs("form",{onSubmit:V,className:"space-y-8",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[e.jsxs("div",{className:"p-8 rounded-2xl bg-white border border-gray-200 shadow-card",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-8",children:[e.jsx("div",{className:"h-10 w-10 rounded-xl bg-primary flex items-center justify-center text-white",children:e.jsx(q,{className:"h-5 w-5"})}),e.jsx("h3",{className:"text-lg font-bold text-gray-900",children:c("defaultModel")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{htmlFor:"model",className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:(r==null?void 0:r.label)??"Model Name"}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsx("div",{className:"sm:w-[38%] sm:min-w-[170px]",children:e.jsxs(te,{value:s,onValueChange:D,children:[e.jsx(ae,{className:"h-10 w-full rounded-xl",children:e.jsx(le,{placeholder:c("providersSelectPlaceholder")})}),e.jsx(re,{children:a.map(t=>e.jsx(ne,{value:t.name,children:t.displayName},t.name))})]})}),e.jsx("span",{className:"hidden h-10 items-center justify-center leading-none text-lg font-semibold text-gray-300 sm:inline-flex",children:"/"}),e.jsx(xe,{id:"model",value:b,onChange:I,options:j,placeholder:(r==null?void 0:r.placeholder)??"gpt-5.1",className:"sm:flex-1",inputClassName:"h-10 rounded-xl",emptyText:c("modelPickerNoOptions"),createText:c("modelPickerUseCustom")},s)]}),e.jsx("p",{className:"text-xs text-gray-400",children:k}),e.jsx("p",{className:"text-xs text-gray-500",children:c("modelInputCustomHint")}),e.jsxs("a",{href:`${oe}/guide/model-selection`,className:"inline-flex items-center gap-1.5 text-xs text-primary hover:text-primary-hover transition-colors",children:[e.jsx(G,{className:"h-3.5 w-3.5"}),c("channelsGuideTitle")]})]})]}),e.jsxs("div",{className:"p-8 rounded-2xl bg-white border border-gray-200 shadow-card",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-8",children:[e.jsx("div",{className:"h-10 w-10 rounded-xl bg-primary flex items-center justify-center text-white",children:e.jsx(K,{className:"h-5 w-5"})}),e.jsx("h3",{className:"text-lg font-bold text-gray-900",children:c("workspace")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{htmlFor:"workspace",className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:(d==null?void 0:d.label)??"Default Path"}),e.jsx(A,{id:"workspace",value:v,onChange:t=>M(t.target.value),placeholder:(d==null?void 0:d.placeholder)??"/path/to/workspace",className:"rounded-xl"})]})]})]}),e.jsx("div",{className:"flex justify-end pt-4",children:e.jsx(Q,{type:"submit",disabled:N.isPending,size:"lg",children:N.isPending?e.jsx(Z,{className:"h-5 w-5 animate-spin"}):c("saveChanges")})})]})]})}export{ye as ModelConfig};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as c,j as e,aL as ht,aM as xt,aF as Xe,a0 as Ce,a as pt,d as z,aE as He,aN as ft,C as yt,aO as gt,a1 as jt,K as bt}from"./vendor-TlME1INH.js";import{c as ie,t as a,u as Ze,a as et,b as tt,E as vt,F as wt,G as Nt,H as Ct,I as At,J as Pt,K as Mt,S as We,e as qe,f as Ue,g as Ge,h as Qe,M as St}from"./index-Cn6_2To7.js";import{B,P as It,a as Dt}from"./page-layout-DO8BlScF.js";import{I as q}from"./input-oBvxsnV9.js";import{L as R}from"./label-C7F8lMpQ.js";import{C as Et,a as Lt,S as st,b as kt,c as $t,L as Bt}from"./LogoBadge-CL_8ZPXU.js";import{h as re}from"./config-hints-CApS3K_7.js";import{T as Tt}from"./tabs-custom-BatFap5k.js";function Ft({isSet:t,className:i,value:r,onChange:l,placeholder:m,...j}){const[h,x]=c.useState(!1),[f,b]=c.useState(!1),v=typeof r=="string"&&r.length>0,D=t&&!v&&!f;return e.jsxs("div",{className:"relative",children:[D?e.jsx("div",{onClick:()=>b(!0),className:ie("flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-500 cursor-text items-center pr-12",i),children:"••••••••••••"}):e.jsx(q,{type:h?"text":"password",className:ie("pr-12",i),value:r,onChange:l,onBlur:()=>{v||b(!1)},placeholder:m,autoFocus:f,...j}),e.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex gap-1",children:(t||v)&&e.jsx(B,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>x(!h),children:h?e.jsx(ht,{className:"h-4 w-4"}):e.jsx(xt,{className:"h-4 w-4"})})})]})}function Kt({value:t,onChange:i,className:r}){const l=t?Object.entries(t):[],m=(x,f,b)=>{const v=[...l];v[x]=[f,b],i(Object.fromEntries(v))},j=()=>{i({...t,"":""})},h=x=>{const f=l.filter((b,v)=>v!==x);i(Object.fromEntries(f))};return e.jsxs("div",{className:ie("space-y-2",r),children:[l.map(([x,f],b)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(q,{type:"text",value:x,onChange:v=>m(b,v.target.value,f),placeholder:a("headerName"),className:"flex-1"}),e.jsx(q,{type:"text",value:f,onChange:v=>m(b,x,v.target.value),placeholder:a("headerValue"),className:"flex-1"}),e.jsx(B,{type:"button",variant:"ghost",size:"icon",onClick:()=>h(b),children:e.jsx(Xe,{className:"h-4 w-4 text-red-500"})})]},b)),e.jsxs(B,{type:"button",variant:"outline",size:"sm",onClick:j,children:[e.jsx(Ce,{className:"h-4 w-4 mr-2"}),a("add")]})]})}const zt={displayName:"",apiKeySet:!1,apiBase:null,extraHeaders:null,wireApi:null,models:[]};function ne(t){if(!t)return null;const i=Object.entries(t).map(([r,l])=>[r.trim(),l]).filter(([r])=>r.length>0);return i.length===0?null:Object.fromEntries(i)}function Ve(t,i){const r=ne(t),l=ne(i);if(r===null&&l===null)return!0;if(!r||!l)return!1;const m=Object.entries(r).sort(([h],[x])=>h.localeCompare(x)),j=Object.entries(l).sort(([h],[x])=>h.localeCompare(x));return m.length!==j.length?!1:m.every(([h,x],f)=>h===j[f][0]&&x===j[f][1])}function we(t){if(!t||t.length===0)return[];const i=new Set;for(const r of t){const l=r.trim();l&&i.add(l)}return[...i]}function Ot(t,i){const r=t.trim();if(!r||!i.trim())return r;const l=`${i.trim()}/`;return r.startsWith(l)?r.slice(l.length):r}function xe(t,i){let r=t.trim();if(!r)return"";for(const l of i){const m=l.trim();m&&(r=Ot(r,m))}return r.trim()}function Ne(t,i){return t.length!==i.length?!1:t.every((r,l)=>r===i[l])}function _t(t,i){const r=[...t];for(const l of i)r.includes(l)||r.push(l);return r}function Rt(t,i){return i.length===0?t:i.every(l=>!t.includes(l))?_t(t,i):i}function Ht(t,i){return Ne(t,i)?[]:t}function Wt(t){var f,b,v,D,E;const{providerName:i,methods:r,defaultMethodId:l,language:m}=t;if(r.length===0)return"";const j=new Map;for(const P of r){const N=P.id.trim();N&&j.set(N.toLowerCase(),N)}const h=(...P)=>{for(const N of P){const C=j.get(N.toLowerCase());if(C)return C}},x=l==null?void 0:l.trim();if(i==="minimax-portal"){if(m==="zh")return h("cn","china-mainland")??h(x??"")??((f=r[0])==null?void 0:f.id)??"";if(m==="en")return h("global","intl","international")??h(x??"")??((b=r[0])==null?void 0:b.id)??""}if(x){const P=h(x);if(P)return P}return m==="zh"?h("cn")??((v=r[0])==null?void 0:v.id)??"":m==="en"?h("global")??((D=r[0])==null?void 0:D.id)??"":((E=r[0])==null?void 0:E.id)??""}function Ye(t){return t.required&&t.hasDefault&&t.optionCount>1&&t.optionCount<=3}function Je(t){const{value:i,onChange:r,options:l}=t;return e.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(m=>{const j=m.value===i;return e.jsx("button",{type:"button",onClick:()=>r(m.value),"aria-pressed":j,className:`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors ${j?"border-primary bg-primary text-white shadow-sm":"border-gray-200 bg-white text-gray-700 hover:border-primary/40 hover:text-primary"}`,children:m.label},m.value)})})}function qt({providerName:t,onProviderDeleted:i}){var Te,Fe,Ke,ze,Oe,_e,Re;const r=pt(),{data:l}=Ze(),{data:m}=et(),{data:j}=tt(),h=vt(),x=wt(),f=Nt(),b=Ct(),v=At(),D=Pt(),[E,P]=c.useState(""),[N,C]=c.useState(""),[O,X]=c.useState(null),[u,g]=c.useState("auto"),[w,A]=c.useState([]),[T,M]=c.useState(""),[$,H]=c.useState(""),[Z,le]=c.useState(!1),[pe,oe]=c.useState(!1),[ce,_]=c.useState(null),[Ae,L]=c.useState(""),[Pe,de]=c.useState(""),ue=c.useRef(null),n=m==null?void 0:m.providers.find(s=>s.name===t),k=(t?l==null?void 0:l.providers[t]:null)??zt,me=j==null?void 0:j.uiHints,U=!!(n!=null&&n.isCustom),G=t?re(`providers.${t}.apiKey`,me):void 0,F=t?re(`providers.${t}.apiBase`,me):void 0,fe=t?re(`providers.${t}.extraHeaders`,me):void 0,ye=t?re(`providers.${t}.wireApi`,me):void 0,Me=(n==null?void 0:n.displayName)||t||"",Q=(k.displayName||"").trim()||Me,at=$.trim()||Q||t||a("providersSelectPlaceholder"),Se=(n==null?void 0:n.modelPrefix)||t||"",V=c.useMemo(()=>we([Se,t||""]),[Se,t]),ge=(n==null?void 0:n.defaultApiBase)||"",ee=k.apiBase||ge,je=ne(k.extraHeaders||null),te=k.wireApi||(n==null?void 0:n.defaultWireApi)||"auto",be=c.useMemo(()=>we(((n==null?void 0:n.defaultModels)??[]).map(s=>xe(s,V))),[n==null?void 0:n.defaultModels,V]),Ie=c.useMemo(()=>we((k.models??[]).map(s=>xe(s,V))),[k.models,V]),se=c.useMemo(()=>Rt(be,Ie),[be,Ie]),W=Mt(),rt=((Te=n==null?void 0:n.apiBaseHelp)==null?void 0:Te[W])||((Fe=n==null?void 0:n.apiBaseHelp)==null?void 0:Fe.en)||(F==null?void 0:F.help)||a("providerApiBaseHelp"),o=n==null?void 0:n.auth,S=c.useMemo(()=>(o==null?void 0:o.methods)??[],[o==null?void 0:o.methods]),De=c.useMemo(()=>S.map(s=>{var d,p;return{value:s.id,label:((d=s.label)==null?void 0:d[W])||((p=s.label)==null?void 0:p.en)||s.id}}),[S,W]),he=c.useMemo(()=>Wt({providerName:t,methods:S,defaultMethodId:o==null?void 0:o.defaultMethodId,language:W}),[t,o==null?void 0:o.defaultMethodId,S,W]),Y=c.useMemo(()=>{var d;if(!S.length)return"";const s=Pe.trim();return s&&S.some(p=>p.id===s)?s:he||((d=S[0])==null?void 0:d.id)||""},[Pe,he,S]),J=c.useMemo(()=>S.find(s=>s.id===Y),[S,Y]),Ee=((Ke=J==null?void 0:J.hint)==null?void 0:Ke[W])||((ze=J==null?void 0:J.hint)==null?void 0:ze.en)||"",nt=Ye({required:(o==null?void 0:o.kind)==="device_code",hasDefault:!!((Oe=o==null?void 0:o.defaultMethodId)!=null&&Oe.trim()),optionCount:S.length}),Le=((_e=o==null?void 0:o.note)==null?void 0:_e[W])||((Re=o==null?void 0:o.note)==null?void 0:Re.en)||(o==null?void 0:o.displayName)||"",ve=((n==null?void 0:n.wireApiOptions)||["auto","chat","responses"]).map(s=>({value:s,label:s==="chat"?a("wireApiChat"):s==="responses"?a("wireApiResponses"):a("wireApiAuto")})),it=Ye({required:!!(n!=null&&n.supportsWireApi),hasDefault:typeof(n==null?void 0:n.defaultWireApi)=="string"&&n.defaultWireApi.length>0,optionCount:ve.length}),I=c.useCallback(()=>{ue.current!==null&&(window.clearTimeout(ue.current),ue.current=null)},[]),ke=c.useCallback((s,d)=>{I(),ue.current=window.setTimeout(()=>{(async()=>{if(t)try{const p=await v.mutateAsync({provider:t,data:{sessionId:s}});if(p.status==="pending"){L(a("providerAuthWaitingBrowser")),ke(s,p.nextPollMs??d);return}if(p.status==="authorized"){_(null),I(),L(a("providerAuthCompleted")),z.success(a("providerAuthCompleted")),r.invalidateQueries({queryKey:["config"]}),r.invalidateQueries({queryKey:["config-meta"]});return}_(null),I(),L(p.message||`Authorization ${p.status}.`),z.error(p.message||`Authorization ${p.status}.`)}catch(p){_(null),I();const y=p instanceof Error?p.message:String(p);L(y),z.error(`Authorization failed: ${y}`)}})()},Math.max(1e3,d))},[I,v,t,r]);c.useEffect(()=>{if(!t){P(""),C(""),X(null),g("auto"),A([]),M(""),H(""),_(null),L(""),de(""),I();return}P(""),C(ee),X(k.extraHeaders||null),g(te),A(se),M(""),H(Q),_(null),L(""),de(he),I()},[t,ee,k.extraHeaders,te,se,Q,he,I]),c.useEffect(()=>()=>I(),[I]);const $e=c.useMemo(()=>{if(!t)return!1;const s=E.trim().length>0,d=N.trim()!==ee.trim(),p=!Ve(O,je),y=n!=null&&n.supportsWireApi?u!==te:!1,K=!Ne(w,se),ae=U?$.trim()!==Q:!1;return s||d||p||y||K||ae},[t,U,$,Q,E,N,ee,O,je,n==null?void 0:n.supportsWireApi,u,te,w,se]),Be=()=>{const s=xe(T,V);if(s){if(w.includes(s)){M("");return}A(d=>[...d,s]),M("")}},lt=s=>{if(s.preventDefault(),!t)return;const d={},p=E.trim(),y=N.trim(),K=ne(O),ae=$.trim();U&&ae!==Q&&(d.displayName=ae.length>0?ae:null),p.length>0&&(d.apiKey=p),y!==ee.trim()&&(d.apiBase=y.length>0&&y!==ge?y:null),Ve(K,je)||(d.extraHeaders=K),n!=null&&n.supportsWireApi&&u!==te&&(d.wireApi=u),Ne(w,se)||(d.models=Ht(w,be)),h.mutate({provider:t,data:d})},ot=async()=>{if(!t)return;const s=w.find(y=>y.trim().length>0)??"",d=xe(s,V),p={apiBase:N.trim(),extraHeaders:ne(O),model:d||null};E.trim().length>0&&(p.apiKey=E.trim()),n!=null&&n.supportsWireApi&&(p.wireApi=u);try{const y=await f.mutateAsync({provider:t,data:p});if(y.success){z.success(`${a("providerTestConnectionSuccess")} (${y.latencyMs}ms)`);return}const K=[`provider=${y.provider}`,`latency=${y.latencyMs}ms`];y.model&&K.push(`model=${y.model}`),z.error(`${a("providerTestConnectionFailed")}: ${y.message} | ${K.join(" | ")}`)}catch(y){const K=y instanceof Error?y.message:String(y);z.error(`${a("providerTestConnectionFailed")}: ${K}`)}},ct=async()=>{if(!(!t||!U||!window.confirm(a("providerDeleteConfirm"))))try{await x.mutateAsync({provider:t}),i==null||i(t)}catch{}},dt=async()=>{if(!(!t||(o==null?void 0:o.kind)!=="device_code"))try{L("");const s=await b.mutateAsync({provider:t,data:Y?{methodId:Y}:{}});if(!s.sessionId||!s.verificationUri)throw new Error(a("providerAuthStartFailed"));_(s.sessionId),L(`${a("providerAuthOpenPrompt")}${s.userCode}${a("providerAuthOpenPromptSuffix")}`),window.open(s.verificationUri,"_blank","noopener,noreferrer"),ke(s.sessionId,s.intervalMs)}catch(s){const d=s instanceof Error?s.message:String(s);_(null),I(),L(d),z.error(`${a("providerAuthStartFailed")}: ${d}`)}},ut=async()=>{if(!(!t||(o==null?void 0:o.kind)!=="device_code"))try{I(),_(null);const s=await D.mutateAsync({provider:t}),d=s.expiresAt?` (expires: ${s.expiresAt})`:"";L(`${a("providerAuthImportStatusPrefix")}${d}`),z.success(a("providerAuthImportSuccess")),r.invalidateQueries({queryKey:["config"]}),r.invalidateQueries({queryKey:["config-meta"]})}catch(s){const d=s instanceof Error?s.message:String(s);L(d),z.error(`${a("providerAuthImportFailed")}: ${d}`)}};if(!t||!n)return e.jsx("div",{className:Et,children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold text-gray-900",children:a("providersSelectTitle")}),e.jsx("p",{className:"mt-2 text-sm text-gray-500",children:a("providersSelectDescription")})]})});const mt=k.apiKeySet?a("statusReady"):a("statusSetup");return e.jsxs("div",{className:Lt,children:[e.jsx("div",{className:"border-b border-gray-100 px-6 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"truncate text-lg font-semibold text-gray-900",children:at}),e.jsxs("div",{className:"flex items-center gap-3",children:[U&&e.jsx("button",{type:"button",onClick:ct,disabled:x.isPending,className:"text-gray-400 hover:text-red-500 transition-colors",title:a("providerDelete"),children:e.jsx(Xe,{className:"h-4 w-4"})}),e.jsx(st,{status:k.apiKeySet?"ready":"setup",label:mt})]})]})}),e.jsxs("form",{onSubmit:lt,className:"flex min-h-0 flex-1 flex-col",children:[e.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto px-6 py-5",children:[U&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(R,{htmlFor:"providerDisplayName",className:"text-sm font-medium text-gray-900",children:a("providerDisplayName")}),e.jsx(q,{id:"providerDisplayName",type:"text",value:$,onChange:s=>H(s.target.value),placeholder:Me||a("providerDisplayNamePlaceholder"),className:"rounded-xl"}),e.jsx("p",{className:"text-xs text-gray-500",children:a("providerDisplayNameHelpShort")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(R,{htmlFor:"apiKey",className:"text-sm font-medium text-gray-900",children:(G==null?void 0:G.label)??a("apiKey")}),e.jsx(Ft,{id:"apiKey",value:E,isSet:k.apiKeySet,onChange:s=>P(s.target.value),placeholder:(G==null?void 0:G.placeholder)??a("enterApiKey"),className:"rounded-xl"}),e.jsx("p",{className:"text-xs text-gray-500",children:a("leaveBlankToKeepUnchanged")})]}),(o==null?void 0:o.kind)==="device_code"&&e.jsxs("div",{className:"space-y-2 rounded-xl border border-primary/20 bg-primary-50/50 p-3",children:[e.jsx(R,{className:"text-sm font-medium text-gray-900",children:o.displayName||a("providerAuthSectionTitle")}),Le?e.jsx("p",{className:"text-xs text-gray-600",children:Le}):null,S.length>1?e.jsxs("div",{className:"space-y-2",children:[e.jsx(R,{className:"text-xs font-medium text-gray-700",children:a("providerAuthMethodLabel")}),nt?e.jsx(Je,{value:Y,onChange:de,options:De}):e.jsxs(We,{value:Y,onValueChange:de,children:[e.jsx(qe,{className:"h-8 rounded-lg bg-white",children:e.jsx(Ue,{placeholder:a("providerAuthMethodPlaceholder")})}),e.jsx(Ge,{children:De.map(s=>e.jsx(Qe,{value:s.value,children:s.label},s.value))})]}),Ee?e.jsx("p",{className:"text-xs text-gray-500",children:Ee}):null]}):null,e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(B,{type:"button",variant:"outline",size:"sm",onClick:dt,disabled:b.isPending||!!ce,children:b.isPending?a("providerAuthStarting"):ce?a("providerAuthAuthorizing"):a("providerAuthAuthorizeInBrowser")}),o.supportsCliImport?e.jsx(B,{type:"button",variant:"outline",size:"sm",onClick:ut,disabled:D.isPending,children:D.isPending?a("providerAuthImporting"):a("providerAuthImportFromCli")}):null,ce?e.jsxs("span",{className:"text-xs text-gray-500",children:[a("providerAuthSessionLabel"),": ",ce.slice(0,8),"…"]}):null]}),Ae?e.jsx("p",{className:"text-xs text-gray-600",children:Ae}):null]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(R,{htmlFor:"apiBase",className:"text-sm font-medium text-gray-900",children:(F==null?void 0:F.label)??a("apiBase")}),e.jsx(q,{id:"apiBase",type:"text",value:N,onChange:s=>C(s.target.value),placeholder:ge||(F==null?void 0:F.placeholder)||"https://api.example.com",className:"rounded-xl"}),e.jsx("p",{className:"text-xs text-gray-500",children:rt})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(R,{className:"text-sm font-medium text-gray-900",children:a("providerModelsTitle")}),!pe&&e.jsxs("button",{type:"button",onClick:()=>oe(!0),className:"text-xs text-primary hover:text-primary/80 font-medium flex items-center gap-1",children:[e.jsx(Ce,{className:"h-3 w-3"}),a("providerAddModel")]})]}),pe&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(q,{value:T,onChange:s=>M(s.target.value),onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),Be()),s.key==="Escape"&&(oe(!1),M(""))},placeholder:a("providerModelInputPlaceholder"),className:"flex-1 rounded-xl",autoFocus:!0}),e.jsx(B,{type:"button",size:"sm",onClick:Be,disabled:T.trim().length===0,children:a("add")}),e.jsx(B,{type:"button",size:"sm",variant:"ghost",onClick:()=>{oe(!1),M("")},children:e.jsx(He,{className:"h-4 w-4"})})]}),w.length===0?e.jsxs("div",{className:"rounded-xl border border-dashed border-gray-200 bg-gray-50 px-4 py-6 text-center",children:[e.jsx("p",{className:"text-sm text-gray-500",children:a("providerModelsEmptyShort")}),!pe&&e.jsx("button",{type:"button",onClick:()=>oe(!0),className:"mt-2 text-sm text-primary hover:text-primary/80 font-medium",children:a("providerAddFirstModel")})]}):e.jsx("div",{className:"flex flex-wrap gap-2",children:w.map(s=>e.jsxs("div",{className:"group inline-flex max-w-full items-center gap-1 rounded-full border border-gray-200 bg-white px-3 py-1.5",children:[e.jsx("span",{className:"max-w-[180px] truncate text-sm text-gray-800 sm:max-w-[240px]",children:s}),e.jsx("button",{type:"button",onClick:()=>A(d=>d.filter(p=>p!==s)),className:"inline-flex h-5 w-5 items-center justify-center rounded-full text-gray-400 transition-opacity hover:bg-gray-100 hover:text-gray-600 opacity-100 md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100","aria-label":a("remove"),children:e.jsx(He,{className:"h-3 w-3"})})]},s))})]}),e.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[e.jsxs("button",{type:"button",onClick:()=>le(!Z),className:"flex w-full items-center justify-between text-sm text-gray-600 hover:text-gray-900 transition-colors",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(ft,{className:"h-3.5 w-3.5"}),a("providerAdvancedSettings")]}),e.jsx(yt,{className:`h-4 w-4 transition-transform ${Z?"rotate-180":""}`})]}),Z&&e.jsxs("div",{className:"mt-4 space-y-5",children:[n.supportsWireApi&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(R,{htmlFor:"wireApi",className:"text-sm font-medium text-gray-900",children:(ye==null?void 0:ye.label)??a("wireApi")}),it?e.jsx(Je,{value:u,onChange:s=>g(s),options:ve}):e.jsxs(We,{value:u,onValueChange:s=>g(s),children:[e.jsx(qe,{className:"rounded-xl",children:e.jsx(Ue,{})}),e.jsx(Ge,{children:ve.map(s=>e.jsx(Qe,{value:s.value,children:s.label},s.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(R,{className:"text-sm font-medium text-gray-900",children:(fe==null?void 0:fe.label)??a("extraHeaders")}),e.jsx(Kt,{value:O,onChange:X}),e.jsx("p",{className:"text-xs text-gray-500",children:a("providerExtraHeadersHelpShort")})]})]})]})]}),e.jsxs("div",{className:"flex items-center justify-between border-t border-gray-100 px-6 py-4",children:[e.jsxs(B,{type:"button",variant:"outline",size:"sm",onClick:ot,disabled:f.isPending,children:[e.jsx(gt,{className:"mr-1.5 h-4 w-4"}),f.isPending?a("providerTestingConnection"):a("providerTestConnection")]}),e.jsx(B,{type:"submit",disabled:h.isPending||!$e,children:h.isPending?a("saving"):$e?a("save"):a("unchanged")})]})]})]})}function Ut(t){if(!t)return null;try{const i=new URL(t),r=i.pathname&&i.pathname!=="/"?i.pathname:"";return`${i.host}${r}`}catch{return t.replace(/^https?:\/\//,"")}}function rs(){const{data:t}=Ze(),{data:i}=et(),{data:r}=tt(),l=St(),[m,j]=c.useState("installed"),[h,x]=c.useState(),[f,b]=c.useState(""),v=r==null?void 0:r.uiHints,D=(i==null?void 0:i.providers)??[],E=(t==null?void 0:t.providers)??{},P=D.filter(u=>{var g;return(g=E[u.name])==null?void 0:g.apiKeySet}).length,N=[{id:"installed",label:a("providersTabConfigured"),count:P},{id:"all",label:a("providersTabAll"),count:D.length}],C=c.useMemo(()=>{const u=(i==null?void 0:i.providers)??[],g=(t==null?void 0:t.providers)??{},w=f.trim().toLowerCase();return u.filter(A=>{var T;return m==="installed"?!!((T=g[A.name])!=null&&T.apiKeySet):!0}).filter(A=>{var $,H;return w?(((H=($=g[A.name])==null?void 0:$.displayName)==null?void 0:H.trim())||A.displayName||A.name).toLowerCase().includes(w)||A.name.toLowerCase().includes(w):!0})},[i,t,m,f]);c.useEffect(()=>{if(C.length===0){x(void 0);return}C.some(g=>g.name===h)||x(C[0].name)},[C,h]);const O=h,X=async()=>{try{const u=await l.mutateAsync({data:{}});j("all"),b(""),x(u.name)}catch{}};return!t||!i?e.jsx("div",{className:"p-8",children:a("providersLoading")}):e.jsxs(It,{children:[e.jsx(Dt,{title:a("providersPageTitle"),description:a("providersPageDescription")}),e.jsxs("div",{className:kt,children:[e.jsxs("section",{className:$t,children:[e.jsxs("div",{className:"border-b border-gray-100 px-4 pt-4 pb-3 space-y-3",children:[e.jsx(Tt,{tabs:N,activeTab:m,onChange:j,className:"mb-0"}),e.jsxs(B,{type:"button",variant:"outline",className:"w-full justify-center",onClick:X,disabled:l.isPending,children:[e.jsx(Ce,{className:"mr-2 h-4 w-4"}),l.isPending?a("saving"):a("providerAddCustom")]})]}),e.jsx("div",{className:"border-b border-gray-100 px-4 py-3",children:e.jsxs("div",{className:"relative",children:[e.jsx(jt,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400"}),e.jsx(q,{value:f,onChange:u=>b(u.target.value),placeholder:a("providersFilterPlaceholder"),className:"h-10 rounded-xl pl-9"})]})}),e.jsxs("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto p-3",children:[C.map(u=>{var le;const g=t.providers[u.name],w=!!(g!=null&&g.apiKeySet),A=O===u.name,T=((le=g==null?void 0:g.displayName)==null?void 0:le.trim())||u.displayName||u.name,M=re(`providers.${u.name}`,v),$=(g==null?void 0:g.apiBase)||u.defaultApiBase||"",Z=Ut($)||(M==null?void 0:M.help)||a("providersDefaultDescription");return e.jsx("button",{type:"button",onClick:()=>x(u.name),className:ie("w-full rounded-xl border p-2.5 text-left transition-all",A?"border-primary/30 bg-primary-50/40 shadow-sm":"border-gray-200/70 bg-white hover:border-gray-300 hover:bg-gray-50/70"),children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx(Bt,{name:u.name,src:u.logo?`/logos/${u.logo}`:null,className:ie("h-10 w-10 rounded-lg border",w?"border-primary/30 bg-white":"border-gray-200/70 bg-white"),imgClassName:"h-5 w-5 object-contain",fallback:e.jsx("span",{className:"text-sm font-semibold uppercase text-gray-500",children:u.name[0]})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-semibold text-gray-900",children:T}),e.jsx("p",{className:"line-clamp-1 text-[11px] text-gray-500",children:Z})]})]}),e.jsx(st,{status:w?"ready":"setup",label:w?a("statusReady"):a("statusSetup"),className:"min-w-[56px] justify-center"})]})},u.name)}),C.length===0&&e.jsxs("div",{className:"flex h-full min-h-[220px] flex-col items-center justify-center rounded-xl border border-dashed border-gray-200 bg-gray-50/70 py-10 text-center",children:[e.jsx("div",{className:"mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-white",children:e.jsx(bt,{className:"h-5 w-5 text-gray-300"})}),e.jsx("p",{className:"text-sm font-medium text-gray-700",children:a("providersNoMatch")})]})]})]}),e.jsx(qt,{providerName:O,onProviderDeleted:u=>{u===h&&x(void 0)}})]})]})}export{rs as ProvidersList};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r,j as e,aG as U,a1 as J,aT as A,aQ as X,w as Z,M as Q,aU as ee,a8 as se,a9 as te}from"./vendor-TlME1INH.js";import{u as ae}from"./useConfirmDialog-zJzVKMdu.js";import{q as re,p as ne,s as le,Q as ie,R as oe,t,c as i,S as de,e as ce,f as xe,g as me,h as I,U as ue,k as he}from"./index-Cn6_2To7.js";import{P as ge,a as fe,B as f}from"./page-layout-DO8BlScF.js";import{I as k}from"./input-oBvxsnV9.js";import{b as ye,c as pe,S as be,e as je}from"./session-run-status-Kg0FwAPn.js";const y="__unknown_channel__";function ve(a){return he(a)}function j(a){const l=a.indexOf(":");return l<=0?y:a.slice(0,l).trim()||y}function C(a){return a===y?t("sessionsUnknownChannel"):a}function Ne({session:a,channel:l,runStatus:d,isSelected:x,onSelect:n}){const p=C(l),m=a.label||a.key.split(":").pop()||a.key;return e.jsxs("button",{onClick:n,className:i("w-full text-left p-3.5 rounded-xl transition-all duration-200 outline-none focus:outline-none focus:ring-0 group",x?"bg-brand-50 border border-brand-100/50":"bg-transparent border border-transparent hover:bg-gray-50/80"),children:[e.jsxs("div",{className:"flex items-start justify-between mb-1.5",children:[e.jsx("div",{className:i("font-semibold truncate pr-2 flex-1 text-sm",x?"text-brand-800":"text-gray-900"),children:m}),e.jsx("div",{className:i("text-[10px] font-bold px-2 py-0.5 rounded-full shrink-0 capitalize",x?"bg-white text-brand-600 shadow-[0_1px_2px_rgba(0,0,0,0.02)]":"bg-gray-100 text-gray-500"),children:p})]}),e.jsxs("div",{className:i("flex items-center text-xs justify-between mt-2 font-medium",x?"text-brand-600/80":"text-gray-400"),children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:d?e.jsx(be,{status:d}):null}),e.jsx(ee,{className:"w-3.5 h-3.5 opacity-70"}),e.jsx("span",{className:"truncate max-w-[100px]",children:ue(a.updatedAt)})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Q,{className:"w-3.5 h-3.5 opacity-70"}),e.jsx("span",{children:a.messageCount})]})]})]})}function we({message:a}){const l=a.role.toLowerCase()==="user",d=je(a.content).trim();return e.jsx("div",{className:i("flex w-full mb-6",l?"justify-end":"justify-start"),children:e.jsxs("div",{className:i("max-w-[85%] rounded-[1.25rem] p-5 flex gap-3 text-sm",l?"bg-primary text-white rounded-tr-sm":"bg-gray-50 text-gray-800 rounded-tl-sm border border-gray-100/50"),children:[e.jsx("div",{className:"shrink-0 pt-0.5",children:l?e.jsx(se,{className:"w-4 h-4 text-primary-100"}):e.jsx(te,{className:"w-4 h-4 text-gray-400"})}),e.jsxs("div",{className:"flex-1 space-y-1 overflow-x-hidden",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4 mb-2",children:[e.jsx("span",{className:i("font-semibold text-xs",l?"text-primary-50":"text-gray-900 capitalize"),children:a.role}),e.jsx("span",{className:i("text-[10px]",l?"text-primary-200":"text-gray-400"),children:ve(a.timestamp)})]}),e.jsx("div",{className:"whitespace-pre-wrap break-words leading-relaxed text-[15px]",children:d||"-"})]})]})})}function _e(){var R,B,E,K;const[a,l]=r.useState(""),[d]=r.useState(100),[x]=r.useState(0),[n,p]=r.useState(null),[m,q]=r.useState("all"),[M,v]=r.useState(""),[L,N]=r.useState(""),[w,S]=r.useState(!1),F=r.useMemo(()=>({q:a.trim()||void 0,limit:d,activeMinutes:x}),[a,d,x]),g=re(F),D=ne({states:["queued","running"],limit:200}),u=le(n,200),b=ie(),_=oe(),{confirm:P,ConfirmDialog:O}=ae(),c=r.useMemo(()=>{var s;return((s=g.data)==null?void 0:s.sessions)??[]},[(R=g.data)==null?void 0:R.sessions]),z=r.useMemo(()=>{var s;return ye(((s=D.data)==null?void 0:s.runs)??[])},[(B=D.data)==null?void 0:B.runs]),V=r.useMemo(()=>pe(z),[z]),o=r.useMemo(()=>c.find(s=>s.key===n),[c,n]),$=r.useMemo(()=>{const s=new Set;for(const h of c)s.add(j(h.key));return Array.from(s).sort((h,T)=>h===y?1:T===y?-1:h.localeCompare(T))},[c]),H=r.useMemo(()=>m==="all"?c:c.filter(s=>j(s.key)===m),[c,m]);r.useEffect(()=>{o?(v(o.label||""),N(o.preferredModel||"")):(v(""),N("")),S(!1)},[o]);const G=()=>{n&&(b.mutate({key:n,data:{label:M.trim()||null,preferredModel:L.trim()||null}}),S(!1))},W=async()=>{if(!n)return;await P({title:t("sessionsClearHistory")+"?",variant:"destructive",confirmLabel:t("sessionsClearHistory")})&&b.mutate({key:n,data:{clearHistory:!0}})},Y=async()=>{if(!n)return;await P({title:t("sessionsDeleteConfirm")+"?",variant:"destructive",confirmLabel:t("sessionsDeleteConfirm")})&&_.mutate({key:n},{onSuccess:()=>p(null)})};return e.jsxs(ge,{fullHeight:!0,children:[e.jsx(fe,{title:t("sessionsPageTitle"),description:t("sessionsPageDescription")}),e.jsxs("div",{className:"flex-1 flex gap-6 min-h-0 relative",children:[e.jsxs("div",{className:"w-[320px] flex flex-col shrink-0 bg-white rounded-2xl shadow-sm border border-gray-200 overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-4 border-b border-gray-100 bg-white z-10 shrink-0 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-[11px] font-semibold text-gray-400 uppercase tracking-wider",children:[c.length," ",t("sessionsListTitle")]}),e.jsx(f,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100",onClick:()=>g.refetch(),children:e.jsx(U,{className:i("h-3.5 w-3.5",g.isFetching&&"animate-spin")})})]}),e.jsxs(de,{value:m,onValueChange:q,children:[e.jsx(ce,{className:"w-full h-8.5 rounded-lg bg-gray-50/50 hover:bg-gray-100 border-gray-200 focus:ring-0 shadow-none text-xs font-medium text-gray-700",children:e.jsx(xe,{placeholder:t("sessionsAllChannels")})}),e.jsxs(me,{className:"rounded-xl shadow-lg border-gray-100 max-w-[280px]",children:[e.jsx(I,{value:"all",className:"rounded-lg text-xs",children:t("sessionsAllChannels")}),$.map(s=>e.jsx(I,{value:s,className:"rounded-lg text-xs truncate pr-6",children:C(s)},s))]})]}),e.jsxs("div",{className:"relative w-full",children:[e.jsx(J,{className:"h-3.5 w-3.5 absolute left-3 top-2.5 text-gray-400"}),e.jsx(k,{value:a,onChange:s=>l(s.target.value),placeholder:t("sessionsSearchPlaceholder"),className:"pl-8 h-8.5 rounded-lg bg-gray-50/50 border-gray-200 focus-visible:bg-white text-xs"})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-1 pb-10 custom-scrollbar relative",children:g.isLoading?e.jsx("div",{className:"text-sm text-gray-400 p-4 text-center",children:t("sessionsLoading")}):H.length===0?e.jsxs("div",{className:"text-sm text-gray-400 p-4 text-center border-2 border-dashed border-gray-100 rounded-xl mt-4",children:[e.jsx(A,{className:"w-8 h-8 mx-auto mb-2 text-gray-300"}),t("sessionsEmpty")]}):H.map(s=>e.jsx(Ne,{session:s,channel:j(s.key),runStatus:V.get(s.key),isSelected:n===s.key,onSelect:()=>p(s.key)},s.key))})]}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden relative bg-white rounded-2xl shadow-sm border border-gray-200",children:[(b.isPending||_.isPending)&&e.jsx("div",{className:"absolute top-0 left-0 w-full h-1 bg-primary/20 overflow-hidden z-20",children:e.jsx("div",{className:"h-full bg-primary animate-pulse w-1/3 rounded-r-full"})}),n&&o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shrink-0 border-b border-gray-100 bg-white px-8 py-5 z-10 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-12 w-12 rounded-[14px] bg-gray-50 border border-gray-100 flex items-center justify-center text-gray-400 shrink-0",children:e.jsx(X,{className:"h-6 w-6"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-1.5",children:[e.jsx("h3",{className:"text-lg font-bold text-gray-900 tracking-tight",children:o.label||o.key.split(":").pop()||o.key}),e.jsx("span",{className:"text-[10px] font-bold px-2 py-0.5 rounded-full bg-gray-100 text-gray-500 uppercase tracking-widest",children:C(j(o.key))})]}),e.jsx("div",{className:"text-xs text-gray-500 font-mono break-all line-clamp-1 opacity-70",title:n,children:n})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs(f,{variant:"outline",size:"sm",onClick:()=>S(!w),className:i("h-8.5 rounded-lg shadow-none border-gray-200 transition-all text-xs font-semibold",w?"bg-gray-100 text-gray-900":"hover:bg-gray-50 hover:text-gray-900"),children:[e.jsx(Z,{className:"w-3.5 h-3.5 mr-1.5"}),t("sessionsMetadata")]}),e.jsx(f,{variant:"outline",size:"sm",onClick:W,className:"h-8.5 rounded-lg shadow-none hover:bg-gray-50 hover:text-gray-900 border-gray-200 text-xs font-semibold text-gray-500",children:t("sessionsClearHistory")}),e.jsx(f,{variant:"outline",size:"sm",onClick:Y,className:"h-8.5 rounded-lg shadow-none hover:bg-red-50 hover:text-red-600 hover:border-red-200 border-gray-200 text-xs font-semibold text-red-500",children:t("delete")})]})]}),w&&e.jsxs("div",{className:"flex items-center gap-3 bg-gray-50/50 p-3 rounded-lg border border-gray-100 animate-slide-in",children:[e.jsx(k,{placeholder:t("sessionsLabelPlaceholder"),value:M,onChange:s=>v(s.target.value),className:"h-8 text-sm bg-white"}),e.jsx(k,{placeholder:t("sessionsModelPlaceholder"),value:L,onChange:s=>N(s.target.value),className:"h-8 text-sm bg-white"}),e.jsx(f,{size:"sm",onClick:G,className:"h-8 px-4 shrink-0 shadow-none",disabled:b.isPending,children:t("sessionsSaveMeta")})]})]}),e.jsxs("div",{className:`flex-1 overflow-y-auto p-6 relative
|
|
2
|
-
[&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:bg-gray-300/80 [&::-webkit-scrollbar-thumb]:rounded-full`,children:[u.isLoading&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-50/50 backdrop-blur-sm z-10",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 animate-pulse",children:[e.jsx(U,{className:"w-6 h-6 text-primary animate-spin"}),e.jsx("span",{className:"text-sm font-medium text-gray-500",children:t("sessionsHistoryLoading")})]})}),u.error&&e.jsx("div",{className:"text-center p-6 bg-red-50 rounded-xl text-red-600 border border-red-100 text-sm",children:u.error.message}),!u.isLoading&&((E=u.data)==null?void 0:E.messages.length)===0&&e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[e.jsx(Q,{className:"w-12 h-12 mb-3 text-gray-300"}),e.jsx("p",{className:"text-sm",children:t("sessionsEmpty")})]}),e.jsx("div",{className:"max-w-3xl mx-auto",children:(((K=u.data)==null?void 0:K.messages)??[]).map((s,h)=>e.jsx(we,{message:s},`${s.timestamp}-${h}`))})]})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-gray-400 p-8 h-full bg-white",children:[e.jsx("div",{className:"w-20 h-20 bg-gray-50 rounded-3xl flex items-center justify-center mb-6 border border-gray-100 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.02)] rotate-3",children:e.jsx(A,{className:"h-8 w-8 text-gray-300 -rotate-3"})}),e.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-2",children:t("sessionsNoSelectionTitle")}),e.jsx("p",{className:"text-sm text-center max-w-sm leading-relaxed",children:t("sessionsNoSelectionDescription")})]})]})]}),e.jsx(O,{})]})}export{_e as SessionsConfig};
|