@lovelybunch/api 1.0.71-alpha.3 → 1.0.71-alpha.5

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 (95) hide show
  1. package/dist/routes/api/v1/context/images/index.d.ts +2 -0
  2. package/dist/routes/api/v1/context/images/index.js +2 -0
  3. package/dist/routes/api/v1/context/images/route.d.ts +3 -0
  4. package/dist/routes/api/v1/context/images/route.js +253 -0
  5. package/dist/routes/api/v1/context/index.js +2 -0
  6. package/dist/routes/api/v1/resources/generate-audio/index.d.ts +3 -0
  7. package/dist/routes/api/v1/resources/generate-audio/index.js +5 -0
  8. package/dist/routes/api/v1/resources/generate-audio/route.d.ts +19 -0
  9. package/dist/routes/api/v1/resources/generate-audio/route.js +129 -0
  10. package/dist/routes/api/v1/resources/index.js +2 -0
  11. package/package.json +4 -4
  12. package/static/assets/{AgentDetailPage-DVDnvYcy.js → AgentDetailPage-B3CFO9Vg.js} +1 -1
  13. package/static/assets/{AgentEditPage-DRLTkdIZ.js → AgentEditPage-Cc8k9uYb.js} +1 -1
  14. package/static/assets/{AgentsPage-CVoYisFq.js → AgentsPage-CcRVHD2p.js} +2 -2
  15. package/static/assets/{AgentsSettingsPage-D9FDJHpC.js → AgentsSettingsPage-BMphtJ6C.js} +1 -1
  16. package/static/assets/{ApiKeysSettingsPage-DGcz0E10.js → ApiKeysSettingsPage-BLlmALn1.js} +3 -3
  17. package/static/assets/{ArchitectureEditPage-PXH0HtcY.js → ArchitectureEditPage-B8YrHerA.js} +1 -1
  18. package/static/assets/{ArchitecturePage-BiybPTif.js → ArchitecturePage-fIoEV_ow.js} +1 -1
  19. package/static/assets/{AuthSettingsPage-6TaOiZV7.js → AuthSettingsPage-CICO_5eb.js} +2 -2
  20. package/static/assets/{CallbackPage-BdZglBBj.js → CallbackPage-6lJyGru9.js} +1 -1
  21. package/static/assets/{CodePage-B239DtM2.js → CodePage-gGhNXTQn.js} +1 -1
  22. package/static/assets/{CollapsibleSection-DaqBpCe-.js → CollapsibleSection-CkCVMSBD.js} +1 -1
  23. package/static/assets/{DashboardPage-B2FJcHVR.js → DashboardPage-qkyq1COW.js} +1 -1
  24. package/static/assets/{GitPage-DaWE2Q-b.js → GitPage-Dj9uMiQV.js} +1 -1
  25. package/static/assets/{GitSettingsPage-bTqUr0fn.js → GitSettingsPage--hjPt4zu.js} +2 -2
  26. package/static/assets/{IdentityPage-eXzMXYy2.js → IdentityPage-DzqrsAU2.js} +2 -2
  27. package/static/assets/{ImplementationStepsEditor-CuDeossU.js → ImplementationStepsEditor-GxhD-g8y.js} +1 -1
  28. package/static/assets/{IntegrationsSettingsPage-wAf_7nar.js → IntegrationsSettingsPage-DR_v_Fbo.js} +1 -1
  29. package/static/assets/{KnowledgeDetailPage-B5ieYIze.js → KnowledgeDetailPage-BEHrLcNg.js} +1 -1
  30. package/static/assets/{KnowledgeEditPage-OMUREl1n.js → KnowledgeEditPage-CETMgdZf.js} +1 -1
  31. package/static/assets/{KnowledgePage-CKtcok1N.js → KnowledgePage-Dz2YIqdH.js} +2 -2
  32. package/static/assets/{LoginPage-B70_aCBv.js → LoginPage-DSxl4xGK.js} +1 -1
  33. package/static/assets/McpSettingsPage-CLDzqlt3.js +1 -0
  34. package/static/assets/{NewAgentPage-DITLLDez.js → NewAgentPage-DlEnBUUY.js} +1 -1
  35. package/static/assets/{NewKnowledgePage-C7vEg4PR.js → NewKnowledgePage-CI8D1NRB.js} +1 -1
  36. package/static/assets/{NewProposalPage-z8wqyXIj.js → NewProposalPage-B1hVwad9.js} +1 -1
  37. package/static/assets/{ProjectEditPage-BDj8GlD_.js → ProjectEditPage-t_oD7x6f.js} +1 -1
  38. package/static/assets/{ProjectPage-CtoKV0l9.js → ProjectPage-CMez4KRO.js} +1 -1
  39. package/static/assets/{PromptsSettingsPage-CI-pWQVw.js → PromptsSettingsPage-DXvS4JX8.js} +1 -1
  40. package/static/assets/{ProposalDetailPage-D6rhO9vm.js → ProposalDetailPage-Cbld0UYO.js} +1 -1
  41. package/static/assets/{ProposalEditPage-DCy3_sbg.js → ProposalEditPage-Dujm4G1-.js} +1 -1
  42. package/static/assets/{ProposalsPage-DQLqm83b.js → ProposalsPage-0L4kWC5Y.js} +1 -1
  43. package/static/assets/ResourcesPage-5sZL01s_.js +66 -0
  44. package/static/assets/{RulesSettingsPage-MgsP5qaA.js → RulesSettingsPage-D6qjkKbl.js} +1 -1
  45. package/static/assets/{SchedulePage-C1vDSjyh.js → SchedulePage-CgnTsib0.js} +1 -1
  46. package/static/assets/{TagInput-Cdfvhozb.js → TagInput-DJMwLVTn.js} +1 -1
  47. package/static/assets/{TerminalPage-NQzi2rzj.js → TerminalPage-EYVbapc9.js} +1 -1
  48. package/static/assets/{TerminalSessionPage-DQgbm-LP.js → TerminalSessionPage-CQCLFjOR.js} +1 -1
  49. package/static/assets/{UserPreferencesPage-CCYsj_XY.js → UserPreferencesPage-KAsCdvFQ.js} +1 -1
  50. package/static/assets/{UserSettingsPage-DdCnaoY_.js → UserSettingsPage-DclI2Mhd.js} +1 -1
  51. package/static/assets/{UtilitiesPage-DGcmJSz6.js → UtilitiesPage-BKdyva6y.js} +1 -1
  52. package/static/assets/{alert-BAeRxZ1d.js → alert-p2sQnjrU.js} +1 -1
  53. package/static/assets/{arrow-down-5CQhXptz.js → arrow-down-DGeJDsho.js} +1 -1
  54. package/static/assets/{arrow-left-DSqUNUH-.js → arrow-left-BRSAC1N6.js} +1 -1
  55. package/static/assets/{arrow-up-CYoJSbWn.js → arrow-up-C5ecpR5U.js} +1 -1
  56. package/static/assets/{badge-NJasrAx_.js → badge-DaM4gF82.js} +1 -1
  57. package/static/assets/browser-modal-CyeEbzDK.js +6 -0
  58. package/static/assets/{calendar-wiZSxCBM.js → calendar-CV2haPQ9.js} +1 -1
  59. package/static/assets/{card-CvaBJsG6.js → card-B9ym6neB.js} +1 -1
  60. package/static/assets/{chevron-left-CaZHWPr-.js → chevron-left-D8aMFTU2.js} +1 -1
  61. package/static/assets/{circle-alert-61156jM6.js → circle-alert-C-piOZLm.js} +1 -1
  62. package/static/assets/{circle-check-z0By2KN8.js → circle-check-4zzXsmHH.js} +1 -1
  63. package/static/assets/{circle-check-big-K_QMED_K.js → circle-check-big-AlE11jqb.js} +1 -1
  64. package/static/assets/{circle-play-88lMuMRZ.js → circle-play-cWY3nlZW.js} +1 -1
  65. package/static/assets/{circle-x-DdTsJYO7.js → circle-x-D58MbKgZ.js} +1 -1
  66. package/static/assets/{clipboard-BNXOfcye.js → clipboard-BFF6-pdC.js} +1 -1
  67. package/static/assets/{clock-BTCBJF7v.js → clock-B-uSJOTR.js} +1 -1
  68. package/static/assets/{download-BaYIFjpj.js → download-DrQn0jny.js} +1 -1
  69. package/static/assets/{eye-CuSCp49Y.js → eye-BcjteMts.js} +1 -1
  70. package/static/assets/{folder-git-2-CiVM8o0Y.js → folder-git-2-B_ezHf_E.js} +1 -1
  71. package/static/assets/index-B0JO3x3V.js +458 -0
  72. package/static/assets/index-C8p-lTq9.css +2 -0
  73. package/static/assets/label-BHOOQ99D.js +1 -0
  74. package/static/assets/{markdown-editor-DvlGlqU9.js → markdown-editor-B0i_LOAR.js} +1 -1
  75. package/static/assets/{pause-COIsHZIp.js → pause-DqQ7Twc6.js} +1 -1
  76. package/static/assets/{play-a8BsF4gF.js → play-Y2N8OVBu.js} +1 -1
  77. package/static/assets/{plus-Bon5P_OK.js → plus-D737EJ5S.js} +1 -1
  78. package/static/assets/radio-group-nRRUTZ_w.js +1 -0
  79. package/static/assets/{refresh-cw-CnHMzcH3.js → refresh-cw-uBnPtZwp.js} +1 -1
  80. package/static/assets/registry-ANRa5WBi.js +1 -0
  81. package/static/assets/{search-BR37JgJ3.js → search-cntvIhnF.js} +1 -1
  82. package/static/assets/{switch-D86f4WeD.js → switch-BYf9VEgx.js} +1 -1
  83. package/static/assets/{tabs-BYrDWPwx.js → tabs-BnsC3AY5.js} +1 -1
  84. package/static/assets/{tag--U3Nuedb.js → tag-C_HL28Xd.js} +1 -1
  85. package/static/assets/{terminal-preview-Be68j_3t.js → terminal-preview-Qv4UvCJz.js} +1 -1
  86. package/static/assets/{use-terminal-2DGl8X5T.js → use-terminal-5sW1t6SD.js} +1 -1
  87. package/static/assets/{zap-C0eIGEl_.js → zap-CrLPiVyl.js} +1 -1
  88. package/static/index.html +2 -2
  89. package/static/assets/McpSettingsPage-DcJIlHEi.js +0 -1
  90. package/static/assets/ResourcesPage-Bq9t872V.js +0 -66
  91. package/static/assets/browser-modal-x3ise3M1.js +0 -6
  92. package/static/assets/index-B8vejVRZ.js +0 -458
  93. package/static/assets/index-CKwmN6yL.css +0 -2
  94. package/static/assets/label-DtNTh--4.js +0 -1
  95. package/static/assets/radio-group-DpJuX02X.js +0 -1
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-B8vejVRZ.js";/**
1
+ import{c as e}from"./index-B0JO3x3V.js";/**
2
2
  * @license lucide-react v0.542.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-B8vejVRZ.js";/**
1
+ import{c as a}from"./index-B0JO3x3V.js";/**
2
2
  * @license lucide-react v0.542.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-B8vejVRZ.js";/**
1
+ import{c as e}from"./index-B0JO3x3V.js";/**
2
2
  * @license lucide-react v0.542.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1 @@
1
+ import{r as n,b8 as E,aq as K,ak as T,j as a,al as N,b9 as U,ao as x,ap as w,ba as V,an as g,bb as z,at as H,as as $,f as I,bc as W}from"./index-B0JO3x3V.js";var C="Radio",[X,k]=N(C),[Y,J]=X(C),_=n.forwardRef((r,t)=>{const{__scopeRadio:e,name:c,checked:o=!1,required:s,disabled:i,value:p="on",onCheck:f,form:R,...v}=r,[l,m]=n.useState(null),d=w(t,y=>m(y)),u=n.useRef(!1),b=l?R||!!l.closest("form"):!0;return a.jsxs(Y,{scope:e,checked:o,disabled:i,children:[a.jsx(x.button,{type:"button",role:"radio","aria-checked":o,"data-state":S(o),"data-disabled":i?"":void 0,disabled:i,value:p,...v,ref:d,onClick:g(r.onClick,y=>{o||f?.(),b&&(u.current=y.isPropagationStopped(),u.current||y.stopPropagation())})}),b&&a.jsx(P,{control:l,bubbles:!u.current,name:c,value:p,checked:o,required:s,disabled:i,form:R,style:{transform:"translateX(-100%)"}})]})});_.displayName=C;var j="RadioIndicator",G=n.forwardRef((r,t)=>{const{__scopeRadio:e,forceMount:c,...o}=r,s=J(j,e);return a.jsx(z,{present:c||s.checked,children:a.jsx(x.span,{"data-state":S(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:t})})});G.displayName=j;var Q="RadioBubbleInput",P=n.forwardRef(({__scopeRadio:r,control:t,checked:e,bubbles:c=!0,...o},s)=>{const i=n.useRef(null),p=w(i,s),f=H(e),R=$(t);return n.useEffect(()=>{const v=i.current;if(!v)return;const l=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(l,"checked").set;if(f!==e&&d){const u=new Event("click",{bubbles:c});d.call(v,e),v.dispatchEvent(u)}},[f,e,c]),a.jsx(x.input,{type:"radio","aria-hidden":!0,defaultChecked:e,...o,tabIndex:-1,ref:p,style:{...o.style,...R,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});P.displayName=Q;function S(r){return r?"checked":"unchecked"}var Z=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],h="RadioGroup",[ee,ce]=N(h,[E,k]),A=E(),D=k(),[oe,re]=ee(h),M=n.forwardRef((r,t)=>{const{__scopeRadioGroup:e,name:c,defaultValue:o,value:s,required:i=!1,disabled:p=!1,orientation:f,dir:R,loop:v=!0,onValueChange:l,...m}=r,d=A(e),u=K(R),[b,y]=T({prop:s,defaultProp:o??null,onChange:l,caller:h});return a.jsx(oe,{scope:e,name:c,required:i,disabled:p,value:b,onValueChange:y,children:a.jsx(U,{asChild:!0,...d,orientation:f,dir:u,loop:v,children:a.jsx(x.div,{role:"radiogroup","aria-required":i,"aria-orientation":f,"data-disabled":p?"":void 0,dir:u,...m,ref:t})})})});M.displayName=h;var O="RadioGroupItem",q=n.forwardRef((r,t)=>{const{__scopeRadioGroup:e,disabled:c,...o}=r,s=re(O,e),i=s.disabled||c,p=A(e),f=D(e),R=n.useRef(null),v=w(t,R),l=s.value===o.value,m=n.useRef(!1);return n.useEffect(()=>{const d=b=>{Z.includes(b.key)&&(m.current=!0)},u=()=>m.current=!1;return document.addEventListener("keydown",d),document.addEventListener("keyup",u),()=>{document.removeEventListener("keydown",d),document.removeEventListener("keyup",u)}},[]),a.jsx(V,{asChild:!0,...p,focusable:!i,active:l,children:a.jsx(_,{disabled:i,required:s.required,checked:l,...f,...o,name:s.name,ref:v,onCheck:()=>s.onValueChange(o.value),onKeyDown:g(d=>{d.key==="Enter"&&d.preventDefault()}),onFocus:g(o.onFocus,()=>{m.current&&R.current?.click()})})})});q.displayName=O;var ae="RadioGroupIndicator",F=n.forwardRef((r,t)=>{const{__scopeRadioGroup:e,...c}=r,o=D(e);return a.jsx(G,{...o,...c,ref:t})});F.displayName=ae;var L=M,B=q,te=F;const se=n.forwardRef(({className:r,...t},e)=>a.jsx(L,{className:I("grid gap-2",r),...t,ref:e}));se.displayName=L.displayName;const ne=n.forwardRef(({className:r,...t},e)=>a.jsx(B,{ref:e,className:I("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),...t,children:a.jsx(te,{className:"flex items-center justify-center",children:a.jsx(W,{className:"h-2.5 w-2.5 fill-current text-current"})})}));ne.displayName=B.displayName;export{se as R,ne as a};
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-B8vejVRZ.js";/**
1
+ import{c as e}from"./index-B0JO3x3V.js";/**
2
2
  * @license lucide-react v0.542.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1 @@
1
+ const n="https://registry.coconut.dev";async function s(t){const e=t.startsWith("http")?t:`${n}${t}`,r=await fetch(e,{headers:{Accept:"application/json","User-Agent":"coconut-frontend"}});if(!r.ok)throw new Error(`Failed to fetch registry resource: ${r.status}`);return r.json()}async function o(t){const e=`/registry/${t}/root.json`;return s(e)}async function c(t){return s(t)}export{n as R,o as a,c as f};
@@ -1,4 +1,4 @@
1
- import{c}from"./index-B8vejVRZ.js";/**
1
+ import{c}from"./index-B0JO3x3V.js";/**
2
2
  * @license lucide-react v0.542.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{r as c,j as e,f as i}from"./index-B8vejVRZ.js";const d=c.forwardRef(({className:s,onCheckedChange:r,onChange:t,...o},n)=>{const l=a=>{t?.(a),r?.(a.target.checked)};return e.jsxs("label",{className:i("relative inline-flex cursor-pointer",s),children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",onChange:l,ref:n,...o}),e.jsx("div",{className:"block bg-gray-300 w-9 h-5 rounded-full transition-colors duration-200 ease-in-out peer-checked:bg-blue-600"}),e.jsx("div",{className:"absolute left-0 top-0 bg-white w-4 h-4 rounded-full mt-0.5 ml-0.5 transition-transform duration-200 ease-in-out transform peer-checked:translate-x-4 shadow"})]})});d.displayName="Switch";export{d as S};
1
+ import{r as c,j as e,f as i}from"./index-B0JO3x3V.js";const d=c.forwardRef(({className:s,onCheckedChange:r,onChange:t,...o},n)=>{const l=a=>{t?.(a),r?.(a.target.checked)};return e.jsxs("label",{className:i("relative inline-flex cursor-pointer",s),children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",onChange:l,ref:n,...o}),e.jsx("div",{className:"block bg-gray-300 w-9 h-5 rounded-full transition-colors duration-200 ease-in-out peer-checked:bg-blue-600"}),e.jsx("div",{className:"absolute left-0 top-0 bg-white w-4 h-4 rounded-full mt-0.5 ml-0.5 transition-transform duration-200 ease-in-out transform peer-checked:translate-x-4 shadow"})]})});d.displayName="Switch";export{d as S};
@@ -1 +1 @@
1
- import{r as l,a$ as F,b0 as $,j as c,b1 as D,bc as V,b3 as g,a_ as y,b2 as k,b5 as G,b6 as m,b7 as L,f as T}from"./index-B8vejVRZ.js";var p="Tabs",[K,Q]=D(p,[y]),h=y(),[B,x]=K(p),N=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,onValueChange:r,defaultValue:d,orientation:n="horizontal",dir:u,activationMode:f="automatic",...v}=e,i=F(u),[s,b]=$({prop:o,onChange:r,defaultProp:d??"",caller:p});return c.jsx(B,{scope:t,baseId:V(),value:s,onValueChange:b,orientation:n,dir:i,activationMode:f,children:c.jsx(g.div,{dir:i,"data-orientation":n,...v,ref:a})})});N.displayName=p;var C="TabsList",I=l.forwardRef((e,a)=>{const{__scopeTabs:t,loop:o=!0,...r}=e,d=x(C,t),n=h(t);return c.jsx(k,{asChild:!0,...n,orientation:d.orientation,dir:d.dir,loop:o,children:c.jsx(g.div,{role:"tablist","aria-orientation":d.orientation,...r,ref:a})})});I.displayName=C;var R="TabsTrigger",j=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,disabled:r=!1,...d}=e,n=x(R,t),u=h(t),f=A(n.baseId,o),v=E(n.baseId,o),i=o===n.value;return c.jsx(G,{asChild:!0,...u,focusable:!r,active:i,children:c.jsx(g.button,{type:"button",role:"tab","aria-selected":i,"aria-controls":v,"data-state":i?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:f,...d,ref:a,onMouseDown:m(e.onMouseDown,s=>{!r&&s.button===0&&s.ctrlKey===!1?n.onValueChange(o):s.preventDefault()}),onKeyDown:m(e.onKeyDown,s=>{[" ","Enter"].includes(s.key)&&n.onValueChange(o)}),onFocus:m(e.onFocus,()=>{const s=n.activationMode!=="manual";!i&&!r&&s&&n.onValueChange(o)})})})});j.displayName=R;var w="TabsContent",_=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,forceMount:r,children:d,...n}=e,u=x(w,t),f=A(u.baseId,o),v=E(u.baseId,o),i=o===u.value,s=l.useRef(i);return l.useEffect(()=>{const b=requestAnimationFrame(()=>s.current=!1);return()=>cancelAnimationFrame(b)},[]),c.jsx(L,{present:r||i,children:({present:b})=>c.jsx(g.div,{"data-state":i?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":f,hidden:!b,id:v,tabIndex:0,...n,ref:a,style:{...e.style,animationDuration:s.current?"0s":void 0},children:b&&d})})});_.displayName=w;function A(e,a){return`${e}-trigger-${a}`}function E(e,a){return`${e}-content-${a}`}var q=N,S=I,M=j,P=_;const U=q,z=l.forwardRef(({className:e,...a},t)=>c.jsx(S,{ref:t,className:T("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...a}));z.displayName=S.displayName;const H=l.forwardRef(({className:e,...a},t)=>c.jsx(M,{ref:t,className:T("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...a}));H.displayName=M.displayName;const O=l.forwardRef(({className:e,...a},t)=>c.jsx(P,{ref:t,className:T("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...a}));O.displayName=P.displayName;export{U as T,z as a,H as b,O as c};
1
+ import{r as l,aq as F,ak as $,j as c,al as k,be as D,ao as g,b8 as y,b9 as V,ba as G,an as m,bb as L,f as T}from"./index-B0JO3x3V.js";var p="Tabs",[K,Q]=k(p,[y]),h=y(),[q,x]=K(p),N=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,onValueChange:r,defaultValue:d,orientation:n="horizontal",dir:u,activationMode:f="automatic",...v}=e,i=F(u),[s,b]=$({prop:o,onChange:r,defaultProp:d??"",caller:p});return c.jsx(q,{scope:t,baseId:D(),value:s,onValueChange:b,orientation:n,dir:i,activationMode:f,children:c.jsx(g.div,{dir:i,"data-orientation":n,...v,ref:a})})});N.displayName=p;var C="TabsList",I=l.forwardRef((e,a)=>{const{__scopeTabs:t,loop:o=!0,...r}=e,d=x(C,t),n=h(t);return c.jsx(V,{asChild:!0,...n,orientation:d.orientation,dir:d.dir,loop:o,children:c.jsx(g.div,{role:"tablist","aria-orientation":d.orientation,...r,ref:a})})});I.displayName=C;var R="TabsTrigger",j=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,disabled:r=!1,...d}=e,n=x(R,t),u=h(t),f=A(n.baseId,o),v=E(n.baseId,o),i=o===n.value;return c.jsx(G,{asChild:!0,...u,focusable:!r,active:i,children:c.jsx(g.button,{type:"button",role:"tab","aria-selected":i,"aria-controls":v,"data-state":i?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:f,...d,ref:a,onMouseDown:m(e.onMouseDown,s=>{!r&&s.button===0&&s.ctrlKey===!1?n.onValueChange(o):s.preventDefault()}),onKeyDown:m(e.onKeyDown,s=>{[" ","Enter"].includes(s.key)&&n.onValueChange(o)}),onFocus:m(e.onFocus,()=>{const s=n.activationMode!=="manual";!i&&!r&&s&&n.onValueChange(o)})})})});j.displayName=R;var w="TabsContent",_=l.forwardRef((e,a)=>{const{__scopeTabs:t,value:o,forceMount:r,children:d,...n}=e,u=x(w,t),f=A(u.baseId,o),v=E(u.baseId,o),i=o===u.value,s=l.useRef(i);return l.useEffect(()=>{const b=requestAnimationFrame(()=>s.current=!1);return()=>cancelAnimationFrame(b)},[]),c.jsx(L,{present:r||i,children:({present:b})=>c.jsx(g.div,{"data-state":i?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":f,hidden:!b,id:v,tabIndex:0,...n,ref:a,style:{...e.style,animationDuration:s.current?"0s":void 0},children:b&&d})})});_.displayName=w;function A(e,a){return`${e}-trigger-${a}`}function E(e,a){return`${e}-content-${a}`}var B=N,S=I,M=j,P=_;const U=B,z=l.forwardRef(({className:e,...a},t)=>c.jsx(S,{ref:t,className:T("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...a}));z.displayName=S.displayName;const H=l.forwardRef(({className:e,...a},t)=>c.jsx(M,{ref:t,className:T("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...a}));H.displayName=M.displayName;const O=l.forwardRef(({className:e,...a},t)=>c.jsx(P,{ref:t,className:T("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...a}));O.displayName=P.displayName;export{U as T,z as a,H as b,O as c};
@@ -1,4 +1,4 @@
1
- import{c}from"./index-B8vejVRZ.js";/**
1
+ import{c}from"./index-B0JO3x3V.js";/**
2
2
  * @license lucide-react v0.542.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as p,r as e,ab as S,j as u}from"./index-B8vejVRZ.js";import{x as F,a as N}from"./xterm-DTxiCjtJ.js";/**
1
+ import{c as p,r as e,ab as S,j as u}from"./index-B0JO3x3V.js";import{x as F,a as N}from"./xterm-DTxiCjtJ.js";/**
2
2
  * @license lucide-react v0.542.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{r as i,ag as b,A as f}from"./index-B8vejVRZ.js";function j(){const[y,u]=i.useState([]),[g,c]=i.useState(!1),[m,o]=i.useState(null),{refresh:p}=b(),d=i.useCallback(async(s,n,r)=>{try{c(!0),o(null);const e=await fetch(`${f}/api/v1/terminal/${s}/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enableLogging:n||!1,startupCommand:r})});if(!e.ok){const a=await e.json();throw new Error(a.error||"Failed to create terminal session")}const t=await e.json();return await p(),t.sessionId}catch(e){const t=e instanceof Error?e.message:"Unknown error";return o(t),null}finally{c(!1)}},[p]),S=i.useCallback(async s=>{try{c(!0),o(null);let n;if(s.startsWith("session-")){const e=s.split("-");n=`${e[0]}-${e[1]}`}else{const e=s.split("-");n=`${e[0]}-${e[1]}`}const r=await fetch(`${f}/api/v1/terminal/${n}/destroy`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s})});if(!r.ok){const e=await r.json();throw new Error(e.error||"Failed to destroy terminal session")}return u(e=>e.filter(t=>t.id!==s)),await p(),!0}catch(n){const r=n instanceof Error?n.message:"Unknown error";return o(r),!1}finally{c(!1)}},[p]),$=i.useCallback(async(s,n,r)=>{try{o(null);let e;if(s.startsWith("session-")){const a=s.split("-");e=`${a[0]}-${a[1]}`}else{const a=s.split("-");e=`${a[0]}-${a[1]}`}const t=await fetch(`${f}/api/v1/terminal/${e}/resize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s,cols:n,rows:r})});if(!t.ok){const a=await t.json();throw new Error(a.error||"Failed to resize terminal session")}return!0}catch(e){const t=e instanceof Error?e.message:"Unknown error";return o(t),!1}},[]),k=i.useCallback(async(s,n,r)=>{try{c(!0),o(null);const e=new URLSearchParams;s&&e.set("proposalId",s),n&&(e.set("withPreview","true"),r&&Number.isFinite(r)&&e.set("lines",String(r)));const t=`${f}/api/v1/terminal/sessions${e.toString()?`?${e.toString()}`:""}`,a=await fetch(t);if(!a.ok){const l=await a.json();throw new Error(l.error||"Failed to fetch terminal sessions")}const w=await a.json();u(w.sessions)}catch(e){const t=e instanceof Error?e.message:"Unknown error";o(t)}finally{c(!1)}},[]),E=i.useCallback(async(s,n=8)=>{try{o(null);const r=new URLSearchParams;r.set("sessionId",s),r.set("withPreview","true"),r.set("lines",String(n)),r.set("colorize","true");const e=`${f}/api/v1/terminal/sessions?${r.toString()}`,t=await fetch(e);if(!t.ok){const l=await t.json().catch(()=>({}));throw new Error(l.error||"Failed to fetch preview")}const a=await t.json(),w=Array.isArray(a?.sessions)&&a.sessions[0]?.preview?a.sessions[0].preview:[];return u(l=>l.map(h=>h.id===s?{...h,preview:w}:h)),w}catch(r){const e=r instanceof Error?r.message:"Unknown error";return o(e),[]}},[]);return{sessions:y,loading:g,error:m,createSession:d,destroySession:S,resizeSession:$,refreshSessions:k,fetchPreview:E}}export{j as u};
1
+ import{r as i,ag as b,A as f}from"./index-B0JO3x3V.js";function j(){const[y,u]=i.useState([]),[g,c]=i.useState(!1),[m,o]=i.useState(null),{refresh:p}=b(),d=i.useCallback(async(s,n,r)=>{try{c(!0),o(null);const e=await fetch(`${f}/api/v1/terminal/${s}/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enableLogging:n||!1,startupCommand:r})});if(!e.ok){const a=await e.json();throw new Error(a.error||"Failed to create terminal session")}const t=await e.json();return await p(),t.sessionId}catch(e){const t=e instanceof Error?e.message:"Unknown error";return o(t),null}finally{c(!1)}},[p]),S=i.useCallback(async s=>{try{c(!0),o(null);let n;if(s.startsWith("session-")){const e=s.split("-");n=`${e[0]}-${e[1]}`}else{const e=s.split("-");n=`${e[0]}-${e[1]}`}const r=await fetch(`${f}/api/v1/terminal/${n}/destroy`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s})});if(!r.ok){const e=await r.json();throw new Error(e.error||"Failed to destroy terminal session")}return u(e=>e.filter(t=>t.id!==s)),await p(),!0}catch(n){const r=n instanceof Error?n.message:"Unknown error";return o(r),!1}finally{c(!1)}},[p]),$=i.useCallback(async(s,n,r)=>{try{o(null);let e;if(s.startsWith("session-")){const a=s.split("-");e=`${a[0]}-${a[1]}`}else{const a=s.split("-");e=`${a[0]}-${a[1]}`}const t=await fetch(`${f}/api/v1/terminal/${e}/resize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s,cols:n,rows:r})});if(!t.ok){const a=await t.json();throw new Error(a.error||"Failed to resize terminal session")}return!0}catch(e){const t=e instanceof Error?e.message:"Unknown error";return o(t),!1}},[]),k=i.useCallback(async(s,n,r)=>{try{c(!0),o(null);const e=new URLSearchParams;s&&e.set("proposalId",s),n&&(e.set("withPreview","true"),r&&Number.isFinite(r)&&e.set("lines",String(r)));const t=`${f}/api/v1/terminal/sessions${e.toString()?`?${e.toString()}`:""}`,a=await fetch(t);if(!a.ok){const l=await a.json();throw new Error(l.error||"Failed to fetch terminal sessions")}const w=await a.json();u(w.sessions)}catch(e){const t=e instanceof Error?e.message:"Unknown error";o(t)}finally{c(!1)}},[]),E=i.useCallback(async(s,n=8)=>{try{o(null);const r=new URLSearchParams;r.set("sessionId",s),r.set("withPreview","true"),r.set("lines",String(n)),r.set("colorize","true");const e=`${f}/api/v1/terminal/sessions?${r.toString()}`,t=await fetch(e);if(!t.ok){const l=await t.json().catch(()=>({}));throw new Error(l.error||"Failed to fetch preview")}const a=await t.json(),w=Array.isArray(a?.sessions)&&a.sessions[0]?.preview?a.sessions[0].preview:[];return u(l=>l.map(h=>h.id===s?{...h,preview:w}:h)),w}catch(r){const e=r instanceof Error?r.message:"Unknown error";return o(e),[]}},[]);return{sessions:y,loading:g,error:m,createSession:d,destroySession:S,resizeSession:$,refreshSessions:k,fetchPreview:E}}export{j as u};
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-B8vejVRZ.js";/**
1
+ import{c as a}from"./index-B0JO3x3V.js";/**
2
2
  * @license lucide-react v0.542.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
package/static/index.html CHANGED
@@ -8,8 +8,8 @@
8
8
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
9
9
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap" rel="stylesheet">
10
10
  <title>Coconut - Agentic Development Environment</title>
11
- <script type="module" crossorigin src="/assets/index-B8vejVRZ.js"></script>
12
- <link rel="stylesheet" crossorigin href="/assets/index-CKwmN6yL.css">
11
+ <script type="module" crossorigin src="/assets/index-B0JO3x3V.js"></script>
12
+ <link rel="stylesheet" crossorigin href="/assets/index-C8p-lTq9.css">
13
13
  </head>
14
14
  <body class="font-inter">
15
15
  <div id="root"></div>
@@ -1 +0,0 @@
1
- import{j as e,S as ne,Y as E,r as f,aX as B,t as C,a1 as te,aV as ie,B as j,I as g,a0 as M,J as ae,T as oe,g as ce,ad as le}from"./index-B8vejVRZ.js";import{C as P,b as F,c as O,d as R,a as $}from"./card-CvaBJsG6.js";import{L as m}from"./label-DtNTh--4.js";import{B as J}from"./badge-NJasrAx_.js";import{S as I}from"./switch-D86f4WeD.js";import{A as q,a as z}from"./alert-BAeRxZ1d.js";import{R as de,a as me,L as he}from"./browser-modal-x3ise3M1.js";import{C as L}from"./circle-alert-61156jM6.js";import{P as Y}from"./plus-Bon5P_OK.js";import{C as xe}from"./circle-check-big-K_QMED_K.js";import"./search-BR37JgJ3.js";function U(r){if(r){if(Array.isArray(r)){const t=r.map(o=>{if(typeof o=="string")return o.trim();if(typeof o=="number")return`${o}`}).filter(o=>typeof o=="string"&&o.length>0);return t.length>0?t:void 0}if(typeof r=="string"){const t=r.split(",").map(o=>o.trim()).filter(o=>o.length>0);return t.length>0?t:void 0}}}function K(r,t){const o=r.name||t.name,h=t.description||r.description||"",i={registryId:r.id,registryEndpoint:r.endpoint,registrySource:de,author:r.author||t.author};(t.version||r.version)&&(i.version=t.version||r.version);const d=U(t.tags)||U(r.tags);d&&(i.tags=d),t.capabilities&&Array.isArray(t.capabilities)&&(i.capabilities=t.capabilities),t.requirements&&typeof t.requirements=="object"&&(i.requirements=t.requirements),t.links&&typeof t.links=="object"&&(i.links=t.links),t.metadata&&typeof t.metadata=="object"&&(i.mcpMetadata=t.metadata);for(const[a,v]of Object.entries(i))v==null&&delete i[a];return{name:o,command:t.configuration.command,args:t.configuration.args,env:t.configuration.env,enabled:!0,description:h,metadata:Object.keys(i).length>0?i:void 0}}async function ve(r){const t=r.startsWith("http")?r:`https://registry.coconut.dev${r}`,o=await fetch(t,{headers:{Accept:"application/json","User-Agent":"coconut-frontend"}});if(!o.ok)throw new Error(`Failed to fetch MCP server detail: ${o.status}`);return o.json()}function ge({open:r,onOpenChange:t,onImport:o}){return e.jsx(me,{open:r,onOpenChange:t,categoryId:"mcp-servers",title:"Coconut Registry – MCP Servers",confirmLabel:"Add Server",getDetail:h=>ve(h.endpoint),renderPreview:(h,i)=>{if(!i)return e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"Select an MCP server to preview"});const d=K(h,i),a=d.metadata??{},v=typeof a.version=="string"?a.version:void 0,N=Array.isArray(h.tags)?h.tags:[],S=Array.isArray(a.capabilities)?a.capabilities.filter(p=>typeof p=="string"):[];return e.jsx("div",{className:"h-full min-h-0 overflow-hidden rounded-md border",children:e.jsx(ne,{className:"h-full",children:e.jsx("div",{className:"space-y-6 p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:h.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.description})]}),v&&e.jsxs(J,{variant:"outline",children:["v",v]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Registry ID: ",e.jsx("span",{className:"font-mono",children:h.id})]}),N.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:N.map(p=>e.jsx(J,{variant:"secondary",children:p},p))}),e.jsxs("div",{className:"space-y-2 rounded-md border p-3 bg-muted/50",children:[e.jsx("div",{className:"text-sm font-medium",children:"Configuration"}),e.jsxs("div",{className:"space-y-1 text-sm font-mono",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Command:"})," ",e.jsx("span",{className:"text-foreground",children:d.command})]}),d.args&&d.args.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Args:"})," ",e.jsx("span",{className:"text-foreground",children:d.args.join(" ")})]}),d.env&&Object.keys(d.env).length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Env:"})," ",e.jsx("span",{className:"text-foreground",children:JSON.stringify(d.env)})]})]})]}),S.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-medium",children:"Capabilities"}),e.jsx("ul",{className:"list-disc pl-5 text-sm text-muted-foreground space-y-1",children:S.map(p=>e.jsx("li",{children:p},p))})]}),i.documentation&&e.jsxs("div",{className:"space-y-3",children:[i.documentation.overview&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Overview"}),e.jsx(E,{className:"[&_.prose]:max-w-none text-sm",children:i.documentation.overview})]}),i.documentation.installation&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Installation"}),e.jsx(E,{className:"[&_.prose]:max-w-none text-sm",children:i.documentation.installation})]}),i.documentation.usage&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Usage"}),e.jsx(E,{className:"[&_.prose]:max-w-none text-sm",children:i.documentation.usage})]}),i.documentation.examples&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Examples"}),e.jsx(E,{className:"[&_.prose]:max-w-none text-sm",children:i.documentation.examples})]})]})]})})})})},onConfirm:async(h,i)=>{const d=K(h,i);await o({summary:h,detail:i,payload:d})}})}function Ae(){const[r,t]=f.useState({}),[o,h]=f.useState(!0),[i,d]=f.useState(!1),[a,v]=f.useState({name:"",command:"",args:"",env:"",description:"",enabled:!0}),[N,S]=f.useState(!1),[p,A]=f.useState(null),[c,b]=f.useState({name:"",command:"",args:"",env:"",description:"",enabled:!0}),[V,T]=f.useState(!1);f.useEffect(()=>{_()},[]);const _=async()=>{try{h(!0);const s=await B("/api/v1/mcp/raw-config");t(s||{})}catch(s){console.error("Failed to load MCP config:",s),C({title:"Error",description:"Failed to load MCP configuration",variant:"destructive"})}finally{h(!1)}},w=async s=>{try{d(!0),await B("/api/v1/mcp/raw-config",{method:"PUT",body:JSON.stringify(s)}),t(s),C({title:"Success",description:"MCP configuration saved successfully"})}catch(n){console.error("Failed to save MCP config:",n),C({title:"Error",description:"Failed to save MCP configuration",variant:"destructive"})}finally{d(!1)}},G=()=>{if(!a.name||!a.command){C({title:"Error",description:"Server name and command are required",variant:"destructive"});return}const s={name:a.name,command:a.command,enabled:a.enabled,description:a.description||void 0};if(a.args.trim()&&(s.args=a.args.split(" ").filter(x=>x.trim())),a.env.trim())try{s.env=JSON.parse(a.env)}catch{C({title:"Error",description:"Invalid JSON format for environment variables",variant:"destructive"});return}const n={...r,mcpServers:{...r.mcpServers,[a.name]:s}};w(n),v({name:"",command:"",args:"",env:"",description:"",enabled:!0}),S(!1)},H=(s,n)=>{const x={...r,mcpServers:{...r.mcpServers,[s]:{...r.mcpServers[s],enabled:n}}};w(x)},W=s=>{const{[s]:n,...x}=r.mcpServers||{},y={...r,mcpServers:x};w(y)},X=s=>{const n=r.mcpServers?.[s];n&&(b({name:n.name||s,command:n.command,args:n.args?.join(" ")||"",env:n.env?JSON.stringify(n.env,null,2):"",description:n.description||"",enabled:n.enabled!==!1}),A(s))},Q=s=>{if(!c.command){C({title:"Error",description:"Command is required",variant:"destructive"});return}const n={name:c.name,command:c.command,enabled:c.enabled,description:c.description||void 0};if(c.args.trim()&&(n.args=c.args.split(" ").filter(l=>l.trim())),c.env.trim())try{n.env=JSON.parse(c.env)}catch{C({title:"Error",description:"Invalid JSON format for environment variables",variant:"destructive"});return}const{[s]:x,...y}=r.mcpServers||{},u={...r,mcpServers:{...y,[s]:n}};w(u),A(null)},Z=()=>{A(null),b({name:"",command:"",args:"",env:"",description:"",enabled:!0})},k=s=>{const n={...r,globalSettings:{...r.globalSettings,...s}};w(n)},ee=async s=>{const{payload:n}=s;let x=n.name.toLowerCase().replace(/\s+/g,"-");const y=r.mcpServers||{};let u=x,l=1;for(;y[u];)u=`${x}-${l}`,l++;const se={name:u,command:n.command,args:n.args,env:n.env,enabled:n.enabled!==!1,description:n.description},re={...r,mcpServers:{...r.mcpServers,[u]:se}};await w(re),C({title:"Success",description:`MCP server "${u}" added from registry`})};if(o)return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"MCP Settings"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading configuration..."})]})});const D=r.mcpServers||{};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"MCP Settings"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure Model Context Protocol servers and settings."})]}),e.jsx(te,{}),Object.keys(D).length===0&&!N&&e.jsxs(q,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsx(z,{children:"No MCP servers configured yet. Add your first server to get started."})]}),e.jsxs(P,{children:[e.jsx(F,{children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsxs(O,{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"h-5 w-5"}),"MCP Servers"]}),e.jsx(R,{className:"hidden sm:block",children:"Configure and manage Model Context Protocol servers for enhanced AI capabilities."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(j,{size:"sm",variant:"outline",onClick:()=>T(!0),children:[e.jsx(he,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Registry"})]}),e.jsxs(j,{size:"sm",onClick:()=>S(!N),variant:N?"outline":"default",children:[e.jsx(Y,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:N?"Cancel":"Add Server"})]})]})]})}),e.jsxs($,{children:[N&&e.jsxs("div",{className:"space-y-4 p-3 sm:p-4 border rounded-lg mb-4",children:[e.jsx("h4",{className:"font-medium",children:"Add MCP Server"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverName",children:"Server Name"}),e.jsx(g,{id:"serverName",value:a.name,onChange:s=>v({...a,name:s.target.value}),placeholder:"e.g., filesystem-server"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverCommand",children:"Command"}),e.jsx(g,{id:"serverCommand",value:a.command,onChange:s=>v({...a,command:s.target.value}),placeholder:"e.g., npx @modelcontextprotocol/server-filesystem"})]})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverArgs",children:"Arguments (space-separated)"}),e.jsx(g,{id:"serverArgs",value:a.args,onChange:s=>v({...a,args:s.target.value}),placeholder:"e.g., /path/to/allowed/directory"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverEnv",children:"Environment Variables (JSON format)"}),e.jsx(M,{id:"serverEnv",value:a.env,onChange:s=>v({...a,env:s.target.value}),placeholder:'{"KEY": "value", "ANOTHER_KEY": "another_value"}',rows:3})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"serverDescription",children:"Description (optional)"}),e.jsx(g,{id:"serverDescription",value:a.description,onChange:s=>v({...a,description:s.target.value}),placeholder:"Brief description of what this server provides"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(I,{id:"serverEnabled",checked:a.enabled,onCheckedChange:s=>v({...a,enabled:s})}),e.jsx(m,{htmlFor:"serverEnabled",children:"Enable server"})]}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsxs(j,{onClick:G,disabled:i,children:[e.jsx(Y,{className:"h-4 w-4 mr-2"}),"Add Server"]}),e.jsx(j,{variant:"outline",onClick:()=>S(!1),children:"Cancel"})]})]}),e.jsx("div",{className:"space-y-4",children:Object.entries(D).map(([s,n])=>{const x=n.enabled!==!1,y=n.name||s,u=p===s;return e.jsx("div",{className:"border rounded-lg",children:u?e.jsxs("div",{className:"space-y-4 p-3 sm:p-4",children:[e.jsx("h4",{className:"font-medium",children:"Edit MCP Server"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-name-${s}`,children:"Server Name"}),e.jsx(g,{id:`edit-name-${s}`,value:c.name,onChange:l=>b({...c,name:l.target.value}),placeholder:"e.g., filesystem-server"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-command-${s}`,children:"Command"}),e.jsx(g,{id:`edit-command-${s}`,value:c.command,onChange:l=>b({...c,command:l.target.value}),placeholder:"e.g., npx @modelcontextprotocol/server-filesystem"})]})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-args-${s}`,children:"Arguments (space-separated)"}),e.jsx(g,{id:`edit-args-${s}`,value:c.args,onChange:l=>b({...c,args:l.target.value}),placeholder:"e.g., /path/to/allowed/directory"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-env-${s}`,children:"Environment Variables (JSON format)"}),e.jsx(M,{id:`edit-env-${s}`,value:c.env,onChange:l=>b({...c,env:l.target.value}),placeholder:'{"KEY": "value", "ANOTHER_KEY": "another_value"}',rows:3})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:`edit-description-${s}`,children:"Description (optional)"}),e.jsx(g,{id:`edit-description-${s}`,value:c.description,onChange:l=>b({...c,description:l.target.value}),placeholder:"Brief description of what this server provides"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(I,{id:`edit-enabled-${s}`,checked:c.enabled,onCheckedChange:l=>b({...c,enabled:l})}),e.jsx(m,{htmlFor:`edit-enabled-${s}`,children:"Enable server"})]}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(j,{onClick:()=>Q(s),disabled:i,children:"Save Changes"}),e.jsx(j,{variant:"outline",onClick:Z,children:"Cancel"})]})]}):e.jsx("div",{className:"p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[x?e.jsx(xe,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"}):e.jsx(L,{className:"h-4 w-4 text-gray-400 shrink-0 mt-0.5"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h4",{className:"font-medium text-sm sm:text-base",children:y}),e.jsx(J,{variant:x?"default":"secondary",className:"text-xs",children:x?"Enabled":"Disabled"})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:n.description||n.command}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:[e.jsx("span",{className:"font-medium",children:"Command:"})," ",n.command," ",n.args?.join(" ")]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 sm:gap-2 shrink-0",children:[e.jsx(I,{checked:x,onCheckedChange:l=>H(s,l),disabled:i}),e.jsx(j,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>X(s),children:e.jsx(ae,{className:"h-4 w-4"})}),e.jsx(j,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>W(s),disabled:i,children:e.jsx(oe,{className:"h-4 w-4"})})]})]})})},s)})})]})]}),e.jsxs(P,{children:[e.jsxs(F,{children:[e.jsxs(O,{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"h-5 w-5"}),"Configuration File"]}),e.jsxs(R,{children:["The MCP configuration is stored in ",e.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:".nut/mcp/config.json"})]})]}),e.jsxs($,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"configJson",children:"Current Configuration (JSON)"}),e.jsx(M,{id:"configJson",value:JSON.stringify(r,null,2),readOnly:!0,rows:12,className:"font-mono text-sm",placeholder:"Loading configuration..."}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"This is a read-only view of the current configuration. Use the forms above to make changes."})]}),e.jsxs(q,{children:[e.jsx(L,{className:"h-4 w-4"}),e.jsx(z,{children:"Configuration changes are automatically saved to the MCP config file. This file can also be edited manually if you prefer working with JSON directly."})]})]})]}),e.jsxs(P,{children:[e.jsxs(F,{children:[e.jsxs(O,{className:"flex items-center gap-2",children:[e.jsx(le,{className:"h-5 w-5"}),"Global Settings"]}),e.jsx(R,{children:"Configure global MCP behavior and connection settings."})]}),e.jsx($,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"timeout",children:"Connection Timeout (ms)"}),e.jsx(g,{id:"timeout",type:"number",value:r.globalSettings?.timeout||3e4,onChange:s=>k({timeout:parseInt(s.target.value)}),placeholder:"30000"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"retryAttempts",children:"Retry Attempts"}),e.jsx(g,{id:"retryAttempts",type:"number",value:r.globalSettings?.retryAttempts||3,onChange:s=>k({retryAttempts:parseInt(s.target.value)}),placeholder:"3"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"logLevel",children:"Log Level"}),e.jsxs("select",{id:"logLevel",className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",value:r.globalSettings?.logLevel||"info",onChange:s=>k({logLevel:s.target.value}),children:[e.jsx("option",{value:"debug",children:"Debug"}),e.jsx("option",{value:"info",children:"Info"}),e.jsx("option",{value:"warn",children:"Warning"}),e.jsx("option",{value:"error",children:"Error"})]})]})]})})]}),e.jsx("div",{className:"flex justify-end space-x-2",children:e.jsx(j,{variant:"outline",onClick:_,disabled:o,children:"Reload Configuration"})}),e.jsx(ge,{open:V,onOpenChange:T,onImport:ee})]})}export{Ae as default};
@@ -1,66 +0,0 @@
1
- import{c as F,r as n,j as e,D as le,a as ne,b as re,d as ie,S as Fe,B as m,ah as Me,H as He,A as E,n as ee,aj as we,a0 as be,v as T,w as I,x as D,y as L,z as U,ac as Pe,ai as qe,X as Je,C as Ye,g as te,ak as Ne,al as Xe,am as Ze,an as es,e as Te,T as Ie,I as De,ao as ss}from"./index-B8vejVRZ.js";import{C as je,b as Le,a as ve,c as as,d as ts}from"./card-CvaBJsG6.js";import{L as u}from"./label-DtNTh--4.js";import{B as ye}from"./badge-NJasrAx_.js";import{c as ls}from"./clipboard-B9ndUJKl.js";import{D as ke}from"./download-BaYIFjpj.js";import{C as ns}from"./chevron-left-CaZHWPr-.js";import{C as rs}from"./calendar-wiZSxCBM.js";import{P as Ue}from"./plus-Bon5P_OK.js";import{S as is}from"./search-BR37JgJ3.js";/**
2
- * @license lucide-react v0.542.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const os=[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]],Ee=F("file-audio",os);/**
7
- * @license lucide-react v0.542.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const cs=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]],Ce=F("file-code",cs);/**
12
- * @license lucide-react v0.542.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const ds=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],Re=F("file-image",ds);/**
17
- * @license lucide-react v0.542.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const ms=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],_e=F("file-json",ms);/**
22
- * @license lucide-react v0.542.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */const hs=[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],$e=F("file-play",hs);/**
27
- * @license lucide-react v0.542.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const us=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],ze=F("file-spreadsheet",us);/**
32
- * @license lucide-react v0.542.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */const xs=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 13v-1h6v1",key:"1bb014"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M11 18h2",key:"12mj7e"}]],Oe=F("file-type",xs);/**
37
- * @license lucide-react v0.542.0 - ISC
38
- *
39
- * This source code is licensed under the ISC license.
40
- * See the LICENSE file in the root directory of this source tree.
41
- */const ps=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],fs=F("hard-drive",ps);/**
42
- * @license lucide-react v0.542.0 - ISC
43
- *
44
- * This source code is licensed under the ISC license.
45
- * See the LICENSE file in the root directory of this source tree.
46
- */const gs=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],oe=F("image",gs);/**
47
- * @license lucide-react v0.542.0 - ISC
48
- *
49
- * This source code is licensed under the ISC license.
50
- * See the LICENSE file in the root directory of this source tree.
51
- */const js=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],Ve=F("music",js);/**
52
- * @license lucide-react v0.542.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */const vs=[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]],Ae=F("presentation",vs);/**
57
- * @license lucide-react v0.542.0 - ISC
58
- *
59
- * This source code is licensed under the ISC license.
60
- * See the LICENSE file in the root directory of this source tree.
61
- */const ws=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],bs=F("upload",ws);/**
62
- * @license lucide-react v0.542.0 - ISC
63
- *
64
- * This source code is licensed under the ISC license.
65
- * See the LICENSE file in the root directory of this source tree.
66
- */const Ns=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],ys=F("video",Ns),xe=[{id:"example-1",prompt:"A serene Japanese garden at dawn, with cherry blossoms falling gently onto a still koi pond. Morning mist rises from the water, and a traditional red wooden bridge arches gracefully in the background. Shot on medium format film with soft, diffused lighting.",imageUrl:"https://replicate.delivery/pbxt/O7kbtH7wgLIItlCyeWjm0fgPpx7OpGsT9VbYyxBXnfieVxQe/woman-by-car.jpg"},{id:"example-2",prompt:"Glossy candy-colored 3D letters in hot pink, electric orange, and lime green on a sun-drenched poolside patio with bold terrazzo tiles and vintage lounge chairs in turquoise and yellow. Shot on Kodachrome film with a Hasselblad 500C, warm golden afternoon sunlight, dramatic lens flare, punchy oversaturated colors.",imageUrl:"https://replicate.delivery/pbxt/LUSNRiITNZzwaVXiSAWYzDeMJDVgF64hxmfJY5LEXVgdFXKA/out-0.webp"},{id:"example-3",prompt:"A cozy coffee shop interior with exposed brick walls, warm Edison bulb lighting, and steam rising from freshly brewed espresso. Vintage wooden furniture, potted plants on windowsills, and rain gently pattering against large windows. Moody, intimate atmosphere.",imageUrl:"https://replicate.delivery/pbxt/IJbGk2DEcUPrq1x8z6Cg7MJsKRdYhAcEHCKlkMzxPLQfVaNA/out-0.webp"},{id:"example-4",prompt:"Futuristic neon-lit cityscape at night, towering skyscrapers with holographic advertisements, flying vehicles streaking through the sky leaving light trails. Cyberpunk aesthetic with rain-slicked streets reflecting vibrant pink and blue neon lights. Blade Runner inspired.",imageUrl:"https://replicate.delivery/pbxt/K1juSILfCPTmGRnl1gBOzZQS4gVj4YCuSHVJ8KjVPMDfXaNA/out-0.webp"},{id:"example-5",prompt:"A whimsical treehouse village suspended in an ancient forest, connected by rope bridges and spiral staircases. Warm lantern light glows from circular windows, fireflies dance in the twilight air, and moss covers the weathered wooden structures. Fantasy illustration style.",imageUrl:"https://replicate.delivery/pbxt/M2ndEILfCPTmGRnl1gBOzZQS4gVj4YCuSHVJ8KjVPMDfXaNA/out-0.webp"},{id:"example-6",prompt:"Minimalist product photography of a luxury perfume bottle on a marble surface. Soft directional lighting creates elegant shadows, with fresh white flowers blurred in the background. Clean, sophisticated aesthetic with subtle reflections.",imageUrl:"https://replicate.delivery/pbxt/N3oeJKMgDQUnHSnm2hCPaAST5hWk5ZDvTIWK9LkWQNEgYbOB/out-0.webp"},{id:"example-7",prompt:"An astronaut floating in the vastness of space, Earth visible in the background with swirling clouds and deep blue oceans. Stars scatter infinitely into the darkness. The astronaut's visor reflects distant galaxies. Photorealistic, awe-inspiring scale.",imageUrl:"https://replicate.delivery/pbxt/O4pfLMNhERVoITon3iDQbBTU6iXl6AEwUJXL0MlXROFhZcPC/out-0.webp"},{id:"example-8",prompt:"Delicious artisan pizza fresh from a wood-fired oven, with bubbling mozzarella, fresh basil leaves, and drizzled olive oil. Rustic wooden table background, natural lighting, steam rising from the crispy crust. Food photography, appetizing and warm.",imageUrl:"https://replicate.delivery/pbxt/P5qgMNOiFS5pJUpn4jERcCUV7jYm7BFxVKYM1NmYSPGiAdQD/out-0.webp"}];function ks({open:x,onOpenChange:C,onSelectExample:l}){const[d,b]=n.useState(xe.length>0?xe[0]:null),h=()=>{d&&(l(d.prompt),C(!1))},y=c=>{l(c.prompt),C(!1)};return e.jsx(le,{open:x,onOpenChange:C,children:e.jsxs(ne,{className:"max-w-[95vw] sm:max-w-[90vw] w-full sm:w-[90vw] max-h-[95vh] sm:max-h-[90vh] h-[95vh] sm:h-[90vh] p-0 gap-0 flex flex-col",children:[e.jsx(re,{className:"px-4 sm:px-6 pt-4 sm:pt-6 pb-3 sm:pb-4 border-b flex-shrink-0",children:e.jsx(ie,{className:"text-base sm:text-lg",children:"Example Prompts"})}),e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden md:hidden",children:[e.jsx("div",{className:"h-[40%] min-h-0 p-3 flex items-center justify-center bg-muted/30 overflow-hidden",children:d?e.jsx("img",{src:d.imageUrl,alt:"Example",className:"max-w-full max-h-full object-contain rounded-lg shadow-lg"}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Select an example"})}),e.jsxs("div",{className:"flex-1 min-h-0 border-t flex flex-col",children:[e.jsx(Fe,{className:"flex-1",children:e.jsx("div",{className:"p-3 space-y-2",children:xe.map(c=>e.jsxs("button",{onClick:()=>b(c),onDoubleClick:()=>y(c),className:`w-full text-left p-2 rounded-lg border-2 transition-all flex gap-3 ${d?.id===c.id?"border-primary bg-primary/5":"border-transparent bg-muted/50 hover:bg-muted"}`,children:[e.jsx("img",{src:c.imageUrl,alt:"",className:"w-12 h-12 rounded object-cover flex-shrink-0"}),e.jsx("p",{className:"text-sm line-clamp-3 flex-1",children:c.prompt})]},c.id))})}),e.jsx("div",{className:"p-3 border-t flex-shrink-0",children:e.jsxs(m,{onClick:h,disabled:!d,className:"w-full",children:[e.jsx(Me,{className:"mr-2 h-4 w-4"}),"Use This Prompt"]})})]})]}),e.jsxs("div",{className:"flex-1 hidden md:flex overflow-hidden",children:[e.jsxs("div",{className:"w-[35%] border-r flex flex-col",children:[e.jsx(Fe,{className:"flex-1",children:e.jsx("div",{className:"p-4 space-y-3",children:xe.map(c=>e.jsxs("button",{onClick:()=>b(c),onDoubleClick:()=>y(c),className:`w-full text-left p-3 rounded-lg border-2 transition-all flex gap-3 ${d?.id===c.id?"border-primary bg-primary/5 shadow-sm":"border-transparent bg-muted/50 hover:bg-muted hover:border-muted-foreground/20"}`,children:[e.jsx("img",{src:c.imageUrl,alt:"",className:"w-16 h-16 rounded object-cover flex-shrink-0"}),e.jsx("p",{className:"text-sm leading-relaxed line-clamp-4 flex-1",children:c.prompt})]},c.id))})}),e.jsx("div",{className:"p-4 border-t flex-shrink-0",children:e.jsxs(m,{onClick:h,disabled:!d,className:"w-full",children:[e.jsx(Me,{className:"mr-2 h-4 w-4"}),"Use This Prompt"]})})]}),e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx("div",{className:"flex-1 min-h-0 p-6 flex items-center justify-center bg-muted/30 overflow-hidden",children:d?e.jsx("img",{src:d.imageUrl,alt:"Example",className:"max-w-full max-h-full object-contain rounded-lg shadow-lg"}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Select an example to preview"})}),d&&e.jsxs("div",{className:"border-t p-4 bg-background flex-shrink-0 max-h-[30%] overflow-y-auto",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2 font-medium",children:"Full Prompt:"}),e.jsx("p",{className:"text-sm leading-relaxed",children:d.prompt})]})]})]})]})})}const Se={"nano-banana-pro":{id:"nano-banana-pro",label:"Nano Banana Pro",replicateId:"google/nano-banana-pro",features:{resolution:!0,outputQuality:!1,goFast:!1,safetyTolerance:!1,matchInputImage:!1},resolutionOptions:[{value:"1K",label:"1K"},{value:"2K",label:"2K"},{value:"4K",label:"4K"}],defaults:{resolution:"2K"}},"flux-2-dev":{id:"flux-2-dev",label:"FLUX.2 Dev",replicateId:"black-forest-labs/flux-2-dev",features:{resolution:!1,outputQuality:!0,goFast:!0,safetyTolerance:!1,matchInputImage:!0},defaults:{outputQuality:80,goFast:!0}},"flux-2-pro":{id:"flux-2-pro",label:"FLUX.2 Pro",replicateId:"black-forest-labs/flux-2-pro",features:{resolution:!0,outputQuality:!0,goFast:!1,safetyTolerance:!0,matchInputImage:!1},resolutionOptions:[{value:"0.5 MP",label:"0.5 MP"},{value:"1 MP",label:"1 MP"},{value:"2 MP",label:"2 MP"},{value:"4 MP",label:"4 MP"}],defaults:{resolution:"2 MP",outputQuality:80,safetyTolerance:2}}},Ge=Object.values(Se).map(x=>({value:x.id,label:x.label})),We=[{value:"1:1",label:"1:1"},{value:"2:3",label:"2:3"},{value:"3:2",label:"3:2"},{value:"3:4",label:"3:4"},{value:"4:3",label:"4:3"},{value:"4:5",label:"4:5"},{value:"5:4",label:"5:4"},{value:"9:16",label:"9:16"},{value:"16:9",label:"16:9"},{value:"21:9",label:"21:9"}],Cs={value:"match_input_image",label:"Match Input"},Qe=[{value:"png",label:"PNG"},{value:"jpg",label:"JPG"},{value:"webp",label:"WebP"}],Be=[{value:"60",label:"60"},{value:"70",label:"70"},{value:"80",label:"80"},{value:"90",label:"90"},{value:"100",label:"100"}],Ke=[{value:"1",label:"1 (Strict)"},{value:"2",label:"2"},{value:"3",label:"3"},{value:"4",label:"4"},{value:"5",label:"5"},{value:"6",label:"6 (Relaxed)"}];function Ss({open:x,onOpenChange:C,onSave:l}){const[d,b]=n.useState(""),[h,y]=n.useState("nano-banana-pro"),[c,p]=n.useState("4:3"),[M,f]=n.useState("2K"),[R,k]=n.useState("png"),[z,O]=n.useState("80"),[B,g]=n.useState(!0),[V,A]=n.useState("2"),[N,G]=n.useState(null),[j,P]=n.useState(!1),[S,_]=n.useState(!1),[K,r]=n.useState([]),[i,$]=n.useState([]),[W,Z]=n.useState(!0),[ce,se]=n.useState(!1),{toast:X}=He(),w=Se[h],de=w.features.matchInputImage?[Cs,...We]:We,ae=w.resolutionOptions||[];n.useEffect(()=>{const a=Se[h];a.defaults.resolution&&a.features.resolution&&f(a.defaults.resolution),a.defaults.outputQuality!==void 0&&O(String(a.defaults.outputQuality)),a.defaults.goFast!==void 0&&g(a.defaults.goFast),a.defaults.safetyTolerance!==void 0&&A(String(a.defaults.safetyTolerance)),p(v=>v==="match_input_image"&&!a.features.matchInputImage?"4:3":v)},[h]),n.useEffect(()=>{x&&pe()},[x]);const pe=async()=>{try{const v=await(await fetch(`${E}/api/v1/resources`)).json();if(v.success){const q=(v.data||[]).filter(Q=>{const s=Q.type==="image/jpeg"||Q.name.toLowerCase().endsWith(".jpg")||Q.name.toLowerCase().endsWith(".jpeg"),t=Q.type==="image/png"||Q.name.toLowerCase().endsWith(".png");return(s||t)&&Q.thumbnailPath});r(q)}}catch(a){console.error("Failed to fetch image resources:",a)}},me=async()=>{if(!d.trim()){X({title:"Prompt required",description:"Please enter a prompt to generate an image",variant:"destructive"});return}P(!0),G(null);try{const a=W||i.length===0?[]:[...i],v=await fetch(`${E}/api/v1/resources/generate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:d,model:h,dimensions:c,resolution:w.features.resolution?M:void 0,output_format:R,output_quality:w.features.outputQuality?parseInt(z):void 0,go_fast:w.features.goFast?B:void 0,safety_tolerance:w.features.safetyTolerance?parseInt(V):void 0,image_input:a})}),q=await v.json();if(!v.ok||!q.success){const Q=q.error?.message||"Failed to generate image",s=q.error?.code==="MISSING_API_TOKEN";throw new Error(s?"Replicate API token not configured. Please add it in Settings → Integrations.":Q)}G(q.data.imageUrl),X({title:"Image generated",description:"Your image has been generated successfully"})}catch(a){console.error("Generation error:",a),X({title:"Generation failed",description:a instanceof Error?a.message:"Failed to generate image. Please try again.",variant:"destructive"})}finally{P(!1)}},he=async()=>{if(N){_(!0);try{await l(N),b(""),y("nano-banana-pro"),p("4:3"),f("2K"),k("png"),O("80"),g(!0),A("2"),G(null),Z(!0),$([]),C(!1)}catch(a){X({title:"Save failed",description:a instanceof Error?a.message:"Failed to save image. Please try again.",variant:"destructive"})}finally{_(!1)}}},fe=()=>{!j&&!S&&C(!1)},H=()=>{Z(!0),$([])},ue=a=>{W&&Z(!1),i.includes(a)?($(i.filter(v=>v!==a)),i.length===1&&Z(!0)):i.length<3?$([...i,a]):X({title:"Maximum selection",description:"You can only select up to 3 images",variant:"destructive"})},ge=a=>{b(a)};return e.jsxs(le,{open:x,onOpenChange:fe,children:[e.jsxs(ne,{className:"max-w-[95vw] sm:max-w-[90vw] w-full sm:w-[90vw] max-h-[95vh] sm:max-h-[90vh] h-[95vh] sm:h-[90vh] p-0 gap-0 flex flex-col",children:[e.jsx(re,{className:"px-4 sm:px-6 pt-4 sm:pt-6 pb-3 sm:pb-4 border-b flex-shrink-0",children:e.jsx(ie,{className:"text-base sm:text-lg",children:"Generate Image"})}),e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden md:hidden",children:[e.jsx("div",{className:"flex-1 min-h-0 p-3 flex items-center justify-center bg-muted/30 overflow-hidden",children:j?e.jsxs("div",{className:"flex flex-col items-center justify-center space-y-3",children:[e.jsx(ee,{className:"h-10 w-10 animate-spin text-muted-foreground"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Generating..."})]}):N?e.jsx("div",{className:"w-full h-full min-h-0 flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:N,alt:"Generated",className:"max-w-full max-h-full object-contain rounded-lg shadow-lg"})}):e.jsxs("div",{className:"flex flex-col items-center justify-center space-y-3 text-muted-foreground",children:[e.jsx(oe,{className:"h-12 w-12"}),e.jsx("p",{className:"text-xs",children:"Preview"}),e.jsxs(m,{size:"sm",onClick:()=>se(!0),className:"mt-2",children:[e.jsx(we,{className:"mr-2 h-4 w-4"}),"View Examples"]})]})}),e.jsx("div",{className:"border-t bg-background p-2 flex-shrink-0",children:e.jsxs("div",{className:"flex gap-1.5 overflow-x-auto pb-1",children:[e.jsx("button",{onClick:H,className:`flex-shrink-0 h-16 w-16 flex items-center justify-center border-2 rounded-md transition-colors text-xs ${W?"border-primary bg-primary/10":"border-muted hover:border-muted-foreground/50"}`,children:"None"}),K.map(a=>{const v=i.includes(a.id);return e.jsx("button",{onClick:()=>ue(a.id),className:`flex-shrink-0 h-16 w-16 border-2 rounded-md overflow-hidden transition-colors ${v?"border-primary ring-2 ring-primary":"border-muted hover:border-muted-foreground/50"}`,children:e.jsx("img",{src:`${E}/api/v1/resources/${a.id}/thumbnail`,alt:a.name,className:"w-full h-full object-cover"})},a.id)})]})}),e.jsx("div",{className:"border-t p-3 overflow-y-auto flex-shrink-0 max-h-[45vh]",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(u,{htmlFor:"prompt-mobile",className:"text-xs",children:"Prompt"}),e.jsx(be,{id:"prompt-mobile",placeholder:"Describe the image...",value:d,onChange:a=>b(a.target.value),rows:2,className:"resize-none text-sm"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(u,{htmlFor:"model-mobile",className:"text-xs",children:"Model"}),e.jsxs(T,{value:h,onValueChange:a=>y(a),children:[e.jsx(I,{id:"model-mobile",className:"h-8 text-xs",children:e.jsx(D,{})}),e.jsx(L,{children:Ge.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(u,{htmlFor:"outputFormat-mobile",className:"text-xs",children:"Format"}),e.jsxs(T,{value:R,onValueChange:k,children:[e.jsx(I,{id:"outputFormat-mobile",className:"h-8 text-xs",children:e.jsx(D,{})}),e.jsx(L,{children:Qe.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),w.features.goFast&&e.jsx("div",{className:"space-y-1 flex flex-col justify-end",children:e.jsxs("div",{className:"flex items-center space-x-2 h-8",children:[e.jsx(Pe,{id:"goFast-mobile",checked:B,onCheckedChange:a=>g(a===!0)}),e.jsx(u,{htmlFor:"goFast-mobile",className:"text-xs cursor-pointer",children:"Go Fast"})]})}),w.features.safetyTolerance&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(u,{htmlFor:"safetyTolerance-mobile",className:"text-xs",children:"Safety"}),e.jsxs(T,{value:V,onValueChange:A,children:[e.jsx(I,{id:"safetyTolerance-mobile",className:"h-8 text-xs",children:e.jsx(D,{})}),e.jsx(L,{children:Ke.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]})]}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[w.features.resolution&&e.jsxs("div",{className:"space-y-1 flex-1 min-w-[80px]",children:[e.jsx(u,{htmlFor:"resolution-mobile",className:"text-xs",children:"Resolution"}),e.jsxs(T,{value:M,onValueChange:f,children:[e.jsx(I,{id:"resolution-mobile",className:"h-8 text-xs",children:e.jsx(D,{})}),e.jsx(L,{children:ae.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),e.jsxs("div",{className:"space-y-1 flex-1 min-w-[80px]",children:[e.jsx(u,{htmlFor:"aspectRatio-mobile",className:"text-xs",children:"Ratio"}),e.jsxs(T,{value:c,onValueChange:p,children:[e.jsx(I,{id:"aspectRatio-mobile",className:"h-8 text-xs",children:e.jsx(D,{})}),e.jsx(L,{children:de.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),w.features.outputQuality&&e.jsxs("div",{className:"space-y-1 flex-1 min-w-[80px]",children:[e.jsx(u,{htmlFor:"outputQuality-mobile",className:"text-xs",children:"Quality"}),e.jsxs(T,{value:z,onValueChange:O,children:[e.jsx(I,{id:"outputQuality-mobile",className:"h-8 text-xs",children:e.jsx(D,{})}),e.jsx(L,{children:Be.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx(m,{onClick:me,disabled:!d.trim()||j||S,className:"flex-1 h-9",size:"sm",children:j?e.jsx(ee,{className:"h-4 w-4 animate-spin"}):"Generate"}),e.jsx(m,{onClick:he,disabled:!N||j||S,variant:"outline",className:"flex-1 h-9",size:"sm",children:S?e.jsx(ee,{className:"h-4 w-4 animate-spin"}):"Save"})]})]})})]}),e.jsxs("div",{className:"flex-1 hidden md:flex overflow-hidden",children:[e.jsx("div",{className:"w-[22%] border-r p-6 overflow-y-auto",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"prompt",children:"Prompt"}),e.jsx(be,{id:"prompt",placeholder:"Describe the image you want to generate...",value:d,onChange:a=>b(a.target.value),rows:4,className:"resize-none"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"model",children:"Model"}),e.jsxs(T,{value:h,onValueChange:a=>y(a),children:[e.jsx(I,{id:"model",children:e.jsx(D,{})}),e.jsx(L,{children:Ge.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"aspectRatio",children:"Aspect Ratio"}),e.jsxs(T,{value:c,onValueChange:p,children:[e.jsx(I,{id:"aspectRatio",children:e.jsx(D,{})}),e.jsx(L,{children:de.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),w.features.resolution&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"resolution",children:"Resolution"}),e.jsxs(T,{value:M,onValueChange:f,children:[e.jsx(I,{id:"resolution",children:e.jsx(D,{})}),e.jsx(L,{children:ae.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"outputFormat",children:"Output Format"}),e.jsxs(T,{value:R,onValueChange:k,children:[e.jsx(I,{id:"outputFormat",children:e.jsx(D,{})}),e.jsx(L,{children:Qe.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),w.features.outputQuality&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"outputQuality",children:"Output Quality"}),e.jsxs(T,{value:z,onValueChange:O,children:[e.jsx(I,{id:"outputQuality",children:e.jsx(D,{})}),e.jsx(L,{children:Be.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),w.features.goFast&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Pe,{id:"goFast",checked:B,onCheckedChange:a=>g(a===!0)}),e.jsx(u,{htmlFor:"goFast",className:"cursor-pointer",children:"Go Fast"})]}),w.features.safetyTolerance&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"safetyTolerance",children:"Safety Tolerance"}),e.jsxs(T,{value:V,onValueChange:A,children:[e.jsx(I,{id:"safetyTolerance",children:e.jsx(D,{})}),e.jsx(L,{children:Ke.map(a=>e.jsx(U,{value:a.value,children:a.label},a.value))})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 pt-4",children:[e.jsx(m,{onClick:me,disabled:!d.trim()||j||S,className:"w-full",children:j?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"mr-2 h-4 w-4 animate-spin"}),"Generating..."]}):"Generate"}),e.jsx(m,{onClick:he,disabled:!N||j||S,variant:"outline",className:"w-full",children:S?e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})]})]})}),e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsx("div",{className:"flex-1 min-h-0 p-6 flex items-center justify-center bg-muted/30 overflow-hidden",children:j?e.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4",children:[e.jsx(ee,{className:"h-12 w-12 animate-spin text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Generating image..."})]}):N?e.jsx("div",{className:"w-full h-full min-h-0 flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:N,alt:"Generated",className:"max-w-full max-h-full object-contain rounded-lg shadow-lg"})}):e.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4 text-muted-foreground",children:[e.jsx(oe,{className:"h-16 w-16"}),e.jsx("p",{className:"text-sm",children:"Generated image will appear here"}),e.jsxs(m,{onClick:()=>se(!0),className:"mt-2",children:[e.jsx(we,{className:"mr-2 h-4 w-4"}),"View Examples"]})]})}),e.jsx("div",{className:"border-t bg-background p-4 flex-shrink-0",children:e.jsxs("div",{className:"flex gap-2 overflow-x-auto",children:[e.jsx("button",{onClick:H,className:`flex-shrink-0 h-32 w-32 flex items-center justify-center border-2 rounded-md transition-colors ${W?"border-primary bg-primary/10":"border-muted hover:border-muted-foreground/50"}`,children:e.jsx("span",{className:"text-sm font-medium",children:"None"})}),K.map(a=>{const v=i.includes(a.id);return e.jsx("button",{onClick:()=>ue(a.id),className:`flex-shrink-0 h-32 w-32 border-2 rounded-md overflow-hidden transition-colors ${v?"border-primary ring-2 ring-primary":"border-muted hover:border-muted-foreground/50"}`,children:e.jsx("img",{src:`${E}/api/v1/resources/${a.id}/thumbnail`,alt:a.name,className:"w-full h-full object-cover"})},a.id)})]})})]})]})]}),e.jsx(ks,{open:ce,onOpenChange:se,onSelectExample:ge})]})}function Fs({open:x,onOpenChange:C,resource:l,onCopyPath:d,onDownload:b,onNavigate:h,canNavigatePrev:y,canNavigateNext:c}){const[p,M]=n.useState(null),[f,R]=n.useState(!1),k=l?`${E}/api/v1/resources/${l.id}`:"",z=l?.type.startsWith("image/")??!1,O=l?l.type==="image/svg+xml"||l.name.toLowerCase().endsWith(".svg"):!1,B=l?l.type==="application/pdf"||l.name.toLowerCase().endsWith(".pdf"):!1,g=l?.type.startsWith("video/")??!1,V=l?.type.startsWith("audio/")??!1,A=l?l.type.startsWith("text/")||l.type==="application/json"||l.type.includes("javascript")||l.type.includes("typescript")||l.type.includes("xml")||l.name.toLowerCase().match(/\.(txt|md|json|js|ts|jsx|tsx|css|html|xml|yaml|yml|log|sh|bash|zsh|fish)$/)!==null:!1,N=l?l.name.toLowerCase().endsWith(".md")||l.name.toLowerCase().endsWith(".markdown"):!1,G=l?l.type==="application/json"||l.name.toLowerCase().endsWith(".json"):!1,j=l?l.type==="text/html"||l.name.toLowerCase().endsWith(".html"):!1;if(n.useEffect(()=>{const r=i=>{if(x){if(i.key==="Escape"){C(!1);return}if(i.key==="ArrowLeft"&&y){i.preventDefault(),h("prev");return}i.key==="ArrowRight"&&c&&(i.preventDefault(),h("next"))}};if(x)return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[x,C,h,y,c]),n.useEffect(()=>{x&&l&&(A||N||G||j)?(R(!0),fetch(k).then(r=>{if(r.ok)return r.text();throw new Error("Failed to load file")}).then(r=>{M(r)}).catch(r=>{console.error("Failed to load text content:",r),M(null)}).finally(()=>{R(!1)})):M(null)},[x,l?.id,A,N,G,j,k]),!l)return null;const P=r=>{if(r===0)return"0 B";const i=1024,$=["B","KB","MB","GB"],W=Math.floor(Math.log(r)/Math.log(i));return parseFloat((r/Math.pow(i,W)).toFixed(2))+" "+$[W]},S=r=>new Date(r).toLocaleString(),_=r=>r.startsWith("image/")?e.jsx(oe,{className:"h-6 w-6"}):r.startsWith("video/")?e.jsx(ys,{className:"h-6 w-6"}):r.startsWith("audio/")?e.jsx(Ve,{className:"h-6 w-6"}):r.includes("text")||r.includes("document")||r.includes("code")?e.jsx(te,{className:"h-6 w-6"}):r.includes("json")||r.includes("javascript")||r.includes("typescript")?e.jsx(Ce,{className:"h-6 w-6"}):e.jsx(Ne,{className:"h-6 w-6"}),K=()=>{if(O)return e.jsx("img",{src:k,alt:l.name,className:"max-w-full max-h-full object-contain rounded-lg shadow-lg"});if(B)return e.jsx("iframe",{src:k,className:"w-full h-full min-h-[600px] rounded-lg border",title:l.name});if(g)return e.jsx("video",{src:k,controls:!0,className:"max-w-full max-h-full rounded-lg shadow-lg",children:"Your browser does not support the video tag."});if(V)return e.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4 p-8",children:[e.jsx(Ve,{className:"h-16 w-16 text-muted-foreground"}),e.jsx("audio",{src:k,controls:!0,className:"w-full max-w-md",children:"Your browser does not support the audio tag."})]});if(N&&p!==null)return f?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})}):e.jsx("div",{className:"w-full h-full overflow-auto p-6 prose prose-sm dark:prose-invert max-w-none",children:e.jsx(Xe,{remarkPlugins:[es],rehypePlugins:[Ze],children:p})});if(j&&p!==null)return f?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})}):e.jsx("iframe",{srcDoc:p,className:"w-full h-full min-h-[600px] rounded-lg border",title:l.name,sandbox:"allow-same-origin"});if(G&&p!==null){if(f)return e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})});let r=p;try{const i=JSON.parse(p);r=JSON.stringify(i,null,2)}catch{}return e.jsx("div",{className:"w-full h-full overflow-auto p-6",children:e.jsx("pre",{className:"text-xs bg-muted p-4 rounded-lg overflow-auto",children:e.jsx("code",{children:r})})})}return A&&p!==null?f?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})}):e.jsx("div",{className:"w-full h-full overflow-auto p-6",children:e.jsx("pre",{className:"text-xs bg-muted p-4 rounded-lg overflow-auto whitespace-pre-wrap",children:e.jsx("code",{children:p})})}):z?e.jsx("img",{src:k,alt:l.name,className:"max-w-full max-h-full object-contain rounded-lg shadow-lg"}):e.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4 text-muted-foreground",children:[_(l.type),e.jsx("p",{className:"text-sm",children:"Preview not available for this file type"}),e.jsxs(m,{variant:"outline",onClick:()=>b(l),children:[e.jsx(ke,{className:"mr-2 h-4 w-4"}),"Download to view"]})]})};return e.jsx(le,{open:x,onOpenChange:C,children:e.jsxs(ne,{className:"max-w-[90vw] w-[90vw] max-h-[90vh] h-[90vh] p-0 gap-0 flex flex-col [&>button]:hidden",children:[e.jsx(re,{className:"px-6 pt-6 pb-4 border-b flex-shrink-0",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[_(l.type),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(ie,{className:"text-xl truncate",children:l.name}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:l.type})]})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[e.jsx(m,{variant:"ghost",size:"sm",onClick:()=>d(l),title:"Copy path to clipboard",children:e.jsx(qe,{className:"h-4 w-4"})}),e.jsx(m,{variant:"ghost",size:"sm",onClick:()=>b(l),title:"Download",children:e.jsx(ke,{className:"h-4 w-4"})}),e.jsx(m,{variant:"ghost",size:"sm",onClick:()=>C(!1),title:"Close",children:e.jsx(Je,{className:"h-4 w-4"})})]})]})}),e.jsx("div",{className:"flex-1 flex overflow-hidden",children:e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex-1 relative flex items-center justify-center bg-muted/30 p-6 overflow-auto",children:[y&&e.jsx("button",{type:"button",onClick:()=>h("prev"),className:"absolute left-4 top-1/2 -translate-y-1/2 rounded-full border bg-background/80 p-2 shadow-sm hover:bg-background transition-colors","aria-label":"Previous resource",children:e.jsx(ns,{className:"h-5 w-5"})}),c&&e.jsx("button",{type:"button",onClick:()=>h("next"),className:"absolute right-4 top-1/2 -translate-y-1/2 rounded-full border bg-background/80 p-2 shadow-sm hover:bg-background transition-colors","aria-label":"Next resource",children:e.jsx(Ye,{className:"h-5 w-5"})}),K()]}),e.jsx("div",{className:"border-t p-6 flex-shrink-0 bg-background",children:e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-3",children:"Information"}),e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Size:"}),e.jsx("span",{children:P(l.size)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(rs,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Uploaded:"}),e.jsx("span",{children:S(l.uploadedAt)})]})]})]})}),e.jsxs("div",{className:"space-y-4",children:[l.metadata.description&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-2",children:"Description"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l.metadata.description})]}),l.metadata.tags&&l.metadata.tags.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-2",children:"Tags"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:l.metadata.tags.map(r=>e.jsx(ye,{variant:"secondary",children:r},r))})]})]})]})})]})})]})})}function zs(){const[x,C]=n.useState([]),[l,d]=n.useState(!0),[b,h]=n.useState(!1),[y,c]=n.useState(""),[p,M]=n.useState(!1),[f,R]=n.useState([]),[k,z]=n.useState(""),[O,B]=n.useState(""),[g,V]=n.useState([]),[A,N]=n.useState(!1),[G,j]=n.useState(null),[P,S]=n.useState(null),[_,K]=n.useState(null),r=n.useRef(null),{toast:i}=He();n.useEffect(()=>{$()},[]);const $=async()=>{try{d(!0);const t=await(await fetch(`${E}/api/v1/resources`)).json();t.success&&C(t.data||[])}catch(s){console.error("Failed to fetch resources:",s)}finally{d(!1)}},W=s=>{s.length!==0&&V(Array.from(s))},Z=async()=>{if(g.length!==0){h(!0);try{for(const s of g){const t=new FormData;if(t.append("file",s),t.append("tags",f.join(", ")),t.append("description",O),!(await fetch(`${E}/api/v1/resources`,{method:"POST",body:t})).ok)throw new Error("Upload failed")}R([]),z(""),B(""),V([]),M(!1),await $(),i({title:"Upload successful",description:`${g.length} file(s) uploaded successfully`})}catch(s){console.error("Upload failed:",s),i({title:"Upload failed",description:"Failed to upload files. Please try again.",variant:"destructive"})}finally{h(!1)}}},ce=()=>{R([]),z(""),B(""),V([]),M(!1)},se=s=>{if(s.key==="Enter"){s.preventDefault();const t=k.trim();t&&!f.includes(t)&&(R([...f,t]),z(""))}},X=s=>{R(f.filter(t=>t!==s))},w=s=>{V(g.filter((t,o)=>o!==s))},de=async()=>{if(_)try{if((await fetch(`${E}/api/v1/resources/${_.id}`,{method:"DELETE"})).ok)await $(),i({title:"Resource deleted",description:`${_.name} has been deleted`});else throw new Error("Delete failed")}catch(s){console.error("Failed to delete resource:",s),i({title:"Delete failed",description:"Failed to delete resource. Please try again.",variant:"destructive"})}finally{K(null)}},ae=async s=>{try{const t=`.nut/resources/files/${s.path}`;await ls(t),i({title:"Path copied!",description:`Copied ${t} to clipboard`})}catch(t){console.error("Failed to copy path:",t),i({title:"Failed to copy",description:"Unable to copy path to clipboard",variant:"destructive"})}},pe=s=>{if(s===0)return"0 B";const t=1024,o=["B","KB","MB","GB"],J=Math.floor(Math.log(s)/Math.log(t));return parseFloat((s/Math.pow(t,J)).toFixed(2))+" "+o[J]},me=(s,t)=>{const o=t.toLowerCase();return s.startsWith("image/")?s==="image/svg+xml"||o.endsWith(".svg")?e.jsx(Re,{className:"h-4 w-4"}):e.jsx(oe,{className:"h-4 w-4"}):s.startsWith("video/")?e.jsx($e,{className:"h-4 w-4"}):s.startsWith("audio/")?e.jsx(Ee,{className:"h-4 w-4"}):s==="application/pdf"||o.endsWith(".pdf")?e.jsx(te,{className:"h-4 w-4"}):o.match(/\.(js|jsx|ts|tsx|py|java|cpp|c|h|hpp|cs|go|rs|rb|php|swift|kt|scala|r|m|mm)$/)?e.jsx(Ce,{className:"h-4 w-4"}):s==="application/json"||o.endsWith(".json")?e.jsx(_e,{className:"h-4 w-4"}):s.includes("spreadsheet")||s.includes("excel")||o.match(/\.(xls|xlsx|csv)$/)?e.jsx(ze,{className:"h-4 w-4"}):s.includes("presentation")||s.includes("powerpoint")||o.match(/\.(ppt|pptx)$/)?e.jsx(Ae,{className:"h-4 w-4"}):s.startsWith("text/")||s.includes("document")||s.includes("word")?e.jsx(te,{className:"h-4 w-4"}):s.includes("font")||o.match(/\.(ttf|otf|woff|woff2|eot)$/)?e.jsx(Oe,{className:"h-4 w-4"}):e.jsx(Ne,{className:"h-4 w-4"})},he=(s,t)=>{const o=t.toLowerCase();return s.startsWith("image/")?s==="image/svg+xml"||o.endsWith(".svg")?e.jsx(Re,{className:"h-16 w-16"}):e.jsx(oe,{className:"h-16 w-16"}):s.startsWith("video/")?e.jsx($e,{className:"h-16 w-16"}):s.startsWith("audio/")?e.jsx(Ee,{className:"h-16 w-16"}):s==="application/pdf"||o.endsWith(".pdf")?e.jsx(te,{className:"h-16 w-16"}):o.match(/\.(js|jsx|ts|tsx|py|java|cpp|c|h|hpp|cs|go|rs|rb|php|swift|kt|scala|r|m|mm)$/)?e.jsx(Ce,{className:"h-16 w-16"}):s==="application/json"||o.endsWith(".json")?e.jsx(_e,{className:"h-16 w-16"}):s.includes("spreadsheet")||s.includes("excel")||o.match(/\.(xls|xlsx|csv)$/)?e.jsx(ze,{className:"h-16 w-16"}):s.includes("presentation")||s.includes("powerpoint")||o.match(/\.(ppt|pptx)$/)?e.jsx(Ae,{className:"h-16 w-16"}):s.startsWith("text/")||s.includes("document")||s.includes("word")?e.jsx(te,{className:"h-16 w-16"}):s.includes("font")||o.match(/\.(ttf|otf|woff|woff2|eot)$/)?e.jsx(Oe,{className:"h-16 w-16"}):e.jsx(Ne,{className:"h-16 w-16"})},fe=s=>{const t=s.name.toLowerCase(),o=s.type.startsWith("image/");return s.type==="image/svg+xml"||t.endsWith(".svg")?e.jsx("div",{className:"w-full h-32 flex items-center justify-center bg-muted/30 rounded-md border overflow-hidden p-2",children:e.jsx("img",{src:`${E}/api/v1/resources/${s.id}`,alt:s.name,className:"w-full h-full object-contain"})}):o&&s.thumbnailPath?e.jsx("img",{src:`${E}/api/v1/resources/${s.id}/thumbnail`,alt:s.name,className:"w-full h-32 object-cover rounded-md border",onError:Y=>{Y.currentTarget.style.display="none"}}):e.jsx("div",{className:"w-full h-32 flex items-center justify-center bg-muted/50 rounded-md border",children:e.jsx("div",{className:"text-muted-foreground",children:he(s.type,s.name)})})},H=x.filter(s=>{if(!y)return!0;const t=y.toLowerCase();return s.name.toLowerCase().includes(t)||s.metadata.description?.toLowerCase().includes(t)||s.metadata.tags?.some(o=>o.toLowerCase().includes(t))}),ue=s=>{s.preventDefault(),s.stopPropagation()},ge=s=>{s.preventDefault(),s.stopPropagation(),s.dataTransfer.files&&s.dataTransfer.files.length>0&&W(s.dataTransfer.files)},a=(s,t)=>{if(t.target.closest("button"))return;j(s);const J=H.findIndex(Y=>Y.id===s.id);S(J>=0?J:null)},v=s=>{window.open(`${E}/api/v1/resources/${s.id}?download=true`)},q=async s=>{h(!0);try{const t=await fetch(s);if(!t.ok)throw new Error("Failed to download generated image");const o=await t.blob(),J=`generated-image-${Date.now()}.png`,Y=new FormData;if(Y.append("file",o,J),Y.append("tags",f.join(",")),Y.append("description",O),!(await fetch(`${E}/api/v1/resources`,{method:"POST",body:Y})).ok)throw new Error("Upload failed");await $(),i({title:"Image saved",description:"Generated image has been saved to resources"})}catch(t){throw console.error("Failed to save generated image:",t),i({title:"Save failed",description:t.message||"Failed to save generated image",variant:"destructive"}),t}finally{h(!1)}},Q=s=>{if(P===null)return;const t=s==="next"?P+1:P-1;if(t<0||t>=H.length)return;const o=H[t];S(t),j(o)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Resources"}),e.jsx("p",{className:"text-muted-foreground text-sm hidden sm:block",children:"Manage files and resources for your project"})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsxs(m,{variant:"outline",size:"sm",onClick:()=>N(!0),children:[e.jsx(we,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Generate"})]}),e.jsxs(m,{size:"sm",onClick:()=>M(!p),children:[e.jsx(Ue,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Add Resource"})]})]})]}),e.jsx(le,{open:p,onOpenChange:s=>!s&&ce(),children:e.jsxs(ne,{className:"max-w-2xl",children:[e.jsxs(re,{children:[e.jsx(ie,{children:"Upload Resource"}),e.jsx(Te,{children:"Add files to your project resources"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"border-2 border-dashed border-muted-foreground/25 rounded-lg p-8 text-center cursor-pointer hover:border-muted-foreground/50 transition-colors",onDragOver:ue,onDrop:ge,onClick:()=>r.current?.click(),children:[e.jsx(bs,{className:"mx-auto h-8 w-8 text-muted-foreground"}),e.jsx("p",{className:"mt-2 text-sm font-medium",children:"Drop files here or click to browse"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Support for images, documents, and other files"})]}),e.jsx("input",{ref:r,type:"file",multiple:!0,className:"hidden",onChange:s=>s.target.files&&W(s.target.files)}),g.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs(u,{children:["Selected Files (",g.length,")"]}),e.jsx("div",{className:"border rounded-lg p-3 max-h-40 overflow-y-auto space-y-2",children:g.map((s,t)=>e.jsxs("div",{className:"flex items-center justify-between text-sm bg-muted/50 rounded px-3 py-2",children:[e.jsx("span",{className:"truncate flex-1",children:s.name}),e.jsx(m,{variant:"ghost",size:"sm",onClick:()=>w(t),className:"h-6 w-6 p-0 ml-2",children:e.jsx(Ie,{className:"h-3 w-3"})})]},t))})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"tags",children:"Tags"}),e.jsx(De,{id:"tags",placeholder:"Type a tag and press Enter",value:k,onChange:s=>z(s.target.value),onKeyDown:se}),f.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:f.map(s=>e.jsxs(ye,{variant:"secondary",className:"text-xs",children:[s,e.jsx("button",{type:"button",onClick:()=>X(s),className:"ml-1 hover:text-destructive",children:"×"})]},s))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"description",children:"Description"}),e.jsx(be,{id:"description",placeholder:"Brief description of this resource...",value:O,onChange:s=>B(s.target.value),rows:3})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(m,{variant:"outline",onClick:ce,disabled:b,children:"Cancel"}),e.jsx(m,{onClick:Z,disabled:g.length===0||b,children:b?"Uploading...":`Upload ${g.length>0?`(${g.length})`:""}`})]})]})]})}),e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs("div",{className:"relative flex-1 w-full",children:[e.jsx(is,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(De,{placeholder:"Search resources...",value:y,onChange:s=>c(s.target.value),className:"pl-8"})]})}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:l?Array.from({length:6}).map((s,t)=>e.jsxs(je,{className:"animate-pulse",children:[e.jsxs(Le,{children:[e.jsx("div",{className:"h-4 bg-muted rounded w-3/4"}),e.jsx("div",{className:"h-3 bg-muted rounded w-1/2"})]}),e.jsx(ve,{children:e.jsx("div",{className:"h-20 bg-muted rounded"})})]},t)):H.length>0?H.map(s=>e.jsxs(je,{className:"hover:shadow-lg hover:bg-muted transition-all cursor-pointer",onClick:t=>a(s,t),children:[e.jsxs(Le,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[me(s.type,s.name),e.jsx(as,{className:"text-sm font-medium truncate",children:s.name})]}),e.jsxs(ts,{className:"text-xs",children:[pe(s.size)," • ",new Date(s.uploadedAt).toLocaleDateString()]}),e.jsxs("div",{className:"flex justify-end space-x-1 mt-2",children:[e.jsx(m,{variant:"ghost",size:"sm",onClick:t=>{t.stopPropagation(),ae(s)},title:"Copy path to clipboard",children:e.jsx(qe,{className:"h-3 w-3"})}),e.jsx(m,{variant:"ghost",size:"sm",onClick:t=>{t.stopPropagation(),v(s)},children:e.jsx(ke,{className:"h-3 w-3"})}),e.jsx(m,{variant:"ghost",size:"sm",onClick:t=>{t.stopPropagation(),K(s)},children:e.jsx(Ie,{className:"h-3 w-3"})})]})]}),e.jsxs(ve,{className:"pt-0",children:[e.jsx("div",{className:"mb-3",children:fe(s)}),s.metadata.description&&e.jsx("p",{className:"text-sm text-muted-foreground mb-2 line-clamp-2",children:s.metadata.description}),s.metadata.tags&&s.metadata.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:s.metadata.tags.map(t=>e.jsx(ye,{variant:"secondary",className:"text-xs",children:t},t))})]})]},s.id)):e.jsx("div",{className:"col-span-full",children:e.jsx(je,{children:e.jsxs(ve,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(ss,{className:"h-12 w-12 text-muted-foreground/50"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No resources yet"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground text-center max-w-sm",children:"Upload files to get started. Resources can be referenced by LLMs and team members for enhanced context."}),e.jsxs(m,{className:"mt-4",onClick:()=>M(!0),children:[e.jsx(Ue,{className:"mr-2 h-4 w-4"}),"Add First Resource"]})]})})})}),b&&e.jsx("div",{className:"fixed bottom-4 right-4 bg-background border rounded-lg shadow-lg p-4",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-primary"}),e.jsx("span",{className:"text-sm",children:"Uploading files..."})]})}),e.jsx(Ss,{open:A,onOpenChange:N,onSave:q}),e.jsx(Fs,{open:!!G,onOpenChange:s=>{s||j(null),s||S(null)},resource:G,onCopyPath:ae,onDownload:v,onNavigate:Q,canNavigatePrev:P!==null&&P>0,canNavigateNext:P!==null&&P<H.length-1}),e.jsx(le,{open:!!_,onOpenChange:s=>!s&&K(null),children:e.jsxs(ne,{className:"max-w-md",children:[e.jsxs(re,{children:[e.jsx(ie,{children:"Delete Resource"}),e.jsxs(Te,{children:["Are you sure you want to delete ",e.jsx("strong",{children:_?.name}),"? This action cannot be undone."]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(m,{variant:"outline",onClick:()=>K(null),children:"Cancel"}),e.jsx(m,{variant:"destructive",onClick:de,children:"Delete"})]})]})})]})}export{zs as default};
@@ -1,6 +0,0 @@
1
- import{c as J,r,j as e,D as W,a as Y,b as z,d as K,I as Q,n as A,S as V,f as X,$ as Z,B as R}from"./index-B8vejVRZ.js";import{B as y}from"./badge-NJasrAx_.js";import{S as O}from"./search-BR37JgJ3.js";/**
2
- * @license lucide-react v0.542.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const ee=[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]],oe=J("library",ee),te="https://registry.coconut.dev";async function B(a){const n=a.startsWith("http")?a:`${te}${a}`,i=await fetch(n,{headers:{Accept:"application/json","User-Agent":"coconut-frontend"}});if(!i.ok)throw new Error(`Failed to fetch registry resource: ${i.status}`);return i.json()}async function se(a){const n=`/registry/${a}/root.json`;return B(n)}async function ce(a){return B(a)}const re="Browse Registry",ae="Import";function de({open:a,categoryId:n,onOpenChange:i,title:F=re,confirmLabel:M=ae,filterTags:d,onConfirm:I,getDetail:_,renderPreview:$}){const[u,v]=r.useState([]),[U,N]=r.useState(!1),[w,S]=r.useState(null),[o,E]=r.useState(null),[x,b]=r.useState({}),[T,g]=r.useState(!1),[L,j]=r.useState(null),[f,C]=r.useState(""),[p,k]=r.useState(!1);r.useEffect(()=>{if(!a)return;N(!0),S(null),E(null),j(null),g(!1),b({}),C("");const t=Array.isArray(n)?n:[n];Promise.all(t.map(s=>se(s))).then(s=>{const l=s.flatMap(h=>h.elements??[]);v(l)}).catch(s=>{console.error("Failed to load registry category",s),v([]),S("Failed to load registry entries")}).finally(()=>N(!1))},[a,n]);const D=r.useMemo(()=>{let t=u;if(d&&d.length>0&&(t=t.filter(l=>{const h=l.tags??[];return d.some(G=>h.some(H=>H.toLowerCase()===G.toLowerCase()))})),!f.trim())return t;const s=f.trim().toLowerCase();return t.filter(l=>[l.name,l.description,l.preview,...l.tags??[]].filter(Boolean).join(" ").toLowerCase().includes(s))},[u,f,d]),c=r.useMemo(()=>o?u.find(t=>t.id===o)??null:null,[u,o]),m=r.useMemo(()=>o?x[o]?.detail??null:null,[o,x]),P=async t=>{if(E(t.id),j(null),!x?.[t.id]?.detail){g(!0);try{const s=await _(t);b(l=>({...l??{},[t.id]:{detail:s,fetchedAt:Date.now()}}))}catch(s){console.error("Failed to load registry element detail",s),j("Unable to load detail for this entry")}finally{g(!1)}}},q=async()=>{if(!(!c||!m)){k(!0);try{await I(c,m),i(!1)}catch(t){console.error("Failed to import registry element",t)}finally{k(!1)}}};return e.jsx(W,{open:a,onOpenChange:i,children:e.jsxs(Y,{className:"max-w-5xl h-[80vh] flex flex-col",children:[e.jsx(z,{children:e.jsx(K,{children:F})}),e.jsx("div",{className:"flex flex-col gap-4",children:e.jsxs("div",{className:"relative",children:[e.jsx(O,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Q,{value:f,onChange:t=>C(t.target.value),placeholder:"Search registry entries",className:"pl-9"})]})}),e.jsxs("div",{className:"flex-1 flex gap-4 min-h-0",children:[e.jsx("div",{className:"w-1/3 border-r pr-3",children:U?e.jsxs("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:[e.jsx(A,{className:"h-4 w-4 animate-spin mr-2"}),"Loading entries…"]}):w?e.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:w}):D.length===0?e.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"No entries found"}):e.jsx(V,{className:"h-full",children:e.jsx("div",{className:"space-y-1 pb-4",children:D.map(t=>e.jsxs("button",{onClick:()=>P(t),className:X("w-full rounded-md border border-transparent p-3 text-left transition-colors hover:border-border hover:bg-muted/40",o===t.id&&"border-primary bg-muted"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:t.name}),e.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:t.description||t.preview})]}),t.version&&e.jsxs(y,{variant:"outline",className:"text-[10px] font-medium uppercase",children:["v",t.version]})]}),t.tags&&t.tags.length>0&&e.jsxs("div",{className:"mt-2 flex flex-wrap gap-1",children:[t.tags.slice(0,4).map(s=>e.jsx(y,{variant:"secondary",className:"text-[10px] font-normal",children:s},s)),t.tags.length>4&&e.jsxs(y,{variant:"outline",className:"text-[10px] font-normal",children:["+",t.tags.length-4]})]})]},t.id))})})}),e.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:T?e.jsxs("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:[e.jsx(A,{className:"h-5 w-5 animate-spin mr-2"}),"Loading detail…"]}):L?e.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:L}):c?e.jsx("div",{className:"h-full overflow-hidden",children:$(c,m)}):e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"Select an entry to preview"})})]}),e.jsxs(Z,{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:c?`Selected: ${c.name}`:"No entry selected"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(R,{variant:"outline",onClick:()=>i(!1),disabled:p,children:"Cancel"}),e.jsx(R,{onClick:q,disabled:!c||!m||p,children:p?"Importing…":M})]})]})]})})}export{oe as L,te as R,de as a,ce as f};