@decocms/mesh 2.59.3 → 2.59.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.
- package/dist/client/assets/{AlertCircle-xn5rFX2T.js → AlertCircle-BmzagJTS.js} +1 -1
- package/dist/client/assets/{ArrowLeft-Bb6bw7wO.js → ArrowLeft-BkK50n5W.js} +1 -1
- package/dist/client/assets/{ArrowUp-DmmjiRhr.js → ArrowUp-BjUPYtOi.js} +1 -1
- package/dist/client/assets/{Calendar-DjDp3sZ6.js → Calendar-DZcEp1o3.js} +1 -1
- package/dist/client/assets/{Check-CP3euUrF.js → Check-CeorNg_Q.js} +1 -1
- package/dist/client/assets/{ChevronDown-sM8LyvvZ.js → ChevronDown-DHgzfDOn.js} +1 -1
- package/dist/client/assets/{Code01-DR-jbECo.js → Code01-C3uTkWw7.js} +1 -1
- package/dist/client/assets/{Copy01-Ds6kUzpe.js → Copy01-D2UqUo7F.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-DZRRv704.js → DotsHorizontal-C2Cp4F2y.js} +1 -1
- package/dist/client/assets/{DotsVertical-DZEGrhum.js → DotsVertical-CbPPn03K.js} +1 -1
- package/dist/client/assets/{Download01-BxIh__MC.js → Download01-BrsFevks.js} +1 -1
- package/dist/client/assets/{Edit01-BVZvpfR8.js → Edit01-D4kKualc.js} +1 -1
- package/dist/client/assets/{File02-Dh_9xh7Q.js → File02-CJChiHT7.js} +1 -1
- package/dist/client/assets/{File06-B5Dv7-Oa.js → File06-D3YhRSWf.js} +1 -1
- package/dist/client/assets/{FilterLines-DH_DosQX.js → FilterLines-Dm0iR9nQ.js} +1 -1
- package/dist/client/assets/{Grid01-BRgRtmbs.js → Grid01-C0Yt3TrW.js} +1 -1
- package/dist/client/assets/{Home02-lEMcKcn1.js → Home02-BXCJMmnc.js} +1 -1
- package/dist/client/assets/{Image01-DoUr5ERm.js → Image01-BxGEkI20.js} +1 -1
- package/dist/client/assets/{Inbox01-DGDxlReT.js → Inbox01-pqRVnVhd.js} +1 -1
- package/dist/client/assets/{InfoCircle-BzAYvvO0.js → InfoCircle-CItUremO.js} +1 -1
- package/dist/client/assets/{Key01-DYMhbAB1.js → Key01-CG2VBx47.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CG-vKoro.js → LinkExternal01-CsuKk35n.js} +1 -1
- package/dist/client/assets/{List-7uuZoLIU.js → List-Tf6_FYvd.js} +1 -1
- package/dist/client/assets/{Loading01-CaAuMuYs.js → Loading01-D7Nk5rBn.js} +1 -1
- package/dist/client/assets/{Lock01-B3UR0GHM.js → Lock01-DV6G4OAL.js} +1 -1
- package/dist/client/assets/{Pin01-YRdxhSee.js → Pin01-EjlLL7Hj.js} +1 -1
- package/dist/client/assets/{Play-CUJHUsFq.js → Play-CaQCPrdk.js} +1 -1
- package/dist/client/assets/{Plus-BfTBbS63.js → Plus-BAl5ksmH.js} +1 -1
- package/dist/client/assets/{SearchMd-DVKxUKrX.js → SearchMd-XlpqEN-D.js} +1 -1
- package/dist/client/assets/{Share07-DC87ym6H.js → Share07-Dw_Ho0Fm.js} +1 -1
- package/dist/client/assets/{Terminal-Csxea4Ut.js → Terminal-BK5I3Y1e.js} +1 -1
- package/dist/client/assets/{Tool01-ChloSpuN.js → Tool01-BLwXizsZ.js} +1 -1
- package/dist/client/assets/{Trash01-DFo133oe.js → Trash01-CdZ-Jz57.js} +1 -1
- package/dist/client/assets/{Upload01-D1Hk2Al6.js → Upload01-D7Wikn5K.js} +1 -1
- package/dist/client/assets/{Users03-D4Z1AQ9s.js → Users03-9f86Wop8.js} +1 -1
- package/dist/client/assets/{X-DhTQLdE5.js → X-CjLPt87f.js} +1 -1
- package/dist/client/assets/{XClose-DnQCXbLq.js → XClose-DSGHFh4M.js} +1 -1
- package/dist/client/assets/agent-detail-7FOys_Jg.js +1 -0
- package/dist/client/assets/{agents-EruM84S0.js → agents-CPStualW.js} +1 -1
- package/dist/client/assets/{alert-dialog-DZDASW_Y.js → alert-dialog-D0Pbwyv-.js} +2 -2
- package/dist/client/assets/{auth-catchall-DMglr4vj.js → auth-catchall-C8EKwBMn.js} +1 -1
- package/dist/client/assets/{avatar-D8fhy6Ww.js → avatar-DwsJKOst.js} +1 -1
- package/dist/client/assets/{badge-DUUncEQr.js → badge-C6I3bZub.js} +1 -1
- package/dist/client/assets/{binder-BPAsHHtz.js → binder-DMkBMJDe.js} +1 -1
- package/dist/client/assets/{button-CrpAre8y.js → button-BVfOTfpc.js} +1 -1
- package/dist/client/assets/{card-DFAR9fdq.js → card-C1ZVlkU0.js} +1 -1
- package/dist/client/assets/{checkbox-C3_7sazf.js → checkbox-DAuxoUuR.js} +1 -1
- package/dist/client/assets/{circle-alert-CKX7xMwa.js → circle-alert-DuAEeMx-.js} +1 -1
- package/dist/client/assets/collapsible-GqoDHWGA.js +23 -0
- package/dist/client/assets/{collection-detail-P4xS7bsU.js → collection-detail-ComoILCe.js} +1 -1
- package/dist/client/assets/{collection-display-button-Bg3dpeu8.js → collection-display-button-ChMvUn2E.js} +1 -1
- package/dist/client/assets/{collection-header-otDJIXED.js → collection-header-CJErncxY.js} +1 -1
- package/dist/client/assets/{collection-page-CUjvCEL-.js → collection-page-Bi-tbERp.js} +1 -1
- package/dist/client/assets/{collection-search-DCaFQu6x.js → collection-search-BzoiV2-u.js} +1 -1
- package/dist/client/assets/{collection-tab-CzmKWGIs.js → collection-tab-1YVo2yy8.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-DGYtCyoO.js → collection-table-wrapper-thG71bGI.js} +1 -1
- package/dist/client/assets/{connect-BdCEolcr.js → connect-Cdro5khB.js} +1 -1
- package/dist/client/assets/{connection-card-rs_E5lwE.js → connection-card-ss7oQ1sY.js} +1 -1
- package/dist/client/assets/{connection-detail-DmZtLLGV.js → connection-detail-D8BVZUed.js} +1 -1
- package/dist/client/assets/{connections-cBCnIsVT.js → connections-BmxtYRou.js} +1 -1
- package/dist/client/assets/{constants-CAezfWK1.js → constants-BW4JZ47T.js} +1 -1
- package/dist/client/assets/constants-CBcj5NvV.js +1 -0
- package/dist/client/assets/{create-organization-dialog-BPmyxFH3.js → create-organization-dialog-5VVOifK_.js} +1 -1
- package/dist/client/assets/{dialog-DHQqGK7g.js → dialog-BKc0uyIf.js} +1 -1
- package/dist/client/assets/{dropdown-menu-C8F0EsLR.js → dropdown-menu-COxc-l2r.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-D4RjVErB.js → dynamic-plugin-layout-D0Ome1yQ.js} +1 -1
- package/dist/client/assets/{empty-state--pBjJrWJ.js → empty-state-BA1dna4T.js} +1 -1
- package/dist/client/assets/{empty-state-DrxI6i2r.js → empty-state-Cu7Vuwtc.js} +1 -1
- package/dist/client/assets/env-vars-editor-V0t9-7eJ.js +1 -0
- package/dist/client/assets/{error-boundary-C4ZiBZqG.js → error-boundary-DGWOOFEb.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BQo5YaFM.js → extract-connection-data-CUU0Xk9N.js} +1 -1
- package/dist/client/assets/{file-browser-DsCPH1Ag.js → file-browser-DlzXa6OC.js} +2 -2
- package/dist/client/assets/{form-DQQrIzsV.js → form-CVtLpajs.js} +1 -1
- package/dist/client/assets/{grid-view-DW981ZW7.js → grid-view-C-AwkYIf.js} +1 -1
- package/dist/client/assets/{home-D-N7CfPC.js → home-CNkoFZIO.js} +1 -1
- package/dist/client/assets/{index-M3wOD-T-.js → index-BcdQIGUF.js} +32 -32
- package/dist/client/assets/{index-D55GsjfR.js → index-CCsaEkmm.js} +2 -2
- package/dist/client/assets/{index-BVCaXPqJ.js → index-D47Uffzr.js} +1 -1
- package/dist/client/assets/index-DXup9nzR.js +1 -0
- package/dist/client/assets/{index-CsFpv8QQ.js → index-Der3_fHk.js} +1 -1
- package/dist/client/assets/index-DmpB2YV8.js +1 -0
- package/dist/client/assets/{infiniteQueryObserver-CfX1I4Ag.js → infiniteQueryObserver-DrveVX8A.js} +1 -1
- package/dist/client/assets/{input-YM08EPCC.js → input-CUCPZMz2.js} +1 -1
- package/dist/client/assets/{layout-BHkRlBCz.js → layout-BbogDOP_.js} +1 -1
- package/dist/client/assets/localstorage-keys-du1r-Z9U.js +1 -0
- package/dist/client/assets/{login-DST3z8Qq.js → login-DmgPNC9v.js} +1 -1
- package/dist/client/assets/{mcp-oauth-PtJaIBSs.js → mcp-oauth-JUhR-zCP.js} +1 -1
- package/dist/client/assets/{mcp-server-card-BGCxJtFs.js → mcp-server-card-BljG3HDb.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-CLu2K73s.js → mcp-server-detail-CnzqXowm.js} +2 -2
- package/dist/client/assets/{members-DdELhmRF.js → members-C_HxHJzG.js} +1 -1
- package/dist/client/assets/{monaco-editor-i9oMLTE9.js → monaco-editor-CBeaXMU-.js} +1 -1
- package/dist/client/assets/{monitoring-CVIH1wIi.js → monitoring-Bvmrto3t.js} +1 -1
- package/dist/client/assets/{oauth-callback-BHMg2ciL.js → oauth-callback-CKCDA102.js} +1 -1
- package/dist/client/assets/{page-DVKYkPd1.js → page-CR4MuyMw.js} +1 -1
- package/dist/client/assets/{page-DAZ87OMt.js → page-dZAP2FO7.js} +1 -1
- package/dist/client/assets/{pin-to-sidebar-button-CnJDDpqU.js → pin-to-sidebar-button-D1PDIW9U.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-CRXDez4A.js → plugin-empty-state-UWD4gqMv.js} +1 -1
- package/dist/client/assets/{plugin-header-BW0ZqJ9r.js → plugin-header--R1hkRV-.js} +1 -1
- package/dist/client/assets/plugins-B39yvsMR.js +1 -0
- package/dist/client/assets/{popover-B_5ZVJni.js → popover-LSiJhuO3.js} +1 -1
- package/dist/client/assets/{registry-utils-CcsfK0rU.js → registry-utils-BtoR-qhS.js} +1 -1
- package/dist/client/assets/{resizable-rgbJMlXu.js → resizable-CQSJSF2D.js} +1 -1
- package/dist/client/assets/{resource-tabs-DnsGbVCQ.js → resource-tabs-4g29YzhM.js} +1 -1
- package/dist/client/assets/{select-D2wMncj-.js → select-Bti-BgCx.js} +1 -1
- package/dist/client/assets/{settings-CLiZONWL.js → settings-DiOvc3SE.js} +1 -1
- package/dist/client/assets/{shell-layout-Cjy6ltJC.js → shell-layout-BEh2pmUE.js} +2 -2
- package/dist/client/assets/{spinner-B3atGTOQ.js → spinner-Fg4ciUuT.js} +1 -1
- package/dist/client/assets/{store-invite-Ckjal6E8.js → store-invite-fnQnsnI3.js} +1 -1
- package/dist/client/assets/{switch-DKUU5EKy.js → switch-Dj3WkUS4.js} +1 -1
- package/dist/client/assets/{textarea-55XlgpLZ.js → textarea-DeK9qU4Z.js} +1 -1
- package/dist/client/assets/{tools-list-ENMGYPBW.js → tools-list-BeFKqIIs.js} +1 -1
- package/dist/client/assets/{tooltip-D1Jc2Tgr.js → tooltip-DDTkATYg.js} +1 -1
- package/dist/client/assets/{typewriter-title-1wCftG4E.js → typewriter-title-DbQkTfun.js} +2 -2
- package/dist/client/assets/{use-binding-DdMe4omo.js → use-binding-Cx0cnXwg.js} +1 -1
- package/dist/client/assets/{use-collections-COu7mzCX.js → use-collections-D97KvVa9.js} +1 -1
- package/dist/client/assets/{use-connection-D5-dSK3A.js → use-connection-C76BYat1.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BaTDfij5.js → use-create-virtual-mcp-DazESShZ.js} +1 -1
- package/dist/client/assets/{use-deco-chat-open-BRCU7WzQ.js → use-deco-chat-open-u5zZi1de.js} +1 -1
- package/dist/client/assets/{use-list-state-xhqAqE-A.js → use-list-state-BrsvhCvu.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-BLDzHD20.js → use-mcp-prompts-DzCHcPVg.js} +1 -1
- package/dist/client/assets/{use-members-IqhuQTuW.js → use-members-BGZRzPKD.js} +1 -1
- package/dist/client/assets/{use-mobile-DIZjLJK7.js → use-mobile-0MLmfurT.js} +1 -1
- package/dist/client/assets/{use-organization-settings-D9D-nJ5w.js → use-organization-settings-K9WNKRlW.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-Ciz726kq.js → use-virtual-mcp-TOs4GWZq.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-etEZJXp8.js +1 -0
- package/dist/client/assets/{useMutation-i3JyomhH.js → useMutation-C7y5vUn8.js} +1 -1
- package/dist/client/assets/useQuery-frKnQxkY.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-7GUdjJBj.js +1 -0
- package/dist/client/assets/{view-mode-toggle-DWoBF8kY.js → view-mode-toggle-JXEPDzFm.js} +1 -1
- package/dist/client/assets/{workflow-BQn7VIZF.js → workflow-BUf_HFcm.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +163 -163
- package/dist/server/migrate.js +148 -148
- package/dist/server/server.js +140 -140
- package/package.json +1 -1
- package/dist/client/assets/agent-detail-ByBpnMWY.js +0 -1
- package/dist/client/assets/collapsible-CNHksBot.js +0 -23
- package/dist/client/assets/constants-AccVhxEg.js +0 -1
- package/dist/client/assets/env-vars-editor-B2cK0oXN.js +0 -1
- package/dist/client/assets/index-CYuJPFs9.js +0 -1
- package/dist/client/assets/index-DaTQM6wc.js +0 -1
- package/dist/client/assets/localstorage-keys-hwI1e15G.js +0 -1
- package/dist/client/assets/plugins-Ciz3DPby.js +0 -1
- package/dist/client/assets/useInfiniteQuery-DZakeCfr.js +0 -1
- package/dist/client/assets/useQuery-BQUu3Rwx.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-aRxFMhU5.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aR as g,aS as u,c as l,j as v,$ as b,t as p}from"./index-BcdQIGUF.js";function x(...a){return g(u(a))}const f=p("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive cursor-pointer",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border text-foreground bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-foreground/80 hover:text-foreground",brand:"bg-brand-green-light text-brand-green-dark hover:bg-brand-green-light/90"},size:{default:"h-10 px-4 py-2 has-[>svg]:px-3",sm:"h-7 gap-1.5 px-3 has-[>svg]:px-2.5",xs:"h-6 gap-1 px-2 text-xs has-[>svg]:px-1.5",lg:"h-10 px-6 has-[>svg]:px-4",icon:"size-10"}},defaultVariants:{variant:"default",size:"default"}});function k(a){const e=l.c(14);let t,r,s,o,i;e[0]!==a?({className:t,variant:i,size:s,asChild:o,...r}=a,e[0]=a,e[1]=t,e[2]=r,e[3]=s,e[4]=o,e[5]=i):(t=e[1],r=e[2],s=e[3],o=e[4],i=e[5]);const c=(o===void 0?!1:o)?b:"button";let n;e[6]!==t||e[7]!==s||e[8]!==i?(n=x(f({variant:i,size:s,className:t})),e[6]=t,e[7]=s,e[8]=i,e[9]=n):n=e[9];let d;return e[10]!==c||e[11]!==r||e[12]!==n?(d=v.jsx(c,{"data-slot":"button",className:n,...r}),e[10]=c,e[11]=r,e[12]=n,e[13]=d):d=e[13],d}export{k as B,f as b,x as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c,j as l}from"./index-
|
|
1
|
+
import{c,j as l}from"./index-BcdQIGUF.js";import{c as n}from"./button-BVfOTfpc.js";function f(o){const e=c.c(8);let r,t;e[0]!==o?({className:r,...t}=o,e[0]=o,e[1]=r,e[2]=t):(r=e[1],t=e[2]);let s;e[3]!==r?(s=n("bg-card text-card-foreground hover:bg-accent/50 flex flex-col gap-6 rounded-xl border border-border/75",r),e[3]=r,e[4]=s):s=e[4];let a;return e[5]!==t||e[6]!==s?(a=l.jsx("div",{"data-slot":"card",className:s,...t}),e[5]=t,e[6]=s,e[7]=a):a=e[7],a}function p(o){const e=c.c(4);let r;e[0]!==o?({...r}=o,e[0]=o,e[1]=r):r=e[1];let t;return e[2]!==r?(t=l.jsx("div",{"data-slot":"card-content",...r}),e[2]=r,e[3]=t):t=e[3],t}export{f as C,p as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as d,j as c,
|
|
1
|
+
import{c as d,j as c,ae as n,af as l}from"./index-BcdQIGUF.js";import{i as m}from"./Check-CeorNg_Q.js";import{c as b}from"./button-BVfOTfpc.js";function x(o){const e=d.c(9);let r,a;e[0]!==o?({className:r,...a}=o,e[0]=o,e[1]=r,e[2]=a):(r=e[1],a=e[2]);let i;e[3]!==r?(i=b("peer border-foreground dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",r),e[3]=r,e[4]=i):i=e[4];let t;e[5]===Symbol.for("react.memo_cache_sentinel")?(t=c.jsx(l,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-primary-foreground transition-none",children:c.jsx(m,{className:"size-3.5"})}),e[5]=t):t=e[5];let s;return e[6]!==a||e[7]!==i?(s=c.jsx(n,{"data-slot":"checkbox",className:i,...a,children:t}),e[6]=a,e[7]=i,e[8]=s):s=e[8],s}export{x as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c}from"./index-
|
|
1
|
+
import{r as c}from"./index-BcdQIGUF.js";const h=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),y=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,o)=>o?o.toUpperCase():r.toLowerCase()),i=t=>{const e=y(t);return e.charAt(0).toUpperCase()+e.slice(1)},l=(...t)=>t.filter((e,r,o)=>!!e&&e.trim()!==""&&o.indexOf(e)===r).join(" ").trim(),f=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var k={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const w=c.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:s="",children:a,iconNode:p,...n},d)=>c.createElement("svg",{ref:d,...k,width:e,height:e,stroke:t,strokeWidth:o?Number(r)*24/Number(e):r,className:l("lucide",s),...!a&&!f(n)&&{"aria-hidden":"true"},...n},[...p.map(([m,C])=>c.createElement(m,C)),...Array.isArray(a)?a:[a]]));const u=(t,e)=>{const r=c.forwardRef(({className:o,...s},a)=>c.createElement(w,{ref:a,iconNode:e,className:l(`lucide-${h(i(t))}`,`lucide-${t}`,o),...s}));return r.displayName=i(t),r};const g=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],b=u("check",g);const x=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],L=u("circle-alert",x);export{L as C,b as a,u as c};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{r as C,bu as Na,bv as Ca,a0 as Ta,bd as B,s as h,bw as je,bx as Ot,bh as Aa,bi as Ma,bc as Ra,be as U,b8 as Ie,n as Ne,o as R,bf as I,bg as re,by as ja,bz as O,_ as Oa,bq as ka,c as D,u as Ce,a as kt,K as Pt,ab as Pa,ao as ze,j as d,g as Da,w as $a,x as Xe,aw as La,z as Za,E as Fa,D as Ua,y as za,b1 as Ba}from"./index-BcdQIGUF.js";import{u as ke,a as Ke,d as Va}from"./constants-BW4JZ47T.js";import{b as qa}from"./use-virtual-mcp-TOs4GWZq.js";import{b as Dt}from"./use-collections-D97KvVa9.js";import{b as Ja}from"./use-connection-C76BYat1.js";import{a as Wa}from"./use-binding-Cx0cnXwg.js";import{u as Ha}from"./useSuspenseInfiniteQuery-7GUdjJBj.js";import{u as Be,L as $t}from"./localstorage-keys-du1r-Z9U.js";import{c as et,B as Ya}from"./button-BVfOTfpc.js";import{I as Ga}from"./input-CUCPZMz2.js";import{P as Qa,a as Xa,b as Ka}from"./popover-LSiJhuO3.js";import{S as es,a as ts,b as as,c as ss,d as rs}from"./select-Bti-BgCx.js";import{t as ut}from"./ChevronDown-DHgzfDOn.js";import{i as ns}from"./File06-D3YhRSWf.js";import{c as os}from"./Grid01-C0Yt3TrW.js";import{a as is}from"./Image01-BxGEkI20.js";import{i as Lt}from"./SearchMd-XlpqEN-D.js";var Ee;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function a(r){throw new Error}t.assertNever=a,t.arrayToEnum=r=>{const n={};for(const i of r)n[i]=i;return n},t.getValidEnumValues=r=>{const n=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(const o of n)i[o]=r[o];return t.objectValues(i)},t.objectValues=r=>t.objectKeys(r).map(function(n){return r[n]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const n=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push(i);return n},t.find=(r,n)=>{for(const i of r)if(n(i))return i},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,n=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}t.joinValues=s,t.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(Ee||(Ee={}));var dt;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(dt||(dt={}));Ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Ee.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Oe extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(n){return n.message},s={_errors:[]},r=n=>{for(const i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(a(i));else{let o=s,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(a(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return r(this),s}static assert(e){if(!(e instanceof Oe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ee.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a=Object.create(null),s=[];for(const r of this.issues)if(r.path.length>0){const n=r.path[0];a[n]=a[n]||[],a[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:a}}get formErrors(){return this.flatten()}}Oe.create=t=>new Oe(t);var pt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(pt||(pt={}));var w;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(w||(w={}));const Zt=({size:t=24,color:e="currentColor",...a})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},C.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));Zt.displayName="ChevronSelectorVertical";const Ft=({size:t=24,color:e="currentColor",...a})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},C.createElement("path",{d:"M6 16a4 4 0 0 0 4 4h4a4 4 0 0 0 0-8h-4a4 4 0 0 1 0-8h4a4 4 0 0 1 4 4m-6-6v20"}));Ft.displayName="CurrencyDollar";const Ut=({size:t=24,color:e="currentColor",...a})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},C.createElement("path",{d:"m18 8 4 4m0 0-4 4m4-4H9m6-7.796A8.383 8.383 0 0 0 10.667 3C5.88 3 2 7.03 2 12s3.88 9 8.667 9A8.384 8.384 0 0 0 15 19.796"}));Ut.displayName="LogOut04";const zt=({size:t=24,color:e="currentColor",...a})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},C.createElement("path",{d:"m6.5 13 .784 1.569c.266.53.399.796.576 1.026a3 3 0 0 0 .545.545c.23.177.495.31 1.026.575L11 17.5l-1.569.785c-.53.265-.796.398-1.026.575a3 3 0 0 0-.545.545c-.177.23-.31.495-.576 1.026L6.5 22l-.784-1.569c-.266-.53-.399-.796-.576-1.026a3 3 0 0 0-.545-.545c-.23-.177-.495-.31-1.026-.575L2 17.5l1.569-.785c.53-.265.796-.398 1.026-.575a3 3 0 0 0 .545-.545c.177-.23.31-.495.576-1.026L6.5 13ZM15 2l1.179 3.064c.282.734.423 1.1.642 1.409a3 3 0 0 0 .706.706c.309.22.675.36 1.409.642L22 9l-3.064 1.179c-.734.282-1.1.423-1.409.642a3 3 0 0 0-.706.706c-.22.309-.36.675-.642 1.409L15 16l-1.179-3.064c-.282-.734-.423-1.1-.642-1.409a3 3 0 0 0-.706-.706c-.309-.22-.675-.36-1.409-.642L8 9l3.064-1.179c.734-.282 1.1-.423 1.409-.642a3 3 0 0 0 .706-.706c.22-.309.36-.675.642-1.409L15 2Z"}));zt.displayName="Stars01";var Bt="vercel.ai.error",ls=Symbol.for(Bt),mt,ft,Q=class Vt extends(ft=Error,mt=ls,ft){constructor({name:e,message:a,cause:s}){super(a),this[mt]=!0,this.name=e,this.cause=s}static isInstance(e){return Vt.hasMarker(e,Bt)}static hasMarker(e,a){const s=Symbol.for(a);return e!=null&&typeof e=="object"&&s in e&&typeof e[s]=="boolean"&&e[s]===!0}};function qt(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var Jt="AI_InvalidArgumentError",Wt=`vercel.ai.error.${Jt}`,cs=Symbol.for(Wt),ht,gt,us=class extends(gt=Q,ht=cs,gt){constructor({message:t,cause:e,argument:a}){super({name:Jt,message:t,cause:e}),this[ht]=!0,this.argument=a}static isInstance(t){return Q.hasMarker(t,Wt)}},Ht="AI_JSONParseError",Yt=`vercel.ai.error.${Ht}`,ds=Symbol.for(Yt),vt,yt,bt=class extends(yt=Q,vt=ds,yt){constructor({text:t,cause:e}){super({name:Ht,message:`JSON parsing failed: Text: ${t}.
|
|
2
|
+
Error message: ${qt(e)}`,cause:e}),this[vt]=!0,this.text=t}static isInstance(t){return Q.hasMarker(t,Yt)}},Gt="AI_TypeValidationError",Qt=`vercel.ai.error.${Gt}`,ps=Symbol.for(Qt),xt,_t,ve=class Ve extends(_t=Q,xt=ps,_t){constructor({value:e,cause:a,context:s}){let r="Type validation failed";if(s?.field&&(r+=` for ${s.field}`),s?.entityName||s?.entityId){r+=" (";const n=[];s.entityName&&n.push(s.entityName),s.entityId&&n.push(`id: "${s.entityId}"`),r+=n.join(", "),r+=")"}super({name:Gt,message:`${r}: Value: ${JSON.stringify(e)}.
|
|
3
|
+
Error message: ${qt(a)}`,cause:a}),this[xt]=!0,this.value=e,this.context=s}static isInstance(e){return Q.hasMarker(e,Qt)}static wrap({value:e,cause:a,context:s}){var r,n,i;return Ve.isInstance(a)&&a.value===e&&((r=a.context)==null?void 0:r.field)===s?.field&&((n=a.context)==null?void 0:n.entityName)===s?.entityName&&((i=a.context)==null?void 0:i.entityId)===s?.entityId?a:new Ve({value:e,cause:a,context:s})}},Te=({prefix:t,size:e=16,alphabet:a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:s="-"}={})=>{const r=()=>{const n=a.length,i=new Array(e);for(let o=0;o<e;o++)i[o]=a[Math.random()*n|0];return i.join("")};if(t==null)return r;if(a.includes(s))throw new us({argument:"separator",message:`The separator "${s}" must not be part of the alphabet "${a}".`});return()=>`${t}${s}${r()}`},ms=Te();function It(t=globalThis){var e,a,s;return t.window?"runtime/browser":(e=t.navigator)!=null&&e.userAgent?`runtime/${t.navigator.userAgent.toLowerCase()}`:(s=(a=t.process)==null?void 0:a.versions)!=null&&s.node?`runtime/node.js/${t.process.version.substring(0)}`:t.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function pe(t){if(t==null)return{};const e={};if(t instanceof Headers)t.forEach((a,s)=>{e[s.toLowerCase()]=a});else{Array.isArray(t)||(t=Object.entries(t));for(const[a,s]of t)s!=null&&(e[a.toLowerCase()]=s)}return e}function Et(t,...e){const a=new Headers(pe(t)),s=a.get("user-agent")||"";return a.set("user-agent",[s,...e].filter(Boolean).join(" ")),Object.fromEntries(a.entries())}var fs=/"__proto__"\s*:/,hs=/"constructor"\s*:/;function wt(t){const e=JSON.parse(t);return e===null||typeof e!="object"||fs.test(t)===!1&&hs.test(t)===!1?e:gs(e)}function gs(t){let e=[t];for(;e.length;){const a=e;e=[];for(const s of a){if(Object.prototype.hasOwnProperty.call(s,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(s,"constructor")&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const r in s){const n=s[r];n&&typeof n=="object"&&e.push(n)}}}return t}function vs(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return wt(t)}try{return wt(t)}finally{Error.stackTraceLimit=e}}function tt(t){if(t.type==="object"||Array.isArray(t.type)&&t.type.includes("object")){t.additionalProperties=!1;const{properties:a}=t;if(a!=null)for(const s of Object.keys(a))a[s]=de(a[s])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(de):de(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(de)),t.allOf!=null&&(t.allOf=t.allOf.map(de)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(de));const{definitions:e}=t;if(e!=null)for(const a of Object.keys(e))e[a]=de(e[a]);return t}function de(t){return typeof t=="boolean"?t:tt(t)}var ys=Symbol("Let zodToJsonSchema decide on which parser to use"),St={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},bs=t=>typeof t=="string"?{...St,name:t}:{...St,...t};function q(){return{}}function xs(t,e){var a,s,r;const n={type:"array"};return(a=t.type)!=null&&a._def&&((r=(s=t.type)==null?void 0:s._def)==null?void 0:r.typeName)!==w.ZodAny&&(n.items=M(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(n.minItems=t.minLength.value),t.maxLength&&(n.maxItems=t.maxLength.value),t.exactLength&&(n.minItems=t.exactLength.value,n.maxItems=t.exactLength.value),n}function _s(t){const e={type:"integer",format:"int64"};if(!t.checks)return e;for(const a of t.checks)switch(a.kind){case"min":a.inclusive?e.minimum=a.value:e.exclusiveMinimum=a.value;break;case"max":a.inclusive?e.maximum=a.value:e.exclusiveMaximum=a.value;break;case"multipleOf":e.multipleOf=a.value;break}return e}function Is(){return{type:"boolean"}}function Xt(t,e){return M(t.type._def,e)}var Es=(t,e)=>M(t.innerType._def,e);function Kt(t,e,a){const s=a??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>Kt(t,e,r))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return ws(t)}}var ws=t=>{const e={type:"integer",format:"unix-time"};for(const a of t.checks)switch(a.kind){case"min":e.minimum=a.value;break;case"max":e.maximum=a.value;break}return e};function Ss(t,e){return{...M(t.innerType._def,e),default:t.defaultValue()}}function Ns(t,e){return e.effectStrategy==="input"?M(t.schema._def,e):q()}function Cs(t){return{type:"string",enum:Array.from(t.values)}}var Ts=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function As(t,e){const a=[M(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),M(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(r=>!!r),s=[];return a.forEach(r=>{if(Ts(r))s.push(...r.allOf);else{let n=r;if("additionalProperties"in r&&r.additionalProperties===!1){const{additionalProperties:i,...o}=r;n=o}s.push(n)}}),s.length?{allOf:s}:void 0}function Ms(t){const e=typeof t.value;return e!=="bigint"&&e!=="number"&&e!=="boolean"&&e!=="string"?{type:Array.isArray(t.value)?"array":"object"}:{type:e==="bigint"?"integer":e,const:t.value}}var Ze=void 0,H={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Ze===void 0&&(Ze=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ze),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function ea(t,e){const a={type:"string"};if(t.checks)for(const s of t.checks)switch(s.kind){case"min":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value;break;case"max":a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value;break;case"email":switch(e.emailStrategy){case"format:email":Y(a,"email",s.message,e);break;case"format:idn-email":Y(a,"idn-email",s.message,e);break;case"pattern:zod":F(a,H.email,s.message,e);break}break;case"url":Y(a,"uri",s.message,e);break;case"uuid":Y(a,"uuid",s.message,e);break;case"regex":F(a,s.regex,s.message,e);break;case"cuid":F(a,H.cuid,s.message,e);break;case"cuid2":F(a,H.cuid2,s.message,e);break;case"startsWith":F(a,RegExp(`^${Fe(s.value,e)}`),s.message,e);break;case"endsWith":F(a,RegExp(`${Fe(s.value,e)}$`),s.message,e);break;case"datetime":Y(a,"date-time",s.message,e);break;case"date":Y(a,"date",s.message,e);break;case"time":Y(a,"time",s.message,e);break;case"duration":Y(a,"duration",s.message,e);break;case"length":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value,a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value;break;case"includes":{F(a,RegExp(Fe(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&Y(a,"ipv4",s.message,e),s.version!=="v4"&&Y(a,"ipv6",s.message,e);break}case"base64url":F(a,H.base64url,s.message,e);break;case"jwt":F(a,H.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&F(a,H.ipv4Cidr,s.message,e),s.version!=="v4"&&F(a,H.ipv6Cidr,s.message,e);break}case"emoji":F(a,H.emoji(),s.message,e);break;case"ulid":{F(a,H.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Y(a,"binary",s.message,e);break}case"contentEncoding:base64":{a.contentEncoding="base64";break}case"pattern:zod":{F(a,H.base64,s.message,e);break}}break}case"nanoid":F(a,H.nanoid,s.message,e)}return a}function Fe(t,e){return e.patternStrategy==="escape"?js(t):t}var Rs=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function js(t){let e="";for(let a=0;a<t.length;a++)Rs.has(t[a])||(e+="\\"),e+=t[a];return e}function Y(t,e,a,s){var r;t.format||(r=t.anyOf)!=null&&r.some(n=>n.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format}),delete t.format),t.anyOf.push({format:e,...a&&s.errorMessages&&{errorMessage:{format:a}}})):t.format=e}function F(t,e,a,s){var r;t.pattern||(r=t.allOf)!=null&&r.some(n=>n.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern}),delete t.pattern),t.allOf.push({pattern:Nt(e,s),...a&&s.errorMessages&&{errorMessage:{pattern:a}}})):t.pattern=Nt(e,s)}function Nt(t,e){var a;if(!e.applyRegexFlags||!t.flags)return t.source;const s={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},r=s.i?t.source.toLowerCase():t.source;let n="",i=!1,o=!1,c=!1;for(let l=0;l<r.length;l++){if(i){n+=r[l],i=!1;continue}if(s.i){if(o){if(r[l].match(/[a-z]/)){c?(n+=r[l],n+=`${r[l-2]}-${r[l]}`.toUpperCase(),c=!1):r[l+1]==="-"&&((a=r[l+2])!=null&&a.match(/[a-z]/))?(n+=r[l],c=!0):n+=`${r[l]}${r[l].toUpperCase()}`;continue}}else if(r[l].match(/[a-z]/)){n+=`[${r[l]}${r[l].toUpperCase()}]`;continue}}if(s.m){if(r[l]==="^"){n+=`(^|(?<=[\r
|
|
4
|
+
]))`;continue}else if(r[l]==="$"){n+=`($|(?=[\r
|
|
5
|
+
]))`;continue}}if(s.s&&r[l]==="."){n+=o?`${r[l]}\r
|
|
6
|
+
`:`[${r[l]}\r
|
|
7
|
+
]`;continue}n+=r[l],r[l]==="\\"?i=!0:o&&r[l]==="]"?o=!1:!o&&r[l]==="["&&(o=!0)}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return n}function ta(t,e){var a,s,r,n,i,o;const c={type:"object",additionalProperties:(a=M(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?a:e.allowedAdditionalProperties};if(((s=t.keyType)==null?void 0:s._def.typeName)===w.ZodString&&((r=t.keyType._def.checks)!=null&&r.length)){const{type:l,...p}=ea(t.keyType._def,e);return{...c,propertyNames:p}}else{if(((n=t.keyType)==null?void 0:n._def.typeName)===w.ZodEnum)return{...c,propertyNames:{enum:t.keyType._def.values}};if(((i=t.keyType)==null?void 0:i._def.typeName)===w.ZodBranded&&t.keyType._def.type._def.typeName===w.ZodString&&((o=t.keyType._def.type._def.checks)!=null&&o.length)){const{type:l,...p}=Xt(t.keyType._def,e);return{...c,propertyNames:p}}}return c}function Os(t,e){if(e.mapStrategy==="record")return ta(t,e);const a=M(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||q(),s=M(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||q();return{type:"array",maxItems:125,items:{type:"array",items:[a,s],minItems:2,maxItems:2}}}function ks(t){const e=t.values,s=Object.keys(t.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(s.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function Ps(){return{not:q()}}function Ds(){return{type:"null"}}var qe={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function $s(t,e){const a=t.options instanceof Map?Array.from(t.options.values()):t.options;if(a.every(s=>s._def.typeName in qe&&(!s._def.checks||!s._def.checks.length))){const s=a.reduce((r,n)=>{const i=qe[n._def.typeName];return i&&!r.includes(i)?[...r,i]:r},[]);return{type:s.length>1?s:s[0]}}else if(a.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){const s=a.reduce((r,n)=>{const i=typeof n._def.value;switch(i){case"string":case"number":case"boolean":return[...r,i];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];default:return r}},[]);if(s.length===a.length){const r=s.filter((n,i,o)=>o.indexOf(n)===i);return{type:r.length>1?r:r[0],enum:a.reduce((n,i)=>n.includes(i._def.value)?n:[...n,i._def.value],[])}}}else if(a.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:a.reduce((s,r)=>[...s,...r._def.values.filter(n=>!s.includes(n))],[])};return Ls(t,e)}var Ls=(t,e)=>{const a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,r)=>M(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return a.length?{anyOf:a}:void 0};function Zs(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[qe[t.innerType._def.typeName],"null"]};const a=M(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function Fs(t){const e={type:"number"};if(!t.checks)return e;for(const a of t.checks)switch(a.kind){case"int":e.type="integer";break;case"min":a.inclusive?e.minimum=a.value:e.exclusiveMinimum=a.value;break;case"max":a.inclusive?e.maximum=a.value:e.exclusiveMaximum=a.value;break;case"multipleOf":e.multipleOf=a.value;break}return e}function Us(t,e){const a={type:"object",properties:{}},s=[],r=t.shape();for(const i in r){let o=r[i];if(o===void 0||o._def===void 0)continue;const c=Bs(o),l=M(o._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});l!==void 0&&(a.properties[i]=l,c||s.push(i))}s.length&&(a.required=s);const n=zs(t,e);return n!==void 0&&(a.additionalProperties=n),a}function zs(t,e){if(t.catchall._def.typeName!=="ZodNever")return M(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Bs(t){try{return t.isOptional()}catch{return!0}}var Vs=(t,e)=>{var a;if(e.currentPath.toString()===((a=e.propertyPath)==null?void 0:a.toString()))return M(t.innerType._def,e);const s=M(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return s?{anyOf:[{not:q()},s]}:q()},qs=(t,e)=>{if(e.pipeStrategy==="input")return M(t.in._def,e);if(e.pipeStrategy==="output")return M(t.out._def,e);const a=M(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=M(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,s].filter(r=>r!==void 0)}};function Js(t,e){return M(t.type._def,e)}function Ws(t,e){const s={type:"array",uniqueItems:!0,items:M(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(s.minItems=t.minSize.value),t.maxSize&&(s.maxItems=t.maxSize.value),s}function Hs(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((a,s)=>M(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[]),additionalItems:M(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((a,s)=>M(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[])}}function Ys(){return{not:q()}}function Gs(){return q()}var Qs=(t,e)=>M(t.innerType._def,e),Xs=(t,e,a)=>{switch(e){case w.ZodString:return ea(t,a);case w.ZodNumber:return Fs(t);case w.ZodObject:return Us(t,a);case w.ZodBigInt:return _s(t);case w.ZodBoolean:return Is();case w.ZodDate:return Kt(t,a);case w.ZodUndefined:return Ys();case w.ZodNull:return Ds();case w.ZodArray:return xs(t,a);case w.ZodUnion:case w.ZodDiscriminatedUnion:return $s(t,a);case w.ZodIntersection:return As(t,a);case w.ZodTuple:return Hs(t,a);case w.ZodRecord:return ta(t,a);case w.ZodLiteral:return Ms(t);case w.ZodEnum:return Cs(t);case w.ZodNativeEnum:return ks(t);case w.ZodNullable:return Zs(t,a);case w.ZodOptional:return Vs(t,a);case w.ZodMap:return Os(t,a);case w.ZodSet:return Ws(t,a);case w.ZodLazy:return()=>t.getter()._def;case w.ZodPromise:return Js(t,a);case w.ZodNaN:case w.ZodNever:return Ps();case w.ZodEffects:return Ns(t,a);case w.ZodAny:return q();case w.ZodUnknown:return Gs();case w.ZodDefault:return Ss(t,a);case w.ZodBranded:return Xt(t,a);case w.ZodReadonly:return Qs(t,a);case w.ZodCatch:return Es(t,a);case w.ZodPipeline:return qs(t,a);case w.ZodFunction:case w.ZodVoid:case w.ZodSymbol:return;default:return(s=>{})()}},Ks=(t,e)=>{let a=0;for(;a<t.length&&a<e.length&&t[a]===e[a];a++);return[(t.length-a).toString(),...e.slice(a)].join("/")};function M(t,e,a=!1){var s;const r=e.seen.get(t);if(e.override){const c=(s=e.override)==null?void 0:s.call(e,t,e,r,a);if(c!==ys)return c}if(r&&!a){const c=er(r,e);if(c!==void 0)return c}const n={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,n);const i=Xs(t,t.typeName,e),o=typeof i=="function"?M(i(),e):i;if(o&&tr(t,e,o),e.postProcess){const c=e.postProcess(o,t,e);return n.jsonSchema=o,c}return n.jsonSchema=o,o}var er=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Ks(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((a,s)=>e.currentPath[s]===a)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),q()):e.$refStrategy==="seen"?q():void 0}},tr=(t,e,a)=>(t.description&&(a.description=t.description),a),ar=t=>{const e=bs(t),a=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}},sr=(t,e)=>{var a;const s=ar(e);let r=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[p,m])=>{var b;return{...l,[p]:(b=M(m._def,{...s,currentPath:[...s.basePath,s.definitionPath,p]},!0))!=null?b:q()}},{}):void 0;const n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=(a=M(t._def,n===void 0?s:{...s,currentPath:[...s.basePath,s.definitionPath,n]},!1))!=null?a:q(),o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(i.title=o);const c=n===void 0?r?{...i,[s.definitionPath]:r}:i:{$ref:[...s.$refStrategy==="relative"?[]:s.basePath,s.definitionPath,n].join("/"),[s.definitionPath]:{...r,[n]:i}};return c.$schema="http://json-schema.org/draft-07/schema#",c},Je=Symbol.for("vercel.ai.schema");function rr(t){let e;return()=>(e==null&&(e=t()),e)}function Pe(t,{validate:e}={}){return{[Je]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function nr(t){return typeof t=="object"&&t!==null&&Je in t&&t[Je]===!0&&"jsonSchema"in t&&"validate"in t}function at(t){return t==null?Pe({properties:{},additionalProperties:!1}):nr(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?aa(t):or(t):t()}function or(t){return Pe(()=>tt(t["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async e=>{const a=await t["~standard"].validate(e);return"value"in a?{success:!0,value:a.value}:{success:!1,error:new ve({value:e,cause:a.issues})}}})}function ir(t,e){var a;const s=(a=void 0)!=null?a:!1;return Pe(()=>sr(t,{$refStrategy:s?"root":"none"}),{validate:async r=>{const n=await t.safeParseAsync(r);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function lr(t,e){var a;const s=(a=void 0)!=null?a:!1;return Pe(()=>tt(Ta(t,{target:"draft-7",io:"input",reused:s?"ref":"inline"})),{validate:async r=>{const n=await Ca(t,r);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function cr(t){return"_zod"in t}function aa(t,e){return cr(t)?lr(t):ir(t)}async function Ct({value:t,schema:e,context:a}){const s=await we({value:t,schema:e,context:a});if(!s.success)throw ve.wrap({value:t,cause:s.error,context:a});return s.value}async function we({value:t,schema:e,context:a}){const s=at(e);try{if(s.validate==null)return{success:!0,value:t,rawValue:t};const r=await s.validate(t);return r.success?{success:!0,value:r.value,rawValue:t}:{success:!1,error:ve.wrap({value:t,cause:r.error,context:a}),rawValue:t}}catch(r){return{success:!1,error:ve.wrap({value:t,cause:r,context:a}),rawValue:t}}}async function me({text:t,schema:e}){try{const a=vs(t);return e==null?{success:!0,value:a,rawValue:a}:await we({value:a,schema:e})}catch(a){return{success:!1,error:bt.isInstance(a)?a:new bt({text:t,cause:a}),rawValue:void 0}}}function ur({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new Na).pipeThrough(new TransformStream({async transform({data:a},s){a!=="[DONE]"&&s.enqueue(await me({text:a,schema:e}))}}))}async function oe(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var dr=Object.defineProperty,pr=(t,e)=>{for(var a in e)dr(t,a,{get:e[a],enumerable:!0})},sa="AI_NoObjectGeneratedError",ra=`vercel.ai.error.${sa}`,mr=Symbol.for(ra),na,ie=class extends Q{constructor({message:t="No object generated.",cause:e,text:a,response:s,usage:r,finishReason:n}){super({name:sa,message:t,cause:e}),this[na]=!0,this.text=a,this.response=s,this.usage=r,this.finishReason=n}static isInstance(t){return Q.hasMarker(t,ra)}};na=mr;var oa="AI_UIMessageStreamError",ia=`vercel.ai.error.${oa}`,fr=Symbol.for(ia),la,fe=class extends Q{constructor({chunkType:t,chunkId:e,message:a}){super({name:oa,message:a}),this[la]=!0,this.chunkType=t,this.chunkId=e}static isInstance(t){return Q.hasMarker(t,ia)}};la=fr;var Tt="6.0.62",ca=B([h(),je(Uint8Array),je(ArrayBuffer),Ot(t=>{var e,a;return(a=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?a:!1},{message:"Must be a Buffer"})]),Se=Aa(()=>B([Ma(),h(),Ra(),U(),Ie(h(),Se.optional()),Ne(Se)])),A=Ie(h(),Ie(h(),Se.optional())),ua=R({type:I("text"),text:h(),providerOptions:A.optional()}),hr=R({type:I("image"),image:B([ca,je(URL)]),mediaType:h().optional(),providerOptions:A.optional()}),da=R({type:I("file"),data:B([ca,je(URL)]),filename:h().optional(),mediaType:h(),providerOptions:A.optional()}),gr=R({type:I("reasoning"),text:h(),providerOptions:A.optional()}),vr=R({type:I("tool-call"),toolCallId:h(),toolName:h(),input:re(),providerOptions:A.optional(),providerExecuted:U().optional()}),yr=ja("type",[R({type:I("text"),value:h(),providerOptions:A.optional()}),R({type:I("json"),value:Se,providerOptions:A.optional()}),R({type:I("execution-denied"),reason:h().optional(),providerOptions:A.optional()}),R({type:I("error-text"),value:h(),providerOptions:A.optional()}),R({type:I("error-json"),value:Se,providerOptions:A.optional()}),R({type:I("content"),value:Ne(B([R({type:I("text"),text:h(),providerOptions:A.optional()}),R({type:I("media"),data:h(),mediaType:h()}),R({type:I("file-data"),data:h(),mediaType:h(),filename:h().optional(),providerOptions:A.optional()}),R({type:I("file-url"),url:h(),providerOptions:A.optional()}),R({type:I("file-id"),fileId:B([h(),Ie(h(),h())]),providerOptions:A.optional()}),R({type:I("image-data"),data:h(),mediaType:h(),providerOptions:A.optional()}),R({type:I("image-url"),url:h(),providerOptions:A.optional()}),R({type:I("image-file-id"),fileId:B([h(),Ie(h(),h())]),providerOptions:A.optional()}),R({type:I("custom"),providerOptions:A.optional()})]))})]),pa=R({type:I("tool-result"),toolCallId:h(),toolName:h(),output:yr,providerOptions:A.optional()}),br=R({type:I("tool-approval-request"),approvalId:h(),toolCallId:h()}),xr=R({type:I("tool-approval-response"),approvalId:h(),approved:U(),reason:h().optional()}),_r=R({role:I("system"),content:h(),providerOptions:A.optional()}),Ir=R({role:I("user"),content:B([h(),Ne(B([ua,hr,da]))]),providerOptions:A.optional()}),Er=R({role:I("assistant"),content:B([h(),Ne(B([ua,da,gr,vr,pa,br]))]),providerOptions:A.optional()}),wr=R({role:I("tool"),content:Ne(B([pa,xr])),providerOptions:A.optional()});B([_r,Ir,Er,wr]);function ma(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;const a={...t};for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)){const r=e[s];if(r===void 0)continue;const n=s in t?t[s]:void 0,i=r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)&&!(r instanceof RegExp),o=n!=null&&typeof n=="object"&&!Array.isArray(n)&&!(n instanceof Date)&&!(n instanceof RegExp);i&&o?a[s]=ma(n,r):a[s]=r}return a}var Sr={};pr(Sr,{array:()=>Ar,choice:()=>Mr,json:()=>Rr,object:()=>Tr,text:()=>Cr});function Nr(t){const e=["ROOT"];let a=-1,s=null;function r(c,l,p){switch(c){case'"':{a=l,e.pop(),e.push(p),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{a=l,s=l,e.pop(),e.push(p),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(p),e.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{a=l,e.pop(),e.push(p),e.push("INSIDE_NUMBER");break}case"{":{a=l,e.pop(),e.push(p),e.push("INSIDE_OBJECT_START");break}case"[":{a=l,e.pop(),e.push(p),e.push("INSIDE_ARRAY_START");break}}}function n(c,l){switch(c){case",":{e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{a=l,e.pop();break}}}function i(c,l){switch(c){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{a=l,e.pop();break}}}for(let c=0;c<t.length;c++){const l=t[c];switch(e[e.length-1]){case"ROOT":r(l,c,"FINISH");break;case"INSIDE_OBJECT_START":{switch(l){case'"':{e.pop(),e.push("INSIDE_OBJECT_KEY");break}case"}":{a=c,e.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{l===":"&&(e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{r(l,c,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{n(l,c);break}case"INSIDE_STRING":{switch(l){case'"':{e.pop(),a=c;break}case"\\":{e.push("INSIDE_STRING_ESCAPE");break}default:a=c}break}case"INSIDE_ARRAY_START":{l==="]"?(a=c,e.pop()):(a=c,r(l,c,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(l){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{a=c,e.pop();break}default:{a=c;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{r(l,c,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{e.pop(),a=c;break}case"INSIDE_NUMBER":{switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{a=c;break}case"e":case"E":case"-":case".":break;case",":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&n(l,c);break}case"}":{e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&n(l,c);break}case"]":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c);break}default:{e.pop();break}}break}case"INSIDE_LITERAL":{const m=t.substring(s,c+1);!"false".startsWith(m)&&!"true".startsWith(m)&&!"null".startsWith(m)?(e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?n(l,c):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c)):a=c;break}}}let o=t.slice(0,a+1);for(let c=e.length-1;c>=0;c--)switch(e[c]){case"INSIDE_STRING":{o+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{o+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{o+="]";break}case"INSIDE_LITERAL":{const p=t.substring(s,t.length);"true".startsWith(p)?o+="true".slice(p.length):"false".startsWith(p)?o+="false".slice(p.length):"null".startsWith(p)&&(o+="null".slice(p.length))}}return o}async function Ae(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await me({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await me({text:Nr(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var Cr=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}},createElementStreamTransform(){}}),Tr=({schema:t,name:e,description:a})=>{const s=at(t);return{name:"object",responseFormat:oe(s.jsonSchema).then(r=>({type:"json",schema:r,...e!=null&&{name:e},...a!=null&&{description:a}})),async parseCompleteOutput({text:r},n){const i=await me({text:r});if(!i.success)throw new ie({message:"No object generated: could not parse the response.",cause:i.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});const o=await we({value:i.value,schema:s});if(!o.success)throw new ie({message:"No object generated: response did not match schema.",cause:o.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});return o.value},async parsePartialOutput({text:r}){const n=await Ae(r);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:n.value}}},createElementStreamTransform(){}}},Ar=({element:t,name:e,description:a})=>{const s=at(t);return{name:"array",responseFormat:oe(s.jsonSchema).then(r=>{const{$schema:n,...i}=r;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:i}},required:["elements"],additionalProperties:!1},...e!=null&&{name:e},...a!=null&&{description:a}}}),async parseCompleteOutput({text:r},n){const i=await me({text:r});if(!i.success)throw new ie({message:"No object generated: could not parse the response.",cause:i.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});const o=i.value;if(o==null||typeof o!="object"||!("elements"in o)||!Array.isArray(o.elements))throw new ie({message:"No object generated: response did not match schema.",cause:new ve({value:o,cause:"response must be an object with an elements array"}),text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});for(const c of o.elements){const l=await we({value:c,schema:s});if(!l.success)throw new ie({message:"No object generated: response did not match schema.",cause:l.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason})}return o.elements},async parsePartialOutput({text:r}){const n=await Ae(r);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const i=n.value;if(i==null||typeof i!="object"||!("elements"in i)||!Array.isArray(i.elements))return;const o=n.state==="repaired-parse"&&i.elements.length>0?i.elements.slice(0,-1):i.elements,c=[];for(const l of o){const p=await we({value:l,schema:s});p.success&&c.push(p.value)}return{partial:c}}}},createElementStreamTransform(){let r=0;return new TransformStream({transform({partialOutput:n},i){if(n!=null)for(;r<n.length;r++)i.enqueue(n[r])}})}}},Mr=({options:t,name:e,description:a})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:t}},required:["result"],additionalProperties:!1},...e!=null&&{name:e},...a!=null&&{description:a}}),async parseCompleteOutput({text:s},r){const n=await me({text:s});if(!n.success)throw new ie({message:"No object generated: could not parse the response.",cause:n.error,text:s,response:r.response,usage:r.usage,finishReason:r.finishReason});const i=n.value;if(i==null||typeof i!="object"||!("result"in i)||typeof i.result!="string"||!t.includes(i.result))throw new ie({message:"No object generated: response did not match schema.",cause:new ve({value:i,cause:"response must be an object that contains a choice value."}),text:s,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.result},async parsePartialOutput({text:s}){const r=await Ae(s);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const n=r.value;if(n==null||typeof n!="object"||!("result"in n)||typeof n.result!="string")return;const i=t.filter(o=>o.startsWith(n.result));return r.state==="successful-parse"?i.includes(n.result)?{partial:n.result}:void 0:i.length===1?{partial:i[0]}:void 0}}},createElementStreamTransform(){}}),Rr=({name:t,description:e}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...t!=null&&{name:t},...e!=null&&{description:e}}),async parseCompleteOutput({text:a},s){const r=await me({text:a});if(!r.success)throw new ie({message:"No object generated: could not parse the response.",cause:r.error,text:a,response:s.response,usage:s.usage,finishReason:s.finishReason});return r.value},async parsePartialOutput({text:a}){const s=await Ae(a);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return s.value===void 0?void 0:{partial:s.value}}},createElementStreamTransform(){}});Te({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(t,e){e.enqueue(`data: ${JSON.stringify(t)}
|
|
8
|
+
|
|
9
|
+
`)},flush(t){t.enqueue(`data: [DONE]
|
|
10
|
+
|
|
11
|
+
`)}})}});var jr=rr(()=>aa(B([O({type:I("text-start"),id:h(),providerMetadata:A.optional()}),O({type:I("text-delta"),id:h(),delta:h(),providerMetadata:A.optional()}),O({type:I("text-end"),id:h(),providerMetadata:A.optional()}),O({type:I("error"),errorText:h()}),O({type:I("tool-input-start"),toolCallId:h(),toolName:h(),providerExecuted:U().optional(),providerMetadata:A.optional(),dynamic:U().optional(),title:h().optional()}),O({type:I("tool-input-delta"),toolCallId:h(),inputTextDelta:h()}),O({type:I("tool-input-available"),toolCallId:h(),toolName:h(),input:re(),providerExecuted:U().optional(),providerMetadata:A.optional(),dynamic:U().optional(),title:h().optional()}),O({type:I("tool-input-error"),toolCallId:h(),toolName:h(),input:re(),providerExecuted:U().optional(),providerMetadata:A.optional(),dynamic:U().optional(),errorText:h(),title:h().optional()}),O({type:I("tool-approval-request"),approvalId:h(),toolCallId:h()}),O({type:I("tool-output-available"),toolCallId:h(),output:re(),providerExecuted:U().optional(),dynamic:U().optional(),preliminary:U().optional()}),O({type:I("tool-output-error"),toolCallId:h(),errorText:h(),providerExecuted:U().optional(),dynamic:U().optional()}),O({type:I("tool-output-denied"),toolCallId:h()}),O({type:I("reasoning-start"),id:h(),providerMetadata:A.optional()}),O({type:I("reasoning-delta"),id:h(),delta:h(),providerMetadata:A.optional()}),O({type:I("reasoning-end"),id:h(),providerMetadata:A.optional()}),O({type:I("source-url"),sourceId:h(),url:h(),title:h().optional(),providerMetadata:A.optional()}),O({type:I("source-document"),sourceId:h(),mediaType:h(),title:h(),filename:h().optional(),providerMetadata:A.optional()}),O({type:I("file"),url:h(),mediaType:h(),providerMetadata:A.optional()}),O({type:Ot(t=>typeof t=="string"&&t.startsWith("data-"),{message:'Type must start with "data-"'}),id:h().optional(),data:re(),transient:U().optional()}),O({type:I("start-step")}),O({type:I("finish-step")}),O({type:I("start"),messageId:h().optional(),messageMetadata:re().optional()}),O({type:I("finish"),finishReason:Oa(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:re().optional()}),O({type:I("abort"),reason:h().optional()}),O({type:I("message-metadata"),messageMetadata:re()})])));function Or(t){return t.type.startsWith("data-")}function We(t){return t.type.startsWith("tool-")}function kr(t){return t.type==="dynamic-tool"}function He(t){return We(t)||kr(t)}function At(t){return t.type.split("-").slice(1).join("-")}function Pr({lastMessage:t,messageId:e}){return{message:t?.role==="assistant"?t:{id:e,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function Dr({stream:t,messageMetadataSchema:e,dataPartSchemas:a,runUpdateMessageJob:s,onError:r,onToolCall:n,onData:i}){return t.pipeThrough(new TransformStream({async transform(o,c){await s(async({state:l,write:p})=>{var m,b,f,g;function x(u){const T=l.message.parts.filter(He).find(S=>S.toolCallId===u);if(T==null)throw new fe({chunkType:"tool-invocation",chunkId:u,message:`No tool invocation found for tool call ID "${u}".`});return T}function v(u){var E;const T=l.message.parts.find(j=>We(j)&&j.toolCallId===u.toolCallId),S=u,N=T;T!=null?(T.state=u.state,N.input=S.input,N.output=S.output,N.errorText=S.errorText,N.rawInput=S.rawInput,N.preliminary=S.preliminary,u.title!==void 0&&(N.title=u.title),N.providerExecuted=(E=S.providerExecuted)!=null?E:T.providerExecuted,S.providerMetadata!=null&&(T.callProviderMetadata=S.providerMetadata)):l.message.parts.push({type:`tool-${u.toolName}`,toolCallId:u.toolCallId,state:u.state,title:u.title,input:S.input,output:S.output,rawInput:S.rawInput,errorText:S.errorText,providerExecuted:S.providerExecuted,preliminary:S.preliminary,...S.providerMetadata!=null?{callProviderMetadata:S.providerMetadata}:{}})}function y(u){var E,T;const S=l.message.parts.find(Z=>Z.type==="dynamic-tool"&&Z.toolCallId===u.toolCallId),N=u,j=S;S!=null?(S.state=u.state,j.toolName=u.toolName,j.input=N.input,j.output=N.output,j.errorText=N.errorText,j.rawInput=(E=N.rawInput)!=null?E:j.rawInput,j.preliminary=N.preliminary,u.title!==void 0&&(j.title=u.title),j.providerExecuted=(T=N.providerExecuted)!=null?T:S.providerExecuted,N.providerMetadata!=null&&(S.callProviderMetadata=N.providerMetadata)):l.message.parts.push({type:"dynamic-tool",toolName:u.toolName,toolCallId:u.toolCallId,state:u.state,input:N.input,output:N.output,errorText:N.errorText,preliminary:N.preliminary,providerExecuted:N.providerExecuted,title:u.title,...N.providerMetadata!=null?{callProviderMetadata:N.providerMetadata}:{}})}async function _(u){if(u!=null){const E=l.message.metadata!=null?ma(l.message.metadata,u):u;e!=null&&await Ct({value:E,schema:e,context:{field:"message.metadata",entityId:l.message.id}}),l.message.metadata=E}}switch(o.type){case"text-start":{const u={type:"text",text:"",providerMetadata:o.providerMetadata,state:"streaming"};l.activeTextParts[o.id]=u,l.message.parts.push(u),p();break}case"text-delta":{const u=l.activeTextParts[o.id];if(u==null)throw new fe({chunkType:"text-delta",chunkId:o.id,message:`Received text-delta for missing text part with ID "${o.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});u.text+=o.delta,u.providerMetadata=(m=o.providerMetadata)!=null?m:u.providerMetadata,p();break}case"text-end":{const u=l.activeTextParts[o.id];if(u==null)throw new fe({chunkType:"text-end",chunkId:o.id,message:`Received text-end for missing text part with ID "${o.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});u.state="done",u.providerMetadata=(b=o.providerMetadata)!=null?b:u.providerMetadata,delete l.activeTextParts[o.id],p();break}case"reasoning-start":{const u={type:"reasoning",text:"",providerMetadata:o.providerMetadata,state:"streaming"};l.activeReasoningParts[o.id]=u,l.message.parts.push(u),p();break}case"reasoning-delta":{const u=l.activeReasoningParts[o.id];if(u==null)throw new fe({chunkType:"reasoning-delta",chunkId:o.id,message:`Received reasoning-delta for missing reasoning part with ID "${o.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});u.text+=o.delta,u.providerMetadata=(f=o.providerMetadata)!=null?f:u.providerMetadata,p();break}case"reasoning-end":{const u=l.activeReasoningParts[o.id];if(u==null)throw new fe({chunkType:"reasoning-end",chunkId:o.id,message:`Received reasoning-end for missing reasoning part with ID "${o.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});u.providerMetadata=(g=o.providerMetadata)!=null?g:u.providerMetadata,u.state="done",delete l.activeReasoningParts[o.id],p();break}case"file":{l.message.parts.push({type:"file",mediaType:o.mediaType,url:o.url}),p();break}case"source-url":{l.message.parts.push({type:"source-url",sourceId:o.sourceId,url:o.url,title:o.title,providerMetadata:o.providerMetadata}),p();break}case"source-document":{l.message.parts.push({type:"source-document",sourceId:o.sourceId,mediaType:o.mediaType,title:o.title,filename:o.filename,providerMetadata:o.providerMetadata}),p();break}case"tool-input-start":{const u=l.message.parts.filter(We);l.partialToolCalls[o.toolCallId]={text:"",toolName:o.toolName,index:u.length,dynamic:o.dynamic,title:o.title},o.dynamic?y({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-streaming",input:void 0,providerExecuted:o.providerExecuted,title:o.title,providerMetadata:o.providerMetadata}):v({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-streaming",input:void 0,providerExecuted:o.providerExecuted,title:o.title,providerMetadata:o.providerMetadata}),p();break}case"tool-input-delta":{const u=l.partialToolCalls[o.toolCallId];if(u==null)throw new fe({chunkType:"tool-input-delta",chunkId:o.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${o.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});u.text+=o.inputTextDelta;const{value:E}=await Ae(u.text);u.dynamic?y({toolCallId:o.toolCallId,toolName:u.toolName,state:"input-streaming",input:E,title:u.title}):v({toolCallId:o.toolCallId,toolName:u.toolName,state:"input-streaming",input:E,title:u.title}),p();break}case"tool-input-available":{o.dynamic?y({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-available",input:o.input,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata,title:o.title}):v({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-available",input:o.input,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata,title:o.title}),p(),n&&!o.providerExecuted&&await n({toolCall:o});break}case"tool-input-error":{o.dynamic?y({toolCallId:o.toolCallId,toolName:o.toolName,state:"output-error",input:o.input,errorText:o.errorText,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata}):v({toolCallId:o.toolCallId,toolName:o.toolName,state:"output-error",input:void 0,rawInput:o.input,errorText:o.errorText,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata}),p();break}case"tool-approval-request":{const u=x(o.toolCallId);u.state="approval-requested",u.approval={id:o.approvalId},p();break}case"tool-output-denied":{const u=x(o.toolCallId);u.state="output-denied",p();break}case"tool-output-available":{const u=x(o.toolCallId);u.type==="dynamic-tool"?y({toolCallId:o.toolCallId,toolName:u.toolName,state:"output-available",input:u.input,output:o.output,preliminary:o.preliminary,providerExecuted:o.providerExecuted,title:u.title}):v({toolCallId:o.toolCallId,toolName:At(u),state:"output-available",input:u.input,output:o.output,providerExecuted:o.providerExecuted,preliminary:o.preliminary,title:u.title}),p();break}case"tool-output-error":{const u=x(o.toolCallId);u.type==="dynamic-tool"?y({toolCallId:o.toolCallId,toolName:u.toolName,state:"output-error",input:u.input,errorText:o.errorText,providerExecuted:o.providerExecuted,title:u.title}):v({toolCallId:o.toolCallId,toolName:At(u),state:"output-error",input:u.input,rawInput:u.rawInput,errorText:o.errorText,providerExecuted:o.providerExecuted,title:u.title}),p();break}case"start-step":{l.message.parts.push({type:"step-start"});break}case"finish-step":{l.activeTextParts={},l.activeReasoningParts={};break}case"start":{o.messageId!=null&&(l.message.id=o.messageId),await _(o.messageMetadata),(o.messageId!=null||o.messageMetadata!=null)&&p();break}case"finish":{o.finishReason!=null&&(l.finishReason=o.finishReason),await _(o.messageMetadata),o.messageMetadata!=null&&p();break}case"message-metadata":{await _(o.messageMetadata),o.messageMetadata!=null&&p();break}case"error":{r?.(new Error(o.errorText));break}default:if(Or(o)){if(a?.[o.type]!=null){const T=l.message.parts.findIndex(N=>"id"in N&&"data"in N&&N.id===o.id&&N.type===o.type),S=T>=0?T:l.message.parts.length;await Ct({value:o.data,schema:a[o.type],context:{field:`message.parts[${S}].data`,entityName:o.type,entityId:o.id}})}const u=o;if(u.transient){i?.(u);break}const E=u.id!=null?l.message.parts.find(T=>u.type===T.type&&u.id===T.id):void 0;E!=null?E.data=u.data:l.message.parts.push(u),i?.(u),p()}}c.enqueue(o)})}}))}async function $r({stream:t,onError:e}){const a=t.getReader();try{for(;;){const{done:s}=await a.read();if(s)break}}catch(s){e?.(s)}finally{a.releaseLock()}}Te({prefix:"aitxt",size:24});Te({prefix:"aiobj",size:24});var Lr=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(t){return new Promise((e,a)=>{this.queue.push(async()=>{try{await t(),e()}catch(s){a(s)}}),this.processQueue()})}};Te({prefix:"aiobj",size:24});async function Zr(t){if(t==null)return[];if(!globalThis.FileList||!(t instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(t).map(async e=>{const{name:a,type:s}=e,r=await new Promise((n,i)=>{const o=new FileReader;o.onload=c=>{var l;n((l=c.target)==null?void 0:l.result)},o.onerror=c=>i(c),o.readAsDataURL(e)});return{type:"file",mediaType:s,filename:a,url:r}}))}var Fr=class{constructor({api:t="/api/chat",credentials:e,headers:a,body:s,fetch:r,prepareSendMessagesRequest:n,prepareReconnectToStreamRequest:i}){this.api=t,this.credentials=e,this.headers=a,this.body=s,this.fetch=r,this.prepareSendMessagesRequest=n,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:t,...e}){var a,s,r,n,i;const o=await oe(this.body),c=await oe(this.headers),l=await oe(this.credentials),p={...pe(c),...pe(e.headers)},m=await((a=this.prepareSendMessagesRequest)==null?void 0:a.call(this,{api:this.api,id:e.chatId,messages:e.messages,body:{...o,...e.body},headers:p,credentials:l,requestMetadata:e.metadata,trigger:e.trigger,messageId:e.messageId})),b=(s=m?.api)!=null?s:this.api,f=m?.headers!==void 0?pe(m.headers):p,g=m?.body!==void 0?m.body:{...o,...e.body,id:e.chatId,messages:e.messages,trigger:e.trigger,messageId:e.messageId},x=(r=m?.credentials)!=null?r:l,y=await((n=this.fetch)!=null?n:globalThis.fetch)(b,{method:"POST",headers:Et({"Content-Type":"application/json",...f},`ai-sdk/${Tt}`,It()),body:JSON.stringify(g),credentials:x,signal:t});if(!y.ok)throw new Error((i=await y.text())!=null?i:"Failed to fetch the chat response.");if(!y.body)throw new Error("The response body is empty.");return this.processResponseStream(y.body)}async reconnectToStream(t){var e,a,s,r,n;const i=await oe(this.body),o=await oe(this.headers),c=await oe(this.credentials),l={...pe(o),...pe(t.headers)},p=await((e=this.prepareReconnectToStreamRequest)==null?void 0:e.call(this,{api:this.api,id:t.chatId,body:{...i,...t.body},headers:l,credentials:c,requestMetadata:t.metadata})),m=(a=p?.api)!=null?a:`${this.api}/${t.chatId}/stream`,b=p?.headers!==void 0?pe(p.headers):l,f=(s=p?.credentials)!=null?s:c,x=await((r=this.fetch)!=null?r:globalThis.fetch)(m,{method:"GET",headers:Et(b,`ai-sdk/${Tt}`,It()),credentials:f});if(x.status===204)return null;if(!x.ok)throw new Error((n=await x.text())!=null?n:"Failed to fetch the chat response.");if(!x.body)throw new Error("The response body is empty.");return this.processResponseStream(x.body)}},fa=class extends Fr{constructor(t={}){super(t)}processResponseStream(t){return ur({stream:t,schema:jr}).pipeThrough(new TransformStream({async transform(e,a){if(!e.success)throw e.error;a.enqueue(e.value)}}))}},Ur=class{constructor({generateId:t=ms,id:e=t(),transport:a=new fa,messageMetadataSchema:s,dataPartSchemas:r,state:n,onError:i,onToolCall:o,onFinish:c,onData:l,sendAutomaticallyWhen:p}){this.activeResponse=void 0,this.jobExecutor=new Lr,this.sendMessage=async(m,b)=>{var f,g,x,v;if(m==null){await this.makeRequest({trigger:"submit-message",messageId:(f=this.lastMessage)==null?void 0:f.id,...b});return}let y;if("text"in m||"files"in m?y={parts:[...Array.isArray(m.files)?m.files:await Zr(m.files),..."text"in m&&m.text!=null?[{type:"text",text:m.text}]:[]]}:y=m,m.messageId!=null){const _=this.state.messages.findIndex(u=>u.id===m.messageId);if(_===-1)throw new Error(`message with id ${m.messageId} not found`);if(this.state.messages[_].role!=="user")throw new Error(`message with id ${m.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,_+1),this.state.replaceMessage(_,{...y,id:m.messageId,role:(g=y.role)!=null?g:"user",metadata:m.metadata})}else this.state.pushMessage({...y,id:(x=y.id)!=null?x:this.generateId(),role:(v=y.role)!=null?v:"user",metadata:m.metadata});await this.makeRequest({trigger:"submit-message",messageId:m.messageId,...b})},this.regenerate=async({messageId:m,...b}={})=>{const f=m==null?this.state.messages.length-1:this.state.messages.findIndex(g=>g.id===m);if(f===-1)throw new Error(`message ${m} not found`);this.state.messages=this.state.messages.slice(0,this.messages[f].role==="assistant"?f:f+1),await this.makeRequest({trigger:"regenerate-message",messageId:m,...b})},this.resumeStream=async(m={})=>{await this.makeRequest({trigger:"resume-stream",...m})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:m,approved:b,reason:f})=>this.jobExecutor.run(async()=>{var g,x;const v=this.state.messages,y=v[v.length-1],_=u=>He(u)&&u.state==="approval-requested"&&u.approval.id===m?{...u,state:"approval-responded",approval:{id:m,approved:b,reason:f}}:u;this.state.replaceMessage(v.length-1,{...y,parts:y.parts.map(_)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(_)),this.status!=="streaming"&&this.status!=="submitted"&&((g=this.sendAutomaticallyWhen)!=null&&g.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(x=this.lastMessage)==null?void 0:x.id})}),this.addToolOutput=async({state:m="output-available",tool:b,toolCallId:f,output:g,errorText:x})=>this.jobExecutor.run(async()=>{var v,y;const _=this.state.messages,u=_[_.length-1],E=T=>He(T)&&T.toolCallId===f?{...T,state:m,output:g,errorText:x}:T;this.state.replaceMessage(_.length-1,{...u,parts:u.parts.map(E)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(E)),this.status!=="streaming"&&this.status!=="submitted"&&((v=this.sendAutomaticallyWhen)!=null&&v.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(y=this.lastMessage)==null?void 0:y.id})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var m;this.status!=="streaming"&&this.status!=="submitted"||(m=this.activeResponse)!=null&&m.abortController&&this.activeResponse.abortController.abort()},this.id=e,this.transport=a,this.generateId=t,this.messageMetadataSchema=s,this.dataPartSchemas=r,this.state=n,this.onError=i,this.onToolCall=o,this.onFinish=c,this.onData=l,this.sendAutomaticallyWhen=p}get status(){return this.state.status}setStatus({status:t,error:e}){this.status!==t&&(this.state.status=t,this.state.error=e)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(t){this.state.messages=t}async makeRequest({trigger:t,metadata:e,headers:a,body:s,messageId:r}){var n,i,o,c;this.setStatus({status:"submitted",error:void 0});const l=this.lastMessage;let p=!1,m=!1,b=!1;try{const f={state:Pr({lastMessage:this.state.snapshot(l),messageId:this.generateId()}),abortController:new AbortController};f.abortController.signal.addEventListener("abort",()=>{p=!0}),this.activeResponse=f;let g;if(t==="resume-stream"){const v=await this.transport.reconnectToStream({chatId:this.id,metadata:e,headers:a,body:s});if(v==null){this.setStatus({status:"ready"});return}g=v}else g=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:f.abortController.signal,metadata:e,headers:a,body:s,trigger:t,messageId:r});const x=v=>this.jobExecutor.run(()=>v({state:f.state,write:()=>{var y;this.setStatus({status:"streaming"}),f.state.message.id===((y=this.lastMessage)==null?void 0:y.id)?this.state.replaceMessage(this.state.messages.length-1,f.state.message):this.state.pushMessage(f.state.message)}}));await $r({stream:Dr({stream:g,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:x,onError:v=>{throw v}}),onError:v=>{throw v}}),this.setStatus({status:"ready"})}catch(f){if(p||f.name==="AbortError")return p=!0,this.setStatus({status:"ready"}),null;b=!0,f instanceof TypeError&&(f.message.toLowerCase().includes("fetch")||f.message.toLowerCase().includes("network"))&&(m=!0),this.onError&&f instanceof Error&&this.onError(f),this.setStatus({status:"error",error:f})}finally{try{(i=this.onFinish)==null||i.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:p,isDisconnect:m,isError:b,finishReason:(n=this.activeResponse)==null?void 0:n.state.finishReason})}catch(f){console.error(f)}this.activeResponse=void 0}(o=this.sendAutomaticallyWhen)!=null&&o.call(this,{messages:this.state.messages})&&!b&&await this.makeRequest({trigger:"submit-message",messageId:(c=this.lastMessage)==null?void 0:c.id,metadata:e,headers:a,body:s})}},Ue,Mt;function zr(){if(Mt)return Ue;Mt=1;function t(e,a){if(typeof e!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let s,r=0;return function(...i){clearTimeout(s);const o=Date.now(),c=o-r,l=a-c;l<=0?(r=o,e.apply(this,i)):s=setTimeout(()=>{r=Date.now(),e.apply(this,i)},l)}}return Ue=t,Ue}var Br=zr();const Vr=ka(Br);var ha=(t,e,a)=>{if(!e.has(t))throw TypeError("Cannot "+a)},k=(t,e,a)=>(ha(t,e,"read from private field"),a?a.call(t):e.get(t)),G=(t,e,a)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,a)},ne=(t,e,a,s)=>(ha(t,e,"write to private field"),e.set(t,a),a);function qr(t,e){return e!=null?Vr(t,e):t}var J,Me,Re,be,xe,_e,he,Ye,Ge,Jr=class{constructor(t=[]){G(this,J,void 0),G(this,Me,"ready"),G(this,Re,void 0),G(this,be,new Set),G(this,xe,new Set),G(this,_e,new Set),this.pushMessage=e=>{ne(this,J,k(this,J).concat(e)),k(this,he).call(this)},this.popMessage=()=>{ne(this,J,k(this,J).slice(0,-1)),k(this,he).call(this)},this.replaceMessage=(e,a)=>{ne(this,J,[...k(this,J).slice(0,e),this.snapshot(a),...k(this,J).slice(e+1)]),k(this,he).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,a)=>{const s=a?qr(e,a):e;return k(this,be).add(s),()=>{k(this,be).delete(s)}},this["~registerStatusCallback"]=e=>(k(this,xe).add(e),()=>{k(this,xe).delete(e)}),this["~registerErrorCallback"]=e=>(k(this,_e).add(e),()=>{k(this,_e).delete(e)}),G(this,he,()=>{k(this,be).forEach(e=>e())}),G(this,Ye,()=>{k(this,xe).forEach(e=>e())}),G(this,Ge,()=>{k(this,_e).forEach(e=>e())}),ne(this,J,t)}get status(){return k(this,Me)}set status(t){ne(this,Me,t),k(this,Ye).call(this)}get error(){return k(this,Re)}set error(t){ne(this,Re,t),k(this,Ge).call(this)}get messages(){return k(this,J)}set messages(t){ne(this,J,[...t]),k(this,he).call(this)}};J=new WeakMap;Me=new WeakMap;Re=new WeakMap;be=new WeakMap;xe=new WeakMap;_e=new WeakMap;he=new WeakMap;Ye=new WeakMap;Ge=new WeakMap;var ge,Rt=class extends Ur{constructor({messages:t,...e}){const a=new Jr(t);super({...e,state:a}),G(this,ge,void 0),this["~registerMessagesCallback"]=(s,r)=>k(this,ge)["~registerMessagesCallback"](s,r),this["~registerStatusCallback"]=s=>k(this,ge)["~registerStatusCallback"](s),this["~registerErrorCallback"]=s=>k(this,ge)["~registerErrorCallback"](s),ne(this,ge,a)}};ge=new WeakMap;function Wr({experimental_throttle:t,resume:e=!1,...a}={}){const s=C.useRef("chat"in a?{}:{onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});"chat"in a||(s.current={onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});const r={...a,onToolCall:b=>{var f,g;return(g=(f=s.current).onToolCall)==null?void 0:g.call(f,b)},onData:b=>{var f,g;return(g=(f=s.current).onData)==null?void 0:g.call(f,b)},onFinish:b=>{var f,g;return(g=(f=s.current).onFinish)==null?void 0:g.call(f,b)},onError:b=>{var f,g;return(g=(f=s.current).onError)==null?void 0:g.call(f,b)},sendAutomaticallyWhen:b=>{var f,g,x;return(x=(g=(f=s.current).sendAutomaticallyWhen)==null?void 0:g.call(f,b))!=null?x:!1}},n=C.useRef("chat"in a?a.chat:new Rt(r));("chat"in a&&a.chat!==n.current||"id"in a&&n.current.id!==a.id)&&(n.current="chat"in a?a.chat:new Rt(r));const o=C.useCallback(b=>n.current["~registerMessagesCallback"](b,t),[t,n.current.id]),c=C.useSyncExternalStore(o,()=>n.current.messages,()=>n.current.messages),l=C.useSyncExternalStore(n.current["~registerStatusCallback"],()=>n.current.status,()=>n.current.status),p=C.useSyncExternalStore(n.current["~registerErrorCallback"],()=>n.current.error,()=>n.current.error),m=C.useCallback(b=>{typeof b=="function"&&(b=b(n.current.messages)),n.current.messages=b},[n]);return C.useEffect(()=>{e&&n.current.resumeStream()},[e,n]),{id:n.current.id,messages:c,setMessages:m,sendMessage:n.current.sendMessage,regenerate:n.current.regenerate,clearError:n.current.clearError,stop:n.current.stop,error:p,resumeStream:n.current.resumeStream,status:l,addToolResult:n.current.addToolOutput,addToolOutput:n.current.addToolOutput,addToolApprovalResponse:n.current.addToolApprovalResponse}}function Hr(t,e){const a=D.c(5);let s;a[0]!==e?(s=e===void 0?{}:e,a[0]=e,a[1]=s):s=a[1];const r=s,{org:n}=Ce(),i=t??null;let o;a[2]!==n.id||a[3]!==i?(o={connectionId:i,orgId:n.id},a[2]=n.id,a[3]=i,a[4]=o):o=a[4];const c=ke(o);return Dt(t??"no-connection","LLM",c,r)}function st(){const t=D.c(2),e=Ja();let a;return t[0]!==e?(a={connections:e,binding:"LLMS"},t[0]=e,t[1]=a):a=t[1],Wa(a)}function Yr(t){const e=D.c(10);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[0]=a):a=e[0];const s=kt(a);let r;if(e[1]!==s.collectionName||e[2]!==s.connectionId||e[3]!==s.itemId||e[4]!==t){r=[],t&&r.push(`### Selected Agent
|
|
12
|
+
- ID: ${t}`);let n;e[6]!==s.collectionName||e[7]!==s.connectionId||e[8]!==s.itemId?(n=[],s.connectionId&&n.push(`- Connection ID: ${s.connectionId}`),s.collectionName&&n.push(`- Collection: ${s.collectionName}`),s.itemId&&n.push(`- Item ID: ${s.itemId}`),e[6]=s.collectionName,e[7]=s.connectionId,e[8]=s.itemId,e[9]=n):n=e[9],n.length>0&&r.push(`### Current Resource
|
|
13
|
+
The user is viewing the following resource:
|
|
14
|
+
${n.join(`
|
|
15
|
+
`)}
|
|
16
|
+
|
|
17
|
+
Help the user understand and work with this resource.`),e[1]=s.collectionName,e[2]=s.connectionId,e[3]=s.itemId,e[4]=t,e[5]=r}else r=e[5];return r.join(`
|
|
18
|
+
|
|
19
|
+
`)}const ga=50;function Gr(){const t=D.c(17),{locator:e,org:a}=Ce();let s;t[0]!==a.id?(s={connectionId:Ke,orgId:a.id},t[0]=a.id,t[1]=s):s=t[1];const r=ke(s);let n;t[2]!==e?(n=Pt.threads(e),t[2]=e,t[3]=n):n=t[3];let i;t[4]!==r?(i=async v=>{const{pageParam:y}=v,_=y===void 0?0:y;if(!r)throw new Error("MCP client is not available");const u={limit:ga,offset:_},E=await r.callTool({name:"COLLECTION_THREADS_LIST",arguments:u}),T=E.structuredContent??E;return{items:T.items??[],hasMore:T.hasMore??!1,totalCount:T.totalCount}},t[4]=r,t[5]=i):i=t[5];let o;t[6]!==n||t[7]!==i?(o={queryKey:n,queryFn:i,getNextPageParam:Xr,initialPageParam:0,staleTime:3e4},t[6]=n,t[7]=i,t[8]=o):o=t[8];const{data:c,fetchNextPage:l,hasNextPage:p,isFetchingNextPage:m,refetch:b}=Ha(o);let f;t[9]!==c?.pages?(f=c?.pages.flatMap(Qr)??[],t[9]=c?.pages,t[10]=f):f=t[10];const g=f;let x;return t[11]!==l||t[12]!==p||t[13]!==m||t[14]!==b||t[15]!==g?(x={threads:g,refetch:b,hasNextPage:p,isFetchingNextPage:m,fetchNextPage:l},t[11]=l,t[12]=p,t[13]=m,t[14]=b,t[15]=g,t[16]=x):x=t[16],x}function Qr(t){return t.items}function Xr(t,e){if(t.hasMore)return e.length*ga}function Kr(t){const e=D.c(6),{org:a}=Ce();let s;e[0]!==a.id?(s={connectionId:Ke,orgId:a.id},e[0]=a.id,e[1]=s):s=e[1];const r=ke(s);let n;e[2]!==t?(n={filters:t?[{column:"threadId",value:t}]:[],pageSize:100},e[2]=t,e[3]=n):n=e[3];const i=Dt(a.id,"THREAD_MESSAGES",r,n);let o;return e[4]!==i?(o=i??[],e[4]=i,e[5]=o):o=e[5],o}function en(){const t=D.c(5),e=Pa(),{org:a}=Ce();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},t[0]=s):s=t[0];const r=kt(s);let n;return t[1]!==a||t[2]!==r||t[3]!==e?(n=i=>{const c=i.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!c||!c[1])return;const l=c[1],p=r.connectionId;if(!p)return;e.invalidateQueries({queryKey:Pt.collection(a.slug,p,l)});const m=l.toLowerCase().replace(/_/g," ");ze.success(`${m} updated`)},t[1]=a,t[2]=r,t[3]=e,t[4]=n):n=t[4],n}function z(t){const e=D.c(8);let a,s;e[0]!==t?({className:a,...s}=t,e[0]=t,e[1]=a,e[2]=s):(a=e[1],s=e[2]);let r;e[3]!==a?(r=et("bg-accent animate-pulse rounded-md",a),e[3]=a,e[4]=r):r=e[4];let n;return e[5]!==s||e[6]!==r?(n=d.jsx("div",{"data-slot":"skeleton",className:r,...s}),e[5]=s,e[6]=r,e[7]=n):n=e[7],n}const tn=["x-ai/grok-code-fast-1","anthropic/claude-sonnet-4.5","google/gemini-2.5-flash","xiaomi/mimo-v2-flash:free","google/gemini-3-flash-preview","deepseek/deepseek-v3.2","anthropic/claude-opus-4.5","x-ai/grok-4.1-fast","google/gemini-2.5-flash-lite","google/gemini-2.0-flash-001"],Qe=new Map;tn.forEach((t,e)=>{Qe.set(t,e)});function rt(t){const e=D.c(3);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={pageSize:999},e[0]=a):a=e[0];const s=Hr(t??void 0,a);let r;return e[1]!==s?(r=s.filter(sn).sort(an),e[1]=s,e[2]=r):r=e[2],r}function an(t,e){const a=Qe.get(t.id),s=Qe.get(e.id);return a!==void 0&&s!==void 0?a-s:a!==void 0?-1:s!==void 0?1:t.title.localeCompare(e.title)}function sn(t){return t.limits?.contextWindow&&t.limits?.maxOutputTokens}const rn={reasoning:{icon:d.jsx(zt,{className:"size-4"}),label:"Reasoning"},"image-upload":{icon:d.jsx(is,{className:"size-4"}),label:"Can analyze images"},"file-upload":{icon:d.jsx(ns,{className:"size-4"}),label:"Can analyze files"},"web-search":{icon:d.jsx(Lt,{className:"size-4"}),label:"Can search the web to answer questions"}};function va(t){const e=D.c(10),{capability:a}=t,s=rn[a];let r,n;e[0]!==a||e[1]!==s?(r=s||{icon:null,label:a},n=r.label.split("-").map(nn).join(" "),e[0]=a,e[1]=s,e[2]=r,e[3]=n):(r=e[2],n=e[3]);const i=n;let o;e[4]===Symbol.for("react.memo_cache_sentinel")?(o={backgroundColor:"color-mix(in oklch, var(--chart-1) 15%, transparent)",color:"var(--chart-1)"},e[4]=o):o=e[4];let c;e[5]!==i?(c=d.jsx("span",{children:i}),e[5]=i,e[6]=c):c=e[6];let l;return e[7]!==r.icon||e[8]!==c?(l=d.jsxs("div",{className:"flex items-center gap-1.5 py-0.5 px-1.5 rounded-md text-xs font-medium",style:o,children:[r.icon,c]}),e[7]=r.icon,e[8]=c,e[9]=l):l=e[9],l}function nn(t){return t.charAt(0).toUpperCase()+t.slice(1)}function on(t){const e=D.c(53),{model:a,compact:s}=t,r=s===void 0?!1:s;if(!a){let v;return e[0]===Symbol.for("react.memo_cache_sentinel")?(v=d.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),e[0]=v):v=e[0],v}const n=a.limits?.contextWindow||a.costs?.input||a.costs?.output||a.limits?.maxOutputTokens;if(!n&&!r){let v;e[1]!==a.logo||e[2]!==a.title?(v=a.logo&&d.jsx("img",{src:a.logo,className:"w-6 h-6",alt:a.title}),e[1]=a.logo,e[2]=a.title,e[3]=v):v=e[3];let y;e[4]!==a.title?(y=d.jsx("p",{className:"text-lg font-medium leading-7",children:a.title}),e[4]=a.title,e[5]=y):y=e[5];let _;e[6]!==v||e[7]!==y?(_=d.jsxs("div",{className:"flex items-center gap-3 py-2 px-0",children:[v,y]}),e[6]=v,e[7]=y,e[8]=_):_=e[8];let u;e[9]!==a.description?(u=a.description&&d.jsx("p",{className:"text-sm text-muted-foreground",children:a.description}),e[9]=a.description,e[10]=u):u=e[10];let E;return e[11]!==_||e[12]!==u?(E=d.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[_,u]}),e[11]=_,e[12]=u,e[13]=E):E=e[13],E}if(!n&&r)return null;if(r){let v;e[14]!==a.limits?(v=a.limits?.contextWindow&&d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-muted-foreground",children:"Context"}),d.jsxs("span",{className:"text-foreground font-medium",children:[a.limits.contextWindow.toLocaleString()," tokens"]})]}),e[14]=a.limits,e[15]=v):v=e[15];let y;e[16]!==a.costs?(y=a.costs?.input&&d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-muted-foreground",children:"Input cost"}),d.jsxs("span",{className:"text-foreground font-medium",children:["$",a.costs.input.toFixed(2)," / 1M"]})]}),e[16]=a.costs,e[17]=y):y=e[17];let _;e[18]!==a.costs?(_=a.costs?.output&&d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-muted-foreground",children:"Output cost"}),d.jsxs("span",{className:"text-foreground font-medium",children:["$",a.costs.output.toFixed(2)," / 1M"]})]}),e[18]=a.costs,e[19]=_):_=e[19];let u;e[20]!==a.limits?(u=a.limits?.maxOutputTokens&&d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-muted-foreground",children:"Output limit"}),d.jsxs("span",{className:"text-foreground font-medium",children:[a.limits.maxOutputTokens.toLocaleString()," tokens"]})]}),e[20]=a.limits,e[21]=u):u=e[21];let E;return e[22]!==v||e[23]!==y||e[24]!==_||e[25]!==u?(E=d.jsxs("div",{className:"flex flex-col gap-2.5 pt-3 pb-3 px-3 rounded-b-lg text-xs",children:[v,y,_,u]}),e[22]=v,e[23]=y,e[24]=_,e[25]=u,e[26]=E):E=e[26],E}let i;e[27]!==a.logo||e[28]!==a.title?(i=a.logo&&d.jsx("img",{src:a.logo,className:"w-6 h-6 shrink-0",alt:a.title}),e[27]=a.logo,e[28]=a.title,e[29]=i):i=e[29];let o;e[30]!==a.title?(o=d.jsx("p",{className:"text-lg font-medium leading-7 wrap-break-word min-w-0",children:a.title}),e[30]=a.title,e[31]=o):o=e[31];let c;e[32]!==i||e[33]!==o?(c=d.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[i,o]}),e[32]=i,e[33]=o,e[34]=c):c=e[34];let l;e[35]!==a.capabilities?(l=a.capabilities&&a.capabilities.length>0&&d.jsx("div",{className:"flex items-center gap-2",children:a.capabilities.map(ln)}),e[35]=a.capabilities,e[36]=l):l=e[36];let p;e[37]!==c||e[38]!==l?(p=d.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[c,l]}),e[37]=c,e[38]=l,e[39]=p):p=e[39];let m;e[40]!==a.limits?(m=a.limits?.contextWindow&&d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(os,{className:"w-3.5 h-3.5 text-muted-foreground"}),d.jsx("p",{className:"text-sm text-foreground",children:"Context window"})]}),d.jsxs("p",{className:"text-sm text-muted-foreground",children:[a.limits.contextWindow.toLocaleString()," tokens"]})]}),e[40]=a.limits,e[41]=m):m=e[41];let b;e[42]!==a.costs?(b=(a.costs?.input||a.costs?.output)&&d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Ft,{className:"w-3.5 h-3.5 text-muted-foreground"}),d.jsx("p",{className:"text-sm text-foreground",children:"Costs"})]}),d.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.costs?.input!==null&&a.costs?.input!==void 0&&d.jsxs("p",{className:"text-sm text-muted-foreground",children:["$",a.costs.input.toFixed(2)," / 1M tokens (input)"]}),a.costs?.output!==null&&a.costs?.output!==void 0&&d.jsxs("p",{className:"text-sm text-muted-foreground",children:["$",a.costs.output.toFixed(2)," / 1M tokens (output)"]})]})]}),e[42]=a.costs,e[43]=b):b=e[43];let f;e[44]!==a.limits?(f=a.limits?.maxOutputTokens&&d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Ut,{className:"w-4.5 h-4.5 text-muted-foreground/70"}),d.jsx("p",{className:"text-sm text-foreground",children:"Output limit"})]}),d.jsxs("p",{className:"text-sm text-muted-foreground",children:[a.limits.maxOutputTokens.toLocaleString()," token limit"]})]}),e[44]=a.limits,e[45]=f):f=e[45];let g;e[46]!==m||e[47]!==b||e[48]!==f?(g=d.jsxs("div",{className:"flex flex-col gap-4",children:[m,b,f]}),e[46]=m,e[47]=b,e[48]=f,e[49]=g):g=e[49];let x;return e[50]!==g||e[51]!==p?(x=d.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[p,g]}),e[50]=g,e[51]=p,e[52]=x):x=e[52],x}function ln(t){return d.jsx(va,{capability:t},t)}function cn(t){const e=D.c(15),{model:a,onHover:s}=t;let r;e[0]!==a||e[1]!==s?(r=()=>s(a),e[0]=a,e[1]=s,e[2]=r):r=e[2];let n;e[3]!==a.logo||e[4]!==a.title?(n=a.logo&&d.jsx("img",{src:a.logo,className:"w-5 h-5 shrink-0",alt:a.title}),e[3]=a.logo,e[4]=a.title,e[5]=n):n=e[5];let i;e[6]!==a.title?(i=d.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:a.title}),e[6]=a.title,e[7]=i):i=e[7];let o;e[8]!==a.capabilities?(o=a.capabilities&&a.capabilities.length>0&&d.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:a.capabilities.slice(0,2).map(un)}),e[8]=a.capabilities,e[9]=o):o=e[9];let c;return e[10]!==r||e[11]!==n||e[12]!==i||e[13]!==o?(c=d.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:r,children:[n,i,o]}),e[10]=r,e[11]=n,e[12]=i,e[13]=o,e[14]=c):c=e[14],c}function un(t){return d.jsx(va,{capability:t},t)}function dn(t){const e=D.c(14),{model:a,placeholder:s}=t,r=s===void 0?"Select model":s;if(!a){let l;e[0]!==r?(l=d.jsx("span",{className:"text-sm text-muted-foreground",children:r}),e[0]=r,e[1]=l):l=e[1];let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=d.jsx(ut,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[2]=p):p=e[2];let m;return e[3]!==l?(m=d.jsxs("div",{className:"flex items-center gap-1.5",children:[l,p]}),e[3]=l,e[4]=m):m=e[4],m}let n;e[5]!==a.logo||e[6]!==a.title?(n=a.logo&&d.jsx("img",{src:a.logo,className:"w-5 h-5 shrink-0 rounded-sm",alt:a.title}),e[5]=a.logo,e[6]=a.title,e[7]=n):n=e[7];let i;e[8]!==a.title?(i=d.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors truncate min-w-0 hidden sm:inline-block",children:a.title}),e[8]=a.title,e[9]=i):i=e[9];let o;e[10]===Symbol.for("react.memo_cache_sentinel")?(o=d.jsx(ut,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[10]=o):o=e[10];let c;return e[11]!==n||e[12]!==i?(c=d.jsxs("div",{className:"flex items-center gap-2 min-w-0 overflow-hidden",children:[n,i,o]}),e[11]=n,e[12]=i,e[13]=c):c=e[13],c}function Hn(t){return t?.capabilities?.includes("vision")===!0}function pn(){const t=D.c(6);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:d.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[d.jsx(z,{className:"size-4 shrink-0"}),d.jsx(z,{className:"flex-1 h-6"}),d.jsx(z,{className:"w-[140px] h-8 shrink-0"})]})}),t[0]=e):e=t[0];let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[400px] md:min-w-[400px]",children:[e,d.jsx("div",{className:"flex-1 overflow-y-auto px-0.5 pt-2 space-y-1",children:Array.from({length:6}).map(mn)})]}),t[1]=a):a=t[1];let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=d.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[d.jsx(z,{className:"size-6 shrink-0"}),d.jsx(z,{className:"h-6 w-32"})]}),t[2]=s):s=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[s,d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(z,{className:"h-6 w-20 rounded-md"}),d.jsx(z,{className:"h-6 w-24 rounded-md"})]})]}),t[3]=r):r=t[3];let n;t[4]===Symbol.for("react.memo_cache_sentinel")?(n=d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsx(z,{className:"h-4 w-24"}),d.jsx(z,{className:"h-4 w-32"})]}),t[4]=n):n=t[4];let i;return t[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsxs("div",{className:"flex flex-col md:flex-row h-[350px]",children:[a,d.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:d.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[r,d.jsxs("div",{className:"flex flex-col gap-4",children:[n,d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsx(z,{className:"h-4 w-16"}),d.jsx(z,{className:"h-4 w-40"})]})]})]})})]}),t[5]=i):i=t[5],i}function mn(t,e){return d.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[d.jsx(z,{className:"size-5 shrink-0 rounded-sm"}),d.jsx(z,{className:"flex-1 h-4"}),d.jsx(z,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function fn(t){const e=D.c(39),{selectedModel:a,onModelChange:s,onClose:r,modelsConnections:n}=t,[i,o]=C.useState(null),[c,l]=C.useState(""),p=C.useRef(null),[m,b]=C.useState(a?.connectionId??null),f=st(),g=n??f,x=rt(m);let v,y;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{setTimeout(()=>{p.current?.focus()},0)},y=[],e[0]=v,e[1]=y):(v=e[0],y=e[1]),C.useEffect(v,y);let _;e[2]!==x||e[3]!==c?(_=c.trim()?x.filter($=>{const W=c.toLowerCase();return $.title.toLowerCase().includes(W)||$.provider?.toLowerCase().includes(W)||$.description?.toLowerCase().includes(W)}):x,e[2]=x,e[3]=c,e[4]=_):_=e[4];const u=_;let E;e[5]===Symbol.for("react.memo_cache_sentinel")?(E=$=>{b($)},e[5]=E):E=e[5];const T=E;let S;e[6]!==x||e[7]!==r||e[8]!==s||e[9]!==m?(S=$=>{const W=x.find($e=>$e.id===$);!W||!m||(s({id:W.id,connectionId:m,provider:W.provider??void 0}),l(""),r())},e[6]=x,e[7]=r,e[8]=s,e[9]=m,e[10]=S):S=e[10];const N=S;let j;e[11]===Symbol.for("react.memo_cache_sentinel")?(j=d.jsx(Lt,{size:16,className:"text-muted-foreground shrink-0"}),e[11]=j):j=e[11];let Z;e[12]===Symbol.for("react.memo_cache_sentinel")?(Z=$=>l($.target.value),e[12]=Z):Z=e[12];let V;e[13]!==c?(V=d.jsx(Ga,{ref:p,type:"text",placeholder:"Search for a model...",value:c,onChange:Z,className:"flex-1 border-0 shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[13]=c,e[14]=V):V=e[14];let X;e[15]!==g||e[16]!==m?(X=g.length>0&&d.jsxs(es,{value:m??"",onValueChange:T,children:[d.jsxs(ts,{size:"sm",className:"w-auto min-w-[140px] h-8 shrink-0 [&>svg:last-child]:hidden",onClick:gn,children:[d.jsx(as,{placeholder:"Select connection"}),d.jsx(Zt,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),d.jsx(ss,{children:g.map(hn)})]}),e[15]=g,e[16]=m,e[17]=X):X=e[17];let le;e[18]!==V||e[19]!==X?(le=d.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:d.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 cursor-text",children:[j,V,X]})}),e[18]=V,e[19]=X,e[20]=le):le=e[20];let L;e[21]!==u||e[22]!==N||e[23]!==a?.id?(L=u.length>0?u.map($=>{const W=$.id===a?.id;return d.jsx("div",{onClick:()=>N($.id),className:et("rounded-lg mb-1",W&&"bg-accent"),children:d.jsx(cn,{model:$,onHover:o})},$.id)}):d.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No models found"}),e[21]=u,e[22]=N,e[23]=a?.id,e[24]=L):L=e[24];let K;e[25]!==L?(K=d.jsx("div",{className:"flex-1 overflow-y-auto px-0.5 pt-2",children:L}),e[25]=L,e[26]=K):K=e[26];let ee;e[27]!==le||e[28]!==K?(ee=d.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[400px] md:min-w-[400px]",children:[le,K]}),e[27]=le,e[28]=K,e[29]=ee):ee=e[29];let te;e[30]!==i||e[31]!==x||e[32]!==a?(te=i||(a?x.find($=>$.id===a.id):null)||null,e[30]=i,e[31]=x,e[32]=a,e[33]=te):te=e[33];let ae;e[34]!==te?(ae=d.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:d.jsx(on,{model:te})}),e[34]=te,e[35]=ae):ae=e[35];let ce;return e[36]!==ee||e[37]!==ae?(ce=d.jsxs("div",{className:"flex flex-col md:flex-row h-[350px]",children:[ee,ae]}),e[36]=ee,e[37]=ae,e[38]=ce):ce=e[38],ce}function hn(t){return d.jsx(rs,{value:t.id,children:d.jsxs("div",{className:"flex items-center gap-2",children:[t.icon?d.jsx("img",{src:t.icon,alt:t.title,className:"w-4 h-4 rounded"}):d.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:t.title.slice(0,1).toUpperCase()}),d.jsx("span",{children:t.title})]})},t.id)}function gn(t){return t.stopPropagation()}function Yn(t){const e=D.c(23),{selectedModel:a,onModelChange:s,modelsConnections:r,variant:n,className:i,placeholder:o}=t,c=n===void 0?"borderless":n,l=o===void 0?"Select model":o,[p,m]=C.useState(!1),b=st(),f=r??b,g=a?.connectionId??null,x=rt(g);let v;e[0]!==x||e[1]!==a?(v=a?x.find(X=>X.id===a.id):void 0,e[0]=x,e[1]=a,e[2]=v):v=e[2];const y=v;if(f.length===0)return null;const _=c==="borderless"?"ghost":"outline",u=c==="borderless"&&"md:border-none";let E;e[3]!==i||e[4]!==u?(E=et("text-sm hover:bg-accent rounded-lg py-0.5 px-1 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0 min-w-0 shrink justify-start overflow-hidden",u,i),e[3]=i,e[4]=u,e[5]=E):E=e[5];let T;e[6]!==y||e[7]!==l?(T=d.jsx(dn,{model:y,placeholder:l}),e[6]=y,e[7]=l,e[8]=T):T=e[8];let S;e[9]!==_||e[10]!==E||e[11]!==T?(S=d.jsx(Qa,{asChild:!0,children:d.jsx(Ya,{variant:_,size:"sm",className:E,children:T})}),e[9]=_,e[10]=E,e[11]=T,e[12]=S):S=e[12];let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=d.jsx(pn,{}),e[13]=N):N=e[13];let j;e[14]===Symbol.for("react.memo_cache_sentinel")?(j=()=>m(!1),e[14]=j):j=e[14];let Z;e[15]!==f||e[16]!==s||e[17]!==a?(Z=d.jsx(Xa,{className:"w-full md:w-auto p-0",align:"start",side:"bottom",sideOffset:8,children:d.jsx(C.Suspense,{fallback:N,children:d.jsx(fn,{selectedModel:a,onModelChange:s,onClose:j,modelsConnections:f})})}),e[15]=f,e[16]=s,e[17]=a,e[18]=Z):Z=e[18];let V;return e[19]!==p||e[20]!==Z||e[21]!==S?(V=d.jsxs(Ka,{open:p,onOpenChange:m,children:[S,Z]}),e[19]=p,e[20]=Z,e[21]=S,e[22]=V):V=e[22],V}const vn=t=>new fa({api:`/api/${t}/decopilot/stream`,credentials:"include",prepareSendMessagesRequest:({messages:e,requestMetadata:a={}})=>{const{system:s,tiptapDoc:r,...n}=a,i=s?{id:crypto.randomUUID(),role:"system",parts:[{type:"text",text:s}]}:null,o=e.slice(-1).filter(Boolean);return{body:{messages:i?[i,...o]:o,...n}}}}),jt=(t,e)=>t?.find(a=>a.id===e)??t?.[0]??null,yn=(t,e)=>{const a=D.c(17);let s;a[0]!==t?(s=$t.chatSelectedModel(t),a[0]=t,a[1]=s):s=a[1];const[r,n]=Be(s,null),i=r?.connectionId;let o;a[2]!==e||a[3]!==i?(o=jt(e,i),a[2]=e,a[3]=i,a[4]=o):o=a[4];const c=o,l=rt(c?.id??null);let p;a[5]!==l?(p=l.filter(Sn).reduce(Nn,void 0),a[5]=l,a[6]=p):p=a[6];const m=p,b=r?.id;let f;a[7]!==l||a[8]!==b?(f=jt(l,b),a[7]=l,a[8]=b,a[9]=f):f=a[9];const g=f;let x;a[10]!==m?.id||a[11]!==c||a[12]!==g?(x=g&&c?.id?{id:g.id,provider:g.provider,limits:g.limits,capabilities:g.capabilities,connectionId:c.id,fastId:m?.id}:null,a[10]=m?.id,a[11]=c,a[12]=g,a[13]=x):x=a[13];const v=x;let y;return a[14]!==v||a[15]!==n?(y=[v,n],a[14]=v,a[15]=n,a[16]=y):y=a[16],y},ya={tiptapDoc:void 0,parentThread:null,finishReason:null};function bn(t,e){switch(e.type){case"SET_TIPTAP_DOC":return{...t,tiptapDoc:e.payload};case"CLEAR_TIPTAP_DOC":return{...t,tiptapDoc:void 0};case"START_BRANCH":return{...t,parentThread:e.payload};case"CLEAR_BRANCH":return{...t,parentThread:null};case"SET_FINISH_REASON":return{...t,finishReason:e.payload};case"CLEAR_FINISH_REASON":return{...t,finishReason:null};case"RESET":return ya;default:return t}}function xn(t,e){const a=[];for(const s of t)"text"in s&&s.text?a.push({type:"text",text:`[${e}]
|
|
20
|
+
${s.text}`}):"blob"in s&&s.blob&&s.mimeType&&a.push({type:"file",url:`data:${s.mimeType};base64,${s.blob}`,filename:String(s.uri),mediaType:String(s.mimeType)});return a}function _n(t,e){const a=[];for(const s of t){if(s.role!=="user"||!s.content)continue;const r=Array.isArray(s.content)?s.content:[s.content];for(const n of r)switch(n.type){case"text":{const i=n.text?.trim();if(!i)continue;a.push({type:"text",text:`[${e}]
|
|
21
|
+
${i}`});break}case"image":case"audio":{if(!n.data||!n.mimeType)continue;a.push({type:"file",url:`data:${n.mimeType};base64,${n.data}`,mediaType:n.mimeType});break}case"resource":{const i=n.resource;if(!i||!i.mimeType)continue;i&&("text"in i&&i.text?a.push({type:"text",text:`[${e}]
|
|
22
|
+
${i.text}`}):"blob"in i&&i.blob&&i.mimeType&&a.push({type:"file",url:`data:${i.mimeType};base64,${i.blob}`,filename:String(i.uri),mediaType:String(i.mimeType)}));break}}}return a}function In(t,e){const{mimeType:a,data:s}=t;if(a.startsWith("text/"))try{const r=atob(s);return[{type:"text",text:`${e}
|
|
23
|
+
${r}`}]}catch(r){console.error("Failed to decode text file:",r)}return[{type:"file",url:`data:${a};base64,${s}`,filename:e,mediaType:a}]}function En(t){if(!t)return[];const e=[];let a="";const s=r=>{if(r){if(r.type==="text"&&"text"in r&&typeof r.text=="string")a+=r.text;else if(r.type==="mention"&&r.attrs){const n=r.attrs.char??"/",i=`${n}${r.attrs.name}`;if(a+=i,n==="@"){const o=r.attrs.metadata||[];e.push(...xn(o,i))}else{const o=r.attrs.metadata||r.attrs.prompts||[];e.push(..._n(o,i))}}else if(r.type==="file"&&r.attrs){const n=r.attrs,i=`[file:://${encodeURIComponent(n.name)}]`;a+=i,e.push(...In(n,i))}if("content"in r&&Array.isArray(r.content))for(const n of r.content)s(n)}};return s(t),a.trim()&&e.unshift({type:"text",text:a.trim()}),e}async function wn(t,e,a){if(!t)throw new Error("MCP client is not available");const s=await t.callTool({name:"COLLECTION_THREADS_UPDATE",arguments:{id:e,data:a}});return(s.structuredContent??s).item}const ba=C.createContext(null);function Gn({children:t}){const{locator:e,org:a}=Ce(),{threads:s,hasNextPage:r,isFetchingNextPage:n,fetchNextPage:i,refetch:o}=Gr(),[c,l]=Be($t.assistantChatActiveThread(e),s[0]?.id??crypto.randomUUID()),p=ke({connectionId:Ke,orgId:a.id}),{data:m}=Da.useSession(),b=m?.user??null,[f,g]=C.useReducer(bn,ya),x=qa(),[v,y]=Be(`${e}:selected-virtual-mcp-id`,null),_=st(),[u,E]=yn(e,_),T=Kr(c),S=Yr(v),N=en(),j=v?x.find(P=>P.id===v)??null:null,Z=Va(a.id).id,V=vn(a.slug),L=Wr({id:c,messages:T,transport:V,onFinish:async({finishReason:P,isAbort:se,isDisconnect:ue,isError:ye})=>{g({type:"SET_FINISH_REASON",payload:P??null}),!(P!=="stop"||se||ue||ye)&&await o()},onToolCall:N,onError:P=>{console.error("[chat] Error",P)}}),K=L.status==="submitted"||L.status==="streaming",ee=L.messages.length===0,te=P=>g({type:"SET_TIPTAP_DOC",payload:P}),ae=()=>g({type:"CLEAR_TIPTAP_DOC"}),ce=()=>g({type:"RESET"}),$=async P=>{try{if(await wn(p,P,{hidden:!0})){if(P===c){const ye=s.find(Le=>Le.id!==P);l(ye?.id??crypto.randomUUID())}await o()}}catch(se){const ue=se;ze.error(`Failed to update thread: ${ue.message}`),console.error("[chat] Failed to update thread:",se)}},W=P=>{y(P)},$e=P=>{E({id:P.id,connectionId:P.connectionId})},Ia=async P=>{if(!u){ze.error("No model configured");return}const se=En(P);if(se.length===0)return;ce();const ue={tiptapDoc:P,created_at:new Date().toISOString(),thread_id:c,agent:{id:j?.id??Z},user:{avatar:b?.image??void 0,name:b?.name??"you"}},ye={...ue,system:S,model:{id:u.id,connectionId:u.connectionId,provider:u.provider??void 0,limits:u.limits??void 0,capabilities:{vision:u.capabilities?.includes("vision")??void 0,text:u.capabilities?.includes("text")??void 0,tools:u.capabilities?.includes("tools")??void 0},fastId:u.fastId}},Le={id:crypto.randomUUID(),role:"user",parts:se,metadata:ue};await L.sendMessage(Le,{metadata:ye})},Ea=()=>L.stop(),wa=()=>g({type:"CLEAR_FINISH_REASON"}),Sa={tiptapDoc:f.tiptapDoc,setTiptapDoc:te,clearTiptapDoc:ae,resetInteraction:ce,activeThreadId:c,threads:s,setActiveThreadId:l,hideThread:$,hasNextPage:r,isFetchingNextPage:n,fetchNextPage:i,virtualMcps:x,selectedVirtualMcp:j,setVirtualMcpId:W,modelsConnections:_,selectedModel:u,setSelectedModel:$e,messages:L.messages,chatStatus:L.status,isStreaming:K,isChatEmpty:ee,sendMessage:Ia,stopStreaming:Ea,setMessages:L.setMessages,chatError:L.error,clearChatError:L.clearError,finishReason:f.finishReason,clearFinishReason:wa};return d.jsx(ba.Provider,{value:Sa,children:t})}function Qn(){const t=C.useContext(ba);if(!t)throw new Error("useChat must be used within a ChatProvider");return t}function Sn(t){return(t.costs?.input??0)+(t.costs?.output??0)>0}function Nn(t,e){const a=e.costs?.input??0,s=e.costs?.output??0,r=(t?.costs?.input??0)+(t?.costs?.output??0);return!t||r===0||a+s<r?e:t}var De="Collapsible",[Cn,Xn]=Fa(De),[Tn,nt]=Cn(De),xa=C.forwardRef((t,e)=>{const{__scopeCollapsible:a,open:s,defaultOpen:r,disabled:n,onOpenChange:i,...o}=t,[c,l]=$a({prop:s,defaultProp:r??!1,onChange:i,caller:De});return d.jsx(Tn,{scope:a,disabled:n,contentId:La(),open:c,onOpenToggle:C.useCallback(()=>l(p=>!p),[l]),children:d.jsx(Xe.div,{"data-state":ct(c),"data-disabled":n?"":void 0,...o,ref:e})})});xa.displayName=De;var _a="CollapsibleTrigger",ot=C.forwardRef((t,e)=>{const{__scopeCollapsible:a,...s}=t,r=nt(_a,a);return d.jsx(Xe.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":ct(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...s,ref:e,onClick:Za(t.onClick,r.onOpenToggle)})});ot.displayName=_a;var it="CollapsibleContent",lt=C.forwardRef((t,e)=>{const{forceMount:a,...s}=t,r=nt(it,t.__scopeCollapsible);return d.jsx(Ua,{present:a||r.open,children:({present:n})=>d.jsx(An,{...s,ref:e,present:n})})});lt.displayName=it;var An=C.forwardRef((t,e)=>{const{__scopeCollapsible:a,present:s,children:r,...n}=t,i=nt(it,a),[o,c]=C.useState(s),l=C.useRef(null),p=za(e,l),m=C.useRef(0),b=m.current,f=C.useRef(0),g=f.current,x=i.open||o,v=C.useRef(x),y=C.useRef(void 0);return C.useEffect(()=>{const _=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(_)},[]),Ba(()=>{const _=l.current;if(_){y.current=y.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";const u=_.getBoundingClientRect();m.current=u.height,f.current=u.width,v.current||(_.style.transitionDuration=y.current.transitionDuration,_.style.animationName=y.current.animationName),c(s)}},[i.open,s]),d.jsx(Xe.div,{"data-state":ct(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!x,...n,ref:p,style:{"--radix-collapsible-content-height":b?`${b}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:x&&r})});function ct(t){return t?"open":"closed"}var Mn=xa,Kn=ot,eo=lt;function to(t){const e=D.c(4);let a;e[0]!==t?({...a}=t,e[0]=t,e[1]=a):a=e[1];let s;return e[2]!==a?(s=d.jsx(Mn,{"data-slot":"collapsible",...a}),e[2]=a,e[3]=s):s=e[3],s}function ao(t){const e=D.c(4);let a;e[0]!==t?({...a}=t,e[0]=t,e[1]=a):a=e[1];let s;return e[2]!==a?(s=d.jsx(ot,{"data-slot":"collapsible-trigger",...a}),e[2]=a,e[3]=s):s=e[3],s}function so(t){const e=D.c(4);let a;e[0]!==t?({...a}=t,e[0]=t,e[1]=a):a=e[1];let s;return e[2]!==a?(s=d.jsx(lt,{"data-slot":"collapsible-content",...a}),e[2]=a,e[3]=s):s=e[3],s}export{to as C,Yn as M,Mn as R,z as S,Kn as T,ao as a,eo as b,Xn as c,so as d,Gn as e,Zt as i,Hn as m,zt as t,Qn as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{bD as Q,r as C,o as As,s as mt,c as N,j as o,b9 as It,u as Y,k as Ms,t as Ps,a as oe,f as Ls,an as gn,bt as F,bE as zs,aA as Ds,x as _t,z as ne,D as bn,aB as Ws,w as Tt,ay as Hs,aC as jn,y as vn,aI as Fs,aJ as Vs,E as yn,aK as Bs,bF as $t,bG as Us,az as qs,b5 as Ks,v as Js,bH as Gs,bm as Sn}from"./index-M3wOD-T-.js";import{E as wn,I as Ye,n as Xs}from"./empty-state--pBjJrWJ.js";import{E as Nn}from"./error-boundary-C4ZiBZqG.js";import{a as Et,u as Ot,g as Rt,e as At,d as Mt}from"./use-collections-COu7mzCX.js";import{u as ee,i as Zs}from"./constants-CAezfWK1.js";import{P as Pt}from"./pin-to-sidebar-button-CnJDDpqU.js";import{B as V,c as O}from"./button-CrpAre8y.js";import{F as pt,a as Qs,b as Lt,d as zt}from"./form-DQQrIzsV.js";import{I as Dt}from"./input-YM08EPCC.js";import{T as yt}from"./textarea-55XlgpLZ.js";import{T as le,a as ce,b as ae,c as de}from"./tooltip-D1Jc2Tgr.js";import{i as kn,a as Ys}from"./Tool01-ChloSpuN.js";import{a as Cn,V as Wt,b as Ee}from"./layout-BHkRlBCz.js";import{S as In,a as _n,b as Tn,c as $n,d as St}from"./select-D2wMncj-.js";import{i as eo}from"./AlertCircle-xn5rFX2T.js";import{s as to,M as Oe}from"./monaco-editor-i9oMLTE9.js";import{i as no}from"./Code01-DR-jbECo.js";import{a as so}from"./Copy01-Ds6kUzpe.js";import{i as ze}from"./Loading01-CaAuMuYs.js";import{i as Ht}from"./Play-CUJHUsFq.js";import{s as Ft}from"./XClose-DnQCXbLq.js";import{u as oo,O as ro,M as io,F as lo,v as co}from"./index-D55GsjfR.js";import{u as Vt,b as ao}from"./use-connection-D5-dSK3A.js";import{E as Bt}from"./empty-state-DrxI6i2r.js";import{D as uo,a as fo}from"./use-binding-DdMe4omo.js";import{b as En}from"./use-virtual-mcp-Ciz726kq.js";import{b as mo,a as rn,R as po}from"./resizable-rgbJMlXu.js";import{S as De}from"./spinner-B3atGTOQ.js";import{V as xo}from"./view-mode-toggle-DWoBF8kY.js";import{N as ho,S as go,a as bo,c as jo,m as Ke,P as vo,i as yo,R as So,b as wo,d as No,e as ln,E as ko,f as Co}from"./index-CsFpv8QQ.js";import{b as Io,c as _o,d as To,e as $o,a as Eo,D as Oo}from"./dialog-DHQqGK7g.js";import"./index-CYuJPFs9.js";import{s as On}from"./Plus-BfTBbS63.js";import{n as Ro}from"./Calendar-DjDp3sZ6.js";import{i as Ut}from"./Check-CP3euUrF.js";import{i as Ao}from"./DotsHorizontal-DZRRv704.js";import{D as Mo,a as Po,b as Lo,c as cn}from"./dropdown-menu-C8F0EsLR.js";import{T as zo,R as Do,b as Wo,c as Rn}from"./collapsible-CNHksBot.js";import{i as Ho}from"./Grid01-BRgRtmbs.js";import{B as $e}from"./badge-DUUncEQr.js";import{i as An}from"./X-DhTQLdE5.js";import"./useMutation-i3JyomhH.js";import"./useQuery-BQUu3Rwx.js";import"./Pin01-YRdxhSee.js";import"./use-organization-settings-D9D-nJ5w.js";import"./ArrowLeft-Bb6bw7wO.js";import"./ChevronDown-sM8LyvvZ.js";import"./mcp-oauth-PtJaIBSs.js";import"./env-vars-editor-B2cK0oXN.js";import"./Trash01-DFo133oe.js";import"./File06-B5Dv7-Oa.js";import"./Key01-DYMhbAB1.js";import"./extract-connection-data-BQo5YaFM.js";import"./constants-AccVhxEg.js";import"./github-icon-Dp3wHhYE.js";import"./registry-utils-CcsfK0rU.js";import"./generate-id-Dyweu44Y.js";import"./Terminal-Csxea4Ut.js";import"./Users03-D4Z1AQ9s.js";import"./circle-alert-CKX7xMwa.js";import"./index-BVCaXPqJ.js";import"./binder-BPAsHHtz.js";import"./popover-B_5ZVJni.js";import"./use-mcp-prompts-BLDzHD20.js";import"./ArrowUp-DmmjiRhr.js";import"./Edit01-BVZvpfR8.js";import"./localstorage-keys-hwI1e15G.js";import"./SearchMd-DVKxUKrX.js";import"./use-create-virtual-mcp-BaTDfij5.js";import"./useSuspenseInfiniteQuery-aRxFMhU5.js";import"./infiniteQueryObserver-CfX1I4Ag.js";import"./Image01-DoUr5ERm.js";const Mn=Q("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);const Pn=Q("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const qt=Q("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Kt=Q("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Fo=Q("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const Vo=Q("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const Bo=Q("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const Ln=Q("FileText",[["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 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const zn=Q("File",[["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"}]]);const Dn=Q("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const Wn=Q("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const Hn=Q("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]),Jt=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M12 8v4m0 4h.01M2 8.523v6.954c0 .245 0 .367.028.482a1 1 0 0 0 .12.29c.061.1.148.187.32.36l4.923 4.922c.173.173.26.26.36.322.09.054.188.095.29.12.115.027.237.027.482.027h6.954c.245 0 .367 0 .482-.028a.998.998 0 0 0 .29-.12c.1-.061.187-.148.36-.32l4.922-4.923c.173-.173.26-.26.322-.36a.998.998 0 0 0 .12-.29c.027-.115.027-.237.027-.482V8.523c0-.245 0-.367-.028-.482a.998.998 0 0 0-.12-.29c-.061-.1-.148-.187-.32-.36L16.608 2.47c-.173-.173-.26-.26-.36-.322a1 1 0 0 0-.29-.12C15.844 2 15.722 2 15.477 2H8.523c-.245 0-.367 0-.482.028a1 1 0 0 0-.29.12c-.1.061-.187.148-.36.32L2.47 7.392c-.173.173-.26.26-.322.36a1 1 0 0 0-.12.29C2 8.156 2 8.278 2 8.523Z"}));Jt.displayName="AlertOctagon";const Fn=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M20.5 8v8.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.22 21 17.38 21 15.7 21H8.3c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3.5 18.72 3.5 17.88 3.5 16.2V8m.1-5h16.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C22 3.76 22 4.04 22 4.6v1.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C21.24 8 20.96 8 20.4 8H3.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C2 7.24 2 6.96 2 6.4V4.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C2.76 3 3.04 3 3.6 3Zm6 8.5h4.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C16 12.26 16 12.54 16 13.1v.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437c-.214.109-.494.109-1.054.109H9.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C8 14.74 8 14.46 8 13.9v-.8c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C8.76 11.5 9.04 11.5 9.6 11.5Z"}));Fn.displayName="Box";const Vn=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"m22.7 11.5-2 2-2-2m2.245 1.5A9 9 0 1 0 19 17.657M12 7v5l3 2"}));Vn.displayName="ClockFastForward";const Bn=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"m17 17 5-5-5-5M7 7l-5 5 5 5m7-14-4 18"}));Bn.displayName="Code02";const Je=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M6.8 3h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C3 4.52 3 5.08 3 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 21 5.08 21 6.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C10 19.48 10 18.92 10 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C8.48 3 7.92 3 6.8 3Zm11 0h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C14 4.52 14 5.08 14 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C15.52 21 16.08 21 17.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 19.48 21 18.92 21 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C19.48 3 18.92 3 17.8 3Z"}));Je.displayName="Columns01";const Un=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M4 4v1.4c0 3.36 0 5.04.654 6.324a6 6 0 0 0 2.622 2.622C8.56 15 10.24 15 13.6 15H20m0 0-5-5m5 5-5 5"}));Un.displayName="CornerDownRight";const qn=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M21 5c0 1.657-4.03 3-9 3S3 6.657 3 5m18 0c0-1.657-4.03-3-9-3S3 3.343 3 5m18 0v14c0 1.66-4 3-9 3s-9-1.34-9-3V5m18 7c0 1.66-4 3-9 3s-9-1.34-9-3"}));qn.displayName="Database01";const Kn=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M3 3v10.2c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 18 6.12 18 7.8 18H15m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0ZM3 8h12m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0Z"}));Kn.displayName="GitBranch01";const Jn=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"m13 22-3-3m0 0 3-3m-3 3h5a7 7 0 0 0 3-13.326M6 18.326A7 7 0 0 1 9 5h5m0 0-3-3m3 3-3 3"}));Jn.displayName="Repeat03";const Gt=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M15 8H8.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C7 7.24 7 6.96 7 6.4V3m10 18v-6.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C16.24 13 15.96 13 15.4 13H8.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C7 13.76 7 14.04 7 14.6V21M21 9.325V16.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h6.875c.489 0 .733 0 .963.055.204.05.4.13.579.24.201.123.374.296.72.642l3.126 3.126c.346.346.519.519.642.72.11.18.19.374.24.579.055.23.055.474.055.963Z"}));Gt.displayName="Save02";As({title:mt().min(1),description:mt().nullable(),body:mt()});function xt(t){for(const e of t.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Uo(){const t=window.location.pathname.split("/").filter(Boolean),e=t.findIndex(s=>s==="mcps"),n=e>=0?t[e+1]:void 0;return n?decodeURIComponent(n):void 0}function qo(t){const e=N.c(13),{form:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=s):s=e[0];let i;e[1]!==n.control?(i=o.jsxs("div",{className:"flex flex-col gap-4",children:[s,o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsx(pt,{control:n.control,name:"title",render:Go}),o.jsx(pt,{control:n.control,name:"description",render:Jo})]})]}),e[1]=n.control,e[2]=i):i=e[2];let r,l;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),l=o.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=r,e[4]=l):(r=e[3],l=e[4]);let c;e[5]!==n.control?(c=o.jsxs("div",{className:"flex flex-col gap-2",children:[r,l,o.jsx(pt,{control:n.control,name:"body",render:Ko})]}),e[5]=n.control,e[6]=c):c=e[6];let a;e[7]!==i||e[8]!==c?(a=o.jsxs("div",{className:"h-full py-6 flex flex-col max-w-3xl mx-auto w-full min-w-0 gap-8 overflow-y-auto px-4",children:[i,c]}),e[7]=i,e[8]=c,e[9]=a):a=e[9];let d;return e[10]!==n||e[11]!==a?(d=o.jsx(Qs,{...n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}function Ko(t){const{field:e}=t;return o.jsx(Lt,{children:o.jsx(zt,{children:o.jsx(yt,{...e,value:e.value??"",placeholder:"Write the prompt message…",className:"min-h-[240px] resize-none text-base leading-relaxed font-normal rounded-xl border border-border bg-muted/20 px-4 py-3 shadow-none focus-visible:ring-0"})})})}function Jo(t){const{field:e}=t;return o.jsxs(Lt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),o.jsx(zt,{children:o.jsx(Dt,{...e,value:e.value??"",placeholder:"Add a description…",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Go(t){const{field:e}=t;return o.jsxs(Lt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),o.jsx(zt,{children:o.jsx(Dt,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Xo(t){const e=N.c(52),{providerId:n,promptId:s,onBack:i}=t,l=It().location.href,{org:c}=Y(),a=n||null;let d;e[0]!==c.id||e[1]!==a?(d={connectionId:a,orgId:c.id},e[0]=c.id,e[1]=a,e[2]=d):d=e[2];const u=ee(d),f=Et(n,"PROMPT",s,u),m=Ot(n,"PROMPT",u),x=m.update.isPending;let p;e[3]!==f?(p=f?{title:f.title,description:f.description??null,body:xt(f)}:void 0,e[3]=f,e[4]=p):p=e[4];let h;e[5]!==p?(h={values:p},e[5]=p,e[6]=h):h=e[6];const g=Ms(h);let b;e[7]!==g||e[8]!==f?(b=()=>{f&&g.reset({title:f.title,description:f.description??null,body:xt(f)})},e[7]=g,e[8]=f,e[9]=b):b=e[9];const j=b;let y;e[10]!==m.update||e[11]!==g||e[12]!==s?(y=g.handleSubmit(async D=>{const G=await m.update.mutateAsync({id:s,data:{title:D.title,description:D.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:D.body}}]}});g.reset({title:G.title,description:G.description??null,body:xt(G)})}),e[10]=m.update,e[11]=g,e[12]=s,e[13]=y):y=e[13];const S=y;if(!f){let D;return e[14]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(wn,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[14]=D):D=e[14],D}let v;e[15]!==f.title?(v=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:f.title}),e[15]=f.title,e[16]=v):v=e[16];let w;e[17]!==f.description?(w=f.description?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),o.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:f.description})]}):null,e[17]=f.description,e[18]=w):w=e[18];let k;e[19]!==v||e[20]!==w?(k=o.jsx(Cn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[v,w]})}),e[19]=v,e[20]=w,e[21]=k):k=e[21];let I;e[22]!==f.title||e[23]!==l?(I=o.jsx(Pt,{title:f.title,url:l,icon:"description"}),e[22]=f.title,e[23]=l,e[24]=I):I=e[24];const T=!g.formState.isDirty||x;let M;e[25]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(kn,{size:14}),e[25]=M):M=e[25];let R;e[26]!==j||e[27]!==T?(R=o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:T,onClick:j,"aria-label":"Cancel",children:M})})}),e[26]=j,e[27]=T,e[28]=R):R=e[28];let P;e[29]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(ce,{side:"bottom",children:"Cancel"}),e[29]=P):P=e[29];let z;e[30]!==R?(z=o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[R,P]})}),e[30]=R,e[31]=z):z=e[31];const q=!g.formState.isDirty||x;let A;e[32]!==S?(A=()=>{S()},e[32]=S,e[33]=A):A=e[33];let J;e[34]===Symbol.for("react.memo_cache_sentinel")?(J=o.jsx(Gt,{size:14}),e[34]=J):J=e[34];let _;e[35]!==q||e[36]!==A?(_=o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:q,onClick:A,"aria-label":"Save",children:J})})}),e[35]=q,e[36]=A,e[37]=_):_=e[37];let $;e[38]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(ce,{side:"bottom",children:"Save"}),e[38]=$):$=e[38];let E;e[39]!==_?(E=o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[_,$]})}),e[39]=_,e[40]=E):E=e[40];let L;e[41]!==I||e[42]!==z||e[43]!==E?(L=o.jsxs(Wt,{children:[I,z,E]}),e[41]=I,e[42]=z,e[43]=E,e[44]=L):L=e[44];let H;e[45]!==g?(H=o.jsx("div",{className:"h-full",children:o.jsx(qo,{form:g})}),e[45]=g,e[46]=H):H=e[46];let Z;return e[47]!==i||e[48]!==L||e[49]!==H||e[50]!==k?(Z=o.jsxs(Ee,{onBack:i,children:[k,L,H]}),e[47]=i,e[48]=L,e[49]=H,e[50]=k,e[51]=Z):Z=e[51],Z}function Zo(t){const e=N.c(5),{itemId:n,onBack:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Uo(),e[0]=i):i=e[0];const r=i;if(!r){let c;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(wn,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=c):c=e[1],c}let l;return e[2]!==n||e[3]!==s?(l=o.jsx(Nn,{children:o.jsx(C.Suspense,{fallback:null,children:o.jsx(Xo,{providerId:r,promptId:n,onBack:s})})}),e[2]=n,e[3]=s,e[4]=l):l=e[4],l}const Qo=Ps("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/5 text-destructive border-destructive/25 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function Yo(t){const e=N.c(10);let n,s,i;e[0]!==t?({className:n,variant:i,...s}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i):(n=e[1],s=e[2],i=e[3]);let r;e[4]!==n||e[5]!==i?(r=O(Qo({variant:i}),n),e[4]=n,e[5]=i,e[6]=r):r=e[6];let l;return e[7]!==s||e[8]!==r?(l=o.jsx("div",{"data-slot":"alert",role:"alert",className:r,...s}),e[7]=s,e[8]=r,e[9]=l):l=e[9],l}function er(t){const e=N.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=O("line-clamp-1 min-h-4 font-medium tracking-tight",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx("div",{"data-slot":"alert-title",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function tr(t){const e=N.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=O("text-muted-foreground leading-relaxed",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx("div",{"data-slot":"alert-description",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}const nr=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function sr(t){const e=N.c(10),{toolName:n,connectionId:s,onBack:i}=t;let r;e[0]!==s?(r={connectionId:s},e[0]=s,e[1]=r):r=e[1];const l=oo(r);if(!l.isAuthenticated){let d;return e[2]!==l.supportsOAuth||e[3]!==i?(d=o.jsx("div",{className:"flex h-full items-center justify-center",children:l.supportsOAuth?o.jsx(ro,{onAuthenticate:()=>i(),buttonText:"Go back to authenticate"}):o.jsx(io,{hasReadme:!1})}),e[2]=l.supportsOAuth,e[3]=i,e[4]=d):d=e[4],d}const c=`${s}:${n}`;let a;return e[5]!==s||e[6]!==i||e[7]!==c||e[8]!==n?(a=o.jsx(or,{toolName:n,connectionId:s,onBack:i},c),e[5]=s,e[6]=i,e[7]=c,e[8]=n,e[9]=a):a=e[9],a}function or({toolName:t,connectionId:e,onBack:n}){const i=It().location.href,{replayId:r}=Ls({strict:!1}),l=(()=>{if(!r)return null;const _=`replay-${r}`,$=sessionStorage.getItem(_);if(!$)return null;sessionStorage.removeItem(_);try{return JSON.parse($)}catch{return null}})(),c=(()=>{if(!l)return null;const _={};for(const[$,E]of Object.entries(l))E!==null&&typeof E=="object"?_[$]=JSON.stringify(E,null,2):_[$]=E;return _})(),[a,d]=C.useState(c??{}),[u,f]=C.useState(l?JSON.stringify(l,null,2):"{}"),[m,x]=C.useState(null),[p,h]=C.useState(null),[g,b]=C.useState(!1),[j,y]=C.useState(null),{org:S}=Y(),v=Vt(e),w=ee({connectionId:e,orgId:S.id}),k=Rt({client:w}),I=k.data?.tools?.find(_=>_.name===t),T=I?.inputSchema?.properties,M=T?Object.keys(T):[],R=M.length>0,P={};if(R&&I?.inputSchema?.properties)for(const _ of M)P[_]=I.inputSchema.required?.includes(_)?"":void 0;const z=_=>Object.prototype.hasOwnProperty.call(a,_),q=async()=>{b(!0),h(null),x(null),y(null);const _=performance.now();try{if(!w)throw new Error("MCP client is not available");const $=R?{...P,...a}:(()=>{const B=u.trim();if(!B)return{};const K=JSON.parse(B);if(K&&typeof K=="object")return K;throw new Error("Raw JSON input must be an object.")})();R&&I?.inputSchema?.properties&&Object.entries(I.inputSchema.properties).forEach(([B,K])=>{if((K.type==="object"||K.type==="array")&&typeof $[B]=="string")try{$[B]=JSON.parse($[B])}catch{}});const E=await w.callTool({name:t,arguments:$}),L=E.structuredContent??E,H=performance.now(),Z=Math.round(H-_);x(L);const D=JSON.stringify(L),G=new TextEncoder().encode(D).length;y({duration:`${Z}ms`,bytes:`${G} bytes`,tokens:`~${Math.ceil(G/4)} tokens`,cost:"$0.0000"})}catch($){const E=$ instanceof Error?$.message:String($);h(E||"Unknown error occurred");const L=performance.now();y({duration:`${Math.round(L-_)}ms`})}finally{b(!1)}},A=(_,$)=>{d(E=>({...E,[_]:$}))},J=()=>{x(null),h(null),y(null)};return o.jsxs(Ee,{onBack:n,children:[o.jsx(Wt,{children:o.jsx(Pt,{title:I?.name??nr(t),url:i,icon:"build"})}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 h-full",children:[o.jsx("div",{className:"flex flex-col border-r border-border overflow-hidden",children:o.jsxs("div",{className:"flex-1 overflow-auto",children:[o.jsx("div",{className:"flex flex-col gap-4 p-6 border-b border-border min-h-28",children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Ye,{icon:v?.icon||null,name:v?.title||t,size:"sm",className:"shadow-sm shrink-0"}),o.jsx("h1",{className:"text-lg font-medium text-foreground leading-none",children:t}),o.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit",children:[k.isSuccess?o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):k.isLoading?o.jsx(ze,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),o.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:k.isSuccess?"ready":k.isLoading?"connecting":"error"})]})]}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:I?.description||"No description available"})]})}),o.jsxs("div",{className:"flex flex-col p-6 gap-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),I?.inputSchema?.required&&I.inputSchema.required.length>0&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[o.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),o.jsx("div",{className:"space-y-4",children:R&&I?.inputSchema?.properties?Object.entries(I.inputSchema.properties).map(([_,$])=>o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[_,I.inputSchema?.required?.includes(_)&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),o.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:$.type})]}),$.description&&o.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:$.description}),$.type==="object"||$.type==="array"?o.jsx(yt,{className:"font-mono text-xs",value:z(_)?a[_]??"":P[_]??"",onChange:E=>A(_,E.target.value),placeholder:`Enter ${_} as JSON...`,rows:3}):$.type==="boolean"?o.jsxs(In,{value:z(_)?String(a[_]??""):"",onValueChange:E=>A(_,E==="true"),children:[o.jsx(_n,{children:o.jsx(Tn,{placeholder:"Select true or false..."})}),o.jsxs($n,{children:[o.jsx(St,{value:"true",children:"true"}),o.jsx(St,{value:"false",children:"false"})]})]}):o.jsx(Dt,{value:z(_)?a[_]??"":P[_]??"",onChange:E=>A(_,E.target.value),placeholder:`Enter ${_}...`})]},_)):I?.inputSchema&&!R?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),o.jsx(yt,{className:"font-mono text-xs min-h-[120px]",value:u,onChange:_=>f(_.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):o.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})})]})]})}),o.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-t lg:border-t-0 border-b border-border bg-background",children:[o.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),j&&o.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(to,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:j.duration})]}),j.tokens&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(Fn,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:j.tokens})]}),j.bytes&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(qn,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:j.bytes})]}),j.cost&&o.jsx("div",{className:"flex items-center gap-1.5",children:o.jsx("span",{className:"font-mono text-foreground",children:j.cost})})]})]}),o.jsx("div",{className:"flex items-center justify-end lg:justify-between px-4 h-14 border-b border-border bg-background",children:o.jsxs("div",{className:"flex items-center gap-2 w-full lg:w-auto",children:[o.jsx(V,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:q,disabled:g,children:g?o.jsxs(o.Fragment,{children:[o.jsx(ze,{size:14,className:"animate-spin"}),"Executing..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Ht,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),o.jsx(ae,{children:o.jsxs(de,{children:[o.jsx(le,{asChild:!0,children:o.jsx(V,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:J,disabled:!m&&!p,children:o.jsx(Ft,{size:14})})}),o.jsx(ce,{children:o.jsx("p",{children:"Clear results"})})]})})]})}),p&&o.jsx("div",{className:"px-6 py-4 bg-background",children:o.jsx(Yo,{variant:"destructive",children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(eo,{className:"h-4 w-4"}),o.jsx(er,{className:"mb-0",children:"Execution Failed"})]}),o.jsx(tr,{className:"text-xs text-destructive",children:p})]})})}),o.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:m?o.jsxs(o.Fragment,{children:[o.jsx(Oe,{code:JSON.stringify(m,null,2),language:"json",height:"100%",readOnly:!0}),o.jsx(V,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(m,null,2)),gn.success("Copied to clipboard")},children:o.jsx(so,{className:"h-3.5 w-3.5"})})]}):o.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[o.jsx(no,{className:"h-12 w-12 mb-3 opacity-40"}),o.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})]})}function rr(t){const e=N.c(7),{itemId:n,onBack:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const l=oe(i).connectionId;if(!Vt(l)||!l){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[1]=u):u=e[1],u}let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(ze,{size:32,className:"animate-spin text-muted-foreground"})}),e[2]=a):a=e[2];let d;return e[3]!==l||e[4]!==s||e[5]!==n?(d=o.jsx(C.Suspense,{fallback:a,children:o.jsx(sr,{toolName:n,connectionId:l,onBack:s})}),e[3]=l,e[4]=s,e[5]=n,e[6]=d):d=e[6],d}const an=t=>{let e;const n=new Set,s=(d,u)=>{const f=typeof d=="function"?d(e):d;if(!Object.is(f,e)){const m=e;e=u??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(x=>x(e,m))}},i=()=>e,c={setState:s,getState:i,getInitialState:()=>a,subscribe:d=>(n.add(d),()=>n.delete(d))},a=e=t(s,i,c);return c},Xt=(t=>t?an(t):an),ir=t=>t;function wt(t,e=ir){const n=F.useSyncExternalStore(t.subscribe,F.useCallback(()=>e(t.getState()),[t,e]),F.useCallback(()=>e(t.getInitialState()),[t,e]));return F.useDebugValue(n),n}const lr=t=>{const e=Xt(t),n=s=>wt(e,s);return Object.assign(n,e),n},cr=(t=>lr);function Gn(t,e){let n;try{n=t()}catch{return}return{getItem:i=>{var r;const l=a=>a===null?null:JSON.parse(a,void 0),c=(r=n.getItem(i))!=null?r:null;return c instanceof Promise?c.then(l):l(c)},setItem:(i,r)=>n.setItem(i,JSON.stringify(r,void 0)),removeItem:i=>n.removeItem(i)}}const Nt=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return Nt(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return Nt(s)(n)}}}},ar=(t,e)=>(n,s,i)=>{let r={storage:Gn(()=>localStorage),partialize:g=>g,version:0,merge:(g,b)=>({...b,...g}),...e},l=!1,c=0;const a=new Set,d=new Set;let u=r.storage;if(!u)return t((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),n(...g)},s,i);const f=()=>{const g=r.partialize({...s()});return u.setItem(r.name,{state:g,version:r.version})},m=i.setState;i.setState=(g,b)=>(m(g,b),f());const x=t((...g)=>(n(...g),f()),s,i);i.getInitialState=()=>x;let p;const h=()=>{var g,b;if(!u)return;const j=++c;l=!1,a.forEach(S=>{var v;return S((v=s())!=null?v:x)});const y=((b=r.onRehydrateStorage)==null?void 0:b.call(r,(g=s())!=null?g:x))||void 0;return Nt(u.getItem.bind(u))(r.name).then(S=>{if(S)if(typeof S.version=="number"&&S.version!==r.version){if(r.migrate){const v=r.migrate(S.state,S.version);return v instanceof Promise?v.then(w=>[!0,w]):[!0,v]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,S.state];return[!1,void 0]}).then(S=>{var v;if(j!==c)return;const[w,k]=S;if(p=r.merge(k,(v=s())!=null?v:x),n(p,!0),w)return f()}).then(()=>{j===c&&(y?.(p,void 0),p=s(),l=!0,d.forEach(S=>S(p)))}).catch(S=>{j===c&&y?.(void 0,S)})};return i.persist={setOptions:g=>{r={...r,...g},g.storage&&(u=g.storage)},clearStorage:()=>{u?.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>h(),hasHydrated:()=>l,onHydrate:g=>(a.add(g),()=>{a.delete(g)}),onFinishHydration:g=>(d.add(g),()=>{d.delete(g)})},r.skipHydration||h(),p||x},Xn=ar,{useSyncExternalStoreWithSelector:dr}=zs,ur=t=>t;function fr(t,e=ur,n){const s=dr(t.subscribe,t.getState,t.getInitialState,e,n);return F.useDebugValue(s),s}const dn=t=>Symbol.iterator in t,un=t=>"entries"in t,fn=(t,e)=>{const n=t instanceof Map?t:new Map(t.entries()),s=e instanceof Map?e:new Map(e.entries());if(n.size!==s.size)return!1;for(const[i,r]of n)if(!s.has(i)||!Object.is(r,s.get(i)))return!1;return!0},mr=(t,e)=>{const n=t[Symbol.iterator](),s=e[Symbol.iterator]();let i=n.next(),r=s.next();for(;!i.done&&!r.done;){if(!Object.is(i.value,r.value))return!1;i=n.next(),r=s.next()}return!!i.done&&!!r.done};function pr(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e)?!1:dn(t)&&dn(e)?un(t)&&un(e)?fn(t,e):mr(t,e):fn({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function xr(t,e="Output"){if(!t)return`interface ${e} {}`;function n(r){if(!r||typeof r!="object")return"unknown";const l=r.type;if(Array.isArray(l))return l.map(c=>s(c)).join(" | ");switch(l){case"string":return r.enum?r.enum.map(c=>`"${c}"`).join(" | "):"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";case"array":{const c=r.items;return c?`${n(c)}[]`:"unknown[]"}case"object":return i(r);default:return r.anyOf?r.anyOf.map(n).join(" | "):r.oneOf?r.oneOf.map(n).join(" | "):r.allOf?r.allOf.map(n).join(" & "):"unknown"}}function s(r){switch(r){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";default:return"unknown"}}function i(r){const l=r.properties;if(!l)return"Record<string, unknown>";const c=new Set(r.required||[]);return`{
|
|
1
|
+
import{bD as Q,r as C,o as As,s as mt,c as N,j as o,b6 as It,u as Y,k as Ms,t as Ps,a as oe,f as Ls,ao as gn,bt as F,bE as zs,ax as Ds,x as _t,z as ne,D as bn,ay as Ws,w as Tt,av as Hs,az as jn,y as vn,aF as Fs,aG as Vs,E as yn,aH as Bs,bF as $t,bG as Us,aw as qs,b2 as Ks,v as Js,bH as Gs,bn as Sn}from"./index-BcdQIGUF.js";import{E as wn,I as Ye,n as Xs}from"./empty-state-BA1dna4T.js";import{E as Nn}from"./error-boundary-DGWOOFEb.js";import{a as Et,u as Ot,g as Rt,e as At,d as Mt}from"./use-collections-D97KvVa9.js";import{u as ee,i as Zs}from"./constants-BW4JZ47T.js";import{P as Pt}from"./pin-to-sidebar-button-D1PDIW9U.js";import{B as V,c as O}from"./button-BVfOTfpc.js";import{F as pt,a as Qs,b as Lt,d as zt}from"./form-CVtLpajs.js";import{I as Dt}from"./input-CUCPZMz2.js";import{T as yt}from"./textarea-DeK9qU4Z.js";import{T as le,a as ce,b as ae,c as de}from"./tooltip-DDTkATYg.js";import{i as kn,a as Ys}from"./Tool01-BLwXizsZ.js";import{a as Cn,V as Wt,b as Ee}from"./layout-BbogDOP_.js";import{S as In,a as _n,b as Tn,c as $n,d as St}from"./select-Bti-BgCx.js";import{i as eo}from"./AlertCircle-BmzagJTS.js";import{s as to,M as Oe}from"./monaco-editor-CBeaXMU-.js";import{i as no}from"./Code01-C3uTkWw7.js";import{a as so}from"./Copy01-D2UqUo7F.js";import{i as ze}from"./Loading01-D7Nk5rBn.js";import{i as Ht}from"./Play-CaQCPrdk.js";import{s as Ft}from"./XClose-DSGHFh4M.js";import{u as oo,O as ro,M as io,F as lo,v as co}from"./index-CCsaEkmm.js";import{u as Vt,b as ao}from"./use-connection-C76BYat1.js";import{E as Bt}from"./empty-state-Cu7Vuwtc.js";import{D as uo,a as fo}from"./use-binding-Cx0cnXwg.js";import{b as En}from"./use-virtual-mcp-TOs4GWZq.js";import{b as mo,a as rn,R as po}from"./resizable-CQSJSF2D.js";import{S as De}from"./spinner-Fg4ciUuT.js";import{V as xo}from"./view-mode-toggle-JXEPDzFm.js";import{N as ho,S as go,a as bo,c as jo,m as Ke,P as vo,i as yo,R as So,b as wo,d as No,e as ln,E as ko,f as Co}from"./index-Der3_fHk.js";import{b as Io,c as _o,d as To,e as $o,a as Eo,D as Oo}from"./dialog-BKc0uyIf.js";import"./index-DXup9nzR.js";import{s as On}from"./Plus-BAl5ksmH.js";import{n as Ro}from"./Calendar-DZcEp1o3.js";import{i as Ut}from"./Check-CeorNg_Q.js";import{i as Ao}from"./DotsHorizontal-C2Cp4F2y.js";import{D as Mo,a as Po,b as Lo,c as cn}from"./dropdown-menu-COxc-l2r.js";import{T as zo,R as Do,b as Wo,c as Rn}from"./collapsible-GqoDHWGA.js";import{i as Ho}from"./Grid01-C0Yt3TrW.js";import{B as $e}from"./badge-C6I3bZub.js";import{i as An}from"./X-CjLPt87f.js";import"./useMutation-C7y5vUn8.js";import"./useQuery-frKnQxkY.js";import"./Pin01-EjlLL7Hj.js";import"./use-organization-settings-K9WNKRlW.js";import"./ArrowLeft-BkK50n5W.js";import"./ChevronDown-DHgzfDOn.js";import"./mcp-oauth-JUhR-zCP.js";import"./env-vars-editor-V0t9-7eJ.js";import"./Trash01-CdZ-Jz57.js";import"./File06-D3YhRSWf.js";import"./Key01-CG2VBx47.js";import"./extract-connection-data-CUU0Xk9N.js";import"./constants-CBcj5NvV.js";import"./github-icon-Dp3wHhYE.js";import"./registry-utils-BtoR-qhS.js";import"./generate-id-Dyweu44Y.js";import"./Terminal-BK5I3Y1e.js";import"./Users03-9f86Wop8.js";import"./circle-alert-DuAEeMx-.js";import"./index-D47Uffzr.js";import"./binder-DMkBMJDe.js";import"./popover-LSiJhuO3.js";import"./use-mcp-prompts-DzCHcPVg.js";import"./ArrowUp-BjUPYtOi.js";import"./Edit01-D4kKualc.js";import"./localstorage-keys-du1r-Z9U.js";import"./SearchMd-XlpqEN-D.js";import"./use-create-virtual-mcp-DazESShZ.js";import"./useSuspenseInfiniteQuery-7GUdjJBj.js";import"./infiniteQueryObserver-DrveVX8A.js";import"./Image01-BxGEkI20.js";const Mn=Q("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);const Pn=Q("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const qt=Q("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Kt=Q("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Fo=Q("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const Vo=Q("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const Bo=Q("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const Ln=Q("FileText",[["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 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const zn=Q("File",[["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"}]]);const Dn=Q("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const Wn=Q("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const Hn=Q("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]),Jt=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M12 8v4m0 4h.01M2 8.523v6.954c0 .245 0 .367.028.482a1 1 0 0 0 .12.29c.061.1.148.187.32.36l4.923 4.922c.173.173.26.26.36.322.09.054.188.095.29.12.115.027.237.027.482.027h6.954c.245 0 .367 0 .482-.028a.998.998 0 0 0 .29-.12c.1-.061.187-.148.36-.32l4.922-4.923c.173-.173.26-.26.322-.36a.998.998 0 0 0 .12-.29c.027-.115.027-.237.027-.482V8.523c0-.245 0-.367-.028-.482a.998.998 0 0 0-.12-.29c-.061-.1-.148-.187-.32-.36L16.608 2.47c-.173-.173-.26-.26-.36-.322a1 1 0 0 0-.29-.12C15.844 2 15.722 2 15.477 2H8.523c-.245 0-.367 0-.482.028a1 1 0 0 0-.29.12c-.1.061-.187.148-.36.32L2.47 7.392c-.173.173-.26.26-.322.36a1 1 0 0 0-.12.29C2 8.156 2 8.278 2 8.523Z"}));Jt.displayName="AlertOctagon";const Fn=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M20.5 8v8.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.22 21 17.38 21 15.7 21H8.3c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3.5 18.72 3.5 17.88 3.5 16.2V8m.1-5h16.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C22 3.76 22 4.04 22 4.6v1.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C21.24 8 20.96 8 20.4 8H3.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C2 7.24 2 6.96 2 6.4V4.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C2.76 3 3.04 3 3.6 3Zm6 8.5h4.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C16 12.26 16 12.54 16 13.1v.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437c-.214.109-.494.109-1.054.109H9.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C8 14.74 8 14.46 8 13.9v-.8c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C8.76 11.5 9.04 11.5 9.6 11.5Z"}));Fn.displayName="Box";const Vn=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"m22.7 11.5-2 2-2-2m2.245 1.5A9 9 0 1 0 19 17.657M12 7v5l3 2"}));Vn.displayName="ClockFastForward";const Bn=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"m17 17 5-5-5-5M7 7l-5 5 5 5m7-14-4 18"}));Bn.displayName="Code02";const Je=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M6.8 3h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C3 4.52 3 5.08 3 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 21 5.08 21 6.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C10 19.48 10 18.92 10 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C8.48 3 7.92 3 6.8 3Zm11 0h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C14 4.52 14 5.08 14 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C15.52 21 16.08 21 17.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 19.48 21 18.92 21 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C19.48 3 18.92 3 17.8 3Z"}));Je.displayName="Columns01";const Un=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M4 4v1.4c0 3.36 0 5.04.654 6.324a6 6 0 0 0 2.622 2.622C8.56 15 10.24 15 13.6 15H20m0 0-5-5m5 5-5 5"}));Un.displayName="CornerDownRight";const qn=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M21 5c0 1.657-4.03 3-9 3S3 6.657 3 5m18 0c0-1.657-4.03-3-9-3S3 3.343 3 5m18 0v14c0 1.66-4 3-9 3s-9-1.34-9-3V5m18 7c0 1.66-4 3-9 3s-9-1.34-9-3"}));qn.displayName="Database01";const Kn=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M3 3v10.2c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 18 6.12 18 7.8 18H15m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0ZM3 8h12m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0Z"}));Kn.displayName="GitBranch01";const Jn=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"m13 22-3-3m0 0 3-3m-3 3h5a7 7 0 0 0 3-13.326M6 18.326A7 7 0 0 1 9 5h5m0 0-3-3m3 3-3 3"}));Jn.displayName="Repeat03";const Gt=({size:t=24,color:e="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M15 8H8.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C7 7.24 7 6.96 7 6.4V3m10 18v-6.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C16.24 13 15.96 13 15.4 13H8.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C7 13.76 7 14.04 7 14.6V21M21 9.325V16.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h6.875c.489 0 .733 0 .963.055.204.05.4.13.579.24.201.123.374.296.72.642l3.126 3.126c.346.346.519.519.642.72.11.18.19.374.24.579.055.23.055.474.055.963Z"}));Gt.displayName="Save02";As({title:mt().min(1),description:mt().nullable(),body:mt()});function xt(t){for(const e of t.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Uo(){const t=window.location.pathname.split("/").filter(Boolean),e=t.findIndex(s=>s==="mcps"),n=e>=0?t[e+1]:void 0;return n?decodeURIComponent(n):void 0}function qo(t){const e=N.c(13),{form:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=s):s=e[0];let i;e[1]!==n.control?(i=o.jsxs("div",{className:"flex flex-col gap-4",children:[s,o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsx(pt,{control:n.control,name:"title",render:Go}),o.jsx(pt,{control:n.control,name:"description",render:Jo})]})]}),e[1]=n.control,e[2]=i):i=e[2];let r,l;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),l=o.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=r,e[4]=l):(r=e[3],l=e[4]);let c;e[5]!==n.control?(c=o.jsxs("div",{className:"flex flex-col gap-2",children:[r,l,o.jsx(pt,{control:n.control,name:"body",render:Ko})]}),e[5]=n.control,e[6]=c):c=e[6];let a;e[7]!==i||e[8]!==c?(a=o.jsxs("div",{className:"h-full py-6 flex flex-col max-w-3xl mx-auto w-full min-w-0 gap-8 overflow-y-auto px-4",children:[i,c]}),e[7]=i,e[8]=c,e[9]=a):a=e[9];let d;return e[10]!==n||e[11]!==a?(d=o.jsx(Qs,{...n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}function Ko(t){const{field:e}=t;return o.jsx(Lt,{children:o.jsx(zt,{children:o.jsx(yt,{...e,value:e.value??"",placeholder:"Write the prompt message…",className:"min-h-[240px] resize-none text-base leading-relaxed font-normal rounded-xl border border-border bg-muted/20 px-4 py-3 shadow-none focus-visible:ring-0"})})})}function Jo(t){const{field:e}=t;return o.jsxs(Lt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),o.jsx(zt,{children:o.jsx(Dt,{...e,value:e.value??"",placeholder:"Add a description…",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Go(t){const{field:e}=t;return o.jsxs(Lt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),o.jsx(zt,{children:o.jsx(Dt,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Xo(t){const e=N.c(52),{providerId:n,promptId:s,onBack:i}=t,l=It().location.href,{org:c}=Y(),a=n||null;let d;e[0]!==c.id||e[1]!==a?(d={connectionId:a,orgId:c.id},e[0]=c.id,e[1]=a,e[2]=d):d=e[2];const u=ee(d),f=Et(n,"PROMPT",s,u),m=Ot(n,"PROMPT",u),x=m.update.isPending;let p;e[3]!==f?(p=f?{title:f.title,description:f.description??null,body:xt(f)}:void 0,e[3]=f,e[4]=p):p=e[4];let h;e[5]!==p?(h={values:p},e[5]=p,e[6]=h):h=e[6];const g=Ms(h);let b;e[7]!==g||e[8]!==f?(b=()=>{f&&g.reset({title:f.title,description:f.description??null,body:xt(f)})},e[7]=g,e[8]=f,e[9]=b):b=e[9];const j=b;let y;e[10]!==m.update||e[11]!==g||e[12]!==s?(y=g.handleSubmit(async D=>{const G=await m.update.mutateAsync({id:s,data:{title:D.title,description:D.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:D.body}}]}});g.reset({title:G.title,description:G.description??null,body:xt(G)})}),e[10]=m.update,e[11]=g,e[12]=s,e[13]=y):y=e[13];const S=y;if(!f){let D;return e[14]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(wn,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[14]=D):D=e[14],D}let v;e[15]!==f.title?(v=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:f.title}),e[15]=f.title,e[16]=v):v=e[16];let w;e[17]!==f.description?(w=f.description?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),o.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:f.description})]}):null,e[17]=f.description,e[18]=w):w=e[18];let k;e[19]!==v||e[20]!==w?(k=o.jsx(Cn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[v,w]})}),e[19]=v,e[20]=w,e[21]=k):k=e[21];let I;e[22]!==f.title||e[23]!==l?(I=o.jsx(Pt,{title:f.title,url:l,icon:"description"}),e[22]=f.title,e[23]=l,e[24]=I):I=e[24];const T=!g.formState.isDirty||x;let M;e[25]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(kn,{size:14}),e[25]=M):M=e[25];let R;e[26]!==j||e[27]!==T?(R=o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:T,onClick:j,"aria-label":"Cancel",children:M})})}),e[26]=j,e[27]=T,e[28]=R):R=e[28];let P;e[29]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(ce,{side:"bottom",children:"Cancel"}),e[29]=P):P=e[29];let z;e[30]!==R?(z=o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[R,P]})}),e[30]=R,e[31]=z):z=e[31];const q=!g.formState.isDirty||x;let A;e[32]!==S?(A=()=>{S()},e[32]=S,e[33]=A):A=e[33];let J;e[34]===Symbol.for("react.memo_cache_sentinel")?(J=o.jsx(Gt,{size:14}),e[34]=J):J=e[34];let _;e[35]!==q||e[36]!==A?(_=o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:q,onClick:A,"aria-label":"Save",children:J})})}),e[35]=q,e[36]=A,e[37]=_):_=e[37];let $;e[38]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(ce,{side:"bottom",children:"Save"}),e[38]=$):$=e[38];let E;e[39]!==_?(E=o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[_,$]})}),e[39]=_,e[40]=E):E=e[40];let L;e[41]!==I||e[42]!==z||e[43]!==E?(L=o.jsxs(Wt,{children:[I,z,E]}),e[41]=I,e[42]=z,e[43]=E,e[44]=L):L=e[44];let H;e[45]!==g?(H=o.jsx("div",{className:"h-full",children:o.jsx(qo,{form:g})}),e[45]=g,e[46]=H):H=e[46];let Z;return e[47]!==i||e[48]!==L||e[49]!==H||e[50]!==k?(Z=o.jsxs(Ee,{onBack:i,children:[k,L,H]}),e[47]=i,e[48]=L,e[49]=H,e[50]=k,e[51]=Z):Z=e[51],Z}function Zo(t){const e=N.c(5),{itemId:n,onBack:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Uo(),e[0]=i):i=e[0];const r=i;if(!r){let c;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(wn,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=c):c=e[1],c}let l;return e[2]!==n||e[3]!==s?(l=o.jsx(Nn,{children:o.jsx(C.Suspense,{fallback:null,children:o.jsx(Xo,{providerId:r,promptId:n,onBack:s})})}),e[2]=n,e[3]=s,e[4]=l):l=e[4],l}const Qo=Ps("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/5 text-destructive border-destructive/25 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function Yo(t){const e=N.c(10);let n,s,i;e[0]!==t?({className:n,variant:i,...s}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i):(n=e[1],s=e[2],i=e[3]);let r;e[4]!==n||e[5]!==i?(r=O(Qo({variant:i}),n),e[4]=n,e[5]=i,e[6]=r):r=e[6];let l;return e[7]!==s||e[8]!==r?(l=o.jsx("div",{"data-slot":"alert",role:"alert",className:r,...s}),e[7]=s,e[8]=r,e[9]=l):l=e[9],l}function er(t){const e=N.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=O("line-clamp-1 min-h-4 font-medium tracking-tight",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx("div",{"data-slot":"alert-title",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function tr(t){const e=N.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=O("text-muted-foreground leading-relaxed",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx("div",{"data-slot":"alert-description",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}const nr=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function sr(t){const e=N.c(10),{toolName:n,connectionId:s,onBack:i}=t;let r;e[0]!==s?(r={connectionId:s},e[0]=s,e[1]=r):r=e[1];const l=oo(r);if(!l.isAuthenticated){let d;return e[2]!==l.supportsOAuth||e[3]!==i?(d=o.jsx("div",{className:"flex h-full items-center justify-center",children:l.supportsOAuth?o.jsx(ro,{onAuthenticate:()=>i(),buttonText:"Go back to authenticate"}):o.jsx(io,{hasReadme:!1})}),e[2]=l.supportsOAuth,e[3]=i,e[4]=d):d=e[4],d}const c=`${s}:${n}`;let a;return e[5]!==s||e[6]!==i||e[7]!==c||e[8]!==n?(a=o.jsx(or,{toolName:n,connectionId:s,onBack:i},c),e[5]=s,e[6]=i,e[7]=c,e[8]=n,e[9]=a):a=e[9],a}function or({toolName:t,connectionId:e,onBack:n}){const i=It().location.href,{replayId:r}=Ls({strict:!1}),l=(()=>{if(!r)return null;const _=`replay-${r}`,$=sessionStorage.getItem(_);if(!$)return null;sessionStorage.removeItem(_);try{return JSON.parse($)}catch{return null}})(),c=(()=>{if(!l)return null;const _={};for(const[$,E]of Object.entries(l))E!==null&&typeof E=="object"?_[$]=JSON.stringify(E,null,2):_[$]=E;return _})(),[a,d]=C.useState(c??{}),[u,f]=C.useState(l?JSON.stringify(l,null,2):"{}"),[m,x]=C.useState(null),[p,h]=C.useState(null),[g,b]=C.useState(!1),[j,y]=C.useState(null),{org:S}=Y(),v=Vt(e),w=ee({connectionId:e,orgId:S.id}),k=Rt({client:w}),I=k.data?.tools?.find(_=>_.name===t),T=I?.inputSchema?.properties,M=T?Object.keys(T):[],R=M.length>0,P={};if(R&&I?.inputSchema?.properties)for(const _ of M)P[_]=I.inputSchema.required?.includes(_)?"":void 0;const z=_=>Object.prototype.hasOwnProperty.call(a,_),q=async()=>{b(!0),h(null),x(null),y(null);const _=performance.now();try{if(!w)throw new Error("MCP client is not available");const $=R?{...P,...a}:(()=>{const B=u.trim();if(!B)return{};const K=JSON.parse(B);if(K&&typeof K=="object")return K;throw new Error("Raw JSON input must be an object.")})();R&&I?.inputSchema?.properties&&Object.entries(I.inputSchema.properties).forEach(([B,K])=>{if((K.type==="object"||K.type==="array")&&typeof $[B]=="string")try{$[B]=JSON.parse($[B])}catch{}});const E=await w.callTool({name:t,arguments:$}),L=E.structuredContent??E,H=performance.now(),Z=Math.round(H-_);x(L);const D=JSON.stringify(L),G=new TextEncoder().encode(D).length;y({duration:`${Z}ms`,bytes:`${G} bytes`,tokens:`~${Math.ceil(G/4)} tokens`,cost:"$0.0000"})}catch($){const E=$ instanceof Error?$.message:String($);h(E||"Unknown error occurred");const L=performance.now();y({duration:`${Math.round(L-_)}ms`})}finally{b(!1)}},A=(_,$)=>{d(E=>({...E,[_]:$}))},J=()=>{x(null),h(null),y(null)};return o.jsxs(Ee,{onBack:n,children:[o.jsx(Wt,{children:o.jsx(Pt,{title:I?.name??nr(t),url:i,icon:"build"})}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 h-full",children:[o.jsx("div",{className:"flex flex-col border-r border-border overflow-hidden",children:o.jsxs("div",{className:"flex-1 overflow-auto",children:[o.jsx("div",{className:"flex flex-col gap-4 p-6 border-b border-border min-h-28",children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Ye,{icon:v?.icon||null,name:v?.title||t,size:"sm",className:"shadow-sm shrink-0"}),o.jsx("h1",{className:"text-lg font-medium text-foreground leading-none",children:t}),o.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit",children:[k.isSuccess?o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):k.isLoading?o.jsx(ze,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),o.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:k.isSuccess?"ready":k.isLoading?"connecting":"error"})]})]}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:I?.description||"No description available"})]})}),o.jsxs("div",{className:"flex flex-col p-6 gap-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),I?.inputSchema?.required&&I.inputSchema.required.length>0&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[o.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),o.jsx("div",{className:"space-y-4",children:R&&I?.inputSchema?.properties?Object.entries(I.inputSchema.properties).map(([_,$])=>o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[_,I.inputSchema?.required?.includes(_)&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),o.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:$.type})]}),$.description&&o.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:$.description}),$.type==="object"||$.type==="array"?o.jsx(yt,{className:"font-mono text-xs",value:z(_)?a[_]??"":P[_]??"",onChange:E=>A(_,E.target.value),placeholder:`Enter ${_} as JSON...`,rows:3}):$.type==="boolean"?o.jsxs(In,{value:z(_)?String(a[_]??""):"",onValueChange:E=>A(_,E==="true"),children:[o.jsx(_n,{children:o.jsx(Tn,{placeholder:"Select true or false..."})}),o.jsxs($n,{children:[o.jsx(St,{value:"true",children:"true"}),o.jsx(St,{value:"false",children:"false"})]})]}):o.jsx(Dt,{value:z(_)?a[_]??"":P[_]??"",onChange:E=>A(_,E.target.value),placeholder:`Enter ${_}...`})]},_)):I?.inputSchema&&!R?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),o.jsx(yt,{className:"font-mono text-xs min-h-[120px]",value:u,onChange:_=>f(_.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):o.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})})]})]})}),o.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-t lg:border-t-0 border-b border-border bg-background",children:[o.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),j&&o.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(to,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:j.duration})]}),j.tokens&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(Fn,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:j.tokens})]}),j.bytes&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(qn,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:j.bytes})]}),j.cost&&o.jsx("div",{className:"flex items-center gap-1.5",children:o.jsx("span",{className:"font-mono text-foreground",children:j.cost})})]})]}),o.jsx("div",{className:"flex items-center justify-end lg:justify-between px-4 h-14 border-b border-border bg-background",children:o.jsxs("div",{className:"flex items-center gap-2 w-full lg:w-auto",children:[o.jsx(V,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:q,disabled:g,children:g?o.jsxs(o.Fragment,{children:[o.jsx(ze,{size:14,className:"animate-spin"}),"Executing..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Ht,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),o.jsx(ae,{children:o.jsxs(de,{children:[o.jsx(le,{asChild:!0,children:o.jsx(V,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:J,disabled:!m&&!p,children:o.jsx(Ft,{size:14})})}),o.jsx(ce,{children:o.jsx("p",{children:"Clear results"})})]})})]})}),p&&o.jsx("div",{className:"px-6 py-4 bg-background",children:o.jsx(Yo,{variant:"destructive",children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(eo,{className:"h-4 w-4"}),o.jsx(er,{className:"mb-0",children:"Execution Failed"})]}),o.jsx(tr,{className:"text-xs text-destructive",children:p})]})})}),o.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:m?o.jsxs(o.Fragment,{children:[o.jsx(Oe,{code:JSON.stringify(m,null,2),language:"json",height:"100%",readOnly:!0}),o.jsx(V,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(m,null,2)),gn.success("Copied to clipboard")},children:o.jsx(so,{className:"h-3.5 w-3.5"})})]}):o.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[o.jsx(no,{className:"h-12 w-12 mb-3 opacity-40"}),o.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})]})}function rr(t){const e=N.c(7),{itemId:n,onBack:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const l=oe(i).connectionId;if(!Vt(l)||!l){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[1]=u):u=e[1],u}let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(ze,{size:32,className:"animate-spin text-muted-foreground"})}),e[2]=a):a=e[2];let d;return e[3]!==l||e[4]!==s||e[5]!==n?(d=o.jsx(C.Suspense,{fallback:a,children:o.jsx(sr,{toolName:n,connectionId:l,onBack:s})}),e[3]=l,e[4]=s,e[5]=n,e[6]=d):d=e[6],d}const an=t=>{let e;const n=new Set,s=(d,u)=>{const f=typeof d=="function"?d(e):d;if(!Object.is(f,e)){const m=e;e=u??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(x=>x(e,m))}},i=()=>e,c={setState:s,getState:i,getInitialState:()=>a,subscribe:d=>(n.add(d),()=>n.delete(d))},a=e=t(s,i,c);return c},Xt=(t=>t?an(t):an),ir=t=>t;function wt(t,e=ir){const n=F.useSyncExternalStore(t.subscribe,F.useCallback(()=>e(t.getState()),[t,e]),F.useCallback(()=>e(t.getInitialState()),[t,e]));return F.useDebugValue(n),n}const lr=t=>{const e=Xt(t),n=s=>wt(e,s);return Object.assign(n,e),n},cr=(t=>lr);function Gn(t,e){let n;try{n=t()}catch{return}return{getItem:i=>{var r;const l=a=>a===null?null:JSON.parse(a,void 0),c=(r=n.getItem(i))!=null?r:null;return c instanceof Promise?c.then(l):l(c)},setItem:(i,r)=>n.setItem(i,JSON.stringify(r,void 0)),removeItem:i=>n.removeItem(i)}}const Nt=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return Nt(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return Nt(s)(n)}}}},ar=(t,e)=>(n,s,i)=>{let r={storage:Gn(()=>localStorage),partialize:g=>g,version:0,merge:(g,b)=>({...b,...g}),...e},l=!1,c=0;const a=new Set,d=new Set;let u=r.storage;if(!u)return t((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),n(...g)},s,i);const f=()=>{const g=r.partialize({...s()});return u.setItem(r.name,{state:g,version:r.version})},m=i.setState;i.setState=(g,b)=>(m(g,b),f());const x=t((...g)=>(n(...g),f()),s,i);i.getInitialState=()=>x;let p;const h=()=>{var g,b;if(!u)return;const j=++c;l=!1,a.forEach(S=>{var v;return S((v=s())!=null?v:x)});const y=((b=r.onRehydrateStorage)==null?void 0:b.call(r,(g=s())!=null?g:x))||void 0;return Nt(u.getItem.bind(u))(r.name).then(S=>{if(S)if(typeof S.version=="number"&&S.version!==r.version){if(r.migrate){const v=r.migrate(S.state,S.version);return v instanceof Promise?v.then(w=>[!0,w]):[!0,v]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,S.state];return[!1,void 0]}).then(S=>{var v;if(j!==c)return;const[w,k]=S;if(p=r.merge(k,(v=s())!=null?v:x),n(p,!0),w)return f()}).then(()=>{j===c&&(y?.(p,void 0),p=s(),l=!0,d.forEach(S=>S(p)))}).catch(S=>{j===c&&y?.(void 0,S)})};return i.persist={setOptions:g=>{r={...r,...g},g.storage&&(u=g.storage)},clearStorage:()=>{u?.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>h(),hasHydrated:()=>l,onHydrate:g=>(a.add(g),()=>{a.delete(g)}),onFinishHydration:g=>(d.add(g),()=>{d.delete(g)})},r.skipHydration||h(),p||x},Xn=ar,{useSyncExternalStoreWithSelector:dr}=zs,ur=t=>t;function fr(t,e=ur,n){const s=dr(t.subscribe,t.getState,t.getInitialState,e,n);return F.useDebugValue(s),s}const dn=t=>Symbol.iterator in t,un=t=>"entries"in t,fn=(t,e)=>{const n=t instanceof Map?t:new Map(t.entries()),s=e instanceof Map?e:new Map(e.entries());if(n.size!==s.size)return!1;for(const[i,r]of n)if(!s.has(i)||!Object.is(r,s.get(i)))return!1;return!0},mr=(t,e)=>{const n=t[Symbol.iterator](),s=e[Symbol.iterator]();let i=n.next(),r=s.next();for(;!i.done&&!r.done;){if(!Object.is(i.value,r.value))return!1;i=n.next(),r=s.next()}return!!i.done&&!!r.done};function pr(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e)?!1:dn(t)&&dn(e)?un(t)&&un(e)?fn(t,e):mr(t,e):fn({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function xr(t,e="Output"){if(!t)return`interface ${e} {}`;function n(r){if(!r||typeof r!="object")return"unknown";const l=r.type;if(Array.isArray(l))return l.map(c=>s(c)).join(" | ");switch(l){case"string":return r.enum?r.enum.map(c=>`"${c}"`).join(" | "):"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";case"array":{const c=r.items;return c?`${n(c)}[]`:"unknown[]"}case"object":return i(r);default:return r.anyOf?r.anyOf.map(n).join(" | "):r.oneOf?r.oneOf.map(n).join(" | "):r.allOf?r.allOf.map(n).join(" & "):"unknown"}}function s(r){switch(r){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";default:return"unknown"}}function i(r){const l=r.properties;if(!l)return"Record<string, unknown>";const c=new Set(r.required||[]);return`{
|
|
2
2
|
${Object.entries(l).map(([d,u])=>{const f=c.has(d)?"":"?";return`${u.description?` /** ${u.description} */
|
|
3
3
|
`:""} ${d}${f}: ${n(u)};`}).join(`
|
|
4
4
|
`)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as j,c as k,j as s}from"./index-
|
|
1
|
+
import{r as j,c as k,j as s}from"./index-BcdQIGUF.js";import{c as N,B as C}from"./button-BVfOTfpc.js";import{c as y,a as M,D as z,b as D}from"./dropdown-menu-COxc-l2r.js";import{i as S}from"./ArrowUp-BjUPYtOi.js";import{i as T}from"./Check-CeorNg_Q.js";import{c as E}from"./Grid01-C0Yt3TrW.js";import{i as V}from"./List-Tf6_FYvd.js";import{b as _,c as B,T as L,a as $}from"./tooltip-DDTkATYg.js";import{V as W}from"./view-mode-toggle-JXEPDzFm.js";const w=({size:r=24,color:e="currentColor",...o})=>j.createElement("svg",{viewBox:"0 0 24 24",width:r,height:r,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...o},j.createElement("path",{d:"M12 5v14m0 0 7-7m-7 7-7-7"}));w.displayName="ArrowDown";const b=({size:r=24,color:e="currentColor",...o})=>j.createElement("svg",{viewBox:"0 0 24 24",width:r,height:r,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...o},j.createElement("path",{d:"M5 21v-7m0-4V3m7 18v-9m0-4V3m7 18v-5m0-4V3M2 14h6m1-6h6m1 8h6"}));b.displayName="Sliders01";function H(r){const e=k.c(16),{viewMode:o,onViewModeChange:g,sortKey:v,sortDirection:n,onSort:l,sortOptions:a}=r;let c;e[0]!==a?(c=a===void 0?[]:a,e[0]=a,e[1]=c):c=e[1];const d=c;let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(_,{children:s.jsxs(B,{children:[s.jsx(L,{asChild:!0,children:s.jsx(M,{asChild:!0,children:s.jsx(C,{variant:"outline",size:"icon",className:"size-7 border border-input",children:s.jsx(b,{size:16})})})}),s.jsx($,{children:"Search filters"})]})}),e[2]=m):m=e[2];let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p={value:"table",icon:s.jsx(V,{})},e[3]=p):p=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=[p,{value:"cards",icon:s.jsx(E,{})}],e[4]=h):h=e[4];let t;e[5]!==g||e[6]!==o?(t=s.jsx("div",{className:"p-2 border-b border-border",children:s.jsx(W,{value:o,onValueChange:g,fullWidth:!0,options:h})}),e[5]=g,e[6]=o,e[7]=t):t=e[7];let i;e[8]!==l||e[9]!==n||e[10]!==v||e[11]!==d?(i=d.length>0&&l&&s.jsxs("div",{className:"p-1 flex flex-col gap-0.5",children:[s.jsx("div",{className:"px-2 py-1.5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Sort by"}),d.map(u=>{const f=v===u.id;return s.jsx(y,{onClick:()=>l(u.id),className:N("h-8 px-2 py-0 cursor-pointer",f&&"bg-accent"),children:s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[f&&s.jsx(T,{size:16,className:"text-foreground shrink-0"}),!f&&s.jsx("div",{className:"w-4 shrink-0"}),s.jsx("span",{className:"text-sm text-foreground flex-1",children:u.label}),f&&n&&(n==="asc"?s.jsx(S,{size:16,className:"text-foreground shrink-0"}):s.jsx(w,{size:16,className:"text-foreground shrink-0"}))]})},u.id)})]}),e[8]=l,e[9]=n,e[10]=v,e[11]=d,e[12]=i):i=e[12];let x;return e[13]!==t||e[14]!==i?(x=s.jsxs(z,{children:[m,s.jsxs(D,{align:"end",className:"w-[200px] p-0 gap-0",children:[t,i]})]}),e[13]=t,e[14]=i,e[15]=x):x=e[15],x}export{H as C,w as n};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as v,j as l}from"./index-
|
|
1
|
+
import{c as v,j as l}from"./index-BcdQIGUF.js";import{C as b}from"./collection-display-button-ChMvUn2E.js";function w(g){const e=v.c(20),{title:r,viewMode:n,onViewModeChange:c,sortKey:f,sortDirection:x,onSort:p,sortOptions:a,ctaButton:h,leftElement:u}=g;let m;e[0]!==a?(m=a===void 0?[]:a,e[0]=a,e[1]=m):m=e[1];const j=m;let t;e[2]!==r?(t=typeof r=="string"?l.jsx("h1",{className:"text-sm font-medium text-foreground",children:r}):r,e[2]=r,e[3]=t):t=e[3];let s;e[4]!==u||e[5]!==t?(s=l.jsxs("div",{className:"flex items-center gap-2",children:[u,t]}),e[4]=u,e[5]=t,e[6]=s):s=e[6];let i;e[7]!==p||e[8]!==c||e[9]!==x||e[10]!==f||e[11]!==j||e[12]!==n?(i=n&&c&&l.jsx(b,{viewMode:n,onViewModeChange:c,sortKey:f,sortDirection:x,onSort:p,sortOptions:j}),e[7]=p,e[8]=c,e[9]=x,e[10]=f,e[11]=j,e[12]=n,e[13]=i):i=e[13];let o;e[14]!==h||e[15]!==i?(o=l.jsxs("div",{className:"flex items-center gap-2",children:[i,h]}),e[14]=h,e[15]=i,e[16]=o):o=e[16];let d;return e[17]!==s||e[18]!==o?(d=l.jsx("div",{className:"shrink-0 w-full border-b border-border h-12",children:l.jsxs("div",{className:"flex items-center justify-between gap-3 h-12 px-4",children:[s,o]})}),e[17]=s,e[18]=o,e[19]=d):d=e[19],d}export{w as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as s,j as c}from"./index-
|
|
1
|
+
import{c as s,j as c}from"./index-BcdQIGUF.js";function r(t){const e=s.c(2),{children:l}=t;let o;return e[0]!==l?(o=c.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden",children:l}),e[0]=l,e[1]=o):o=e[1],o}export{r as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as v,j as i}from"./index-
|
|
1
|
+
import{c as v,j as i}from"./index-BcdQIGUF.js";import{i as w}from"./Loading01-D7Nk5rBn.js";import{i as C}from"./SearchMd-XlpqEN-D.js";import{I as k}from"./input-CUCPZMz2.js";import{c as b}from"./button-BVfOTfpc.js";function R(j){const e=v.c(21),{value:m,onChange:d,placeholder:g,onKeyDown:f,className:p,isSearching:u,disabled:n}=j,x=g===void 0?"Search...":g;let t;e[0]!==p?(t=b("shrink-0 w-full border-b border-border h-12",p),e[0]=p,e[1]=t):t=e[1];const h=n?"cursor-not-allowed opacity-50":"cursor-text";let s;e[2]!==h?(s=b("flex items-center gap-2.5 h-12 px-4",h),e[2]=h,e[3]=s):s=e[3];let r;e[4]!==u?(r=u?i.jsx(w,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):i.jsx(C,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=u,e[5]=r):r=e[5];let o;e[6]!==d?(o=N=>d(N.target.value),e[6]=d,e[7]=o):o=e[7];let l;e[8]!==n||e[9]!==f||e[10]!==x||e[11]!==o||e[12]!==m?(l=i.jsx(k,{value:m,onChange:o,onKeyDown:f,placeholder:x,disabled:n,className:"flex-1 border-0 shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[8]=n,e[9]=f,e[10]=x,e[11]=o,e[12]=m,e[13]=l):l=e[13];let a;e[14]!==s||e[15]!==r||e[16]!==l?(a=i.jsxs("label",{className:s,children:[r,l]}),e[14]=s,e[15]=r,e[16]=l,e[17]=a):a=e[17];let c;return e[18]!==t||e[19]!==a?(c=i.jsx("div",{className:t,children:a}),e[18]=t,e[19]=a,e[20]=c):c=e[20],c}export{R as C};
|