@decocms/mesh 1.0.13 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/client/assets/{AlertCircle-zCOLtXNG.js → AlertCircle-DaEUMwle.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-b0UM4Vui.js → ArrowLeft-CvFDkdiU.js} +1 -1
  3. package/dist/client/assets/{Calendar-Cxw5FKll.js → Calendar-DBqzL4c-.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-U8-nit8x.js → CheckCircle-CILz6OCh.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-BFYjmmoG.js → ChevronDown-g4L12M9A.js} +1 -1
  6. package/dist/client/assets/{Clock-qZko4uak.js → Clock-C-uwthk9.js} +1 -1
  7. package/dist/client/assets/{Copy01-XN5V21c6.js → Copy01-CHjgpWtl.js} +1 -1
  8. package/dist/client/assets/{CpuChip02-Nhk4zHXl.js → CpuChip02-DlCI7cQJ.js} +1 -1
  9. package/dist/client/assets/{DotsVertical-CcNQsTaW.js → DotsVertical-CIfapH0j.js} +1 -1
  10. package/dist/client/assets/{File06-DB55FK-Z.js → File06-CBkqKj5m.js} +1 -1
  11. package/dist/client/assets/{GitBranch01-CM-ab6hS.js → GitBranch01-Ci5lqvRi.js} +1 -1
  12. package/dist/client/assets/{Inbox01-CIzt2AdR.js → Inbox01-DCkU3Xgq.js} +1 -1
  13. package/dist/client/assets/{InfoCircle-ChxTTkMX.js → InfoCircle-BwNsGATl.js} +1 -1
  14. package/dist/client/assets/{Key01-DYiMWoz_.js → Key01-5nxXQgMM.js} +1 -1
  15. package/dist/client/assets/{LinkExternal01-CBZhTXC0.js → LinkExternal01-ISpHuMJE.js} +1 -1
  16. package/dist/client/assets/{Loading01-Dtm2TLlA.js → Loading01-r04aEG5T.js} +1 -1
  17. package/dist/client/assets/{Plus-DF_I5mml.js → Plus-CS_Y2Vnc.js} +1 -1
  18. package/dist/client/assets/{SearchMd-C_ak4ze3.js → SearchMd-1Gq7nypQ.js} +1 -1
  19. package/dist/client/assets/{Terminal-4DdepWh9.js → Terminal-DYN6gEAz.js} +1 -1
  20. package/dist/client/assets/{Trash01-FYPMjpVf.js → Trash01-DVxmznxT.js} +1 -1
  21. package/dist/client/assets/{Upload01-BYeEw9Vy.js → Upload01-Da0sGkRE.js} +1 -1
  22. package/dist/client/assets/{X-BTsWwO_U.js → X-BX0rl0N7.js} +1 -1
  23. package/dist/client/assets/{XClose-CY6vd_0A.js → XClose-BUuGHVgA.js} +1 -1
  24. package/dist/client/assets/{alert-dialog-DhxQ40TA.js → alert-dialog-DdP064l-.js} +1 -1
  25. package/dist/client/assets/{auth-CfgXQhXI.js → auth-AUS48lXs.js} +1 -1
  26. package/dist/client/assets/{auth-catchall-CohlC3Pb.js → auth-catchall-DqCIX1bA.js} +1 -1
  27. package/dist/client/assets/{avatar-CcUZFpwU.js → avatar-bcdjVFyi.js} +1 -1
  28. package/dist/client/assets/{badge-CgUwfcKq.js → badge-1WraHGEG.js} +1 -1
  29. package/dist/client/assets/{button-DuitHSR8.js → button-DodNLkpL.js} +1 -1
  30. package/dist/client/assets/{card-DkEpNms8.js → card-BHz-BqEu.js} +1 -1
  31. package/dist/client/assets/{checkbox-DTaSeum9.js → checkbox-Bj9jBMQF.js} +1 -1
  32. package/dist/client/assets/{collection-detail-Dvc6iyHF.js → collection-detail-QGbMDWA7.js} +1 -1
  33. package/dist/client/assets/{collection-display-button-DgDdVSTg.js → collection-display-button-475jHotV.js} +1 -1
  34. package/dist/client/assets/{collection-header-D-wXFMG4.js → collection-header-DcpyPzrC.js} +1 -1
  35. package/dist/client/assets/{collection-page-AFIAghtr.js → collection-page-DpUZNbpd.js} +1 -1
  36. package/dist/client/assets/{collection-search-OoKPetka.js → collection-search-DVBnlN6E.js} +1 -1
  37. package/dist/client/assets/{collection-table-wrapper-DEVlTpj8.js → collection-table-wrapper-DQ4F9pbh.js} +1 -1
  38. package/dist/client/assets/{connection-card-CVX6Dj6b.js → connection-card-opsQBUfD.js} +1 -1
  39. package/dist/client/assets/{connection-detail-C_uPOJ6z.js → connection-detail-DpiL6xjK.js} +1 -1
  40. package/dist/client/assets/{connections-DoAE9QhX.js → connections-CeDc3J_o.js} +1 -1
  41. package/dist/client/assets/{core-BMfBj0bw.js → core-DJoPglro.js} +1 -1
  42. package/dist/client/assets/{create-organization-dialog-C_xVF_Jl.js → create-organization-dialog-fbCy_hNu.js} +1 -1
  43. package/dist/client/assets/{dialog-Dl9CupEb.js → dialog-BqvvzTa7.js} +1 -1
  44. package/dist/client/assets/{dropdown-menu-CPQpNQmn.js → dropdown-menu-DrQKdl4f.js} +1 -1
  45. package/dist/client/assets/{env-vars-editor-BcyBU5xA.js → env-vars-editor-DEYac6H7.js} +1 -1
  46. package/dist/client/assets/{error-boundary-DMJQCmxn.js → error-boundary-CdmYlIj7.js} +1 -1
  47. package/dist/client/assets/{extract-connection-data-Bt1_1dQ8.js → extract-connection-data-Ty2DjF1e.js} +1 -1
  48. package/dist/client/assets/{form-BfiwCHdz.js → form-Bus-fIfC.js} +1 -1
  49. package/dist/client/assets/{formatDistanceToNow-BmkU67cZ.js → formatDistanceToNow-D46rGC8T.js} +1 -1
  50. package/dist/client/assets/{gateway-detail-ZknLelfM.js → gateway-detail-fCVh3_nF.js} +1 -1
  51. package/dist/client/assets/{gateways-BAQA-e5y.js → gateways-DQmZoxNy.js} +1 -1
  52. package/dist/client/assets/{home-BzOK0WeX.js → home-heelYyW2.js} +1 -1
  53. package/dist/client/assets/{index-CCNaUj2A.js → index-A52jfksK.js} +2 -2
  54. package/dist/client/assets/{index-DR-B7Y1Z.js → index-DDiLOLYT.js} +1 -1
  55. package/dist/client/assets/index-DKrh5SL2.css +1 -0
  56. package/dist/client/assets/{index-T7OaHK12.js → index-JV0IIYp6.js} +1 -1
  57. package/dist/client/assets/{index-be58e1VX.js → index-td_4XAxf.js} +1 -1
  58. package/dist/client/assets/{input-YU6lpVgW.js → input-BXHWk19m.js} +1 -1
  59. package/dist/client/assets/json-gPxhilNK.js +1 -0
  60. package/dist/client/assets/{json-syntax-highlighter-Dve1WRV4.js → json-syntax-highlighter-i1hiMNnF.js} +2 -2
  61. package/dist/client/assets/{layout-n40g10Oh.js → layout-dxbGsEKV.js} +1 -1
  62. package/dist/client/assets/{lazy-highlighter-BY_mRZdt.js → lazy-highlighter-QDCjbXst.js} +1 -1
  63. package/dist/client/assets/{localstorage-keys-BphvZ-YX.js → localstorage-keys-D7pZSS7H.js} +1 -1
  64. package/dist/client/assets/{login-CJi6KFGq.js → login-CcnR2b1q.js} +1 -1
  65. package/dist/client/assets/{mcp-oauth-CvO1Z13d.js → mcp-oauth-D7V7V-GS.js} +1 -1
  66. package/dist/client/assets/{members-UHyk3Nn4.js → members-D5QtYSzf.js} +1 -1
  67. package/dist/client/assets/{monitoring-65mgE8O0.js → monitoring-Cp92YRPy.js} +1 -1
  68. package/dist/client/assets/{oauth-callback-KqixmXKf.js → oauth-callback-1_PgXFG_.js} +1 -1
  69. package/dist/client/assets/{page-DmmG4y1n.js → page-C8KGQPlY.js} +1 -1
  70. package/dist/client/assets/{popover-PTQF8Dbg.js → popover-MhzpcVkW.js} +1 -1
  71. package/dist/client/assets/prism-light-C-ukkBST.js +1 -0
  72. package/dist/client/assets/{resizable-BF9gWgPg.js → resizable-B3HA_CX4.js} +3 -3
  73. package/dist/client/assets/{resource-tabs-Dx5v9tHv.js → resource-tabs-ru5yaRIE.js} +1 -1
  74. package/dist/client/assets/{select-C4QWjnSz.js → select-Be0LRVWn.js} +1 -1
  75. package/dist/client/assets/{settings-UndPSfwX.js → settings-gZFi_2QA.js} +1 -1
  76. package/dist/client/assets/shell-layout-adVEIdhn.js +17 -0
  77. package/dist/client/assets/{spinner-CNb2mD_9.js → spinner-oZ2DO2-U.js} +1 -1
  78. package/dist/client/assets/store-DzO4PTg0.js +1 -0
  79. package/dist/client/assets/{store-app-detail-BQ4UUaoG.js → store-app-detail-BIXt1EdE.js} +1 -1
  80. package/dist/client/assets/{switch-BmVnuO_C.js → switch-DsCvClV8.js} +1 -1
  81. package/dist/client/assets/{tools-list-BV-qlQqF.js → tools-list-BsHebq88.js} +1 -1
  82. package/dist/client/assets/{tooltip-CqCXb38Z.js → tooltip-BjhP6ibY.js} +1 -1
  83. package/dist/client/assets/{types-Bm46njUN.js → types-D4T3qWDr.js} +1 -1
  84. package/dist/client/assets/{use-binding-DdwsXkNS.js → use-binding-CapMpNVF.js} +1 -1
  85. package/dist/client/assets/{use-connection-BbvAiBvg.js → use-connection-BX5-4xHw.js} +1 -1
  86. package/dist/client/assets/{use-connection-resources-D-1-SK-8.js → use-connection-resources-FqHsvBSA.js} +1 -1
  87. package/dist/client/assets/{use-gateway-L1UQyU7-.js → use-gateway-CseaalWF.js} +1 -1
  88. package/dist/client/assets/{use-list-state-DVYCFUpb.js → use-list-state-7NLbXyOC.js} +1 -1
  89. package/dist/client/assets/{use-mcp-CWOlOW9q.js → use-mcp-M6XXMHar.js} +1 -1
  90. package/dist/client/assets/{use-members-Dyh_-7GU.js → use-members-DzZB15s9.js} +1 -1
  91. package/dist/client/assets/{use-mobile-B0xRFGhT.js → use-mobile-TpeNqylz.js} +1 -1
  92. package/dist/client/assets/{use-organization-settings-fWTyw7VB.js → use-organization-settings-BAhAEDx8.js} +1 -1
  93. package/dist/client/assets/{use-tool-call-CVPTtLoG.js → use-tool-call-CQCb5PBf.js} +1 -1
  94. package/dist/client/assets/useQuery-ojqdZMTH.js +1 -0
  95. package/dist/client/assets/utils-DgLfrg3u.js +1 -0
  96. package/dist/client/assets/{view-mode-toggle-DOtHoBLN.js → view-mode-toggle-DAXMt6ZW.js} +1 -1
  97. package/dist/client/assets/well-known-mcp-BPQQU1v0.js +1 -0
  98. package/dist/client/empty-state-openrouter.svg +320 -0
  99. package/dist/client/emptystate-mcp.svg +26 -70
  100. package/dist/client/index.html +2 -2
  101. package/dist/client/store-empty-state.svg +96 -349
  102. package/dist/server/cli.js +112 -112
  103. package/dist/server/server.js +105 -105
  104. package/package.json +1 -1
  105. package/dist/client/assets/index-Dgn6D_6Q.css +0 -1
  106. package/dist/client/assets/json-BnmF_c7J.js +0 -1
  107. package/dist/client/assets/prism-light-0RxCg8xt.js +0 -1
  108. package/dist/client/assets/shell-layout-BLjMALRt.js +0 -17
  109. package/dist/client/assets/store-CGyOcqhE.js +0 -1
  110. package/dist/client/assets/useQuery-C4GPpw7d.js +0 -1
  111. package/dist/client/assets/utils-o1atviYh.js +0 -1
  112. package/dist/client/assets/well-known-mcp-d1wcdFCF.js +0 -1
@@ -1 +1 @@
1
- import{r as c,a5 as Pe,J as rt,y as _e,j as d,a6 as st,F as lt,a7 as be,aC as at,a1 as k,a8 as it,z as j,B as N,a4 as $,a9 as ct,al as Ee,aZ as dt,a3 as ut,aa as pt,ad as ft,ab as mt,ac as ht,ae as vt,af as gt,ag as xt,ah as St,c as ee}from"./index-CCNaUj2A.js";import{V as wt,i as yt}from"./tooltip-CqCXb38Z.js";import{t as Re}from"./ChevronDown-BFYjmmoG.js";import{c as oe}from"./utils-o1atviYh.js";function Ne(n,[e,t]){return Math.min(t,Math.max(e,n))}var Ct=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],J="Select",[de,ue,bt]=at(J),[ne]=lt(J,[bt,Pe]),pe=Pe(),[Tt,G]=ne(J),[_t,Nt]=ne(J),je=n=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:r,onOpenChange:i,value:s,defaultValue:l,onValueChange:a,dir:u,name:h,autoComplete:g,disabled:w,required:y,form:S}=n,p=pe(e),[v,C]=c.useState(null),[m,x]=c.useState(null),[F,M]=c.useState(!1),re=rt(u),[P,O]=_e({prop:o,defaultProp:r??!1,onChange:i,caller:J}),[U,q]=_e({prop:s,defaultProp:l,onChange:a,caller:J}),L=c.useRef(null),B=v?S||!!v.closest("form"):!0,[W,V]=c.useState(new Set),H=Array.from(W).map(E=>E.props.value).join(";");return d.jsx(st,{...p,children:d.jsxs(Tt,{required:y,scope:e,trigger:v,onTriggerChange:C,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:be(),value:U,onValueChange:q,open:P,onOpenChange:O,dir:re,triggerPointerDownPosRef:L,disabled:w,children:[d.jsx(de.Provider,{scope:e,children:d.jsx(_t,{scope:n.__scopeSelect,onNativeOptionAdd:c.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:c.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?d.jsxs(Qe,{"aria-hidden":!0,required:y,tabIndex:-1,name:h,autoComplete:g,value:U,onChange:E=>q(E.target.value),disabled:w,form:S,children:[U===void 0?d.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};je.displayName=J;var Me="SelectTrigger",Ae=c.forwardRef((n,e)=>{const{__scopeSelect:t,disabled:o=!1,...r}=n,i=pe(t),s=G(Me,t),l=s.disabled||o,a=k(e,s.onTriggerChange),u=ue(t),h=c.useRef("touch"),[g,w,y]=tt(p=>{const v=u().filter(x=>!x.disabled),C=v.find(x=>x.value===s.value),m=ot(v,p,C);m!==void 0&&s.onValueChange(m.value)}),S=p=>{l||(s.onOpenChange(!0),y()),p&&(s.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return d.jsx(it,{asChild:!0,...i,children:d.jsx(j.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":et(s.value)?"":void 0,...r,ref:a,onClick:N(r.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&S(p)}),onPointerDown:N(r.onPointerDown,p=>{h.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:N(r.onKeyDown,p=>{const v=g.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&w(p.key),!(v&&p.key===" ")&&Ct.includes(p.key)&&(S(),p.preventDefault())})})})});Ae.displayName=Me;var Oe="SelectValue",De=c.forwardRef((n,e)=>{const{__scopeSelect:t,className:o,style:r,children:i,placeholder:s="",...l}=n,a=G(Oe,t),{onValueNodeHasChildrenChange:u}=a,h=i!==void 0,g=k(e,a.onValueNodeChange);return $(()=>{u(h)},[u,h]),d.jsx(j.span,{...l,ref:g,style:{pointerEvents:"none"},children:et(a.value)?d.jsx(d.Fragment,{children:s}):i})});De.displayName=Oe;var Pt="SelectIcon",ke=c.forwardRef((n,e)=>{const{__scopeSelect:t,children:o,...r}=n;return d.jsx(j.span,{"aria-hidden":!0,...r,ref:e,children:o||"▼"})});ke.displayName=Pt;var Et="SelectPortal",Le=n=>d.jsx(ct,{asChild:!0,...n});Le.displayName=Et;var Q="SelectContent",Be=c.forwardRef((n,e)=>{const t=G(Q,n.__scopeSelect),[o,r]=c.useState();if($(()=>{r(new DocumentFragment)},[]),!t.open){const i=o;return i?Ee.createPortal(d.jsx(Ve,{scope:n.__scopeSelect,children:d.jsx(de.Slot,{scope:n.__scopeSelect,children:d.jsx("div",{children:n.children})})}),i):null}return d.jsx(He,{...n,ref:e})});Be.displayName=Q;var A=10,[Ve,Y]=ne(Q),Rt="SelectContentImpl",jt=ht("SelectContent.RemoveScroll"),He=c.forwardRef((n,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:i,onPointerDownOutside:s,side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:w,collisionPadding:y,sticky:S,hideWhenDetached:p,avoidCollisions:v,...C}=n,m=G(Q,t),[x,F]=c.useState(null),[M,re]=c.useState(null),P=k(e,f=>F(f)),[O,U]=c.useState(null),[q,L]=c.useState(null),B=ue(t),[W,V]=c.useState(!1),H=c.useRef(!1);c.useEffect(()=>{if(x)return pt(x)},[x]),ft();const E=c.useCallback(f=>{const[T,...R]=B().map(_=>_.ref.current),[I]=R.slice(-1),b=document.activeElement;for(const _ of f)if(_===b||(_?.scrollIntoView({block:"nearest"}),_===T&&M&&(M.scrollTop=0),_===I&&M&&(M.scrollTop=M.scrollHeight),_?.focus(),document.activeElement!==b))return},[B,M]),D=c.useCallback(()=>E([O,x]),[E,O,x]);c.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=m;c.useEffect(()=>{if(x){let f={x:0,y:0};const T=I=>{f={x:Math.abs(Math.round(I.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(I.pageY)-(K.current?.y??0))}},R=I=>{f.x<=10&&f.y<=10?I.preventDefault():x.contains(I.target)||z(!1),document.removeEventListener("pointermove",T),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",R,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",R,{capture:!0})}}},[x,z,K]),c.useEffect(()=>{const f=()=>z(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[z]);const[fe,ae]=tt(f=>{const T=B().filter(b=>!b.disabled),R=T.find(b=>b.ref.current===document.activeElement),I=ot(T,f,R);I&&setTimeout(()=>I.ref.current.focus())}),me=c.useCallback((f,T,R)=>{const I=!H.current&&!R;(m.value!==void 0&&m.value===T||I)&&(U(f),I&&(H.current=!0))},[m.value]),he=c.useCallback(()=>x?.focus(),[x]),te=c.useCallback((f,T,R)=>{const I=!H.current&&!R;(m.value!==void 0&&m.value===T||I)&&L(f)},[m.value]),ie=o==="popper"?Se:ze,se=ie===Se?{side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:w,collisionPadding:y,sticky:S,hideWhenDetached:p,avoidCollisions:v}:{};return d.jsx(Ve,{scope:t,content:x,viewport:M,onViewportChange:re,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:W,searchRef:fe,children:d.jsx(mt,{as:jt,allowPinchZoom:!0,children:d.jsx(vt,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:N(r,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:d.jsx(gt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:d.jsx(ie,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...C,...se,onPlaced:()=>V(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:N(C.onKeyDown,f=>{const T=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!T&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let I=B().filter(b=>!b.disabled).map(b=>b.ref.current);if(["ArrowUp","End"].includes(f.key)&&(I=I.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const b=f.target,_=I.indexOf(b);I=I.slice(_+1)}setTimeout(()=>E(I)),f.preventDefault()}})})})})})})});He.displayName=Rt;var Mt="SelectItemAlignedPosition",ze=c.forwardRef((n,e)=>{const{__scopeSelect:t,onPlaced:o,...r}=n,i=G(Q,t),s=Y(Q,t),[l,a]=c.useState(null),[u,h]=c.useState(null),g=k(e,P=>h(P)),w=ue(t),y=c.useRef(!1),S=c.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:C,focusSelectedItem:m}=s,x=c.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&p&&v&&C){const P=i.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),U=i.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(i.dir!=="rtl"){const b=q.left-O.left,_=U.left-b,Z=P.left-_,X=P.width+Z,ve=Math.max(X,O.width),ge=window.innerWidth-A,xe=Ne(_,[A,Math.max(A,ge-ve)]);l.style.minWidth=X+"px",l.style.left=xe+"px"}else{const b=O.right-q.right,_=window.innerWidth-U.right-b,Z=window.innerWidth-P.right-_,X=P.width+Z,ve=Math.max(X,O.width),ge=window.innerWidth-A,xe=Ne(_,[A,Math.max(A,ge-ve)]);l.style.minWidth=X+"px",l.style.right=xe+"px"}const L=w(),B=window.innerHeight-A*2,W=p.scrollHeight,V=window.getComputedStyle(u),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),z=parseInt(V.paddingBottom,10),K=H+E+W+z+D,fe=Math.min(v.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=P.top+P.height/2-A,ie=B-te,se=v.offsetHeight/2,f=v.offsetTop+se,T=H+E+f,R=K-T;if(T<=te){const b=L.length>0&&v===L[L.length-1].ref.current;l.style.bottom="0px";const _=u.clientHeight-p.offsetTop-p.offsetHeight,Z=Math.max(ie,se+(b?he:0)+_+D),X=T+Z;l.style.height=X+"px"}else{const b=L.length>0&&v===L[0].ref.current;l.style.top="0px";const Z=Math.max(te,H+p.offsetTop+(b?me:0)+se)+R;l.style.height=Z+"px",p.scrollTop=T-te+p.offsetTop}l.style.margin=`${A}px 0`,l.style.minHeight=fe+"px",l.style.maxHeight=B+"px",o?.(),requestAnimationFrame(()=>y.current=!0)}},[w,i.trigger,i.valueNode,l,u,p,v,C,i.dir,o]);$(()=>x(),[x]);const[F,M]=c.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const re=c.useCallback(P=>{P&&S.current===!0&&(x(),m?.(),S.current=!1)},[x,m]);return d.jsx(Ot,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:y,onScrollButtonChange:re,children:d.jsx("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:d.jsx(j.div,{...r,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});ze.displayName=Mt;var At="SelectPopperPosition",Se=c.forwardRef((n,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:r=A,...i}=n,s=pe(t);return d.jsx(xt,{...s,...i,ref:e,align:o,collisionPadding:r,style:{boxSizing:"border-box",...i.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)"}})});Se.displayName=At;var[Ot,Te]=ne(Q,{}),we="SelectViewport",Fe=c.forwardRef((n,e)=>{const{__scopeSelect:t,nonce:o,...r}=n,i=Y(we,t),s=Te(we,t),l=k(e,i.onViewportChange),a=c.useRef(0);return d.jsxs(d.Fragment,{children:[d.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:o}),d.jsx(de.Slot,{scope:t,children:d.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:N(r.onScroll,u=>{const h=u.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:w}=s;if(w?.current&&g){const y=Math.abs(a.current-h.scrollTop);if(y>0){const S=window.innerHeight-A*2,p=parseFloat(g.style.minHeight),v=parseFloat(g.style.height),C=Math.max(p,v);if(C<S){const m=C+y,x=Math.min(S,m),F=m-x;g.style.height=x+"px",g.style.bottom==="0px"&&(h.scrollTop=F>0?F:0,g.style.justifyContent="flex-end")}}}a.current=h.scrollTop})})})]})});Fe.displayName=we;var Ue="SelectGroup",[Dt,kt]=ne(Ue),Lt=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n,r=be();return d.jsx(Dt,{scope:t,id:r,children:d.jsx(j.div,{role:"group","aria-labelledby":r,...o,ref:e})})});Lt.displayName=Ue;var We="SelectLabel",Bt=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n,r=kt(We,t);return d.jsx(j.div,{id:r.id,...o,ref:e})});Bt.displayName=We;var ce="SelectItem",[Vt,Ke]=ne(ce),$e=c.forwardRef((n,e)=>{const{__scopeSelect:t,value:o,disabled:r=!1,textValue:i,...s}=n,l=G(ce,t),a=Y(ce,t),u=l.value===o,[h,g]=c.useState(i??""),[w,y]=c.useState(!1),S=k(e,m=>a.itemRefCallback?.(m,o,r)),p=be(),v=c.useRef("touch"),C=()=>{r||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")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 d.jsx(Vt,{scope:t,value:o,disabled:r,textId:p,isSelected:u,onItemTextChange:c.useCallback(m=>{g(x=>x||(m?.textContent??"").trim())},[]),children:d.jsx(de.ItemSlot,{scope:t,value:o,disabled:r,textValue:h,children:d.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":w?"":void 0,"aria-selected":u&&w,"data-state":u?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...s,ref:S,onFocus:N(s.onFocus,()=>y(!0)),onBlur:N(s.onBlur,()=>y(!1)),onClick:N(s.onClick,()=>{v.current!=="mouse"&&C()}),onPointerUp:N(s.onPointerUp,()=>{v.current==="mouse"&&C()}),onPointerDown:N(s.onPointerDown,m=>{v.current=m.pointerType}),onPointerMove:N(s.onPointerMove,m=>{v.current=m.pointerType,r?a.onItemLeave?.():v.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:N(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&a.onItemLeave?.()}),onKeyDown:N(s.onKeyDown,m=>{a.searchRef?.current!==""&&m.key===" "||(It.includes(m.key)&&C(),m.key===" "&&m.preventDefault())})})})})});$e.displayName=ce;var le="SelectItemText",Ge=c.forwardRef((n,e)=>{const{__scopeSelect:t,className:o,style:r,...i}=n,s=G(le,t),l=Y(le,t),a=Ke(le,t),u=Nt(le,t),[h,g]=c.useState(null),w=k(e,C=>g(C),a.onItemTextChange,C=>l.itemTextRefCallback?.(C,a.value,a.disabled)),y=h?.textContent,S=c.useMemo(()=>d.jsx("option",{value:a.value,disabled:a.disabled,children:y},a.value),[a.disabled,a.value,y]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=u;return $(()=>(p(S),()=>v(S)),[p,v,S]),d.jsxs(d.Fragment,{children:[d.jsx(j.span,{id:a.textId,...i,ref:w}),a.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Ee.createPortal(i.children,s.valueNode):null]})});Ge.displayName=le;var Ye="SelectItemIndicator",qe=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n;return Ke(Ye,t).isSelected?d.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});qe.displayName=Ye;var ye="SelectScrollUpButton",Ze=c.forwardRef((n,e)=>{const t=Y(ye,n.__scopeSelect),o=Te(ye,n.__scopeSelect),[r,i]=c.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollTop>0;i(u)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),r?d.jsx(Je,{...n,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop-a.offsetHeight)}}):null});Ze.displayName=ye;var Ce="SelectScrollDownButton",Xe=c.forwardRef((n,e)=>{const t=Y(Ce,n.__scopeSelect),o=Te(Ce,n.__scopeSelect),[r,i]=c.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollHeight-a.clientHeight,h=Math.ceil(a.scrollTop)<u;i(h)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),r?d.jsx(Je,{...n,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop+a.offsetHeight)}}):null});Xe.displayName=Ce;var Je=c.forwardRef((n,e)=>{const{__scopeSelect:t,onAutoScroll:o,...r}=n,i=Y("SelectScrollButton",t),s=c.useRef(null),l=ue(t),a=c.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return c.useEffect(()=>()=>a(),[a]),$(()=>{l().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),d.jsx(j.div,{"aria-hidden":!0,...r,ref:e,style:{flexShrink:0,...r.style},onPointerDown:N(r.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:N(r.onPointerMove,()=>{i.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:N(r.onPointerLeave,()=>{a()})})}),Ht="SelectSeparator",zt=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n;return d.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});zt.displayName=Ht;var Ie="SelectArrow",Ft=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n,r=pe(t),i=G(Ie,t),s=Y(Ie,t);return i.open&&s.position==="popper"?d.jsx(St,{...r,...o,ref:e}):null});Ft.displayName=Ie;var Ut="SelectBubbleInput",Qe=c.forwardRef(({__scopeSelect:n,value:e,...t},o)=>{const r=c.useRef(null),i=k(o,r),s=dt(e);return c.useEffect(()=>{const l=r.current;if(!l)return;const a=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(a,"value").set;if(s!==e&&h){const g=new Event("change",{bubbles:!0});h.call(l,e),l.dispatchEvent(g)}},[s,e]),d.jsx(j.select,{...t,style:{...wt,...t.style},ref:i,defaultValue:e})});Qe.displayName=Ut;function et(n){return n===""||n===void 0}function tt(n){const e=ut(n),t=c.useRef(""),o=c.useRef(0),r=c.useCallback(s=>{const l=t.current+s;e(l),(function a(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>a(""),1e3))})(l)},[e]),i=c.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return c.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,r,i]}function ot(n,e,t){const r=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=t?n.indexOf(t):-1;let s=Wt(n,Math.max(i,0));r.length===1&&(s=s.filter(u=>u!==t));const a=s.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return a!==t?a:void 0}function Wt(n,e){return n.map((t,o)=>n[(e+o)%n.length])}var Kt=je,$t=Ae,Gt=De,Yt=ke,qt=Le,Zt=Be,Xt=Fe,Jt=$e,Qt=Ge,eo=qe,to=Ze,oo=Xe;const nt=({size:n=24,color:e="currentColor",...t})=>c.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},c.createElement("path",{d:"m18 15-6-6-6 6"}));nt.displayName="ChevronUp";function co(n){const e=ee.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Kt,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function uo(n){const e=ee.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Gt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function po(n){const e=ee.c(13);let t,o,r,i;e[0]!==n?({className:o,size:i,children:t,...r}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i):(t=e[1],o=e[2],r=e[3],i=e[4]);const s=i===void 0?"default":i;let l;e[5]!==o?(l=oe("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 hover:bg-accent hover:text-accent-foreground dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-xl border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-10 data-[size=sm]:h-8 data-[size=xs]:h-7 data-[size=xs]:px-2.5 data-[size=xs]:py-1.5 data-[size=xs]:rounded-lg *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(Yt,{asChild:!0,children:d.jsx(Re,{className:"size-4 opacity-50"})}),e[7]=a):a=e[7];let u;return e[8]!==t||e[9]!==r||e[10]!==s||e[11]!==l?(u=d.jsxs($t,{"data-slot":"select-trigger","data-size":s,className:l,...r,children:[t,a]}),e[8]=t,e[9]=r,e[10]=s,e[11]=l,e[12]=u):u=e[12],u}function fo(n){const e=ee.c(20);let t,o,r,i;e[0]!==n?({className:o,children:t,position:i,...r}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i):(t=e[1],o=e[2],r=e[3],i=e[4]);const s=i===void 0?"popper":i,l=s==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";let a;e[5]!==o||e[6]!==l?(a=oe("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-xl border shadow-md",l,o),e[5]=o,e[6]=l,e[7]=a):a=e[7];let u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=d.jsx(no,{}),e[8]=u):u=e[8];const h=s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let g;e[9]!==h?(g=oe("p-1",h),e[9]=h,e[10]=g):g=e[10];let w;e[11]!==t||e[12]!==g?(w=d.jsx(Xt,{className:g,children:t}),e[11]=t,e[12]=g,e[13]=w):w=e[13];let y;e[14]===Symbol.for("react.memo_cache_sentinel")?(y=d.jsx(ro,{}),e[14]=y):y=e[14];let S;return e[15]!==s||e[16]!==r||e[17]!==a||e[18]!==w?(S=d.jsx(qt,{children:d.jsxs(Zt,{"data-slot":"select-content",className:a,position:s,...r,children:[u,w,y]})}),e[15]=s,e[16]=r,e[17]=a,e[18]=w,e[19]=S):S=e[19],S}function mo(n){const e=ee.c(16);let t,o,r,i;e[0]!==n?({className:o,children:t,hideCheck:i,...r}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i):(t=e[1],o=e[2],r=e[3],i=e[4]);const s=i===void 0?!1:i;let l;e[5]!==o?(l=oe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-xl py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]!==s?(a=!s&&d.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:d.jsx(eo,{children:d.jsx(yt,{className:"size-4"})})}),e[7]=s,e[8]=a):a=e[8];let u;e[9]!==t?(u=d.jsx(Qt,{children:t}),e[9]=t,e[10]=u):u=e[10];let h;return e[11]!==r||e[12]!==l||e[13]!==a||e[14]!==u?(h=d.jsxs(Jt,{"data-slot":"select-item",className:l,...r,children:[a,u]}),e[11]=r,e[12]=l,e[13]=a,e[14]=u,e[15]=h):h=e[15],h}function no(n){const e=ee.c(9);let t,o;e[0]!==n?({className:t,...o}=n,e[0]=n,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let r;e[3]!==t?(r=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=r):r=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(nt,{className:"size-4"}),e[5]=i):i=e[5];let s;return e[6]!==o||e[7]!==r?(s=d.jsx(to,{"data-slot":"select-scroll-up-button",className:r,...o,children:i}),e[6]=o,e[7]=r,e[8]=s):s=e[8],s}function ro(n){const e=ee.c(9);let t,o;e[0]!==n?({className:t,...o}=n,e[0]=n,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let r;e[3]!==t?(r=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=r):r=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(Re,{className:"size-4"}),e[5]=i):i=e[5];let s;return e[6]!==o||e[7]!==r?(s=d.jsx(oo,{"data-slot":"select-scroll-down-button",className:r,...o,children:i}),e[6]=o,e[7]=r,e[8]=s):s=e[8],s}export{co as S,po as a,uo as b,fo as c,mo as d,Ne as e,nt as n};
1
+ import{r as c,a5 as Pe,J as rt,y as _e,j as d,a6 as st,F as lt,a7 as be,aC as at,a1 as k,a8 as it,z as j,B as N,a4 as $,a9 as ct,al as Ee,aZ as dt,a3 as ut,aa as pt,ad as ft,ab as mt,ac as ht,ae as vt,af as gt,ag as xt,ah as St,c as ee}from"./index-A52jfksK.js";import{V as wt,i as yt}from"./tooltip-BjhP6ibY.js";import{t as Re}from"./ChevronDown-g4L12M9A.js";import{c as oe}from"./utils-DgLfrg3u.js";function Ne(n,[e,t]){return Math.min(t,Math.max(e,n))}var Ct=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],J="Select",[de,ue,bt]=at(J),[ne]=lt(J,[bt,Pe]),pe=Pe(),[Tt,G]=ne(J),[_t,Nt]=ne(J),je=n=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:r,onOpenChange:i,value:s,defaultValue:l,onValueChange:a,dir:u,name:h,autoComplete:g,disabled:w,required:y,form:S}=n,p=pe(e),[v,C]=c.useState(null),[m,x]=c.useState(null),[F,M]=c.useState(!1),re=rt(u),[P,O]=_e({prop:o,defaultProp:r??!1,onChange:i,caller:J}),[U,q]=_e({prop:s,defaultProp:l,onChange:a,caller:J}),L=c.useRef(null),B=v?S||!!v.closest("form"):!0,[W,V]=c.useState(new Set),H=Array.from(W).map(E=>E.props.value).join(";");return d.jsx(st,{...p,children:d.jsxs(Tt,{required:y,scope:e,trigger:v,onTriggerChange:C,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:be(),value:U,onValueChange:q,open:P,onOpenChange:O,dir:re,triggerPointerDownPosRef:L,disabled:w,children:[d.jsx(de.Provider,{scope:e,children:d.jsx(_t,{scope:n.__scopeSelect,onNativeOptionAdd:c.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:c.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?d.jsxs(Qe,{"aria-hidden":!0,required:y,tabIndex:-1,name:h,autoComplete:g,value:U,onChange:E=>q(E.target.value),disabled:w,form:S,children:[U===void 0?d.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};je.displayName=J;var Me="SelectTrigger",Ae=c.forwardRef((n,e)=>{const{__scopeSelect:t,disabled:o=!1,...r}=n,i=pe(t),s=G(Me,t),l=s.disabled||o,a=k(e,s.onTriggerChange),u=ue(t),h=c.useRef("touch"),[g,w,y]=tt(p=>{const v=u().filter(x=>!x.disabled),C=v.find(x=>x.value===s.value),m=ot(v,p,C);m!==void 0&&s.onValueChange(m.value)}),S=p=>{l||(s.onOpenChange(!0),y()),p&&(s.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return d.jsx(it,{asChild:!0,...i,children:d.jsx(j.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":et(s.value)?"":void 0,...r,ref:a,onClick:N(r.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&S(p)}),onPointerDown:N(r.onPointerDown,p=>{h.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:N(r.onKeyDown,p=>{const v=g.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&w(p.key),!(v&&p.key===" ")&&Ct.includes(p.key)&&(S(),p.preventDefault())})})})});Ae.displayName=Me;var Oe="SelectValue",De=c.forwardRef((n,e)=>{const{__scopeSelect:t,className:o,style:r,children:i,placeholder:s="",...l}=n,a=G(Oe,t),{onValueNodeHasChildrenChange:u}=a,h=i!==void 0,g=k(e,a.onValueNodeChange);return $(()=>{u(h)},[u,h]),d.jsx(j.span,{...l,ref:g,style:{pointerEvents:"none"},children:et(a.value)?d.jsx(d.Fragment,{children:s}):i})});De.displayName=Oe;var Pt="SelectIcon",ke=c.forwardRef((n,e)=>{const{__scopeSelect:t,children:o,...r}=n;return d.jsx(j.span,{"aria-hidden":!0,...r,ref:e,children:o||"▼"})});ke.displayName=Pt;var Et="SelectPortal",Le=n=>d.jsx(ct,{asChild:!0,...n});Le.displayName=Et;var Q="SelectContent",Be=c.forwardRef((n,e)=>{const t=G(Q,n.__scopeSelect),[o,r]=c.useState();if($(()=>{r(new DocumentFragment)},[]),!t.open){const i=o;return i?Ee.createPortal(d.jsx(Ve,{scope:n.__scopeSelect,children:d.jsx(de.Slot,{scope:n.__scopeSelect,children:d.jsx("div",{children:n.children})})}),i):null}return d.jsx(He,{...n,ref:e})});Be.displayName=Q;var A=10,[Ve,Y]=ne(Q),Rt="SelectContentImpl",jt=ht("SelectContent.RemoveScroll"),He=c.forwardRef((n,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:i,onPointerDownOutside:s,side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:w,collisionPadding:y,sticky:S,hideWhenDetached:p,avoidCollisions:v,...C}=n,m=G(Q,t),[x,F]=c.useState(null),[M,re]=c.useState(null),P=k(e,f=>F(f)),[O,U]=c.useState(null),[q,L]=c.useState(null),B=ue(t),[W,V]=c.useState(!1),H=c.useRef(!1);c.useEffect(()=>{if(x)return pt(x)},[x]),ft();const E=c.useCallback(f=>{const[T,...R]=B().map(_=>_.ref.current),[I]=R.slice(-1),b=document.activeElement;for(const _ of f)if(_===b||(_?.scrollIntoView({block:"nearest"}),_===T&&M&&(M.scrollTop=0),_===I&&M&&(M.scrollTop=M.scrollHeight),_?.focus(),document.activeElement!==b))return},[B,M]),D=c.useCallback(()=>E([O,x]),[E,O,x]);c.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=m;c.useEffect(()=>{if(x){let f={x:0,y:0};const T=I=>{f={x:Math.abs(Math.round(I.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(I.pageY)-(K.current?.y??0))}},R=I=>{f.x<=10&&f.y<=10?I.preventDefault():x.contains(I.target)||z(!1),document.removeEventListener("pointermove",T),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",R,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",R,{capture:!0})}}},[x,z,K]),c.useEffect(()=>{const f=()=>z(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[z]);const[fe,ae]=tt(f=>{const T=B().filter(b=>!b.disabled),R=T.find(b=>b.ref.current===document.activeElement),I=ot(T,f,R);I&&setTimeout(()=>I.ref.current.focus())}),me=c.useCallback((f,T,R)=>{const I=!H.current&&!R;(m.value!==void 0&&m.value===T||I)&&(U(f),I&&(H.current=!0))},[m.value]),he=c.useCallback(()=>x?.focus(),[x]),te=c.useCallback((f,T,R)=>{const I=!H.current&&!R;(m.value!==void 0&&m.value===T||I)&&L(f)},[m.value]),ie=o==="popper"?Se:ze,se=ie===Se?{side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:w,collisionPadding:y,sticky:S,hideWhenDetached:p,avoidCollisions:v}:{};return d.jsx(Ve,{scope:t,content:x,viewport:M,onViewportChange:re,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:W,searchRef:fe,children:d.jsx(mt,{as:jt,allowPinchZoom:!0,children:d.jsx(vt,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:N(r,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:d.jsx(gt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:d.jsx(ie,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...C,...se,onPlaced:()=>V(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:N(C.onKeyDown,f=>{const T=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!T&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let I=B().filter(b=>!b.disabled).map(b=>b.ref.current);if(["ArrowUp","End"].includes(f.key)&&(I=I.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const b=f.target,_=I.indexOf(b);I=I.slice(_+1)}setTimeout(()=>E(I)),f.preventDefault()}})})})})})})});He.displayName=Rt;var Mt="SelectItemAlignedPosition",ze=c.forwardRef((n,e)=>{const{__scopeSelect:t,onPlaced:o,...r}=n,i=G(Q,t),s=Y(Q,t),[l,a]=c.useState(null),[u,h]=c.useState(null),g=k(e,P=>h(P)),w=ue(t),y=c.useRef(!1),S=c.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:C,focusSelectedItem:m}=s,x=c.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&p&&v&&C){const P=i.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),U=i.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(i.dir!=="rtl"){const b=q.left-O.left,_=U.left-b,Z=P.left-_,X=P.width+Z,ve=Math.max(X,O.width),ge=window.innerWidth-A,xe=Ne(_,[A,Math.max(A,ge-ve)]);l.style.minWidth=X+"px",l.style.left=xe+"px"}else{const b=O.right-q.right,_=window.innerWidth-U.right-b,Z=window.innerWidth-P.right-_,X=P.width+Z,ve=Math.max(X,O.width),ge=window.innerWidth-A,xe=Ne(_,[A,Math.max(A,ge-ve)]);l.style.minWidth=X+"px",l.style.right=xe+"px"}const L=w(),B=window.innerHeight-A*2,W=p.scrollHeight,V=window.getComputedStyle(u),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),z=parseInt(V.paddingBottom,10),K=H+E+W+z+D,fe=Math.min(v.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=P.top+P.height/2-A,ie=B-te,se=v.offsetHeight/2,f=v.offsetTop+se,T=H+E+f,R=K-T;if(T<=te){const b=L.length>0&&v===L[L.length-1].ref.current;l.style.bottom="0px";const _=u.clientHeight-p.offsetTop-p.offsetHeight,Z=Math.max(ie,se+(b?he:0)+_+D),X=T+Z;l.style.height=X+"px"}else{const b=L.length>0&&v===L[0].ref.current;l.style.top="0px";const Z=Math.max(te,H+p.offsetTop+(b?me:0)+se)+R;l.style.height=Z+"px",p.scrollTop=T-te+p.offsetTop}l.style.margin=`${A}px 0`,l.style.minHeight=fe+"px",l.style.maxHeight=B+"px",o?.(),requestAnimationFrame(()=>y.current=!0)}},[w,i.trigger,i.valueNode,l,u,p,v,C,i.dir,o]);$(()=>x(),[x]);const[F,M]=c.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const re=c.useCallback(P=>{P&&S.current===!0&&(x(),m?.(),S.current=!1)},[x,m]);return d.jsx(Ot,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:y,onScrollButtonChange:re,children:d.jsx("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:d.jsx(j.div,{...r,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});ze.displayName=Mt;var At="SelectPopperPosition",Se=c.forwardRef((n,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:r=A,...i}=n,s=pe(t);return d.jsx(xt,{...s,...i,ref:e,align:o,collisionPadding:r,style:{boxSizing:"border-box",...i.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)"}})});Se.displayName=At;var[Ot,Te]=ne(Q,{}),we="SelectViewport",Fe=c.forwardRef((n,e)=>{const{__scopeSelect:t,nonce:o,...r}=n,i=Y(we,t),s=Te(we,t),l=k(e,i.onViewportChange),a=c.useRef(0);return d.jsxs(d.Fragment,{children:[d.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:o}),d.jsx(de.Slot,{scope:t,children:d.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:N(r.onScroll,u=>{const h=u.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:w}=s;if(w?.current&&g){const y=Math.abs(a.current-h.scrollTop);if(y>0){const S=window.innerHeight-A*2,p=parseFloat(g.style.minHeight),v=parseFloat(g.style.height),C=Math.max(p,v);if(C<S){const m=C+y,x=Math.min(S,m),F=m-x;g.style.height=x+"px",g.style.bottom==="0px"&&(h.scrollTop=F>0?F:0,g.style.justifyContent="flex-end")}}}a.current=h.scrollTop})})})]})});Fe.displayName=we;var Ue="SelectGroup",[Dt,kt]=ne(Ue),Lt=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n,r=be();return d.jsx(Dt,{scope:t,id:r,children:d.jsx(j.div,{role:"group","aria-labelledby":r,...o,ref:e})})});Lt.displayName=Ue;var We="SelectLabel",Bt=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n,r=kt(We,t);return d.jsx(j.div,{id:r.id,...o,ref:e})});Bt.displayName=We;var ce="SelectItem",[Vt,Ke]=ne(ce),$e=c.forwardRef((n,e)=>{const{__scopeSelect:t,value:o,disabled:r=!1,textValue:i,...s}=n,l=G(ce,t),a=Y(ce,t),u=l.value===o,[h,g]=c.useState(i??""),[w,y]=c.useState(!1),S=k(e,m=>a.itemRefCallback?.(m,o,r)),p=be(),v=c.useRef("touch"),C=()=>{r||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")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 d.jsx(Vt,{scope:t,value:o,disabled:r,textId:p,isSelected:u,onItemTextChange:c.useCallback(m=>{g(x=>x||(m?.textContent??"").trim())},[]),children:d.jsx(de.ItemSlot,{scope:t,value:o,disabled:r,textValue:h,children:d.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":w?"":void 0,"aria-selected":u&&w,"data-state":u?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...s,ref:S,onFocus:N(s.onFocus,()=>y(!0)),onBlur:N(s.onBlur,()=>y(!1)),onClick:N(s.onClick,()=>{v.current!=="mouse"&&C()}),onPointerUp:N(s.onPointerUp,()=>{v.current==="mouse"&&C()}),onPointerDown:N(s.onPointerDown,m=>{v.current=m.pointerType}),onPointerMove:N(s.onPointerMove,m=>{v.current=m.pointerType,r?a.onItemLeave?.():v.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:N(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&a.onItemLeave?.()}),onKeyDown:N(s.onKeyDown,m=>{a.searchRef?.current!==""&&m.key===" "||(It.includes(m.key)&&C(),m.key===" "&&m.preventDefault())})})})})});$e.displayName=ce;var le="SelectItemText",Ge=c.forwardRef((n,e)=>{const{__scopeSelect:t,className:o,style:r,...i}=n,s=G(le,t),l=Y(le,t),a=Ke(le,t),u=Nt(le,t),[h,g]=c.useState(null),w=k(e,C=>g(C),a.onItemTextChange,C=>l.itemTextRefCallback?.(C,a.value,a.disabled)),y=h?.textContent,S=c.useMemo(()=>d.jsx("option",{value:a.value,disabled:a.disabled,children:y},a.value),[a.disabled,a.value,y]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=u;return $(()=>(p(S),()=>v(S)),[p,v,S]),d.jsxs(d.Fragment,{children:[d.jsx(j.span,{id:a.textId,...i,ref:w}),a.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Ee.createPortal(i.children,s.valueNode):null]})});Ge.displayName=le;var Ye="SelectItemIndicator",qe=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n;return Ke(Ye,t).isSelected?d.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});qe.displayName=Ye;var ye="SelectScrollUpButton",Ze=c.forwardRef((n,e)=>{const t=Y(ye,n.__scopeSelect),o=Te(ye,n.__scopeSelect),[r,i]=c.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollTop>0;i(u)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),r?d.jsx(Je,{...n,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop-a.offsetHeight)}}):null});Ze.displayName=ye;var Ce="SelectScrollDownButton",Xe=c.forwardRef((n,e)=>{const t=Y(Ce,n.__scopeSelect),o=Te(Ce,n.__scopeSelect),[r,i]=c.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollHeight-a.clientHeight,h=Math.ceil(a.scrollTop)<u;i(h)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),r?d.jsx(Je,{...n,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop+a.offsetHeight)}}):null});Xe.displayName=Ce;var Je=c.forwardRef((n,e)=>{const{__scopeSelect:t,onAutoScroll:o,...r}=n,i=Y("SelectScrollButton",t),s=c.useRef(null),l=ue(t),a=c.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return c.useEffect(()=>()=>a(),[a]),$(()=>{l().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),d.jsx(j.div,{"aria-hidden":!0,...r,ref:e,style:{flexShrink:0,...r.style},onPointerDown:N(r.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:N(r.onPointerMove,()=>{i.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:N(r.onPointerLeave,()=>{a()})})}),Ht="SelectSeparator",zt=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n;return d.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});zt.displayName=Ht;var Ie="SelectArrow",Ft=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n,r=pe(t),i=G(Ie,t),s=Y(Ie,t);return i.open&&s.position==="popper"?d.jsx(St,{...r,...o,ref:e}):null});Ft.displayName=Ie;var Ut="SelectBubbleInput",Qe=c.forwardRef(({__scopeSelect:n,value:e,...t},o)=>{const r=c.useRef(null),i=k(o,r),s=dt(e);return c.useEffect(()=>{const l=r.current;if(!l)return;const a=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(a,"value").set;if(s!==e&&h){const g=new Event("change",{bubbles:!0});h.call(l,e),l.dispatchEvent(g)}},[s,e]),d.jsx(j.select,{...t,style:{...wt,...t.style},ref:i,defaultValue:e})});Qe.displayName=Ut;function et(n){return n===""||n===void 0}function tt(n){const e=ut(n),t=c.useRef(""),o=c.useRef(0),r=c.useCallback(s=>{const l=t.current+s;e(l),(function a(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>a(""),1e3))})(l)},[e]),i=c.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return c.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,r,i]}function ot(n,e,t){const r=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=t?n.indexOf(t):-1;let s=Wt(n,Math.max(i,0));r.length===1&&(s=s.filter(u=>u!==t));const a=s.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return a!==t?a:void 0}function Wt(n,e){return n.map((t,o)=>n[(e+o)%n.length])}var Kt=je,$t=Ae,Gt=De,Yt=ke,qt=Le,Zt=Be,Xt=Fe,Jt=$e,Qt=Ge,eo=qe,to=Ze,oo=Xe;const nt=({size:n=24,color:e="currentColor",...t})=>c.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},c.createElement("path",{d:"m18 15-6-6-6 6"}));nt.displayName="ChevronUp";function co(n){const e=ee.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Kt,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function uo(n){const e=ee.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Gt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function po(n){const e=ee.c(13);let t,o,r,i;e[0]!==n?({className:o,size:i,children:t,...r}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i):(t=e[1],o=e[2],r=e[3],i=e[4]);const s=i===void 0?"default":i;let l;e[5]!==o?(l=oe("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 hover:bg-accent hover:text-accent-foreground dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-xl border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-10 data-[size=sm]:h-8 data-[size=xs]:h-7 data-[size=xs]:px-2.5 data-[size=xs]:py-1.5 data-[size=xs]:rounded-lg *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(Yt,{asChild:!0,children:d.jsx(Re,{className:"size-4 opacity-50"})}),e[7]=a):a=e[7];let u;return e[8]!==t||e[9]!==r||e[10]!==s||e[11]!==l?(u=d.jsxs($t,{"data-slot":"select-trigger","data-size":s,className:l,...r,children:[t,a]}),e[8]=t,e[9]=r,e[10]=s,e[11]=l,e[12]=u):u=e[12],u}function fo(n){const e=ee.c(20);let t,o,r,i;e[0]!==n?({className:o,children:t,position:i,...r}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i):(t=e[1],o=e[2],r=e[3],i=e[4]);const s=i===void 0?"popper":i,l=s==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";let a;e[5]!==o||e[6]!==l?(a=oe("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-xl border shadow-md",l,o),e[5]=o,e[6]=l,e[7]=a):a=e[7];let u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=d.jsx(no,{}),e[8]=u):u=e[8];const h=s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let g;e[9]!==h?(g=oe("p-1",h),e[9]=h,e[10]=g):g=e[10];let w;e[11]!==t||e[12]!==g?(w=d.jsx(Xt,{className:g,children:t}),e[11]=t,e[12]=g,e[13]=w):w=e[13];let y;e[14]===Symbol.for("react.memo_cache_sentinel")?(y=d.jsx(ro,{}),e[14]=y):y=e[14];let S;return e[15]!==s||e[16]!==r||e[17]!==a||e[18]!==w?(S=d.jsx(qt,{children:d.jsxs(Zt,{"data-slot":"select-content",className:a,position:s,...r,children:[u,w,y]})}),e[15]=s,e[16]=r,e[17]=a,e[18]=w,e[19]=S):S=e[19],S}function mo(n){const e=ee.c(16);let t,o,r,i;e[0]!==n?({className:o,children:t,hideCheck:i,...r}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i):(t=e[1],o=e[2],r=e[3],i=e[4]);const s=i===void 0?!1:i;let l;e[5]!==o?(l=oe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-xl py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]!==s?(a=!s&&d.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:d.jsx(eo,{children:d.jsx(yt,{className:"size-4"})})}),e[7]=s,e[8]=a):a=e[8];let u;e[9]!==t?(u=d.jsx(Qt,{children:t}),e[9]=t,e[10]=u):u=e[10];let h;return e[11]!==r||e[12]!==l||e[13]!==a||e[14]!==u?(h=d.jsxs(Jt,{"data-slot":"select-item",className:l,...r,children:[a,u]}),e[11]=r,e[12]=l,e[13]=a,e[14]=u,e[15]=h):h=e[15],h}function no(n){const e=ee.c(9);let t,o;e[0]!==n?({className:t,...o}=n,e[0]=n,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let r;e[3]!==t?(r=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=r):r=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(nt,{className:"size-4"}),e[5]=i):i=e[5];let s;return e[6]!==o||e[7]!==r?(s=d.jsx(to,{"data-slot":"select-scroll-up-button",className:r,...o,children:i}),e[6]=o,e[7]=r,e[8]=s):s=e[8],s}function ro(n){const e=ee.c(9);let t,o;e[0]!==n?({className:t,...o}=n,e[0]=n,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let r;e[3]!==t?(r=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=r):r=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(Re,{className:"size-4"}),e[5]=i):i=e[5];let s;return e[6]!==o||e[7]!==r?(s=d.jsx(oo,{"data-slot":"select-scroll-down-button",className:r,...o,children:i}),e[6]=o,e[7]=r,e[8]=s):s=e[8],s}export{co as S,po as a,uo as b,fo as c,mo as d,Ne as e,nt as n};
@@ -1 +1 @@
1
- import{f as q,Y as D,r as U,x as B,w as K,j as s,s as P,c as $,t as y,K as I,a as Q,v as F}from"./index-CCNaUj2A.js";import{C as Y}from"./collection-header-D-wXFMG4.js";import{C as A}from"./collection-page-AFIAghtr.js";import{u as H}from"./tooltip-CqCXb38Z.js";import{u as G,B as N}from"./button-DuitHSR8.js";import{a as J,F as R,b as O,c as E,d as L,f as k,e as T}from"./form-BfiwCHdz.js";import{I as M}from"./input-YU6lpVgW.js";import{i as V}from"./Upload01-BYeEw9Vy.js";import{i as W}from"./X-BTsWwO_U.js";import"./collection-display-button-DgDdVSTg.js";import"./dropdown-menu-CPQpNQmn.js";import"./utils-o1atviYh.js";import"./view-mode-toggle-DOtHoBLN.js";const X=P({name:F().min(1,"Name is required").max(255,"Name is too long"),slug:F().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:F().optional()});function Z(C){const e=$.c(24),{value:n,onChange:o,name:d}=C,a=U.useRef(null);let m;e[0]!==o?(m=w=>{const z=w.target.files?.[0];if(z){if(z.size>2097152){y.error("Image must be smaller than 2MB");return}const c=new FileReader;c.onerror=()=>{const b=c.error;console.error("FileReader error:",b),y.error(b?.message||"Failed to read image file. Please try again."),a.current&&(a.current.value="")},c.onloadend=()=>{if(c.readyState===FileReader.DONE&&c.result){const b=c.result;o(b)}},c.readAsDataURL(z)}},e[0]=o,e[1]=m):m=e[1];const p=m;let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{a.current?.click()},e[2]=i):i=e[2];const t=i;let l;e[3]!==o?(l=w=>{w.stopPropagation(),o("")},e[3]=o,e[4]=l):l=e[4];const r=l;let u;e[5]!==p?(u=s.jsx("input",{type:"file",ref:a,className:"hidden",accept:"image/*",onChange:p}),e[5]=p,e[6]=u):u=e[6];let g;e[7]!==r||e[8]!==d||e[9]!==n?(g=n?s.jsxs("div",{className:"relative group",children:[s.jsx("div",{className:"h-20 w-20 rounded-lg border border-border bg-muted/20 overflow-hidden",children:s.jsx("img",{src:n,alt:d||"Organization logo",className:"w-full h-full object-cover"})}),s.jsx("button",{type:"button",onClick:r,className:"absolute -top-2 -right-2 h-6 w-6 rounded-full bg-destructive text-destructive-foreground opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:s.jsx(W,{className:"h-3 w-3"})})]}):s.jsxs("button",{type:"button",onClick:t,className:"h-20 w-20 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-1 text-muted-foreground hover:text-foreground",children:[s.jsx(V,{className:"h-5 w-5"}),s.jsx("span",{className:"text-xs",children:"Upload"})]}),e[7]=r,e[8]=d,e[9]=n,e[10]=g):g=e[10];const S=n?"Change Logo":"Upload Logo";let x;e[11]!==S?(x=s.jsx(N,{type:"button",variant:"outline",size:"sm",onClick:t,className:"mb-2",children:S}),e[11]=S,e[12]=x):x=e[12];let h;e[13]!==r||e[14]!==n?(h=n&&s.jsx(N,{type:"button",variant:"ghost",size:"sm",onClick:r,className:"ml-2",children:"Remove"}),e[13]=r,e[14]=n,e[15]=h):h=e[15];let j;e[16]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Recommended: Square image, at least 200x200px. Max 2MB."}),e[16]=j):j=e[16];let f;e[17]!==x||e[18]!==h?(f=s.jsxs("div",{className:"flex-1",children:[x,h,j]}),e[17]=x,e[18]=h,e[19]=f):f=e[19];let v;return e[20]!==f||e[21]!==u||e[22]!==g?(v=s.jsxs("div",{className:"flex items-start gap-4",children:[u,g,f]}),e[20]=f,e[21]=u,e[22]=g,e[23]=v):v=e[23],v}function ue(){const C=q(),{org:e}=H(),n=D(),[o,d]=U.useState(!1),a=B({resolver:K(X),values:{name:e.name??"",slug:e.slug??"",logo:e.logo??""}}),m=G({mutationFn:async t=>{const l={name:t.name,slug:t.slug};t.logo&&(l.logo=t.logo);const r=await Q.organization.update({organizationId:e.id,data:l});if(r?.error)throw new Error(r.error.message||"Failed to update organization");return r},onSuccess:t=>{n.invalidateQueries({queryKey:I.organizations()}),n.invalidateQueries({queryKey:I.activeOrganization(e.slug)}),y.success("Organization settings updated successfully"),t?.data?.slug&&t.data.slug!==e.slug&&C({to:"/$org/settings",params:{org:t.data.slug}})},onError:t=>{y.error(t instanceof Error?t.message:"Failed to update organization")},onSettled:()=>{d(!1)}}),p=t=>{d(!0),m.mutate(t)},i=a.formState.isDirty;return s.jsxs(A,{children:[s.jsx(Y,{title:"Settings"}),s.jsx("div",{className:"flex-1 overflow-auto",children:s.jsx("div",{className:"flex h-full",children:s.jsx("div",{className:"flex-1 overflow-auto",children:s.jsx("div",{className:"p-5 max-w-2xl",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Organization"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Update your organization's name, slug, and logo."})]}),s.jsx(J,{...a,children:s.jsxs("form",{onSubmit:a.handleSubmit(p),className:"space-y-6",children:[s.jsx(R,{control:a.control,name:"name",render:({field:t})=>s.jsxs(O,{children:[s.jsx(E,{children:"Organization Name"}),s.jsx(L,{children:s.jsx(M,{placeholder:"My Organization",...t,disabled:o})}),s.jsx(k,{})]})}),s.jsx(R,{control:a.control,name:"slug",render:({field:t})=>s.jsxs(O,{children:[s.jsx(E,{children:"Organization Slug"}),s.jsx(L,{children:s.jsx(M,{placeholder:"my-organization",...t,disabled:o,onChange:l=>{const r=l.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");t.onChange(r)}})}),s.jsx(T,{children:"Used in URLs. Only lowercase letters, numbers, and hyphens are allowed."}),s.jsx(k,{})]})}),s.jsx(R,{control:a.control,name:"logo",render:({field:t})=>s.jsxs(O,{children:[s.jsx(E,{children:"Logo"}),s.jsx(L,{children:s.jsx(Z,{value:t.value,onChange:t.onChange,name:a.watch("name")})}),s.jsx(k,{})]})}),s.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[s.jsx(N,{type:"submit",disabled:!i||o,className:"min-w-24",children:o?"Saving...":"Save Changes"}),i&&s.jsx(N,{type:"button",variant:"outline",onClick:()=>a.reset(),disabled:o,children:"Cancel"})]})]})})]})})})})})]})}export{ue as default};
1
+ import{f as q,Y as D,r as U,x as B,w as K,j as s,s as P,c as $,t as y,K as I,a as Q,v as F}from"./index-A52jfksK.js";import{C as Y}from"./collection-header-DcpyPzrC.js";import{C as A}from"./collection-page-DpUZNbpd.js";import{u as H}from"./tooltip-BjhP6ibY.js";import{u as G,B as N}from"./button-DodNLkpL.js";import{a as J,F as R,b as O,c as E,d as L,f as k,e as T}from"./form-Bus-fIfC.js";import{I as M}from"./input-BXHWk19m.js";import{i as V}from"./Upload01-Da0sGkRE.js";import{i as W}from"./X-BX0rl0N7.js";import"./collection-display-button-475jHotV.js";import"./dropdown-menu-DrQKdl4f.js";import"./utils-DgLfrg3u.js";import"./view-mode-toggle-DAXMt6ZW.js";const X=P({name:F().min(1,"Name is required").max(255,"Name is too long"),slug:F().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:F().optional()});function Z(C){const e=$.c(24),{value:n,onChange:o,name:d}=C,a=U.useRef(null);let m;e[0]!==o?(m=w=>{const z=w.target.files?.[0];if(z){if(z.size>2097152){y.error("Image must be smaller than 2MB");return}const c=new FileReader;c.onerror=()=>{const b=c.error;console.error("FileReader error:",b),y.error(b?.message||"Failed to read image file. Please try again."),a.current&&(a.current.value="")},c.onloadend=()=>{if(c.readyState===FileReader.DONE&&c.result){const b=c.result;o(b)}},c.readAsDataURL(z)}},e[0]=o,e[1]=m):m=e[1];const p=m;let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{a.current?.click()},e[2]=i):i=e[2];const t=i;let l;e[3]!==o?(l=w=>{w.stopPropagation(),o("")},e[3]=o,e[4]=l):l=e[4];const r=l;let u;e[5]!==p?(u=s.jsx("input",{type:"file",ref:a,className:"hidden",accept:"image/*",onChange:p}),e[5]=p,e[6]=u):u=e[6];let g;e[7]!==r||e[8]!==d||e[9]!==n?(g=n?s.jsxs("div",{className:"relative group",children:[s.jsx("div",{className:"h-20 w-20 rounded-lg border border-border bg-muted/20 overflow-hidden",children:s.jsx("img",{src:n,alt:d||"Organization logo",className:"w-full h-full object-cover"})}),s.jsx("button",{type:"button",onClick:r,className:"absolute -top-2 -right-2 h-6 w-6 rounded-full bg-destructive text-destructive-foreground opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:s.jsx(W,{className:"h-3 w-3"})})]}):s.jsxs("button",{type:"button",onClick:t,className:"h-20 w-20 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-1 text-muted-foreground hover:text-foreground",children:[s.jsx(V,{className:"h-5 w-5"}),s.jsx("span",{className:"text-xs",children:"Upload"})]}),e[7]=r,e[8]=d,e[9]=n,e[10]=g):g=e[10];const S=n?"Change Logo":"Upload Logo";let x;e[11]!==S?(x=s.jsx(N,{type:"button",variant:"outline",size:"sm",onClick:t,className:"mb-2",children:S}),e[11]=S,e[12]=x):x=e[12];let h;e[13]!==r||e[14]!==n?(h=n&&s.jsx(N,{type:"button",variant:"ghost",size:"sm",onClick:r,className:"ml-2",children:"Remove"}),e[13]=r,e[14]=n,e[15]=h):h=e[15];let j;e[16]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Recommended: Square image, at least 200x200px. Max 2MB."}),e[16]=j):j=e[16];let f;e[17]!==x||e[18]!==h?(f=s.jsxs("div",{className:"flex-1",children:[x,h,j]}),e[17]=x,e[18]=h,e[19]=f):f=e[19];let v;return e[20]!==f||e[21]!==u||e[22]!==g?(v=s.jsxs("div",{className:"flex items-start gap-4",children:[u,g,f]}),e[20]=f,e[21]=u,e[22]=g,e[23]=v):v=e[23],v}function ue(){const C=q(),{org:e}=H(),n=D(),[o,d]=U.useState(!1),a=B({resolver:K(X),values:{name:e.name??"",slug:e.slug??"",logo:e.logo??""}}),m=G({mutationFn:async t=>{const l={name:t.name,slug:t.slug};t.logo&&(l.logo=t.logo);const r=await Q.organization.update({organizationId:e.id,data:l});if(r?.error)throw new Error(r.error.message||"Failed to update organization");return r},onSuccess:t=>{n.invalidateQueries({queryKey:I.organizations()}),n.invalidateQueries({queryKey:I.activeOrganization(e.slug)}),y.success("Organization settings updated successfully"),t?.data?.slug&&t.data.slug!==e.slug&&C({to:"/$org/settings",params:{org:t.data.slug}})},onError:t=>{y.error(t instanceof Error?t.message:"Failed to update organization")},onSettled:()=>{d(!1)}}),p=t=>{d(!0),m.mutate(t)},i=a.formState.isDirty;return s.jsxs(A,{children:[s.jsx(Y,{title:"Settings"}),s.jsx("div",{className:"flex-1 overflow-auto",children:s.jsx("div",{className:"flex h-full",children:s.jsx("div",{className:"flex-1 overflow-auto",children:s.jsx("div",{className:"p-5 max-w-2xl",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Organization"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Update your organization's name, slug, and logo."})]}),s.jsx(J,{...a,children:s.jsxs("form",{onSubmit:a.handleSubmit(p),className:"space-y-6",children:[s.jsx(R,{control:a.control,name:"name",render:({field:t})=>s.jsxs(O,{children:[s.jsx(E,{children:"Organization Name"}),s.jsx(L,{children:s.jsx(M,{placeholder:"My Organization",...t,disabled:o})}),s.jsx(k,{})]})}),s.jsx(R,{control:a.control,name:"slug",render:({field:t})=>s.jsxs(O,{children:[s.jsx(E,{children:"Organization Slug"}),s.jsx(L,{children:s.jsx(M,{placeholder:"my-organization",...t,disabled:o,onChange:l=>{const r=l.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");t.onChange(r)}})}),s.jsx(T,{children:"Used in URLs. Only lowercase letters, numbers, and hyphens are allowed."}),s.jsx(k,{})]})}),s.jsx(R,{control:a.control,name:"logo",render:({field:t})=>s.jsxs(O,{children:[s.jsx(E,{children:"Logo"}),s.jsx(L,{children:s.jsx(Z,{value:t.value,onChange:t.onChange,name:a.watch("name")})}),s.jsx(k,{})]})}),s.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[s.jsx(N,{type:"submit",disabled:!i||o,className:"min-w-24",children:o?"Saving...":"Save Changes"}),i&&s.jsx(N,{type:"button",variant:"outline",onClick:()=>a.reset(),disabled:o,children:"Cancel"})]})]})})]})})})})})]})}export{ue as default};
@@ -0,0 +1,17 @@
1
+ import{r as w,c as x,j as o,e as nt,f as ne,a as Q,t as oe,R as at,T as ot,D as it,C as lt,P as rt,g as ct,O as dt,h as ut,i as mt,k as ft,d as be,l as ht,G as pt,U as xt,m as gt,S as ve,n as bt,o as vt,N as jt,p as wt,K as St,q as je}from"./index-A52jfksK.js";import{i as yt,E as Ct}from"./SearchMd-1Gq7nypQ.js";import{u as Nt,a as _t,I as me,n as kt}from"./use-connection-BX5-4xHw.js";import{u as Y,L as X}from"./localstorage-keys-D7pZSS7H.js";import{u as J,T as It,a as $t,b as Tt,c as Mt,L as fe,i as zt,P as Ot,O as Dt}from"./tooltip-BjhP6ibY.js";import{B as W}from"./button-DodNLkpL.js";import{c as $}from"./utils-DgLfrg3u.js";import{i as ie}from"./CpuChip02-DlCI7cQJ.js";import{i as At}from"./Loading01-r04aEG5T.js";import{s as Pt}from"./Plus-CS_Y2Vnc.js";import{i as se}from"./X-BX0rl0N7.js";import{u as Rt,a as Et,b as Lt,c as Ht,d as Ut,C as A,e as Bt,I as Gt,D as Wt,f as Vt,g as Ft,h as Kt,i as Yt,j as Zt,R as we,k as qt,l as Qt,m as Xt}from"./resizable-B3HA_CX4.js";import{P as Se,a as ye,b as Ce}from"./popover-MhzpcVkW.js";import{s as Jt}from"./Clock-C-uwthk9.js";import{s as es}from"./Trash01-DVxmznxT.js";import{u as ts}from"./use-binding-CapMpNVF.js";import{E as re}from"./error-boundary-CdmYlIj7.js";import{g as ss}from"./generate-id-Dyweu44Y.js";import{i as ns}from"./File06-CBkqKj5m.js";import{u as ee}from"./use-mobile-TpeNqylz.js";import{u as Ne,a as as}from"./use-organization-settings-BAhAEDx8.js";import{C as os}from"./create-organization-dialog-fbCy_hNu.js";import{I as is}from"./input-BXHWk19m.js";import{A as Z}from"./avatar-bcdjVFyi.js";import{c as ls,D as rs,a as cs,b as ds,d as us,e as he}from"./dropdown-menu-DrQKdl4f.js";import{a as ms}from"./Copy01-CHjgpWtl.js";import{n as pe}from"./LinkExternal01-ISpHuMJE.js";import{D as _e,a as ke,b as Ie,c as $e,d as Te}from"./dialog-BqvvzTa7.js";import"./useQuery-ojqdZMTH.js";import"./select-Be0LRVWn.js";import"./ChevronDown-g4L12M9A.js";import"./use-gateway-CseaalWF.js";import"./AlertCircle-DaEUMwle.js";import"./Terminal-DYN6gEAz.js";import"./connection-card-opsQBUfD.js";import"./card-BHz-BqEu.js";import"./spinner-oZ2DO2-U.js";import"./InfoCircle-BwNsGATl.js";import"./auth-AUS48lXs.js";import"./alert-dialog-DdP064l-.js";import"./form-Bus-fIfC.js";const Me=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.createElement("path",{d:"M9 7H4.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C3 7.76 3 8.04 3 8.6v10.8c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C3.76 21 4.04 21 4.6 21H9m0 0h6m-6 0V4.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C9.76 3 10.04 3 10.6 3h2.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C15 3.76 15 4.04 15 4.6V21m0-10h4.4c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C21 11.76 21 12.04 21 12.6v6.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C20.24 21 19.96 21 19.4 21H15"}));Me.displayName="BarChart10";const ze=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.createElement("path",{d:"M15 21v-5.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C14.24 14 13.96 14 13.4 14h-2.8c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C9 14.76 9 15.04 9 15.6V21M3 7a3 3 0 0 0 6 0 3 3 0 1 0 6 0 3 3 0 1 0 6 0M6.2 21h11.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 19.48 21 18.92 21 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C19.48 3 18.92 3 17.8 3H6.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C3 4.52 3 5.08 3 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 21 5.08 21 6.2 21Z"}));ze.displayName="Building02";const Oe=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));Oe.displayName="ChevronSelectorVertical";const De=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.createElement("path",{d:"M2 12h20M2 12c0 5.523 4.477 10 10 10M2 12C2 6.477 6.477 2 12 2m10 10c0 5.523-4.477 10-10 10m10-10c0-5.523-4.477-10-10-10m0 0a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10m0-20a15.3 15.3 0 0 0-4 10 15.3 15.3 0 0 0 4 10"}));De.displayName="Globe01";const Ae=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.createElement("path",{d:"M9 21v-7.4c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C9.76 12 10.04 12 10.6 12h2.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C15 12.76 15 13.04 15 13.6V21M11.018 2.764 4.235 8.039c-.453.353-.68.53-.843.75a2 2 0 0 0-.318.65C3 9.704 3 9.991 3 10.565V17.8c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 21 5.08 21 6.2 21h11.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 19.48 21 18.92 21 17.8v-7.235c0-.574 0-.861-.074-1.126a2.002 2.002 0 0 0-.318-.65c-.163-.22-.39-.397-.843-.75l-6.783-5.275c-.351-.273-.527-.41-.72-.462a1 1 0 0 0-.523 0c-.194.052-.37.189-.721.462Z"}));Ae.displayName="Home02";const Pe=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.createElement("path",{d:"M15 3v18M7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3Z"}));Pe.displayName="LayoutRight";const Re=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.createElement("path",{d:"m16 17 5-5m0 0-5-5m5 5H9m0-9H7.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C3 5.28 3 6.12 3 7.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 21 6.12 21 7.8 21H9"}));Re.displayName="LogOut01";const Ee=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.createElement("path",{d:"m2 7 8.165 5.715c.661.463.992.695 1.351.784a2 2 0 0 0 .968 0c.36-.09.69-.32 1.351-.784L22 7M6.8 20h10.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C22 17.72 22 16.88 22 15.2V8.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C19.72 4 18.88 4 17.2 4H6.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C2 6.28 2 7.12 2 8.8v6.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C4.28 20 5.12 20 6.8 20Z"}));Ee.displayName="Mail01";const Le=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),w.createElement("path",{d:"M18.727 14.727a1.5 1.5 0 0 0 .3 1.655l.055.054a1.816 1.816 0 0 1 0 2.573 1.818 1.818 0 0 1-2.573 0l-.055-.055a1.5 1.5 0 0 0-1.654-.3 1.5 1.5 0 0 0-.91 1.373v.155a1.818 1.818 0 1 1-3.636 0V20.1a1.5 1.5 0 0 0-.981-1.373 1.5 1.5 0 0 0-1.655.3l-.054.055a1.818 1.818 0 0 1-3.106-1.287 1.818 1.818 0 0 1 .533-1.286l.054-.055a1.5 1.5 0 0 0 .3-1.654 1.5 1.5 0 0 0-1.372-.91h-.155a1.818 1.818 0 1 1 0-3.636H3.9a1.5 1.5 0 0 0 1.373-.981 1.5 1.5 0 0 0-.3-1.655l-.055-.054A1.818 1.818 0 1 1 7.491 4.99l.054.054a1.5 1.5 0 0 0 1.655.3h.073a1.5 1.5 0 0 0 .909-1.372v-.155a1.818 1.818 0 0 1 3.636 0V3.9a1.499 1.499 0 0 0 .91 1.373 1.5 1.5 0 0 0 1.654-.3l.054-.055a1.817 1.817 0 0 1 2.573 0 1.819 1.819 0 0 1 0 2.573l-.055.054a1.5 1.5 0 0 0-.3 1.655v.073a1.5 1.5 0 0 0 1.373.909h.155a1.818 1.818 0 0 1 0 3.636H20.1a1.499 1.499 0 0 0-1.373.91Z"}));Le.displayName="Settings01";const He=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.createElement("path",{d:"M5.316 19.438A4.001 4.001 0 0 1 9 17h6a4.001 4.001 0 0 1 3.684 2.438M16 9.5a4 4 0 1 1-8 0 4 4 0 0 1 8 0Zm6 2.5c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));He.displayName="UserCircle";const Ue=({size:t=24,color:e="currentColor",...s})=>w.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},w.createElement("path",{d:"M22 21v-2a4.002 4.002 0 0 0-3-3.874M15.5 3.291a4.001 4.001 0 0 1 0 7.418M17 21c0-1.864 0-2.796-.305-3.53a4 4 0 0 0-2.164-2.165C13.796 15 12.864 15 11 15H8c-1.864 0-2.796 0-3.53.305a4 4 0 0 0-2.166 2.164C2 18.204 2 19.136 2 21M13.5 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z"}));Ue.displayName="Users01";function ce(){const t=x.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=X.decoChatOpen(),t[0]=e):e=t[0];const[s,a]=Y(e,fs);let n;return t[1]!==s||t[2]!==a?(n=[s,a],t[1]=s,t[2]=a,t[3]=n):n=t[3],n}function fs(t){return!!(t??!1)}function hs(t){const e=x.c(14),{title:s,description:a,avatar:n,avatarNode:i,className:l}=t,r=s===void 0?"Start a conversation":s;let c;e[0]!==l?(c=$("flex flex-col items-center justify-center gap-4 p-0 text-center",l),e[0]=l,e[1]=c):c=e[1];let d;e[2]!==n||e[3]!==i?(d=i||n&&o.jsx("img",{src:n,alt:"Chat avatar",className:"size-[60px] rounded-[18px] border-[1.875px] border-border/10"}),e[2]=n,e[3]=i,e[4]=d):d=e[4];let u;e[5]!==r?(u=r&&o.jsx("h3",{className:"text-xl font-medium text-foreground",children:r}),e[5]=r,e[6]=u):u=e[6];let m;e[7]!==a?(m=a&&o.jsx("div",{className:"text-muted-foreground text-center text-sm max-w-md",children:a}),e[7]=a,e[8]=m):m=e[8];let f;return e[9]!==c||e[10]!==d||e[11]!==u||e[12]!==m?(f=o.jsxs("div",{className:c,children:[d,u,m]}),e[9]=c,e[10]=d,e[11]=u,e[12]=m,e[13]=f):f=e[13],f}const Be=()=>crypto.randomUUID(),Ge=w.createContext(null);function ps(t){const e=x.c(15),{children:s}=t,{locator:a}=J(),n=Rt(),[i,l]=Y(X.threadManagerState(a)+":active-id",xs);let r;e[0]!==l||e[1]!==n?(r=h=>{const v=h?.id||crypto.randomUUID(),g=new Date().toISOString(),b={id:v,title:h?.title||"",created_at:h?.created_at||g,updated_at:h?.updated_at||g,hidden:h?.hidden??!1};return n.insert.mutate(b),l(v),b},e[0]=l,e[1]=n,e[2]=r):r=e[2];const c=r;let d;e[3]!==i||e[4]!==l||e[5]!==n?(d=h=>{n.update.mutate({id:h,updates:{hidden:!0,updated_at:new Date().toISOString()}}),i===h&&l(Be())},e[3]=i,e[4]=l,e[5]=n,e[6]=d):d=e[6];const u=d;let m;e[7]!==i||e[8]!==c||e[9]!==u||e[10]!==l?(m={activeThreadId:i,createThread:c,setActiveThreadId:l,hideThread:u},e[7]=i,e[8]=c,e[9]=u,e[10]=l,e[11]=m):m=e[11];const f=m;let p;return e[12]!==s||e[13]!==f?(p=o.jsx(Ge.Provider,{value:f,children:s}),e[12]=s,e[13]=f,e[14]=p):p=e[14],p}function xs(t){return t||Be()}function gs(){const t=w.useContext(Ge);if(!t)throw new Error("useChat must be used within a ChatProvider");return t}function bs(t){const e=new Date(t),a=new Date().getTime()-e.getTime(),n=Math.floor(a/6e4),i=Math.floor(a/36e5);return n<1?"now":n<60?`${n}m`:`${i}h`}function vs(t){const e=new Date,s=new Date(e.getFullYear(),e.getMonth(),e.getDate()),a=new Date(s.getTime()-864e5),n=new Date(s.getTime()-7*864e5),i=new Date(s.getTime()-30*864e5),l=[],r=[],c=[],d=[],u=[];for(const f of t){const p=new Date(f.updated_at);p>=s?l.push(f):p>=a?r.push(f):p>=n?c.push(f):p>=i?d.push(f):u.push(f)}const m=[];return l.length>0&&m.push({label:"Today",threads:l,showRelativeTime:!0}),r.length>0&&m.push({label:"Yesterday",threads:r,showRelativeTime:!1}),c.length>0&&m.push({label:"7 days ago",threads:c,showRelativeTime:!1}),d.length>0&&m.push({label:"30 days ago",threads:d,showRelativeTime:!1}),u.length>0&&m.push({label:"Older",threads:u,showRelativeTime:!1}),m}function js(t){const e=x.c(36),{threads:s,activeThreadId:a,onSelectThread:n,onRemoveThread:i,onOpen:l}=t,[r,c]=w.useState("");let d,u,m,f,p,h,v,g,b;if(e[0]!==a||e[1]!==l||e[2]!==i||e[3]!==n||e[4]!==r||e[5]!==s){const y=r.trim()?s.filter(T=>(T.title||"New chat").toLowerCase().includes(r.toLowerCase())):s,N=vs(y);let _;e[15]!==l?(_=T=>{T?l?.():c("")},e[15]=l,e[16]=_):_=e[16];const O=_;u=Se,g=O,e[17]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(ye,{asChild:!0,children:o.jsx("button",{type:"button",className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent group cursor-pointer",title:"Chat history",children:o.jsx(Jt,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"})})}),e[17]=b):b=e[17],d=Ce,p="end",h="w-80 p-0";let I;e[18]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx(yt,{size:16,className:"text-muted-foreground shrink-0"}),e[18]=I):I=e[18];let M;e[19]===Symbol.for("react.memo_cache_sentinel")?(M=T=>c(T.target.value),e[19]=M):M=e[19],e[20]!==r?(v=o.jsx("div",{className:"border-b",children:o.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 cursor-text",children:[I,o.jsx("input",{type:"text",placeholder:"Search chats...",value:r,onChange:M,className:"flex-1 border-0 shadow-none focus:outline-none px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"})]})}),e[20]=r,e[21]=v):v=e[21],m="max-h-[300px] overflow-y-auto",f=y.length===0?o.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:r.trim()?"No chats found":"No chats yet"}):N.map((T,z)=>o.jsxs("div",{children:[z>0&&o.jsx("div",{className:"border-t mx-3"}),o.jsx("div",{className:"px-3 py-1",children:o.jsx("span",{className:"text-xs font-medium text-muted-foreground tracking-wide",children:T.label})}),T.threads.map(D=>{const V=D.id===a;return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 hover:bg-accent cursor-pointer group ${V?"bg-accent/50":""}`,onClick:()=>n(D.id),children:[o.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[o.jsx("span",{className:"text-sm truncate",children:D.title||"New chat"}),o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:V?"current":T.showRelativeTime?bs(D.updated_at):null})]}),o.jsx("button",{type:"button",onClick:R=>{R.stopPropagation(),i(D.id)},className:"opacity-0 cursor-pointer group/trash group-hover:opacity-100 p-1 hover:bg-destructive/10 rounded transition-opacity",title:"Remove chat",children:o.jsx(es,{size:14,className:"text-muted-foreground group-hover/trash:text-destructive"})})]},D.id)})]},T.label)),e[0]=a,e[1]=l,e[2]=i,e[3]=n,e[4]=r,e[5]=s,e[6]=d,e[7]=u,e[8]=m,e[9]=f,e[10]=p,e[11]=h,e[12]=v,e[13]=g,e[14]=b}else d=e[6],u=e[7],m=e[8],f=e[9],p=e[10],h=e[11],v=e[12],g=e[13],b=e[14];let j;e[22]!==m||e[23]!==f?(j=o.jsx("div",{className:m,children:f}),e[22]=m,e[23]=f,e[24]=j):j=e[24];let S;e[25]!==d||e[26]!==p||e[27]!==h||e[28]!==v||e[29]!==j?(S=o.jsxs(d,{align:p,className:h,children:[v,j]}),e[25]=d,e[26]=p,e[27]=h,e[28]=v,e[29]=j,e[30]=S):S=e[30];let C;return e[31]!==u||e[32]!==g||e[33]!==b||e[34]!==S?(C=o.jsxs(u,{onOpenChange:g,children:[b,S]}),e[31]=u,e[32]=g,e[33]=b,e[34]=S,e[35]=C):C=e[35],C}function ws(t){const e=/\/[^/]+\/mcps\/([^/]+)\/([^/]+)\/([^/]+)/,s=t.match(e);return s&&s[1]&&s[2]&&s[3]?{connectionId:decodeURIComponent(s[1]),collectionName:decodeURIComponent(s[2]),itemId:decodeURIComponent(s[3])}:{connectionId:null,collectionName:null,itemId:null}}function Ss(){const t=x.c(2),e=nt();let s;t[0]!==e.location.pathname?(s=ws(e.location.pathname),t[0]=e.location.pathname,t[1]=s):s=t[1];const{connectionId:a,collectionName:n,itemId:i}=s;return`You are an AI assistant running in an MCP Mesh environment.
2
+
3
+ ## About MCP Mesh
4
+ The Model Context Protocol (MCP) Mesh allows users to connect external MCP servers and expose their capabilities through gateways. Each gateway provides access to a curated set of tools from connected MCP servers.
5
+
6
+ ## Important Notes
7
+ - All tool calls are logged and audited for security and compliance
8
+ - You have access to the tools exposed through the selected gateway
9
+ - MCPs may expose resources that users can browse and edit
10
+
11
+ ## Current Editing Context
12
+ ${a?`- Connection ID: ${a}`:""}
13
+ ${n?`- Collection Name: ${n}`:""}
14
+ ${i?`- Item ID: ${i}`:""}
15
+
16
+ Help the user understand and work with this resource.
17
+ `}const ys="https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png";function Cs(){const t=x.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("img",{src:"/empty-state-openrouter.svg",alt:"",width:336,height:320,"aria-hidden":"true",className:"w-xs h-auto mask-radial-[100%_100%] mask-radial-from-20% mask-radial-to-50% mask-radial-at-center"}),t[0]=e):e=t[0],e}function Ns(t){const e=x.c(3),{gatewayId:s,onSelect:a}=t,{data:n}=Bt(s);if(n.length===0)return null;let i;return e[0]!==a||e[1]!==n?(i=o.jsx(Gt,{prompts:n,onSelect:a,className:"mt-6"}),e[0]=a,e[1]=n,e[2]=i):i=e[2],i}function _s(){const{org:{slug:t,id:e},locator:s}=J(),[,a]=ce(),n=ne(),{data:i}=Q.useSession(),l=i?.user,{createThread:r,activeThreadId:c,setActiveThreadId:d,hideThread:u}=gs(),{threads:m,refetch:f}=Et(),p=Lt(),h=Ht(),v=Nt(),[g]=ts({connections:v,binding:"LLMS"}),b=!!g,j=p.length>0,S=b&&j,[C,y]=Y(X.chatSelectedModel(s),k=>k??null),[N,_]=Y(`${s}:selected-gateway`,()=>null),O=h[0],I=C??(O?{id:O.id,connectionId:O.connectionId}:null),M=p[0]?.id,T=N?.gatewayId??M,z=p.find(k=>k.id===T),D=h.find(k=>k.id===I?.id&&k.connectionId===I?.connectionId),V=Ss(),R=Ut({threadId:c,systemPrompt:V,onCreateThread:k=>r({id:k.id,title:k.title})}),F=async k=>{if(!D){oe.error("No model configured");return}const B={created_at:new Date().toISOString(),thread_id:c,model:{id:D.id,connectionId:D.connectionId,provider:D.provider??void 0},gateway:z?{id:z.id}:void 0,user:{avatar:l?.image??void 0,name:l?.name??"you"}};await R.sendMessage(k,B)},q=k=>{y({id:k.id,connectionId:k.connectionId})},[L,H]=w.useState(!1),K=_t(),E=async()=>{if(!e||!l?.id){oe.error("Not authenticated");return}H(!0);try{const k="https://sites-openrouter.decocache.com/mcp",B=v?.find(st=>st.connection_url===k);if(B){n({to:"/$org/mcps/$connectionId",params:{org:t,connectionId:B.id}});return}const ue=new Date().toISOString(),et={id:ss("conn"),title:"OpenRouter",description:"Access hundreds of LLM models from a single API",icon:"https://openrouter.ai/favicon.ico",app_name:"openrouter",app_id:"openrouter",connection_type:"HTTP",connection_url:k,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{source:"chat",verified:!1,scopeName:"deco",toolsCount:0,publishedAt:null,repository:null},created_at:ue,updated_at:ue,created_by:l.id,organization_id:e,tools:null,bindings:null,status:"inactive"},tt=await K.create.mutateAsync(et);n({to:"/$org/mcps/$connectionId",params:{org:t,connectionId:tt.id}})}catch(k){oe.error(`Failed to connect OpenRouter: ${k instanceof Error?k.message:String(k)}`)}finally{H(!1)}};if(!S){let k,B;return!b&&!j?(k="Connect your providers",B="Connect an LLM provider and create a gateway to unlock AI-powered features."):b?(k="No gateways configured",B="Create a gateway to expose your MCP tools to the chat."):(k="No model provider connected",B="Connect to a model provider to unlock AI-powered features."),o.jsxs(A,{children:[o.jsxs(A.Header,{children:[o.jsxs(A.Header.Left,{children:[o.jsx("img",{src:ys,alt:"deco chat",className:"size-5 rounded"}),o.jsx("span",{className:"text-sm font-medium",children:"deco chat"})]}),o.jsx(A.Header.Right,{children:o.jsx("button",{type:"button",onClick:()=>a(!1),className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent transition-colors group cursor-pointer",title:"Close chat",children:o.jsx(se,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"})})})]}),o.jsx(A.Main,{className:"flex flex-col items-center",children:o.jsx(A.EmptyState,{children:o.jsx(Ct,{image:o.jsx(Cs,{}),title:k,description:B,actions:o.jsxs(o.Fragment,{children:[o.jsxs(W,{variant:"outline",onClick:E,disabled:L,children:[o.jsx("img",{src:"https://openrouter.ai/favicon.ico",alt:"OpenRouter",className:"size-4"}),L?"Installing...":"Install OpenRouter"]}),o.jsx(W,{variant:"outline",onClick:()=>n({to:"/$org/mcps",params:{org:t},search:{action:"create"}}),children:"Install MCP Server"})]})})})})]})}const U=R.messages.filter(k=>k.role!=="system");return o.jsxs(A,{children:[o.jsxs(A.Header,{children:[o.jsxs(A.Header.Left,{children:[o.jsx(me,{icon:z?.icon,name:z?.title||"deco chat",size:"xs",fallbackIcon:o.jsx(ie,{size:12})}),o.jsx("span",{className:"text-sm font-medium",children:z?.title||"deco chat"})]}),o.jsxs(A.Header.Right,{children:[o.jsx("button",{type:"button",onClick:()=>r(),className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent group cursor-pointer",title:"New chat",children:o.jsx(Pt,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"})}),o.jsx(js,{threads:m,activeThreadId:c,onSelectThread:d,onRemoveThread:u,onOpen:()=>f()}),o.jsx("button",{type:"button",onClick:()=>a(!1),className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent transition-colors group cursor-pointer",title:"Close chat",children:o.jsx(se,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"})})]})]}),o.jsx(A.Main,{children:U.length===0?o.jsx(A.EmptyState,{children:o.jsxs("div",{className:"flex flex-col items-center gap-6 w-full px-4",children:[o.jsx(hs,{title:z?.title||"Ask deco chat",description:z?.description??"Ask anything about configuring model providers or using MCP Mesh.",avatarNode:o.jsx(me,{icon:z?.icon,name:z?.title||"deco chat",size:"lg",fallbackIcon:o.jsx(ie,{size:32}),className:"size-[60px]! rounded-[18px]!"})}),T&&o.jsx(re,{fallback:null,children:o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"flex justify-center",children:o.jsx(At,{size:20,className:"animate-spin text-muted-foreground"})}),children:o.jsx(Ns,{gatewayId:T,onSelect:k=>{F(k.description??k.name)}})})},T)]})}):o.jsx(A.Messages,{messages:R.messages,status:R.status,minHeightOffset:240})}),o.jsx(A.Footer,{children:o.jsx("div",{children:o.jsxs(A.Input,{onSubmit:F,onStop:R.stop,disabled:h.length===0||!I,isStreaming:R.status==="submitted"||R.status==="streaming",placeholder:h.length===0?"Add an LLM binding connection to start chatting":"Ask anything or @ for context",usageMessages:R.messages,children:[o.jsx(A.Input.GatewaySelector,{disabled:!1,selectedGatewayId:T,onGatewayChange:k=>{k&&_({gatewayId:k})}}),o.jsx(A.Input.ModelSelector,{disabled:!1,selectedModel:I??void 0,onModelChange:q})]})})})]})}function ks(t){const e=x.c(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a=o.jsx(at,{"data-slot":"sheet",...s}),e[2]=s,e[3]=a):a=e[3],a}function Is(t){const e=x.c(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a=o.jsx(rt,{"data-slot":"sheet-portal",...s}),e[2]=s,e[3]=a):a=e[3],a}function $s(t){const e=x.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let n;e[3]!==s?(n=$("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",s),e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==a||e[6]!==n?(i=o.jsx(dt,{"data-slot":"sheet-overlay",className:n,...a}),e[5]=a,e[6]=n,e[7]=i):i=e[7],i}function Ts(t){const e=x.c(17);let s,a,n,i;e[0]!==t?({className:a,children:s,side:i,...n}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=n,e[4]=i):(s=e[1],a=e[2],n=e[3],i=e[4]);const l=i===void 0?"right":i;let r;e[5]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx($s,{}),e[5]=r):r=e[5];const c=l==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",d=l==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",u=l==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",m=l==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t";let f;e[6]!==a||e[7]!==c||e[8]!==d||e[9]!==u||e[10]!==m?(f=$("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",c,d,u,m,a),e[6]=a,e[7]=c,e[8]=d,e[9]=u,e[10]=m,e[11]=f):f=e[11];let p;e[12]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsxs(ct,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[o.jsx(se,{className:"size-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]}),e[12]=p):p=e[12];let h;return e[13]!==s||e[14]!==n||e[15]!==f?(h=o.jsxs(Is,{children:[r,o.jsxs(lt,{"data-slot":"sheet-content",className:f,...n,children:[s,p]})]}),e[13]=s,e[14]=n,e[15]=f,e[16]=h):h=e[16],h}function Ms(t){const e=x.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let n;e[3]!==s?(n=$("flex flex-col gap-1.5 p-4",s),e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==a||e[6]!==n?(i=o.jsx("div",{"data-slot":"sheet-header",className:n,...a}),e[5]=a,e[6]=n,e[7]=i):i=e[7],i}function zs(t){const e=x.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let n;e[3]!==s?(n=$("text-foreground font-semibold",s),e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==a||e[6]!==n?(i=o.jsx(ot,{"data-slot":"sheet-title",className:n,...a}),e[5]=a,e[6]=n,e[7]=i):i=e[7],i}function Os(t){const e=x.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let n;e[3]!==s?(n=$("text-muted-foreground text-sm",s),e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==a||e[6]!==n?(i=o.jsx(it,{"data-slot":"sheet-description",className:n,...a}),e[5]=a,e[6]=n,e[7]=i):i=e[7],i}function We(t){const e=x.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let n;e[3]!==s?(n=$("bg-accent animate-pulse rounded-md",s),e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==a||e[6]!==n?(i=o.jsx("div",{"data-slot":"skeleton",className:n,...a}),e[5]=a,e[6]=n,e[7]=i):i=e[7],i}const Ds="sidebar_state",As=3600*24*7,Ps="16rem",Rs="18rem",Es="3rem",Ls="b",Ve=w.createContext(null);function de(){const t=w.useContext(Ve);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function Hs(t){const e=x.c(21),{defaultOpen:s,open:a,onOpenChange:n,children:i}=t,l=s===void 0?!0:s,r=ee(),[c,d]=w.useState(!1),[u,m]=w.useState(l),f=a??u;let p;e[0]!==f||e[1]!==n?(p=O=>{const I=typeof O=="function"?O(f):O;n?n(I):m(I),document.cookie=`${Ds}=${I}; path=/; max-age=${As}`},e[0]=f,e[1]=n,e[2]=p):p=e[2];const h=p;let v;e[3]!==r||e[4]!==h?(v=()=>r?d(Bs):h(Us),e[3]=r,e[4]=h,e[5]=v):v=e[5];const g=v;let b,j;e[6]!==g?(b=()=>{const O=I=>{if(I.key===Ls&&(I.metaKey||I.ctrlKey)){const M=I.target;if(M.tagName==="INPUT"||M.tagName==="TEXTAREA"||M.isContentEditable)return;I.preventDefault(),g()}};return globalThis.addEventListener("keydown",O),()=>globalThis.removeEventListener("keydown",O)},j=[g],e[6]=g,e[7]=b,e[8]=j):(b=e[7],j=e[8]),w.useEffect(b,j);const S=f?"expanded":"collapsed";let C;e[9]!==r||e[10]!==f||e[11]!==c||e[12]!==h||e[13]!==S||e[14]!==g?(C={state:S,open:f,setOpen:h,isMobile:r,openMobile:c,setOpenMobile:d,toggleSidebar:g},e[9]=r,e[10]=f,e[11]=c,e[12]=h,e[13]=S,e[14]=g,e[15]=C):C=e[15];const y=C;let N;e[16]!==i?(N=o.jsx($t,{delayDuration:0,children:i}),e[16]=i,e[17]=N):N=e[17];let _;return e[18]!==y||e[19]!==N?(_=o.jsx(Ve.Provider,{value:y,children:N}),e[18]=y,e[19]=N,e[20]=_):_=e[20],_}function Us(t){return!t}function Bs(t){return!t}function Gs(t){const e=x.c(14);let s,a,n,i;e[0]!==t?({className:a,style:i,children:s,...n}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=n,e[4]=i):(s=e[1],a=e[2],n=e[3],i=e[4]);let l;e[5]!==i?(l={"--sidebar-width":Ps,"--sidebar-width-icon":Es,...i},e[5]=i,e[6]=l):l=e[6];const r=l;let c;e[7]!==a?(c=$("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex h-full w-full",a),e[7]=a,e[8]=c):c=e[8];let d;return e[9]!==s||e[10]!==n||e[11]!==r||e[12]!==c?(d=o.jsx("div",{"data-slot":"sidebar-wrapper",style:r,className:c,...n,children:s}),e[9]=s,e[10]=n,e[11]=r,e[12]=c,e[13]=d):d=e[13],d}function Ws(t){const e=x.c(46);let s,a,n,i,l,r;e[0]!==t?({side:i,variant:l,collapsible:r,className:a,children:s,...n}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=n,e[4]=i,e[5]=l,e[6]=r):(s=e[1],a=e[2],n=e[3],i=e[4],l=e[5],r=e[6]);const c=i===void 0?"left":i,d=l===void 0?"sidebar":l,u=r===void 0?"offcanvas":r,{isMobile:m,state:f,openMobile:p,setOpenMobile:h}=de();if(u==="none"){let I;e[7]!==a?(I=$("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",a),e[7]=a,e[8]=I):I=e[8];let M;return e[9]!==s||e[10]!==n||e[11]!==I?(M=o.jsx("div",{"data-slot":"sidebar",className:I,...n,children:s}),e[9]=s,e[10]=n,e[11]=I,e[12]=M):M=e[12],M}if(m){let I;e[13]===Symbol.for("react.memo_cache_sentinel")?(I={"--sidebar-width":Rs},e[13]=I):I=e[13];let M;e[14]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsxs(Ms,{className:"sr-only",children:[o.jsx(zs,{children:"Sidebar"}),o.jsx(Os,{children:"Displays the mobile sidebar."})]}),e[14]=M):M=e[14];let T;e[15]!==s?(T=o.jsx("div",{className:"flex h-full w-full flex-col",children:s}),e[15]=s,e[16]=T):T=e[16];let z;e[17]!==c||e[18]!==T?(z=o.jsxs(Ts,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:I,side:c,children:[M,T]}),e[17]=c,e[18]=T,e[19]=z):z=e[19];let D;return e[20]!==p||e[21]!==n||e[22]!==h||e[23]!==z?(D=o.jsx(ks,{open:p,onOpenChange:h,...n,children:z}),e[20]=p,e[21]=n,e[22]=h,e[23]=z,e[24]=D):D=e[24],D}const v=f==="collapsed"?u:"",g=d==="floating"||d==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)";let b;e[25]!==g?(b=$("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",g),e[25]=g,e[26]=b):b=e[26];let j;e[27]!==b?(j=o.jsx("div",{"data-slot":"sidebar-gap",className:b}),e[27]=b,e[28]=j):j=e[28];const S=c==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",C=d==="floating"||d==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)";let y;e[29]!==a||e[30]!==S||e[31]!==C?(y=$("fixed top-12 bottom-0 z-10 hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",S,C,a),e[29]=a,e[30]=S,e[31]=C,e[32]=y):y=e[32];let N;e[33]!==s?(N=o.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border py-2 flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:s}),e[33]=s,e[34]=N):N=e[34];let _;e[35]!==n||e[36]!==y||e[37]!==N?(_=o.jsx("div",{"data-slot":"sidebar-container",className:y,...n,children:N}),e[35]=n,e[36]=y,e[37]=N,e[38]=_):_=e[38];let O;return e[39]!==c||e[40]!==f||e[41]!==_||e[42]!==v||e[43]!==j||e[44]!==d?(O=o.jsxs("div",{className:"group peer text-foreground hidden md:block border-r","data-state":f,"data-collapsible":v,"data-variant":d,"data-side":c,"data-slot":"sidebar",children:[j,_]}),e[39]=c,e[40]=f,e[41]=_,e[42]=v,e[43]=j,e[44]=d,e[45]=O):O=e[45],O}function Vs(t){const e=x.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let n;e[3]!==s?(n=$("bg-background relative flex w-full flex-1 flex-col min-w-0","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",s),e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==a||e[6]!==n?(i=o.jsx("main",{"data-slot":"sidebar-inset",className:n,...a}),e[5]=a,e[6]=n,e[7]=i):i=e[7],i}function Fs(t){const e=x.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let n;e[3]!==s?(n=$("h-4 m-0! w-full",s),e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==a||e[6]!==n?(i=o.jsx("div",{"data-sidebar":"separator",className:n,...a}),e[5]=a,e[6]=n,e[7]=i):i=e[7],i}function Ks(t){const e=x.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let n;e[3]!==s?(n=$("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",s),e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==a||e[6]!==n?(i=o.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:n,...a}),e[5]=a,e[6]=n,e[7]=i):i=e[7],i}function Ys(t){const e=x.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let n;e[3]!==s?(n=$("relative flex w-full min-w-0 flex-col px-2 py-2 md:py-0",s),e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==a||e[6]!==n?(i=o.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:n,...a}),e[5]=a,e[6]=n,e[7]=i):i=e[7],i}function Zs(t){const e=x.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let n;e[3]!==s?(n=$("w-full text-sm",s),e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==a||e[6]!==n?(i=o.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:n,...a}),e[5]=a,e[6]=n,e[7]=i):i=e[7],i}function qs(t){const e=x.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let n;e[3]!==s?(n=$("flex w-full min-w-0 flex-col gap-1",s),e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==a||e[6]!==n?(i=o.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:n,...a}),e[5]=a,e[6]=n,e[7]=i):i=e[7],i}function ae(t){const e=x.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let n;e[3]!==s?(n=$("group/menu-item relative",s),e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==a||e[6]!==n?(i=o.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:n,...a}),e[5]=a,e[6]=n,e[7]=i):i=e[7],i}const Qs=ut("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-lg px-2 py-1.5 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding,colors] transition-colors duration-150 ease-out hover:transition-none focus-visible:ring-2 active:bg-sidebar-accent/75 disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent/75 [&>span:last-child]:truncate [&>svg]:size-[18px] [&>svg]:shrink-0 [&>svg]:text-muted-foreground",{variants:{variant:{default:"hover:bg-sidebar-accent text-sidebar-foreground/80 active:text-sidebar-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-7 text-sm font-[450]",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function Fe(t){const e=x.c(28);let s,a,n,i,l,r,c;e[0]!==t?({asChild:n,isActive:i,variant:l,size:r,tooltip:c,className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=n,e[4]=i,e[5]=l,e[6]=r,e[7]=c):(s=e[1],a=e[2],n=e[3],i=e[4],l=e[5],r=e[6],c=e[7]);const d=n===void 0?!1:n,u=i===void 0?!1:i,m=l===void 0?"default":l,f=r===void 0?"default":r,p=d?mt:"button",{isMobile:h,state:v}=de();let g;e[8]!==s||e[9]!==f||e[10]!==m?(g=$(Qs({variant:m,size:f}),s),e[8]=s,e[9]=f,e[10]=m,e[11]=g):g=e[11];let b;e[12]!==p||e[13]!==u||e[14]!==a||e[15]!==f||e[16]!==g?(b=o.jsx(p,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":f,"data-active":u,className:g,...a}),e[12]=p,e[13]=u,e[14]=a,e[15]=f,e[16]=g,e[17]=b):b=e[17];const j=b;if(!c)return j;if(typeof c=="string"){let _;e[18]!==c?(_={children:c},e[18]=c,e[19]=_):_=e[19],c=_}let S;e[20]!==j?(S=o.jsx(Tt,{asChild:!0,children:j}),e[20]=j,e[21]=S):S=e[21];const C=v!=="collapsed"||h;let y;e[22]!==C||e[23]!==c?(y=o.jsx(It,{side:"right",align:"center",hidden:C,...c}),e[22]=C,e[23]=c,e[24]=y):y=e[24];let N;return e[25]!==S||e[26]!==y?(N=o.jsxs(Mt,{children:[S,y]}),e[25]=S,e[26]=y,e[27]=N):N=e[27],N}function Xs(t){const e=x.c(26),{item:s}=t,a=ne(),{org:n}=J(),i=Ne(n.id),l=as(n.id);let r;e[0]!==l.update||e[1]!==s.url||e[2]!==i?.sidebar_items?(r=async()=>{const C=(i?.sidebar_items||[]).filter(y=>y.url!==s.url);await l.update.mutateAsync({sidebar_items:C})},e[0]=l.update,e[1]=s.url,e[2]=i?.sidebar_items,e[3]=r):r=e[3];const c=r;let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=/^https?:\/\/.+/,e[4]=d):d=e[4];let u;e[5]!==s.icon?(u=d.test(s.icon),e[5]=s.icon,e[6]=u):u=e[6];const m=u;let f;e[7]!==s.url||e[8]!==a?(f=()=>{a({to:s.url})},e[7]=s.url,e[8]=a,e[9]=f):f=e[9];const p=s.title;let h;e[10]!==m||e[11]!==s.icon||e[12]!==s.title?(h=o.jsx("div",{className:"flex items-center justify-center shrink-0",children:m?o.jsx("img",{src:s.icon,alt:s.title,className:"h-4 w-4 rounded object-cover"}):o.jsx(ns,{size:16,className:"text-muted-foreground group-hover/item:text-foreground transition-colors"})}),e[10]=m,e[11]=s.icon,e[12]=s.title,e[13]=h):h=e[13];let v;e[14]!==s.title?(v=s.title.toLocaleLowerCase(),e[14]=s.title,e[15]=v):v=e[15];let g;e[16]!==v?(g=o.jsx("div",{className:"flex-1 min-w-0 flex flex-col items-start",children:o.jsx("span",{className:"truncate text-sm w-full capitalize",children:v})}),e[16]=v,e[17]=g):g=e[17];let b;e[18]!==c?(b=o.jsx(se,{size:16,className:"text-muted-foreground opacity-0 group-hover/item:opacity-50 hover:opacity-100 cursor-pointer",onClick:S=>{S.preventDefault(),S.stopPropagation(),c()}}),e[18]=c,e[19]=b):b=e[19];let j;return e[20]!==s.title||e[21]!==f||e[22]!==h||e[23]!==g||e[24]!==b?(j=o.jsx(ae,{children:o.jsxs(Fe,{className:"w-full pr-2 group/item relative cursor-pointer text-foreground/90 hover:text-foreground",onClick:f,tooltip:p,children:[h,g,b]})}),e[20]=s.title,e[21]=f,e[22]=h,e[23]=g,e[24]=b,e[25]=j):j=e[25],j}function Js(){const t=x.c(4),{org:e}=J(),a=Ne(e.id)?.sidebar_items;if(!a?.length)return null;let n;t[0]!==a?(n=a.map(en),t[0]=a,t[1]=n):n=t[1];let i;return t[2]!==n?(i=o.jsx(Ke,{children:n}),t[2]=n,t[3]=i):i=t[3],i}function en(t){return o.jsx(Xs,{item:t},t.url)}function xe(){const t=x.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(ae,{children:o.jsx("div",{className:"flex items-center gap-2 px-4 py-2",children:o.jsx(We,{className:"h-4 flex-1"})})}),t[0]=e):e=t[0],e}function Ke(t){const e=x.c(4),{children:s}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(Fs,{className:"my-2 -ml-1"}),e[0]=a):a=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(ae,{children:o.jsx("div",{className:"group-data-[collapsible=icon]:hidden px-2 py-0 text-xs font-medium h-6 text-muted-foreground flex items-center justify-between",children:o.jsx("span",{className:"whitespace-nowrap",children:"Pinned Views"})})}),e[1]=n):n=e[1];let i;return e[2]!==s?(i=o.jsxs(o.Fragment,{children:[a,n,s]}),e[2]=s,e[3]=i):i=e[3],i}function tn(){const t=x.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(w.Suspense,{fallback:o.jsxs(Ke,{children:[o.jsx(xe,{}),o.jsx(xe,{})]}),children:o.jsx(Js,{})}),t[0]=e):e=t[0],e}function sn(){const t=x.c(43),{locator:e}=J(),s=ne();let a;t[0]!==e?(a=fe.parse(e),t[0]=e,t[1]=a):a=t[1];const{org:n}=a;let i;t[2]!==e?(i=fe.isOrgAdminProject(e),t[2]=e,t[3]=i):i=t[3];const l=i;let r;t[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Ae,{}),t[4]=r):r=t[4];let c;t[5]!==s||t[6]!==n?(c={key:"home",label:"Home",icon:r,onClick:()=>s({to:"/$org",params:{org:n}})},t[5]=s,t[6]=n,t[7]=c):c=t[7];let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(ze,{}),t[8]=d):d=t[8];let u;t[9]!==s||t[10]!==n?(u={key:"store",label:"Store",icon:d,onClick:()=>s({to:"/$org/store",params:{org:n}})},t[9]=s,t[10]=n,t[11]=u):u=t[11];let m;t[12]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(kt,{}),t[12]=m):m=t[12];let f;t[13]!==s||t[14]!==n?(f={key:"mcps",label:"MCP Servers",icon:m,onClick:()=>s({to:"/$org/mcps",params:{org:n}})},t[13]=s,t[14]=n,t[15]=f):f=t[15];let p;t[16]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(ie,{}),t[16]=p):p=t[16];let h;t[17]!==s||t[18]!==n?(h={key:"gateways",label:"MCP Gateways",icon:p,onClick:()=>s({to:"/$org/gateways",params:{org:n}})},t[17]=s,t[18]=n,t[19]=h):h=t[19];let v;t[20]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(Me,{}),t[20]=v):v=t[20];let g;t[21]!==s||t[22]!==n?(g={key:"monitoring",label:"Monitoring",icon:v,onClick:()=>s({to:"/$org/monitoring",params:{org:n}})},t[21]=s,t[22]=n,t[23]=g):g=t[23];let b;t[24]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(Ue,{}),t[24]=b):b=t[24];let j;t[25]!==s||t[26]!==n?(j={key:"members",label:"Members",icon:b,onClick:()=>s({to:"/$org/members",params:{org:n}})},t[25]=s,t[26]=n,t[27]=j):j=t[27];let S;t[28]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Le,{}),t[28]=S):S=t[28];let C;t[29]!==s||t[30]!==n?(C={key:"settings",label:"Settings",icon:S,onClick:()=>s({to:"/$org/settings",params:{org:n}})},t[29]=s,t[30]=n,t[31]=C):C=t[31];let y;t[32]!==g||t[33]!==j||t[34]!==C||t[35]!==c||t[36]!==u||t[37]!==f||t[38]!==h?(y=[c,u,f,h,g,j,C],t[32]=g,t[33]=j,t[34]=C,t[35]=c,t[36]=u,t[37]=f,t[38]=h,t[39]=y):y=t[39];const N=y;let _;return t[40]!==N||t[41]!==l?(_=l?N:[],t[40]=N,t[41]=l,t[42]=_):_=t[42],_}function Ye(t){const e=x.c(10),{navigationItems:s,footer:a,additionalContent:n,variant:i,collapsible:l}=t,r=i===void 0?"sidebar":i,c=l===void 0?"icon":l;let d;e[0]!==s?(d=s.map(nn),e[0]=s,e[1]=d):d=e[1];let u;e[2]!==n||e[3]!==d?(u=o.jsx(Ks,{className:"flex-1 overflow-x-hidden",children:o.jsx(Ys,{className:"font-medium",children:o.jsx(Zs,{children:o.jsxs(qs,{className:"gap-0.5",children:[d,n]})})})}),e[2]=n,e[3]=d,e[4]=u):u=e[4];let m;return e[5]!==c||e[6]!==a||e[7]!==u||e[8]!==r?(m=o.jsxs(Ws,{variant:r,collapsible:c,children:[u,a]}),e[5]=c,e[6]=a,e[7]=u,e[8]=r,e[9]=m):m=e[9],m}function nn(t){return o.jsx(ae,{children:o.jsxs(Fe,{className:"group/nav-item cursor-pointer text-foreground/90 hover:text-foreground",onClick:t.onClick,isActive:t.isActive,tooltip:t.label,children:[o.jsx("span",{className:"text-muted-foreground group-hover/nav-item:text-foreground transition-colors [&>svg]:size-4",children:t.icon}),o.jsx("span",{className:"truncate",children:t.label})]})},t.key)}Ye.Skeleton=function(){return o.jsx("div",{className:"flex flex-col gap-0.5",children:Array.from({length:8}).map((e,s)=>o.jsx("div",{className:"w-full h-8",children:o.jsx(We,{className:"h-full bg-sidebar-accent rounded-md"})},s))})};function an(){const t=x.c(3),e=sn();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(o.Fragment,{children:o.jsx(re,{children:o.jsx(w.Suspense,{fallback:null,children:o.jsx(tn,{})})})}),t[0]=s):s=t[0];let a;return t[1]!==e?(a=o.jsx(Ye,{navigationItems:e,additionalContent:s}),t[1]=e,t[2]=a):a=t[2],a}function on(t){const e=x.c(12);let s,a,n,i;e[0]!==t?({className:s,orientation:n,decorative:i,...a}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=n,e[4]=i):(s=e[1],a=e[2],n=e[3],i=e[4]);const l=n===void 0?"horizontal":n,r=i===void 0?!0:i;let c;e[5]!==s?(c=$("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",s),e[5]=s,e[6]=c):c=e[6];let d;return e[7]!==r||e[8]!==l||e[9]!==a||e[10]!==c?(d=o.jsx(ft,{"data-slot":"separator-root",decorative:r,orientation:l,className:c,...a}),e[7]=r,e[8]=l,e[9]=a,e[10]=c,e[11]=d):d=e[11],d}const Ze=w.createContext(null);function ln(){const t=w.useContext(Ze);if(!t)throw new Error("TopbarSwitcher compound components must be used within TopbarSwitcher.Root");return t}function rn(t){const e=x.c(10),{children:s,onItemHover:a}=t,[n,i]=w.useState(null);let l;e[0]!==a?(l=m=>{i(m),a?.(m)},e[0]=a,e[1]=l):l=e[1];const r=l;let c;e[2]!==n||e[3]!==r?(c={hoveredItem:n,setHoveredItem:r},e[2]=n,e[3]=r,e[4]=c):c=e[4];let d;e[5]!==s?(d=o.jsx(Se,{children:s}),e[5]=s,e[6]=d):d=e[6];let u;return e[7]!==c||e[8]!==d?(u=o.jsx(Ze.Provider,{value:c,children:d}),e[7]=c,e[8]=d,e[9]=u):u=e[9],u}function cn(t){const e=x.c(6),{children:s,onClick:a}=t;let n;e[0]!==s||e[1]!==a?(n=o.jsx(W,{variant:"link",className:"p-0.5 h-auto",onClick:a,type:"button",children:s}),e[0]=s,e[1]=a,e[2]=n):n=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(ye,{asChild:!0,children:o.jsx(W,{size:"icon",variant:"ghost",className:"w-6 h-6 p-0",children:o.jsx(Oe,{size:16,className:"opacity-50"})})}),e[3]=i):i=e[3];let l;return e[4]!==n?(l=o.jsxs("div",{className:"flex items-center gap-1",children:[n,i]}),e[4]=n,e[5]=l):l=e[5],l}function dn(t){const e=x.c(8),{item:s,fallback:a}=t,n=a===void 0?"":a,i=s?.avatarUrl??"",l=s?.name??n;let r;e[0]!==i||e[1]!==l?(r=o.jsx(Z,{url:i,fallback:l,size:"xs",objectFit:"contain"}),e[0]=i,e[1]=l,e[2]=r):r=e[2];const c=s?.name??n;let d;e[3]!==c?(d=o.jsx("span",{children:c}),e[3]=c,e[4]=d):d=e[4];let u;return e[5]!==r||e[6]!==d?(u=o.jsxs("div",{className:"flex items-center gap-2",children:[r,d]}),e[5]=r,e[6]=d,e[7]=u):u=e[7],u}function un(t){const e=x.c(6),{children:s,align:a}=t,n=a===void 0?"start":a,l=w.Children.toArray(s).filter(mn).length===1?"280px":"480px";let r;e[0]!==l?(r={width:l},e[0]=l,e[1]=r):r=e[1];let c;return e[2]!==n||e[3]!==s||e[4]!==r?(c=o.jsx(Ce,{align:n,className:"p-0 flex items-start",style:r,children:s}),e[2]=n,e[3]=s,e[4]=r,e[5]=c):c=e[5],c}function mn(t){return w.isValidElement(t)&&(t.type===Qe||t.type===qe)}function qe(t){const e=x.c(5),{children:s,className:a}=t;let n;e[0]!==a?(n=$("flex flex-col border-border w-[240px] border-r last:border-r-0 last:w-full",a),e[0]=a,e[1]=n):n=e[1];let i;return e[2]!==s||e[3]!==n?(i=o.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=i):i=e[4],i}const Qe=qe;function fn(t){const e=x.c(6),{placeholder:s,value:a,onChange:n}=t,i=s===void 0?"Search...":s;let l;e[0]!==n?(l=c=>n(c.target.value),e[0]=n,e[1]=l):l=e[1];let r;return e[2]!==i||e[3]!==l||e[4]!==a?(r=o.jsx(is,{placeholder:i,value:a,onChange:l,className:"rounded-none border-t-0 border-x-0 focus-visible:border-border focus-visible:ring-0"}),e[2]=i,e[3]=l,e[4]=a,e[5]=r):r=e[5],r}function hn(t){const e=x.c(6),{children:s,emptyMessage:a}=t,n=a===void 0?"No items found.":a,i=w.Children.count(s)>0;let l;e[0]!==n||e[1]!==i?(l=!i&&o.jsx("div",{className:"text-muted-foreground text-sm px-1 py-8 text-center",children:n}),e[0]=n,e[1]=i,e[2]=l):l=e[2];let r;return e[3]!==s||e[4]!==l?(r=o.jsxs("div",{className:"flex flex-col gap-0.5 p-1 max-h-44 overflow-y-auto",children:[l,s]}),e[3]=s,e[4]=l,e[5]=r):r=e[5],r}function pn(t){const e=x.c(15),{item:s,onClick:a,onHover:n,children:i}=t,l=ln();let r;e[0]!==l||e[1]!==s||e[2]!==n?(r=()=>{l.setHoveredItem(s.slug),n?.(s)},e[0]=l,e[1]=s,e[2]=n,e[3]=r):r=e[3];const c=r;let d;e[4]!==s||e[5]!==a?(d=()=>a(s),e[4]=s,e[5]=a,e[6]=d):d=e[6];let u;e[7]!==i||e[8]!==s.avatarUrl||e[9]!==s.name?(u=i||o.jsxs(o.Fragment,{children:[o.jsx(Z,{url:s.avatarUrl??"",fallback:s.name,size:"xs",className:"w-[22px]! h-[22px]!",objectFit:"contain"}),o.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:s.name})]}),e[7]=i,e[8]=s.avatarUrl,e[9]=s.name,e[10]=u):u=e[10];let m;return e[11]!==c||e[12]!==d||e[13]!==u?(m=o.jsx(W,{onClick:d,onMouseEnter:c,variant:"ghost",size:"sm",className:"w-full justify-start font-normal",children:u}),e[11]=c,e[12]=d,e[13]=u,e[14]=m):m=e[14],m}function xn(t){const e=x.c(2),{children:s}=t;let a;return e[0]!==s?(a=o.jsx("div",{className:"px-1 pb-1 pt-0.5",children:s}),e[0]=s,e[1]=a):a=e[1],a}function gn(t){const e=x.c(11),{onClick:s,icon:a,children:n,variant:i}=t,r=(i===void 0?"default":i)==="muted"&&"text-muted-foreground";let c;e[0]!==r?(c=$("w-full justify-start font-normal",r),e[0]=r,e[1]=c):c=e[1];let d;e[2]!==a?(d=a&&o.jsx("span",{className:"[&>svg]:size-4",children:a}),e[2]=a,e[3]=d):d=e[3];let u;e[4]!==n?(u=o.jsx("span",{children:n}),e[4]=n,e[5]=u):u=e[5];let m;return e[6]!==s||e[7]!==c||e[8]!==d||e[9]!==u?(m=o.jsxs(W,{variant:"ghost",size:"sm",className:c,onClick:s,children:[d,u]}),e[6]=s,e[7]=c,e[8]=d,e[9]=u,e[10]=m):m=e[10],m}function bn(){const t=x.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(on,{}),t[0]=e):e=t[0],e}function vn(){const t=x.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"h-4 w-16 bg-accent rounded-full animate-pulse"}),t[0]=e):e=t[0],e}const P=Object.assign(rn,{Trigger:cn,CurrentItem:dn,Content:un,Panel:Qe,Search:fn,Items:hn,Item:pn,Actions:xn,Action:gn,Separator:bn,Skeleton:vn});function le(){const t=x.c(59);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const{org:s}=be(e),{data:a}=Q.useListOrganizations(),n=ne();let i;t[1]!==s||t[2]!==a?(i=a?.find(V=>V.slug===s),t[1]=s,t[2]=a,t[3]=i):i=t[3];const l=i,[r,c]=w.useState(""),[d,u]=w.useState(!1);let m,f,p,h,v,g,b,j;if(t[4]!==l||t[5]!==n||t[6]!==s||t[7]!==r||t[8]!==a){const R=(a?(()=>{const E=a.filter(U=>U.name.toLowerCase().includes(r.toLowerCase()));if(s){const U=E.findIndex(k=>k.slug===s);if(U>0){const k=E[U];k&&(E.splice(U,1),E.unshift(k))}}return E})():[]).map(jn);let F;t[17]!==l?(F=l?{slug:l.slug,name:l.name,avatarUrl:l.logo}:void 0,t[17]=l,t[18]=F):F=t[18];const q=F;h=P;let L;t[19]!==n||t[20]!==s?(L=()=>n({to:"/$org",params:{org:s??""}}),t[19]=n,t[20]=s,t[21]=L):L=t[21];let H;t[22]!==q?(H=o.jsx(P.CurrentItem,{item:q}),t[22]=q,t[23]=H):H=t[23],t[24]!==L||t[25]!==H?(j=o.jsx(P.Trigger,{onClick:L,children:H}),t[24]=L,t[25]=H,t[26]=j):j=t[26],p=P.Content,f=P.Panel,t[27]!==r?(b=o.jsx(P.Search,{placeholder:"Search organizations...",value:r,onChange:c}),t[27]=r,t[28]=b):b=t[28],m=P.Items,v="No organizations found.";let K;t[29]!==n?(K=E=>o.jsx(P.Item,{item:E,onClick:U=>n({to:"/$org",params:{org:U.slug}})},E.slug),t[29]=n,t[30]=K):K=t[30],g=R.map(K),t[4]=l,t[5]=n,t[6]=s,t[7]=r,t[8]=a,t[9]=m,t[10]=f,t[11]=p,t[12]=h,t[13]=v,t[14]=g,t[15]=b,t[16]=j}else m=t[9],f=t[10],p=t[11],h=t[12],v=t[13],g=t[14],b=t[15],j=t[16];let S;t[31]!==m||t[32]!==v||t[33]!==g?(S=o.jsx(m,{emptyMessage:v,children:g}),t[31]=m,t[32]=v,t[33]=g,t[34]=S):S=t[34];let C,y;t[35]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(P.Actions,{children:o.jsx(P.Action,{onClick:()=>u(!0),variant:"muted",children:"+ Create organization"})}),y=o.jsx(P.Separator,{}),t[35]=C,t[36]=y):(C=t[35],y=t[36]);let N;t[37]!==n?(N=()=>n({to:"/"}),t[37]=n,t[38]=N):N=t[38];let _;t[39]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(ls,{}),t[39]=_):_=t[39];let O;t[40]!==N?(O=o.jsx(P.Actions,{children:o.jsx(P.Action,{onClick:N,icon:_,children:"See all organizations"})}),t[40]=N,t[41]=O):O=t[41];let I;t[42]!==f||t[43]!==O||t[44]!==b||t[45]!==S?(I=o.jsxs(f,{children:[b,S,C,y,O]}),t[42]=f,t[43]=O,t[44]=b,t[45]=S,t[46]=I):I=t[46];let M;t[47]!==p||t[48]!==I?(M=o.jsx(p,{children:I}),t[47]=p,t[48]=I,t[49]=M):M=t[49];let T;t[50]!==h||t[51]!==M||t[52]!==j?(T=o.jsxs(h,{children:[j,M]}),t[50]=h,t[51]=M,t[52]=j,t[53]=T):T=t[53];let z;t[54]!==d?(z=o.jsx(os,{open:d,onOpenChange:u}),t[54]=d,t[55]=z):z=t[55];let D;return t[56]!==T||t[57]!==z?(D=o.jsxs(o.Fragment,{children:[T,z]}),t[56]=T,t[57]=z,t[58]=D):D=t[58],D}function jn(t){return{slug:t.slug,name:t.name,avatarUrl:t.logo}}le.Skeleton=P.Skeleton;const Xe=w.createContext({setOpen:()=>{}}),wn=()=>w.useContext(Xe),Sn=t=>{const e=x.c(25);let s,a,n,i,l;e[0]!==t?({children:s,defaultOpen:a,open:i,onOpenChange:n,...l}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=n,e[4]=i,e[5]=l):(s=e[1],a=e[2],n=e[3],i=e[4],l=e[5]);const r=a??!1;let c;e[6]!==n||e[7]!==i||e[8]!==r?(c={prop:i,defaultProp:r,onChange:n},e[6]=n,e[7]=i,e[8]=r,e[9]=c):c=e[9];const[d,u]=Yt(c);let m;e[10]!==u?(m={setOpen:u},e[10]=u,e[11]=m):m=e[11];let f;e[12]!==s||e[13]!==d||e[14]!==l||e[15]!==u?(f=o.jsx(Zt,{open:d,onOpenChange:u,...l,children:s}),e[12]=s,e[13]=d,e[14]=l,e[15]=u,e[16]=f):f=e[16];let p;e[17]!==d||e[18]!==l||e[19]!==u||e[20]!==f?(p=o.jsx(ds,{open:d,onOpenChange:u,...l,children:f}),e[17]=d,e[18]=l,e[19]=u,e[20]=f,e[21]=p):p=e[21];let h;return e[22]!==m||e[23]!==p?(h=o.jsx(Xe.Provider,{value:m,children:p}),e[22]=m,e[23]=p,e[24]=h):h=e[24],h},yn=t=>{const{children:e,title:s,...a}=t,n=ee(),{className:i,...l}=a;return n?o.jsxs(Vt,{...l,children:[o.jsx(Ft,{className:"hidden",children:o.jsx(Kt,{children:s})}),o.jsx("div",{className:$("flex flex-col gap-2 p-2 py-4",i),children:e})]}):o.jsx(cs,{...a,children:e})},Cn=t=>{const{children:e,...s}=t,{setOpen:a}=wn(),n=ee(),{className:i,...l}=s;return n?o.jsx("div",{...l,onClick:r=>{a(!1);const{onClick:c}=l;c?.(r)},className:$("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",i),children:e}):o.jsx(us,{...s,children:e})},Nn=t=>{const e=x.c(7);let s,a;e[0]!==t?({children:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);const n=ee();let i;return e[3]!==s||e[4]!==n||e[5]!==a?(i=n?o.jsx(Wt,{asChild:!0,children:s}):o.jsx(rs,{...a,children:s}),e[3]=s,e[4]=n,e[5]=a,e[6]=i):i=e[6],i},_n=t=>{const e=x.c(7);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);const n=ee();let i;return e[3]!==s||e[4]!==n||e[5]!==a?(i=n?o.jsx(he,{className:$(s),...a}):o.jsx(he,{className:$(s),...a}),e[3]=s,e[4]=n,e[5]=a,e[6]=i):i=e[6],i};function kn(t){const e=x.c(11),{user:s,trigger:a,align:n,children:i}=t,l=n===void 0?"start":n;let r;e[0]!==a||e[1]!==s?(r=a(s),e[0]=a,e[1]=s,e[2]=r):r=e[2];let c;e[3]!==r?(c=o.jsx(Nn,{asChild:!0,children:o.jsx("div",{children:r})}),e[3]=r,e[4]=c):c=e[4];let d;e[5]!==l||e[6]!==i?(d=o.jsx(yn,{side:"top",align:l,className:"md:w-[240px]",children:i}),e[5]=l,e[6]=i,e[7]=d):d=e[7];let u;return e[8]!==c||e[9]!==d?(u=o.jsxs(Sn,{children:[c,d]}),e[8]=c,e[9]=d,e[10]=u):u=e[10],u}function In(t){const e=x.c(8),{children:s,onClick:a,className:n,asChild:i}=t;let l;e[0]!==i||e[1]!==s||e[2]!==a?(l=i?s:o.jsx("button",{type:"button",className:"flex items-center gap-2 text-sm w-full cursor-pointer",onClick:a,children:s}),e[0]=i,e[1]=s,e[2]=a,e[3]=l):l=e[3];let r;return e[4]!==i||e[5]!==n||e[6]!==l?(r=o.jsx(Cn,{asChild:i,className:n,children:l}),e[4]=i,e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function $n(t){const e=x.c(2),{className:s}=t;let a;return e[0]!==s?(a=o.jsx(_n,{className:s}),e[0]=s,e[1]=a):a=e[1],a}function Tn(){const t=x.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"w-8 h-8 bg-muted rounded-full animate-pulse"}),t[0]=e):e=t[0],e}const G=Object.assign(kn,{Item:In,Separator:$n,Skeleton:Tn});function Mn(t){const e=x.c(32),{open:s,onOpenChange:a,user:n,userImage:i}=t,[l,r]=w.useState(!1);let c;e[0]!==n.id?(c=()=>{navigator.clipboard.writeText(n.id),r(!0),setTimeout(()=>r(!1),2e3)},e[0]=n.id,e[1]=c):c=e[1];const d=c;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsxs(_e,{children:[o.jsx(ke,{children:"Profile"}),o.jsx(Ie,{children:"Your account information"})]}),e[2]=u):u=e[2];const m=n.name||n.email||"U";let f;e[3]!==m||e[4]!==i?(f=o.jsx(Z,{url:i,fallback:m,shape:"circle",size:"2xl"}),e[3]=m,e[4]=i,e[5]=f):f=e[5];const p=n.name||n.email;let h;e[6]!==p?(h=o.jsx("div",{className:"text-lg font-semibold text-center",children:p}),e[6]=p,e[7]=h):h=e[7];let v;e[8]!==n.email?(v=o.jsx("div",{className:"text-sm text-muted-foreground text-center",children:n.email}),e[8]=n.email,e[9]=v):v=e[9];let g;e[10]!==h||e[11]!==v?(g=o.jsxs("div",{className:"flex flex-col items-center gap-2 w-full",children:[h,v]}),e[10]=h,e[11]=v,e[12]=g):g=e[12];let b;e[13]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"User ID"}),e[13]=b):b=e[13];let j;e[14]!==n.id?(j=o.jsxs("div",{className:"flex flex-col gap-1 min-w-0 flex-1",children:[b,o.jsx("span",{className:"text-sm font-mono truncate",children:n.id})]}),e[14]=n.id,e[15]=j):j=e[15];let S;e[16]!==l?(S=l?o.jsx(zt,{size:16,className:"text-green-600"}):o.jsx(ms,{size:16,className:"text-muted-foreground"}),e[16]=l,e[17]=S):S=e[17];let C;e[18]!==d||e[19]!==S?(C=o.jsx("button",{type:"button",onClick:d,className:"flex-shrink-0 p-2 hover:bg-background rounded-md transition-colors","aria-label":"Copy user ID",children:S}),e[18]=d,e[19]=S,e[20]=C):C=e[20];let y;e[21]!==j||e[22]!==C?(y=o.jsxs("div",{className:"flex items-center justify-between gap-3 w-full px-4 py-3 rounded-lg bg-muted/50 border border-border",children:[j,C]}),e[21]=j,e[22]=C,e[23]=y):y=e[23];let N;e[24]!==y||e[25]!==f||e[26]!==g?(N=o.jsxs($e,{className:"sm:max-w-md",children:[u,o.jsxs("div",{className:"flex flex-col items-center gap-6 py-4",children:[f,g,y]})]}),e[24]=y,e[25]=f,e[26]=g,e[27]=N):N=e[27];let _;return e[28]!==a||e[29]!==s||e[30]!==N?(_=o.jsx(Te,{open:s,onOpenChange:a,children:N}),e[28]=a,e[29]=s,e[30]=N,e[31]=_):_=e[31],_}function zn(t){const e=x.c(5),{open:s,onOpenChange:a}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsxs(_e,{children:[o.jsx(ke,{children:"Invitations"}),o.jsx(Ie,{children:"Your pending organization invitations"})]}),e[0]=n):n=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs($e,{className:"sm:max-w-lg",children:[n,o.jsx("div",{className:"max-h-[420px] overflow-auto pr-1",children:o.jsx(xt,{})})]}),e[1]=i):i=e[1];let l;return e[2]!==a||e[3]!==s?(l=o.jsx(Te,{open:s,onOpenChange:a,children:i}),e[2]=a,e[3]=s,e[4]=l):l=e[4],l}function On(t){const e=x.c(31),{user:s,userImage:a,hasInvites:n,showInvitesItem:i}=t,[l,r]=w.useState(!1),[c,d]=w.useState(!1);let u;e[0]!==n||e[1]!==s.email||e[2]!==s.name||e[3]!==a?(u=()=>o.jsxs("div",{className:"relative",children:[o.jsx(Z,{url:a,fallback:s.name||s.email||"U",shape:"circle",size:"sm",className:"cursor-pointer hover:ring-2 ring-muted-foreground transition-all"}),n&&o.jsx("span",{className:"absolute -top-0.5 -right-0.5 h-2.5 w-2.5 rounded-full bg-destructive ring-2 ring-background"})]}),e[0]=n,e[1]=s.email,e[2]=s.name,e[3]=a,e[4]=u):u=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsxs(G.Item,{onClick:()=>r(!0),children:[o.jsx(He,{className:"text-muted-foreground",size:18}),"Profile"]}),e[5]=m):m=e[5];let f;e[6]!==n||e[7]!==i?(f=i&&o.jsxs(G.Item,{onClick:()=>d(!0),children:[o.jsx(Ee,{className:"text-muted-foreground",size:18}),"Invitations",n&&o.jsx("span",{className:"ml-auto h-2 w-2 rounded-full bg-destructive"})]}),e[6]=n,e[7]=i,e[8]=f):f=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(G.Separator,{}),e[9]=p):p=e[9];let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(pt,{className:"w-4 h-4 text-muted-foreground"}),e[10]=h):h=e[10];let v;e[11]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(G.Item,{asChild:!0,children:o.jsxs("a",{href:"https://github.com/decocms/admin",target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 text-sm cursor-pointer",children:[h,"decocms/admin",o.jsx(pe,{size:18,className:"text-muted-foreground ml-auto"})]})}),e[11]=v):v=e[11];let g;e[12]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(De,{className:"text-muted-foreground",size:18}),e[12]=g):g=e[12];let b,j;e[13]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(G.Item,{asChild:!0,children:o.jsxs("a",{href:"https://decocms.com",target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 text-sm cursor-pointer",children:[g,"Homepage",o.jsx(pe,{size:18,className:"ml-auto text-muted-foreground"})]})}),j=o.jsx(G.Separator,{}),e[13]=b,e[14]=j):(b=e[13],j=e[14]);let S;e[15]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsxs(G.Item,{onClick:Dn,children:[o.jsx(Re,{size:18,className:"text-muted-foreground"}),"Log out"]}),e[15]=S):S=e[15];let C;e[16]!==u||e[17]!==f||e[18]!==s?(C=o.jsxs(G,{user:s,trigger:u,align:"end",children:[m,f,p,v,b,j,S]}),e[16]=u,e[17]=f,e[18]=s,e[19]=C):C=e[19];let y;e[20]!==l||e[21]!==s||e[22]!==a?(y=l&&o.jsx(Mn,{open:l,onOpenChange:r,user:s,userImage:a}),e[20]=l,e[21]=s,e[22]=a,e[23]=y):y=e[23];let N;e[24]!==c||e[25]!==i?(N=i&&c&&o.jsx(zn,{open:c,onOpenChange:d}),e[24]=c,e[25]=i,e[26]=N):N=e[26];let _;return e[27]!==C||e[28]!==y||e[29]!==N?(_=o.jsxs(o.Fragment,{children:[C,y,N]}),e[27]=C,e[28]=y,e[29]=N,e[30]=_):_=e[30],_}function Dn(){return Q.signOut()}function An(){const{data:t}=Q.useSession(),e=w.useContext(ht),{data:s}=e.hooks.useListUserInvitations(),n=(s??[]).length>0;if(!t?.user)return o.jsx(Z,{url:void 0,fallback:"U",shape:"circle",size:"sm",className:"cursor-pointer",muted:!0});const i=t.user,l={...i,name:i.name??void 0},r=i.image;return o.jsx(On,{user:l,userImage:r,hasInvites:n,showInvitesItem:!0})}function Pn(t){const e=x.c(6),{children:s}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(gt,{children:o.jsx(ve,{})}),e[0]=a):a=e[0];let n;e[1]!==s?(n=o.jsx(bt,{children:s}),e[1]=s,e[2]=n):n=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(vt,{children:o.jsx(jt,{to:"/login",replace:!0})}),e[3]=i):i=e[3];let l;return e[4]!==n?(l=o.jsxs(o.Fragment,{children:[a,n,i]}),e[4]=n,e[5]=l):l=e[5],l}function Rn(t){const e=x.c(5),{children:s,className:a}=t;let n;e[0]!==a?(n=$("fixed top-0 left-0 right-0 z-20 bg-sidebar flex items-center w-full h-12 border-b border-border",a),e[0]=a,e[1]=n):n=e[1];let i;return e[2]!==s||e[3]!==n?(i=o.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=i):i=e[4],i}function En(t){const e=x.c(5),{children:s,className:a}=t;let n;e[0]!==a?(n=$("flex items-center justify-center px-2 h-full border-r border-border",a),e[0]=a,e[1]=n):n=e[1];let i;return e[2]!==s||e[3]!==n?(i=o.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=i):i=e[4],i}function Ln(t){const e=x.c(5),{children:s,className:a}=t;let n;e[0]!==a?(n=$("flex items-center gap-2 px-2 h-full",a),e[0]=a,e[1]=n):n=e[1];let i;return e[2]!==s||e[3]!==n?(i=o.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=i):i=e[4],i}function Hn(t){const e=x.c(5),{children:s,className:a}=t;let n;e[0]!==a?(n=$("flex items-center gap-2 px-2 h-full flex-1",a),e[0]=a,e[1]=n):n=e[1];let i;return e[2]!==s||e[3]!==n?(i=o.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=i):i=e[4],i}function Un(t){const e=x.c(5),{children:s,className:a}=t;let n;e[0]!==a?(n=$("flex items-center gap-2 px-2 h-full ml-auto",a),e[0]=a,e[1]=n):n=e[1];let i;return e[2]!==s||e[3]!==n?(i=o.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=i):i=e[4],i}function Bn(){const t=x.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex items-center justify-center px-2 h-full border-r border-border",children:o.jsx("div",{className:"w-8 h-8 bg-muted rounded-md animate-pulse"})}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"flex items-center gap-2 px-2 h-full",children:o.jsx("div",{className:"w-32 h-6 bg-muted rounded-md animate-pulse"})}),t[1]=s):s=t[1];let a;return t[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsxs("div",{className:"fixed top-0 left-0 right-0 z-20 bg-sidebar flex items-center w-full h-12 border-b border-border",children:[e,s,o.jsx("div",{className:"flex items-center gap-2 px-2 h-full ml-auto",children:o.jsx("div",{className:"w-8 h-8 bg-muted rounded-full animate-pulse"})})]}),t[2]=a):a=t[2],a}const te=Object.assign(Rn,{Sidebar:En,Left:Ln,Center:Hn,Right:Un,Skeleton:Bn});function Je(){const t=x.c(3),{toggleSidebar:e}=de();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Pe,{className:"text-muted-foreground/85 group-hover:text-foreground transition-colors",size:20}),t[0]=s):s=t[0];let a;return t[1]!==e?(a=o.jsx(o.Fragment,{children:o.jsx(W,{onClick:e,size:"icon",variant:"ghost",className:"w-8 h-8 rounded-md",children:s})}),t[1]=e,t[2]=a):a=t[2],a}Je.Skeleton=function(){return o.jsx("div",{className:"w-8 h-8 bg-muted rounded-md animate-pulse"})};const Gn="https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png";function ge(t){const e=x.c(18),{showSidebarToggle:s,showOrgSwitcher:a,showDecoChat:n}=t,i=s===void 0?!1:s,l=a===void 0?!1:a,r=n===void 0?!1:n,[,c]=ce();let d;e[0]!==c?(d=()=>c(Wn),e[0]=c,e[1]=d):d=e[1];const u=d;let m;e[2]!==i?(m=i&&o.jsx(te.Sidebar,{children:o.jsx(Je,{})}),e[2]=i,e[3]=m):m=e[3];let f;e[4]!==l?(f=l&&o.jsx(w.Suspense,{fallback:o.jsx(le.Skeleton,{}),children:o.jsx(le,{})}),e[4]=l,e[5]=f):f=e[5];let p;e[6]!==f?(p=o.jsx(te.Left,{children:f}),e[6]=f,e[7]=p):p=e[7];let h;e[8]!==r||e[9]!==u?(h=r&&o.jsxs(W,{size:"sm",variant:"default",onClick:u,children:[o.jsx(Z,{url:Gn,fallback:"DC",size:"2xs",className:"rounded-sm"}),"deco chat"]}),e[8]=r,e[9]=u,e[10]=h):h=e[10];let v;e[11]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(An,{}),e[11]=v):v=e[11];let g;e[12]!==h?(g=o.jsxs(te.Right,{className:"gap-2",children:[h,v]}),e[12]=h,e[13]=g):g=e[13];let b;return e[14]!==g||e[15]!==m||e[16]!==p?(b=o.jsxs(te,{children:[m,p,g]}),e[14]=g,e[15]=m,e[16]=p,e[17]=b):b=e[17],b}function Wn(t){return!t}function Vn(t){const e=x.c(10),{children:s,className:a}=t,[,n]=w.useTransition();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=X.decoChatPanelWidth(),e[0]=i):i=e[0];const[l,r]=Y(i,30);let c;e[1]!==r?(c=f=>n(()=>r(f)),e[1]=r,e[2]=c):c=e[2];const d=c;let u;e[3]!==a?(u=$("min-w-0",a),e[3]=a,e[4]=u):u=e[4];let m;return e[5]!==l||e[6]!==s||e[7]!==d||e[8]!==u?(m=o.jsx(we,{defaultSize:l,minSize:20,className:u,onResize:d,children:s}),e[5]=l,e[6]=s,e[7]=d,e[8]=u,e[9]=m):m=e[9],m}function Fn(t){const e=x.c(5),{children:s}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=X.sidebarOpen(),e[0]=a):a=e[0];const[n,i]=Y(a,!0);let l;return e[1]!==s||e[2]!==i||e[3]!==n?(l=o.jsx(Hs,{open:n,onOpenChange:i,children:s}),e[1]=s,e[2]=i,e[3]=n,e[4]=l):l=e[4],l}function Kn(){const t=x.c(9),[e]=ce();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(we,{className:"bg-background",children:o.jsx(je,{})}),t[0]=s):s=t[0];let a;t[1]!==e?(a=o.jsx(qt,{withHandle:e}),t[1]=e,t[2]=a):a=t[2];const n=e?"max-w-none":"max-w-0";let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(re,{children:o.jsx(w.Suspense,{fallback:o.jsx(Qt,{}),children:o.jsx(_s,{})})}),t[3]=i):i=t[3];let l;t[4]!==n?(l=o.jsx(Vn,{className:n,children:i}),t[4]=n,t[5]=l):l=t[5];let r;return t[6]!==a||t[7]!==l?(r=o.jsxs(Xt,{direction:"horizontal",children:[s,a,l]}),t[6]=a,t[7]=l,t[8]=r):r=t[8],r}function Yn(){const t=x.c(19);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const{org:s}=be(e);let a;t[1]!==s?(a=St.activeOrganization(s),t[1]=s,t[2]=a):a=t[2];let n;t[3]!==s?(n=async()=>{if(!s)return null;const{data:p}=await Q.organization.setActive({organizationSlug:s});return{org:p,project:{slug:Dt}}},t[3]=s,t[4]=n):n=t[4];let i;t[5]!==a||t[6]!==n?(i={queryKey:a,queryFn:n,gcTime:1/0,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnMount:!1},t[5]=a,t[6]=n,t[7]=i):i=t[7];const{data:l}=wt(i);if(!l){let p;t[8]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(ge,{}),t[8]=p):p=t[8];let h;return t[9]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsxs("div",{className:"min-h-screen bg-background",children:[p,o.jsx("div",{className:"pt-12",children:o.jsx(je,{})})]}),t[9]=h):h=t[9],h}let r;t[10]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(ge,{showSidebarToggle:!0,showOrgSwitcher:!0,showDecoChat:!0}),t[10]=r):r=t[10];let c;t[11]===Symbol.for("react.memo_cache_sentinel")?(c={"--sidebar-width":"13rem","--sidebar-width-mobile":"11rem"},t[11]=c):c=t[11];let d;t[12]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(an,{}),t[12]=d):d=t[12];let u;t[13]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Fn,{children:o.jsxs("div",{className:"flex flex-col h-screen",children:[r,o.jsxs(Gs,{className:"flex-1 bg-sidebar",style:c,children:[d,o.jsx(Vs,{className:"pt-12",children:o.jsx(Kn,{})})]})]})}),t[13]=u):u=t[13];let m;t[14]!==l.org.slug?(m=o.jsx(ps,{children:u},l.org.slug),t[14]=l.org.slug,t[15]=m):m=t[15];let f;return t[16]!==l||t[17]!==m?(f=o.jsx(Ot,{...l,children:m}),t[16]=l,t[17]=m,t[18]=f):f=t[18],f}function Pa(){const t=x.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(Pn,{children:o.jsx(w.Suspense,{fallback:o.jsx(ve,{}),children:o.jsx(Yn,{})})}),t[0]=e):e=t[0],e}export{Pa as default};
@@ -1 +1 @@
1
- import{c as C,h as d,j as a}from"./index-CCNaUj2A.js";import{c as m}from"./utils-o1atviYh.js";const u=d("animate-spin",{variants:{variant:{default:"fill-primary text-gray-200",destructive:"fill-destructive text-gray-200",secondary:"fill-secondary text-gray-200",special:"fill-special text-backround"},size:{default:"h-7 w-7",sm:"h-6 w-6",lg:"h-8 w-8",icon:"h-6 w-6",xs:"h-4 w-4"}},defaultVariants:{variant:"default",size:"default"}});function p(f){const e=C.c(10),{variant:c,size:o}=f;let t;e[0]!==o||e[1]!==c?(t=m(u({variant:c,size:o})),e[0]=o,e[1]=c,e[2]=t):t=e[2];let l,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=a.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i=a.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"}),e[3]=l,e[4]=i):(l=e[3],i=e[4]);let s;e[5]!==t?(s=a.jsxs("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l,i]}),e[5]=t,e[6]=s):s=e[6];let r;e[7]===Symbol.for("react.memo_cache_sentinel")?(r=a.jsx("span",{className:"sr-only",children:"Loading..."}),e[7]=r):r=e[7];let n;return e[8]!==s?(n=a.jsxs("div",{role:"status",children:[s,r]}),e[8]=s,e[9]=n):n=e[9],n}export{p as S};
1
+ import{c as C,h as d,j as a}from"./index-A52jfksK.js";import{c as m}from"./utils-DgLfrg3u.js";const u=d("animate-spin",{variants:{variant:{default:"fill-primary text-gray-200",destructive:"fill-destructive text-gray-200",secondary:"fill-secondary text-gray-200",special:"fill-special text-backround"},size:{default:"h-7 w-7",sm:"h-6 w-6",lg:"h-8 w-8",icon:"h-6 w-6",xs:"h-4 w-4"}},defaultVariants:{variant:"default",size:"default"}});function p(f){const e=C.c(10),{variant:c,size:o}=f;let t;e[0]!==o||e[1]!==c?(t=m(u({variant:c,size:o})),e[0]=o,e[1]=c,e[2]=t):t=e[2];let l,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=a.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i=a.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"}),e[3]=l,e[4]=i):(l=e[3],i=e[4]);let s;e[5]!==t?(s=a.jsxs("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l,i]}),e[5]=t,e[6]=s):s=e[6];let r;e[7]===Symbol.for("react.memo_cache_sentinel")?(r=a.jsx("span",{className:"sr-only",children:"Loading..."}),e[7]=r):r=e[7];let n;return e[8]!==s?(n=a.jsxs("div",{role:"status",children:[s,r]}),e[8]=s,e[9]=n):n=e[9],n}export{p as S};
@@ -0,0 +1 @@
1
+ import{ap as H,aq as D,ar as q,as as G,at as Y,au as Z,r as T,c as A,j as s,f as _,K as J,a as X,e as ee,q as te}from"./index-A52jfksK.js";import{i as se,g as ie,a as le}from"./well-known-mcp-BPQQU1v0.js";import{C as re}from"./collection-header-DcpyPzrC.js";import{I as ne,b as ae,c as oe,a as W,u as ce}from"./use-connection-BX5-4xHw.js";import{b as de,T as me,c as fe,u as z}from"./tooltip-BjhP6ibY.js";import{s as ue}from"./slugify-CEUa2lfQ.js";import{n as he}from"./Inbox01-DCkU3Xgq.js";import{i as Q}from"./Loading01-r04aEG5T.js";import{i as xe,E as pe}from"./SearchMd-1Gq7nypQ.js";import{C as ge}from"./collection-search-DVBnlN6E.js";import{C as ve}from"./card-BHz-BqEu.js";import{g as je,f as Ne,a as ye}from"./registry-utils-ulDDT0d8.js";import{e as Ce}from"./app-name-gTETL9So.js";import{d as we,a as Se,b as be,c as Pe,S as Re}from"./select-Be0LRVWn.js";import{s as Ie}from"./Plus-CS_Y2Vnc.js";import{B}from"./button-DodNLkpL.js";import{a as ke}from"./use-binding-CapMpNVF.js";import{L as Ee,u as Le}from"./localstorage-keys-D7pZSS7H.js";import"./collection-display-button-475jHotV.js";import"./dropdown-menu-DrQKdl4f.js";import"./utils-DgLfrg3u.js";import"./view-mode-toggle-DAXMt6ZW.js";import"./input-BXHWk19m.js";import"./ChevronDown-g4L12M9A.js";import"./auth-AUS48lXs.js";import"./useQuery-ojqdZMTH.js";var Me=class extends H{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:D()})}getOptimisticResult(t){return t.behavior=D(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,e){const{state:l}=t,f=super.createResult(t,e),{isFetching:o,isRefetching:h,isError:a,isRefetchError:c}=f,r=l.fetchMeta?.fetchMore?.direction,i=a&&r==="forward",n=o&&r==="forward",d=a&&r==="backward",x=o&&r==="backward";return{...f,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:G(e,l.data),hasPreviousPage:q(e,l.data),isFetchNextPageError:i,isFetchingNextPage:n,isFetchPreviousPageError:d,isFetchingPreviousPage:x,isRefetchError:c&&!i&&!d,isRefetching:h&&!n&&!x}}};function Te(t,e){return Y({...t,enabled:!0,suspense:!0,throwOnError:Z},Me,e)}const U=({size:t=24,color:e="currentColor",...l})=>T.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...l},T.createElement("path",{d:"m9 12 2 2 4.5-4.5m2.401-4.501a2.03 2.03 0 0 0 1.1 1.1l1.744.723a2.033 2.033 0 0 1 1.1 2.656l-.722 1.744a2.03 2.03 0 0 0 0 1.556l.722 1.744a2.033 2.033 0 0 1-1.1 2.656L19 17.901A2.033 2.033 0 0 0 17.9 19l-.723 1.745a2.032 2.032 0 0 1-2.656 1.1l-1.744-.722a2.032 2.032 0 0 0-1.555 0l-1.745.723a2.033 2.033 0 0 1-2.654-1.1L6.1 19.001A2.033 2.033 0 0 0 5 17.9l-1.744-.723a2.033 2.033 0 0 1-1.1-2.654l.721-1.744a2.033 2.033 0 0 0 0-1.556l-.722-1.746a2.033 2.033 0 0 1 1.1-2.657L5 6.098A2.03 2.03 0 0 0 6.1 5l.723-1.745a2.033 2.033 0 0 1 2.656-1.1l1.744.722a2.033 2.033 0 0 0 1.555-.001l1.746-.72a2.032 2.032 0 0 1 2.655 1.1l.723 1.746v-.003Z"}));U.displayName="CheckVerified02";function Ae(t){const e=t.title||t.server.title||t.id||"Unnamed Item",l=t.server.description||null,f=t.server.icons?.[0]?.src||je(t.server.repository)||null,o=t._meta?.["mcp.mesh"]?.verified??!1,h=t.server.version,c=(t.server.remotes?.length??0)>0;let r=e,i=null;if(e.includes("/")){const n=e.split("/");n.length>=2&&(i=n[0]||null,r=Ce(e))}if(!i){const n=t._meta?.["mcp.mesh"]?.scopeName,d=t._meta?.["mcp.mesh"]?.appName;n&&d?i=`${n}/${d}`:n&&(i=n)}return{icon:f,scopeName:i,displayName:r,description:l,version:h||null,isVerified:o,canInstall:c}}function Ke(t){const e=A.c(39),{icon:l,scopeName:f,displayName:o,description:h,isVerified:a,canInstall:c,onClick:r}=t;let i;e[0]!==o||e[1]!==l?(i=s.jsx(ne,{icon:l,name:o,size:"md",className:"shadow-sm"}),e[0]=o,e[1]=l,e[2]=i):i=e[2];let n;e[3]!==o?(n=s.jsx("span",{className:"truncate",children:o}),e[3]=o,e[4]=n):n=e[4];let d;e[5]!==a?(d=a&&s.jsx(U,{size:16,className:"text-success shrink-0"}),e[5]=a,e[6]=d):d=e[6];let x;e[7]!==c?(x=!c&&s.jsx(se,{size:16,className:"text-muted-foreground shrink-0"}),e[7]=c,e[8]=x):x=e[8];let v;e[9]!==n||e[10]!==d||e[11]!==x?(v=s.jsx(de,{asChild:!0,children:s.jsxs("div",{className:"flex items-center gap-2 text-base font-medium min-w-0",children:[n,d,x]})}),e[9]=n,e[10]=d,e[11]=x,e[12]=v):v=e[12];let m;e[13]!==o?(m=s.jsx("p",{children:o}),e[13]=o,e[14]=m):m=e[14];let p;e[15]!==c?(p=!c&&s.jsx("p",{className:"text-xs mt-1",children:"No connection available"}),e[15]=c,e[16]=p):p=e[16];let g;e[17]!==m||e[18]!==p?(g=s.jsxs(me,{children:[m,p]}),e[17]=m,e[18]=p,e[19]=g):g=e[19];let y;e[20]!==v||e[21]!==g?(y=s.jsxs(fe,{children:[v,g]}),e[20]=v,e[21]=g,e[22]=y):y=e[22];let C;e[23]!==f?(C=f&&s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:f}),e[23]=f,e[24]=C):C=e[24];let b;e[25]!==C||e[26]!==y?(b=s.jsx("div",{className:"flex gap-2 items-start min-w-0 flex-1",children:s.jsxs("div",{className:"min-w-0 flex-1",children:[y,C]})}),e[25]=C,e[26]=y,e[27]=b):b=e[27];let w;e[28]!==i||e[29]!==b?(w=s.jsxs("div",{className:"flex gap-3",children:[i,b]}),e[28]=i,e[29]=b,e[30]=w):w=e[30];const P=h||"No description available";let j;e[31]!==P?(j=s.jsx("div",{className:"grid grid-cols-1 gap-1 min-w-0",children:s.jsx("div",{className:"text-sm text-muted-foreground line-clamp-2",children:P})}),e[31]=P,e[32]=j):j=e[32];let u;e[33]!==w||e[34]!==j?(u=s.jsxs("div",{className:"flex flex-col gap-4 h-full relative",children:[w,j]}),e[33]=w,e[34]=j,e[35]=u):u=e[35];let S;return e[36]!==r||e[37]!==u?(S=s.jsx(ve,{className:"p-6 cursor-pointer hover:bg-muted/50 transition-colors",onClick:r,children:u}),e[36]=r,e[37]=u,e[38]=S):S=e[38],S}function V(t){const e=A.c(12),{items:l,title:f,onItemClick:o}=t;if(l.length===0)return null;let h;e[0]!==f?(h=f&&s.jsx("div",{className:"flex items-center justify-between w-max gap-2",children:s.jsx("h2",{className:"text-lg font-medium",children:f})}),e[0]=f,e[1]=h):h=e[1];let a;if(e[2]!==l||e[3]!==o){let i;e[5]!==o?(i=n=>{const d=Ae(n);return s.jsx(Ke,{...d,onClick:()=>o(n)},n.id)},e[5]=o,e[6]=i):i=e[6],a=l.map(i),e[2]=l,e[3]=o,e[4]=a}else a=e[4];let c;e[7]!==a?(c=s.jsx("div",{className:"grid grid-cols-4 gap-4",children:a}),e[7]=a,e[8]=c):c=e[8];let r;return e[9]!==h||e[10]!==c?(r=s.jsxs("div",{className:"flex flex-col gap-4",children:[h,c]}),e[9]=h,e[10]=c,e[11]=r):r=e[11],r}function $e(t,e){if(!e)return t;const l=e.toLowerCase();return t.filter(f=>(f.name||f.title||"").toLowerCase().includes(l)||(f.description||f.server.description||"").toLowerCase().includes(l))}function Oe(t){return t.verified===!0||t._meta?.["mcp.mesh"]?.verified===!0||t.server._meta?.["mcp.mesh"]?.verified===!0}function Fe(t){const e=A.c(32),{items:l,isLoadingMore:f,registryId:o,hasMore:h,onLoadMore:a}=t,c=f===void 0?!1:f,r=h===void 0?!1:h,[i,n]=T.useState(""),d=_(),{org:x}=z(),v=T.useRef(null);let m,p,g;e[0]!==l||e[1]!==i?(m=$e(l,i),g=m.filter(Oe),p=m.filter(R=>!g.find(I=>I.id===R.id)),e[0]=l,e[1]=i,e[2]=m,e[3]=p,e[4]=g):(m=e[2],p=e[3],g=e[4]);const y=p;let C;e[5]!==d||e[6]!==x.slug||e[7]!==o?(C=R=>{const I=ue(R.name||R.title||R.server.title||""),L=R.server.name;d({to:"/$org/store/$appName",params:{org:x.slug,appName:I},search:{registryId:o,serverName:L}})},e[5]=d,e[6]=x.slug,e[7]=o,e[8]=C):C=e[8];const b=C;let w;e[9]!==r||e[10]!==c||e[11]!==a||e[12]!==i?(w=R=>{if(!r||!a||i||c)return;const I=R.currentTarget;I.scrollHeight-I.scrollTop-I.clientHeight<200&&a()},e[9]=r,e[10]=c,e[11]=a,e[12]=i,e[13]=w):w=e[13];const P=w;let j;e[14]===Symbol.for("react.memo_cache_sentinel")?(j=R=>{R.key==="Enter"&&n(R.currentTarget.value)},e[14]=j):j=e[14];let u;e[15]!==i?(u=s.jsx(ge,{value:i,onChange:n,placeholder:"Search for an MCP Server...",onKeyDown:j}),e[15]=i,e[16]=u):u=e[16];let S;e[17]!==y||e[18]!==m||e[19]!==b||e[20]!==r||e[21]!==c||e[22]!==l.length||e[23]!==i||e[24]!==g?(S=s.jsx("div",{className:"p-5",children:s.jsx("div",{children:l.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(he,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No items available"}),s.jsx("p",{className:"text-muted-foreground",children:"This store doesn't have any available items yet."})]}):i&&m.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(xe,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"No results found"}),s.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your search terms."})]}):s.jsxs("div",{className:"flex flex-col gap-8",children:[g.length>0&&s.jsx(V,{items:g,title:"Verified",onItemClick:b}),y.length>0&&s.jsx(V,{items:y,title:g.length>0?"All":"",onItemClick:b}),r&&!i&&c&&s.jsx("div",{className:"flex justify-center py-8",children:s.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[s.jsx(Q,{size:20,className:"animate-spin"}),s.jsx("span",{className:"text-sm",children:"Loading more items..."})]})})]})})}),e[17]=y,e[18]=m,e[19]=b,e[20]=r,e[21]=c,e[22]=l.length,e[23]=i,e[24]=g,e[25]=S):S=e[25];let k;e[26]!==P||e[27]!==S?(k=s.jsx("div",{ref:v,className:"flex-1 overflow-y-auto",onScroll:P,children:S}),e[26]=P,e[27]=S,e[28]=k):k=e[28];let E;return e[29]!==u||e[30]!==k?(E=s.jsxs("div",{className:"flex flex-col h-full",children:[u,k]}),e[29]=u,e[30]=k,e[31]=E):E=e[31],E}const F=24;function ze(t){const e=A.c(27),{registryId:l}=t,f=ae(l);let o,h,a,c;if(e[0]!==f?.tools||e[1]!==l){if(o=Ne(f?.tools),!o)throw new Error("This registry does not support listing store items.");let u;e[6]!==l?(u=oe(l),e[6]=l,e[7]=u):u=e[7],c=u,a=Te,h=J.toolCall(l,o,JSON.stringify({limit:F})),e[0]=f?.tools,e[1]=l,e[2]=o,e[3]=h,e[4]=a,e[5]=c}else o=e[2],h=e[3],a=e[4],c=e[5];let r;e[8]!==o||e[9]!==c?(r=async u=>{const{pageParam:S}=u;return await c(o,S?{cursor:S,limit:F}:{limit:F})},e[8]=o,e[9]=c,e[10]=r):r=e[10];let i;e[11]!==h||e[12]!==r?(i={queryKey:h,queryFn:r,initialPageParam:void 0,getNextPageParam:De,staleTime:36e5},e[11]=h,e[12]=r,e[13]=i):i=e[13];const{data:n,fetchNextPage:d,hasNextPage:x,isFetchingNextPage:v}=a(i);let m;e:{if(!n?.pages||n.pages.length===0){m=null;break e}const u=n.pages[0];if(typeof u=="object"&&u!==null&&"totalCount"in u&&typeof u.totalCount=="number"){m=u.totalCount;break e}m=null}const p=m,g=n?.pages;let y;e[14]!==g?(y=ye(g),e[14]=g,e[15]=y):y=e[15];const C=y;let b;e[16]!==d||e[17]!==x||e[18]!==v?(b=()=>{x&&!v&&d()},e[16]=d,e[17]=x,e[18]=v,e[19]=b):b=e[19];const w=b,P=x??!1;let j;return e[20]!==C||e[21]!==w||e[22]!==v||e[23]!==l||e[24]!==P||e[25]!==p?(j=s.jsx(Fe,{items:C,isLoadingMore:v,registryId:l,hasMore:P,onLoadMore:w,totalCount:p}),e[20]=C,e[21]=w,e[22]=v,e[23]=l,e[24]=P,e[25]=p,e[26]=j):j=e[26],j}function De(t){if(typeof t=="object"&&t!==null){const e=t.nextCursor||t.cursor;if(e)return e}}function Be(t){const e=A.c(15),{registries:l,value:f,onValueChange:o,onAddWellKnown:h,wellKnownRegistries:a,placeholder:c}=t,r=c===void 0?"Select a registry...":c;let i;e[0]!==r?(i=s.jsx(Se,{className:"w-[200px] h-8!",children:s.jsx(be,{placeholder:r})}),e[0]=r,e[1]=i):i=e[1];let n;e[2]!==l?(n=l.map(Ve),e[2]=l,e[3]=n):n=e[3];let d;e[4]!==h||e[5]!==a?(d=a.length>0&&s.jsxs("div",{className:"border-t border-border pt-1",children:[s.jsx("p",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:"Other known registries"}),a.map(m=>s.jsxs("button",{onClick:p=>{p.preventDefault(),p.stopPropagation(),h(m)},className:"relative flex w-full cursor-pointer items-center gap-2 rounded-xl py-1.5 pr-8 pl-2 text-sm outline-hidden select-none hover:bg-accent hover:text-accent-foreground",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[m.icon?s.jsx("img",{src:m.icon,alt:m.title,className:"w-4 h-4 rounded"}):s.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:m.title.slice(0,1).toUpperCase()}),s.jsx("span",{className:"flex-1",children:m.title})]}),s.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center text-muted-foreground",children:s.jsx(Ie,{size:16})})]},m.id??m.title))]}),e[4]=h,e[5]=a,e[6]=d):d=e[6];let x;e[7]!==n||e[8]!==d?(x=s.jsxs(Pe,{children:[n,d]}),e[7]=n,e[8]=d,e[9]=x):x=e[9];let v;return e[10]!==o||e[11]!==i||e[12]!==x||e[13]!==f?(v=s.jsxs(Re,{value:f,onValueChange:o,children:[i,x]}),e[10]=o,e[11]=i,e[12]=x,e[13]=f,e[14]=v):v=e[14],v}function Ve(t){return s.jsx(we,{className:"cursor-pointer",value:t.id??t.name,children:s.jsxs("div",{className:"flex items-center gap-2",children:[t.icon?s.jsx("img",{src:t.icon,alt:t.name,className:"w-4 h-4 rounded"}):s.jsx("div",{className:"w-4 h-4 rounded from-primary/20 to-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:t.name.slice(0,1).toUpperCase()}),s.jsx("span",{children:t.name})]})},t.id??t.name)}function _e({registries:t,onConnected:e}){const l=W(),{org:{slug:f}}=z(),{data:o}=X.useSession(),h=_(),[a,c]=T.useState(!1),r=t[0],i=async()=>{if(!(!r||!o?.user?.id)){c(!0);try{const d=await l.create.mutateAsync(r);e?.(d.id)}finally{c(!1)}}},n=()=>{h({to:"/$org/mcps",params:{org:f},search:{action:"create"}})};return s.jsx(pe,{image:s.jsx("img",{src:"/store-empty-state.svg",alt:"No store connected",width:336,height:320,className:"max-w-full h-auto"}),title:"Connect to registry",description:"Connect to discover and use MCP Servers from the community.",actions:s.jsxs(s.Fragment,{children:[s.jsxs(B,{variant:"outline",onClick:i,disabled:a||!r,children:[r?.icon&&s.jsx("img",{src:r.icon,alt:"",className:"size-4"}),a?"Installing...":"Install Registry"]}),s.jsx(B,{variant:"outline",onClick:n,children:"Install MCP Server"})]})})}function jt(){const t=A.c(41),{org:e}=z(),l=ce(),f=W(),o=ee(),h=o.location.pathname.includes("/store/")&&o.location.pathname.split("/").length>3,a=ke(l);let c;t[0]!==a?(c=a.map(Ue),t[0]=a,t[1]=c):c=t[1];const r=c;let i;t[2]!==e.slug?(i=Ee.selectedRegistry(e.slug),t[2]=e.slug,t[3]=i):i=t[3];const[n,d]=Le(i,Qe);let x;if(t[4]!==a||t[5]!==n){let N;t[7]!==n?(N=O=>O.id===n,t[7]=n,t[8]=N):N=t[8],x=a.find(N),t[4]=a,t[5]=n,t[6]=x}else x=t[6];const m=x?.id||a[0]?.id||"";let p;t[9]!==e.id?(p=ie(e.id),t[9]=e.id,t[10]=p):p=t[10];let g;t[11]!==p?(g=[p],t[11]=p,t[12]=g):g=t[12];const y=g;let C;t[13]===Symbol.for("react.memo_cache_sentinel")?(C=[le()],t[13]=C):C=t[13];const b=C;let w;t[14]!==f.create||t[15]!==d?(w=async N=>{const O=await f.create.mutateAsync(N);d(O.id)},t[14]=f.create,t[15]=d,t[16]=w):w=t[16];const P=w;let j;t[17]!==a?(j=new Set(a.map(We)),t[17]=a,t[18]=j):j=t[18];const u=j;let S;t[19]!==u||t[20]!==y?(S=y.filter(N=>N.id&&!u.has(N.id)),t[19]=u,t[20]=y,t[21]=S):S=t[21];const k=S;let E;t[22]!==u?(E=b.filter(N=>N.id&&!u.has(N.id)),t[22]=u,t[23]=E):E=t[23];const R=E;if(h){let N;return t[24]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(te,{}),t[24]=N):N=t[24],N}let I;t[25]!==P?(I=async N=>P(N),t[25]=P,t[26]=I):I=t[26];let L;t[27]!==k||t[28]!==m||t[29]!==r||t[30]!==d||t[31]!==I?(L=s.jsx(re,{title:"Store",ctaButton:s.jsx(Be,{wellKnownRegistries:k,registries:r,value:m,onValueChange:d,onAddWellKnown:I,placeholder:"Select store..."})}),t[27]=k,t[28]=m,t[29]=r,t[30]=d,t[31]=I,t[32]=L):L=t[32];let K;t[33]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[s.jsx(Q,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading store items..."})]}),t[33]=K):K=t[33];let M;t[34]!==R||t[35]!==m||t[36]!==d?(M=s.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:s.jsx(T.Suspense,{fallback:K,children:m?s.jsx(ze,{registryId:m}):s.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:s.jsx(_e,{registries:R,onConnected:N=>{d(N)}})})})}),t[34]=R,t[35]=m,t[36]=d,t[37]=M):M=t[37];let $;return t[38]!==L||t[39]!==M?($=s.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[L,M]}),t[38]=L,t[39]=M,t[40]=$):$=t[40],$}function We(t){return t.id}function Qe(){return""}function Ue(t){return{id:t.id,name:t.title,icon:t.icon||void 0}}export{jt as default};
@@ -1 +1 @@
1
- import{r as q,c as _,j as s,f as ve,d as ke,b as Se,a as Ie,t as he}from"./index-CCNaUj2A.js";import{i as _e}from"./AlertCircle-zCOLtXNG.js";import{i as je}from"./Loading01-Dtm2TLlA.js";import{B as ie}from"./button-DuitHSR8.js";import{i as Le}from"./ArrowLeft-b0UM4Vui.js";import{I as ye,a as Ae,u as De,b as Ee,c as Me}from"./use-connection-BbvAiBvg.js";import{i as Ue}from"./CheckCircle-U8-nit8x.js";import{t as Ve}from"./ChevronDown-BFYjmmoG.js";import{s as ge}from"./Plus-DF_I5mml.js";import{b as $e,D as Re,a as Pe,d as ze}from"./dropdown-menu-CPQpNQmn.js";import{n as be}from"./LinkExternal01-CBZhTXC0.js";import{E as Be}from"./SearchMd-C_ak4ze3.js";import{T as Ge,R as Fe}from"./tools-list-BV-qlQqF.js";import{R as Oe}from"./resource-tabs-Dx5v9tHv.js";import{a as He}from"./use-binding-DdwsXkNS.js";import{u as We}from"./use-tool-call-CVPTtLoG.js";import{u as Ke}from"./use-mcp-CWOlOW9q.js";import{u as Ne}from"./tooltip-CqCXb38Z.js";import{e as Ze}from"./extract-connection-data-Bt1_1dQ8.js";import{s as qe}from"./slugify-CEUa2lfQ.js";import{f as Je,e as Qe,b as Xe,c as Ye,g as et}from"./registry-utils-ulDDT0d8.js";import{e as tt}from"./app-name-gTETL9So.js";import{i as st}from"./InfoCircle-ChxTTkMX.js";import"./utils-o1atviYh.js";import"./useQuery-C4GPpw7d.js";import"./File06-DB55FK-Z.js";import"./collection-display-button-DgDdVSTg.js";import"./view-mode-toggle-DOtHoBLN.js";import"./collection-search-OoKPetka.js";import"./input-YU6lpVgW.js";import"./collection-table-wrapper-DEVlTpj8.js";import"./card-DkEpNms8.js";import"./layout-n40g10Oh.js";import"./badge-CgUwfcKq.js";import"./auth-CfgXQhXI.js";import"./generate-id-Dyweu44Y.js";const we=({size:t=24,color:e="currentColor",...o})=>q.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...o},q.createElement("path",{d:"m21 21-3.5-3.5m2.5-6a8.5 8.5 0 1 1-17 0 8.5 8.5 0 0 1 17 0Z"}));we.displayName="SearchLg";function ot(t){const e=_.c(3),{message:o}=t,n=o===void 0?"Loading app details...":o;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(je,{size:48,className:"animate-spin mb-4"}),e[0]=r):r=e[0];let i;return e[1]!==n?(i=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[r,s.jsx("p",{className:"text-sm text-muted-foreground",children:n})]}),e[1]=n,e[2]=i):i=e[2],i}function rt(t){const e=_.c(9),{error:o,onBack:n}=t,r=o instanceof Error?o.message:o;let i,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(_e,{size:48,className:"text-destructive mb-4"}),d=s.jsx("h3",{className:"text-lg font-medium mb-2",children:"Error loading app"}),e[0]=i,e[1]=d):(i=e[0],d=e[1]);let a;e[2]!==r?(a=s.jsx("p",{className:"text-muted-foreground max-w-md text-center",children:r}),e[2]=r,e[3]=a):a=e[3];let l;e[4]!==n?(l=s.jsx("button",{onClick:n,className:"mt-4 px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"Go Back"}),e[4]=n,e[5]=l):l=e[5];let m;return e[6]!==a||e[7]!==l?(m=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[i,d,a,l]}),e[6]=a,e[7]=l,e[8]=m):m=e[8],m}function nt(t){const e=_.c(5),{onBack:o}=t;let n,r,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(we,{size:48,className:"text-muted-foreground mb-4"}),r=s.jsx("h3",{className:"text-lg font-medium mb-2",children:"App not found"}),i=s.jsx("p",{className:"text-muted-foreground max-w-md text-center",children:"The app you're looking for doesn't exist in this store."}),e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let d;return e[3]!==o?(d=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[n,r,i,s.jsx("button",{onClick:o,className:"mt-4 px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"Go Back to Store"})]}),e[3]=o,e[4]=d):d=e[4],d}function it(t){const e=_.c(3),{onBack:o}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Le,{}),e[0]=n):n=e[0];let r;return e[1]!==o?(r=s.jsx("div",{className:"flex items-center h-12 border-b border-border shrink-0",children:s.jsx("div",{className:"flex h-full px-2 border-r items-center",children:s.jsx(ie,{variant:"ghost",size:"icon",className:"items-center size-8 text-muted-foreground",onClick:o,"aria-label":"Go back",children:n})})}),e[1]=o,e[2]=r):r=e[2],r}function lt(t){const e=_.c(25),{data:o,itemVersions:n,onInstall:r,canInstall:i,isInstalling:d}=t,a=i===void 0?!0:i,l=d===void 0?!1:d,[m,p]=q.useState(0);let x;e[0]!==r?(x=S=>{p(S),r(S)},e[0]=r,e[1]=x):x=e[1];const f=x;let h;e[2]!==o.icon||e[3]!==o.name?(h=s.jsx(ye,{icon:o.icon,name:o.name,size:"lg",className:"shrink-0 shadow-sm"}),e[2]=o.icon,e[3]=o.name,e[4]=h):h=e[4];let g;e[5]!==o.name?(g=s.jsx("h1",{className:"text-3xl font-medium",children:o.name}),e[5]=o.name,e[6]=g):g=e[6];let b;e[7]!==o.verified?(b=o.verified&&s.jsx("img",{src:"/verified-badge.svg",alt:"Verified",className:"w-5 h-5 shrink-0"}),e[7]=o.verified,e[8]=b):b=e[8];let y;e[9]!==g||e[10]!==b?(y=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsxs("div",{className:"flex items-center gap-2",children:[g,b]})}),e[9]=g,e[10]=b,e[11]=y):y=e[11];let N;e[12]!==a||e[13]!==f||e[14]!==l||e[15]!==n||e[16]!==r||e[17]!==m?(N=a?s.jsx("div",{className:"shrink-0",children:n.length>1?s.jsxs("div",{className:"flex",children:[s.jsxs(ie,{variant:"brand",onClick:()=>f(0),disabled:l,className:"shrink-0 rounded-r-none cursor-pointer",children:[s.jsx(ge,{size:20}),l?"Connecting...":"Connect MCP Server"]}),s.jsxs($e,{children:[s.jsx(Re,{asChild:!0,children:s.jsx(ie,{variant:"brand",disabled:l,className:"shrink-0 rounded-l-none px-2 border-l-2 border-l-white/50 cursor-pointer",children:s.jsx(Ve,{size:20})})}),s.jsx(Pe,{align:"end",className:"w-56 max-h-[300px] overflow-y-auto",children:n.map((S,C)=>{const I=S._meta?.["io.modelcontextprotocol.registry/official"];return s.jsx(ze,{onClick:()=>f(C),disabled:l,className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center justify-between gap-2 w-full",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"font-medium text-sm",children:["v",S.server?.version||"unknown"]}),I?.isLatest&&s.jsx("div",{className:"text-xs text-muted-foreground/50 font-semibold",children:"LATEST"})]}),C===m&&s.jsx(Ue,{size:16,className:"text-muted-foreground shrink-0"})]})},C)})})]})]}):s.jsxs(ie,{variant:"brand",onClick:()=>r(),disabled:n.length===0||l,className:"shrink-0",children:[s.jsx(ge,{size:20}),l?"Connecting...":"Connect MCP Server"]})}):s.jsx("div",{className:"shrink-0 px-4 py-2 text-sm text-muted-foreground bg-muted rounded-lg",children:"Cannot be connected"}),e[12]=a,e[13]=f,e[14]=l,e[15]=n,e[16]=r,e[17]=m,e[18]=N):N=e[18];let w;e[19]!==y||e[20]!==N?(w=s.jsxs("div",{className:"flex-1 min-w-0 flex items-center justify-between",children:[y,N]}),e[19]=y,e[20]=N,e[21]=w):w=e[21];let k;return e[22]!==h||e[23]!==w?(k=s.jsxs("div",{className:"flex items-center gap-4 py-8 px-5 border-b border-border",children:[h,w]}),e[22]=h,e[23]=w,e[24]=k):k=e[24],k}function at(t){if(!t)return"—";try{const e=new Date(t);return isNaN(e.getTime())?"—":e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return"—"}}function ct(t){const e=_.c(45),{data:o,publisherInfo:n,selectedItem:r}=t;let i;e[0]!==o.description?(i=o.description&&s.jsxs("div",{className:"px-5 pb-5 border-b border-border",children:[s.jsx("h2",{className:"text-base font-medium mb-3",children:"Overview"}),s.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:o.description})]}),e[0]=o.description,e[1]=i):i=e[1];const d=o.publisher==="io.modelcontextprotocol.registry/official"?"Official Registry":o.publisher;let a;e[2]!==n.logo||e[3]!==d?(a=s.jsx(ye,{icon:n.logo,name:d,size:"sm",className:"shrink-0 shadow-sm"}),e[2]=n.logo,e[3]=d,e[4]=a):a=e[4];let l;e[5]!==o.publisher?(l=o.publisher==="io.modelcontextprotocol.registry/official"?"Official Registry":o.publisher.charAt(0).toUpperCase()+o.publisher.slice(1),e[5]=o.publisher,e[6]=l):l=e[6];let m;e[7]!==l?(m=s.jsx("div",{className:"font-medium",children:l}),e[7]=l,e[8]=m):m=e[8];let p;e[9]!==n.count?(p=n.count>0?s.jsxs(s.Fragment,{children:[s.jsx("img",{src:"/globe.svg",alt:"globe",className:"w-3 h-3"}),s.jsxs("span",{children:[n.count," ",n.count===1?"published app":"published apps"]})]}):"Publisher",e[9]=n.count,e[10]=p):p=e[10];let x;e[11]!==p?(x=s.jsx("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:p}),e[11]=p,e[12]=x):x=e[12];let f;e[13]!==m||e[14]!==x?(f=s.jsxs("div",{children:[m,x]}),e[13]=m,e[14]=x,e[15]=f):f=e[15];let h;e[16]!==a||e[17]!==f?(h=s.jsx("div",{className:"px-5 border-b border-border",children:s.jsxs("div",{className:"flex items-center gap-3 py-5",children:[a,f]})}),e[16]=a,e[17]=f,e[18]=h):h=e[18];let g;e[19]!==o.version?(g=o.version&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Version"}),s.jsxs("span",{className:"text-muted-foreground uppercase text-xs",children:["v",o.version]})]}),e[19]=o.version,e[20]=g):g=e[20];let b;e[21]!==o.connectionType?(b=o.connectionType&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Connection Type"}),s.jsx("span",{className:"text-muted-foreground uppercase text-xs",children:o.connectionType})]}),e[21]=o.connectionType,e[22]=b):b=e[22];let y;e[23]!==o.schemaVersion?(y=o.schemaVersion&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Schema Version"}),s.jsx("span",{className:"text-muted-foreground text-xs",children:o.schemaVersion})]}),e[23]=o.schemaVersion,e[24]=y):y=e[24];let N;e[25]!==o.websiteUrl?(N=o.websiteUrl&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Website"}),s.jsxs("a",{href:o.websiteUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:underline flex items-center gap-1 text-xs",children:[s.jsx("span",{children:"Visit"}),s.jsx(be,{size:14})]})]}),e[25]=o.websiteUrl,e[26]=N):N=e[26];let w;e[27]!==o.repository?(w=o.repository?.url&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Source"}),s.jsxs("a",{href:o.repository.url,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:underline flex items-center gap-1 text-xs",children:[s.jsx("span",{children:"GitHub"}),s.jsx(be,{size:14})]})]}),e[27]=o.repository,e[28]=w):w=e[28];let k;e[29]!==g||e[30]!==b||e[31]!==y||e[32]!==N||e[33]!==w?(k=s.jsxs("div",{className:"px-5 py-5 border-b border-border space-y-4",children:[g,b,y,N,w]}),e[29]=g,e[30]=b,e[31]=y,e[32]=N,e[33]=w,e[34]=k):k=e[34];let S;e[35]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("span",{className:"text-foreground text-sm",children:"Last Updated"}),e[35]=S):S=e[35];let C;e[36]!==r.updated_at?(C=at(r.updated_at),e[36]=r.updated_at,e[37]=C):C=e[37];let I;e[38]!==C?(I=s.jsxs("div",{className:"px-5 py-5 text-sm flex justify-between items-center border-b border-border",children:[S,s.jsx("span",{className:"text-muted-foreground uppercase text-xs",children:C})]}),e[38]=C,e[39]=I):I=e[39];let u;return e[40]!==i||e[41]!==k||e[42]!==I||e[43]!==h?(u=s.jsxs("div",{className:"lg:col-span-1 flex flex-col pt-5",children:[i,h,k,I]}),e[40]=i,e[41]=k,e[42]=I,e[43]=h,e[44]=u):u=e[44],u}function dt(t){const e=_.c(18),{data:o,availableTabs:n,effectiveActiveTabId:r,effectiveTools:i,isLoadingTools:d,onTabChange:a}=t,l=d===void 0?!1:d;let m;e[0]!==i?(m=i.map(mt),e[0]=i,e[1]=m):m=e[1];const p=m;let x;e[2]!==n||e[3]!==r||e[4]!==a?(x=n.length>0&&s.jsx("div",{className:"px-4 py-2 border-b border-border bg-background",children:s.jsx(Oe,{tabs:n,activeTab:r,onTabChange:a})}),e[2]=n,e[3]=r,e[4]=a,e[5]=x):x=e[5];let f;e[6]!==r||e[7]!==i.length||e[8]!==l||e[9]!==p?(f=r==="tools"&&s.jsx("div",{className:"flex flex-col flex-1",children:l?s.jsxs("div",{className:"flex items-center justify-center p-8",children:[s.jsx(je,{size:24,className:"animate-spin"}),s.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading tools..."})]}):i.length>0?s.jsx(Ge,{tools:p,showToolbar:!1,emptyMessage:"This app doesn't have any tools."}):s.jsx(Be,{image:null,title:"No tools available",description:"This app doesn't have any tools."})}),e[6]=r,e[7]=i.length,e[8]=l,e[9]=p,e[10]=f):f=e[10];let h;e[11]!==o?.repository||e[12]!==r?(h=r==="readme"&&s.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:s.jsx(Fe,{repository:o?.repository})}),e[11]=o?.repository,e[12]=r,e[13]=h):h=e[13];let g;return e[14]!==x||e[15]!==f||e[16]!==h?(g=s.jsxs("div",{className:"lg:col-span-2 flex flex-col border-l border-border",children:[x,f,h]}),e[14]=x,e[15]=f,e[16]=h,e[17]=g):g=e[17],g}function mt(t){const e=t;return{name:e.name||"",description:e.description||void 0}}function ft(t,e){if(!t||!e)return;const o=e.toLowerCase();return t.find(n=>n.app_name?.toLowerCase()===o||n.app_id?.toLowerCase()===o||n.title.toLowerCase()===o)||t.find(n=>n.title.toLowerCase().includes(o))}function ut(t,e,o,n,r){if(!e||e==="Unknown")return{count:0};if(e==="io.modelcontextprotocol.registry/official")return{logo:n?.icon||void 0,count:r??t.length};const i=e.toLowerCase(),d=t.filter(l=>(l._meta?.["io.modelcontextprotocol.registry/official"]?"io.modelcontextprotocol.registry/official":l.publisher||l._meta?.["mcp.mesh"]?.scopeName||"Unknown").toLowerCase()===i);return{logo:o?.icon||d[0]?.publisher_logo||d[0]?.icon||void 0,count:d.length}}function pt(t){const e=t.server._meta?.["mcp.mesh/publisher-provided"],o=t._meta?.["mcp.mesh"],n=t._meta?.["io.modelcontextprotocol.registry/official"],r=t.server,i=Xe(r.remotes?.[0]?.type),d=Ye(r.$schema),a=n?"io.modelcontextprotocol.registry/official":t.publisher||o?.scopeName||"Unknown",l=et(r.repository),m=t.icon||t.image||t.logo||r.icons?.[0]?.src||l||null,p=t.name||t.title||t.server?.title||"Unnamed Item";return{name:tt(p),description:t.description||t.summary||t.server?.description||"",icon:m,verified:t.verified||o?.verified,publisher:a,version:r.version||null,websiteUrl:r.websiteUrl||null,repository:r.repository||null,schemaVersion:d??null,connectionType:i,connectionUrl:null,remoteUrl:null,tools:t.tools||r.tools||e?.tools||[],models:t.models||r.models||e?.models||[],emails:t.emails||r.emails||e?.emails||[],analytics:t.analytics||r.analytics||e?.analytics,cdn:t.cdn||r.cdn||e?.cdn}}class xt extends q.Component{state={hasError:!1,error:null};static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,o){console.error("Store app detail error:",e,o)}render(){return this.state.hasError?s.jsx(rt,{error:this.state.error||new Error("Unknown error"),onBack:this.props.onBack}):this.props.children}}function ht(){const t=_.c(70),{org:e}=Ne(),o=ve();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const{appName:r}=ke(n);let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},t[1]=i):i=t[1];const{registryId:d,serverName:a}=Se(i),[l,m]=q.useState("readme"),p=Ae(),x=De(),{data:f}=Ie.useSession(),h=He(x),g=d||h[0]?.id||"",b=Ee(g),y=Je(b?.tools),N=b?.tools&&b.tools.find(yt)?.name||"",w=b?.tools&&b.tools.find(jt)?.name||"",k=Me(g),S=!!a;let C,I;S?(C=N||w,I={name:a}):(C=y,I={});const{data:u}=We({toolCaller:k,toolName:C,toolInputParams:I,scope:g});let E=[],L=[],pe=null;if(u){if(Array.isArray(u))E=u;else if(typeof u=="object"&&u!==null)if("totalCount"in u&&typeof u.totalCount=="number"&&(pe=u.totalCount),"item"in u&&u.item){const c=u.item,T=c.id||"",M=c.server,U=c._meta;let D;t[2]!==c.title||t[3]!==T||t[4]!==M||t[5]!==U?(D=[{id:T,title:c.title,server:M,_meta:U}],t[2]=c.title,t[3]=T,t[4]=M,t[5]=U,t[6]=D):D=t[6],E=D}else{let c;"versions"in u&&Array.isArray(u.versions)?c="versions":"servers"in u&&Array.isArray(u.servers)?c="servers":c=Object.keys(u).find(T=>Array.isArray(u[T])),c&&(E=u[c],(c==="versions"||C?.includes("VERSIONS"))&&(L=E))}}let X;t[7]!==r?(X=c=>{const T=c.name||c.title||c.server.title||"";return qe(T)===r},t[7]=r,t[8]=X):X=t[8];let j=E.find(X);if(!j&&a){let c;t[9]!==a?(c=T=>T.server.name===a||T.name===a||T.title===a,t[9]=a,t[10]=c):c=t[10],j=E.find(c)}const v=j?pt(j):null,le=(v?.tools?.length||0)>0,ae=j?.server?.remotes?.[0]?.url||null,J=!le&&!!ae,Q=Ke({url:J?ae:""}),Y=J&&Q.state==="connecting";let ee;t[11]!==Q||t[12]!==J?(ee=J&&Q.state==="ready"?(Q.tools||[]).map(vt):[],t[11]=Q,t[12]=J,t[13]=ee):ee=t[13];const xe=ee,V=le?v?.tools||[]:xe,Ce=ft(x,v?.publisher),ce=v?ut(E,v.publisher,Ce,b??null,pe):{count:0},Te=v?.repository?Qe(v.repository):null,de=!!v?.repository&&!!Te;let $;t[14]!==de?($={id:"readme",label:"README",visible:de},t[14]=de,t[15]=$):$=t[15];const me=le||xe.length>0||Y&&!!ae;let R;t[16]!==V.length||t[17]!==me?(R={id:"tools",label:"Tools",count:V.length,visible:me},t[16]=V.length,t[17]=me,t[18]=R):R=t[18];let te;t[19]!==$||t[20]!==R?(te=[$,R].filter(bt),t[19]=$,t[20]=R,t[21]=te):te=t[21];const A=te;let se;t[22]!==l||t[23]!==A?(se=A.find(c=>c.id===l)?l:A.find(gt)?.id||A[0]?.id||"overview",t[22]=l,t[23]=A,t[24]=se):se=t[24];const fe=se;let oe;t[25]!==p||t[26]!==L||t[27]!==o||t[28]!==e||t[29]!==j||t[30]!==f?(oe=async c=>{const T=L[c??0]||j;if(!T||!e||!f?.user?.id)return;const M=Ze(T,e.id,f.user.id);if(!M.connection_url){he.error("This MCP Server cannot be connected: no connection URL available");return}try{const{id:U}=await p.create.mutateAsync(M);o({to:"/$org/mcps/$connectionId",params:{org:e.slug,connectionId:U}})}catch(U){const D=U;he.error(`Failed to connect MCP Server: ${D instanceof Error?D.message:String(D)}`)}},t[25]=p,t[26]=L,t[27]=o,t[28]=e,t[29]=j,t[30]=f,t[31]=oe):oe=t[31];const ue=oe;let re;t[32]!==o||t[33]!==e.slug?(re=()=>{o({to:"/$org/store",params:{org:e.slug}})},t[32]=o,t[33]=e.slug,t[34]=re):re=t[34];const P=re;if(!j){let c;return t[35]!==P?(c=s.jsx(nt,{onBack:P}),t[35]=P,t[36]=c):c=t[36],c}if(!v)return null;const z=(j?.server?.remotes?.length??0)>0;let B;t[37]!==P?(B=s.jsx(it,{onBack:P}),t[37]=P,t[38]=B):B=t[38];let G;t[39]!==z?(G=!z&&s.jsxs("div",{className:"mb-6 p-4 bg-amber-50 border border-amber-200 rounded-lg text-sm text-amber-900",children:[s.jsx(st,{size:16,className:"inline mr-2"}),"This MCP Server cannot be connected - no connection method available."]}),t[39]=z,t[40]=G):G=t[40];let F;t[41]!==L||t[42]!==j?(F=L.length>0?L:[j],t[41]=L,t[42]=j,t[43]=F):F=t[43];let O;t[44]!==p.create.isPending||t[45]!==z||t[46]!==v||t[47]!==ue||t[48]!==F?(O=s.jsx(lt,{data:v,itemVersions:F,onInstall:ue,canInstall:z,isInstalling:p.create.isPending}),t[44]=p.create.isPending,t[45]=z,t[46]=v,t[47]=ue,t[48]=F,t[49]=O):O=t[49];let H;t[50]!==v||t[51]!==ce||t[52]!==j?(H=s.jsx(ct,{data:v,publisherInfo:ce,selectedItem:j}),t[50]=v,t[51]=ce,t[52]=j,t[53]=H):H=t[53];let W;t[54]!==A||t[55]!==v||t[56]!==fe||t[57]!==V||t[58]!==Y?(W=s.jsx(dt,{data:v,availableTabs:A,effectiveActiveTabId:fe,effectiveTools:V,isLoadingTools:Y,onTabChange:m}),t[54]=A,t[55]=v,t[56]=fe,t[57]=V,t[58]=Y,t[59]=W):W=t[59];let K;t[60]!==H||t[61]!==W?(K=s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 min-h-[677px]",children:[H,W]}),t[60]=H,t[61]=W,t[62]=K):K=t[62];let Z;t[63]!==G||t[64]!==O||t[65]!==K?(Z=s.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:s.jsx("div",{className:"h-full",children:s.jsxs("div",{className:"h-full",children:[G,O,K]})})}),t[63]=G,t[64]=O,t[65]=K,t[66]=Z):Z=t[66];let ne;return t[67]!==B||t[68]!==Z?(ne=s.jsxs("div",{className:"flex flex-col h-full border-l border-border",children:[B,Z]}),t[67]=B,t[68]=Z,t[69]=ne):ne=t[69],ne}function gt(t){return t.id==="readme"}function bt(t){return t.visible}function vt(t){return{name:t.name,description:t.description}}function jt(t){return t.name.endsWith("_GET")}function yt(t){return t.name.endsWith("_VERSIONS")}function rs(){const t=_.c(6),{org:e}=Ne(),o=ve();let n;t[0]!==o||t[1]!==e.slug?(n=()=>{o({to:"/$org/store",params:{org:e.slug}})},t[0]=o,t[1]=e.slug,t[2]=n):n=t[2];const r=n;let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(q.Suspense,{fallback:s.jsx(ot,{}),children:s.jsx(ht,{})}),t[3]=i):i=t[3];let d;return t[4]!==r?(d=s.jsx(xt,{onBack:r,children:i}),t[4]=r,t[5]=d):d=t[5],d}export{rs as default};
1
+ import{r as q,c as _,j as s,f as ve,d as ke,b as Se,a as Ie,t as he}from"./index-A52jfksK.js";import{i as _e}from"./AlertCircle-DaEUMwle.js";import{i as je}from"./Loading01-r04aEG5T.js";import{B as ie}from"./button-DodNLkpL.js";import{i as Le}from"./ArrowLeft-CvFDkdiU.js";import{I as ye,a as Ae,u as De,b as Ee,c as Me}from"./use-connection-BX5-4xHw.js";import{i as Ue}from"./CheckCircle-CILz6OCh.js";import{t as Ve}from"./ChevronDown-g4L12M9A.js";import{s as ge}from"./Plus-CS_Y2Vnc.js";import{b as $e,D as Re,a as Pe,d as ze}from"./dropdown-menu-DrQKdl4f.js";import{n as be}from"./LinkExternal01-ISpHuMJE.js";import{E as Be}from"./SearchMd-1Gq7nypQ.js";import{T as Ge,R as Fe}from"./tools-list-BsHebq88.js";import{R as Oe}from"./resource-tabs-ru5yaRIE.js";import{a as He}from"./use-binding-CapMpNVF.js";import{u as We}from"./use-tool-call-CQCb5PBf.js";import{u as Ke}from"./use-mcp-M6XXMHar.js";import{u as Ne}from"./tooltip-BjhP6ibY.js";import{e as Ze}from"./extract-connection-data-Ty2DjF1e.js";import{s as qe}from"./slugify-CEUa2lfQ.js";import{f as Je,e as Qe,b as Xe,c as Ye,g as et}from"./registry-utils-ulDDT0d8.js";import{e as tt}from"./app-name-gTETL9So.js";import{i as st}from"./InfoCircle-BwNsGATl.js";import"./utils-DgLfrg3u.js";import"./useQuery-ojqdZMTH.js";import"./File06-CBkqKj5m.js";import"./collection-display-button-475jHotV.js";import"./view-mode-toggle-DAXMt6ZW.js";import"./collection-search-DVBnlN6E.js";import"./input-BXHWk19m.js";import"./collection-table-wrapper-DQ4F9pbh.js";import"./card-BHz-BqEu.js";import"./layout-dxbGsEKV.js";import"./badge-1WraHGEG.js";import"./auth-AUS48lXs.js";import"./generate-id-Dyweu44Y.js";const we=({size:t=24,color:e="currentColor",...o})=>q.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...o},q.createElement("path",{d:"m21 21-3.5-3.5m2.5-6a8.5 8.5 0 1 1-17 0 8.5 8.5 0 0 1 17 0Z"}));we.displayName="SearchLg";function ot(t){const e=_.c(3),{message:o}=t,n=o===void 0?"Loading app details...":o;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(je,{size:48,className:"animate-spin mb-4"}),e[0]=r):r=e[0];let i;return e[1]!==n?(i=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[r,s.jsx("p",{className:"text-sm text-muted-foreground",children:n})]}),e[1]=n,e[2]=i):i=e[2],i}function rt(t){const e=_.c(9),{error:o,onBack:n}=t,r=o instanceof Error?o.message:o;let i,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(_e,{size:48,className:"text-destructive mb-4"}),d=s.jsx("h3",{className:"text-lg font-medium mb-2",children:"Error loading app"}),e[0]=i,e[1]=d):(i=e[0],d=e[1]);let a;e[2]!==r?(a=s.jsx("p",{className:"text-muted-foreground max-w-md text-center",children:r}),e[2]=r,e[3]=a):a=e[3];let l;e[4]!==n?(l=s.jsx("button",{onClick:n,className:"mt-4 px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"Go Back"}),e[4]=n,e[5]=l):l=e[5];let m;return e[6]!==a||e[7]!==l?(m=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[i,d,a,l]}),e[6]=a,e[7]=l,e[8]=m):m=e[8],m}function nt(t){const e=_.c(5),{onBack:o}=t;let n,r,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(we,{size:48,className:"text-muted-foreground mb-4"}),r=s.jsx("h3",{className:"text-lg font-medium mb-2",children:"App not found"}),i=s.jsx("p",{className:"text-muted-foreground max-w-md text-center",children:"The app you're looking for doesn't exist in this store."}),e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let d;return e[3]!==o?(d=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[n,r,i,s.jsx("button",{onClick:o,className:"mt-4 px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"Go Back to Store"})]}),e[3]=o,e[4]=d):d=e[4],d}function it(t){const e=_.c(3),{onBack:o}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Le,{}),e[0]=n):n=e[0];let r;return e[1]!==o?(r=s.jsx("div",{className:"flex items-center h-12 border-b border-border shrink-0",children:s.jsx("div",{className:"flex h-full px-2 border-r items-center",children:s.jsx(ie,{variant:"ghost",size:"icon",className:"items-center size-8 text-muted-foreground",onClick:o,"aria-label":"Go back",children:n})})}),e[1]=o,e[2]=r):r=e[2],r}function lt(t){const e=_.c(25),{data:o,itemVersions:n,onInstall:r,canInstall:i,isInstalling:d}=t,a=i===void 0?!0:i,l=d===void 0?!1:d,[m,p]=q.useState(0);let x;e[0]!==r?(x=S=>{p(S),r(S)},e[0]=r,e[1]=x):x=e[1];const f=x;let h;e[2]!==o.icon||e[3]!==o.name?(h=s.jsx(ye,{icon:o.icon,name:o.name,size:"lg",className:"shrink-0 shadow-sm"}),e[2]=o.icon,e[3]=o.name,e[4]=h):h=e[4];let g;e[5]!==o.name?(g=s.jsx("h1",{className:"text-3xl font-medium",children:o.name}),e[5]=o.name,e[6]=g):g=e[6];let b;e[7]!==o.verified?(b=o.verified&&s.jsx("img",{src:"/verified-badge.svg",alt:"Verified",className:"w-5 h-5 shrink-0"}),e[7]=o.verified,e[8]=b):b=e[8];let y;e[9]!==g||e[10]!==b?(y=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsxs("div",{className:"flex items-center gap-2",children:[g,b]})}),e[9]=g,e[10]=b,e[11]=y):y=e[11];let N;e[12]!==a||e[13]!==f||e[14]!==l||e[15]!==n||e[16]!==r||e[17]!==m?(N=a?s.jsx("div",{className:"shrink-0",children:n.length>1?s.jsxs("div",{className:"flex",children:[s.jsxs(ie,{variant:"brand",onClick:()=>f(0),disabled:l,className:"shrink-0 rounded-r-none cursor-pointer",children:[s.jsx(ge,{size:20}),l?"Connecting...":"Connect MCP Server"]}),s.jsxs($e,{children:[s.jsx(Re,{asChild:!0,children:s.jsx(ie,{variant:"brand",disabled:l,className:"shrink-0 rounded-l-none px-2 border-l-2 border-l-white/50 cursor-pointer",children:s.jsx(Ve,{size:20})})}),s.jsx(Pe,{align:"end",className:"w-56 max-h-[300px] overflow-y-auto",children:n.map((S,C)=>{const I=S._meta?.["io.modelcontextprotocol.registry/official"];return s.jsx(ze,{onClick:()=>f(C),disabled:l,className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center justify-between gap-2 w-full",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"font-medium text-sm",children:["v",S.server?.version||"unknown"]}),I?.isLatest&&s.jsx("div",{className:"text-xs text-muted-foreground/50 font-semibold",children:"LATEST"})]}),C===m&&s.jsx(Ue,{size:16,className:"text-muted-foreground shrink-0"})]})},C)})})]})]}):s.jsxs(ie,{variant:"brand",onClick:()=>r(),disabled:n.length===0||l,className:"shrink-0",children:[s.jsx(ge,{size:20}),l?"Connecting...":"Connect MCP Server"]})}):s.jsx("div",{className:"shrink-0 px-4 py-2 text-sm text-muted-foreground bg-muted rounded-lg",children:"Cannot be connected"}),e[12]=a,e[13]=f,e[14]=l,e[15]=n,e[16]=r,e[17]=m,e[18]=N):N=e[18];let w;e[19]!==y||e[20]!==N?(w=s.jsxs("div",{className:"flex-1 min-w-0 flex items-center justify-between",children:[y,N]}),e[19]=y,e[20]=N,e[21]=w):w=e[21];let k;return e[22]!==h||e[23]!==w?(k=s.jsxs("div",{className:"flex items-center gap-4 py-8 px-5 border-b border-border",children:[h,w]}),e[22]=h,e[23]=w,e[24]=k):k=e[24],k}function at(t){if(!t)return"—";try{const e=new Date(t);return isNaN(e.getTime())?"—":e.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return"—"}}function ct(t){const e=_.c(45),{data:o,publisherInfo:n,selectedItem:r}=t;let i;e[0]!==o.description?(i=o.description&&s.jsxs("div",{className:"px-5 pb-5 border-b border-border",children:[s.jsx("h2",{className:"text-base font-medium mb-3",children:"Overview"}),s.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:o.description})]}),e[0]=o.description,e[1]=i):i=e[1];const d=o.publisher==="io.modelcontextprotocol.registry/official"?"Official Registry":o.publisher;let a;e[2]!==n.logo||e[3]!==d?(a=s.jsx(ye,{icon:n.logo,name:d,size:"sm",className:"shrink-0 shadow-sm"}),e[2]=n.logo,e[3]=d,e[4]=a):a=e[4];let l;e[5]!==o.publisher?(l=o.publisher==="io.modelcontextprotocol.registry/official"?"Official Registry":o.publisher.charAt(0).toUpperCase()+o.publisher.slice(1),e[5]=o.publisher,e[6]=l):l=e[6];let m;e[7]!==l?(m=s.jsx("div",{className:"font-medium",children:l}),e[7]=l,e[8]=m):m=e[8];let p;e[9]!==n.count?(p=n.count>0?s.jsxs(s.Fragment,{children:[s.jsx("img",{src:"/globe.svg",alt:"globe",className:"w-3 h-3"}),s.jsxs("span",{children:[n.count," ",n.count===1?"published app":"published apps"]})]}):"Publisher",e[9]=n.count,e[10]=p):p=e[10];let x;e[11]!==p?(x=s.jsx("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:p}),e[11]=p,e[12]=x):x=e[12];let f;e[13]!==m||e[14]!==x?(f=s.jsxs("div",{children:[m,x]}),e[13]=m,e[14]=x,e[15]=f):f=e[15];let h;e[16]!==a||e[17]!==f?(h=s.jsx("div",{className:"px-5 border-b border-border",children:s.jsxs("div",{className:"flex items-center gap-3 py-5",children:[a,f]})}),e[16]=a,e[17]=f,e[18]=h):h=e[18];let g;e[19]!==o.version?(g=o.version&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Version"}),s.jsxs("span",{className:"text-muted-foreground uppercase text-xs",children:["v",o.version]})]}),e[19]=o.version,e[20]=g):g=e[20];let b;e[21]!==o.connectionType?(b=o.connectionType&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Connection Type"}),s.jsx("span",{className:"text-muted-foreground uppercase text-xs",children:o.connectionType})]}),e[21]=o.connectionType,e[22]=b):b=e[22];let y;e[23]!==o.schemaVersion?(y=o.schemaVersion&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Schema Version"}),s.jsx("span",{className:"text-muted-foreground text-xs",children:o.schemaVersion})]}),e[23]=o.schemaVersion,e[24]=y):y=e[24];let N;e[25]!==o.websiteUrl?(N=o.websiteUrl&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Website"}),s.jsxs("a",{href:o.websiteUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:underline flex items-center gap-1 text-xs",children:[s.jsx("span",{children:"Visit"}),s.jsx(be,{size:14})]})]}),e[25]=o.websiteUrl,e[26]=N):N=e[26];let w;e[27]!==o.repository?(w=o.repository?.url&&s.jsxs("div",{className:"flex justify-between items-center text-sm",children:[s.jsx("span",{className:"text-foreground text-sm",children:"Source"}),s.jsxs("a",{href:o.repository.url,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:underline flex items-center gap-1 text-xs",children:[s.jsx("span",{children:"GitHub"}),s.jsx(be,{size:14})]})]}),e[27]=o.repository,e[28]=w):w=e[28];let k;e[29]!==g||e[30]!==b||e[31]!==y||e[32]!==N||e[33]!==w?(k=s.jsxs("div",{className:"px-5 py-5 border-b border-border space-y-4",children:[g,b,y,N,w]}),e[29]=g,e[30]=b,e[31]=y,e[32]=N,e[33]=w,e[34]=k):k=e[34];let S;e[35]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("span",{className:"text-foreground text-sm",children:"Last Updated"}),e[35]=S):S=e[35];let C;e[36]!==r.updated_at?(C=at(r.updated_at),e[36]=r.updated_at,e[37]=C):C=e[37];let I;e[38]!==C?(I=s.jsxs("div",{className:"px-5 py-5 text-sm flex justify-between items-center border-b border-border",children:[S,s.jsx("span",{className:"text-muted-foreground uppercase text-xs",children:C})]}),e[38]=C,e[39]=I):I=e[39];let u;return e[40]!==i||e[41]!==k||e[42]!==I||e[43]!==h?(u=s.jsxs("div",{className:"lg:col-span-1 flex flex-col pt-5",children:[i,h,k,I]}),e[40]=i,e[41]=k,e[42]=I,e[43]=h,e[44]=u):u=e[44],u}function dt(t){const e=_.c(18),{data:o,availableTabs:n,effectiveActiveTabId:r,effectiveTools:i,isLoadingTools:d,onTabChange:a}=t,l=d===void 0?!1:d;let m;e[0]!==i?(m=i.map(mt),e[0]=i,e[1]=m):m=e[1];const p=m;let x;e[2]!==n||e[3]!==r||e[4]!==a?(x=n.length>0&&s.jsx("div",{className:"px-4 py-2 border-b border-border bg-background",children:s.jsx(Oe,{tabs:n,activeTab:r,onTabChange:a})}),e[2]=n,e[3]=r,e[4]=a,e[5]=x):x=e[5];let f;e[6]!==r||e[7]!==i.length||e[8]!==l||e[9]!==p?(f=r==="tools"&&s.jsx("div",{className:"flex flex-col flex-1",children:l?s.jsxs("div",{className:"flex items-center justify-center p-8",children:[s.jsx(je,{size:24,className:"animate-spin"}),s.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading tools..."})]}):i.length>0?s.jsx(Ge,{tools:p,showToolbar:!1,emptyMessage:"This app doesn't have any tools."}):s.jsx(Be,{image:null,title:"No tools available",description:"This app doesn't have any tools."})}),e[6]=r,e[7]=i.length,e[8]=l,e[9]=p,e[10]=f):f=e[10];let h;e[11]!==o?.repository||e[12]!==r?(h=r==="readme"&&s.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:s.jsx(Fe,{repository:o?.repository})}),e[11]=o?.repository,e[12]=r,e[13]=h):h=e[13];let g;return e[14]!==x||e[15]!==f||e[16]!==h?(g=s.jsxs("div",{className:"lg:col-span-2 flex flex-col border-l border-border",children:[x,f,h]}),e[14]=x,e[15]=f,e[16]=h,e[17]=g):g=e[17],g}function mt(t){const e=t;return{name:e.name||"",description:e.description||void 0}}function ft(t,e){if(!t||!e)return;const o=e.toLowerCase();return t.find(n=>n.app_name?.toLowerCase()===o||n.app_id?.toLowerCase()===o||n.title.toLowerCase()===o)||t.find(n=>n.title.toLowerCase().includes(o))}function ut(t,e,o,n,r){if(!e||e==="Unknown")return{count:0};if(e==="io.modelcontextprotocol.registry/official")return{logo:n?.icon||void 0,count:r??t.length};const i=e.toLowerCase(),d=t.filter(l=>(l._meta?.["io.modelcontextprotocol.registry/official"]?"io.modelcontextprotocol.registry/official":l.publisher||l._meta?.["mcp.mesh"]?.scopeName||"Unknown").toLowerCase()===i);return{logo:o?.icon||d[0]?.publisher_logo||d[0]?.icon||void 0,count:d.length}}function pt(t){const e=t.server._meta?.["mcp.mesh/publisher-provided"],o=t._meta?.["mcp.mesh"],n=t._meta?.["io.modelcontextprotocol.registry/official"],r=t.server,i=Xe(r.remotes?.[0]?.type),d=Ye(r.$schema),a=n?"io.modelcontextprotocol.registry/official":t.publisher||o?.scopeName||"Unknown",l=et(r.repository),m=t.icon||t.image||t.logo||r.icons?.[0]?.src||l||null,p=t.name||t.title||t.server?.title||"Unnamed Item";return{name:tt(p),description:t.description||t.summary||t.server?.description||"",icon:m,verified:t.verified||o?.verified,publisher:a,version:r.version||null,websiteUrl:r.websiteUrl||null,repository:r.repository||null,schemaVersion:d??null,connectionType:i,connectionUrl:null,remoteUrl:null,tools:t.tools||r.tools||e?.tools||[],models:t.models||r.models||e?.models||[],emails:t.emails||r.emails||e?.emails||[],analytics:t.analytics||r.analytics||e?.analytics,cdn:t.cdn||r.cdn||e?.cdn}}class xt extends q.Component{state={hasError:!1,error:null};static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,o){console.error("Store app detail error:",e,o)}render(){return this.state.hasError?s.jsx(rt,{error:this.state.error||new Error("Unknown error"),onBack:this.props.onBack}):this.props.children}}function ht(){const t=_.c(70),{org:e}=Ne(),o=ve();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const{appName:r}=ke(n);let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},t[1]=i):i=t[1];const{registryId:d,serverName:a}=Se(i),[l,m]=q.useState("readme"),p=Ae(),x=De(),{data:f}=Ie.useSession(),h=He(x),g=d||h[0]?.id||"",b=Ee(g),y=Je(b?.tools),N=b?.tools&&b.tools.find(yt)?.name||"",w=b?.tools&&b.tools.find(jt)?.name||"",k=Me(g),S=!!a;let C,I;S?(C=N||w,I={name:a}):(C=y,I={});const{data:u}=We({toolCaller:k,toolName:C,toolInputParams:I,scope:g});let E=[],L=[],pe=null;if(u){if(Array.isArray(u))E=u;else if(typeof u=="object"&&u!==null)if("totalCount"in u&&typeof u.totalCount=="number"&&(pe=u.totalCount),"item"in u&&u.item){const c=u.item,T=c.id||"",M=c.server,U=c._meta;let D;t[2]!==c.title||t[3]!==T||t[4]!==M||t[5]!==U?(D=[{id:T,title:c.title,server:M,_meta:U}],t[2]=c.title,t[3]=T,t[4]=M,t[5]=U,t[6]=D):D=t[6],E=D}else{let c;"versions"in u&&Array.isArray(u.versions)?c="versions":"servers"in u&&Array.isArray(u.servers)?c="servers":c=Object.keys(u).find(T=>Array.isArray(u[T])),c&&(E=u[c],(c==="versions"||C?.includes("VERSIONS"))&&(L=E))}}let X;t[7]!==r?(X=c=>{const T=c.name||c.title||c.server.title||"";return qe(T)===r},t[7]=r,t[8]=X):X=t[8];let j=E.find(X);if(!j&&a){let c;t[9]!==a?(c=T=>T.server.name===a||T.name===a||T.title===a,t[9]=a,t[10]=c):c=t[10],j=E.find(c)}const v=j?pt(j):null,le=(v?.tools?.length||0)>0,ae=j?.server?.remotes?.[0]?.url||null,J=!le&&!!ae,Q=Ke({url:J?ae:""}),Y=J&&Q.state==="connecting";let ee;t[11]!==Q||t[12]!==J?(ee=J&&Q.state==="ready"?(Q.tools||[]).map(vt):[],t[11]=Q,t[12]=J,t[13]=ee):ee=t[13];const xe=ee,V=le?v?.tools||[]:xe,Ce=ft(x,v?.publisher),ce=v?ut(E,v.publisher,Ce,b??null,pe):{count:0},Te=v?.repository?Qe(v.repository):null,de=!!v?.repository&&!!Te;let $;t[14]!==de?($={id:"readme",label:"README",visible:de},t[14]=de,t[15]=$):$=t[15];const me=le||xe.length>0||Y&&!!ae;let R;t[16]!==V.length||t[17]!==me?(R={id:"tools",label:"Tools",count:V.length,visible:me},t[16]=V.length,t[17]=me,t[18]=R):R=t[18];let te;t[19]!==$||t[20]!==R?(te=[$,R].filter(bt),t[19]=$,t[20]=R,t[21]=te):te=t[21];const A=te;let se;t[22]!==l||t[23]!==A?(se=A.find(c=>c.id===l)?l:A.find(gt)?.id||A[0]?.id||"overview",t[22]=l,t[23]=A,t[24]=se):se=t[24];const fe=se;let oe;t[25]!==p||t[26]!==L||t[27]!==o||t[28]!==e||t[29]!==j||t[30]!==f?(oe=async c=>{const T=L[c??0]||j;if(!T||!e||!f?.user?.id)return;const M=Ze(T,e.id,f.user.id);if(!M.connection_url){he.error("This MCP Server cannot be connected: no connection URL available");return}try{const{id:U}=await p.create.mutateAsync(M);o({to:"/$org/mcps/$connectionId",params:{org:e.slug,connectionId:U}})}catch(U){const D=U;he.error(`Failed to connect MCP Server: ${D instanceof Error?D.message:String(D)}`)}},t[25]=p,t[26]=L,t[27]=o,t[28]=e,t[29]=j,t[30]=f,t[31]=oe):oe=t[31];const ue=oe;let re;t[32]!==o||t[33]!==e.slug?(re=()=>{o({to:"/$org/store",params:{org:e.slug}})},t[32]=o,t[33]=e.slug,t[34]=re):re=t[34];const P=re;if(!j){let c;return t[35]!==P?(c=s.jsx(nt,{onBack:P}),t[35]=P,t[36]=c):c=t[36],c}if(!v)return null;const z=(j?.server?.remotes?.length??0)>0;let B;t[37]!==P?(B=s.jsx(it,{onBack:P}),t[37]=P,t[38]=B):B=t[38];let G;t[39]!==z?(G=!z&&s.jsxs("div",{className:"mb-6 p-4 bg-amber-50 border border-amber-200 rounded-lg text-sm text-amber-900",children:[s.jsx(st,{size:16,className:"inline mr-2"}),"This MCP Server cannot be connected - no connection method available."]}),t[39]=z,t[40]=G):G=t[40];let F;t[41]!==L||t[42]!==j?(F=L.length>0?L:[j],t[41]=L,t[42]=j,t[43]=F):F=t[43];let O;t[44]!==p.create.isPending||t[45]!==z||t[46]!==v||t[47]!==ue||t[48]!==F?(O=s.jsx(lt,{data:v,itemVersions:F,onInstall:ue,canInstall:z,isInstalling:p.create.isPending}),t[44]=p.create.isPending,t[45]=z,t[46]=v,t[47]=ue,t[48]=F,t[49]=O):O=t[49];let H;t[50]!==v||t[51]!==ce||t[52]!==j?(H=s.jsx(ct,{data:v,publisherInfo:ce,selectedItem:j}),t[50]=v,t[51]=ce,t[52]=j,t[53]=H):H=t[53];let W;t[54]!==A||t[55]!==v||t[56]!==fe||t[57]!==V||t[58]!==Y?(W=s.jsx(dt,{data:v,availableTabs:A,effectiveActiveTabId:fe,effectiveTools:V,isLoadingTools:Y,onTabChange:m}),t[54]=A,t[55]=v,t[56]=fe,t[57]=V,t[58]=Y,t[59]=W):W=t[59];let K;t[60]!==H||t[61]!==W?(K=s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 min-h-[677px]",children:[H,W]}),t[60]=H,t[61]=W,t[62]=K):K=t[62];let Z;t[63]!==G||t[64]!==O||t[65]!==K?(Z=s.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:s.jsx("div",{className:"h-full",children:s.jsxs("div",{className:"h-full",children:[G,O,K]})})}),t[63]=G,t[64]=O,t[65]=K,t[66]=Z):Z=t[66];let ne;return t[67]!==B||t[68]!==Z?(ne=s.jsxs("div",{className:"flex flex-col h-full border-l border-border",children:[B,Z]}),t[67]=B,t[68]=Z,t[69]=ne):ne=t[69],ne}function gt(t){return t.id==="readme"}function bt(t){return t.visible}function vt(t){return{name:t.name,description:t.description}}function jt(t){return t.name.endsWith("_GET")}function yt(t){return t.name.endsWith("_VERSIONS")}function rs(){const t=_.c(6),{org:e}=Ne(),o=ve();let n;t[0]!==o||t[1]!==e.slug?(n=()=>{o({to:"/$org/store",params:{org:e.slug}})},t[0]=o,t[1]=e.slug,t[2]=n):n=t[2];const r=n;let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(q.Suspense,{fallback:s.jsx(ot,{}),children:s.jsx(ht,{})}),t[3]=i):i=t[3];let d;return t[4]!==r?(d=s.jsx(xt,{onBack:r,children:i}),t[4]=r,t[5]=d):d=t[5],d}export{rs as default};
@@ -1 +1 @@
1
- import{r as j,c as M,j as t,F as W,z as I,a1 as z,y as X,B as Z,aZ as G,a_ as J}from"./index-CCNaUj2A.js";import{I as $,u as K}from"./use-connection-BbvAiBvg.js";import{C as F}from"./checkbox-DTaSeum9.js";import{B as Y}from"./button-DuitHSR8.js";import{i as ee}from"./ArrowLeft-b0UM4Vui.js";import{c as S}from"./utils-o1atviYh.js";import{C as te}from"./collection-search-OoKPetka.js";const se=j.memo(function(o){const e=M.c(21),{connection:n,isSelected:r,hasToolsEnabled:c,activeToolsCount:i,totalToolsCount:x,onSelect:b,onToggle:g}=o,d=r?"bg-accent/50":"hover:bg-muted/50";let u;e[0]!==d?(u=S("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",d),e[0]=d,e[1]=u):u=e[1];let m;e[2]!==n.icon||e[3]!==n.title?(m=t.jsx($,{icon:n.icon,name:n.title,size:"xs"}),e[2]=n.icon,e[3]=n.title,e[4]=m):m=e[4];let p;e[5]!==n.title?(p=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.title})}),e[5]=n.title,e[6]=p):p=e[6];let a;e[7]!==b||e[8]!==m||e[9]!==p?(a=t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:b,children:[m,p]}),e[7]=b,e[8]=m,e[9]=p,e[10]=a):a=e[10];let f;e[11]!==i||e[12]!==n.tools||e[13]!==c||e[14]!==g||e[15]!==x?(f=n.tools&&n.tools.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[i,"/",x]}),t.jsx(F,{checked:c,onCheckedChange:g,onClick:ne})]}),e[11]=i,e[12]=n.tools,e[13]=c,e[14]=g,e[15]=x,e[16]=f):f=e[16];let C;return e[17]!==u||e[18]!==a||e[19]!==f?(C=t.jsxs("div",{className:u,children:[a,f]}),e[17]=u,e[18]=a,e[19]=f,e[20]=C):C=e[20],C}),oe=j.memo(function(o){const e=M.c(18),{connectionId:n,tool:r,isSelected:c,onToggle:i}=o,x=`tool-${n}-${r.name}`,b=c?"text-foreground":"text-muted-foreground";let g;e[0]!==b?(g=S("text-sm font-medium",b),e[0]=b,e[1]=g):g=e[1];let d;e[2]!==g||e[3]!==r.name?(d=t.jsx("div",{className:"flex items-center gap-2 mb-1",children:t.jsx("span",{className:g,children:r.name})}),e[2]=g,e[3]=r.name,e[4]=d):d=e[4];let u;e[5]!==r.description?(u=r.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:r.description}),e[5]=r.description,e[6]=u):u=e[6];let m;e[7]!==d||e[8]!==u?(m=t.jsxs("div",{className:"flex-1 min-w-0",children:[d,u]}),e[7]=d,e[8]=u,e[9]=m):m=e[9];const p=`tool-${n}-${r.name}`;let a;e[10]!==c||e[11]!==i||e[12]!==p?(a=t.jsx("div",{className:"flex items-center shrink-0",children:t.jsx(F,{id:p,checked:c,onCheckedChange:i,onClick:re})}),e[10]=c,e[11]=i,e[12]=p,e[13]=a):a=e[13];let f;return e[14]!==x||e[15]!==m||e[16]!==a?(f=t.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:x,children:[m,a]}),e[14]=x,e[15]=m,e[16]=a,e[17]=f):f=e[17],f});function ve({toolSet:l,onToolSetChange:o}){const[e,n]=j.useState(""),r=j.useDeferredValue(e),[c,i]=j.useState("all"),[x,b]=j.useState(!1),g=j.useRef(new Set(Object.keys(l))),d=K({searchTerm:r.trim()||void 0}),u=g.current,m=[...u.values()].map(s=>d.find(h=>h.id===s)).filter(s=>s!==void 0),p=d.filter(s=>!u.has(s.id)),a=[...m,...p],f=s=>{const h=l[s];return h!==void 0&&h.length>0},C=a.filter(s=>{if(c==="all")return!0;const h=f(s.id);return c==="selected"?h:c==="unselected"?!h:!0}),[w,P]=j.useState(a[0]?.id??null),v=w?a.find(s=>s.id===w)??null:null,E=v?.tools??[],Q=(s,h)=>l[s]?.includes(h)??!1,q=(s,h)=>{const N=l[s]??[],R=N.includes(h),T={...l};if(R){const y=N.filter(k=>k!==h);y.length===0?delete T[s]:T[s]=y}else T[s]=[...N,h];o(T)},L=s=>{const h=a.find(k=>k.id===s);if(!h?.tools)return;const N=l[s]??[],R=h.tools.map(k=>k.name),T=N.length>0&&R.every(k=>N.includes(k)),y={...l};T?delete y[s]:(y[s]=R,P(s)),o(y)},_=s=>{P(s),b(!0)},V=()=>{b(!1)};return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:S("w-full md:w-80 border-r border-border flex flex-col",x&&"hidden md:flex"),children:[t.jsx(te,{value:e,onChange:n,placeholder:"Search MCP Servers..."}),t.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[t.jsx("button",{onClick:()=>i("all"),className:S("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),t.jsx("button",{onClick:()=>i("selected"),className:S("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),t.jsx("button",{onClick:()=>i("unselected"),className:S("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:C.length===0?t.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:e?"No connections found":c==="selected"?"No servers selected":c==="unselected"?"No unselected servers":"No connections available"}):t.jsx("div",{className:"p-2 space-y-1",children:C.map(s=>{const h=s.tools?.length??0,N=l[s.id]?.length??0;return t.jsx(se,{connection:s,isSelected:w===s.id,hasToolsEnabled:f(s.id),activeToolsCount:N,totalToolsCount:h,onSelect:()=>_(s.id),onToggle:()=>L(s.id)},s.id)})})})]}),t.jsx("div",{className:S("flex-1 flex-col",x?"flex":"hidden md:flex"),children:v?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[t.jsx(Y,{variant:"ghost",size:"sm",onClick:V,className:"h-8 w-8 p-0 shrink-0",children:t.jsx(ee,{size:20})}),t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx($,{icon:v.icon,name:v.title,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:v.title}),v.description&&t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:v.description})]})]})]}),t.jsx("div",{className:"flex-1 overflow-auto p-4",children:E.length===0?t.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):t.jsx("div",{className:"space-y-2",children:E.map(s=>t.jsx(oe,{connectionId:v.id,tool:s,isSelected:Q(v.id,s.name),onToggle:()=>q(v.id,s.name)},s.name))})})]}):t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function ne(l){return l.stopPropagation()}function re(l){return l.stopPropagation()}var B="Switch",[le]=W(B),[ce,ie]=le(B),O=j.forwardRef((l,o)=>{const{__scopeSwitch:e,name:n,checked:r,defaultChecked:c,required:i,disabled:x,value:b="on",onCheckedChange:g,form:d,...u}=l,[m,p]=j.useState(null),a=z(o,v=>p(v)),f=j.useRef(!1),C=m?d||!!m.closest("form"):!0,[w,P]=X({prop:r,defaultProp:c??!1,onChange:g,caller:B});return t.jsxs(ce,{scope:e,checked:w,disabled:x,children:[t.jsx(I.button,{type:"button",role:"switch","aria-checked":w,"aria-required":i,"data-state":U(w),"data-disabled":x?"":void 0,disabled:x,value:b,...u,ref:a,onClick:Z(l.onClick,v=>{P(E=>!E),C&&(f.current=v.isPropagationStopped(),f.current||v.stopPropagation())})}),C&&t.jsx(H,{control:m,bubbles:!f.current,name:n,value:b,checked:w,required:i,disabled:x,form:d,style:{transform:"translateX(-100%)"}})]})});O.displayName=B;var A="SwitchThumb",D=j.forwardRef((l,o)=>{const{__scopeSwitch:e,...n}=l,r=ie(A,e);return t.jsx(I.span,{"data-state":U(r.checked),"data-disabled":r.disabled?"":void 0,...n,ref:o})});D.displayName=A;var ae="SwitchBubbleInput",H=j.forwardRef(({__scopeSwitch:l,control:o,checked:e,bubbles:n=!0,...r},c)=>{const i=j.useRef(null),x=z(i,c),b=G(e),g=J(o);return j.useEffect(()=>{const d=i.current;if(!d)return;const u=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(u,"checked").set;if(b!==e&&p){const a=new Event("click",{bubbles:n});p.call(d,e),d.dispatchEvent(a)}},[b,e,n]),t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:e,...r,tabIndex:-1,ref:x,style:{...r.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});H.displayName=ae;function U(l){return l?"checked":"unchecked"}var de=O,ue=D;function je(l){const o=M.c(9);let e,n;o[0]!==l?({className:e,...n}=l,o[0]=l,o[1]=e,o[2]=n):(e=o[1],n=o[2]);let r;o[3]!==e?(r=S("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),o[3]=e,o[4]=r):r=o[4];let c;o[5]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(ue,{"data-slot":"switch-thumb",className:S("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")}),o[5]=c):c=o[5];let i;return o[6]!==n||o[7]!==r?(i=t.jsx(de,{"data-slot":"switch",className:r,...n,children:c}),o[6]=n,o[7]=r,o[8]=i):i=o[8],i}export{je as S,ve as T};
1
+ import{r as j,c as M,j as t,F as W,z as I,a1 as z,y as X,B as Z,aZ as G,a_ as J}from"./index-A52jfksK.js";import{I as $,u as K}from"./use-connection-BX5-4xHw.js";import{C as F}from"./checkbox-Bj9jBMQF.js";import{B as Y}from"./button-DodNLkpL.js";import{i as ee}from"./ArrowLeft-CvFDkdiU.js";import{c as S}from"./utils-DgLfrg3u.js";import{C as te}from"./collection-search-DVBnlN6E.js";const se=j.memo(function(o){const e=M.c(21),{connection:n,isSelected:r,hasToolsEnabled:c,activeToolsCount:i,totalToolsCount:x,onSelect:b,onToggle:g}=o,d=r?"bg-accent/50":"hover:bg-muted/50";let u;e[0]!==d?(u=S("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",d),e[0]=d,e[1]=u):u=e[1];let m;e[2]!==n.icon||e[3]!==n.title?(m=t.jsx($,{icon:n.icon,name:n.title,size:"xs"}),e[2]=n.icon,e[3]=n.title,e[4]=m):m=e[4];let p;e[5]!==n.title?(p=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.title})}),e[5]=n.title,e[6]=p):p=e[6];let a;e[7]!==b||e[8]!==m||e[9]!==p?(a=t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:b,children:[m,p]}),e[7]=b,e[8]=m,e[9]=p,e[10]=a):a=e[10];let f;e[11]!==i||e[12]!==n.tools||e[13]!==c||e[14]!==g||e[15]!==x?(f=n.tools&&n.tools.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[i,"/",x]}),t.jsx(F,{checked:c,onCheckedChange:g,onClick:ne})]}),e[11]=i,e[12]=n.tools,e[13]=c,e[14]=g,e[15]=x,e[16]=f):f=e[16];let C;return e[17]!==u||e[18]!==a||e[19]!==f?(C=t.jsxs("div",{className:u,children:[a,f]}),e[17]=u,e[18]=a,e[19]=f,e[20]=C):C=e[20],C}),oe=j.memo(function(o){const e=M.c(18),{connectionId:n,tool:r,isSelected:c,onToggle:i}=o,x=`tool-${n}-${r.name}`,b=c?"text-foreground":"text-muted-foreground";let g;e[0]!==b?(g=S("text-sm font-medium",b),e[0]=b,e[1]=g):g=e[1];let d;e[2]!==g||e[3]!==r.name?(d=t.jsx("div",{className:"flex items-center gap-2 mb-1",children:t.jsx("span",{className:g,children:r.name})}),e[2]=g,e[3]=r.name,e[4]=d):d=e[4];let u;e[5]!==r.description?(u=r.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:r.description}),e[5]=r.description,e[6]=u):u=e[6];let m;e[7]!==d||e[8]!==u?(m=t.jsxs("div",{className:"flex-1 min-w-0",children:[d,u]}),e[7]=d,e[8]=u,e[9]=m):m=e[9];const p=`tool-${n}-${r.name}`;let a;e[10]!==c||e[11]!==i||e[12]!==p?(a=t.jsx("div",{className:"flex items-center shrink-0",children:t.jsx(F,{id:p,checked:c,onCheckedChange:i,onClick:re})}),e[10]=c,e[11]=i,e[12]=p,e[13]=a):a=e[13];let f;return e[14]!==x||e[15]!==m||e[16]!==a?(f=t.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:x,children:[m,a]}),e[14]=x,e[15]=m,e[16]=a,e[17]=f):f=e[17],f});function ve({toolSet:l,onToolSetChange:o}){const[e,n]=j.useState(""),r=j.useDeferredValue(e),[c,i]=j.useState("all"),[x,b]=j.useState(!1),g=j.useRef(new Set(Object.keys(l))),d=K({searchTerm:r.trim()||void 0}),u=g.current,m=[...u.values()].map(s=>d.find(h=>h.id===s)).filter(s=>s!==void 0),p=d.filter(s=>!u.has(s.id)),a=[...m,...p],f=s=>{const h=l[s];return h!==void 0&&h.length>0},C=a.filter(s=>{if(c==="all")return!0;const h=f(s.id);return c==="selected"?h:c==="unselected"?!h:!0}),[w,P]=j.useState(a[0]?.id??null),v=w?a.find(s=>s.id===w)??null:null,E=v?.tools??[],Q=(s,h)=>l[s]?.includes(h)??!1,q=(s,h)=>{const N=l[s]??[],R=N.includes(h),T={...l};if(R){const y=N.filter(k=>k!==h);y.length===0?delete T[s]:T[s]=y}else T[s]=[...N,h];o(T)},L=s=>{const h=a.find(k=>k.id===s);if(!h?.tools)return;const N=l[s]??[],R=h.tools.map(k=>k.name),T=N.length>0&&R.every(k=>N.includes(k)),y={...l};T?delete y[s]:(y[s]=R,P(s)),o(y)},_=s=>{P(s),b(!0)},V=()=>{b(!1)};return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:S("w-full md:w-80 border-r border-border flex flex-col",x&&"hidden md:flex"),children:[t.jsx(te,{value:e,onChange:n,placeholder:"Search MCP Servers..."}),t.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[t.jsx("button",{onClick:()=>i("all"),className:S("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),t.jsx("button",{onClick:()=>i("selected"),className:S("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),t.jsx("button",{onClick:()=>i("unselected"),className:S("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:C.length===0?t.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:e?"No connections found":c==="selected"?"No servers selected":c==="unselected"?"No unselected servers":"No connections available"}):t.jsx("div",{className:"p-2 space-y-1",children:C.map(s=>{const h=s.tools?.length??0,N=l[s.id]?.length??0;return t.jsx(se,{connection:s,isSelected:w===s.id,hasToolsEnabled:f(s.id),activeToolsCount:N,totalToolsCount:h,onSelect:()=>_(s.id),onToggle:()=>L(s.id)},s.id)})})})]}),t.jsx("div",{className:S("flex-1 flex-col",x?"flex":"hidden md:flex"),children:v?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[t.jsx(Y,{variant:"ghost",size:"sm",onClick:V,className:"h-8 w-8 p-0 shrink-0",children:t.jsx(ee,{size:20})}),t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx($,{icon:v.icon,name:v.title,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:v.title}),v.description&&t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:v.description})]})]})]}),t.jsx("div",{className:"flex-1 overflow-auto p-4",children:E.length===0?t.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):t.jsx("div",{className:"space-y-2",children:E.map(s=>t.jsx(oe,{connectionId:v.id,tool:s,isSelected:Q(v.id,s.name),onToggle:()=>q(v.id,s.name)},s.name))})})]}):t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function ne(l){return l.stopPropagation()}function re(l){return l.stopPropagation()}var B="Switch",[le]=W(B),[ce,ie]=le(B),O=j.forwardRef((l,o)=>{const{__scopeSwitch:e,name:n,checked:r,defaultChecked:c,required:i,disabled:x,value:b="on",onCheckedChange:g,form:d,...u}=l,[m,p]=j.useState(null),a=z(o,v=>p(v)),f=j.useRef(!1),C=m?d||!!m.closest("form"):!0,[w,P]=X({prop:r,defaultProp:c??!1,onChange:g,caller:B});return t.jsxs(ce,{scope:e,checked:w,disabled:x,children:[t.jsx(I.button,{type:"button",role:"switch","aria-checked":w,"aria-required":i,"data-state":U(w),"data-disabled":x?"":void 0,disabled:x,value:b,...u,ref:a,onClick:Z(l.onClick,v=>{P(E=>!E),C&&(f.current=v.isPropagationStopped(),f.current||v.stopPropagation())})}),C&&t.jsx(H,{control:m,bubbles:!f.current,name:n,value:b,checked:w,required:i,disabled:x,form:d,style:{transform:"translateX(-100%)"}})]})});O.displayName=B;var A="SwitchThumb",D=j.forwardRef((l,o)=>{const{__scopeSwitch:e,...n}=l,r=ie(A,e);return t.jsx(I.span,{"data-state":U(r.checked),"data-disabled":r.disabled?"":void 0,...n,ref:o})});D.displayName=A;var ae="SwitchBubbleInput",H=j.forwardRef(({__scopeSwitch:l,control:o,checked:e,bubbles:n=!0,...r},c)=>{const i=j.useRef(null),x=z(i,c),b=G(e),g=J(o);return j.useEffect(()=>{const d=i.current;if(!d)return;const u=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(u,"checked").set;if(b!==e&&p){const a=new Event("click",{bubbles:n});p.call(d,e),d.dispatchEvent(a)}},[b,e,n]),t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:e,...r,tabIndex:-1,ref:x,style:{...r.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});H.displayName=ae;function U(l){return l?"checked":"unchecked"}var de=O,ue=D;function je(l){const o=M.c(9);let e,n;o[0]!==l?({className:e,...n}=l,o[0]=l,o[1]=e,o[2]=n):(e=o[1],n=o[2]);let r;o[3]!==e?(r=S("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),o[3]=e,o[4]=r):r=o[4];let c;o[5]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(ue,{"data-slot":"switch-thumb",className:S("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")}),o[5]=c):c=o[5];let i;return o[6]!==n||o[7]!==r?(i=t.jsx(de,{"data-slot":"switch",className:r,...n,children:c}),o[6]=n,o[7]=r,o[8]=i):i=o[8],i}export{je as S,ve as T};