@decocms/mesh 2.72.0 → 2.72.1
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-CHm1uTvc.js → AlertCircle-BOIQEKjW.js} +1 -1
- package/dist/client/assets/{ArrowUp-CsvTcSKO.js → ArrowUp-BRclUYsx.js} +1 -1
- package/dist/client/assets/{Calendar-RaRlGUMn.js → Calendar-DydX5uRn.js} +1 -1
- package/dist/client/assets/{Check-CTaDpFbx.js → Check-Bkb61eVw.js} +1 -1
- package/dist/client/assets/{CheckCircle-BUL08lD-.js → CheckCircle-ZkjIkaWv.js} +1 -1
- package/dist/client/assets/{CheckDone01-C9iBTpWu.js → CheckDone01-BusS8ANA.js} +1 -1
- package/dist/client/assets/{ChevronDown-BmbIYWgz.js → ChevronDown-DqJTvBdv.js} +1 -1
- package/dist/client/assets/{ChevronRight-C7PRdwhN.js → ChevronRight-BBcOJkyP.js} +1 -1
- package/dist/client/assets/{Code01-BHb1dfFm.js → Code01-DEMYMNLO.js} +1 -1
- package/dist/client/assets/{Copy01-BHrubS15.js → Copy01-BvgMlJ5t.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-BKEGXeRq.js → DotsHorizontal-C3Pu-YCA.js} +1 -1
- package/dist/client/assets/{DotsVertical-6bV4Jb02.js → DotsVertical-DMOP2SMU.js} +1 -1
- package/dist/client/assets/{Download01-DCCcXkST.js → Download01-VwSgop8U.js} +1 -1
- package/dist/client/assets/{Edit01-Ck6L4sn5.js → Edit01-ByF-cYbh.js} +1 -1
- package/dist/client/assets/{File02-Bdk2SiT1.js → File02-D6OcKUS4.js} +1 -1
- package/dist/client/assets/{File06-g3-IRgq5.js → File06-CkTcogsG.js} +1 -1
- package/dist/client/assets/{FilterLines-CZJIfYWV.js → FilterLines-BL17m8OO.js} +1 -1
- package/dist/client/assets/{Globe02-nY9R9qg_.js → Globe02-CwdZK2H5.js} +1 -1
- package/dist/client/assets/{Grid01-CzUkHZSJ.js → Grid01-zbmmdox0.js} +1 -1
- package/dist/client/assets/{Home02-D9mVq7KP.js → Home02-DPzckV1r.js} +1 -1
- package/dist/client/assets/{Image01-C213KIPf.js → Image01-BuXlAy8i.js} +1 -1
- package/dist/client/assets/{Inbox01-CXr_wpYC.js → Inbox01-Czow08Bp.js} +1 -1
- package/dist/client/assets/{InfoCircle-DEUMb_Ke.js → InfoCircle-C8GtqndP.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CmQ2HPM6.js → LinkExternal01-DJasjN8P.js} +1 -1
- package/dist/client/assets/{List-hntTIiNx.js → List-BvAv-Mbv.js} +1 -1
- package/dist/client/assets/{Loading01-B78uc8_j.js → Loading01-DOPFYU4m.js} +1 -1
- package/dist/client/assets/{Lock01-rY0GklCm.js → Lock01-BALKEl0l.js} +1 -1
- package/dist/client/assets/{Pin01-B6bFgA7L.js → Pin01-Dk_x7uai.js} +1 -1
- package/dist/client/assets/{Play-CMxteKat.js → Play-CjfPPVn_.js} +1 -1
- package/dist/client/assets/{Plus-B1DSIk_Y.js → Plus-WaQ7hmj5.js} +1 -1
- package/dist/client/assets/{SearchMd-rxhL9uWW.js → SearchMd-Ds-ERWzq.js} +1 -1
- package/dist/client/assets/{Settings01-BBpmfPia.js → Settings01-CMNXJNnf.js} +1 -1
- package/dist/client/assets/{Share07-DNr4Gv0F.js → Share07-w2-wABEW.js} +1 -1
- package/dist/client/assets/{Terminal-CvqFIFfF.js → Terminal-CrrxpXUI.js} +1 -1
- package/dist/client/assets/{Tool01-BWEJZQCA.js → Tool01-Cn8FHCpZ.js} +1 -1
- package/dist/client/assets/{Trash01-CNJdNb2Z.js → Trash01-C-euKa34.js} +1 -1
- package/dist/client/assets/{Upload01-CtypJgSZ.js → Upload01-Dc0hOrKX.js} +1 -1
- package/dist/client/assets/{Users03-B_SbeQBk.js → Users03-zsvZ9QWQ.js} +1 -1
- package/dist/client/assets/{X-mZzFkOTX.js → X-DUGfq2_H.js} +1 -1
- package/dist/client/assets/{XClose-BwAC8sFB.js → XClose-Cv_qbaYN.js} +1 -1
- package/dist/client/assets/{agent-connections-preview-DieWCUjN.js → agent-connections-preview-C15fpCN8.js} +1 -1
- package/dist/client/assets/{agent-detail-CViIjBwu.js → agent-detail-BQXrWX9M.js} +1 -1
- package/dist/client/assets/{agents-CyHP3pcb.js → agents-NgYS-NWl.js} +1 -1
- package/dist/client/assets/{alert-dialog-BN06wH-l.js → alert-dialog-B4H6MrIT.js} +1 -1
- package/dist/client/assets/{auth-catchall-DXrXBOXl.js → auth-catchall-GUc2KujY.js} +1 -1
- package/dist/client/assets/{avatar-2G5ouaDu.js → avatar-B-AS-16N.js} +1 -1
- package/dist/client/assets/{badge-tOUVTd9z.js → badge-BFm6jM0d.js} +1 -1
- package/dist/client/assets/{binder-CbgCr5Rm.js → binder-C4CQlgMb.js} +1 -1
- package/dist/client/assets/{breadcrumb-JfdGMaRd.js → breadcrumb-Cvo4WJJ5.js} +1 -1
- package/dist/client/assets/{button-BKtq_PYU.js → button-Cl3WMTWk.js} +1 -1
- package/dist/client/assets/{card-C0u1Pmkw.js → card-B-73zAje.js} +1 -1
- package/dist/client/assets/{checkbox-DmCTNQLX.js → checkbox-kN_xGJfO.js} +1 -1
- package/dist/client/assets/{circle-alert-BNmG-8Wh.js → circle-alert-BEtzK3t3.js} +1 -1
- package/dist/client/assets/{collection-detail-CGH1Knd0.js → collection-detail-C9AV2Fn9.js} +1 -1
- package/dist/client/assets/{collection-search-MQc1JOFA.js → collection-search-Aeh0FXZR.js} +1 -1
- package/dist/client/assets/{collection-tab-qHWWI3bH.js → collection-tab-CgMRLj1Y.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-L4Z0dyO1.js → collection-table-wrapper-CmBNNf0K.js} +1 -1
- package/dist/client/assets/{collection-tabs-CyRXUdkR.js → collection-tabs-2AUf3kZ2.js} +1 -1
- package/dist/client/assets/{command-Bqwb_7NQ.js → command-DICG2vo0.js} +1 -1
- package/dist/client/assets/{connect-D30M34Bx.js → connect-DoxLTvbh.js} +1 -1
- package/dist/client/assets/{connection-card-CMQL70VR.js → connection-card-ChzuU2dT.js} +1 -1
- package/dist/client/assets/connection-detail-CVNpoyUm.js +1 -0
- package/dist/client/assets/{connections-B7K4OdQw.js → connections-BHOwcUB0.js} +1 -1
- package/dist/client/assets/{constants-PBHJ4h9F.js → constants-1q3hobyw.js} +1 -1
- package/dist/client/assets/constants-DzWq-50V.js +1 -0
- package/dist/client/assets/{create-organization-dialog-BOgbyqMq.js → create-organization-dialog-DWV2eGAF.js} +1 -1
- package/dist/client/assets/{create-project-dialog-BxxiVX3V.js → create-project-dialog-49RtElmv.js} +1 -1
- package/dist/client/assets/{dialog-B8Jtq_Yp.js → dialog-BmGDp4UV.js} +1 -1
- package/dist/client/assets/{dropdown-menu-C6Z4raJE.js → dropdown-menu-6IaHSzwJ.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-CDgkhjuC.js → dynamic-plugin-layout-C_HHJRk0.js} +1 -1
- package/dist/client/assets/{empty-state-BXisfxVt.js → empty-state-DFIrBrC-.js} +1 -1
- package/dist/client/assets/{empty-state-B8XrD0Ub.js → empty-state-oU8PNga_.js} +1 -1
- package/dist/client/assets/{env-vars-editor-8a4L674b.js → env-vars-editor-Bmnp2cvo.js} +1 -1
- package/dist/client/assets/{error-boundary-D9qG4zZt.js → error-boundary-D7C5xzme.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CCyj_Y1X.js → extract-connection-data-CQQ4ZZEG.js} +1 -1
- package/dist/client/assets/{file-browser-DInIgvl2.js → file-browser-CHtfSNHu.js} +2 -2
- package/dist/client/assets/{form-DQap4sDh.js → form-qYB4UriD.js} +1 -1
- package/dist/client/assets/{grid-view-BKnSWUuB.js → grid-view-B4Eut3Xi.js} +1 -1
- package/dist/client/assets/{home-DvvANWHB.js → home-BYm3DFU4.js} +1 -1
- package/dist/client/assets/index--g69ISoA.css +1 -0
- package/dist/client/assets/{index-sFvIWgLs.js → index-5T3tdhiA.js} +1 -1
- package/dist/client/assets/{index-D5w8F0R7.js → index-9vOB29ZB.js} +1 -1
- package/dist/client/assets/{index-UwBLOz8J.js → index-BA6gcyzW.js} +1 -1
- package/dist/client/assets/{index-CCcWAtA_.js → index-BV-rIyOx.js} +2 -2
- package/dist/client/assets/{index-BMXxQz0A.js → index-BYzsWn1B.js} +1 -1
- package/dist/client/assets/{index-D12lWWsR.js → index-CxyQJKsK.js} +1 -1
- package/dist/client/assets/{index--tmJoUux.js → index-Dolyg0HI.js} +1 -1
- package/dist/client/assets/{index-C76QOf8q.js → index-Vp0uDDij.js} +1 -1
- package/dist/client/assets/{index-DFZdUy6e.js → index-fCCl5Un_.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-BdhSYRBe.js → infiniteQueryObserver-CrYps4St.js} +1 -1
- package/dist/client/assets/{input-Dh6Cjukb.js → input-Dv5qvD5N.js} +1 -1
- package/dist/client/assets/{integration-icon-Biu6JpM0.js → integration-icon-DKM9NBX1.js} +1 -1
- package/dist/client/assets/{layout-DWXfRazY.js → layout-B7afTuaN.js} +1 -1
- package/dist/client/assets/{localstorage-keys-BWsOCDUX.js → localstorage-keys-Ds2uOTRP.js} +1 -1
- package/dist/client/assets/{login-DoPkmmdP.js → login-BpnfmGBt.js} +1 -1
- package/dist/client/assets/{mcp-oauth-BQMyy4a5.js → mcp-oauth-C_XpjqFg.js} +1 -1
- package/dist/client/assets/{mcp-server-card-DxnHyWDy.js → mcp-server-card-CiGvO9aP.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-BzBDrjZ5.js → mcp-server-detail-SQfpDpYc.js} +2 -2
- package/dist/client/assets/{members-pjR_l8r-.js → members-CQSBREQS.js} +1 -1
- package/dist/client/assets/{monaco-editor-XyXN2SEV.js → monaco-editor-q53ZLBJ5.js} +1 -1
- package/dist/client/assets/{monitoring-BiXkhP0l.js → monitoring-CK4xcQzM.js} +1 -1
- package/dist/client/assets/{oauth-callback-COK_3Woz.js → oauth-callback-CeLfnx5m.js} +1 -1
- package/dist/client/assets/{page-zhioOXqc.js → page-CrfNBuC7.js} +1 -1
- package/dist/client/assets/{page-Ca4TsO7U.js → page-jzi-88Nr.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-BWDzgwMT.js → plugin-empty-state-Bnssy2Oj.js} +1 -1
- package/dist/client/assets/{plugin-header-Dm-T5OvY.js → plugin-header-DoQQAOys.js} +1 -1
- package/dist/client/assets/{popover-Bn1QrYWJ.js → popover-DuZ2ZN5J.js} +1 -1
- package/dist/client/assets/{project-layout-DQQxPJ7M.js → project-layout-CH4wXxX2.js} +1 -1
- package/dist/client/assets/{project-settings-Bq572DKS.js → project-settings-CKgnjrBp.js} +1 -1
- package/dist/client/assets/{projects-list-D2y67tOl.js → projects-list-D0sSao6e.js} +1 -1
- package/dist/client/assets/{registry-utils-eTnhYK1Z.js → registry-utils-CqOx6XXE.js} +1 -1
- package/dist/client/assets/{resizable-Cth4qfOJ.js → resizable-CZuYHBhW.js} +1 -1
- package/dist/client/assets/{select-CJ01X7RE.js → select-ODRW9YrY.js} +1 -1
- package/dist/client/assets/{shell-layout-Dmklwlc_.js → shell-layout-BxNK1bDI.js} +1 -1
- package/dist/client/assets/{spinner-CoIaSc2j.js → spinner-BPZfVVyD.js} +1 -1
- package/dist/client/assets/{store-invite-CM-bUgIj.js → store-invite-ICTVmn8_.js} +1 -1
- package/dist/client/assets/{switch-TZYuSAHJ.js → switch-B-1QAIh-.js} +1 -1
- package/dist/client/assets/{table-B7Ue2bk2.js → table-BBnlXDKe.js} +1 -1
- package/dist/client/assets/{tasks-DvdoE4Ok.js → tasks-CpdqRpYU.js} +1 -1
- package/dist/client/assets/{textarea-D6y1LKj_.js → textarea-DK_SwVx9.js} +1 -1
- package/dist/client/assets/{tools-list-fxJEZlSp.js → tools-list-B5iaOgKy.js} +1 -1
- package/dist/client/assets/{typewriter-title-DR6tdNBL.js → typewriter-title-C_OsyMAQ.js} +1 -1
- package/dist/client/assets/{use-binding-ucSDtQ56.js → use-binding-BVOuBiur.js} +1 -1
- package/dist/client/assets/{use-connection-BCPygOxC.js → use-connection-B8DnjeO8.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-u-AAtHmy.js → use-create-virtual-mcp-7fubOknm.js} +1 -1
- package/dist/client/assets/use-deco-chat-open-cMRvRYVG.js +23 -0
- package/dist/client/assets/{use-install-from-registry-f8JxKFFW.js → use-install-from-registry-ClVbT6BY.js} +1 -1
- package/dist/client/assets/{use-list-state-oNgAMbdK.js → use-list-state-DjV5kR97.js} +1 -1
- package/dist/client/assets/{use-llm-Lxpo1ior.js → use-llm-H-K3anTg.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-WwyO9-Nk.js → use-mcp-prompts-Chz_2-6S.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-eSLltC3i.js → use-mcp-tools-CXMetymP.js} +1 -1
- package/dist/client/assets/{use-mobile-BUK8Wer1.js → use-mobile-B2CDnK8i.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BR3GSp3x.js → use-organization-settings-Bu92wRjl.js} +1 -1
- package/dist/client/assets/{use-project-DLsFLh3O.js → use-project-CzroiUzj.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-ByfXJ3SB.js → use-virtual-mcp-ayu_K6US.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-TqDHdib1.js +1 -0
- package/dist/client/assets/{useMutation-Cn2d2ilG.js → useMutation-BOrtlNTb.js} +1 -1
- package/dist/client/assets/useQuery-DDYln2BW.js +1 -0
- package/dist/client/assets/utils-CfR4kXxZ.js +1 -0
- package/dist/client/assets/{view-mode-toggle-BJkt6e92.js → view-mode-toggle-CHHKGadJ.js} +1 -1
- package/dist/client/assets/{workflow-BP45xRRH.js → workflow-BBKpGvON.js} +1 -1
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/dist/client/assets/connection-detail-CQNN_rRv.js +0 -1
- package/dist/client/assets/constants-DIAAKB_c.js +0 -1
- package/dist/client/assets/index-CP_rYaE5.css +0 -1
- package/dist/client/assets/use-deco-chat-open-DsNk3kZu.js +0 -23
- package/dist/client/assets/useInfiniteQuery-BcqgMbS1.js +0 -1
- package/dist/client/assets/useQuery-Dp4Sp9Q1.js +0 -1
- package/dist/client/assets/utils-CnoQZeDK.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as T,c as j,j as l,T as z,w as E,R as H,x as L,B as D,y as V,D as I}from"./index-
|
|
1
|
+
import{r as T,c as j,j as l,T as z,w as E,R as H,x as L,B as D,y as V,D as I}from"./index-BV-rIyOx.js";import{I as R}from"./input-Dv5qvD5N.js";import{i as A}from"./X-DUGfq2_H.js";import{c as b}from"./utils-CfR4kXxZ.js";import{i as M}from"./SearchMd-Ds-ERWzq.js";const O=({size:n=24,color:e="currentColor",...t})=>T.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},T.createElement("path",{d:"m22.7 13.5-2-2-2 2M21 12a9 9 0 1 1-1.245-4.57M12 7v5l3 2"}));O.displayName="ClockRewind";const B=({size:n=24,color:e="currentColor",...t})=>T.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},T.createElement("path",{d:"m10 15-3.075 3.114c-.43.434-.644.651-.828.666a.5.5 0 0 1-.421-.172c-.12-.14-.12-.446-.12-1.056v-1.56c0-.548-.449-.944-.99-1.024v0a3 3 0 0 1-2.534-2.533C2 12.219 2 11.96 2 11.445V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 2 5.12 2 6.8 2h7.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C19 4.28 19 5.12 19 6.8V11m0 11-2.176-1.513c-.306-.213-.46-.32-.626-.395a2.002 2.002 0 0 0-.462-.145c-.18-.033-.367-.033-.74-.033H13.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C10 18.394 10 17.834 10 16.714V14.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C11.52 11 12.08 11 13.2 11h5.6c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C22 12.52 22 13.08 22 14.2v2.714c0 .932 0 1.398-.152 1.766a2 2 0 0 1-1.083 1.082c-.367.152-.833.152-1.765.152V22Z"}));B.displayName="MessageChatSquare";function W(n){const e=j.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let s;return e[2]!==t?(s=l.jsx(H,{"data-slot":"sheet",...t}),e[2]=t,e[3]=s):s=e[3],s}function P(n){const e=j.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let s;return e[2]!==t?(s=l.jsx(L,{"data-slot":"sheet-portal",...t}),e[2]=t,e[3]=s):s=e[3],s}function Q(n){const e=j.c(8);let t,s;e[0]!==n?({className:t,...s}=n,e[0]=n,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=b("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=l.jsx(V,{"data-slot":"sheet-overlay",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function q(n){const e=j.c(17);let t,s,a,o;e[0]!==n?({className:s,children:t,side:o,...a}=n,e[0]=n,e[1]=t,e[2]=s,e[3]=a,e[4]=o):(t=e[1],s=e[2],a=e[3],o=e[4]);const c=o===void 0?"right":o;let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=l.jsx(Q,{}),e[5]=h):h=e[5];const d=c==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",i=c==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",r=c==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",v=c==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t";let m;e[6]!==s||e[7]!==d||e[8]!==i||e[9]!==r||e[10]!==v?(m=b("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",d,i,r,v,s),e[6]=s,e[7]=d,e[8]=i,e[9]=r,e[10]=v,e[11]=m):m=e[11];let u;e[12]===Symbol.for("react.memo_cache_sentinel")?(u=l.jsxs(D,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[l.jsx(A,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]}),e[12]=u):u=e[12];let f;return e[13]!==t||e[14]!==a||e[15]!==m?(f=l.jsxs(P,{children:[h,l.jsxs(E,{"data-slot":"sheet-content",className:m,...a,children:[t,u]})]}),e[13]=t,e[14]=a,e[15]=m,e[16]=f):f=e[16],f}function F(n){const e=j.c(8);let t,s;e[0]!==n?({className:t,...s}=n,e[0]=n,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=b("flex flex-col gap-1.5 p-4",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=l.jsx("div",{"data-slot":"sheet-header",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function Z(n){const e=j.c(8);let t,s;e[0]!==n?({className:t,...s}=n,e[0]=n,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=b("text-foreground font-semibold",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=l.jsx(z,{"data-slot":"sheet-title",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function Y(n){const e=j.c(8);let t,s;e[0]!==n?({className:t,...s}=n,e[0]=n,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=b("text-muted-foreground text-sm",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=l.jsx(I,{"data-slot":"sheet-description",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function _(n){const e=j.c(24),{threads:t,activeThreadId:s,onThreadSelect:a,onClose:o,showHeader:c,showBackButton:h}=n,d=c===void 0?!0:c,i=h===void 0?!1:h,[r,v]=T.useState("");let m;e[0]!==r||e[1]!==t?(m=r.trim()?t.filter(p=>(p.title||"New chat").toLowerCase().includes(r.toLowerCase())):t,e[0]=r,e[1]=t,e[2]=m):m=e[2];const u=m;let f;e[3]!==o||e[4]!==a?(f=p=>{a(p),o&&o()},e[3]=o,e[4]=a,e[5]=f):f=e[5];const k=f;let y;e[6]!==o||e[7]!==i||e[8]!==d?(y=d&&l.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b shrink-0",children:[l.jsx("span",{className:"text-sm font-medium",children:"Chat History"}),i&&l.jsx("button",{type:"button",onClick:o,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Back to chat"})]}),e[6]=o,e[7]=i,e[8]=d,e[9]=y):y=e[9];let C;e[10]===Symbol.for("react.memo_cache_sentinel")?(C=b("px-3 py-3 border-b","shrink-0"),e[10]=C):C=e[10];let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S=l.jsx(M,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e[11]=S):S=e[11];let g;e[12]===Symbol.for("react.memo_cache_sentinel")?(g=p=>v(p.target.value),e[12]=g):g=e[12];let x;e[13]!==r?(x=l.jsx("div",{className:C,children:l.jsxs("div",{className:"relative",children:[S,l.jsx(R,{type:"text",placeholder:"Search conversations...",value:r,onChange:g,className:"pl-9 h-9 text-sm"})]})}),e[13]=r,e[14]=x):x=e[14];let w;e[15]!==s||e[16]!==u||e[17]!==k||e[18]!==r?(w=l.jsx("div",{className:"flex-1 overflow-y-auto",children:u.length===0?l.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-12 px-4 text-center",children:[l.jsx("div",{className:"size-12 rounded-full bg-muted/50 flex items-center justify-center",children:l.jsx(B,{size:24,className:"text-muted-foreground"})}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:r?"No results found":"No conversations yet"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:r?"Try a different search term":"Start a new chat to see your history here"})]})]}):l.jsx("div",{className:"flex flex-col py-2",children:u.map(p=>{const $=p.id===s;return l.jsx("button",{type:"button",onClick:()=>k(p.id),className:b("flex items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-accent/50",$&&"bg-accent/50"),children:l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:b("text-sm truncate",$?"font-medium text-foreground":"text-muted-foreground"),children:p.title||"New chat"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:new Date(p.updatedAt).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]})},p.id)})})}),e[15]=s,e[16]=u,e[17]=k,e[18]=r,e[19]=w):w=e[19];let N;return e[20]!==w||e[21]!==y||e[22]!==x?(N=l.jsxs(l.Fragment,{children:[y,x,w]}),e[20]=w,e[21]=y,e[22]=x,e[23]=N):N=e[23],N}function ee(n){const e=j.c(9),{open:t,onOpenChange:s,threads:a,activeThreadId:o,onThreadSelect:c}=n;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=l.jsx(F,{className:"h-12 px-4 flex flex-row items-center justify-between border-b shrink-0",children:l.jsx(Z,{className:"text-sm font-medium",children:"Chat History"})}),e[0]=h):h=e[0];let d;e[1]!==o||e[2]!==c||e[3]!==a?(d=l.jsxs(q,{side:"right",className:"w-[320px] sm:w-[380px] p-0 flex flex-col",children:[h,l.jsx(_,{threads:a,activeThreadId:o,onThreadSelect:c,showHeader:!1})]}),e[1]=o,e[2]=c,e[3]=a,e[4]=d):d=e[4];let i;return e[5]!==s||e[6]!==t||e[7]!==d?(i=l.jsx(W,{open:t,onOpenChange:s,children:d}),e[5]=s,e[6]=t,e[7]=d,e[8]=i):i=e[8],i}function te(n){const e=j.c(5),{threads:t,activeThreadId:s,onThreadSelect:a,onClose:o}=n;let c;return e[0]!==s||e[1]!==o||e[2]!==a||e[3]!==t?(c=l.jsx("div",{className:"flex flex-col h-full w-full bg-background",children:l.jsx(_,{threads:t,activeThreadId:s,onThreadSelect:a,onClose:o,showBackButton:!0})}),e[0]=s,e[1]=o,e[2]=a,e[3]=t,e[4]=c):c=e[4],c}function se(n){const e=j.c(22),{text:t,className:s,speed:a}=n,o=s===void 0?"":s,c=a===void 0?30:a,[h,d]=T.useState(!1),i=t.length/c*1e3,r=t.length,v=`${t.length}ch`;let m;e[0]!==i?(m=()=>{d(!1);const p=setTimeout(()=>{d(!0)},i);return()=>clearTimeout(p)},e[0]=i,e[1]=m):m=e[1];let u;e[2]!==i||e[3]!==t?(u=[t,i],e[2]=i,e[3]=t,e[4]=u):u=e[4],T.useEffect(m,u);let f;e[5]!==o?(f=b(o,"block overflow-hidden inline-flex"),e[5]=o,e[6]=f):f=e[6];const k=`${i}ms`;let y;e[7]!==v||e[8]!==r||e[9]!==k?(y={"--typewriter-duration":k,"--typewriter-steps":r,"--typewriter-max-width":v},e[7]=v,e[8]=r,e[9]=k,e[10]=y):y=e[10];const C=y,S=h&&"truncate";let g;e[11]!==S?(g=b("typewriter-text",S),e[11]=S,e[12]=g):g=e[12];let x;e[13]!==g||e[14]!==t?(x=l.jsx("span",{className:g,children:t}),e[13]=g,e[14]=t,e[15]=x):x=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=l.jsx("style",{children:`
|
|
2
2
|
.typewriter-text {
|
|
3
3
|
display: inline-block;
|
|
4
4
|
width: 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as v}from"./binder-CbgCr5Rm.js";import{b9 as T,G as O,o as t,s as e,ba as p,ae as l,bb as c,bc as R,bd as U,be as i,af as x,bf as u,bg as g,bh as n,bi as b,bj as L,bk as B,bl as C}from"./index-CCcWAtA_.js";const W=O.extend({avatar:e().describe("URL or data URI to the assistant's avatar image"),system_prompt:e().describe("System prompt that defines the assistant's behavior"),virtual_mcp_id:e().describe("Virtual MCP ID to use for this assistant"),model:t({id:e().describe("Model ID"),connectionId:e().describe("Connection ID that provides the model")}).describe("Selected model reference for this assistant")}),F=T("assistant",W),G=[...F],w=L(()=>u([B(),e(),i(),g(),p(e(),w),l(w)])),f=p(e(),p(e(),w)).optional().describe("Additional provider-specific options. Outer record keyed by provider name, inner by option key"),E=t({type:n("text"),text:e().describe("The text content"),providerOptions:f}),q=t({type:n("text"),text:e().describe("The text content"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),j=e().describe("File data as URL string"),k=t({type:n("file"),filename:e().optional().describe("Optional filename of the file"),data:j,mediaType:e().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),providerOptions:f}),$=t({type:n("file"),mediaType:e().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),data:e().describe("Generated file data as base64 encoded string")}),J=t({type:n("reasoning"),text:e().describe("The reasoning text"),providerOptions:f}),K=t({type:n("reasoning"),text:e().describe("The reasoning text"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),V=t({type:n("tool-call"),toolCallId:e().describe("ID of the tool call, used to match with tool result"),toolName:e().describe("Name of the tool being called"),input:e().describe("Arguments of the tool call (JSON-serializable object matching tool input schema)"),providerExecuted:g().optional().describe("Whether the tool call will be executed by the provider"),providerOptions:f}),z=t({type:n("tool-call"),toolCallId:e().describe("ID of the tool call"),toolName:e().describe("Name of the tool being called"),input:e().describe("Stringified JSON object with the tool call arguments"),providerExecuted:g().optional().describe("Whether the tool call will be executed by the provider"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),H=u([t({type:n("text"),value:e()}),t({type:n("json"),value:w}),t({type:n("error-text"),value:e()}),t({type:n("error-json"),value:w}),t({type:n("content"),value:l(u([t({type:n("text"),text:e().describe("Text content")}),t({type:n("media"),data:e().describe("Base-64 encoded media data"),mediaType:e().describe("IANA media type")})]))})]),A=t({type:n("tool-result"),toolCallId:e().describe("ID of the tool call that this result is associated with"),toolName:e().describe("Name of the tool that generated this result"),output:H.describe("Result of the tool call"),result:b().describe("Unknown result of the tool call"),providerOptions:f}),X=t({type:n("tool-result"),toolCallId:e().describe("ID of the tool call that this result is associated with"),toolName:e().describe("Name of the tool that generated this result"),result:c().describe("Result of the tool call (JSON-serializable)"),isError:g().optional().describe("Whether the result is an error or error message"),providerExecuted:g().optional().describe("Whether the tool result was generated by the provider"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),Y=u([t({type:n("source"),sourceType:n("url"),id:e().describe("The ID of the source"),url:e().describe("The URL of the source"),title:e().optional().describe("The title of the source"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),t({type:n("source"),sourceType:n("document"),id:e().describe("The ID of the source"),mediaType:e().describe("IANA media type of the document (e.g., application/pdf)"),title:e().describe("The title of the document"),filename:e().optional().describe("Optional filename of the document"),providerMetadata:c().optional().describe("Additional provider-specific metadata")})]),Z=t({role:n("system"),content:e().describe("System message content"),providerOptions:f}),Q=t({role:n("user"),content:l(u([E,k])).describe("User message content parts (text or file)"),providerOptions:f}),ee=t({role:n("assistant"),content:l(u([E,k,J,V,A])).describe("Assistant message content parts (text, file, reasoning, tool-call, or tool-result)"),providerOptions:f}),te=t({role:n("tool"),content:l(A).describe("Tool message content (tool results)"),providerOptions:f}),oe=u([Z,Q,ee,te]),ae=l(oe).describe("A list of messages forming the prompt"),ie=t({prompt:ae.describe("A language model prompt is a standardized prompt type (array of messages with roles: system, user, assistant, tool)"),maxOutputTokens:i().optional().describe("Maximum number of tokens to generate"),temperature:i().optional().describe("Temperature setting. The range depends on the provider and model"),topP:i().optional().describe("Nucleus sampling parameter"),topK:i().optional().describe("Only sample from the top K options for each subsequent token. Used to remove long tail low probability responses"),presencePenalty:i().optional().describe("Presence penalty setting. It affects the likelihood of the model to repeat information that is already in the prompt"),frequencyPenalty:i().optional().describe("Frequency penalty setting. It affects the likelihood of the model to repeatedly use the same words or phrases"),seed:i().optional().describe("The seed (integer) to use for random sampling. If set and supported by the model, calls will generate deterministic results"),stopSequences:l(e()).optional().describe("Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated"),responseFormat:u([t({type:n("text")}),t({type:n("json"),schema:c().optional().describe("JSON schema that the generated output should conform to"),name:e().optional().describe("Name of output that should be generated"),description:e().optional().describe("Description of the output that should be generated")})]).optional().describe("Response format. The output can either be text or JSON. Default is text"),tools:l(c()).optional().describe("The tools that are available for the model"),toolChoice:c().optional().describe("Specifies how the tool should be selected. Defaults to 'auto'"),includeRawChunks:g().optional().describe("Include raw chunks in the stream. Only applicable for streaming calls"),abortSignal:c().optional().describe("Abort signal for cancelling the operation"),providerOptions:c().optional().describe("Additional provider-specific options")}),ne=t({content:l(u([q,$,K,z,X,Y])).describe("Ordered content that the model has generated (text, tool-calls, reasoning, files, sources)"),finishReason:x(["stop","length","content-filter","tool-calls","error","other","unknown"]).describe("Reason why generation stopped"),usage:U({inputTokens:i().optional(),outputTokens:i().optional(),totalTokens:i().optional(),reasoningTokens:i().optional()}).describe("Usage information for the language model call"),providerMetadata:c().optional().describe("Additional provider-specific metadata"),request:t({body:c().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:t({id:e().optional().describe("ID for the generated response"),timestamp:R().optional().describe("Timestamp for the start of the generated response"),modelId:e().optional().describe("The ID of the response model that was used"),headers:p(e(),e()).optional().describe("Response headers"),body:c().optional().describe("Response HTTP body")}).optional().describe("Optional response information for telemetry and debugging"),warnings:l(c()).describe("Warnings for the call, e.g. unsupported settings")});t({stream:c().describe("ReadableStream of LanguageModelV2StreamPart"),request:t({body:c().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:t({headers:p(e(),e()).optional().describe("Response headers")}).optional().describe("Optional response data")});const se=t({supportedUrls:p(e(),l(e())).describe("Supported URL patterns by media type for the provider")});t({modelId:e().describe("The ID of the model"),logo:e().nullable(),description:e().nullable(),capabilities:l(e()),limits:t({contextWindow:i(),maxOutputTokens:i()}).nullable(),costs:t({input:i(),output:i()}).nullable(),provider:x(["openai","anthropic","google","x-ai","deepseek","openai-compatible","openrouter"]).nullable()});const N=t({modelId:e().describe("The ID of the model"),callOptions:ie}),re=O.extend({logo:e().nullable(),description:e().nullable(),capabilities:l(e()),limits:t({contextWindow:i(),maxOutputTokens:i()}).nullable(),costs:t({input:i(),output:i()}).nullable(),provider:x(["openai","anthropic","google","xai","deepseek","openai-compatible","openrouter"]).nullable()}),le=T("llm",re,{readOnly:!0}),ce=[{name:"LLM_METADATA",inputSchema:t({modelId:e().describe("The ID of the model")}),outputSchema:se},{name:"LLM_DO_STREAM",inputSchema:N,streamable:!0},{name:"LLM_DO_GENERATE",inputSchema:N,outputSchema:ne},...le],de=t({scopes:l(e()).describe("List of scopes available"),stateSchema:p(e(),b()).describe("JSON Schema (draft-07) defining the state structure")}),pe=[{name:"MCP_CONFIGURATION",inputSchema:t({}),outputSchema:de}],ue=t({toolName:e().describe("Name of the tool to invoke on that connection"),transformCode:e().optional().describe("Pure TypeScript function for data transformation of the tool call result. Must be a TypeScript file that declares the Output interface and exports a default function: `interface Output { ... } export default async function(input): Output { ... }`\n The input will match with the tool call outputSchema. If transformCode is not provided, the tool call result will be used as the step output. \n Providing an transformCode is recommended because it both allows you to transform the data and validate it against a JSON Schema - tools are ephemeral and may return unexpected data.")}),me=t({code:e().describe(`Pure TypeScript function for data transformation. Useful to merge data from multiple steps and transform it. Must be a TypeScript file that declares the Output interface and exports a default function: \`interface Output { ... } export default async function(input): Output { ... }\`
|
|
1
|
+
import{a as v}from"./binder-C4CQlgMb.js";import{b9 as T,G as O,o as t,s as e,ba as p,ae as l,bb as c,bc as R,bd as U,be as i,af as x,bf as u,bg as g,bh as n,bi as b,bj as L,bk as B,bl as C}from"./index-BV-rIyOx.js";const W=O.extend({avatar:e().describe("URL or data URI to the assistant's avatar image"),system_prompt:e().describe("System prompt that defines the assistant's behavior"),virtual_mcp_id:e().describe("Virtual MCP ID to use for this assistant"),model:t({id:e().describe("Model ID"),connectionId:e().describe("Connection ID that provides the model")}).describe("Selected model reference for this assistant")}),F=T("assistant",W),G=[...F],w=L(()=>u([B(),e(),i(),g(),p(e(),w),l(w)])),f=p(e(),p(e(),w)).optional().describe("Additional provider-specific options. Outer record keyed by provider name, inner by option key"),E=t({type:n("text"),text:e().describe("The text content"),providerOptions:f}),q=t({type:n("text"),text:e().describe("The text content"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),j=e().describe("File data as URL string"),k=t({type:n("file"),filename:e().optional().describe("Optional filename of the file"),data:j,mediaType:e().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),providerOptions:f}),$=t({type:n("file"),mediaType:e().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),data:e().describe("Generated file data as base64 encoded string")}),J=t({type:n("reasoning"),text:e().describe("The reasoning text"),providerOptions:f}),K=t({type:n("reasoning"),text:e().describe("The reasoning text"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),V=t({type:n("tool-call"),toolCallId:e().describe("ID of the tool call, used to match with tool result"),toolName:e().describe("Name of the tool being called"),input:e().describe("Arguments of the tool call (JSON-serializable object matching tool input schema)"),providerExecuted:g().optional().describe("Whether the tool call will be executed by the provider"),providerOptions:f}),z=t({type:n("tool-call"),toolCallId:e().describe("ID of the tool call"),toolName:e().describe("Name of the tool being called"),input:e().describe("Stringified JSON object with the tool call arguments"),providerExecuted:g().optional().describe("Whether the tool call will be executed by the provider"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),H=u([t({type:n("text"),value:e()}),t({type:n("json"),value:w}),t({type:n("error-text"),value:e()}),t({type:n("error-json"),value:w}),t({type:n("content"),value:l(u([t({type:n("text"),text:e().describe("Text content")}),t({type:n("media"),data:e().describe("Base-64 encoded media data"),mediaType:e().describe("IANA media type")})]))})]),A=t({type:n("tool-result"),toolCallId:e().describe("ID of the tool call that this result is associated with"),toolName:e().describe("Name of the tool that generated this result"),output:H.describe("Result of the tool call"),result:b().describe("Unknown result of the tool call"),providerOptions:f}),X=t({type:n("tool-result"),toolCallId:e().describe("ID of the tool call that this result is associated with"),toolName:e().describe("Name of the tool that generated this result"),result:c().describe("Result of the tool call (JSON-serializable)"),isError:g().optional().describe("Whether the result is an error or error message"),providerExecuted:g().optional().describe("Whether the tool result was generated by the provider"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),Y=u([t({type:n("source"),sourceType:n("url"),id:e().describe("The ID of the source"),url:e().describe("The URL of the source"),title:e().optional().describe("The title of the source"),providerMetadata:c().optional().describe("Additional provider-specific metadata")}),t({type:n("source"),sourceType:n("document"),id:e().describe("The ID of the source"),mediaType:e().describe("IANA media type of the document (e.g., application/pdf)"),title:e().describe("The title of the document"),filename:e().optional().describe("Optional filename of the document"),providerMetadata:c().optional().describe("Additional provider-specific metadata")})]),Z=t({role:n("system"),content:e().describe("System message content"),providerOptions:f}),Q=t({role:n("user"),content:l(u([E,k])).describe("User message content parts (text or file)"),providerOptions:f}),ee=t({role:n("assistant"),content:l(u([E,k,J,V,A])).describe("Assistant message content parts (text, file, reasoning, tool-call, or tool-result)"),providerOptions:f}),te=t({role:n("tool"),content:l(A).describe("Tool message content (tool results)"),providerOptions:f}),oe=u([Z,Q,ee,te]),ae=l(oe).describe("A list of messages forming the prompt"),ie=t({prompt:ae.describe("A language model prompt is a standardized prompt type (array of messages with roles: system, user, assistant, tool)"),maxOutputTokens:i().optional().describe("Maximum number of tokens to generate"),temperature:i().optional().describe("Temperature setting. The range depends on the provider and model"),topP:i().optional().describe("Nucleus sampling parameter"),topK:i().optional().describe("Only sample from the top K options for each subsequent token. Used to remove long tail low probability responses"),presencePenalty:i().optional().describe("Presence penalty setting. It affects the likelihood of the model to repeat information that is already in the prompt"),frequencyPenalty:i().optional().describe("Frequency penalty setting. It affects the likelihood of the model to repeatedly use the same words or phrases"),seed:i().optional().describe("The seed (integer) to use for random sampling. If set and supported by the model, calls will generate deterministic results"),stopSequences:l(e()).optional().describe("Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated"),responseFormat:u([t({type:n("text")}),t({type:n("json"),schema:c().optional().describe("JSON schema that the generated output should conform to"),name:e().optional().describe("Name of output that should be generated"),description:e().optional().describe("Description of the output that should be generated")})]).optional().describe("Response format. The output can either be text or JSON. Default is text"),tools:l(c()).optional().describe("The tools that are available for the model"),toolChoice:c().optional().describe("Specifies how the tool should be selected. Defaults to 'auto'"),includeRawChunks:g().optional().describe("Include raw chunks in the stream. Only applicable for streaming calls"),abortSignal:c().optional().describe("Abort signal for cancelling the operation"),providerOptions:c().optional().describe("Additional provider-specific options")}),ne=t({content:l(u([q,$,K,z,X,Y])).describe("Ordered content that the model has generated (text, tool-calls, reasoning, files, sources)"),finishReason:x(["stop","length","content-filter","tool-calls","error","other","unknown"]).describe("Reason why generation stopped"),usage:U({inputTokens:i().optional(),outputTokens:i().optional(),totalTokens:i().optional(),reasoningTokens:i().optional()}).describe("Usage information for the language model call"),providerMetadata:c().optional().describe("Additional provider-specific metadata"),request:t({body:c().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:t({id:e().optional().describe("ID for the generated response"),timestamp:R().optional().describe("Timestamp for the start of the generated response"),modelId:e().optional().describe("The ID of the response model that was used"),headers:p(e(),e()).optional().describe("Response headers"),body:c().optional().describe("Response HTTP body")}).optional().describe("Optional response information for telemetry and debugging"),warnings:l(c()).describe("Warnings for the call, e.g. unsupported settings")});t({stream:c().describe("ReadableStream of LanguageModelV2StreamPart"),request:t({body:c().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:t({headers:p(e(),e()).optional().describe("Response headers")}).optional().describe("Optional response data")});const se=t({supportedUrls:p(e(),l(e())).describe("Supported URL patterns by media type for the provider")});t({modelId:e().describe("The ID of the model"),logo:e().nullable(),description:e().nullable(),capabilities:l(e()),limits:t({contextWindow:i(),maxOutputTokens:i()}).nullable(),costs:t({input:i(),output:i()}).nullable(),provider:x(["openai","anthropic","google","x-ai","deepseek","openai-compatible","openrouter"]).nullable()});const N=t({modelId:e().describe("The ID of the model"),callOptions:ie}),re=O.extend({logo:e().nullable(),description:e().nullable(),capabilities:l(e()),limits:t({contextWindow:i(),maxOutputTokens:i()}).nullable(),costs:t({input:i(),output:i()}).nullable(),provider:x(["openai","anthropic","google","xai","deepseek","openai-compatible","openrouter"]).nullable()}),le=T("llm",re,{readOnly:!0}),ce=[{name:"LLM_METADATA",inputSchema:t({modelId:e().describe("The ID of the model")}),outputSchema:se},{name:"LLM_DO_STREAM",inputSchema:N,streamable:!0},{name:"LLM_DO_GENERATE",inputSchema:N,outputSchema:ne},...le],de=t({scopes:l(e()).describe("List of scopes available"),stateSchema:p(e(),b()).describe("JSON Schema (draft-07) defining the state structure")}),pe=[{name:"MCP_CONFIGURATION",inputSchema:t({}),outputSchema:de}],ue=t({toolName:e().describe("Name of the tool to invoke on that connection"),transformCode:e().optional().describe("Pure TypeScript function for data transformation of the tool call result. Must be a TypeScript file that declares the Output interface and exports a default function: `interface Output { ... } export default async function(input): Output { ... }`\n The input will match with the tool call outputSchema. If transformCode is not provided, the tool call result will be used as the step output. \n Providing an transformCode is recommended because it both allows you to transform the data and validate it against a JSON Schema - tools are ephemeral and may return unexpected data.")}),me=t({code:e().describe(`Pure TypeScript function for data transformation. Useful to merge data from multiple steps and transform it. Must be a TypeScript file that declares the Output interface and exports a default function: \`interface Output { ... } export default async function(input): Output { ... }\`
|
|
2
2
|
The input is the resolved value of the references in the input field. Example:
|
|
3
3
|
{
|
|
4
4
|
"input": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{q as P,c as w,v as Q,t as h,u as v}from"./index-
|
|
1
|
+
import{q as P,c as w,v as Q,t as h,u as v}from"./index-BV-rIyOx.js";import{u as F}from"./useMutation-BOrtlNTb.js";import{K as x,a as q,u as U}from"./constants-1q3hobyw.js";function b(o,n,s){const e=[];if(o?.trim()){const t=o.trim(),r=s.map(a=>({field:[String(a)],operator:"contains",value:t}));r.length===1&&r[0]?e.push(r[0]):r.length>1&&e.push({operator:"or",conditions:r})}if(n&&n.length>0)for(const t of n)e.push({field:[t.column],operator:"eq",value:t.value});if(e.length!==0)return e.length===1?e[0]:{operator:"and",conditions:e}}function D(o,n,s){const e=o??s,t=n??"asc";return[{field:[String(e)],direction:t}]}function I(o){if(!o||typeof o!="object")throw new Error("Invalid result");if("isError"in o&&o.isError)throw new Error("content"in o&&Array.isArray(o.content)&&o.content[0]?.type==="text"?o.content[0].text:"Unknown error");if("structuredContent"in o)return o.structuredContent;throw new Error("No structured content found")}function k(o,n,s,e){const t=w.c(13);let r;t[0]!==n?(r=n.toUpperCase(),t[0]=n,t[1]=r):r=t[1];const i=`COLLECTION_${r}_GET`;let c;t[2]!==e||t[3]!==i||t[4]!==s?(c=x.mcpToolCall(e,i,s??""),t[2]=e,t[3]=i,t[4]=s,t[5]=c):c=t[5];let l;t[6]!==e||t[7]!==i||t[8]!==s?(l=async()=>{if(!s)return{item:null};const p=await e.callTool({name:i,arguments:{id:s}});return I(p)},t[6]=e,t[7]=i,t[8]=s,t[9]=l):l=t[9];let d;t[10]!==c||t[11]!==l?(d={queryKey:c,queryFn:l,staleTime:6e4},t[10]=c,t[11]=l,t[12]=d):d=t[12];const{data:f}=P(d);return f?.item??null}const B={structuredContent:{items:[]},isError:!1};function R(o,n,s,e={}){const{searchTerm:t,filters:r,sortKey:a,sortDirection:i,searchFields:c=["title","description"],defaultSortKey:l="updated_at",pageSize:d=100}=e,p=`COLLECTION_${n.toUpperCase()}_LIST`,m=b(t,r,c),y=D(a,i,l),E={...m&&{where:m},...y&&{orderBy:y},limit:d,offset:0},C=JSON.stringify(E),g=x.mcpToolCall(s,p,C),{data:N}=P({queryKey:g,queryFn:async()=>s?await s.callTool({name:p,arguments:E}):B,staleTime:3e4,retry:!1,select:S=>I(S??{})?.items??[]});return N}function X(o,n,s,e={}){const{searchTerm:t,filters:r,sortKey:a,sortDirection:i,searchFields:c=["title","description"],defaultSortKey:l="updated_at",pageSize:d=100}=e,p=`COLLECTION_${n.toUpperCase()}_LIST`,m=b(t,r,c),y=D(a,i,l),E={...m&&{where:m},...y&&{orderBy:y},limit:d,offset:0},C=JSON.stringify(E);return x.mcpToolCall(o,p,C)}function j(o,n,s){const e=w.c(33),t=Q();let r;e[0]!==n?(r=n.toUpperCase(),e[0]=n,e[1]=r):r=e[1];const a=r,i=`COLLECTION_${a}_CREATE`,c=`COLLECTION_${a}_UPDATE`,l=`COLLECTION_${a}_DELETE`;let d;e[2]!==t||e[3]!==a?(d=()=>{t.invalidateQueries({predicate:_=>{const u=_.queryKey;if(u[0]!=="mcp"||u[1]!=="client"||u[3]!=="tool-call")return!1;const L=u[4];return typeof L=="string"&&L.startsWith(`COLLECTION_${a}_`)}})},e[2]=t,e[3]=a,e[4]=d):d=e[4];const f=d;let p;e[5]!==s||e[6]!==i?(p=async _=>{const u=await s.callTool({name:i,arguments:{data:_}});if(u.isError)throw new Error(Array.isArray(u.content)?u.content[0]?.text:String(u.content));return I(u).item},e[5]=s,e[6]=i,e[7]=p):p=e[7];let m;e[8]!==f?(m=()=>{f(),h.success("Item created successfully")},e[8]=f,e[9]=m):m=e[9];let y;e[10]!==p||e[11]!==m?(y={mutationFn:p,onSuccess:m,onError:W},e[10]=p,e[11]=m,e[12]=y):y=e[12];const E=F(y);let C;e[13]!==s||e[14]!==c?(C=async _=>{const{id:u,data:L}=_,M=await s.callTool({name:c,arguments:{id:u,data:L}});return I(M).item},e[13]=s,e[14]=c,e[15]=C):C=e[15];let g;e[16]!==f?(g=()=>{f(),h.success("Item updated successfully")},e[16]=f,e[17]=g):g=e[17];let N;e[18]!==C||e[19]!==g?(N={mutationFn:C,onSuccess:g,onError:J},e[18]=C,e[19]=g,e[20]=N):N=e[20];const S=F(N);let T;e[21]!==s||e[22]!==l?(T=async _=>{const u=await s.callTool({name:l,arguments:{id:_}});return I(u).item.id},e[21]=s,e[22]=l,e[23]=T):T=e[23];let O;e[24]!==f?(O=()=>{f(),h.success("Item deleted successfully")},e[24]=f,e[25]=O):O=e[25];let K;e[26]!==T||e[27]!==O?(K={mutationFn:T,onSuccess:O,onError:z},e[26]=T,e[27]=O,e[28]=K):K=e[28];const A=F(K);let $;return e[29]!==E||e[30]!==A||e[31]!==S?($={create:E,update:S,delete:A},e[29]=E,e[30]=A,e[31]=S,e[32]=$):$=e[32],$}function z(o){const n=o instanceof Error?o.message:String(o);h.error(`Failed to delete item: ${n}`)}function J(o){const n=o instanceof Error?o.message:String(o);h.error(`Failed to update item: ${n}`)}function W(o){const n=o instanceof Error?o.message:String(o);h.error(`Failed to create item: ${n}`)}function Z(o){const n=w.c(4);let s;n[0]!==o?(s=o===void 0?{}:o,n[0]=o,n[1]=s):s=n[1];const e=s,{org:t}=v();let r;n[2]!==t.id?(r={connectionId:q,orgId:t.id},n[2]=t.id,n[3]=r):r=n[3];const a=U(r);return R(t.id,"CONNECTIONS",a,e)}function ee(o){const n=w.c(2),{org:s}=v();let e;n[0]!==s.id?(e={connectionId:q,orgId:s.id},n[0]=s.id,n[1]=e):e=n[1];const t=U(e);return k(s.id,"CONNECTIONS",o,t)}function te(){const o=w.c(2),{org:n}=v();let s;o[0]!==n.id?(s={connectionId:q,orgId:n.id},o[0]=n.id,o[1]=s):s=o[1];const e=U(s);return j(n.id,"CONNECTIONS",e)}export{B as E,D as a,X as b,b as c,k as d,R as e,ee as f,te as g,Z as h,j as u};
|
package/dist/client/assets/{use-create-virtual-mcp-u-AAtHmy.js → use-create-virtual-mcp-7fubOknm.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as p,u as m,m as C,O as f}from"./index-
|
|
1
|
+
import{c as p,u as m,m as C,O as f}from"./index-BV-rIyOx.js";import{a as v}from"./use-virtual-mcp-ayu_K6US.js";function M(s){const e=p.c(10);let a;e[0]!==s?(a=s===void 0?{}:s,e[0]=s,e[1]=a):a=e[1];const d=a,{navigateOnCreate:l}=d,o=l===void 0?!1:l,{org:r}=m(),c=C(),t=v();let n;e[2]!==t.create||e[3]!==c||e[4]!==o||e[5]!==r?(n=async()=>{const g=await t.create.mutateAsync({title:"New Agent",description:"Agents let you securely expose integrated tools to the outside world.",status:"active",connections:[]});return o&&c({to:"/$org/$project/agents/$agentId",params:{org:r.slug,project:f,agentId:g.id}}),{id:g.id,virtualMcp:g}},e[2]=t.create,e[3]=c,e[4]=o,e[5]=r,e[6]=n):n=e[6];const u=n;let i;return e[7]!==t.create.isPending||e[8]!==u?(i={createVirtualMCP:u,isCreating:t.create.isPending},e[7]=t.create.isPending,e[8]=u,e[9]=i):i=e[9],i}export{M as u};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{r as S,bw as as,bx as ss,F as rs,bf as B,s as b,by as qe,bz as ca,bj as os,bk as ns,be as is,bg as z,ba as Ie,ae as Te,o as R,bh as I,bi as ie,bA as ls,bB as O,af as cs,b5 as ds,c as k,u as xe,K as Ae,a as da,v as xt,t as bt,j as d,g as us,am as ps,_ as _t,at as ms,an as fs,aq as hs,av as gs,al as vs,b0 as ys}from"./index-BV-rIyOx.js";import{u as Et,a as It,d as xs}from"./constants-1q3hobyw.js";import{b as bs}from"./use-virtual-mcp-ayu_K6US.js";import{a as _s,u as St}from"./use-llm-H-K3anTg.js";import{u as Es}from"./useQuery-DDYln2BW.js";import{b as wt,c as Is,a as Ss,e as ws}from"./use-connection-B8DnjeO8.js";import{u as Ns}from"./Code01-DEMYMNLO.js";import{u as Se,L as We}from"./localstorage-keys-Ds2uOTRP.js";import{B as ua}from"./button-Cl3WMTWk.js";import{I as Cs}from"./input-Dv5qvD5N.js";import{P as Ts,a as As,b as Ms}from"./popover-DuZ2ZN5J.js";import{S as js,a as Rs,b as Ps,c as ks,d as Os}from"./select-ODRW9YrY.js";import{c as Nt}from"./utils-CfR4kXxZ.js";import{E as pa,i as Ds}from"./error-boundary-D7C5xzme.js";import{t as dt}from"./ChevronDown-DqJTvBdv.js";import{i as $s}from"./File06-CkTcogsG.js";import{c as Ls}from"./Grid01-zbmmdox0.js";import{a as Zs}from"./Image01-BuXlAy8i.js";import{i as ma}from"./SearchMd-Ds-ERWzq.js";var we;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function a(r){throw new Error}t.assertNever=a,t.arrayToEnum=r=>{const o={};for(const i of r)o[i]=i;return o},t.getValidEnumValues=r=>{const o=t.objectKeys(r).filter(n=>typeof r[r[n]]!="number"),i={};for(const n of o)i[n]=r[n];return t.objectValues(i)},t.objectValues=r=>t.objectKeys(r).map(function(o){return r[o]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const o=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&o.push(i);return o},t.find=(r,o)=>{for(const i of r)if(o(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,o=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}t.joinValues=s,t.jsonStringifyReplacer=(r,o)=>typeof o=="bigint"?o.toString():o})(we||(we={}));var Ft;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Ft||(Ft={}));we.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);we.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 He 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(o){return o.message},s={_errors:[]},r=o=>{for(const i of o.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 n=s,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(n[l]=n[l]||{_errors:[]},n[l]._errors.push(a(i))):n[l]=n[l]||{_errors:[]},n=n[l],c++}}};return r(this),s}static assert(e){if(!(e instanceof He))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,we.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 o=r.path[0];a[o]=a[o]||[],a[o].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:a}}get formErrors(){return this.flatten()}}He.create=t=>new He(t);var Ut;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Ut||(Ut={}));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 Fs=({size:t=24,color:e="currentColor",...a})=>S.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},S.createElement("path",{d:"M4 7h11m0 0-4 4m4-4-4-4M4 17h16m0 0-4 4m4-4-4-4"}));Fs.displayName="ArrowsRight";const fa=({size:t=24,color:e="currentColor",...a})=>S.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},S.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));fa.displayName="ChevronSelectorVertical";const ha=({size:t=24,color:e="currentColor",...a})=>S.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},S.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"}));ha.displayName="CurrencyDollar";const Us=({size:t=24,color:e="currentColor",...a})=>S.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},S.createElement("path",{d:"M10 17.659V20a2 2 0 1 0 4 0v-2.341M12 2v1m-9 9H2m3.5-6.5-.6-.6m13.6.6.6-.6M22 12h-1m-3 0a6 6 0 1 1-12 0 6 6 0 0 1 12 0Z"}));Us.displayName="Lightbulb02";const ga=({size:t=24,color:e="currentColor",...a})=>S.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},S.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"}));ga.displayName="LogOut04";const va=({size:t=24,color:e="currentColor",...a})=>S.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},S.createElement("path",{d:"M2 10s2.005-2.732 3.634-4.362A9 9 0 1 1 12 21a9.004 9.004 0 0 1-8.648-6.5M2 10V4m0 6h6"}));va.displayName="RefreshCcw01";const ya=({size:t=24,color:e="currentColor",...a})=>S.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},S.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"}));ya.displayName="Stars01";var xa="vercel.ai.error",zs=Symbol.for(xa),zt,Bt,te=class ba extends(Bt=Error,zt=zs,Bt){constructor({name:e,message:a,cause:s}){super(a),this[zt]=!0,this.name=e,this.cause=s}static isInstance(e){return ba.hasMarker(e,xa)}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 _a(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var Ea="AI_InvalidArgumentError",Ia=`vercel.ai.error.${Ea}`,Bs=Symbol.for(Ia),Vt,qt,Vs=class extends(qt=te,Vt=Bs,qt){constructor({message:t,cause:e,argument:a}){super({name:Ea,message:t,cause:e}),this[Vt]=!0,this.argument=a}static isInstance(t){return te.hasMarker(t,Ia)}},Sa="AI_JSONParseError",wa=`vercel.ai.error.${Sa}`,qs=Symbol.for(wa),Ht,Wt,Jt=class extends(Wt=te,Ht=qs,Wt){constructor({text:t,cause:e}){super({name:Sa,message:`JSON parsing failed: Text: ${t}.
|
|
2
|
+
Error message: ${_a(e)}`,cause:e}),this[Ht]=!0,this.text=t}static isInstance(t){return te.hasMarker(t,wa)}},Na="AI_TypeValidationError",Ca=`vercel.ai.error.${Na}`,Hs=Symbol.for(Ca),Gt,Yt,ye=class ut extends(Yt=te,Gt=Hs,Yt){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 o=[];s.entityName&&o.push(s.entityName),s.entityId&&o.push(`id: "${s.entityId}"`),r+=o.join(", "),r+=")"}super({name:Na,message:`${r}: Value: ${JSON.stringify(e)}.
|
|
3
|
+
Error message: ${_a(a)}`,cause:a}),this[Gt]=!0,this.value=e,this.context=s}static isInstance(e){return te.hasMarker(e,Ca)}static wrap({value:e,cause:a,context:s}){var r,o,i;return ut.isInstance(a)&&a.value===e&&((r=a.context)==null?void 0:r.field)===s?.field&&((o=a.context)==null?void 0:o.entityName)===s?.entityName&&((i=a.context)==null?void 0:i.entityId)===s?.entityId?a:new ut({value:e,cause:a,context:s})}},Me=({prefix:t,size:e=16,alphabet:a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:s="-"}={})=>{const r=()=>{const o=a.length,i=new Array(e);for(let n=0;n<e;n++)i[n]=a[Math.random()*o|0];return i.join("")};if(t==null)return r;if(a.includes(s))throw new Vs({argument:"separator",message:`The separator "${s}" must not be part of the alphabet "${a}".`});return()=>`${t}${s}${r()}`},Ws=Me();function Qt(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 me(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 Xt(t,...e){const a=new Headers(me(t)),s=a.get("user-agent")||"";return a.set("user-agent",[s,...e].filter(Boolean).join(" ")),Object.fromEntries(a.entries())}var Js=/"__proto__"\s*:/,Gs=/"constructor"\s*:/;function Kt(t){const e=JSON.parse(t);return e===null||typeof e!="object"||Js.test(t)===!1&&Gs.test(t)===!1?e:Ys(e)}function Ys(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 o=s[r];o&&typeof o=="object"&&e.push(o)}}}return t}function Qs(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return Kt(t)}try{return Kt(t)}finally{Error.stackTraceLimit=e}}function Ct(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]=pe(a[s])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(pe):pe(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(pe)),t.allOf!=null&&(t.allOf=t.allOf.map(pe)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(pe));const{definitions:e}=t;if(e!=null)for(const a of Object.keys(e))e[a]=pe(e[a]);return t}function pe(t){return typeof t=="boolean"?t:Ct(t)}var Xs=Symbol("Let zodToJsonSchema decide on which parser to use"),ea={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"},Ks=t=>typeof t=="string"?{...ea,name:t}:{...ea,...t};function V(){return{}}function er(t,e){var a,s,r;const o={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&&(o.items=j(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(o.minItems=t.minLength.value),t.maxLength&&(o.maxItems=t.maxLength.value),t.exactLength&&(o.minItems=t.exactLength.value,o.maxItems=t.exactLength.value),o}function tr(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 ar(){return{type:"boolean"}}function Ta(t,e){return j(t.type._def,e)}var sr=(t,e)=>j(t.innerType._def,e);function Aa(t,e,a){const s=a??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,o)=>Aa(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 rr(t)}}var rr=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 or(t,e){return{...j(t.innerType._def,e),default:t.defaultValue()}}function nr(t,e){return e.effectStrategy==="input"?j(t.schema._def,e):V()}function ir(t){return{type:"string",enum:Array.from(t.values)}}var lr=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function cr(t,e){const a=[j(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),j(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(r=>!!r),s=[];return a.forEach(r=>{if(lr(r))s.push(...r.allOf);else{let o=r;if("additionalProperties"in r&&r.additionalProperties===!1){const{additionalProperties:i,...n}=r;o=n}s.push(o)}}),s.length?{allOf:s}:void 0}function dr(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 it=void 0,G={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:()=>(it===void 0&&(it=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),it),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 Ma(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":U(a,G.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":U(a,s.regex,s.message,e);break;case"cuid":U(a,G.cuid,s.message,e);break;case"cuid2":U(a,G.cuid2,s.message,e);break;case"startsWith":U(a,RegExp(`^${lt(s.value,e)}`),s.message,e);break;case"endsWith":U(a,RegExp(`${lt(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":{U(a,RegExp(lt(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":U(a,G.base64url,s.message,e);break;case"jwt":U(a,G.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&U(a,G.ipv4Cidr,s.message,e),s.version!=="v4"&&U(a,G.ipv6Cidr,s.message,e);break}case"emoji":U(a,G.emoji(),s.message,e);break;case"ulid":{U(a,G.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":{U(a,G.base64,s.message,e);break}}break}case"nanoid":U(a,G.nanoid,s.message,e)}return a}function lt(t,e){return e.patternStrategy==="escape"?pr(t):t}var ur=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function pr(t){let e="";for(let a=0;a<t.length;a++)ur.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(o=>o.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 U(t,e,a,s){var r;t.pattern||(r=t.allOf)!=null&&r.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern}),delete t.pattern),t.allOf.push({pattern:ta(e,s),...a&&s.errorMessages&&{errorMessage:{pattern:a}}})):t.pattern=ta(e,s)}function ta(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 o="",i=!1,n=!1,c=!1;for(let l=0;l<r.length;l++){if(i){o+=r[l],i=!1;continue}if(s.i){if(n){if(r[l].match(/[a-z]/)){c?(o+=r[l],o+=`${r[l-2]}-${r[l]}`.toUpperCase(),c=!1):r[l+1]==="-"&&((a=r[l+2])!=null&&a.match(/[a-z]/))?(o+=r[l],c=!0):o+=`${r[l]}${r[l].toUpperCase()}`;continue}}else if(r[l].match(/[a-z]/)){o+=`[${r[l]}${r[l].toUpperCase()}]`;continue}}if(s.m){if(r[l]==="^"){o+=`(^|(?<=[\r
|
|
4
|
+
]))`;continue}else if(r[l]==="$"){o+=`($|(?=[\r
|
|
5
|
+
]))`;continue}}if(s.s&&r[l]==="."){o+=n?`${r[l]}\r
|
|
6
|
+
`:`[${r[l]}\r
|
|
7
|
+
]`;continue}o+=r[l],r[l]==="\\"?i=!0:n&&r[l]==="]"?n=!1:!n&&r[l]==="["&&(n=!0)}try{new RegExp(o)}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 o}function ja(t,e){var a,s,r,o,i,n;const c={type:"object",additionalProperties:(a=j(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}=Ma(t.keyType._def,e);return{...c,propertyNames:p}}else{if(((o=t.keyType)==null?void 0:o._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&&((n=t.keyType._def.type._def.checks)!=null&&n.length)){const{type:l,...p}=Ta(t.keyType._def,e);return{...c,propertyNames:p}}}return c}function mr(t,e){if(e.mapStrategy==="record")return ja(t,e);const a=j(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||V(),s=j(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||V();return{type:"array",maxItems:125,items:{type:"array",items:[a,s],minItems:2,maxItems:2}}}function fr(t){const e=t.values,s=Object.keys(t.values).filter(o=>typeof e[e[o]]!="number").map(o=>e[o]),r=Array.from(new Set(s.map(o=>typeof o)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function hr(){return{not:V()}}function gr(){return{type:"null"}}var pt={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function vr(t,e){const a=t.options instanceof Map?Array.from(t.options.values()):t.options;if(a.every(s=>s._def.typeName in pt&&(!s._def.checks||!s._def.checks.length))){const s=a.reduce((r,o)=>{const i=pt[o._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,o)=>{const i=typeof o._def.value;switch(i){case"string":case"number":case"boolean":return[...r,i];case"bigint":return[...r,"integer"];case"object":if(o._def.value===null)return[...r,"null"];default:return r}},[]);if(s.length===a.length){const r=s.filter((o,i,n)=>n.indexOf(o)===i);return{type:r.length>1?r:r[0],enum:a.reduce((o,i)=>o.includes(i._def.value)?o:[...o,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(o=>!s.includes(o))],[])};return yr(t,e)}var yr=(t,e)=>{const a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,r)=>j(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 xr(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[pt[t.innerType._def.typeName],"null"]};const a=j(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function br(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 _r(t,e){const a={type:"object",properties:{}},s=[],r=t.shape();for(const i in r){let n=r[i];if(n===void 0||n._def===void 0)continue;const c=Ir(n),l=j(n._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 o=Er(t,e);return o!==void 0&&(a.additionalProperties=o),a}function Er(t,e){if(t.catchall._def.typeName!=="ZodNever")return j(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 Ir(t){try{return t.isOptional()}catch{return!0}}var Sr=(t,e)=>{var a;if(e.currentPath.toString()===((a=e.propertyPath)==null?void 0:a.toString()))return j(t.innerType._def,e);const s=j(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return s?{anyOf:[{not:V()},s]}:V()},wr=(t,e)=>{if(e.pipeStrategy==="input")return j(t.in._def,e);if(e.pipeStrategy==="output")return j(t.out._def,e);const a=j(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=j(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,s].filter(r=>r!==void 0)}};function Nr(t,e){return j(t.type._def,e)}function Cr(t,e){const s={type:"array",uniqueItems:!0,items:j(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 Tr(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((a,s)=>j(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[]),additionalItems:j(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((a,s)=>j(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[])}}function Ar(){return{not:V()}}function Mr(){return V()}var jr=(t,e)=>j(t.innerType._def,e),Rr=(t,e,a)=>{switch(e){case w.ZodString:return Ma(t,a);case w.ZodNumber:return br(t);case w.ZodObject:return _r(t,a);case w.ZodBigInt:return tr(t);case w.ZodBoolean:return ar();case w.ZodDate:return Aa(t,a);case w.ZodUndefined:return Ar();case w.ZodNull:return gr();case w.ZodArray:return er(t,a);case w.ZodUnion:case w.ZodDiscriminatedUnion:return vr(t,a);case w.ZodIntersection:return cr(t,a);case w.ZodTuple:return Tr(t,a);case w.ZodRecord:return ja(t,a);case w.ZodLiteral:return dr(t);case w.ZodEnum:return ir(t);case w.ZodNativeEnum:return fr(t);case w.ZodNullable:return xr(t,a);case w.ZodOptional:return Sr(t,a);case w.ZodMap:return mr(t,a);case w.ZodSet:return Cr(t,a);case w.ZodLazy:return()=>t.getter()._def;case w.ZodPromise:return Nr(t,a);case w.ZodNaN:case w.ZodNever:return hr();case w.ZodEffects:return nr(t,a);case w.ZodAny:return V();case w.ZodUnknown:return Mr();case w.ZodDefault:return or(t,a);case w.ZodBranded:return Ta(t,a);case w.ZodReadonly:return jr(t,a);case w.ZodCatch:return sr(t,a);case w.ZodPipeline:return wr(t,a);case w.ZodFunction:case w.ZodVoid:case w.ZodSymbol:return;default:return(s=>{})()}},Pr=(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 j(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!==Xs)return c}if(r&&!a){const c=kr(r,e);if(c!==void 0)return c}const o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);const i=Rr(t,t.typeName,e),n=typeof i=="function"?j(i(),e):i;if(n&&Or(t,e,n),e.postProcess){const c=e.postProcess(n,t,e);return o.jsonSchema=n,c}return o.jsonSchema=n,n}var kr=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Pr(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`),V()):e.$refStrategy==="seen"?V():void 0}},Or=(t,e,a)=>(t.description&&(a.description=t.description),a),Dr=t=>{const e=Ks(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}]))}},$r=(t,e)=>{var a;const s=Dr(e);let r=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[p,m])=>{var h;return{...l,[p]:(h=j(m._def,{...s,currentPath:[...s.basePath,s.definitionPath,p]},!0))!=null?h:V()}},{}):void 0;const o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=(a=j(t._def,o===void 0?s:{...s,currentPath:[...s.basePath,s.definitionPath,o]},!1))!=null?a:V(),n=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;n!==void 0&&(i.title=n);const c=o===void 0?r?{...i,[s.definitionPath]:r}:i:{$ref:[...s.$refStrategy==="relative"?[]:s.basePath,s.definitionPath,o].join("/"),[s.definitionPath]:{...r,[o]:i}};return c.$schema="http://json-schema.org/draft-07/schema#",c},mt=Symbol.for("vercel.ai.schema");function Lr(t){let e;return()=>(e==null&&(e=t()),e)}function Je(t,{validate:e}={}){return{[mt]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function Zr(t){return typeof t=="object"&&t!==null&&mt in t&&t[mt]===!0&&"jsonSchema"in t&&"validate"in t}function Tt(t){return t==null?Je({properties:{},additionalProperties:!1}):Zr(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?Ra(t):Fr(t):t()}function Fr(t){return Je(()=>Ct(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 ye({value:e,cause:a.issues})}}})}function Ur(t,e){var a;const s=(a=void 0)!=null?a:!1;return Je(()=>$r(t,{$refStrategy:s?"root":"none"}),{validate:async r=>{const o=await t.safeParseAsync(r);return o.success?{success:!0,value:o.data}:{success:!1,error:o.error}}})}function zr(t,e){var a;const s=(a=void 0)!=null?a:!1;return Je(()=>Ct(rs(t,{target:"draft-7",io:"input",reused:s?"ref":"inline"})),{validate:async r=>{const o=await ss(t,r);return o.success?{success:!0,value:o.data}:{success:!1,error:o.error}}})}function Br(t){return"_zod"in t}function Ra(t,e){return Br(t)?zr(t):Ur(t)}async function aa({value:t,schema:e,context:a}){const s=await Ne({value:t,schema:e,context:a});if(!s.success)throw ye.wrap({value:t,cause:s.error,context:a});return s.value}async function Ne({value:t,schema:e,context:a}){const s=Tt(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:ye.wrap({value:t,cause:r.error,context:a}),rawValue:t}}catch(r){return{success:!1,error:ye.wrap({value:t,cause:r,context:a}),rawValue:t}}}async function fe({text:t,schema:e}){try{const a=Qs(t);return e==null?{success:!0,value:a,rawValue:a}:await Ne({value:a,schema:e})}catch(a){return{success:!1,error:Jt.isInstance(a)?a:new Jt({text:t,cause:a}),rawValue:void 0}}}function Vr({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new as).pipeThrough(new TransformStream({async transform({data:a},s){a!=="[DONE]"&&s.enqueue(await fe({text:a,schema:e}))}}))}async function ce(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var qr=Object.defineProperty,Hr=(t,e)=>{for(var a in e)qr(t,a,{get:e[a],enumerable:!0})},Pa="AI_NoObjectGeneratedError",ka=`vercel.ai.error.${Pa}`,Wr=Symbol.for(ka),Oa,de=class extends te{constructor({message:t="No object generated.",cause:e,text:a,response:s,usage:r,finishReason:o}){super({name:Pa,message:t,cause:e}),this[Oa]=!0,this.text=a,this.response=s,this.usage=r,this.finishReason=o}static isInstance(t){return te.hasMarker(t,ka)}};Oa=Wr;var Da="AI_UIMessageStreamError",$a=`vercel.ai.error.${Da}`,Jr=Symbol.for($a),La,he=class extends te{constructor({chunkType:t,chunkId:e,message:a}){super({name:Da,message:a}),this[La]=!0,this.chunkType=t,this.chunkId=e}static isInstance(t){return te.hasMarker(t,$a)}};La=Jr;var sa="6.0.72",Za=B([b(),qe(Uint8Array),qe(ArrayBuffer),ca(t=>{var e,a;return(a=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?a:!1},{message:"Must be a Buffer"})]),Ce=os(()=>B([ns(),b(),is(),z(),Ie(b(),Ce.optional()),Te(Ce)])),A=Ie(b(),Ie(b(),Ce.optional())),Fa=R({type:I("text"),text:b(),providerOptions:A.optional()}),Gr=R({type:I("image"),image:B([Za,qe(URL)]),mediaType:b().optional(),providerOptions:A.optional()}),Ua=R({type:I("file"),data:B([Za,qe(URL)]),filename:b().optional(),mediaType:b(),providerOptions:A.optional()}),Yr=R({type:I("reasoning"),text:b(),providerOptions:A.optional()}),Qr=R({type:I("tool-call"),toolCallId:b(),toolName:b(),input:ie(),providerOptions:A.optional(),providerExecuted:z().optional()}),Xr=ls("type",[R({type:I("text"),value:b(),providerOptions:A.optional()}),R({type:I("json"),value:Ce,providerOptions:A.optional()}),R({type:I("execution-denied"),reason:b().optional(),providerOptions:A.optional()}),R({type:I("error-text"),value:b(),providerOptions:A.optional()}),R({type:I("error-json"),value:Ce,providerOptions:A.optional()}),R({type:I("content"),value:Te(B([R({type:I("text"),text:b(),providerOptions:A.optional()}),R({type:I("media"),data:b(),mediaType:b()}),R({type:I("file-data"),data:b(),mediaType:b(),filename:b().optional(),providerOptions:A.optional()}),R({type:I("file-url"),url:b(),providerOptions:A.optional()}),R({type:I("file-id"),fileId:B([b(),Ie(b(),b())]),providerOptions:A.optional()}),R({type:I("image-data"),data:b(),mediaType:b(),providerOptions:A.optional()}),R({type:I("image-url"),url:b(),providerOptions:A.optional()}),R({type:I("image-file-id"),fileId:B([b(),Ie(b(),b())]),providerOptions:A.optional()}),R({type:I("custom"),providerOptions:A.optional()})]))})]),za=R({type:I("tool-result"),toolCallId:b(),toolName:b(),output:Xr,providerOptions:A.optional()}),Kr=R({type:I("tool-approval-request"),approvalId:b(),toolCallId:b()}),eo=R({type:I("tool-approval-response"),approvalId:b(),approved:z(),reason:b().optional()}),to=R({role:I("system"),content:b(),providerOptions:A.optional()}),ao=R({role:I("user"),content:B([b(),Te(B([Fa,Gr,Ua]))]),providerOptions:A.optional()}),so=R({role:I("assistant"),content:B([b(),Te(B([Fa,Ua,Yr,Qr,za,Kr]))]),providerOptions:A.optional()}),ro=R({role:I("tool"),content:Te(B([za,eo])),providerOptions:A.optional()});B([to,ao,so,ro]);function Ba(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 o=s in t?t[s]:void 0,i=r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)&&!(r instanceof RegExp),n=o!=null&&typeof o=="object"&&!Array.isArray(o)&&!(o instanceof Date)&&!(o instanceof RegExp);i&&n?a[s]=Ba(o,r):a[s]=r}return a}var oo={};Hr(oo,{array:()=>co,choice:()=>uo,json:()=>po,object:()=>lo,text:()=>io});function no(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 o(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":{o(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"&&o(l,c);break}case"}":{e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&o(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"?o(l,c):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c)):a=c;break}}}let n=t.slice(0,a+1);for(let c=e.length-1;c>=0;c--)switch(e[c]){case"INSIDE_STRING":{n+='"';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":{n+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{n+="]";break}case"INSIDE_LITERAL":{const p=t.substring(s,t.length);"true".startsWith(p)?n+="true".slice(p.length):"false".startsWith(p)?n+="false".slice(p.length):"null".startsWith(p)&&(n+="null".slice(p.length))}}return n}async function je(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await fe({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await fe({text:no(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var io=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}},createElementStreamTransform(){}}),lo=({schema:t,name:e,description:a})=>{const s=Tt(t);return{name:"object",responseFormat:ce(s.jsonSchema).then(r=>({type:"json",schema:r,...e!=null&&{name:e},...a!=null&&{description:a}})),async parseCompleteOutput({text:r},o){const i=await fe({text:r});if(!i.success)throw new de({message:"No object generated: could not parse the response.",cause:i.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});const n=await Ne({value:i.value,schema:s});if(!n.success)throw new de({message:"No object generated: response did not match schema.",cause:n.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});return n.value},async parsePartialOutput({text:r}){const o=await je(r);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:o.value}}},createElementStreamTransform(){}}},co=({element:t,name:e,description:a})=>{const s=Tt(t);return{name:"array",responseFormat:ce(s.jsonSchema).then(r=>{const{$schema:o,...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},o){const i=await fe({text:r});if(!i.success)throw new de({message:"No object generated: could not parse the response.",cause:i.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});const n=i.value;if(n==null||typeof n!="object"||!("elements"in n)||!Array.isArray(n.elements))throw new de({message:"No object generated: response did not match schema.",cause:new ye({value:n,cause:"response must be an object with an elements array"}),text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});for(const c of n.elements){const l=await Ne({value:c,schema:s});if(!l.success)throw new de({message:"No object generated: response did not match schema.",cause:l.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason})}return n.elements},async parsePartialOutput({text:r}){const o=await je(r);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const i=o.value;if(i==null||typeof i!="object"||!("elements"in i)||!Array.isArray(i.elements))return;const n=o.state==="repaired-parse"&&i.elements.length>0?i.elements.slice(0,-1):i.elements,c=[];for(const l of n){const p=await Ne({value:l,schema:s});p.success&&c.push(p.value)}return{partial:c}}}},createElementStreamTransform(){let r=0;return new TransformStream({transform({partialOutput:o},i){if(o!=null)for(;r<o.length;r++)i.enqueue(o[r])}})}}},uo=({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 o=await fe({text:s});if(!o.success)throw new de({message:"No object generated: could not parse the response.",cause:o.error,text:s,response:r.response,usage:r.usage,finishReason:r.finishReason});const i=o.value;if(i==null||typeof i!="object"||!("result"in i)||typeof i.result!="string"||!t.includes(i.result))throw new de({message:"No object generated: response did not match schema.",cause:new ye({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 je(s);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const o=r.value;if(o==null||typeof o!="object"||!("result"in o)||typeof o.result!="string")return;const i=t.filter(n=>n.startsWith(o.result));return r.state==="successful-parse"?i.includes(o.result)?{partial:o.result}:void 0:i.length===1?{partial:i[0]}:void 0}}},createElementStreamTransform(){}}),po=({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 fe({text:a});if(!r.success)throw new de({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 je(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(){}});Me({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 mo=Lr(()=>Ra(B([O({type:I("text-start"),id:b(),providerMetadata:A.optional()}),O({type:I("text-delta"),id:b(),delta:b(),providerMetadata:A.optional()}),O({type:I("text-end"),id:b(),providerMetadata:A.optional()}),O({type:I("error"),errorText:b()}),O({type:I("tool-input-start"),toolCallId:b(),toolName:b(),providerExecuted:z().optional(),providerMetadata:A.optional(),dynamic:z().optional(),title:b().optional()}),O({type:I("tool-input-delta"),toolCallId:b(),inputTextDelta:b()}),O({type:I("tool-input-available"),toolCallId:b(),toolName:b(),input:ie(),providerExecuted:z().optional(),providerMetadata:A.optional(),dynamic:z().optional(),title:b().optional()}),O({type:I("tool-input-error"),toolCallId:b(),toolName:b(),input:ie(),providerExecuted:z().optional(),providerMetadata:A.optional(),dynamic:z().optional(),errorText:b(),title:b().optional()}),O({type:I("tool-approval-request"),approvalId:b(),toolCallId:b()}),O({type:I("tool-output-available"),toolCallId:b(),output:ie(),providerExecuted:z().optional(),dynamic:z().optional(),preliminary:z().optional()}),O({type:I("tool-output-error"),toolCallId:b(),errorText:b(),providerExecuted:z().optional(),dynamic:z().optional()}),O({type:I("tool-output-denied"),toolCallId:b()}),O({type:I("reasoning-start"),id:b(),providerMetadata:A.optional()}),O({type:I("reasoning-delta"),id:b(),delta:b(),providerMetadata:A.optional()}),O({type:I("reasoning-end"),id:b(),providerMetadata:A.optional()}),O({type:I("source-url"),sourceId:b(),url:b(),title:b().optional(),providerMetadata:A.optional()}),O({type:I("source-document"),sourceId:b(),mediaType:b(),title:b(),filename:b().optional(),providerMetadata:A.optional()}),O({type:I("file"),url:b(),mediaType:b(),providerMetadata:A.optional()}),O({type:ca(t=>typeof t=="string"&&t.startsWith("data-"),{message:'Type must start with "data-"'}),id:b().optional(),data:ie(),transient:z().optional()}),O({type:I("start-step")}),O({type:I("finish-step")}),O({type:I("start"),messageId:b().optional(),messageMetadata:ie().optional()}),O({type:I("finish"),finishReason:cs(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:ie().optional()}),O({type:I("abort"),reason:b().optional()}),O({type:I("message-metadata"),messageMetadata:ie()})])));function fo(t){return t.type.startsWith("data-")}function ft(t){return t.type.startsWith("tool-")}function ho(t){return t.type==="dynamic-tool"}function ht(t){return ft(t)||ho(t)}function ra(t){return t.type.split("-").slice(1).join("-")}function go({lastMessage:t,messageId:e}){return{message:t?.role==="assistant"?t:{id:e,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function vo({stream:t,messageMetadataSchema:e,dataPartSchemas:a,runUpdateMessageJob:s,onError:r,onToolCall:o,onData:i}){return t.pipeThrough(new TransformStream({async transform(n,c){await s(async({state:l,write:p})=>{var m,h,v,y;function _(u){const T=l.message.parts.filter(ht).find(N=>N.toolCallId===u);if(T==null)throw new he({chunkType:"tool-invocation",chunkId:u,message:`No tool invocation found for tool call ID "${u}".`});return T}function g(u){var E;const T=l.message.parts.find(P=>ft(P)&&P.toolCallId===u.toolCallId),N=u,C=T;T!=null?(T.state=u.state,C.input=N.input,C.output=N.output,C.errorText=N.errorText,C.rawInput=N.rawInput,C.preliminary=N.preliminary,u.title!==void 0&&(C.title=u.title),C.providerExecuted=(E=N.providerExecuted)!=null?E:T.providerExecuted,N.providerMetadata!=null&&(T.callProviderMetadata=N.providerMetadata)):l.message.parts.push({type:`tool-${u.toolName}`,toolCallId:u.toolCallId,state:u.state,title:u.title,input:N.input,output:N.output,rawInput:N.rawInput,errorText:N.errorText,providerExecuted:N.providerExecuted,preliminary:N.preliminary,...N.providerMetadata!=null?{callProviderMetadata:N.providerMetadata}:{}})}function f(u){var E,T;const N=l.message.parts.find($=>$.type==="dynamic-tool"&&$.toolCallId===u.toolCallId),C=u,P=N;N!=null?(N.state=u.state,P.toolName=u.toolName,P.input=C.input,P.output=C.output,P.errorText=C.errorText,P.rawInput=(E=C.rawInput)!=null?E:P.rawInput,P.preliminary=C.preliminary,u.title!==void 0&&(P.title=u.title),P.providerExecuted=(T=C.providerExecuted)!=null?T:N.providerExecuted,C.providerMetadata!=null&&(N.callProviderMetadata=C.providerMetadata)):l.message.parts.push({type:"dynamic-tool",toolName:u.toolName,toolCallId:u.toolCallId,state:u.state,input:C.input,output:C.output,errorText:C.errorText,preliminary:C.preliminary,providerExecuted:C.providerExecuted,title:u.title,...C.providerMetadata!=null?{callProviderMetadata:C.providerMetadata}:{}})}async function x(u){if(u!=null){const E=l.message.metadata!=null?Ba(l.message.metadata,u):u;e!=null&&await aa({value:E,schema:e,context:{field:"message.metadata",entityId:l.message.id}}),l.message.metadata=E}}switch(n.type){case"text-start":{const u={type:"text",text:"",providerMetadata:n.providerMetadata,state:"streaming"};l.activeTextParts[n.id]=u,l.message.parts.push(u),p();break}case"text-delta":{const u=l.activeTextParts[n.id];if(u==null)throw new he({chunkType:"text-delta",chunkId:n.id,message:`Received text-delta for missing text part with ID "${n.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});u.text+=n.delta,u.providerMetadata=(m=n.providerMetadata)!=null?m:u.providerMetadata,p();break}case"text-end":{const u=l.activeTextParts[n.id];if(u==null)throw new he({chunkType:"text-end",chunkId:n.id,message:`Received text-end for missing text part with ID "${n.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});u.state="done",u.providerMetadata=(h=n.providerMetadata)!=null?h:u.providerMetadata,delete l.activeTextParts[n.id],p();break}case"reasoning-start":{const u={type:"reasoning",text:"",providerMetadata:n.providerMetadata,state:"streaming"};l.activeReasoningParts[n.id]=u,l.message.parts.push(u),p();break}case"reasoning-delta":{const u=l.activeReasoningParts[n.id];if(u==null)throw new he({chunkType:"reasoning-delta",chunkId:n.id,message:`Received reasoning-delta for missing reasoning part with ID "${n.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});u.text+=n.delta,u.providerMetadata=(v=n.providerMetadata)!=null?v:u.providerMetadata,p();break}case"reasoning-end":{const u=l.activeReasoningParts[n.id];if(u==null)throw new he({chunkType:"reasoning-end",chunkId:n.id,message:`Received reasoning-end for missing reasoning part with ID "${n.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});u.providerMetadata=(y=n.providerMetadata)!=null?y:u.providerMetadata,u.state="done",delete l.activeReasoningParts[n.id],p();break}case"file":{l.message.parts.push({type:"file",mediaType:n.mediaType,url:n.url}),p();break}case"source-url":{l.message.parts.push({type:"source-url",sourceId:n.sourceId,url:n.url,title:n.title,providerMetadata:n.providerMetadata}),p();break}case"source-document":{l.message.parts.push({type:"source-document",sourceId:n.sourceId,mediaType:n.mediaType,title:n.title,filename:n.filename,providerMetadata:n.providerMetadata}),p();break}case"tool-input-start":{const u=l.message.parts.filter(ft);l.partialToolCalls[n.toolCallId]={text:"",toolName:n.toolName,index:u.length,dynamic:n.dynamic,title:n.title},n.dynamic?f({toolCallId:n.toolCallId,toolName:n.toolName,state:"input-streaming",input:void 0,providerExecuted:n.providerExecuted,title:n.title,providerMetadata:n.providerMetadata}):g({toolCallId:n.toolCallId,toolName:n.toolName,state:"input-streaming",input:void 0,providerExecuted:n.providerExecuted,title:n.title,providerMetadata:n.providerMetadata}),p();break}case"tool-input-delta":{const u=l.partialToolCalls[n.toolCallId];if(u==null)throw new he({chunkType:"tool-input-delta",chunkId:n.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${n.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});u.text+=n.inputTextDelta;const{value:E}=await je(u.text);u.dynamic?f({toolCallId:n.toolCallId,toolName:u.toolName,state:"input-streaming",input:E,title:u.title}):g({toolCallId:n.toolCallId,toolName:u.toolName,state:"input-streaming",input:E,title:u.title}),p();break}case"tool-input-available":{n.dynamic?f({toolCallId:n.toolCallId,toolName:n.toolName,state:"input-available",input:n.input,providerExecuted:n.providerExecuted,providerMetadata:n.providerMetadata,title:n.title}):g({toolCallId:n.toolCallId,toolName:n.toolName,state:"input-available",input:n.input,providerExecuted:n.providerExecuted,providerMetadata:n.providerMetadata,title:n.title}),p(),o&&!n.providerExecuted&&await o({toolCall:n});break}case"tool-input-error":{n.dynamic?f({toolCallId:n.toolCallId,toolName:n.toolName,state:"output-error",input:n.input,errorText:n.errorText,providerExecuted:n.providerExecuted,providerMetadata:n.providerMetadata}):g({toolCallId:n.toolCallId,toolName:n.toolName,state:"output-error",input:void 0,rawInput:n.input,errorText:n.errorText,providerExecuted:n.providerExecuted,providerMetadata:n.providerMetadata}),p();break}case"tool-approval-request":{const u=_(n.toolCallId);u.state="approval-requested",u.approval={id:n.approvalId},p();break}case"tool-output-denied":{const u=_(n.toolCallId);u.state="output-denied",p();break}case"tool-output-available":{const u=_(n.toolCallId);u.type==="dynamic-tool"?f({toolCallId:n.toolCallId,toolName:u.toolName,state:"output-available",input:u.input,output:n.output,preliminary:n.preliminary,providerExecuted:n.providerExecuted,title:u.title}):g({toolCallId:n.toolCallId,toolName:ra(u),state:"output-available",input:u.input,output:n.output,providerExecuted:n.providerExecuted,preliminary:n.preliminary,title:u.title}),p();break}case"tool-output-error":{const u=_(n.toolCallId);u.type==="dynamic-tool"?f({toolCallId:n.toolCallId,toolName:u.toolName,state:"output-error",input:u.input,errorText:n.errorText,providerExecuted:n.providerExecuted,title:u.title}):g({toolCallId:n.toolCallId,toolName:ra(u),state:"output-error",input:u.input,rawInput:u.rawInput,errorText:n.errorText,providerExecuted:n.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":{n.messageId!=null&&(l.message.id=n.messageId),await x(n.messageMetadata),(n.messageId!=null||n.messageMetadata!=null)&&p();break}case"finish":{n.finishReason!=null&&(l.finishReason=n.finishReason),await x(n.messageMetadata),n.messageMetadata!=null&&p();break}case"message-metadata":{await x(n.messageMetadata),n.messageMetadata!=null&&p();break}case"error":{r?.(new Error(n.errorText));break}default:if(fo(n)){if(a?.[n.type]!=null){const T=l.message.parts.findIndex(C=>"id"in C&&"data"in C&&C.id===n.id&&C.type===n.type),N=T>=0?T:l.message.parts.length;await aa({value:n.data,schema:a[n.type],context:{field:`message.parts[${N}].data`,entityName:n.type,entityId:n.id}})}const u=n;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(n)})}}))}async function yo({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()}}Me({prefix:"aitxt",size:24});Me({prefix:"aiobj",size:24});var xo=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()})}};Me({prefix:"aiobj",size:24});async function bo(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((o,i)=>{const n=new FileReader;n.onload=c=>{var l;o((l=c.target)==null?void 0:l.result)},n.onerror=c=>i(c),n.readAsDataURL(e)});return{type:"file",mediaType:s,filename:a,url:r}}))}var _o=class{constructor({api:t="/api/chat",credentials:e,headers:a,body:s,fetch:r,prepareSendMessagesRequest:o,prepareReconnectToStreamRequest:i}){this.api=t,this.credentials=e,this.headers=a,this.body=s,this.fetch=r,this.prepareSendMessagesRequest=o,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:t,...e}){var a,s,r,o,i;const n=await ce(this.body),c=await ce(this.headers),l=await ce(this.credentials),p={...me(c),...me(e.headers)},m=await((a=this.prepareSendMessagesRequest)==null?void 0:a.call(this,{api:this.api,id:e.chatId,messages:e.messages,body:{...n,...e.body},headers:p,credentials:l,requestMetadata:e.metadata,trigger:e.trigger,messageId:e.messageId})),h=(s=m?.api)!=null?s:this.api,v=m?.headers!==void 0?me(m.headers):p,y=m?.body!==void 0?m.body:{...n,...e.body,id:e.chatId,messages:e.messages,trigger:e.trigger,messageId:e.messageId},_=(r=m?.credentials)!=null?r:l,f=await((o=this.fetch)!=null?o:globalThis.fetch)(h,{method:"POST",headers:Xt({"Content-Type":"application/json",...v},`ai-sdk/${sa}`,Qt()),body:JSON.stringify(y),credentials:_,signal:t});if(!f.ok)throw new Error((i=await f.text())!=null?i:"Failed to fetch the chat response.");if(!f.body)throw new Error("The response body is empty.");return this.processResponseStream(f.body)}async reconnectToStream(t){var e,a,s,r,o;const i=await ce(this.body),n=await ce(this.headers),c=await ce(this.credentials),l={...me(n),...me(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`,h=p?.headers!==void 0?me(p.headers):l,v=(s=p?.credentials)!=null?s:c,_=await((r=this.fetch)!=null?r:globalThis.fetch)(m,{method:"GET",headers:Xt(h,`ai-sdk/${sa}`,Qt()),credentials:v});if(_.status===204)return null;if(!_.ok)throw new Error((o=await _.text())!=null?o:"Failed to fetch the chat response.");if(!_.body)throw new Error("The response body is empty.");return this.processResponseStream(_.body)}},Va=class extends _o{constructor(t={}){super(t)}processResponseStream(t){return Vr({stream:t,schema:mo}).pipeThrough(new TransformStream({async transform(e,a){if(!e.success)throw e.error;a.enqueue(e.value)}}))}},Eo=class{constructor({generateId:t=Ws,id:e=t(),transport:a=new Va,messageMetadataSchema:s,dataPartSchemas:r,state:o,onError:i,onToolCall:n,onFinish:c,onData:l,sendAutomaticallyWhen:p}){this.activeResponse=void 0,this.jobExecutor=new xo,this.sendMessage=async(m,h)=>{var v,y,_,g;if(m==null){await this.makeRequest({trigger:"submit-message",messageId:(v=this.lastMessage)==null?void 0:v.id,...h});return}let f;if("text"in m||"files"in m?f={parts:[...Array.isArray(m.files)?m.files:await bo(m.files),..."text"in m&&m.text!=null?[{type:"text",text:m.text}]:[]]}:f=m,m.messageId!=null){const x=this.state.messages.findIndex(u=>u.id===m.messageId);if(x===-1)throw new Error(`message with id ${m.messageId} not found`);if(this.state.messages[x].role!=="user")throw new Error(`message with id ${m.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,x+1),this.state.replaceMessage(x,{...f,id:m.messageId,role:(y=f.role)!=null?y:"user",metadata:m.metadata})}else this.state.pushMessage({...f,id:(_=f.id)!=null?_:this.generateId(),role:(g=f.role)!=null?g:"user",metadata:m.metadata});await this.makeRequest({trigger:"submit-message",messageId:m.messageId,...h})},this.regenerate=async({messageId:m,...h}={})=>{const v=m==null?this.state.messages.length-1:this.state.messages.findIndex(y=>y.id===m);if(v===-1)throw new Error(`message ${m} not found`);this.state.messages=this.state.messages.slice(0,this.messages[v].role==="assistant"?v:v+1),await this.makeRequest({trigger:"regenerate-message",messageId:m,...h})},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:h,reason:v})=>this.jobExecutor.run(async()=>{const y=this.state.messages,_=y[y.length-1],g=f=>ht(f)&&f.state==="approval-requested"&&f.approval.id===m?{...f,state:"approval-responded",approval:{id:m,approved:h,reason:v}}:f;this.state.replaceMessage(y.length-1,{..._,parts:_.parts.map(g)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(g)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(f=>{var x;f&&this.makeRequest({trigger:"submit-message",messageId:(x=this.lastMessage)==null?void 0:x.id})})}),this.addToolOutput=async({state:m="output-available",tool:h,toolCallId:v,output:y,errorText:_})=>this.jobExecutor.run(async()=>{const g=this.state.messages,f=g[g.length-1],x=u=>ht(u)&&u.toolCallId===v?{...u,state:m,output:y,errorText:_}:u;this.state.replaceMessage(g.length-1,{...f,parts:f.parts.map(x)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(x)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(u=>{var E;u&&this.makeRequest({trigger:"submit-message",messageId:(E=this.lastMessage)==null?void 0:E.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=o,this.onError=i,this.onToolCall=n,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 shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;const t=this.sendAutomaticallyWhen({messages:this.state.messages});return t&&typeof t=="object"&&"then"in t?await t:t}async makeRequest({trigger:t,metadata:e,headers:a,body:s,messageId:r}){var o,i,n;this.setStatus({status:"submitted",error:void 0});const c=this.lastMessage;let l=!1,p=!1,m=!1;try{const h={state:go({lastMessage:this.state.snapshot(c),messageId:this.generateId()}),abortController:new AbortController};h.abortController.signal.addEventListener("abort",()=>{l=!0}),this.activeResponse=h;let v;if(t==="resume-stream"){const _=await this.transport.reconnectToStream({chatId:this.id,metadata:e,headers:a,body:s});if(_==null){this.setStatus({status:"ready"});return}v=_}else v=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:h.abortController.signal,metadata:e,headers:a,body:s,trigger:t,messageId:r});const y=_=>this.jobExecutor.run(()=>_({state:h.state,write:()=>{var g;this.setStatus({status:"streaming"}),h.state.message.id===((g=this.lastMessage)==null?void 0:g.id)?this.state.replaceMessage(this.state.messages.length-1,h.state.message):this.state.pushMessage(h.state.message)}}));await yo({stream:vo({stream:v,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:y,onError:_=>{throw _}}),onError:_=>{throw _}}),this.setStatus({status:"ready"})}catch(h){if(l||h.name==="AbortError")return l=!0,this.setStatus({status:"ready"}),null;m=!0,h instanceof TypeError&&(h.message.toLowerCase().includes("fetch")||h.message.toLowerCase().includes("network"))&&(p=!0),this.onError&&h instanceof Error&&this.onError(h),this.setStatus({status:"error",error:h})}finally{try{(i=this.onFinish)==null||i.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:l,isDisconnect:p,isError:m,finishReason:(o=this.activeResponse)==null?void 0:o.state.finishReason})}catch(h){console.error(h)}this.activeResponse=void 0}!m&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:(n=this.lastMessage)==null?void 0:n.id,metadata:e,headers:a,body:s})}},ct,oa;function Io(){if(oa)return ct;oa=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 n=Date.now(),c=n-r,l=a-c;l<=0?(r=n,e.apply(this,i)):s=setTimeout(()=>{r=Date.now(),e.apply(this,i)},l)}}return ct=t,ct}var So=Io();const wo=ds(So);var qa=(t,e,a)=>{if(!e.has(t))throw TypeError("Cannot "+a)},D=(t,e,a)=>(qa(t,e,"read from private field"),a?a.call(t):e.get(t)),ee=(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)},le=(t,e,a,s)=>(qa(t,e,"write to private field"),e.set(t,a),a);function No(t,e){return e!=null?wo(t,e):t}var H,Be,Ve,be,_e,Ee,ge,gt,vt,Co=class{constructor(t=[]){ee(this,H,void 0),ee(this,Be,"ready"),ee(this,Ve,void 0),ee(this,be,new Set),ee(this,_e,new Set),ee(this,Ee,new Set),this.pushMessage=e=>{le(this,H,D(this,H).concat(e)),D(this,ge).call(this)},this.popMessage=()=>{le(this,H,D(this,H).slice(0,-1)),D(this,ge).call(this)},this.replaceMessage=(e,a)=>{le(this,H,[...D(this,H).slice(0,e),this.snapshot(a),...D(this,H).slice(e+1)]),D(this,ge).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,a)=>{const s=a?No(e,a):e;return D(this,be).add(s),()=>{D(this,be).delete(s)}},this["~registerStatusCallback"]=e=>(D(this,_e).add(e),()=>{D(this,_e).delete(e)}),this["~registerErrorCallback"]=e=>(D(this,Ee).add(e),()=>{D(this,Ee).delete(e)}),ee(this,ge,()=>{D(this,be).forEach(e=>e())}),ee(this,gt,()=>{D(this,_e).forEach(e=>e())}),ee(this,vt,()=>{D(this,Ee).forEach(e=>e())}),le(this,H,t)}get status(){return D(this,Be)}set status(t){le(this,Be,t),D(this,gt).call(this)}get error(){return D(this,Ve)}set error(t){le(this,Ve,t),D(this,vt).call(this)}get messages(){return D(this,H)}set messages(t){le(this,H,[...t]),D(this,ge).call(this)}};H=new WeakMap;Be=new WeakMap;Ve=new WeakMap;be=new WeakMap;_e=new WeakMap;Ee=new WeakMap;ge=new WeakMap;gt=new WeakMap;vt=new WeakMap;var ve,na=class extends Eo{constructor({messages:t,...e}){const a=new Co(t);super({...e,state:a}),ee(this,ve,void 0),this["~registerMessagesCallback"]=(s,r)=>D(this,ve)["~registerMessagesCallback"](s,r),this["~registerStatusCallback"]=s=>D(this,ve)["~registerStatusCallback"](s),this["~registerErrorCallback"]=s=>D(this,ve)["~registerErrorCallback"](s),le(this,ve,a)}};ve=new WeakMap;function To({experimental_throttle:t,resume:e=!1,...a}={}){const s=S.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:h=>{var v,y;return(y=(v=s.current).onToolCall)==null?void 0:y.call(v,h)},onData:h=>{var v,y;return(y=(v=s.current).onData)==null?void 0:y.call(v,h)},onFinish:h=>{var v,y;return(y=(v=s.current).onFinish)==null?void 0:y.call(v,h)},onError:h=>{var v,y;return(y=(v=s.current).onError)==null?void 0:y.call(v,h)},sendAutomaticallyWhen:h=>{var v,y,_;return(_=(y=(v=s.current).sendAutomaticallyWhen)==null?void 0:y.call(v,h))!=null?_:!1}},o=S.useRef("chat"in a?a.chat:new na(r));("chat"in a&&a.chat!==o.current||"id"in a&&o.current.id!==a.id)&&(o.current="chat"in a?a.chat:new na(r));const n=S.useCallback(h=>o.current["~registerMessagesCallback"](h,t),[t,o.current.id]),c=S.useSyncExternalStore(n,()=>o.current.messages,()=>o.current.messages),l=S.useSyncExternalStore(o.current["~registerStatusCallback"],()=>o.current.status,()=>o.current.status),p=S.useSyncExternalStore(o.current["~registerErrorCallback"],()=>o.current.error,()=>o.current.error),m=S.useCallback(h=>{typeof h=="function"&&(h=h(o.current.messages)),o.current.messages=h},[o]);return S.useEffect(()=>{e&&o.current.resumeStream()},[e,o]),{id:o.current.id,messages:c,setMessages:m,sendMessage:o.current.sendMessage,regenerate:o.current.regenerate,clearError:o.current.clearError,stop:o.current.stop,error:p,resumeStream:o.current.resumeStream,status:l,addToolResult:o.current.addToolOutput,addToolOutput:o.current.addToolOutput,addToolApprovalResponse:o.current.addToolApprovalResponse}}function At(){const t=k.c(21),{locator:e,org:a}=xe();let s;t[0]!==e?(s=Ae.allowedModels(e),t[0]=e,t[1]=s):s=t[1];let r;t[2]!==a?(r=async()=>{const g=await fetch(`/api/${a.slug}/decopilot/allowed-models`,{credentials:"include"});return g.ok?g.json():{allowAll:!0,models:{}}},t[2]=a,t[3]=r):r=t[3];let o;t[4]!==s||t[5]!==r?(o={queryKey:s,queryFn:r,staleTime:3e4},t[4]=s,t[5]=r,t[6]=o):o=t[6];const{data:i,isLoading:n}=Es(o),c=i?.allowAll??!0;let l;t[7]!==i?.models?(l=i?.models??{},t[7]=i?.models,t[8]=l):l=t[8];const p=l;let m;t[9]!==c||t[10]!==p?(m=(g,f)=>{if(c)return!0;const x=p[g];return x?x.includes("*")||x.includes(f):p["*"]?.includes("*")??!1},t[9]=c,t[10]=p,t[11]=m):m=t[11];const h=m;let v;t[12]!==c||t[13]!==p?(v=g=>{if(c)return!0;const f=p[g];if(f&&f.length>0)return!0;const x=p["*"];return x?x.length>0:!1},t[12]=c,t[13]=p,t[14]=v):v=t[14];const y=v;let _;return t[15]!==c||t[16]!==y||t[17]!==n||t[18]!==h||t[19]!==p?(_={allowAll:c,models:p,isLoading:n,isModelAllowed:h,hasConnectionModels:y},t[15]=c,t[16]=y,t[17]=n,t[18]=h,t[19]=p,t[20]=_):_=t[20],_}function Ao(t){const e=k.c(10);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[0]=a):a=e[0];const s=da(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 o;e[6]!==s.collectionName||e[7]!==s.connectionId||e[8]!==s.itemId?(o=[],s.connectionId&&o.push(`- Connection ID: ${s.connectionId}`),s.collectionName&&o.push(`- Collection: ${s.collectionName}`),s.itemId&&o.push(`- Item ID: ${s.itemId}`),e[6]=s.collectionName,e[7]=s.connectionId,e[8]=s.itemId,e[9]=o):o=e[9],o.length>0&&r.push(`### Current Resource
|
|
13
|
+
The user is viewing the following resource:
|
|
14
|
+
${o.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
|
+
`)}function Mo(){const t=k.c(2),e=xt();let a;return t[0]!==e?(a={prefillCollectionCache:(r,o,i,n)=>{if(!r)return;const c=wt(r,o,i,n);if(e.getQueryData(c))return;const p={structuredContent:{items:[]},isError:!1};e.setQueryData(c,p)}},t[0]=e,t[1]=a):a=t[1],a}const re={THREAD_MESSAGES_PAGE_SIZE:100,THREADS_PAGE_SIZE:50,QUERY_STALE_TIME:3e4};function ia(t,e,a,s){const r=Ae.threads(e),o=t.getQueryData(r);if(!o)return;const i=o.pages.map(c=>{const l=c.items.findIndex(v=>v.id===a);if(l===-1)return c;const p=[...c.items],m=p[l];if(!m)return c;const h={id:m.id,title:s.title??m.title,createdAt:m.createdAt,updatedAt:s.updatedAt??m.updatedAt,hidden:s.hidden??m.hidden};return p[l]=h,{...c,items:p}});i.some((c,l)=>c.items.length!==o.pages[l]?.items.length||c.items.some((p,m)=>p.id===a&&p!==o.pages[l]?.items[m]))&&t.setQueryData(r,{...o,pages:i})}function jo(t,e,a){const s=Ae.threads(e),r=t.getQueryData(s);if(!r){t.setQueryData(s,{pages:[{items:[a],hasMore:!1,totalCount:1}],pageParams:[0]});return}if(r.pages.some(n=>n.items.some(c=>c.id===a.id)))return;const i=r.pages[0];if(i){const n={...i,items:[a,...i.items],totalCount:(i.totalCount??i.items.length)+1};t.setQueryData(s,{...r,pages:[n,...r.pages.slice(1)]})}else t.setQueryData(s,{...r,pages:[{items:[a],hasMore:!1,totalCount:1}]})}async function Ro(t,e,a,s){if(!e)return;const r=wt(e,"THREAD_MESSAGES",a,{filters:[{column:"threadId",value:s}],pageSize:re.THREAD_MESSAGES_PAGE_SIZE});if(!r||t.getQueryData(r))return;const i="COLLECTION_THREAD_MESSAGES_LIST",n=Is(void 0,[{column:"threadId",value:s}],[]),c=Ss(void 0,void 0,"updated_at"),l={...n&&{where:n},...c&&{orderBy:c},limit:re.THREAD_MESSAGES_PAGE_SIZE,offset:0};await t.fetchQuery({queryKey:r,queryFn:async()=>await e.callTool({name:i,arguments:l}),staleTime:re.QUERY_STALE_TIME,retry:!1})}function Po(t,e,a,s,r){if(!e)return;const o=wt(e,"THREAD_MESSAGES",a,{filters:[{column:"threadId",value:s}],pageSize:re.THREAD_MESSAGES_PAGE_SIZE});o&&t.setQueryData(o,{structuredContent:{items:r},isError:!1})}async function ko(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}function Oo(t){const e=new Date().toISOString();return{id:t,title:"New chat",createdAt:e,updatedAt:e}}function Do(t,e){return t.find(a=>a.id!==e)??null}function $o(){const t=k.c(17),{locator:e,org:a}=xe();let s;t[0]!==a.id?(s={connectionId:It,orgId:a.id},t[0]=a.id,t[1]=s):s=t[1];const r=Et(s);let o;t[2]!==e?(o=Ae.threads(e),t[2]=e,t[3]=o):o=t[3];let i;t[4]!==r?(i=async g=>{const{pageParam:f}=g,x=f===void 0?0:f;if(!r)throw new Error("MCP client is not available");const u={limit:re.THREADS_PAGE_SIZE,offset:x},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 n;t[6]!==o||t[7]!==i?(n={queryKey:o,queryFn:i,getNextPageParam:Zo,initialPageParam:0,staleTime:re.QUERY_STALE_TIME},t[6]=o,t[7]=i,t[8]=n):n=t[8];const{data:c,fetchNextPage:l,hasNextPage:p,isFetchingNextPage:m,refetch:h}=Ns(n);let v;t[9]!==c?.pages?(v=c?.pages.flatMap(Lo)??[],t[9]=c?.pages,t[10]=v):v=t[10];const y=v;let _;return t[11]!==l||t[12]!==p||t[13]!==m||t[14]!==h||t[15]!==y?(_={threads:y,refetch:h,hasNextPage:p,isFetchingNextPage:m,fetchNextPage:l},t[11]=l,t[12]=p,t[13]=m,t[14]=h,t[15]=y,t[16]=_):_=t[16],_}function Lo(t){return t.items}function Zo(t,e){if(t.hasMore)return e.length*re.THREADS_PAGE_SIZE}function Fo(t){const e=k.c(6),{org:a}=xe();let s;e[0]!==a.id?(s={connectionId:It,orgId:a.id},e[0]=a.id,e[1]=s):s=e[1];const r=Et(s);let o;e[2]!==t?(o={filters:t?[{column:"threadId",value:t}]:[],pageSize:re.THREAD_MESSAGES_PAGE_SIZE},e[2]=t,e[3]=o):o=e[3];const i=ws(a.id,"THREAD_MESSAGES",r,o);let n;return e[4]!==i?(n=i??[],e[4]=i,e[5]=n):n=e[5],n}function Uo(){const{locator:t,org:e}=xe(),a=xt(),{prefillCollectionCache:s}=Mo(),{threads:r,hasNextPage:o,isFetchingNextPage:i,fetchNextPage:n}=$o(),c=Et({connectionId:It,orgId:e.id}),[l,p]=Se(We.assistantChatActiveThread(t),r[0]?.id??crypto.randomUUID()),m=Fo(l),h=()=>{const f=crypto.randomUUID(),x=Oo(f);jo(a,t,x),c&&s(c,"THREAD_MESSAGES",e.id,{filters:[{column:"threadId",value:f}],pageSize:re.THREAD_MESSAGES_PAGE_SIZE}),p(f)},v=async f=>{await Ro(a,c,e.id,f),p(f)};return{threads:r,activeThreadId:l,messages:m,hasNextPage:o,isFetchingNextPage:i,fetchNextPage:n,createThread:h,switchThread:v,updateThread:(f,x)=>{ia(a,t,f,x)},hideThread:async f=>{try{const x=await ko(c,f,{hidden:!0});if(x){if(f===l){const E=Do(r,f);E?await v(E.id):h()}ia(a,t,f,{hidden:!0,updatedAt:x.updatedAt??new Date().toISOString()})}}catch(x){const u=x;bt.error(`Failed to update thread: ${u.message}`),console.error("[chat] Failed to update thread:",x)}},updateMessagesCache:(f,x)=>{Po(a,c,e.id,f,x)}}}function zo(){const t=k.c(5),e=xt(),{org:a}=xe();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},t[0]=s):s=t[0];const r=da(s);let o;return t[1]!==a||t[2]!==r||t[3]!==e?(o=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:Ae.collection(a.slug,p,l)});const m=l.toLowerCase().replace(/_/g," ");bt.success(`${m} updated`)},t[1]=a,t[2]=r,t[3]=e,t[4]=o):o=t[4],o}function Z(t){const e=k.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=Nt("bg-accent animate-pulse rounded-md",a),e[3]=a,e[4]=r):r=e[4];let o;return e[5]!==s||e[6]!==r?(o=d.jsx("div",{"data-slot":"skeleton",className:r,...s}),e[5]=s,e[6]=r,e[7]=o):o=e[7],o}const Bo=["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"],yt=new Map;Bo.forEach((t,e)=>{yt.set(t,e)});function Mt(t){const e=k.c(3);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={pageSize:999},e[0]=a):a=e[0];const s=_s(t??void 0,a);let r;return e[1]!==s?(r=s.filter(qo).sort(Vo),e[1]=s,e[2]=r):r=e[2],r}function Vo(t,e){const a=yt.get(t.id),s=yt.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 qo(t){return t.limits?.contextWindow&&t.limits?.maxOutputTokens}const Ho={reasoning:{icon:d.jsx(ya,{className:"size-4"}),label:"Reasoning"},"image-upload":{icon:d.jsx(Zs,{className:"size-4"}),label:"Can analyze images"},"file-upload":{icon:d.jsx($s,{className:"size-4"}),label:"Can analyze files"},"web-search":{icon:d.jsx(ma,{className:"size-4"}),label:"Can search the web to answer questions"}};function Ha(t){const e=k.c(10),{capability:a}=t,s=Ho[a];let r,o;e[0]!==a||e[1]!==s?(r=s||{icon:null,label:a},o=r.label.split("-").map(Wo).join(" "),e[0]=a,e[1]=s,e[2]=r,e[3]=o):(r=e[2],o=e[3]);const i=o;let n;e[4]===Symbol.for("react.memo_cache_sentinel")?(n={backgroundColor:"color-mix(in oklch, var(--chart-1) 15%, transparent)",color:"var(--chart-1)"},e[4]=n):n=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:n,children:[r.icon,c]}),e[7]=r.icon,e[8]=c,e[9]=l):l=e[9],l}function Wo(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Jo(t){const e=k.c(53),{model:a,compact:s}=t,r=s===void 0?!1:s;if(!a){let g;return e[0]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),e[0]=g):g=e[0],g}const o=a.limits?.contextWindow||a.costs?.input||a.costs?.output||a.limits?.maxOutputTokens;if(!o&&!r){let g;e[1]!==a.logo||e[2]!==a.title?(g=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]=g):g=e[3];let f;e[4]!==a.title?(f=d.jsx("p",{className:"text-lg font-medium leading-7",children:a.title}),e[4]=a.title,e[5]=f):f=e[5];let x;e[6]!==g||e[7]!==f?(x=d.jsxs("div",{className:"flex items-center gap-3 py-2 px-0",children:[g,f]}),e[6]=g,e[7]=f,e[8]=x):x=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]!==x||e[12]!==u?(E=d.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[x,u]}),e[11]=x,e[12]=u,e[13]=E):E=e[13],E}if(!o&&r)return null;if(r){let g;e[14]!==a.limits?(g=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]=g):g=e[15];let f;e[16]!==a.costs?(f=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]=f):f=e[17];let x;e[18]!==a.costs?(x=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]=x):x=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]!==g||e[23]!==f||e[24]!==x||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:[g,f,x,u]}),e[22]=g,e[23]=f,e[24]=x,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 n;e[30]!==a.title?(n=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]=n):n=e[31];let c;e[32]!==i||e[33]!==n?(c=d.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[i,n]}),e[32]=i,e[33]=n,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(Go)}),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(Ls,{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 h;e[42]!==a.costs?(h=(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(ha,{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]=h):h=e[43];let v;e[44]!==a.limits?(v=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(ga,{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]=v):v=e[45];let y;e[46]!==m||e[47]!==h||e[48]!==v?(y=d.jsxs("div",{className:"flex flex-col gap-4",children:[m,h,v]}),e[46]=m,e[47]=h,e[48]=v,e[49]=y):y=e[49];let _;return e[50]!==y||e[51]!==p?(_=d.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[p,y]}),e[50]=y,e[51]=p,e[52]=_):_=e[52],_}function Go(t){return d.jsx(Ha,{capability:t},t)}function Yo(t){const e=k.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 o;e[3]!==a.logo||e[4]!==a.title?(o=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]=o):o=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 n;e[8]!==a.capabilities?(n=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(Qo)}),e[8]=a.capabilities,e[9]=n):n=e[9];let c;return e[10]!==r||e[11]!==o||e[12]!==i||e[13]!==n?(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:[o,i,n]}),e[10]=r,e[11]=o,e[12]=i,e[13]=n,e[14]=c):c=e[14],c}function Qo(t){return d.jsx(Ha,{capability:t},t)}function Xo(t){const e=k.c(10),{error:a,onRetry:s}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:d.jsx(Ds,{className:"size-5 text-destructive"})}),e[0]=r):r=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=d.jsx("p",{className:"text-sm font-medium text-foreground",children:"Failed to load models"}),e[1]=o):o=e[1];const i=a?.message||"Could not fetch models from this provider.";let n;e[2]!==i?(n=d.jsxs("div",{className:"flex flex-col gap-1",children:[o,d.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[i," Try another provider or retry."]})]}),e[2]=i,e[3]=n):n=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(va,{className:"size-3.5"}),e[4]=c):c=e[4];let l;e[5]!==s?(l=d.jsxs(ua,{variant:"outline",size:"sm",onClick:s,className:"gap-1.5",children:[c,"Retry"]}),e[5]=s,e[6]=l):l=e[6];let p;return e[7]!==n||e[8]!==l?(p=d.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[r,n,l]}),e[7]=n,e[8]=l,e[9]=p):p=e[9],p}function Ko(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx("div",{className:"flex-1 overflow-y-auto px-0.5 pt-2 space-y-1",children:Array.from({length:6}).map(en)}),t[0]=e):e=t[0],e}function en(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 tn(t){const e=k.c(20),{connectionId:a,allowAll:s,isModelAllowed:r,searchTerm:o,selectedModel:i,onModelSelect:n,onHover:c}=t,l=Mt(a??void 0);let p;e[0]!==l||e[1]!==s||e[2]!==a||e[3]!==r?(p=s?l:l.filter(g=>a&&r(a,g.id)),e[0]=l,e[1]=s,e[2]=a,e[3]=r,e[4]=p):p=e[4];const m=p;let h;e[5]!==m||e[6]!==o?(h=o.trim()?m.filter(g=>{const f=o.toLowerCase();return g.title.toLowerCase().includes(f)||g.provider?.toLowerCase().includes(f)||g.description?.toLowerCase().includes(f)}):m,e[5]=m,e[6]=o,e[7]=h):h=e[7];const v=h;if(v.length===0){let g;return e[8]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx("div",{className:"flex-1 flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No models found"}),e[8]=g):g=e[8],g}let y;if(e[9]!==v||e[10]!==c||e[11]!==n||e[12]!==i?.id){let g;e[14]!==c||e[15]!==n||e[16]!==i?.id?(g=f=>{const x=f.id===i?.id;return d.jsx("div",{onClick:()=>n(f),className:Nt("rounded-lg mb-1",x&&"bg-accent"),children:d.jsx(Yo,{model:f,onHover:c})},f.id)},e[14]=c,e[15]=n,e[16]=i?.id,e[17]=g):g=e[17],y=v.map(g),e[9]=v,e[10]=c,e[11]=n,e[12]=i?.id,e[13]=y}else y=e[13];let _;return e[18]!==y?(_=d.jsx("div",{className:"flex-1 overflow-y-auto px-0.5 pt-2",children:y}),e[18]=y,e[19]=_):_=e[19],_}function jt(t){const e=k.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(dt,{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 o;e[5]!==a.logo||e[6]!==a.title?(o=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]=o):o=e[7];let i;e[8]!==a.title?(i=d.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground group-data-[state=open]:text-foreground truncate whitespace-nowrap max-w-0 opacity-0 group-hover:max-w-[150px] group-hover:opacity-100 group-data-[state=open]:max-w-[150px] group-data-[state=open]:opacity-100 transition-all duration-200 ease-in-out overflow-hidden",children:a.title}),e[8]=a.title,e[9]=i):i=e[9];let n;e[10]===Symbol.for("react.memo_cache_sentinel")?(n=d.jsx(dt,{size:14,className:"text-muted-foreground opacity-0 max-w-0 group-hover:opacity-50 group-hover:max-w-[14px] group-data-[state=open]:opacity-50 group-data-[state=open]:max-w-[14px] shrink-0 transition-all duration-200 ease-in-out overflow-hidden"}),e[10]=n):n=e[10];let c;return e[11]!==o||e[12]!==i?(c=d.jsxs("div",{className:"flex items-center gap-0 group-hover:gap-2 group-data-[state=open]:gap-2 min-w-0 overflow-hidden transition-all duration-200",children:[o,i,n]}),e[11]=o,e[12]=i,e[13]=c):c=e[13],c}function qn(t){return t?.capabilities?.includes("vision")===!0}function an(){const t=k.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(sn)})]}),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 o;t[4]===Symbol.for("react.memo_cache_sentinel")?(o=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]=o):o=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:[o,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 sn(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 rn(t){const e=k.c(40),{selectedModel:a,onModelChange:s,onClose:r,modelsConnections:o}=t,[i,n]=S.useState(null),[c,l]=S.useState(""),p=S.useRef(null),[m,h]=S.useState(a?.connectionId??null),v=St(),y=o??v,{isModelAllowed:_,allowAll:g,hasConnectionModels:f}=At();let x;e[0]!==y||e[1]!==g||e[2]!==f?(x=g?y:y.filter(q=>f(q.id)),e[0]=y,e[1]=g,e[2]=f,e[3]=x):x=e[3];const u=x;let E,T;e[4]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{setTimeout(()=>{p.current?.focus()},0)},T=[],e[4]=E,e[5]=T):(E=e[4],T=e[5]),S.useEffect(E,T);let N;e[6]===Symbol.for("react.memo_cache_sentinel")?(N=q=>{h(q),n(null)},e[6]=N):N=e[6];const C=N;let P;e[7]!==r||e[8]!==s||e[9]!==m?(P=q=>{m&&(s({id:q.id,connectionId:m,provider:q.provider??void 0}),l(""),r())},e[7]=r,e[8]=s,e[9]=m,e[10]=P):P=e[10];const $=P;let F;e[11]===Symbol.for("react.memo_cache_sentinel")?(F=d.jsx(ma,{size:16,className:"text-muted-foreground shrink-0"}),e[11]=F):F=e[11];let ae;e[12]===Symbol.for("react.memo_cache_sentinel")?(ae=q=>l(q.target.value),e[12]=ae):ae=e[12];let Q;e[13]!==c?(Q=d.jsx(Cs,{ref:p,type:"text",placeholder:"Search for a model...",value:c,onChange:ae,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]=Q):Q=e[14];let W;e[15]!==u||e[16]!==m?(W=u.length>0&&d.jsxs(js,{value:m??"",onValueChange:C,children:[d.jsxs(Rs,{size:"sm",className:"w-auto min-w-[140px] h-8 shrink-0 [&>svg:last-child]:hidden",onClick:ln,children:[d.jsx(Ps,{placeholder:"Select connection"}),d.jsx(fa,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),d.jsx(ks,{children:u.map(nn)})]}),e[15]=u,e[16]=m,e[17]=W):W=e[17];let X;e[18]!==Q||e[19]!==W?(X=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:[F,Q,W]})}),e[18]=Q,e[19]=W,e[20]=X):X=e[20];let se;e[21]===Symbol.for("react.memo_cache_sentinel")?(se=d.jsx(Ko,{}),e[21]=se):se=e[21];let K;e[22]!==g||e[23]!==$||e[24]!==_||e[25]!==c||e[26]!==m||e[27]!==a?(K=d.jsx(S.Suspense,{fallback:se,children:d.jsx(tn,{connectionId:m,allowAll:g,isModelAllowed:_,searchTerm:c,selectedModel:a,onModelSelect:$,onHover:n})}),e[22]=g,e[23]=$,e[24]=_,e[25]=c,e[26]=m,e[27]=a,e[28]=K):K=e[28];let oe;e[29]!==m||e[30]!==K?(oe=d.jsx(pa,{fallback:on,children:K},m),e[29]=m,e[30]=K,e[31]=oe):oe=e[31];let J;e[32]!==X||e[33]!==oe?(J=d.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[400px] md:min-w-[400px]",children:[X,oe]}),e[32]=X,e[33]=oe,e[34]=J):J=e[34];let M;e[35]!==i?(M=d.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:d.jsx(Jo,{model:i})}),e[35]=i,e[36]=M):M=e[36];let ne;return e[37]!==J||e[38]!==M?(ne=d.jsxs("div",{className:"flex flex-col md:flex-row h-[350px]",children:[J,M]}),e[37]=J,e[38]=M,e[39]=ne):ne=e[39],ne}function on(t){const{error:e,resetError:a}=t;return d.jsx(Xo,{error:e,onRetry:a})}function nn(t){return d.jsx(Os,{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 ln(t){return t.stopPropagation()}function cn(t){const e=k.c(6),{selectedModel:a,placeholder:s}=t,r=a?.connectionId??void 0,o=Mt(r);let i;e[0]!==o||e[1]!==a?(i=a?o.find(l=>l.id===a.id):void 0,e[0]=o,e[1]=a,e[2]=i):i=e[2];const n=i;let c;return e[3]!==n||e[4]!==s?(c=d.jsx(jt,{model:n,placeholder:s}),e[3]=n,e[4]=s,e[5]=c):c=e[5],c}function dn(t){const e=k.c(9),{selectedModel:a,placeholder:s}=t;if(!a){let l;return e[0]!==s?(l=d.jsx(jt,{model:void 0,placeholder:s}),e[0]=s,e[1]=l):l=e[1],l}let r;e[2]!==a.id?(r=a.id.split("/").pop()??a.id,e[2]=a.id,e[3]=r):r=e[3];const o=r;let i;e[4]!==o?(i=d.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground group-data-[state=open]:text-foreground truncate whitespace-nowrap max-w-0 opacity-0 group-hover:max-w-[150px] group-hover:opacity-100 group-data-[state=open]:max-w-[150px] group-data-[state=open]:opacity-100 transition-all duration-200 ease-in-out overflow-hidden",children:o}),e[4]=o,e[5]=i):i=e[5];let n;e[6]===Symbol.for("react.memo_cache_sentinel")?(n=d.jsx(dt,{size:14,className:"text-muted-foreground opacity-0 max-w-0 group-hover:opacity-50 group-hover:max-w-[14px] group-data-[state=open]:opacity-50 group-data-[state=open]:max-w-[14px] shrink-0 transition-all duration-200 ease-in-out overflow-hidden"}),e[6]=n):n=e[6];let c;return e[7]!==i?(c=d.jsxs("div",{className:"flex items-center gap-0 group-hover:gap-2 group-data-[state=open]:gap-2 min-w-0 overflow-hidden transition-all duration-200",children:[i,n]}),e[7]=i,e[8]=c):c=e[8],c}function Hn(t){const e=k.c(31),{selectedModel:a,onModelChange:s,modelsConnections:r,variant:o,className:i,placeholder:n}=t,c=o===void 0?"borderless":o,l=n===void 0?"Select model":n,[p,m]=S.useState(!1),h=St(),v=r??h;if(v.length===0)return null;const y=c==="borderless"?"ghost":"outline",_=c==="borderless"&&"md:border-none";let g;e[0]!==i||e[1]!==_?(g=Nt("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",_,i),e[0]=i,e[1]=_,e[2]=g):g=e[2];let f;e[3]!==l||e[4]!==a?(f=d.jsx(dn,{selectedModel:a,placeholder:l}),e[3]=l,e[4]=a,e[5]=f):f=e[5];let x;e[6]!==l?(x=d.jsx(jt,{model:void 0,placeholder:l}),e[6]=l,e[7]=x):x=e[7];let u;e[8]!==l||e[9]!==a?(u=d.jsx(cn,{selectedModel:a,placeholder:l}),e[8]=l,e[9]=a,e[10]=u):u=e[10];let E;e[11]!==x||e[12]!==u?(E=d.jsx(S.Suspense,{fallback:x,children:u}),e[11]=x,e[12]=u,e[13]=E):E=e[13];let T;e[14]!==f||e[15]!==E?(T=d.jsx(pa,{fallback:f,children:E}),e[14]=f,e[15]=E,e[16]=T):T=e[16];let N;e[17]!==T||e[18]!==y||e[19]!==g?(N=d.jsx(Ts,{asChild:!0,children:d.jsx(ua,{variant:y,size:"sm",className:g,children:T})}),e[17]=T,e[18]=y,e[19]=g,e[20]=N):N=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=d.jsx(an,{}),e[21]=C):C=e[21];let P;e[22]===Symbol.for("react.memo_cache_sentinel")?(P=()=>m(!1),e[22]=P):P=e[22];let $;e[23]!==v||e[24]!==s||e[25]!==a?($=d.jsx(As,{className:"w-full md:w-auto p-0",align:"start",side:"bottom",sideOffset:8,children:d.jsx(S.Suspense,{fallback:C,children:d.jsx(rn,{selectedModel:a,onModelChange:s,onClose:P,modelsConnections:v})})}),e[23]=v,e[24]=s,e[25]=a,e[26]=$):$=e[26];let F;return e[27]!==p||e[28]!==N||e[29]!==$?(F=d.jsxs(Ms,{open:p,onOpenChange:m,children:[N,$]}),e[27]=p,e[28]=N,e[29]=$,e[30]=F):F=e[30],F}const un=t=>new Va({api:`/api/${t}/decopilot/stream`,credentials:"include",prepareSendMessagesRequest:({messages:e,requestMetadata:a={}})=>{const{system:s,tiptapDoc:r,...o}=a,i=s?{id:crypto.randomUUID(),role:"system",parts:[{type:"text",text:s}]}:null,n=e.slice(-1).filter(Boolean);return{body:{messages:i?[i,...n]:n,...o}}}}),la=(t,e)=>t?.find(a=>a.id===e)??t?.[0]??null,pn=(t,e)=>{const a=k.c(12);let s;a[0]!==t?(s=We.chatSelectedModel(t),a[0]=t,a[1]=s):s=a[1];const[r,o]=Se(s,null),{isModelAllowed:i,allowAll:n}=At(),c=la(e,r?.connectionId),l=Mt(c?.id),p=n||!c?.id?l:l.filter(x=>i(c.id,x.id)),m=p.filter(xn).reduce(bn,void 0),h=r?.id;let v;a[2]!==p||a[3]!==h?(v=la(p,h),a[2]=p,a[3]=h,a[4]=v):v=a[4];const y=v;let _;a[5]!==m?.id||a[6]!==c||a[7]!==y?(_=y&&c?.id?{id:y.id,provider:y.provider,limits:y.limits,capabilities:y.capabilities,connectionId:c.id,fastId:m?.id}:null,a[5]=m?.id,a[6]=c,a[7]=y,a[8]=_):_=a[8];const g=_;let f;return a[9]!==g||a[10]!==o?(f=[g,o],a[9]=g,a[10]=o,a[11]=f):f=a[11],f},Wa={tiptapDoc:void 0,parentThread:null,finishReason:null};function mn(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 Wa;default:return t}}function fn(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 hn(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 o of r)switch(o.type){case"text":{const i=o.text?.trim();if(!i)continue;a.push({type:"text",text:`[${e}]
|
|
21
|
+
${i}`});break}case"image":case"audio":{if(!o.data||!o.mimeType)continue;a.push({type:"file",url:`data:${o.mimeType};base64,${o.data}`,mediaType:o.mimeType});break}case"resource":{const i=o.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 gn(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 vn(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 o=r.attrs.char??"/",i=`${o}${r.attrs.name}`;if(a+=i,o==="@"){const n=r.attrs.metadata||[];e.push(...fn(n,i))}else{const n=r.attrs.metadata||r.attrs.prompts||[];e.push(...hn(n,i))}}else if(r.type==="file"&&r.attrs){const o=r.attrs,i=`[file:://${encodeURIComponent(o.name)}]`;a+=i,e.push(...gn(o,i))}if("content"in r&&Array.isArray(r.content))for(const o of r.content)s(o)}};return s(t),a.trim()&&e.unshift({type:"text",text:a.trim()}),e}const Ja=S.createContext(null);function Wn(t){const e=k.c(73),{children:a}=t,{locator:s,org:r}=xe(),o=Uo(),{data:i}=us.useSession(),n=i?.user??null,[c,l]=S.useReducer(mn,Wa),p=bs(),[m,h]=Se(`${s}:selected-virtual-mcp-id`,null),v=St(),{hasConnectionModels:y}=At();let _;if(e[0]!==v||e[1]!==y){let L;e[3]!==y?(L=ue=>y(ue.id),e[3]=y,e[4]=L):L=e[4],_=v.filter(L),e[0]=v,e[1]=y,e[2]=_}else _=e[2];const g=_,[f,x]=pn(s,g);let u;e[5]!==s?(u=We.chatSelectedMode(s),e[5]=s,e[6]=u):u=e[6];const[E,T]=Se(u,"code_execution"),N=o.messages,C=Ao(m),P=zo();let $;e[7]!==m||e[8]!==p?($=m?p.find(L=>L.id===m)??null:null,e[7]=m,e[8]=p,e[9]=$):$=e[9];const F=$;let ae;e[10]!==r.id?(ae=xs(r.id),e[10]=r.id,e[11]=ae):ae=e[11];const Q=ae.id;let W;e[12]!==r.slug?(W=un(r.slug),e[12]=r.slug,e[13]=W):W=e[13];const X=W;let se;e[14]!==o?(se=async L=>{const{finishReason:ue,isAbort:ze,isDisconnect:rt,isError:ot,message:es,messages:ts}=L;if(l({type:"SET_FINISH_REASON",payload:ue??null}),ue!=="stop"||ze||rt||ot)return;const{title:Lt,thread_id:nt,created_at:Zt}=es.metadata??{};!nt||!Lt||!Zt||(o.updateMessagesCache(nt,ts),o.updateThread(nt,{title:Lt,updatedAt:new Date(Zt).toISOString()}))},e[14]=o,e[15]=se):se=e[15];const K=se,oe=yn;let J;e[16]!==N||e[17]!==K||e[18]!==P||e[19]!==o.activeThreadId||e[20]!==X?(J={id:o.activeThreadId,messages:N,transport:X,onFinish:K,onToolCall:P,onError:oe},e[16]=N,e[17]=K,e[18]=P,e[19]=o.activeThreadId,e[20]=X,e[21]=J):J=e[21];const M=To(J),ne=M.status==="submitted"||M.status==="streaming",q=M.messages.length===0,Ye=o.createThread,Qe=o.switchThread,Xe=o.hideThread;let Re;e[22]===Symbol.for("react.memo_cache_sentinel")?(Re=L=>l({type:"SET_TIPTAP_DOC",payload:L}),e[22]=Re):Re=e[22];const Qa=Re;let Pe;e[23]===Symbol.for("react.memo_cache_sentinel")?(Pe=()=>l({type:"CLEAR_TIPTAP_DOC"}),e[23]=Pe):Pe=e[23];const Xa=Pe;let ke;e[24]===Symbol.for("react.memo_cache_sentinel")?(ke=()=>l({type:"RESET"}),e[24]=ke):ke=e[24];const $t=ke;let Oe;e[25]!==h?(Oe=L=>{h(L)},e[25]=h,e[26]=Oe):Oe=e[26];const Ke=Oe;let De;e[27]!==x?(De=L=>{x({id:L.id,connectionId:L.connectionId})},e[27]=x,e[28]=De):De=e[28];const et=De;let $e;e[29]!==M||e[30]!==C||e[31]!==Q||e[32]!==E||e[33]!==f||e[34]!==F?.id||e[35]!==o.activeThreadId||e[36]!==n?.image||e[37]!==n?.name?($e=async L=>{if(!f){bt.error("No model configured");return}const ue=vn(L);if(ue.length===0)return;$t();const ze={tiptapDoc:L,created_at:new Date().toISOString(),thread_id:o.activeThreadId,agent:{id:F?.id??Q,mode:E},user:{avatar:n?.image??void 0,name:n?.name??"you"}},rt={...ze,system:C,model:{id:f.id,connectionId:f.connectionId,provider:f.provider??void 0,limits:f.limits??void 0,capabilities:{vision:f.capabilities?.includes("vision")??void 0,text:f.capabilities?.includes("text")??void 0,tools:f.capabilities?.includes("tools")??void 0},fastId:f.fastId}},ot={id:crypto.randomUUID(),role:"user",parts:ue,metadata:ze};await M.sendMessage(ot,{metadata:rt})},e[29]=M,e[30]=C,e[31]=Q,e[32]=E,e[33]=f,e[34]=F?.id,e[35]=o.activeThreadId,e[36]=n?.image,e[37]=n?.name,e[38]=$e):$e=e[38];const tt=$e;let Le;e[39]!==M?(Le=()=>M.stop(),e[39]=M,e[40]=Le):Le=e[40];const at=Le;let Ze;e[41]===Symbol.for("react.memo_cache_sentinel")?(Ze=()=>l({type:"CLEAR_FINISH_REASON"}),e[41]=Ze):Ze=e[41];const Ka=Ze;let Fe;e[42]!==M.clearError||e[43]!==M.error||e[44]!==M.messages||e[45]!==M.setMessages||e[46]!==M.status||e[47]!==c.finishReason||e[48]!==c.tiptapDoc||e[49]!==Ye||e[50]!==Xe||e[51]!==q||e[52]!==ne||e[53]!==g||e[54]!==E||e[55]!==f||e[56]!==F||e[57]!==tt||e[58]!==T||e[59]!==et||e[60]!==Ke||e[61]!==at||e[62]!==Qe||e[63]!==o.activeThreadId||e[64]!==o.fetchNextPage||e[65]!==o.hasNextPage||e[66]!==o.isFetchingNextPage||e[67]!==o.threads||e[68]!==p?(Fe={tiptapDoc:c.tiptapDoc,setTiptapDoc:Qa,clearTiptapDoc:Xa,resetInteraction:$t,activeThreadId:o.activeThreadId,threads:o.threads,createThread:Ye,switchToThread:Qe,hideThread:Xe,hasNextPage:o.hasNextPage,isFetchingNextPage:o.isFetchingNextPage,fetchNextPage:o.fetchNextPage,virtualMcps:p,selectedVirtualMcp:F,setVirtualMcpId:Ke,modelsConnections:g,selectedModel:f,setSelectedModel:et,selectedMode:E,setSelectedMode:T,messages:M.messages,chatStatus:M.status,isStreaming:ne,isChatEmpty:q,sendMessage:tt,stopStreaming:at,setMessages:M.setMessages,chatError:M.error,clearChatError:M.clearError,finishReason:c.finishReason,clearFinishReason:Ka},e[42]=M.clearError,e[43]=M.error,e[44]=M.messages,e[45]=M.setMessages,e[46]=M.status,e[47]=c.finishReason,e[48]=c.tiptapDoc,e[49]=Ye,e[50]=Xe,e[51]=q,e[52]=ne,e[53]=g,e[54]=E,e[55]=f,e[56]=F,e[57]=tt,e[58]=T,e[59]=et,e[60]=Ke,e[61]=at,e[62]=Qe,e[63]=o.activeThreadId,e[64]=o.fetchNextPage,e[65]=o.hasNextPage,e[66]=o.isFetchingNextPage,e[67]=o.threads,e[68]=p,e[69]=Fe):Fe=e[69];const st=Fe;let Ue;return e[70]!==a||e[71]!==st?(Ue=d.jsx(Ja.Provider,{value:st,children:a}),e[70]=a,e[71]=st,e[72]=Ue):Ue=e[72],Ue}function yn(t){console.error("[chat] Error",t)}function Jn(){const t=S.useContext(Ja);if(!t)throw new Error("useChat must be used within a ChatProvider");return t}function xn(t){return(t.costs?.input??0)+(t.costs?.output??0)>0}function bn(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 Ge="Collapsible",[_n,Gn]=hs(Ge),[En,Rt]=_n(Ge),Ga=S.forwardRef((t,e)=>{const{__scopeCollapsible:a,open:s,defaultOpen:r,disabled:o,onOpenChange:i,...n}=t,[c,l]=ps({prop:s,defaultProp:r??!1,onChange:i,caller:Ge});return d.jsx(En,{scope:a,disabled:o,contentId:ms(),open:c,onOpenToggle:S.useCallback(()=>l(p=>!p),[l]),children:d.jsx(_t.div,{"data-state":Dt(c),"data-disabled":o?"":void 0,...n,ref:e})})});Ga.displayName=Ge;var Ya="CollapsibleTrigger",Pt=S.forwardRef((t,e)=>{const{__scopeCollapsible:a,...s}=t,r=Rt(Ya,a);return d.jsx(_t.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":Dt(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...s,ref:e,onClick:fs(t.onClick,r.onOpenToggle)})});Pt.displayName=Ya;var kt="CollapsibleContent",Ot=S.forwardRef((t,e)=>{const{forceMount:a,...s}=t,r=Rt(kt,t.__scopeCollapsible);return d.jsx(gs,{present:a||r.open,children:({present:o})=>d.jsx(In,{...s,ref:e,present:o})})});Ot.displayName=kt;var In=S.forwardRef((t,e)=>{const{__scopeCollapsible:a,present:s,children:r,...o}=t,i=Rt(kt,a),[n,c]=S.useState(s),l=S.useRef(null),p=vs(e,l),m=S.useRef(0),h=m.current,v=S.useRef(0),y=v.current,_=i.open||n,g=S.useRef(_),f=S.useRef(void 0);return S.useEffect(()=>{const x=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(x)},[]),ys(()=>{const x=l.current;if(x){f.current=f.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const u=x.getBoundingClientRect();m.current=u.height,v.current=u.width,g.current||(x.style.transitionDuration=f.current.transitionDuration,x.style.animationName=f.current.animationName),c(s)}},[i.open,s]),d.jsx(_t.div,{"data-state":Dt(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!_,...o,ref:p,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...t.style},children:_&&r})});function Dt(t){return t?"open":"closed"}var Sn=Ga,Yn=Pt,Qn=Ot;function Xn(t){const e=k.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(Sn,{"data-slot":"collapsible",...a}),e[2]=a,e[3]=s):s=e[3],s}function Kn(t){const e=k.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(Pt,{"data-slot":"collapsible-trigger",...a}),e[2]=a,e[3]=s):s=e[3],s}function ei(t){const e=k.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-content",...a}),e[2]=a,e[3]=s):s=e[3],s}function ti(){const t=k.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=We.decoChatOpen(),t[0]=e):e=t[0];const[a,s]=Se(e,wn);let r;return t[1]!==a||t[2]!==s?(r=[a,s],t[1]=a,t[2]=s,t[3]=r):r=t[3],r}function wn(t){return!!(t??!0)}export{Xn as C,Hn as M,Sn as R,Z as S,Yn as T,Us as a,ti as b,Kn as c,fa as d,Qn as e,Gn as f,ei as g,Wn as h,Fs as i,qn as m,va as s,ya as t,Jn as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as g,g as y,t as e}from"./index-
|
|
1
|
+
import{u as g,g as y,t as e}from"./index-BV-rIyOx.js";import{u as C}from"./use-binding-BVOuBiur.js";import{g as S,h as v}from"./use-connection-B8DnjeO8.js";import{e as B}from"./extract-connection-data-CQQ4ZZEG.js";import{f as I,c as P,e as _}from"./registry-utils-CqOx6XXE.js";function w(t){return t.startsWith("@")?t:`@${t}`}function F(){const{org:t}=g(),{data:s}=y.useSession(),i=S(),l=v(),u=C(l);return{installByBinding:async r=>{if(!t||!s?.user?.id){e.error("Not authenticated");return}const d=w(r),a=(await Promise.all(u.map(async o=>{const c=I(o.tools);if(!c)return null;try{const p=await P(o.id,t.id,c,{where:{appName:d}});return _(p??[])[0]??null}catch{return null}}))).find(o=>o!==null);if(!a){e.error(`MCP Server not found in registry: ${r}`);return}const n=B(a,t.id,s.user.id),m=n.connection_type==="STDIO",f=!!n.connection_url,h=m&&n.connection_headers&&typeof n.connection_headers=="object"&&"command"in n.connection_headers;if(!f&&!h){e.error("This MCP Server cannot be connected: no connection method available");return}return await i.create.mutateAsync(n),{id:n.id,connection:n}},isInstalling:i.create.isPending}}export{F as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as b,c as N,u as B,K as I,j as x}from"./index-
|
|
1
|
+
import{r as b,c as N,u as B,K as I,j as x}from"./index-BV-rIyOx.js";import{A as _}from"./avatar-B-AS-16N.js";import{c as C}from"./utils-CfR4kXxZ.js";import{u as L}from"./useQuery-DDYln2BW.js";import{a as U,u as D}from"./constants-1q3hobyw.js";import{u as P}from"./use-mobile-B2CDnK8i.js";const A=({size:i=24,color:e="currentColor",...t})=>b.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},b.createElement("path",{d:"M2.42 12.713c-.136-.215-.204-.323-.242-.49a1.173 1.173 0 0 1 0-.446c.038-.167.106-.274.242-.49C3.546 9.505 6.895 5 12 5s8.455 4.505 9.58 6.287c.137.215.205.323.243.49.029.125.029.322 0 .446-.038.167-.106.274-.242.49C20.455 14.495 17.105 19 12 19c-5.106 0-8.455-4.505-9.58-6.287Z"}),b.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}));A.displayName="Eye";function R(i){const e=N.c(11),{org:t}=B();let c;e[0]!==t.id?(c={connectionId:U,orgId:t.id},e[0]=t.id,e[1]=c):c=e[1];const r=D(c);let s;e[2]!==i?(s=I.user(i),e[2]=i,e[3]=s):s=e[3];let o;e[4]!==r||e[5]!==i?(o=async()=>{const p=await r.callTool({name:"USER_GET",arguments:{id:i}});return(p.structuredContent??p).user},e[4]=r,e[5]=i,e[6]=o):o=e[6];const a=!!i;let l;return e[7]!==s||e[8]!==o||e[9]!==a?(l={queryKey:s,queryFn:o,staleTime:3e5,retry:1,enabled:a},e[7]=s,e[8]=o,e[9]=a,e[10]=l):l=e[10],L(l)}function H(i){const e=N.c(39),{id:t,size:c,showEmail:r,className:s}=i,o=c===void 0?"xs":c,a=r===void 0?!1:r,{data:l,isLoading:p,isError:j}=R(t);if(p){let u;e[0]!==s?(u=C("flex items-center gap-2",s),e[0]=s,e[1]=u):u=e[1];let n;e[2]!==o?(n=x.jsx(_.Skeleton,{shape:"circle",size:o}),e[2]=o,e[3]=n):n=e[3];let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=x.jsx("div",{className:"h-3 w-24 bg-muted animate-pulse rounded"}),e[4]=g):g=e[4];let h;e[5]!==a?(h=a&&x.jsx("div",{className:"h-2 w-32 bg-muted animate-pulse rounded"}),e[5]=a,e[6]=h):h=e[6];let w;e[7]!==h?(w=x.jsxs("div",{className:"flex flex-col gap-1",children:[g,h]}),e[7]=h,e[8]=w):w=e[8];let M;return e[9]!==u||e[10]!==n||e[11]!==w?(M=x.jsxs("div",{className:u,children:[n,w]}),e[9]=u,e[10]=n,e[11]=w,e[12]=M):M=e[12],M}if(j||!l){let u;e[13]!==s?(u=C("flex items-center gap-2",s),e[13]=s,e[14]=u):u=e[14];let n;e[15]!==o?(n=x.jsx(_,{shape:"circle",size:o,fallback:"?",muted:!0}),e[15]=o,e[16]=n):n=e[16];let g;e[17]===Symbol.for("react.memo_cache_sentinel")?(g=x.jsx("div",{className:"flex flex-col",children:x.jsx("div",{className:"text-sm text-muted-foreground",children:"Unknown User"})}),e[17]=g):g=e[17];let h;return e[18]!==u||e[19]!==n?(h=x.jsxs("div",{className:u,children:[n,g]}),e[18]=u,e[19]=n,e[20]=h):h=e[20],h}let v;e[21]!==s?(v=C("flex items-center gap-2",s),e[21]=s,e[22]=v):v=e[22];const y=l.image??void 0;let m;e[23]!==o||e[24]!==y||e[25]!==l.name?(m=x.jsx(_,{shape:"circle",size:o,url:y,fallback:l.name}),e[23]=o,e[24]=y,e[25]=l.name,e[26]=m):m=e[26];let d;e[27]!==l.name?(d=x.jsx("div",{className:"text-sm font-medium",children:l.name}),e[27]=l.name,e[28]=d):d=e[28];let f;e[29]!==a||e[30]!==l.email?(f=a&&x.jsx("div",{className:"text-xs text-muted-foreground",children:l.email}),e[29]=a,e[30]=l.email,e[31]=f):f=e[31];let S;e[32]!==d||e[33]!==f?(S=x.jsxs("div",{className:"flex flex-col",children:[d,f]}),e[32]=d,e[33]=f,e[34]=S):S=e[34];let E;return e[35]!==v||e[36]!==m||e[37]!==S?(E=x.jsxs("div",{className:v,children:[m,S]}),e[35]=v,e[36]=m,e[37]=S,e[38]=E):E=e[38],E}function W(i){const e=`deco-filters-${i}`,[t,c]=b.useState(()=>{try{const s=globalThis.localStorage?.getItem(e);if(s)return JSON.parse(s)}catch(s){console.error("Failed to parse stored filters:",s)}return[]});return[t,s=>{c(s);try{globalThis.localStorage?.setItem(e,JSON.stringify(s))}catch(o){console.error("Failed to save filters:",o)}}]}function z(i){const e=N.c(7),[t,c]=b.useState(i),[r,s]=b.useState(i?"desc":null);let o;e[0]!==r||e[1]!==t?(o=p=>{t!==p?(c(p),s("asc")):r==="asc"?s("desc"):r==="desc"&&(c(void 0),s(null))},e[0]=r,e[1]=t,e[2]=o):o=e[2];const a=o;let l;return e[3]!==a||e[4]!==r||e[5]!==t?(l={sortKey:t,sortDirection:r,handleSort:a},e[3]=a,e[4]=r,e[5]=t,e[6]=l):l=e[6],l}function q(i,e){const t=N.c(12),c=e===void 0?"cards":e,r=P(),s=b.useRef(r),o=i?`deco-view-mode-${i}`:"deco-view-mode";let a;t[0]!==c||t[1]!==o?(a=()=>{const f=globalThis.localStorage?.getItem(o);return f==="cards"||f==="table"?f:c},t[0]=c,t[1]=o,t[2]=a):a=t[2];const[l,p]=b.useState(a);let j;t[3]!==o?(j=f=>{p(f),globalThis.localStorage?.setItem(o,f)},t[3]=o,t[4]=j):j=t[4];const v=j;let y,m;t[5]!==r||t[6]!==l?(y=()=>{!s.current&&r&&l==="table"&&p("cards"),s.current=r},m=[r,l],t[5]=r,t[6]=l,t[7]=y,t[8]=m):(y=t[7],m=t[8]),b.useEffect(y,m);let d;return t[9]!==v||t[10]!==l?(d=[l,v],t[9]=v,t[10]=l,t[11]=d):d=t[11],d}function X(i){const e=N.c(20),{namespace:t,resource:c,defaultSortKey:r,defaultViewMode:s}=i,o=r===void 0?"title":r,a=s===void 0?"table":s,[l,p]=b.useState(""),j=b.useDeferredValue(l),v=`${t}-${c}`,[y,m]=W(v),d=`mesh-${c}-filter-visible-${t}`;let f;e[0]!==d?(f=()=>globalThis.localStorage?.getItem(d)==="true",e[0]=d,e[1]=f):f=e[1];const[S,E]=b.useState(f);let u;e[2]!==d?(u=T=>{E(T),globalThis.localStorage?.setItem(d,String(T))},e[2]=d,e[3]=u):u=e[3];const n=u;let g;e[4]!==S||e[5]!==n?(g=()=>{n(!S)},e[4]=S,e[5]=n,e[6]=g):g=e[6];const h=g,[w,M]=q(`mesh-${c}-${t}`,a),{sortKey:k,sortDirection:K,handleSort:F}=z(o),V=k;let $;return e[7]!==S||e[8]!==y||e[9]!==F||e[10]!==l||e[11]!==j||e[12]!==n||e[13]!==m||e[14]!==M||e[15]!==K||e[16]!==V||e[17]!==h||e[18]!==w?($={search:l,searchTerm:j,setSearch:p,filters:y,setFilters:m,filterBarVisible:S,setFilterBarVisible:n,toggleFilterBar:h,viewMode:w,setViewMode:M,sortKey:V,sortDirection:K,handleSort:F},e[7]=S,e[8]=y,e[9]=F,e[10]=l,e[11]=j,e[12]=n,e[13]=m,e[14]=M,e[15]=K,e[16]=V,e[17]=h,e[18]=w,e[19]=$):$=e[19],$}export{H as U,A as s,X as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c,u}from"./index-
|
|
1
|
+
import{c,u}from"./index-BV-rIyOx.js";import{h as m,e as a}from"./use-connection-B8DnjeO8.js";import{j as p}from"./constants-1q3hobyw.js";import{a as C}from"./use-binding-BVOuBiur.js";function x(n,s){const o=c.c(5);let e;o[0]!==s?(e=s===void 0?{}:s,o[0]=s,o[1]=e):e=o[1];const r=e,{org:i}=u();let t;o[2]!==n||o[3]!==i.id?(t={connectionId:n,orgId:i.id},o[2]=n,o[3]=i.id,o[4]=t):t=o[4];const l=p(t);return a(n??"no-connection","LLM",l,r)}function j(){const n=c.c(2),s=m();let o;return n[0]!==s?(o={connections:s,binding:"LLMS"},n[0]=s,n[1]=o):o=n[1],C(o)}export{x as a,j as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as u,q as c}from"./index-
|
|
1
|
+
import{c as u,q as c}from"./index-BV-rIyOx.js";import{u as p}from"./useQuery-DDYln2BW.js";import{K as n}from"./constants-1q3hobyw.js";async function f(l){return l.getServerCapabilities()?.resources?await l.listResources():{resources:[]}}async function b(l,e){return await l.readResource({uri:e})}function R(l){const e=u.c(12);let t,s;e[0]!==l?({client:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let r;e[3]!==t?(r=n.mcpResourcesList(t),e[3]=t,e[4]=r):r=e[4];let i;e[5]!==t?(i=()=>f(t),e[5]=t,e[6]=i):i=e[6];const o=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==r||e[9]!==i||e[10]!==o?(a={...s,queryKey:r,queryFn:i,staleTime:o,retry:!1},e[7]=s,e[8]=r,e[9]=i,e[10]=o,e[11]=a):a=e[11],c(a)}function L(l){const e=u.c(12);let t,s;e[0]!==l?({client:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let r;e[3]!==t?(r=n.mcpResourcesList(t),e[3]=t,e[4]=r):r=e[4];let i;e[5]!==t?(i=()=>f(t),e[5]=t,e[6]=i):i=e[6];const o=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==r||e[9]!==i||e[10]!==o?(a={...s,queryKey:r,queryFn:i,staleTime:o,retry:!1},e[7]=s,e[8]=r,e[9]=i,e[10]=o,e[11]=a):a=e[11],p(a)}async function m(l){return l.getServerCapabilities()?.prompts?await l.listPrompts():{prompts:[]}}async function T(l,e,t){if(!l.getServerCapabilities()?.prompts)throw new Error("Prompts capability not supported");return await l.getPrompt({name:e,arguments:t??{}})}function g(l){const e=u.c(12);let t,s;e[0]!==l?({client:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let r;e[3]!==t?(r=n.mcpPromptsList(t),e[3]=t,e[4]=r):r=e[4];let i;e[5]!==t?(i=()=>m(t),e[5]=t,e[6]=i):i=e[6];const o=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==r||e[9]!==i||e[10]!==o?(a={...s,queryKey:r,queryFn:i,staleTime:o,retry:!1},e[7]=s,e[8]=r,e[9]=i,e[10]=o,e[11]=a):a=e[11],c(a)}function C(l){const e=u.c(12);let t,s;e[0]!==l?({client:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let r;e[3]!==t?(r=n.mcpPromptsList(t),e[3]=t,e[4]=r):r=e[4];let i;e[5]!==t?(i=()=>m(t),e[5]=t,e[6]=i):i=e[6];const o=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==r||e[9]!==i||e[10]!==o?(a={...s,queryKey:r,queryFn:i,staleTime:o,retry:!1},e[7]=s,e[8]=r,e[9]=i,e[10]=o,e[11]=a):a=e[11],p(a)}export{f as a,C as b,R as c,L as d,T as g,m as l,b as r,g as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as m,q as p}from"./index-
|
|
1
|
+
import{c as m,q as p}from"./index-BV-rIyOx.js";import{u as q}from"./useQuery-DDYln2BW.js";import{u as C}from"./useMutation-BOrtlNTb.js";import{K as T}from"./constants-1q3hobyw.js";function w(r){const e=m.c(12);let t,s;e[0]!==r?({client:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let l;e[3]!==t?(l=T.mcpToolsList(t),e[3]=t,e[4]=l):l=e[4];let o;e[5]!==t?(o=async()=>await t.listTools(),e[5]=t,e[6]=o):o=e[6];const i=s.staleTime??3e4;let n;return e[7]!==s||e[8]!==l||e[9]!==o||e[10]!==i?(n={...s,queryKey:l,queryFn:o,staleTime:i,retry:!1},e[7]=s,e[8]=l,e[9]=o,e[10]=i,e[11]=n):n=e[11],p(n)}function F(r){const e=m.c(12);let t,s;e[0]!==r?({client:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let l;e[3]!==t?(l=T.mcpToolsList(t),e[3]=t,e[4]=l):l=e[4];let o;e[5]!==t?(o=async()=>await t.listTools(),e[5]=t,e[6]=o):o=e[6];const i=s.staleTime??3e4;let n;return e[7]!==s||e[8]!==l||e[9]!==o||e[10]!==i?(n={...s,queryKey:l,queryFn:o,staleTime:i,retry:!1},e[7]=s,e[8]=l,e[9]=o,e[10]=i,e[11]=n):n=e[11],q(n)}function P(r){const e=m.c(21);let t,s,l,o;e[0]!==r?({client:t,toolName:o,toolArguments:l,...s}=r,e[0]=r,e[1]=t,e[2]=s,e[3]=l,e[4]=o):(t=e[1],s=e[2],l=e[3],o=e[4]);let i,n,u;if(e[5]!==t||e[6]!==s||e[7]!==l||e[8]!==o){const y=JSON.stringify(l??{});u=p,i=s,n=T.mcpToolCall(t,o,y),e[5]=t,e[6]=s,e[7]=l,e[8]=o,e[9]=i,e[10]=n,e[11]=u}else i=e[9],n=e[10],u=e[11];let a;e[12]!==t||e[13]!==l||e[14]!==o?(a=async()=>await t.callTool({name:o,arguments:l}),e[12]=t,e[13]=l,e[14]=o,e[15]=a):a=e[15];const f=s.staleTime??3e4;let c;return e[16]!==i||e[17]!==n||e[18]!==a||e[19]!==f?(c={...i,queryKey:n,queryFn:a,staleTime:f,retry:!1},e[16]=i,e[17]=n,e[18]=a,e[19]=f,e[20]=c):c=e[20],u(c)}function $(r){const e=m.c(21);let t,s,l,o;e[0]!==r?({client:t,toolName:o,toolArguments:l,...s}=r,e[0]=r,e[1]=t,e[2]=s,e[3]=l,e[4]=o):(t=e[1],s=e[2],l=e[3],o=e[4]);let i,n,u;if(e[5]!==t||e[6]!==s||e[7]!==l||e[8]!==o){const y=JSON.stringify(l??{});u=q,i=s,n=T.mcpToolCall(t,o,y),e[5]=t,e[6]=s,e[7]=l,e[8]=o,e[9]=i,e[10]=n,e[11]=u}else i=e[9],n=e[10],u=e[11];let a;e[12]!==t||e[13]!==l||e[14]!==o?(a=async()=>await t.callTool({name:o,arguments:l}),e[12]=t,e[13]=l,e[14]=o,e[15]=a):a=e[15];const f=s.staleTime??3e4;let c;return e[16]!==i||e[17]!==n||e[18]!==a||e[19]!==f?(c={...i,queryKey:n,queryFn:a,staleTime:f,retry:!1},e[16]=i,e[17]=n,e[18]=a,e[19]=f,e[20]=c):c=e[20],u(c)}function L(r){const e=m.c(8);let t,s;e[0]!==r?({client:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let l;e[3]!==t?(l=async i=>await t.callTool(i),e[3]=t,e[4]=l):l=e[4];let o;return e[5]!==s||e[6]!==l?(o={...s,mutationFn:l},e[5]=s,e[6]=l,e[7]=o):o=e[7],C(o)}export{L as a,$ as b,w as c,F as d,P as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as m,r}from"./index-
|
|
1
|
+
import{c as m,r}from"./index-BV-rIyOx.js";const a=768,o=()=>globalThis.innerWidth<a;function u(){const e=m.c(2),[l,n]=r.useState(o);let t,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{const i=()=>n(o),c=globalThis.matchMedia(`(max-width: ${a-1}px)`);return c.addEventListener("change",i),n(o),()=>c.removeEventListener("change",i)},s=[],e[0]=t,e[1]=s):(t=e[0],s=e[1]),r.useEffect(t,s),l}export{u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as m,u as T,q as d,v as y,K as g}from"./index-
|
|
1
|
+
import{c as m,u as T,q as d,v as y,K as g}from"./index-BV-rIyOx.js";import{u as _}from"./useMutation-BOrtlNTb.js";import{a as p,u as A}from"./constants-1q3hobyw.js";function D(e){const t=m.c(10),{org:i}=T();let l;t[0]!==i.id?(l={connectionId:p,orgId:i.id},t[0]=i.id,t[1]=l):l=t[1];const c=A(l);let u;t[2]!==e?(u=g.organizationSettings(e),t[2]=e,t[3]=u):u=t[3];let s;t[4]!==c||t[5]!==e?(s=async()=>{const a=await c.callTool({name:"ORGANIZATION_SETTINGS_GET",arguments:{}}),r=a.structuredContent??a;return r||{organizationId:e,sidebar_items:null,enabled_plugins:null,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}},t[4]=c,t[5]=e,t[6]=s):s=t[6];let n;t[7]!==u||t[8]!==s?(n={queryKey:u,queryFn:s,staleTime:6e4},t[7]=u,t[8]=s,t[9]=n):n=t[9];const{data:o}=d(n);return o}function G(e){const t=m.c(13),i=y(),{org:l}=T();let c;t[0]!==l.id?(c={connectionId:p,orgId:l.id},t[0]=l.id,t[1]=c):c=t[1];const u=A(c);let s;t[2]!==u||t[3]!==e?(s=async S=>{const f=await u.callTool({name:"ORGANIZATION_SETTINGS_UPDATE",arguments:{organizationId:e,...S}});return f.structuredContent??f},t[2]=u,t[3]=e,t[4]=s):s=t[4];let n;t[5]!==e||t[6]!==i?(n=S=>{i.setQueryData(g.organizationSettings(e),S)},t[5]=e,t[6]=i,t[7]=n):n=t[7];let o;t[8]!==s||t[9]!==n?(o={mutationFn:s,onSuccess:n},t[8]=s,t[9]=n,t[10]=o):o=t[10];const a=_(o);let r;return t[11]!==a?(r={update:a},t[11]=a,t[12]=r):r=t[12],r}export{G as a,D as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{K as m,c as C}from"./index-
|
|
1
|
+
import{K as m,c as C}from"./index-BV-rIyOx.js";import{u as y}from"./useQuery-DDYln2BW.js";import{u as f,a}from"./constants-1q3hobyw.js";function q(t,s){const e=C.c(13);let l;e[0]!==t?(l={connectionId:a,orgId:t},e[0]=t,e[1]=l):l=e[1];const u=f(l);let r;e[2]!==t||e[3]!==s?(r=m.project(t,s),e[2]=t,e[3]=s,e[4]=r):r=e[4];let c;e[5]!==u||e[6]!==t||e[7]!==s?(c=async()=>{const p=await u.callTool({name:"PROJECT_GET",arguments:{organizationId:t,slug:s}});return(p.structuredContent??p).project},e[5]=u,e[6]=t,e[7]=s,e[8]=c):c=e[8];const n=!!t&&!!s;let o;return e[9]!==r||e[10]!==c||e[11]!==n?(o={queryKey:r,queryFn:c,enabled:n,staleTime:3e4},e[9]=r,e[10]=c,e[11]=n,e[12]=o):o=e[12],y(o)}function _(t,s){const e=f({connectionId:a,orgId:t}),l={queryKey:m.projects(t),queryFn:async()=>{const u=await e.callTool({name:"PROJECT_LIST",arguments:{organizationId:t}});return(u.structuredContent??u).projects.map(c=>({...c,organizationId:t}))},staleTime:3e4};return y({...l,enabled:!!t})}export{_ as a,q as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c,u as r}from"./index-
|
|
1
|
+
import{c,u as r}from"./index-BV-rIyOx.js";import{e as a,u as C,d as I}from"./use-connection-B8DnjeO8.js";import{a as l,u}from"./constants-1q3hobyw.js";function m(i){const t=c.c(4);let o;t[0]!==i?(o=i===void 0?{}:i,t[0]=i,t[1]=o):o=t[1];const n=o,{org:e}=r();let s;t[2]!==e.id?(s={connectionId:l,orgId:e.id},t[2]=e.id,t[3]=s):s=t[3];const d=u(s);return a(e.id,"VIRTUAL_MCP",d,n)}function V(i){const t=c.c(2),{org:o}=r();let n;t[0]!==o.id?(n={connectionId:l,orgId:o.id},t[0]=o.id,t[1]=n):n=t[1];const e=u(n);return I(o.id,"VIRTUAL_MCP",i??void 0,e)}function p(){const i=c.c(2),{org:t}=r();let o;i[0]!==t.id?(o={connectionId:l,orgId:t.id},i[0]=t.id,i[1]=o):o=i[1];const n=u(o);return C(t.id,"VIRTUAL_MCP",n)}export{p as a,m as b,V as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{I as u}from"./infiniteQueryObserver-CrYps4St.js";import{a0 as i}from"./index-BV-rIyOx.js";function t(e,r){return i(e,u,r)}export{t as u};
|