@decocms/mesh 2.83.0 → 2.85.0
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-BPyXObkI.js → AlertCircle-Dv-pGVbe.js} +1 -1
- package/dist/client/assets/ArrowLeft-DmjHPtds.js +1 -0
- package/dist/client/assets/{ArrowUp-FCHp4iCN.js → ArrowUp-CNNhUiSK.js} +1 -1
- package/dist/client/assets/{Calendar-BfLwT3NA.js → Calendar-DvFZbDSm.js} +1 -1
- package/dist/client/assets/{Check-Cs75lN5s.js → Check-D0-doi3D.js} +1 -1
- package/dist/client/assets/{CheckCircle-DBlwf1j4.js → CheckCircle-B7BcMa43.js} +1 -1
- package/dist/client/assets/{CheckDone01-S0a0qNbM.js → CheckDone01-BFFxKfwE.js} +1 -1
- package/dist/client/assets/{ChevronDown-GKAjmf9-.js → ChevronDown-DhDohZgY.js} +1 -1
- package/dist/client/assets/{ChevronRight-C2P7kbsg.js → ChevronRight-YlJxRSER.js} +1 -1
- package/dist/client/assets/{Code01-BHLC4p1n.js → Code01-BALFVt_U.js} +1 -1
- package/dist/client/assets/{Copy01-DoMQtYG8.js → Copy01-CdI1uSIx.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-CRij3zkT.js → DotsHorizontal-BBNdFqaM.js} +1 -1
- package/dist/client/assets/{DotsVertical-k50WldC_.js → DotsVertical-eKFCZgNz.js} +1 -1
- package/dist/client/assets/{Download01-OETwYsH7.js → Download01-ByYU943d.js} +1 -1
- package/dist/client/assets/{Edit01-DLdvPhN6.js → Edit01-BLqaLVsN.js} +1 -1
- package/dist/client/assets/{File02-CMC92Y7p.js → File02-ChsZyHSt.js} +1 -1
- package/dist/client/assets/{File06-Cw5Qokj9.js → File06-ZuO2Pzkt.js} +1 -1
- package/dist/client/assets/{FilterLines-DYaNswU3.js → FilterLines-kdqwOMYU.js} +1 -1
- package/dist/client/assets/{Globe02-DvDX7kIY.js → Globe02-R_O247ek.js} +1 -1
- package/dist/client/assets/{Grid01-CRxXEj4c.js → Grid01-Hl_fTaOZ.js} +1 -1
- package/dist/client/assets/{Home02-Bl5V3Eer.js → Home02-DCuV9I0Z.js} +1 -1
- package/dist/client/assets/{Image01-Da5y1xnZ.js → Image01-UevfVWVa.js} +1 -1
- package/dist/client/assets/{Inbox01-5raqmbyC.js → Inbox01-DkILVHwB.js} +1 -1
- package/dist/client/assets/{InfoCircle-_vaPWgPM.js → InfoCircle-OFmSmQRy.js} +1 -1
- package/dist/client/assets/{LinkExternal01-Djvm54UL.js → LinkExternal01-CzCmb0H9.js} +1 -1
- package/dist/client/assets/{List-6rUZwe-S.js → List-CziLidfU.js} +1 -1
- package/dist/client/assets/{Loading01-MMZDbbza.js → Loading01-Bnk-9-nZ.js} +1 -1
- package/dist/client/assets/{Lock01-CkQyx7Eh.js → Lock01-D1Ke74xN.js} +1 -1
- package/dist/client/assets/{Pin01-DZ098jO8.js → Pin01-BY5CK8qS.js} +1 -1
- package/dist/client/assets/{Play-DT7fXdjA.js → Play-D6Lfsz7v.js} +1 -1
- package/dist/client/assets/{Plus-D4aZ3IMW.js → Plus-BsvHyKJ8.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-Cim3w8V-.js → RefreshCcw01-BjGY5EQM.js} +1 -1
- package/dist/client/assets/{SearchMd-C_tQMyyy.js → SearchMd-B2tl0hgr.js} +1 -1
- package/dist/client/assets/{Settings01-DHLzOrWD.js → Settings01-DFEntEgk.js} +1 -1
- package/dist/client/assets/{Settings02-rhcgMUZ4.js → Settings02-BKH7FnCM.js} +1 -1
- package/dist/client/assets/{Share07-Dy4fHf5t.js → Share07-BoaRx3Mk.js} +1 -1
- package/dist/client/assets/{Terminal-n9aj2R3o.js → Terminal-DAZzR_ZP.js} +1 -1
- package/dist/client/assets/{Tool01-Cl-4zuR9.js → Tool01-CwDTk-Rs.js} +1 -1
- package/dist/client/assets/{Trash01-Elt9HT4h.js → Trash01-DCp8kuDe.js} +1 -1
- package/dist/client/assets/{Upload01-DIbRC7XB.js → Upload01-u4nRmrqT.js} +1 -1
- package/dist/client/assets/{Users03-B-mM8HW1.js → Users03-B2zsfnpN.js} +1 -1
- package/dist/client/assets/{X-CmvZcFQB.js → X-CERPEbZp.js} +1 -1
- package/dist/client/assets/{XClose-BMnTDdZw.js → XClose-Vbmhp4-x.js} +1 -1
- package/dist/client/assets/{agent-connections-preview-DmJOmFA4.js → agent-connections-preview-C8us1TXi.js} +1 -1
- package/dist/client/assets/agent-detail-DPvjIJq8.js +1 -0
- package/dist/client/assets/{agents-CEo_DHBF.js → agents-B_Mc2Y0p.js} +1 -1
- package/dist/client/assets/{alert-dialog-CMNJi4cu.js → alert-dialog-DZUHuYRj.js} +1 -1
- package/dist/client/assets/{auth-catchall-CDUahCHd.js → auth-catchall-WiUbh3Vy.js} +1 -1
- package/dist/client/assets/{avatar-BYpFPLC-.js → avatar-BlXkFPmj.js} +1 -1
- package/dist/client/assets/{badge-DtKpOapD.js → badge-DspY47ru.js} +1 -1
- package/dist/client/assets/{binder-CdlFZNUo.js → binder-Dm6uKx_q.js} +1 -1
- package/dist/client/assets/{breadcrumb-CsszkVDc.js → breadcrumb-Ds3Lal_V.js} +1 -1
- package/dist/client/assets/{button-D4ybDyA6.js → button-DyxB0Yk5.js} +1 -1
- package/dist/client/assets/{card--mmH1q_H.js → card-Czo4WORA.js} +1 -1
- package/dist/client/assets/{checkbox-MWE-auvg.js → checkbox-BJHuci-0.js} +1 -1
- package/dist/client/assets/{circle-alert-DCnEsE2A.js → circle-alert-CFYGWMlI.js} +1 -1
- package/dist/client/assets/{collection-detail-B4WDsous.js → collection-detail-CtGRRRDt.js} +3 -3
- package/dist/client/assets/{collection-search-Bii84F4z.js → collection-search-B1sfCtHP.js} +1 -1
- package/dist/client/assets/{collection-tab-CXAG_Gd5.js → collection-tab-C0EGq1kq.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-wQINF_n7.js → collection-table-wrapper-CWAiVtOh.js} +1 -1
- package/dist/client/assets/{collection-tabs-BdmTBaKU.js → collection-tabs-BBncsSV1.js} +1 -1
- package/dist/client/assets/{command-D1IlC38C.js → command-DwjGvSxM.js} +1 -1
- package/dist/client/assets/{connect-9NWYegXr.js → connect-79qxws_p.js} +1 -1
- package/dist/client/assets/{connection-card-D4UIkmBy.js → connection-card-BNG8RiKR.js} +1 -1
- package/dist/client/assets/connection-detail-DpJ2obA4.js +1 -0
- package/dist/client/assets/{connections-D9gdP5WF.js → connections-BOIKCGcJ.js} +1 -1
- package/dist/client/assets/constants-Bo5G03e3.js +1 -0
- package/dist/client/assets/{constants-DaNibXfC.js → constants-DeSBGDil.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-6BWQsUK3.js → create-organization-dialog-DTTLW3st.js} +1 -1
- package/dist/client/assets/{create-project-dialog-DXg7_zQn.js → create-project-dialog-b2rgBy6I.js} +1 -1
- package/dist/client/assets/{dialog-CMGr7rql.js → dialog-RkqsUuro.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BuIL6Z9M.js → dropdown-menu-DJfLCcXj.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-Cayql-Em.js → dynamic-plugin-layout-C-BX9dZD.js} +1 -1
- package/dist/client/assets/{empty-state-DRvUMAVC.js → empty-state-B1qLg3Wj.js} +1 -1
- package/dist/client/assets/{empty-state-DTrg-Ql5.js → empty-state-C70KsS8J.js} +1 -1
- package/dist/client/assets/{env-vars-editor-B8Mya4cT.js → env-vars-editor-hgEfXkCQ.js} +1 -1
- package/dist/client/assets/{error-boundary-BtZ5XzHQ.js → error-boundary-BWYaX2Wu.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BF529_V9.js → extract-connection-data-CYX0n8Dz.js} +1 -1
- package/dist/client/assets/{file-browser-w9s7soVF.js → file-browser-luwLtvt1.js} +2 -2
- package/dist/client/assets/{form-DMknnobv.js → form-CPHFoWqg.js} +1 -1
- package/dist/client/assets/{grid-view-CKIDwWZj.js → grid-view-BYwAtmMs.js} +1 -1
- package/dist/client/assets/{home-9ScChuE7.js → home-6BSXWwE-.js} +1 -1
- package/dist/client/assets/{index-6RZw3yFj.js → index-BleD0AWt.js} +1 -1
- package/dist/client/assets/{index-DybN8qgx.js → index-Cj2ccTyE.js} +1 -1
- package/dist/client/assets/{index-DWuFhHja.js → index-CkIIowTe.js} +1 -1
- package/dist/client/assets/{index-CWCxcUgh.js → index-Cu9TDLt5.js} +1 -1
- package/dist/client/assets/{index-jpYHaPrB.js → index-DIarRfAA.js} +1 -1
- package/dist/client/assets/index-DjoTHPX-.js +25 -0
- package/dist/client/assets/{index-BxdkA_ZL.js → index-DyoRyDg0.js} +2 -2
- package/dist/client/assets/index-NuPnrQEp.js +1 -0
- package/dist/client/assets/{index-B3PXgRu6.js → index-ZW5LgkfR.js} +95 -95
- package/dist/client/assets/index-tYpHqvxs.css +1 -0
- package/dist/client/assets/{infiniteQueryObserver-DxBV1LPI.js → infiniteQueryObserver-4tHvFsCT.js} +1 -1
- package/dist/client/assets/{input-z2jpeFYP.js → input-BGIEfDaw.js} +1 -1
- package/dist/client/assets/{integration-icon-jeb5kYQL.js → integration-icon-BRZY1p3G.js} +1 -1
- package/dist/client/assets/{label-DXPngrTd.js → label-nYOkPUBD.js} +1 -1
- package/dist/client/assets/{layout-xAlXRb2v.js → layout-CiQVyOtU.js} +1 -1
- package/dist/client/assets/{localstorage-keys-9xhTORbm.js → localstorage-keys-BVi4c9Wu.js} +1 -1
- package/dist/client/assets/{login-P0jcEajh.js → login-ZhUdP3Du.js} +1 -1
- package/dist/client/assets/{mcp-oauth-CRtwYY4d.js → mcp-oauth-D5ZIKdBG.js} +1 -1
- package/dist/client/assets/{mcp-server-card-BPMJKBms.js → mcp-server-card-BluZeoJV.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-D9Br32wD.js → mcp-server-detail-DA38ZVYK.js} +2 -2
- package/dist/client/assets/members-CcwWOeY4.js +3 -0
- package/dist/client/assets/{monaco-editor-DObrcQRA.js → monaco-editor-D8XjYu_I.js} +1 -1
- package/dist/client/assets/{monitoring-DuyI1XGQ.js → monitoring-CDhjTLeQ.js} +1 -1
- package/dist/client/assets/{oauth-callback-CmUOx9kN.js → oauth-callback-BeReH52R.js} +1 -1
- package/dist/client/assets/{page-CiHJqxqc.js → page-BL5oRGL8.js} +1 -1
- package/dist/client/assets/page-KDOuYuNd.js +1 -0
- package/dist/client/assets/{plugin-empty-state-ChCtFVu4.js → plugin-empty-state-DJs75tbR.js} +1 -1
- package/dist/client/assets/{plugin-header-DvSAgKvH.js → plugin-header-B9k5Jlo7.js} +1 -1
- package/dist/client/assets/{popover-BUw1D-k3.js → popover-CRq_6wOS.js} +1 -1
- package/dist/client/assets/{project-layout-DepNFK93.js → project-layout-BNYVyor9.js} +1 -1
- package/dist/client/assets/{project-settings-DXcKP6OZ.js → project-settings-BB9OYyku.js} +1 -1
- package/dist/client/assets/{projects-list-B7ZAgPRa.js → projects-list-tCSe-p9p.js} +1 -1
- package/dist/client/assets/{registry-utils-BHsSQAZM.js → registry-utils-BSsNDH8z.js} +1 -1
- package/dist/client/assets/{resizable-BgnJryiK.js → resizable-IICqdC0P.js} +1 -1
- package/dist/client/assets/{select-CqT-RHOd.js → select-f15wOonn.js} +1 -1
- package/dist/client/assets/{shell-layout-ds4suCjz.js → shell-layout-Du8t77ur.js} +4 -4
- package/dist/client/assets/{spinner-UdN4XMK9.js → spinner-DnPscNbk.js} +1 -1
- package/dist/client/assets/{store-invite-BEDmgi9S.js → store-invite-OC-5AI4v.js} +1 -1
- package/dist/client/assets/{switch-BNGnFJqx.js → switch-BIO6p3F2.js} +1 -1
- package/dist/client/assets/{table-C5twlOYa.js → table-BECdubXZ.js} +1 -1
- package/dist/client/assets/{tasks-Cp1sI4Vw.js → tasks-07lkw73y.js} +1 -1
- package/dist/client/assets/{textarea-CkIVemYH.js → textarea-Beyy6QRE.js} +1 -1
- package/dist/client/assets/{tools-list-Bx2rM27G.js → tools-list-B4uqUufu.js} +1 -1
- package/dist/client/assets/{topbar-portal-CkY8cVoH.js → topbar-portal-BkkURAkp.js} +1 -1
- package/dist/client/assets/{typewriter-title-C6Pd2n8m.js → typewriter-title-CXc5iNqe.js} +1 -1
- package/dist/client/assets/{use-binding-DPu07RT3.js → use-binding-jnlj8haE.js} +1 -1
- package/dist/client/assets/{use-connection-BMDdHvgl.js → use-connection-CdUUg5oM.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-Sw-q0DnQ.js → use-create-virtual-mcp-Brpfqy1S.js} +1 -1
- package/dist/client/assets/use-deco-chat-open-BIqIiDW-.js +23 -0
- package/dist/client/assets/{use-install-from-registry-DqBKCnsO.js → use-install-from-registry-zPimeqjE.js} +1 -1
- package/dist/client/assets/{use-list-state-C1QR4kf_.js → use-list-state-C8dJBLRY.js} +1 -1
- package/dist/client/assets/{use-llm-BboMgEwt.js → use-llm-AxlP2IMZ.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-CTqLi2Tn.js → use-mcp-prompts-B4-jhghr.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DkyQksFO.js → use-mcp-tools-CwSPwOy3.js} +1 -1
- package/dist/client/assets/{use-mobile-BKBuyZ1f.js → use-mobile-CZgmHxJy.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BRwXXMn8.js → use-organization-settings-7U_CYDtf.js} +1 -1
- package/dist/client/assets/{use-project-CLnw3Rsg.js → use-project-DHmrO9yE.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-0bAaSKwj.js → use-virtual-mcp-B_EKKbiX.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-DiBxunOm.js +1 -0
- package/dist/client/assets/{useMutation-CVJv5Jdm.js → useMutation-BZJqJibi.js} +1 -1
- package/dist/client/assets/useQuery-B0sG-lD7.js +1 -0
- package/dist/client/assets/utils-CDly9l2F.js +1 -0
- package/dist/client/assets/{view-mode-toggle-CiRRW4Qf.js → view-mode-toggle-DFlygBbR.js} +1 -1
- package/dist/client/assets/{workflow-DuF6auLD.js → workflow-CyeaW6pw.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +206 -260
- package/dist/server/migrate.js +149 -149
- package/dist/server/server.js +175 -229
- package/package.json +1 -1
- package/dist/client/assets/agent-detail-DPTr8Yf-.js +0 -1
- package/dist/client/assets/connection-detail-nbfuwO9R.js +0 -1
- package/dist/client/assets/constants-BWVCSHbT.js +0 -1
- package/dist/client/assets/index-BEdPWc-P.css +0 -1
- package/dist/client/assets/index-DkTwn_Zk.js +0 -1
- package/dist/client/assets/index-DoFuO1mJ.js +0 -25
- package/dist/client/assets/members-D1lMQYLf.js +0 -3
- package/dist/client/assets/page-DOMo_XpW.js +0 -1
- package/dist/client/assets/use-deco-chat-open-CJyBdqlw.js +0 -23
- package/dist/client/assets/useInfiniteQuery-BiwY1sxo.js +0 -1
- package/dist/client/assets/useQuery-CBE5-shC.js +0 -1
- package/dist/client/assets/utils-DYQC4wqD.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as i,a3 as C,al as y,am as T,an as I,ao as M,ap as H,aq as q,c as z}from"./index-
|
|
1
|
+
import{r as c,j as i,a3 as C,al as y,am as T,an as I,ao as M,ap as H,aq as q,c as z}from"./index-DyoRyDg0.js";import{c as g}from"./utils-CDly9l2F.js";var b="Switch",[A]=q(b),[U,L]=A(b),E=c.forwardRef((s,e)=>{const{__scopeSwitch:t,name:r,checked:a,defaultChecked:n,required:o,disabled:d,value:u="on",onCheckedChange:k,form:l,...w}=s,[p,h]=c.useState(null),v=y(e,m=>h(m)),x=c.useRef(!1),S=p?l||!!p.closest("form"):!0,[f,N]=T({prop:a,defaultProp:n??!1,onChange:k,caller:b});return i.jsxs(U,{scope:t,checked:f,disabled:d,children:[i.jsx(C.button,{type:"button",role:"switch","aria-checked":f,"aria-required":o,"data-state":j(f),"data-disabled":d?"":void 0,disabled:d,value:u,...w,ref:v,onClick:I(s.onClick,m=>{N(B=>!B),S&&(x.current=m.isPropagationStopped(),x.current||m.stopPropagation())})}),S&&i.jsx(_,{control:p,bubbles:!x.current,name:r,value:u,checked:f,required:o,disabled:d,form:l,style:{transform:"translateX(-100%)"}})]})});E.displayName=b;var P="SwitchThumb",R=c.forwardRef((s,e)=>{const{__scopeSwitch:t,...r}=s,a=L(P,t);return i.jsx(C.span,{"data-state":j(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});R.displayName=P;var O="SwitchBubbleInput",_=c.forwardRef(({__scopeSwitch:s,control:e,checked:t,bubbles:r=!0,...a},n)=>{const o=c.useRef(null),d=y(o,n),u=M(t),k=H(e);return c.useEffect(()=>{const l=o.current;if(!l)return;const w=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(w,"checked").set;if(u!==t&&h){const v=new Event("click",{bubbles:r});h.call(l,t),l.dispatchEvent(v)}},[u,t,r]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...a,tabIndex:-1,ref:d,style:{...a.style,...k,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});_.displayName=O;function j(s){return s?"checked":"unchecked"}var $=E,D=R;function X(s){const e=z.c(9);let t,r;e[0]!==s?({className:t,...r}=s,e[0]=s,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let a;e[3]!==t?(a=g("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),e[3]=t,e[4]=a):a=e[4];let n;e[5]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx(D,{"data-slot":"switch-thumb",className:g("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")}),e[5]=n):n=e[5];let o;return e[6]!==r||e[7]!==a?(o=i.jsx($,{"data-slot":"switch",className:a,...r,children:n}),e[6]=r,e[7]=a,e[8]=o):o=e[8],o}export{X as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as r,j as c}from"./index-
|
|
1
|
+
import{c as r,j as c}from"./index-DyoRyDg0.js";import{c as i}from"./utils-CDly9l2F.js";function b(o){const e=r.c(8);let t,l;e[0]!==o?({className:t,...l}=o,e[0]=o,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let s;e[3]!==t?(s=i("w-full caption-bottom text-sm min-w-0",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==l||e[6]!==s?(a=c.jsx("div",{"data-slot":"table-container",className:"w-full min-w-0 bg-background",children:c.jsx("table",{"data-slot":"table",className:s,...l})}),e[5]=l,e[6]=s,e[7]=a):a=e[7],a}function f(o){const e=r.c(8);let t,l;e[0]!==o?({className:t,...l}=o,e[0]=o,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let s;e[3]!==t?(s=i("[&_tr]:border-b sticky top-0 z-10 bg-background",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==l||e[6]!==s?(a=c.jsx("thead",{"data-slot":"table-header",className:s,...l}),e[5]=l,e[6]=s,e[7]=a):a=e[7],a}function p(o){const e=r.c(8);let t,l;e[0]!==o?({className:t,...l}=o,e[0]=o,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let s;e[3]!==t?(s=i("[&_tr:last-child]:border-0",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==l||e[6]!==s?(a=c.jsx("tbody",{"data-slot":"table-body",className:s,...l}),e[5]=l,e[6]=s,e[7]=a):a=e[7],a}function m(o){const e=r.c(8);let t,l;e[0]!==o?({className:t,...l}=o,e[0]=o,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let s;e[3]!==t?(s=i("data-[state=selected]:bg-muted border-b transition-colors",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==l||e[6]!==s?(a=c.jsx("tr",{"data-slot":"table-row",className:s,...l}),e[5]=l,e[6]=s,e[7]=a):a=e[7],a}function u(o){const e=r.c(8);let t,l;e[0]!==o?({className:t,...l}=o,e[0]=o,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let s;e[3]!==t?(s=i("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==l||e[6]!==s?(a=c.jsx("th",{"data-slot":"table-head",className:s,...l}),e[5]=l,e[6]=s,e[7]=a):a=e[7],a}function x(o){const e=r.c(8);let t,l;e[0]!==o?({className:t,...l}=o,e[0]=o,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let s;e[3]!==t?(s=i("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==l||e[6]!==s?(a=c.jsx("td",{"data-slot":"table-cell",className:s,...l}),e[5]=l,e[6]=s,e[7]=a):a=e[7],a}export{u as T,f as a,m as b,x as c,p as d,b as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as o,j as e}from"./index-
|
|
1
|
+
import{c as o,j as e}from"./index-DyoRyDg0.js";import{E as m}from"./empty-state-B1qLg3Wj.js";import{P as a}from"./index-NuPnrQEp.js";import{B as i,a as c,b as n,c as l}from"./breadcrumb-Ds3Lal_V.js";import{n as d}from"./CheckDone01-BFFxKfwE.js";import"./utils-CDly9l2F.js";import"./ChevronRight-YlJxRSER.js";function b(){const s=o.c(2);let r;s[0]===Symbol.for("react.memo_cache_sentinel")?(r=e.jsx(a.Header,{children:e.jsx(a.Header.Left,{children:e.jsx(i,{children:e.jsx(c,{children:e.jsx(n,{children:e.jsx(l,{children:"Tasks"})})})})})}),s[0]=r):r=s[0];let t;return s[1]===Symbol.for("react.memo_cache_sentinel")?(t=e.jsxs(a,{children:[r,e.jsx(a.Content,{className:"flex",children:e.jsx(m,{image:e.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-muted",children:e.jsx(d,{size:32,className:"text-muted-foreground"})}),title:"Tasks",description:"Manage agent tasks and track progress on project goals. Coming soon."})})]}),s[1]=t):t=s[1],t}export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as o,j as n}from"./index-
|
|
1
|
+
import{c as o,j as n}from"./index-DyoRyDg0.js";import{c as l}from"./utils-CDly9l2F.js";function u(s){const e=o.c(8);let r,i;e[0]!==s?({className:r,...i}=s,e[0]=s,e[1]=r,e[2]=i):(r=e[1],i=e[2]);let t;e[3]!==r?(t=l("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-xl border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",r),e[3]=r,e[4]=t):t=e[4];let a;return e[5]!==i||e[6]!==t?(a=n.jsx("textarea",{"data-slot":"textarea",className:t,...i}),e[5]=i,e[6]=t,e[7]=a):a=e[7],a}export{u as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as O,K as J,j as t,m as P,r as K,O as Q}from"./index-
|
|
1
|
+
import{c as O,K as J,j as t,m as P,r as K,O as Q}from"./index-DyoRyDg0.js";import{u as W}from"./useQuery-B0sG-lD7.js";import{i as Y}from"./File06-ZuO2Pzkt.js";import{i as X}from"./Loading01-Bnk-9-nZ.js";import{e as Z}from"./github-icon-Dp3wHhYE.js";import{a as ee,C as te}from"./collection-table-wrapper-CWAiVtOh.js";import{C as oe}from"./collection-search-B1sfCtHP.js";import{E as z}from"./empty-state-B1qLg3Wj.js";import{I as se}from"./integration-icon-BRZY1p3G.js";import{C as re}from"./card-Czo4WORA.js";import{V as ne}from"./layout-CiQVyOtU.js";function ie(o){return o.replace(/<a[^>]*class="[^"]*anchor[^"]*"[^>]*>.*?<\/a>/gi,"")}function le(o){return o.replace(/<a\s+([^>]*href="[^"]*"[^>]*)>/gi,(e,s)=>{let r=e;return s.includes("target=")?r=r.replace(/target="[^"]*"/gi,'target="_blank"'):r=r.replace(/>/,' target="_blank">'),s.includes("rel=")?r=r.replace(/rel="[^"]*"/gi,'rel="noopener noreferrer"'):r=r.replace(/>/,' rel="noopener noreferrer">'),r})}function ae(o){let e=ie(o);return e=le(e),e}async function ce(o,e){try{const s=await fetch(`https://api.github.com/repos/${o}/${e}/readme`,{headers:{Accept:"application/vnd.github.v3.html"}});if(!s.ok){if(s.status===404)return null;throw new Error(`Failed to fetch README: ${s.statusText}`)}const r=await s.text();return ae(r)}catch(s){return console.error("Error fetching README:",s),null}}function Ee(o){const e=O.c(18),{repository:s,html:r,isLoading:b,queryKey:p}=o;let a,u,f,h;e[0]!==r||e[1]!==p||e[2]!==s?(a=s?Z(s):null,u=!!a&&r===void 0,h=W,f=p??J.githubReadme(a?.owner,a?.repo),e[0]=r,e[1]=p,e[2]=s,e[3]=a,e[4]=u,e[5]=f,e[6]=h):(a=e[3],u=e[4],f=e[5],h=e[6]);let d;e[7]!==a?(d=async()=>a?ce(a.owner,a.repo):null,e[7]=a,e[8]=d):d=e[8];let g;e[9]!==u||e[10]!==f||e[11]!==d?(g={queryKey:f,queryFn:d,enabled:u,staleTime:36e5,gcTime:864e5},e[9]=u,e[10]=f,e[11]=d,e[12]=g):g=e[12];const{data:E,isLoading:l}=h(g),x=r??E;if(b??(u&&l)){let m;return e[13]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(X,{size:32,className:"animate-spin text-muted-foreground"})}),e[13]=m):m=e[13],m}if(!x){let m;return e[14]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-6",children:[t.jsx(Y,{size:48,className:"text-muted-foreground mb-4"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"README not found"}),t.jsx("p",{className:"text-muted-foreground max-w-md",children:"This repository doesn't have a README file, or it's not publicly accessible."})]}),e[14]=m):m=e[14],m}let j;e[15]===Symbol.for("react.memo_cache_sentinel")?(j={backgroundColor:"transparent"},e[15]=j):j=e[15];let n;return e[16]!==x?(n=t.jsx("div",{className:"p-5 markdown-body",style:j,dangerouslySetInnerHTML:{__html:x}}),e[16]=x,e[17]=n):n=e[17],n}function Te(o){const e=O.c(40),{tools:s,connectionId:r,org:b,onToolClick:p,showToolbar:a,emptyMessage:u,isLoading:f}=o,h=a===void 0?!0:a,d=u===void 0?"This connection doesn't have any tools yet.":u,g=f===void 0?!1:f,E=P(),[l,x]=K.useState(""),[y,j]=K.useState("table"),[n,m]=K.useState("name"),[c,V]=K.useState("asc");let R;e[0]!==c||e[1]!==n?(R=i=>{n===i?(V(pe),c==="desc"&&m(void 0)):(m(i),V("asc"))},e[0]=c,e[1]=n,e[2]=R):R=e[2];const N=R;let L;e[3]!==r||e[4]!==E||e[5]!==p||e[6]!==b?(L=i=>{p?p(i):r&&b&&E({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:b,project:Q,connectionId:r,collectionName:"tools",itemId:encodeURIComponent(i.name)}})},e[3]=r,e[4]=E,e[5]=p,e[6]=b,e[7]=L):L=e[7];const I=L;let k;if(e[8]!==l||e[9]!==c||e[10]!==n||e[11]!==s){const i=!s||s.length===0?[]:l.trim()?(()=>{const H=l.toLowerCase();return s.filter(_=>_.name.toLowerCase().includes(H)||_.description&&_.description.toLowerCase().includes(H))})():s;k=!n||!c?i:[...i].sort((H,_)=>{const U=H[n]||"",B=_[n]||"",G=String(U).localeCompare(String(B));return c==="asc"?G:-G}),e[8]=l,e[9]=c,e[10]=n,e[11]=s,e[12]=k}else k=e[12];const T=k;let M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=[{id:"name",header:"Name",render:fe,sortable:!0},{id:"description",header:"Description",render:ue,cellClassName:"flex-1",sortable:!0}],e[13]=M):M=e[13];const F=M;let $;e[14]===Symbol.for("react.memo_cache_sentinel")?($=F.filter(de).map(me),e[14]=$):$=e[14];const q=$;let v;e[15]!==N||e[16]!==h||e[17]!==c||e[18]!==n||e[19]!==y?(v=h&&t.jsx(ne,{children:t.jsx(te,{viewMode:y,onViewModeChange:j,sortKey:n,sortDirection:c,onSort:N,sortOptions:q})}),e[15]=N,e[16]=h,e[17]=c,e[18]=n,e[19]=y,e[20]=v):v=e[20];let D;e[21]===Symbol.for("react.memo_cache_sentinel")?(D=i=>{i.key==="Escape"&&(x(""),i.target.blur())},e[21]=D):D=e[21];let S;e[22]!==l?(S=t.jsx(oe,{value:l,onChange:x,placeholder:"Search tools...",onKeyDown:D}),e[22]=l,e[23]=S):S=e[23];let w;e[24]!==d||e[25]!==N||e[26]!==I||e[27]!==g||e[28]!==l||e[29]!==c||e[30]!==n||e[31]!==T||e[32]!==y?(w=y==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:T.length===0?t.jsx(z,{image:null,title:l?"No tools found":"No tools available",description:l?"Try adjusting your search terms":d}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:T.map(i=>t.jsx(re,{className:"cursor-pointer transition-colors",onClick:()=>I(i),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(se,{icon:null,name:i.name,size:"md",className:"shrink-0 shadow-sm"}),t.jsxs("div",{className:"flex flex-col gap-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:i.name}),t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:i.description||"No description"})]})]})},i.name))})}):t.jsx(ee,{columns:F,data:T,isLoading:g,sortKey:n,sortDirection:c,onSort:N,onRowClick:i=>I(i),emptyState:t.jsx(z,{image:null,title:l?"No tools found":"No tools available",description:l?"Try adjusting your search terms":d})}),e[24]=d,e[25]=N,e[26]=I,e[27]=g,e[28]=l,e[29]=c,e[30]=n,e[31]=T,e[32]=y,e[33]=w):w=e[33];let C;e[34]!==S||e[35]!==w?(C=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[S,w]}),e[34]=S,e[35]=w,e[36]=C):C=e[36];let A;return e[37]!==C||e[38]!==v?(A=t.jsxs(t.Fragment,{children:[v,C]}),e[37]=C,e[38]=v,e[39]=A):A=e[39],A}function me(o){return{id:o.id,label:typeof o.header=="string"?o.header:o.id}}function de(o){return o.sortable}function ue(o){return t.jsx("span",{className:"text-sm text-foreground",children:o.description||"—"})}function fe(o){return t.jsx("span",{className:"text-sm font-medium font-mono text-foreground",children:o.name})}function pe(o){return o==="asc"?"desc":o==="desc"?null:"asc"}export{Ee as R,Te as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,c as x,j as P}from"./index-
|
|
1
|
+
import{r as c,c as x,j as P}from"./index-DyoRyDg0.js";const C=c.createContext(null);function g(e){const t=x.c(3),{value:s,children:r}=e,l=s;let n;return t[0]!==r||t[1]!==l?(n=P.jsx(C.Provider,{value:l,children:r}),t[0]=r,t[1]=l,t[2]=n):n=t[2],n}function d(e){const t=c.useContext(C);if(!t)throw new Error("usePluginContext must be used within a PluginContextProvider");if(!t.connectionId||!t.connection||!t.toolCaller)throw new Error("usePluginContext requires a valid connection. Use { partial: true } in empty state components.");return t}const E=c.createContext(null);function h(e){const t=x.c(7),{children:s}=e,[r,l]=c.useState(null),[n,u]=c.useState(null),[i,a]=c.useState(null);let o;t[0]!==n||t[1]!==r||t[2]!==i?(o={leftEl:r,centerEl:n,rightEl:i,setLeftEl:l,setCenterEl:u,setRightEl:a},t[0]=n,t[1]=r,t[2]=i,t[3]=o):o=t[3];let f;return t[4]!==s||t[5]!==o?(f=P.jsx(E.Provider,{value:o,children:s}),t[4]=s,t[5]=o,t[6]=f):f=t[6],f}function v(){const e=x.c(10),t=c.useContext(E);let s;e[0]!==t?(s=o=>t?.setLeftEl(o),e[0]=t,e[1]=s):s=e[1];const r=s;let l;e[2]!==t?(l=o=>t?.setCenterEl(o),e[2]=t,e[3]=l):l=e[3];const n=l;let u;e[4]!==t?(u=o=>t?.setRightEl(o),e[4]=t,e[5]=u):u=e[5];const i=u;if(!t)return null;let a;return e[6]!==n||e[7]!==r||e[8]!==i?(a={leftRef:r,centerRef:n,rightRef:i},e[6]=n,e[7]=r,e[8]=i,e[9]=a):a=e[9],a}export{g as P,h as T,v as a,d as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as T,c as j,j as l,T as E,D as z,B as H,G as L,J as D,H as V,E as I}from"./index-
|
|
1
|
+
import{r as T,c as j,j as l,T as E,D as z,B as H,G as L,J as D,H as V,E as I}from"./index-DyoRyDg0.js";import{I as R}from"./input-BGIEfDaw.js";import{i as A}from"./X-CERPEbZp.js";import{c as b}from"./utils-CDly9l2F.js";import{i as M}from"./SearchMd-B2tl0hgr.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(z,{"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 G(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(E,{"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(G,{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-CdlFZNUo.js";import{ba as T,Q as O,o as t,s as e,bb as p,aj as l,bc as c,bd as R,be as U,bf as i,ak as x,bg as u,bh as g,bi as n,bj as b,bk as L,bl as B,bm as C}from"./index-BxdkA_ZL.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")}),Q=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")})]),Y=t({role:n("system"),content:e().describe("System message content"),providerOptions:f}),Z=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([Y,Z,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,Q])).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-Dm6uKx_q.js";import{b9 as T,Q as O,o as t,s as e,ba as p,aj as l,bb as c,bc as R,bd as U,be as i,ak 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-DyoRyDg0.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")}),Q=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")})]),Y=t({role:n("system"),content:e().describe("System message content"),providerOptions:f}),Z=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([Y,Z,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,Q])).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{n as P,c as w,z as Q,t as h,u as v}from"./index-
|
|
1
|
+
import{n as P,c as w,z as Q,t as h,u as v}from"./index-DyoRyDg0.js";import{u as F}from"./useMutation-BZJqJibi.js";import{K as x,a as q,u as U}from"./constants-DeSBGDil.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 z={structuredContent:{items:[]},isError:!1};function B(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}):z,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 R(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:j},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 j(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 B(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 R(n.id,"CONNECTIONS",e)}export{z as E,D as a,X as b,b as c,k as d,B as e,ee as f,te as g,Z as h,R as u};
|
package/dist/client/assets/{use-create-virtual-mcp-Sw-q0DnQ.js → use-create-virtual-mcp-Brpfqy1S.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-DyoRyDg0.js";import{a as v}from"./use-virtual-mcp-B_EKKbiX.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,bv as gs,bw as vs,M as ys,bf as B,s as b,bx as Qe,by as ua,bj as xs,bk as bs,be as _s,bg as U,ba as Re,aj as $e,o as k,bh as I,bi as ce,bz as Es,bA as O,ak as Is,b5 as Ss,c as j,u as Ce,K as Le,a as pa,z as It,t as St,j as d,g as ws,a$ as Ns,am as ma,a3 as ge,at as fa,av as ha,aq as ga,b8 as va,b7 as Ts,an as Je,b6 as Cs,al as As,b0 as Ms}from"./index-DyoRyDg0.js";import{u as wt,a as Nt,d as js}from"./constants-DeSBGDil.js";import{b as Rs}from"./use-virtual-mcp-B_EKKbiX.js";import{a as ks,u as Tt}from"./use-llm-AxlP2IMZ.js";import{u as Ps}from"./useQuery-B0sG-lD7.js";import{u as ke,L as et}from"./localstorage-keys-BVi4c9Wu.js";import{B as ya}from"./button-DyxB0Yk5.js";import{I as Os}from"./input-BGIEfDaw.js";import{P as Ds,a as $s,b as Ls}from"./popover-CRq_6wOS.js";import{S as Zs,a as Fs,b as zs,c as Us,d as Bs}from"./select-f15wOonn.js";import{c as ve}from"./utils-CDly9l2F.js";import{E as xa,i as Vs}from"./error-boundary-BWYaX2Wu.js";import{t as ht}from"./ChevronDown-DhDohZgY.js";import{i as qs}from"./File06-ZuO2Pzkt.js";import{c as Ws}from"./Grid01-Hl_fTaOZ.js";import{a as Hs}from"./Image01-UevfVWVa.js";import{s as Js}from"./RefreshCcw01-BjGY5EQM.js";import{i as ba}from"./SearchMd-B2tl0hgr.js";import{b as Ct,c as Gs,a as Ys,e as Qs}from"./use-connection-CdUUg5oM.js";import{u as Xs}from"./Code01-BALFVt_U.js";var Pe;(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})(Pe||(Pe={}));var Ut;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Ut||(Ut={}));Pe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Pe.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 Xe 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 Xe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Pe.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()}}Xe.create=t=>new Xe(t);var Bt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Bt||(Bt={}));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 Ks=({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"}));Ks.displayName="ArrowsRight";const _a=({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"}));_a.displayName="ChevronSelectorVertical";const Ea=({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"}));Ea.displayName="CurrencyDollar";const er=({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"}));er.displayName="Lightbulb02";const Ia=({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"}));Ia.displayName="LogOut04";const Sa=({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"}));Sa.displayName="Stars01";var wa="vercel.ai.error",tr=Symbol.for(wa),Vt,qt,se=class Na extends(qt=Error,Vt=tr,qt){constructor({name:e,message:a,cause:s}){super(a),this[Vt]=!0,this.name=e,this.cause=s}static isInstance(e){return Na.hasMarker(e,wa)}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 Ta(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var Ca="AI_InvalidArgumentError",Aa=`vercel.ai.error.${Ca}`,ar=Symbol.for(Aa),Wt,Ht,sr=class extends(Ht=se,Wt=ar,Ht){constructor({message:t,cause:e,argument:a}){super({name:Ca,message:t,cause:e}),this[Wt]=!0,this.argument=a}static isInstance(t){return se.hasMarker(t,Aa)}},Ma="AI_JSONParseError",ja=`vercel.ai.error.${Ma}`,rr=Symbol.for(ja),Jt,Gt,Yt=class extends(Gt=se,Jt=rr,Gt){constructor({text:t,cause:e}){super({name:Ma,message:`JSON parsing failed: Text: ${t}.
|
|
2
|
+
Error message: ${Ta(e)}`,cause:e}),this[Jt]=!0,this.text=t}static isInstance(t){return se.hasMarker(t,ja)}},Ra="AI_TypeValidationError",ka=`vercel.ai.error.${Ra}`,or=Symbol.for(ka),Qt,Xt,Te=class gt extends(Xt=se,Qt=or,Xt){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:Ra,message:`${r}: Value: ${JSON.stringify(e)}.
|
|
3
|
+
Error message: ${Ta(a)}`,cause:a}),this[Qt]=!0,this.value=e,this.context=s}static isInstance(e){return se.hasMarker(e,ka)}static wrap({value:e,cause:a,context:s}){var r,o,i;return gt.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 gt({value:e,cause:a,context:s})}},Ze=({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 sr({argument:"separator",message:`The separator "${s}" must not be part of the alphabet "${a}".`});return()=>`${t}${s}${r()}`},nr=Ze();function Kt(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 fe(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 ea(t,...e){const a=new Headers(fe(t)),s=a.get("user-agent")||"";return a.set("user-agent",[s,...e].filter(Boolean).join(" ")),Object.fromEntries(a.entries())}var ir=/"__proto__"\s*:/,lr=/"constructor"\s*:/;function ta(t){const e=JSON.parse(t);return e===null||typeof e!="object"||ir.test(t)===!1&&lr.test(t)===!1?e:cr(e)}function cr(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 dr(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return ta(t)}try{return ta(t)}finally{Error.stackTraceLimit=e}}function At(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]=me(a[s])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(me):me(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(me)),t.allOf!=null&&(t.allOf=t.allOf.map(me)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(me));const{definitions:e}=t;if(e!=null)for(const a of Object.keys(e))e[a]=me(e[a]);return t}function me(t){return typeof t=="boolean"?t:At(t)}var ur=Symbol("Let zodToJsonSchema decide on which parser to use"),aa={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"},pr=t=>typeof t=="string"?{...aa,name:t}:{...aa,...t};function V(){return{}}function mr(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=R(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 fr(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 hr(){return{type:"boolean"}}function Pa(t,e){return R(t.type._def,e)}var gr=(t,e)=>R(t.innerType._def,e);function Oa(t,e,a){const s=a??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,o)=>Oa(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 vr(t)}}var vr=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 yr(t,e){return{...R(t.innerType._def,e),default:t.defaultValue()}}function xr(t,e){return e.effectStrategy==="input"?R(t.schema._def,e):V()}function br(t){return{type:"string",enum:Array.from(t.values)}}var _r=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Er(t,e){const a=[R(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),R(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(r=>!!r),s=[];return a.forEach(r=>{if(_r(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 Ir(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 pt=void 0,Y={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:()=>(pt===void 0&&(pt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),pt),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 Da(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":Q(a,"email",s.message,e);break;case"format:idn-email":Q(a,"idn-email",s.message,e);break;case"pattern:zod":z(a,Y.email,s.message,e);break}break;case"url":Q(a,"uri",s.message,e);break;case"uuid":Q(a,"uuid",s.message,e);break;case"regex":z(a,s.regex,s.message,e);break;case"cuid":z(a,Y.cuid,s.message,e);break;case"cuid2":z(a,Y.cuid2,s.message,e);break;case"startsWith":z(a,RegExp(`^${mt(s.value,e)}`),s.message,e);break;case"endsWith":z(a,RegExp(`${mt(s.value,e)}$`),s.message,e);break;case"datetime":Q(a,"date-time",s.message,e);break;case"date":Q(a,"date",s.message,e);break;case"time":Q(a,"time",s.message,e);break;case"duration":Q(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":{z(a,RegExp(mt(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&Q(a,"ipv4",s.message,e),s.version!=="v4"&&Q(a,"ipv6",s.message,e);break}case"base64url":z(a,Y.base64url,s.message,e);break;case"jwt":z(a,Y.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&z(a,Y.ipv4Cidr,s.message,e),s.version!=="v4"&&z(a,Y.ipv6Cidr,s.message,e);break}case"emoji":z(a,Y.emoji(),s.message,e);break;case"ulid":{z(a,Y.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Q(a,"binary",s.message,e);break}case"contentEncoding:base64":{a.contentEncoding="base64";break}case"pattern:zod":{z(a,Y.base64,s.message,e);break}}break}case"nanoid":z(a,Y.nanoid,s.message,e)}return a}function mt(t,e){return e.patternStrategy==="escape"?wr(t):t}var Sr=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function wr(t){let e="";for(let a=0;a<t.length;a++)Sr.has(t[a])||(e+="\\"),e+=t[a];return e}function Q(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 z(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:sa(e,s),...a&&s.errorMessages&&{errorMessage:{pattern:a}}})):t.pattern=sa(e,s)}function sa(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 $a(t,e){var a,s,r,o,i,n;const c={type:"object",additionalProperties:(a=R(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,...u}=Da(t.keyType._def,e);return{...c,propertyNames:u}}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,...u}=Pa(t.keyType._def,e);return{...c,propertyNames:u}}}return c}function Nr(t,e){if(e.mapStrategy==="record")return $a(t,e);const a=R(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||V(),s=R(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 Tr(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 Cr(){return{not:V()}}function Ar(){return{type:"null"}}var vt={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Mr(t,e){const a=t.options instanceof Map?Array.from(t.options.values()):t.options;if(a.every(s=>s._def.typeName in vt&&(!s._def.checks||!s._def.checks.length))){const s=a.reduce((r,o)=>{const i=vt[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 jr(t,e)}var jr=(t,e)=>{const a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,r)=>R(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 Rr(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[vt[t.innerType._def.typeName],"null"]};const a=R(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function kr(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 Pr(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=Dr(n),l=R(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=Or(t,e);return o!==void 0&&(a.additionalProperties=o),a}function Or(t,e){if(t.catchall._def.typeName!=="ZodNever")return R(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 Dr(t){try{return t.isOptional()}catch{return!0}}var $r=(t,e)=>{var a;if(e.currentPath.toString()===((a=e.propertyPath)==null?void 0:a.toString()))return R(t.innerType._def,e);const s=R(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return s?{anyOf:[{not:V()},s]}:V()},Lr=(t,e)=>{if(e.pipeStrategy==="input")return R(t.in._def,e);if(e.pipeStrategy==="output")return R(t.out._def,e);const a=R(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=R(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,s].filter(r=>r!==void 0)}};function Zr(t,e){return R(t.type._def,e)}function Fr(t,e){const s={type:"array",uniqueItems:!0,items:R(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 zr(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((a,s)=>R(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[]),additionalItems:R(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((a,s)=>R(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[])}}function Ur(){return{not:V()}}function Br(){return V()}var Vr=(t,e)=>R(t.innerType._def,e),qr=(t,e,a)=>{switch(e){case w.ZodString:return Da(t,a);case w.ZodNumber:return kr(t);case w.ZodObject:return Pr(t,a);case w.ZodBigInt:return fr(t);case w.ZodBoolean:return hr();case w.ZodDate:return Oa(t,a);case w.ZodUndefined:return Ur();case w.ZodNull:return Ar();case w.ZodArray:return mr(t,a);case w.ZodUnion:case w.ZodDiscriminatedUnion:return Mr(t,a);case w.ZodIntersection:return Er(t,a);case w.ZodTuple:return zr(t,a);case w.ZodRecord:return $a(t,a);case w.ZodLiteral:return Ir(t);case w.ZodEnum:return br(t);case w.ZodNativeEnum:return Tr(t);case w.ZodNullable:return Rr(t,a);case w.ZodOptional:return $r(t,a);case w.ZodMap:return Nr(t,a);case w.ZodSet:return Fr(t,a);case w.ZodLazy:return()=>t.getter()._def;case w.ZodPromise:return Zr(t,a);case w.ZodNaN:case w.ZodNever:return Cr();case w.ZodEffects:return xr(t,a);case w.ZodAny:return V();case w.ZodUnknown:return Br();case w.ZodDefault:return yr(t,a);case w.ZodBranded:return Pa(t,a);case w.ZodReadonly:return Vr(t,a);case w.ZodCatch:return gr(t,a);case w.ZodPipeline:return Lr(t,a);case w.ZodFunction:case w.ZodVoid:case w.ZodSymbol:return;default:return(s=>{})()}},Wr=(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 R(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!==ur)return c}if(r&&!a){const c=Hr(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=qr(t,t.typeName,e),n=typeof i=="function"?R(i(),e):i;if(n&&Jr(t,e,n),e.postProcess){const c=e.postProcess(n,t,e);return o.jsonSchema=n,c}return o.jsonSchema=n,n}var Hr=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Wr(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}},Jr=(t,e,a)=>(t.description&&(a.description=t.description),a),Gr=t=>{const e=pr(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}]))}},Yr=(t,e)=>{var a;const s=Gr(e);let r=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[u,p])=>{var f;return{...l,[u]:(f=R(p._def,{...s,currentPath:[...s.basePath,s.definitionPath,u]},!0))!=null?f:V()}},{}):void 0;const o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=(a=R(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},yt=Symbol.for("vercel.ai.schema");function Qr(t){let e;return()=>(e==null&&(e=t()),e)}function tt(t,{validate:e}={}){return{[yt]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function Xr(t){return typeof t=="object"&&t!==null&&yt in t&&t[yt]===!0&&"jsonSchema"in t&&"validate"in t}function Mt(t){return t==null?tt({properties:{},additionalProperties:!1}):Xr(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?La(t):Kr(t):t()}function Kr(t){return tt(()=>At(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 Te({value:e,cause:a.issues})}}})}function eo(t,e){var a;const s=(a=void 0)!=null?a:!1;return tt(()=>Yr(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 to(t,e){var a;const s=(a=void 0)!=null?a:!1;return tt(()=>At(ys(t,{target:"draft-7",io:"input",reused:s?"ref":"inline"})),{validate:async r=>{const o=await vs(t,r);return o.success?{success:!0,value:o.data}:{success:!1,error:o.error}}})}function ao(t){return"_zod"in t}function La(t,e){return ao(t)?to(t):eo(t)}async function ra({value:t,schema:e,context:a}){const s=await Oe({value:t,schema:e,context:a});if(!s.success)throw Te.wrap({value:t,cause:s.error,context:a});return s.value}async function Oe({value:t,schema:e,context:a}){const s=Mt(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:Te.wrap({value:t,cause:r.error,context:a}),rawValue:t}}catch(r){return{success:!1,error:Te.wrap({value:t,cause:r,context:a}),rawValue:t}}}async function he({text:t,schema:e}){try{const a=dr(t);return e==null?{success:!0,value:a,rawValue:a}:await Oe({value:a,schema:e})}catch(a){return{success:!1,error:Yt.isInstance(a)?a:new Yt({text:t,cause:a}),rawValue:void 0}}}function so({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new gs).pipeThrough(new TransformStream({async transform({data:a},s){a!=="[DONE]"&&s.enqueue(await he({text:a,schema:e}))}}))}async function ue(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var ro=Object.defineProperty,oo=(t,e)=>{for(var a in e)ro(t,a,{get:e[a],enumerable:!0})},Za="AI_NoObjectGeneratedError",Fa=`vercel.ai.error.${Za}`,no=Symbol.for(Fa),za,pe=class extends se{constructor({message:t="No object generated.",cause:e,text:a,response:s,usage:r,finishReason:o}){super({name:Za,message:t,cause:e}),this[za]=!0,this.text=a,this.response=s,this.usage=r,this.finishReason=o}static isInstance(t){return se.hasMarker(t,Fa)}};za=no;var Ua="AI_UIMessageStreamError",Ba=`vercel.ai.error.${Ua}`,io=Symbol.for(Ba),Va,Se=class extends se{constructor({chunkType:t,chunkId:e,message:a}){super({name:Ua,message:a}),this[Va]=!0,this.chunkType=t,this.chunkId=e}static isInstance(t){return se.hasMarker(t,Ba)}};Va=io;var oa="6.0.81",qa=B([b(),Qe(Uint8Array),Qe(ArrayBuffer),ua(t=>{var e,a;return(a=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?a:!1},{message:"Must be a Buffer"})]),De=xs(()=>B([bs(),b(),_s(),U(),Re(b(),De.optional()),$e(De)])),A=Re(b(),Re(b(),De.optional())),Wa=k({type:I("text"),text:b(),providerOptions:A.optional()}),lo=k({type:I("image"),image:B([qa,Qe(URL)]),mediaType:b().optional(),providerOptions:A.optional()}),Ha=k({type:I("file"),data:B([qa,Qe(URL)]),filename:b().optional(),mediaType:b(),providerOptions:A.optional()}),co=k({type:I("reasoning"),text:b(),providerOptions:A.optional()}),uo=k({type:I("tool-call"),toolCallId:b(),toolName:b(),input:ce(),providerOptions:A.optional(),providerExecuted:U().optional()}),po=Es("type",[k({type:I("text"),value:b(),providerOptions:A.optional()}),k({type:I("json"),value:De,providerOptions:A.optional()}),k({type:I("execution-denied"),reason:b().optional(),providerOptions:A.optional()}),k({type:I("error-text"),value:b(),providerOptions:A.optional()}),k({type:I("error-json"),value:De,providerOptions:A.optional()}),k({type:I("content"),value:$e(B([k({type:I("text"),text:b(),providerOptions:A.optional()}),k({type:I("media"),data:b(),mediaType:b()}),k({type:I("file-data"),data:b(),mediaType:b(),filename:b().optional(),providerOptions:A.optional()}),k({type:I("file-url"),url:b(),providerOptions:A.optional()}),k({type:I("file-id"),fileId:B([b(),Re(b(),b())]),providerOptions:A.optional()}),k({type:I("image-data"),data:b(),mediaType:b(),providerOptions:A.optional()}),k({type:I("image-url"),url:b(),providerOptions:A.optional()}),k({type:I("image-file-id"),fileId:B([b(),Re(b(),b())]),providerOptions:A.optional()}),k({type:I("custom"),providerOptions:A.optional()})]))})]),Ja=k({type:I("tool-result"),toolCallId:b(),toolName:b(),output:po,providerOptions:A.optional()}),mo=k({type:I("tool-approval-request"),approvalId:b(),toolCallId:b()}),fo=k({type:I("tool-approval-response"),approvalId:b(),approved:U(),reason:b().optional()}),ho=k({role:I("system"),content:b(),providerOptions:A.optional()}),go=k({role:I("user"),content:B([b(),$e(B([Wa,lo,Ha]))]),providerOptions:A.optional()}),vo=k({role:I("assistant"),content:B([b(),$e(B([Wa,Ha,co,uo,Ja,mo]))]),providerOptions:A.optional()}),yo=k({role:I("tool"),content:$e(B([Ja,fo])),providerOptions:A.optional()});B([ho,go,vo,yo]);function Ga(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]=Ga(o,r):a[s]=r}return a}var xo={};oo(xo,{array:()=>Io,choice:()=>So,json:()=>wo,object:()=>Eo,text:()=>_o});function bo(t){const e=["ROOT"];let a=-1,s=null;function r(c,l,u){switch(c){case'"':{a=l,e.pop(),e.push(u),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{a=l,s=l,e.pop(),e.push(u),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(u),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(u),e.push("INSIDE_NUMBER");break}case"{":{a=l,e.pop(),e.push(u),e.push("INSIDE_OBJECT_START");break}case"[":{a=l,e.pop(),e.push(u),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 p=t.substring(s,c+1);!"false".startsWith(p)&&!"true".startsWith(p)&&!"null".startsWith(p)?(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 u=t.substring(s,t.length);"true".startsWith(u)?n+="true".slice(u.length):"false".startsWith(u)?n+="false".slice(u.length):"null".startsWith(u)&&(n+="null".slice(u.length))}}return n}async function Fe(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await he({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await he({text:bo(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var _o=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}},createElementStreamTransform(){}}),Eo=({schema:t,name:e,description:a})=>{const s=Mt(t);return{name:"object",responseFormat:ue(s.jsonSchema).then(r=>({type:"json",schema:r,...e!=null&&{name:e},...a!=null&&{description:a}})),async parseCompleteOutput({text:r},o){const i=await he({text:r});if(!i.success)throw new pe({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 Oe({value:i.value,schema:s});if(!n.success)throw new pe({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 Fe(r);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:o.value}}},createElementStreamTransform(){}}},Io=({element:t,name:e,description:a})=>{const s=Mt(t);return{name:"array",responseFormat:ue(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 he({text:r});if(!i.success)throw new pe({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 pe({message:"No object generated: response did not match schema.",cause:new Te({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 Oe({value:c,schema:s});if(!l.success)throw new pe({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 Fe(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 u=await Oe({value:l,schema:s});u.success&&c.push(u.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])}})}}},So=({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 he({text:s});if(!o.success)throw new pe({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 pe({message:"No object generated: response did not match schema.",cause:new Te({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 Fe(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(){}}),wo=({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 he({text:a});if(!r.success)throw new pe({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 Fe(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(){}});Ze({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 No=Qr(()=>La(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:U().optional(),providerMetadata:A.optional(),dynamic:U().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:ce(),providerExecuted:U().optional(),providerMetadata:A.optional(),dynamic:U().optional(),title:b().optional()}),O({type:I("tool-input-error"),toolCallId:b(),toolName:b(),input:ce(),providerExecuted:U().optional(),providerMetadata:A.optional(),dynamic:U().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:ce(),providerExecuted:U().optional(),dynamic:U().optional(),preliminary:U().optional()}),O({type:I("tool-output-error"),toolCallId:b(),errorText:b(),providerExecuted:U().optional(),dynamic:U().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:ua(t=>typeof t=="string"&&t.startsWith("data-"),{message:'Type must start with "data-"'}),id:b().optional(),data:ce(),transient:U().optional()}),O({type:I("start-step")}),O({type:I("finish-step")}),O({type:I("start"),messageId:b().optional(),messageMetadata:ce().optional()}),O({type:I("finish"),finishReason:Is(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:ce().optional()}),O({type:I("abort"),reason:b().optional()}),O({type:I("message-metadata"),messageMetadata:ce()})])));function To(t){return t.type.startsWith("data-")}function xt(t){return t.type.startsWith("tool-")}function Co(t){return t.type==="dynamic-tool"}function Ke(t){return xt(t)||Co(t)}function na(t){return t.type.split("-").slice(1).join("-")}function Ao({lastMessage:t,messageId:e}){return{message:t?.role==="assistant"?t:{id:e,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function Mo({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:u})=>{var p,f,v,y;function _(m){const C=l.message.parts.filter(Ke).find(N=>N.toolCallId===m);if(C==null)throw new Se({chunkType:"tool-invocation",chunkId:m,message:`No tool invocation found for tool call ID "${m}".`});return C}function g(m){var E;const C=l.message.parts.find(P=>xt(P)&&P.toolCallId===m.toolCallId),N=m,T=C;C!=null?(C.state=m.state,T.input=N.input,T.output=N.output,T.errorText=N.errorText,T.rawInput=N.rawInput,T.preliminary=N.preliminary,m.title!==void 0&&(T.title=m.title),T.providerExecuted=(E=N.providerExecuted)!=null?E:C.providerExecuted,N.providerMetadata!=null&&(C.callProviderMetadata=N.providerMetadata)):l.message.parts.push({type:`tool-${m.toolName}`,toolCallId:m.toolCallId,state:m.state,title:m.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 h(m){var E,C;const N=l.message.parts.find(L=>L.type==="dynamic-tool"&&L.toolCallId===m.toolCallId),T=m,P=N;N!=null?(N.state=m.state,P.toolName=m.toolName,P.input=T.input,P.output=T.output,P.errorText=T.errorText,P.rawInput=(E=T.rawInput)!=null?E:P.rawInput,P.preliminary=T.preliminary,m.title!==void 0&&(P.title=m.title),P.providerExecuted=(C=T.providerExecuted)!=null?C:N.providerExecuted,T.providerMetadata!=null&&(N.callProviderMetadata=T.providerMetadata)):l.message.parts.push({type:"dynamic-tool",toolName:m.toolName,toolCallId:m.toolCallId,state:m.state,input:T.input,output:T.output,errorText:T.errorText,preliminary:T.preliminary,providerExecuted:T.providerExecuted,title:m.title,...T.providerMetadata!=null?{callProviderMetadata:T.providerMetadata}:{}})}async function x(m){if(m!=null){const E=l.message.metadata!=null?Ga(l.message.metadata,m):m;e!=null&&await ra({value:E,schema:e,context:{field:"message.metadata",entityId:l.message.id}}),l.message.metadata=E}}switch(n.type){case"text-start":{const m={type:"text",text:"",providerMetadata:n.providerMetadata,state:"streaming"};l.activeTextParts[n.id]=m,l.message.parts.push(m),u();break}case"text-delta":{const m=l.activeTextParts[n.id];if(m==null)throw new Se({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.`});m.text+=n.delta,m.providerMetadata=(p=n.providerMetadata)!=null?p:m.providerMetadata,u();break}case"text-end":{const m=l.activeTextParts[n.id];if(m==null)throw new Se({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.`});m.state="done",m.providerMetadata=(f=n.providerMetadata)!=null?f:m.providerMetadata,delete l.activeTextParts[n.id],u();break}case"reasoning-start":{const m={type:"reasoning",text:"",providerMetadata:n.providerMetadata,state:"streaming"};l.activeReasoningParts[n.id]=m,l.message.parts.push(m),u();break}case"reasoning-delta":{const m=l.activeReasoningParts[n.id];if(m==null)throw new Se({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.`});m.text+=n.delta,m.providerMetadata=(v=n.providerMetadata)!=null?v:m.providerMetadata,u();break}case"reasoning-end":{const m=l.activeReasoningParts[n.id];if(m==null)throw new Se({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.`});m.providerMetadata=(y=n.providerMetadata)!=null?y:m.providerMetadata,m.state="done",delete l.activeReasoningParts[n.id],u();break}case"file":{l.message.parts.push({type:"file",mediaType:n.mediaType,url:n.url}),u();break}case"source-url":{l.message.parts.push({type:"source-url",sourceId:n.sourceId,url:n.url,title:n.title,providerMetadata:n.providerMetadata}),u();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}),u();break}case"tool-input-start":{const m=l.message.parts.filter(xt);l.partialToolCalls[n.toolCallId]={text:"",toolName:n.toolName,index:m.length,dynamic:n.dynamic,title:n.title},n.dynamic?h({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}),u();break}case"tool-input-delta":{const m=l.partialToolCalls[n.toolCallId];if(m==null)throw new Se({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.`});m.text+=n.inputTextDelta;const{value:E}=await Fe(m.text);m.dynamic?h({toolCallId:n.toolCallId,toolName:m.toolName,state:"input-streaming",input:E,title:m.title}):g({toolCallId:n.toolCallId,toolName:m.toolName,state:"input-streaming",input:E,title:m.title}),u();break}case"tool-input-available":{n.dynamic?h({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}),u(),o&&!n.providerExecuted&&await o({toolCall:n});break}case"tool-input-error":{n.dynamic?h({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}),u();break}case"tool-approval-request":{const m=_(n.toolCallId);m.state="approval-requested",m.approval={id:n.approvalId},u();break}case"tool-output-denied":{const m=_(n.toolCallId);m.state="output-denied",u();break}case"tool-output-available":{const m=_(n.toolCallId);m.type==="dynamic-tool"?h({toolCallId:n.toolCallId,toolName:m.toolName,state:"output-available",input:m.input,output:n.output,preliminary:n.preliminary,providerExecuted:n.providerExecuted,title:m.title}):g({toolCallId:n.toolCallId,toolName:na(m),state:"output-available",input:m.input,output:n.output,providerExecuted:n.providerExecuted,preliminary:n.preliminary,title:m.title}),u();break}case"tool-output-error":{const m=_(n.toolCallId);m.type==="dynamic-tool"?h({toolCallId:n.toolCallId,toolName:m.toolName,state:"output-error",input:m.input,errorText:n.errorText,providerExecuted:n.providerExecuted,title:m.title}):g({toolCallId:n.toolCallId,toolName:na(m),state:"output-error",input:m.input,rawInput:m.rawInput,errorText:n.errorText,providerExecuted:n.providerExecuted,title:m.title}),u();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)&&u();break}case"finish":{n.finishReason!=null&&(l.finishReason=n.finishReason),await x(n.messageMetadata),n.messageMetadata!=null&&u();break}case"message-metadata":{await x(n.messageMetadata),n.messageMetadata!=null&&u();break}case"error":{r?.(new Error(n.errorText));break}default:if(To(n)){if(a?.[n.type]!=null){const C=l.message.parts.findIndex(T=>"id"in T&&"data"in T&&T.id===n.id&&T.type===n.type),N=C>=0?C:l.message.parts.length;await ra({value:n.data,schema:a[n.type],context:{field:`message.parts[${N}].data`,entityName:n.type,entityId:n.id}})}const m=n;if(m.transient){i?.(m);break}const E=m.id!=null?l.message.parts.find(C=>m.type===C.type&&m.id===C.id):void 0;E!=null?E.data=m.data:l.message.parts.push(m),i?.(m),u()}}c.enqueue(n)})}}))}async function jo({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()}}Ze({prefix:"aitxt",size:24});Ze({prefix:"aiobj",size:24});var Ro=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()})}};Ze({prefix:"aiobj",size:24});async function ko(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 Po=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 ue(this.body),c=await ue(this.headers),l=await ue(this.credentials),u={...fe(c),...fe(e.headers)},p=await((a=this.prepareSendMessagesRequest)==null?void 0:a.call(this,{api:this.api,id:e.chatId,messages:e.messages,body:{...n,...e.body},headers:u,credentials:l,requestMetadata:e.metadata,trigger:e.trigger,messageId:e.messageId})),f=(s=p?.api)!=null?s:this.api,v=p?.headers!==void 0?fe(p.headers):u,y=p?.body!==void 0?p.body:{...n,...e.body,id:e.chatId,messages:e.messages,trigger:e.trigger,messageId:e.messageId},_=(r=p?.credentials)!=null?r:l,h=await((o=this.fetch)!=null?o:globalThis.fetch)(f,{method:"POST",headers:ea({"Content-Type":"application/json",...v},`ai-sdk/${oa}`,Kt()),body:JSON.stringify(y),credentials:_,signal:t});if(!h.ok)throw new Error((i=await h.text())!=null?i:"Failed to fetch the chat response.");if(!h.body)throw new Error("The response body is empty.");return this.processResponseStream(h.body)}async reconnectToStream(t){var e,a,s,r,o;const i=await ue(this.body),n=await ue(this.headers),c=await ue(this.credentials),l={...fe(n),...fe(t.headers)},u=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})),p=(a=u?.api)!=null?a:`${this.api}/${t.chatId}/stream`,f=u?.headers!==void 0?fe(u.headers):l,v=(s=u?.credentials)!=null?s:c,_=await((r=this.fetch)!=null?r:globalThis.fetch)(p,{method:"GET",headers:ea(f,`ai-sdk/${oa}`,Kt()),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)}},Ya=class extends Po{constructor(t={}){super(t)}processResponseStream(t){return so({stream:t,schema:No}).pipeThrough(new TransformStream({async transform(e,a){if(!e.success)throw e.error;a.enqueue(e.value)}}))}},Oo=class{constructor({generateId:t=nr,id:e=t(),transport:a=new Ya,messageMetadataSchema:s,dataPartSchemas:r,state:o,onError:i,onToolCall:n,onFinish:c,onData:l,sendAutomaticallyWhen:u}){this.activeResponse=void 0,this.jobExecutor=new Ro,this.sendMessage=async(p,f)=>{var v,y,_,g;if(p==null){await this.makeRequest({trigger:"submit-message",messageId:(v=this.lastMessage)==null?void 0:v.id,...f});return}let h;if("text"in p||"files"in p?h={parts:[...Array.isArray(p.files)?p.files:await ko(p.files),..."text"in p&&p.text!=null?[{type:"text",text:p.text}]:[]]}:h=p,p.messageId!=null){const x=this.state.messages.findIndex(m=>m.id===p.messageId);if(x===-1)throw new Error(`message with id ${p.messageId} not found`);if(this.state.messages[x].role!=="user")throw new Error(`message with id ${p.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,x+1),this.state.replaceMessage(x,{...h,id:p.messageId,role:(y=h.role)!=null?y:"user",metadata:p.metadata})}else this.state.pushMessage({...h,id:(_=h.id)!=null?_:this.generateId(),role:(g=h.role)!=null?g:"user",metadata:p.metadata});await this.makeRequest({trigger:"submit-message",messageId:p.messageId,...f})},this.regenerate=async({messageId:p,...f}={})=>{const v=p==null?this.state.messages.length-1:this.state.messages.findIndex(y=>y.id===p);if(v===-1)throw new Error(`message ${p} 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:p,...f})},this.resumeStream=async(p={})=>{await this.makeRequest({trigger:"resume-stream",...p})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:p,approved:f,reason:v})=>this.jobExecutor.run(async()=>{const y=this.state.messages,_=y[y.length-1],g=h=>Ke(h)&&h.state==="approval-requested"&&h.approval.id===p?{...h,state:"approval-responded",approval:{id:p,approved:f,reason:v}}:h;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(h=>{var x;h&&this.makeRequest({trigger:"submit-message",messageId:(x=this.lastMessage)==null?void 0:x.id})})}),this.addToolOutput=async({state:p="output-available",tool:f,toolCallId:v,output:y,errorText:_})=>this.jobExecutor.run(async()=>{const g=this.state.messages,h=g[g.length-1],x=m=>Ke(m)&&m.toolCallId===v?{...m,state:p,output:y,errorText:_}:m;this.state.replaceMessage(g.length-1,{...h,parts:h.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(m=>{var E;m&&this.makeRequest({trigger:"submit-message",messageId:(E=this.lastMessage)==null?void 0:E.id})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var p;this.status!=="streaming"&&this.status!=="submitted"||(p=this.activeResponse)!=null&&p.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=u}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,u=!1,p=!1;try{const f={state:Ao({lastMessage:this.state.snapshot(c),messageId:this.generateId()}),abortController:new AbortController};f.abortController.signal.addEventListener("abort",()=>{l=!0}),this.activeResponse=f;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:f.abortController.signal,metadata:e,headers:a,body:s,trigger:t,messageId:r});const y=_=>this.jobExecutor.run(()=>_({state:f.state,write:()=>{var g;this.setStatus({status:"streaming"}),f.state.message.id===((g=this.lastMessage)==null?void 0:g.id)?this.state.replaceMessage(this.state.messages.length-1,f.state.message):this.state.pushMessage(f.state.message)}}));await jo({stream:Mo({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(f){if(l||f.name==="AbortError")return l=!0,this.setStatus({status:"ready"}),null;p=!0,f instanceof TypeError&&(f.message.toLowerCase().includes("fetch")||f.message.toLowerCase().includes("network"))&&(u=!0),this.onError&&f instanceof Error&&this.onError(f),this.setStatus({status:"error",error:f})}finally{try{(i=this.onFinish)==null||i.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:l,isDisconnect:u,isError:p,finishReason:(o=this.activeResponse)==null?void 0:o.state.finishReason})}catch(f){console.error(f)}this.activeResponse=void 0}!p&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:(n=this.lastMessage)==null?void 0:n.id,metadata:e,headers:a,body:s})}};function Do({messages:t}){const e=t[t.length-1];if(!e||e.role!=="assistant")return!1;const a=e.parts.reduce((r,o,i)=>o.type==="step-start"?i:r,-1),s=e.parts.slice(a+1).filter(Ke).filter(r=>!r.providerExecuted);return s.length>0&&s.every(r=>r.state==="output-available"||r.state==="output-error")}var ft,ia;function $o(){if(ia)return ft;ia=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 ft=t,ft}var Lo=$o();const Zo=Ss(Lo);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)),ae=(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)},de=(t,e,a,s)=>(Qa(t,e,"write to private field"),e.set(t,a),a);function Fo(t,e){return e!=null?Zo(t,e):t}var H,Ge,Ye,Ae,Me,je,we,bt,_t,zo=class{constructor(t=[]){ae(this,H,void 0),ae(this,Ge,"ready"),ae(this,Ye,void 0),ae(this,Ae,new Set),ae(this,Me,new Set),ae(this,je,new Set),this.pushMessage=e=>{de(this,H,D(this,H).concat(e)),D(this,we).call(this)},this.popMessage=()=>{de(this,H,D(this,H).slice(0,-1)),D(this,we).call(this)},this.replaceMessage=(e,a)=>{de(this,H,[...D(this,H).slice(0,e),this.snapshot(a),...D(this,H).slice(e+1)]),D(this,we).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,a)=>{const s=a?Fo(e,a):e;return D(this,Ae).add(s),()=>{D(this,Ae).delete(s)}},this["~registerStatusCallback"]=e=>(D(this,Me).add(e),()=>{D(this,Me).delete(e)}),this["~registerErrorCallback"]=e=>(D(this,je).add(e),()=>{D(this,je).delete(e)}),ae(this,we,()=>{D(this,Ae).forEach(e=>e())}),ae(this,bt,()=>{D(this,Me).forEach(e=>e())}),ae(this,_t,()=>{D(this,je).forEach(e=>e())}),de(this,H,t)}get status(){return D(this,Ge)}set status(t){de(this,Ge,t),D(this,bt).call(this)}get error(){return D(this,Ye)}set error(t){de(this,Ye,t),D(this,_t).call(this)}get messages(){return D(this,H)}set messages(t){de(this,H,[...t]),D(this,we).call(this)}};H=new WeakMap;Ge=new WeakMap;Ye=new WeakMap;Ae=new WeakMap;Me=new WeakMap;je=new WeakMap;we=new WeakMap;bt=new WeakMap;_t=new WeakMap;var Ne,la=class extends Oo{constructor({messages:t,...e}){const a=new zo(t);super({...e,state:a}),ae(this,Ne,void 0),this["~registerMessagesCallback"]=(s,r)=>D(this,Ne)["~registerMessagesCallback"](s,r),this["~registerStatusCallback"]=s=>D(this,Ne)["~registerStatusCallback"](s),this["~registerErrorCallback"]=s=>D(this,Ne)["~registerErrorCallback"](s),de(this,Ne,a)}};Ne=new WeakMap;function Uo({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:f=>{var v,y;return(y=(v=s.current).onToolCall)==null?void 0:y.call(v,f)},onData:f=>{var v,y;return(y=(v=s.current).onData)==null?void 0:y.call(v,f)},onFinish:f=>{var v,y;return(y=(v=s.current).onFinish)==null?void 0:y.call(v,f)},onError:f=>{var v,y;return(y=(v=s.current).onError)==null?void 0:y.call(v,f)},sendAutomaticallyWhen:f=>{var v,y,_;return(_=(y=(v=s.current).sendAutomaticallyWhen)==null?void 0:y.call(v,f))!=null?_:!1}},o=S.useRef("chat"in a?a.chat:new la(r));("chat"in a&&a.chat!==o.current||"id"in a&&o.current.id!==a.id)&&(o.current="chat"in a?a.chat:new la(r));const n=S.useCallback(f=>o.current["~registerMessagesCallback"](f,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),u=S.useSyncExternalStore(o.current["~registerErrorCallback"],()=>o.current.error,()=>o.current.error),p=S.useCallback(f=>{typeof f=="function"&&(f=f(o.current.messages)),o.current.messages=f},[o]);return S.useEffect(()=>{e&&o.current.resumeStream()},[e,o]),{id:o.current.id,messages:c,setMessages:p,sendMessage:o.current.sendMessage,regenerate:o.current.regenerate,clearError:o.current.clearError,stop:o.current.stop,error:u,resumeStream:o.current.resumeStream,status:l,addToolResult:o.current.addToolOutput,addToolOutput:o.current.addToolOutput,addToolApprovalResponse:o.current.addToolApprovalResponse}}function jt(){const t=j.c(21),{locator:e,org:a}=Ce();let s;t[0]!==e?(s=Le.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}=Ps(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 u=l;let p;t[9]!==c||t[10]!==u?(p=(g,h)=>{if(c)return!0;const x=u[g];return x?x.includes("*")||x.includes(h):u["*"]?.includes("*")??!1},t[9]=c,t[10]=u,t[11]=p):p=t[11];const f=p;let v;t[12]!==c||t[13]!==u?(v=g=>{if(c)return!0;const h=u[g];if(h&&h.length>0)return!0;const x=u["*"];return x?x.length>0:!1},t[12]=c,t[13]=u,t[14]=v):v=t[14];const y=v;let _;return t[15]!==c||t[16]!==y||t[17]!==n||t[18]!==f||t[19]!==u?(_={allowAll:c,models:u,isLoading:n,isModelAllowed:f,hasConnectionModels:y},t[15]=c,t[16]=y,t[17]=n,t[18]=f,t[19]=u,t[20]=_):_=t[20],_}function Bo(t){const e=j.c(10);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[0]=a):a=e[0];const s=pa(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 Vo(){const t=j.c(5),e=It(),{org:a}=Ce();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},t[0]=s):s=t[0];const r=pa(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],u=r.connectionId;if(!u)return;e.invalidateQueries({queryKey:Le.collection(a.slug,u,l)});const p=l.toLowerCase().replace(/_/g," ");St.success(`${p} updated`)},t[1]=a,t[2]=r,t[3]=e,t[4]=o):o=t[4],o}function Z(t){const e=j.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=ve("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 qo=["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"],Et=new Map;qo.forEach((t,e)=>{Et.set(t,e)});function Rt(t){const e=j.c(3);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={pageSize:999},e[0]=a):a=e[0];const s=ks(t??void 0,a);let r;return e[1]!==s?(r=s.filter(Ho).sort(Wo),e[1]=s,e[2]=r):r=e[2],r}function Wo(t,e){const a=Et.get(t.id),s=Et.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 Ho(t){return t.limits?.contextWindow&&t.limits?.maxOutputTokens}const Jo={reasoning:{icon:d.jsx(Sa,{className:"size-4"}),label:"Reasoning"},"image-upload":{icon:d.jsx(Hs,{className:"size-4"}),label:"Can analyze images"},"file-upload":{icon:d.jsx(qs,{className:"size-4"}),label:"Can analyze files"},"web-search":{icon:d.jsx(ba,{className:"size-4"}),label:"Can search the web to answer questions"}};function Xa(t){const e=j.c(10),{capability:a}=t,s=Jo[a];let r,o;e[0]!==a||e[1]!==s?(r=s||{icon:null,label:a},o=r.label.split("-").map(Go).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 Go(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Yo(t){const e=j.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 h;e[4]!==a.title?(h=d.jsx("p",{className:"text-lg font-medium leading-7",children:a.title}),e[4]=a.title,e[5]=h):h=e[5];let x;e[6]!==g||e[7]!==h?(x=d.jsxs("div",{className:"flex items-center gap-3 py-2 px-0",children:[g,h]}),e[6]=g,e[7]=h,e[8]=x):x=e[8];let m;e[9]!==a.description?(m=a.description&&d.jsx("p",{className:"text-sm text-muted-foreground",children:a.description}),e[9]=a.description,e[10]=m):m=e[10];let E;return e[11]!==x||e[12]!==m?(E=d.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[x,m]}),e[11]=x,e[12]=m,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 h;e[16]!==a.costs?(h=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*1e6).toFixed(2)," / 1M"]})]}),e[16]=a.costs,e[17]=h):h=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*1e6).toFixed(2)," / 1M"]})]}),e[18]=a.costs,e[19]=x):x=e[19];let m;e[20]!==a.limits?(m=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]=m):m=e[21];let E;return e[22]!==g||e[23]!==h||e[24]!==x||e[25]!==m?(E=d.jsxs("div",{className:"flex flex-col gap-2.5 pt-3 pb-3 px-3 rounded-b-lg text-xs",children:[g,h,x,m]}),e[22]=g,e[23]=h,e[24]=x,e[25]=m,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(Qo)}),e[35]=a.capabilities,e[36]=l):l=e[36];let u;e[37]!==c||e[38]!==l?(u=d.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[c,l]}),e[37]=c,e[38]=l,e[39]=u):u=e[39];let p;e[40]!==a.limits?(p=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(Ws,{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]=p):p=e[41];let f;e[42]!==a.costs?(f=(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(Ea,{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*1e6).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*1e6).toFixed(2)," / 1M tokens (output)"]})]})]}),e[42]=a.costs,e[43]=f):f=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(Ia,{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]!==p||e[47]!==f||e[48]!==v?(y=d.jsxs("div",{className:"flex flex-col gap-4",children:[p,f,v]}),e[46]=p,e[47]=f,e[48]=v,e[49]=y):y=e[49];let _;return e[50]!==y||e[51]!==u?(_=d.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[u,y]}),e[50]=y,e[51]=u,e[52]=_):_=e[52],_}function Qo(t){return d.jsx(Xa,{capability:t},t)}function Xo(t){const e=j.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(Ko)}),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 Ko(t){return d.jsx(Xa,{capability:t},t)}function en(t){const e=j.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(Vs,{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(Js,{className:"size-3.5"}),e[4]=c):c=e[4];let l;e[5]!==s?(l=d.jsxs(ya,{variant:"outline",size:"sm",onClick:s,className:"gap-1.5",children:[c,"Retry"]}),e[5]=s,e[6]=l):l=e[6];let u;return e[7]!==n||e[8]!==l?(u=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]=u):u=e[9],u}function tn(){const t=j.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(an)}),t[0]=e):e=t[0],e}function an(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 sn(t){const e=j.c(20),{connectionId:a,allowAll:s,isModelAllowed:r,searchTerm:o,selectedModel:i,onModelSelect:n,onHover:c}=t,l=Rt(a??void 0);let u;e[0]!==l||e[1]!==s||e[2]!==a||e[3]!==r?(u=s?l:l.filter(g=>a&&r(a,g.id)),e[0]=l,e[1]=s,e[2]=a,e[3]=r,e[4]=u):u=e[4];const p=u;let f;e[5]!==p||e[6]!==o?(f=o.trim()?p.filter(g=>{const h=o.toLowerCase();return g.title.toLowerCase().includes(h)||g.provider?.toLowerCase().includes(h)||g.description?.toLowerCase().includes(h)}):p,e[5]=p,e[6]=o,e[7]=f):f=e[7];const v=f;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?.thinking){let g;e[14]!==c||e[15]!==n||e[16]!==i?.thinking?(g=h=>{const x=h.id===i?.thinking.id;return d.jsx("div",{onClick:()=>n(h),className:ve("rounded-lg mb-1",x&&"bg-accent"),children:d.jsx(Xo,{model:h,onHover:c})},h.id)},e[14]=c,e[15]=n,e[16]=i?.thinking,e[17]=g):g=e[17],y=v.map(g),e[9]=v,e[10]=c,e[11]=n,e[12]=i?.thinking,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 kt(t){const e=j.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 u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=d.jsx(ht,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[2]=u):u=e[2];let p;return e[3]!==l?(p=d.jsxs("div",{className:"flex items-center gap-1.5",children:[l,u]}),e[3]=l,e[4]=p):p=e[4],p}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(ht,{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 pi(t){return t?.thinking?.capabilities?.vision===!0}function rn(){const t=j.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(on)})]}),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 on(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 nn(t){const e=j.c(40),{selectedModel:a,onModelChange:s,onClose:r,modelsConnections:o}=t,[i,n]=S.useState(null),[c,l]=S.useState(""),u=S.useRef(null),[p,f]=S.useState(a?.connectionId??null),v=Tt(),y=o??v,{isModelAllowed:_,allowAll:g,hasConnectionModels:h}=jt();let x;e[0]!==y||e[1]!==g||e[2]!==h?(x=g?y:y.filter(q=>h(q.id)),e[0]=y,e[1]=g,e[2]=h,e[3]=x):x=e[3];const m=x;let E,C;e[4]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{setTimeout(()=>{u.current?.focus()},0)},C=[],e[4]=E,e[5]=C):(E=e[4],C=e[5]),S.useEffect(E,C);let N;e[6]===Symbol.for("react.memo_cache_sentinel")?(N=q=>{f(q),n(null)},e[6]=N):N=e[6];const T=N;let P;e[7]!==r||e[8]!==s||e[9]!==p?(P=q=>{p&&(s({id:q.id,connectionId:p,provider:q.provider??void 0}),l(""),r())},e[7]=r,e[8]=s,e[9]=p,e[10]=P):P=e[10];const L=P;let F;e[11]===Symbol.for("react.memo_cache_sentinel")?(F=d.jsx(ba,{size:16,className:"text-muted-foreground shrink-0"}),e[11]=F):F=e[11];let re;e[12]===Symbol.for("react.memo_cache_sentinel")?(re=q=>l(q.target.value),e[12]=re):re=e[12];let X;e[13]!==c?(X=d.jsx(Os,{ref:u,type:"text",placeholder:"Search for a model...",value:c,onChange:re,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]=X):X=e[14];let J;e[15]!==m||e[16]!==p?(J=m.length>0&&d.jsxs(Zs,{value:p??"",onValueChange:T,children:[d.jsxs(Fs,{size:"sm",className:"w-auto min-w-[140px] h-8 shrink-0 [&>svg:last-child]:hidden",onClick:dn,children:[d.jsx(zs,{placeholder:"Select connection"}),d.jsx(_a,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),d.jsx(Us,{children:m.map(cn)})]}),e[15]=m,e[16]=p,e[17]=J):J=e[17];let K;e[18]!==X||e[19]!==J?(K=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,X,J]})}),e[18]=X,e[19]=J,e[20]=K):K=e[20];let oe;e[21]===Symbol.for("react.memo_cache_sentinel")?(oe=d.jsx(tn,{}),e[21]=oe):oe=e[21];let ee;e[22]!==g||e[23]!==L||e[24]!==_||e[25]!==c||e[26]!==p||e[27]!==a?(ee=d.jsx(S.Suspense,{fallback:oe,children:d.jsx(sn,{connectionId:p,allowAll:g,isModelAllowed:_,searchTerm:c,selectedModel:a,onModelSelect:L,onHover:n})}),e[22]=g,e[23]=L,e[24]=_,e[25]=c,e[26]=p,e[27]=a,e[28]=ee):ee=e[28];let ie;e[29]!==p||e[30]!==ee?(ie=d.jsx(xa,{fallback:ln,children:ee},p),e[29]=p,e[30]=ee,e[31]=ie):ie=e[31];let G;e[32]!==K||e[33]!==ie?(G=d.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[400px] md:min-w-[400px]",children:[K,ie]}),e[32]=K,e[33]=ie,e[34]=G):G=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(Yo,{model:i})}),e[35]=i,e[36]=M):M=e[36];let le;return e[37]!==G||e[38]!==M?(le=d.jsxs("div",{className:"flex flex-col md:flex-row h-[350px]",children:[G,M]}),e[37]=G,e[38]=M,e[39]=le):le=e[39],le}function ln(t){const{error:e,resetError:a}=t;return d.jsx(en,{error:e,onRetry:a})}function cn(t){return d.jsx(Bs,{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 dn(t){return t.stopPropagation()}function un(t){const e=j.c(6),{selectedModel:a,placeholder:s}=t,r=a?.connectionId??void 0,o=Rt(r);let i;e[0]!==o||e[1]!==a?(i=a?o.find(l=>l.id===a.thinking.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(kt,{model:n,placeholder:s}),e[3]=n,e[4]=s,e[5]=c):c=e[5],c}function pn(t){const e=j.c(9),{selectedModel:a,placeholder:s}=t;if(!a){let u;return e[0]!==s?(u=d.jsx(kt,{model:void 0,placeholder:s}),e[0]=s,e[1]=u):u=e[1],u}const r=a.thinking.id;let o;e[2]!==r?(o=r.split("/").pop()??r,e[2]=r,e[3]=o):o=e[3];const i=o;let n;e[4]!==i?(n=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:i}),e[4]=i,e[5]=n):n=e[5];let c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=d.jsx(ht,{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]=c):c=e[6];let l;return e[7]!==n?(l=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:[n,c]}),e[7]=n,e[8]=l):l=e[8],l}function mi(t){const e=j.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,[u,p]=S.useState(!1),f=Tt(),v=r??f;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=ve("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 h;e[3]!==l||e[4]!==a?(h=d.jsx(pn,{selectedModel:a,placeholder:l}),e[3]=l,e[4]=a,e[5]=h):h=e[5];let x;e[6]!==l?(x=d.jsx(kt,{model:void 0,placeholder:l}),e[6]=l,e[7]=x):x=e[7];let m;e[8]!==l||e[9]!==a?(m=d.jsx(un,{selectedModel:a,placeholder:l}),e[8]=l,e[9]=a,e[10]=m):m=e[10];let E;e[11]!==x||e[12]!==m?(E=d.jsx(S.Suspense,{fallback:x,children:m}),e[11]=x,e[12]=m,e[13]=E):E=e[13];let C;e[14]!==h||e[15]!==E?(C=d.jsx(xa,{fallback:h,children:E}),e[14]=h,e[15]=E,e[16]=C):C=e[16];let N;e[17]!==C||e[18]!==y||e[19]!==g?(N=d.jsx(Ds,{asChild:!0,children:d.jsx(ya,{variant:y,size:"sm",className:g,children:C})}),e[17]=C,e[18]=y,e[19]=g,e[20]=N):N=e[20];let T;e[21]===Symbol.for("react.memo_cache_sentinel")?(T=d.jsx(rn,{}),e[21]=T):T=e[21];let P;e[22]===Symbol.for("react.memo_cache_sentinel")?(P=()=>p(!1),e[22]=P):P=e[22];let L;e[23]!==v||e[24]!==s||e[25]!==a?(L=d.jsx($s,{className:"w-full md:w-auto p-0",align:"start",side:"bottom",sideOffset:8,children:d.jsx(S.Suspense,{fallback:T,children:d.jsx(nn,{selectedModel:a,onModelChange:s,onClose:P,modelsConnections:v})})}),e[23]=v,e[24]=s,e[25]=a,e[26]=L):L=e[26];let F;return e[27]!==u||e[28]!==N||e[29]!==L?(F=d.jsxs(Ls,{open:u,onOpenChange:p,children:[N,L]}),e[27]=u,e[28]=N,e[29]=L,e[30]=F):F=e[30],F}function mn(){const t=j.c(2),e=It();let a;return t[0]!==e?(a={prefillCollectionCache:(r,o,i,n)=>{if(!r)return;const c=Ct(r,o,i,n);if(e.getQueryData(c))return;const u={structuredContent:{items:[]},isError:!1};e.setQueryData(c,u)}},t[0]=e,t[1]=a):a=t[1],a}const ne={THREAD_MESSAGES_PAGE_SIZE:100,THREADS_PAGE_SIZE:50,QUERY_STALE_TIME:3e4};function ca(t,e,a,s){const r=Le.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 u=[...c.items],p=u[l];if(!p)return c;const f={id:p.id,title:s.title??p.title,createdAt:p.createdAt,updatedAt:s.updatedAt??p.updatedAt,hidden:s.hidden??p.hidden};return u[l]=f,{...c,items:u}});i.some((c,l)=>c.items.length!==o.pages[l]?.items.length||c.items.some((u,p)=>u.id===a&&u!==o.pages[l]?.items[p]))&&t.setQueryData(r,{...o,pages:i})}function fn(t,e,a){const s=Le.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 hn(t,e,a,s){if(!e)return;const r=Ct(e,"THREAD_MESSAGES",a,{filters:[{column:"threadId",value:s}],pageSize:ne.THREAD_MESSAGES_PAGE_SIZE});if(!r||t.getQueryData(r))return;const i="COLLECTION_THREAD_MESSAGES_LIST",n=Gs(void 0,[{column:"threadId",value:s}],[]),c=Ys(void 0,void 0,"updated_at"),l={...n&&{where:n},...c&&{orderBy:c},limit:ne.THREAD_MESSAGES_PAGE_SIZE,offset:0};await t.fetchQuery({queryKey:r,queryFn:async()=>await e.callTool({name:i,arguments:l}),staleTime:ne.QUERY_STALE_TIME,retry:!1})}function gn(t,e,a,s,r){if(!e)return;const o=Ct(e,"THREAD_MESSAGES",a,{filters:[{column:"threadId",value:s}],pageSize:ne.THREAD_MESSAGES_PAGE_SIZE});o&&t.setQueryData(o,{structuredContent:{items:r},isError:!1})}async function vn(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 yn(t){const e=new Date().toISOString();return{id:t,title:"New chat",createdAt:e,updatedAt:e}}function xn(t,e){return t.find(a=>a.id!==e)??null}function bn(){const t=j.c(17),{locator:e,org:a}=Ce();let s;t[0]!==a.id?(s={connectionId:Nt,orgId:a.id},t[0]=a.id,t[1]=s):s=t[1];const r=wt(s);let o;t[2]!==e?(o=Le.threads(e),t[2]=e,t[3]=o):o=t[3];let i;t[4]!==r?(i=async g=>{const{pageParam:h}=g,x=h===void 0?0:h;if(!r)throw new Error("MCP client is not available");const m={limit:ne.THREADS_PAGE_SIZE,offset:x},E=await r.callTool({name:"COLLECTION_THREADS_LIST",arguments:m}),C=E.structuredContent??E;return{items:C.items??[],hasMore:C.hasMore??!1,totalCount:C.totalCount}},t[4]=r,t[5]=i):i=t[5];let n;t[6]!==o||t[7]!==i?(n={queryKey:o,queryFn:i,getNextPageParam:En,initialPageParam:0,staleTime:ne.QUERY_STALE_TIME},t[6]=o,t[7]=i,t[8]=n):n=t[8];const{data:c,fetchNextPage:l,hasNextPage:u,isFetchingNextPage:p,refetch:f}=Xs(n);let v;t[9]!==c?.pages?(v=c?.pages.flatMap(_n)??[],t[9]=c?.pages,t[10]=v):v=t[10];const y=v;let _;return t[11]!==l||t[12]!==u||t[13]!==p||t[14]!==f||t[15]!==y?(_={threads:y,refetch:f,hasNextPage:u,isFetchingNextPage:p,fetchNextPage:l},t[11]=l,t[12]=u,t[13]=p,t[14]=f,t[15]=y,t[16]=_):_=t[16],_}function _n(t){return t.items}function En(t,e){if(t.hasMore)return e.length*ne.THREADS_PAGE_SIZE}function In(t){const e=j.c(6),{org:a}=Ce();let s;e[0]!==a.id?(s={connectionId:Nt,orgId:a.id},e[0]=a.id,e[1]=s):s=e[1];const r=wt(s);let o;e[2]!==t?(o={filters:t?[{column:"threadId",value:t}]:[],pageSize:ne.THREAD_MESSAGES_PAGE_SIZE},e[2]=t,e[3]=o):o=e[3];const i=Qs(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 Sn(){const{locator:t,org:e}=Ce(),a=It(),{prefillCollectionCache:s}=mn(),{threads:r,hasNextPage:o,isFetchingNextPage:i,fetchNextPage:n}=bn(),c=wt({connectionId:Nt,orgId:e.id}),[l,u]=ke(et.assistantChatActiveThread(t),r[0]?.id??crypto.randomUUID()),p=In(l),f=()=>{const h=crypto.randomUUID(),x=yn(h);fn(a,t,x),c&&s(c,"THREAD_MESSAGES",e.id,{filters:[{column:"threadId",value:h}],pageSize:ne.THREAD_MESSAGES_PAGE_SIZE}),u(h)},v=async h=>{await hn(a,c,e.id,h),u(h)};return{threads:r,activeThreadId:l,messages:p,hasNextPage:o,isFetchingNextPage:i,fetchNextPage:n,createThread:f,switchThread:v,updateThread:(h,x)=>{ca(a,t,h,x)},hideThread:async h=>{try{const x=await vn(c,h,{hidden:!0});if(x){if(h===l){const E=xn(r,h);E?await v(E.id):f()}ca(a,t,h,{hidden:!0,updatedAt:x.updatedAt??new Date().toISOString()})}}catch(x){const m=x;St.error(`Failed to update thread: ${m.message}`),console.error("[chat] Failed to update thread:",x)}},updateMessagesCache:(h,x)=>{gn(a,c,e.id,h,x)}}}const wn=t=>new Ya({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),c=i?[i,...n]:n,l=e.at(-1)?.metadata??{},u={...o,agent:o.agent??l.agent,models:o.models??l.models,thread_id:o.thread_id??l.thread_id};return{body:{messages:c,...u}}}}),da=(t,e)=>t?.find(a=>a.id===e)??t?.[0]??null,Nn=(t,e)=>{const a=j.c(5);let s;a[0]!==t?(s=et.chatSelectedModel(t),a[0]=t,a[1]=s):s=a[1];const[r,o]=ke(s,null),{isModelAllowed:i,allowAll:n}=jt(),c=da(e,r?.connectionId),l=Rt(c?.id),u=n||!c?.id?l:l.filter(_=>i(c.id,_.id)),p=u.filter(kn).reduce(Pn,void 0),f=da(u,r?.id),v=f&&c?.id?{connectionId:c.id,thinking:{id:f.id,provider:f.provider??void 0,limits:f.limits??void 0,capabilities:f.capabilities?{vision:f.capabilities.includes("vision")?!0:void 0,text:f.capabilities.includes("text")?!0:void 0,tools:f.capabilities.includes("tools")?!0:void 0}:void 0},fast:p?{id:p.id,provider:p.provider??void 0,limits:p.limits??void 0,capabilities:p.capabilities?{vision:p.capabilities.includes("vision")?!0:void 0,text:p.capabilities.includes("text")?!0:void 0,tools:p.capabilities.includes("tools")?!0:void 0}:void 0}:void 0}:null;let y;return a[2]!==v||a[3]!==o?(y=[v,o],a[2]=v,a[3]=o,a[4]=y):y=a[4],y},Ka={tiptapDoc:void 0,parentThread:null,finishReason:null};function Tn(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 Ka;default:return t}}function Cn(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 An(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 Mn(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 jn(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(...Cn(n,i))}else{const n=r.attrs.metadata||r.attrs.prompts||[];e.push(...An(n,i))}}else if(r.type==="file"&&r.attrs){const o=r.attrs,i=`[file:://${encodeURIComponent(o.name)}]`;a+=i,e.push(...Mn(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 es=S.createContext(null);function fi(t){const e=j.c(84),{children:a}=t,{locator:s,org:r}=Ce(),o=Sn(),{data:i}=ws.useSession(),n=i?.user??null,[c,l]=S.useReducer(Tn,Ka),u=Rs(),[p,f]=ke(`${s}:selected-virtual-mcp-id`,null),v=Tt(),{hasConnectionModels:y}=jt();let _;if(e[0]!==v||e[1]!==y){let $;e[3]!==y?($=W=>y(W.id),e[3]=y,e[4]=$):$=e[4],_=v.filter($),e[0]=v,e[1]=y,e[2]=_}else _=e[2];const g=_,[h,x]=Nn(s,g);let m;e[5]!==s?(m=et.chatSelectedMode(s),e[5]=s,e[6]=m):m=e[6];const[E,C]=ke(m,"code_execution"),N=o.messages,T=Bo(p),P=Vo();let L;e[7]!==p||e[8]!==u?(L=p?u.find($=>$.id===p)??null:null,e[7]=p,e[8]=u,e[9]=L):L=e[9];const F=L;let re;e[10]!==r.id?(re=js(r.id),e[10]=r.id,e[11]=re):re=e[11];const X=re.id;let J;e[12]!==r.slug?(J=wn(r.slug),e[12]=r.slug,e[13]=J):J=e[13];const K=J;let oe;e[14]!==o?(oe=async $=>{const{finishReason:W,isAbort:Ie,isDisconnect:ct,isError:dt,message:fs,messages:hs}=$;if(l({type:"SET_FINISH_REASON",payload:W??null}),W!=="stop"||Ie||ct||dt)return;const{title:Ft,thread_id:ut,created_at:zt}=fs.metadata??{};!ut||!Ft||!zt||(o.updateMessagesCache(ut,hs),o.updateThread(ut,{title:Ft,updatedAt:new Date(zt).toISOString()}))},e[14]=o,e[15]=oe):oe=e[15];const ee=oe,ie=Rn;let G;e[16]!==N||e[17]!==ee||e[18]!==P||e[19]!==o.activeThreadId||e[20]!==K?(G={id:o.activeThreadId,messages:N,transport:K,sendAutomaticallyWhen:Do,onFinish:ee,onToolCall:P,onError:ie},e[16]=N,e[17]=ee,e[18]=P,e[19]=o.activeThreadId,e[20]=K,e[21]=G):G=e[21];const M=Uo(G),le=M.status==="submitted"||M.status==="streaming",q=M.messages.length===0;let ye,xe,be,te,_e,Ee;if(e[22]!==o){xe=()=>{te(),o.createThread()},Ee=o.switchThread,be=o.hideThread;let $;e[29]===Symbol.for("react.memo_cache_sentinel")?($=Ie=>l({type:"SET_TIPTAP_DOC",payload:Ie}),e[29]=$):$=e[29],_e=$;let W;e[30]===Symbol.for("react.memo_cache_sentinel")?(W=()=>l({type:"CLEAR_TIPTAP_DOC"}),e[30]=W):W=e[30],ye=W,te=()=>l({type:"RESET"}),e[22]=o,e[23]=ye,e[24]=xe,e[25]=be,e[26]=te,e[27]=_e,e[28]=Ee}else ye=e[23],xe=e[24],be=e[25],te=e[26],_e=e[27],Ee=e[28];let ze;e[31]!==f?(ze=$=>{f($)},e[31]=f,e[32]=ze):ze=e[32];const rt=ze;let Ue;e[33]!==x?(Ue=$=>{x({id:$.id,connectionId:$.connectionId})},e[33]=x,e[34]=Ue):Ue=e[34];const ot=Ue;let Be;e[35]!==M||e[36]!==T||e[37]!==X||e[38]!==te||e[39]!==E||e[40]!==h||e[41]!==F?.id||e[42]!==o.activeThreadId||e[43]!==n?.image||e[44]!==n?.name?(Be=async $=>{if(!h){St.error("No model configured");return}const W=jn($);if(W.length===0)return;te();const Ie={tiptapDoc:$,created_at:new Date().toISOString(),thread_id:o.activeThreadId,agent:{id:F?.id??X,mode:E},user:{avatar:n?.image??void 0,name:n?.name??"you"}},ct={...Ie,system:T,models:h},dt={id:crypto.randomUUID(),role:"user",parts:W,metadata:Ie};await M.sendMessage(dt,{metadata:ct})},e[35]=M,e[36]=T,e[37]=X,e[38]=te,e[39]=E,e[40]=h,e[41]=F?.id,e[42]=o.activeThreadId,e[43]=n?.image,e[44]=n?.name,e[45]=Be):Be=e[45];const nt=Be;let Ve;e[46]!==M?(Ve=()=>M.stop(),e[46]=M,e[47]=Ve):Ve=e[47];const it=Ve;let qe;e[48]===Symbol.for("react.memo_cache_sentinel")?(qe=()=>l({type:"CLEAR_FINISH_REASON"}),e[48]=qe):qe=e[48];const ms=qe;let We;e[49]!==M.addToolOutput||e[50]!==M.clearError||e[51]!==M.error||e[52]!==M.messages||e[53]!==M.setMessages||e[54]!==M.status||e[55]!==c.finishReason||e[56]!==c.tiptapDoc||e[57]!==ye||e[58]!==xe||e[59]!==be||e[60]!==q||e[61]!==le||e[62]!==g||e[63]!==te||e[64]!==E||e[65]!==h||e[66]!==F||e[67]!==nt||e[68]!==C||e[69]!==ot||e[70]!==_e||e[71]!==rt||e[72]!==it||e[73]!==Ee||e[74]!==o.activeThreadId||e[75]!==o.fetchNextPage||e[76]!==o.hasNextPage||e[77]!==o.isFetchingNextPage||e[78]!==o.threads||e[79]!==u?(We={tiptapDoc:c.tiptapDoc,setTiptapDoc:_e,clearTiptapDoc:ye,resetInteraction:te,activeThreadId:o.activeThreadId,threads:o.threads,createThread:xe,switchToThread:Ee,hideThread:be,hasNextPage:o.hasNextPage,isFetchingNextPage:o.isFetchingNextPage,fetchNextPage:o.fetchNextPage,virtualMcps:u,selectedVirtualMcp:F,setVirtualMcpId:rt,modelsConnections:g,selectedModel:h,setSelectedModel:ot,selectedMode:E,setSelectedMode:C,messages:M.messages,status:M.status,setMessages:M.setMessages,error:M.error,clearError:M.clearError,stop:it,addToolOutput:M.addToolOutput,sendMessage:nt,isStreaming:le,isChatEmpty:q,finishReason:c.finishReason,clearFinishReason:ms},e[49]=M.addToolOutput,e[50]=M.clearError,e[51]=M.error,e[52]=M.messages,e[53]=M.setMessages,e[54]=M.status,e[55]=c.finishReason,e[56]=c.tiptapDoc,e[57]=ye,e[58]=xe,e[59]=be,e[60]=q,e[61]=le,e[62]=g,e[63]=te,e[64]=E,e[65]=h,e[66]=F,e[67]=nt,e[68]=C,e[69]=ot,e[70]=_e,e[71]=rt,e[72]=it,e[73]=Ee,e[74]=o.activeThreadId,e[75]=o.fetchNextPage,e[76]=o.hasNextPage,e[77]=o.isFetchingNextPage,e[78]=o.threads,e[79]=u,e[80]=We):We=e[80];const lt=We;let He;return e[81]!==a||e[82]!==lt?(He=d.jsx(es.Provider,{value:lt,children:a}),e[81]=a,e[82]=lt,e[83]=He):He=e[83],He}function Rn(t){console.error("[chat] Error",t)}function hi(){const t=S.useContext(es);if(!t)throw new Error("useChat must be used within a ChatProvider");return t}function kn(t){return(t.costs?.input??0)+(t.costs?.output??0)>0}function Pn(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 at="Tabs",[On]=ga(at,[va]),ts=va(),[Dn,Pt]=On(at),as=S.forwardRef((t,e)=>{const{__scopeTabs:a,value:s,onValueChange:r,defaultValue:o,orientation:i="horizontal",dir:n,activationMode:c="automatic",...l}=t,u=Ns(n),[p,f]=ma({prop:s,onChange:r,defaultProp:o??"",caller:at});return d.jsx(Dn,{scope:a,baseId:fa(),value:p,onValueChange:f,orientation:i,dir:u,activationMode:c,children:d.jsx(ge.div,{dir:u,"data-orientation":i,...l,ref:e})})});as.displayName=at;var ss="TabsList",rs=S.forwardRef((t,e)=>{const{__scopeTabs:a,loop:s=!0,...r}=t,o=Pt(ss,a),i=ts(a);return d.jsx(Cs,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:s,children:d.jsx(ge.div,{role:"tablist","aria-orientation":o.orientation,...r,ref:e})})});rs.displayName=ss;var os="TabsTrigger",ns=S.forwardRef((t,e)=>{const{__scopeTabs:a,value:s,disabled:r=!1,...o}=t,i=Pt(os,a),n=ts(a),c=cs(i.baseId,s),l=ds(i.baseId,s),u=s===i.value;return d.jsx(Ts,{asChild:!0,...n,focusable:!r,active:u,children:d.jsx(ge.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":l,"data-state":u?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:c,...o,ref:e,onMouseDown:Je(t.onMouseDown,p=>{!r&&p.button===0&&p.ctrlKey===!1?i.onValueChange(s):p.preventDefault()}),onKeyDown:Je(t.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&i.onValueChange(s)}),onFocus:Je(t.onFocus,()=>{const p=i.activationMode!=="manual";!u&&!r&&p&&i.onValueChange(s)})})})});ns.displayName=os;var is="TabsContent",ls=S.forwardRef((t,e)=>{const{__scopeTabs:a,value:s,forceMount:r,children:o,...i}=t,n=Pt(is,a),c=cs(n.baseId,s),l=ds(n.baseId,s),u=s===n.value,p=S.useRef(u);return S.useEffect(()=>{const f=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(f)},[]),d.jsx(ha,{present:r||u,children:({present:f})=>d.jsx(ge.div,{"data-state":u?"active":"inactive","data-orientation":n.orientation,role:"tabpanel","aria-labelledby":c,hidden:!f,id:l,tabIndex:0,...i,ref:e,style:{...t.style,animationDuration:p.current?"0s":void 0},children:f&&o})})});ls.displayName=is;function cs(t,e){return`${t}-trigger-${e}`}function ds(t,e){return`${t}-content-${e}`}var $n=as,Ln=rs,Zn=ns,Fn=ls;function gi(t){const e=j.c(10);let a,s,r;e[0]!==t?({className:a,variant:r,...s}=t,e[0]=t,e[1]=a,e[2]=s,e[3]=r):(a=e[1],s=e[2],r=e[3]);const o=r===void 0?"pill":r;let i;e[4]!==a?(i=ve("flex flex-col gap-2",a),e[4]=a,e[5]=i):i=e[5];let n;return e[6]!==s||e[7]!==i||e[8]!==o?(n=d.jsx($n,{"data-slot":"tabs","data-variant":o,className:i,...s}),e[6]=s,e[7]=i,e[8]=o,e[9]=n):n=e[9],n}function vi(t){const e=j.c(11);let a,s,r;e[0]!==t?({className:a,variant:r,...s}=t,e[0]=t,e[1]=a,e[2]=s,e[3]=r):(a=e[1],s=e[2],r=e[3]);const o=r||"pill",i=o==="underline"?"flex h-[52px] items-center border-b border-border":o==="canvas"?"flex h-10 items-center bg-background relative":"bg-muted text-muted-foreground inline-flex h-10 w-fit items-center justify-center rounded-xl p-[3px]";let n;e[4]!==a||e[5]!==i?(n=ve(i,a),e[4]=a,e[5]=i,e[6]=n):n=e[6];let c;return e[7]!==o||e[8]!==s||e[9]!==n?(c=d.jsx(Ln,{"data-slot":"tabs-list","data-variant":o,className:n,...s}),e[7]=o,e[8]=s,e[9]=n,e[10]=c):c=e[10],c}function yi(t){const e=j.c(11);let a,s,r;e[0]!==t?({className:a,variant:r,...s}=t,e[0]=t,e[1]=a,e[2]=s,e[3]=r):(a=e[1],s=e[2],r=e[3]);const o=r||"pill",i=o==="underline"?"cursor-pointer flex items-center h-full px-3 relative text-sm whitespace-nowrap border-b-2 mb-[-1px] transition-all text-muted-foreground border-transparent hover:text-foreground data-[state=active]:text-foreground data-[state=active]:border-foreground disabled:pointer-events-none disabled:opacity-50":o==="canvas"?"cursor-pointer flex items-center h-full px-3 gap-2.5 text-sm whitespace-nowrap transition-all border-r border-b border-border [&>*]:opacity-50 data-[state=active]:[&>*]:opacity-100 data-[state=active]:border-b-0 last:border-r-0 disabled:pointer-events-none max-w-2xs":"data-[state=active]:bg-background dark:data-[state=active]:text-foreground cursor-pointer focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-lg border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4";let n;e[4]!==a||e[5]!==i?(n=ve(i,a),e[4]=a,e[5]=i,e[6]=n):n=e[6];let c;return e[7]!==o||e[8]!==s||e[9]!==n?(c=d.jsx(Zn,{"data-slot":"tabs-trigger","data-variant":o,className:n,...s}),e[7]=o,e[8]=s,e[9]=n,e[10]=c):c=e[10],c}function xi(t){const e=j.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=ve("flex-1 outline-none h-full",a),e[3]=a,e[4]=r):r=e[4];let o;return e[5]!==s||e[6]!==r?(o=d.jsx(Fn,{"data-slot":"tabs-content",className:r,...s}),e[5]=s,e[6]=r,e[7]=o):o=e[7],o}var st="Collapsible",[zn,bi]=ga(st),[Un,Ot]=zn(st),us=S.forwardRef((t,e)=>{const{__scopeCollapsible:a,open:s,defaultOpen:r,disabled:o,onOpenChange:i,...n}=t,[c,l]=ma({prop:s,defaultProp:r??!1,onChange:i,caller:st});return d.jsx(Un,{scope:a,disabled:o,contentId:fa(),open:c,onOpenToggle:S.useCallback(()=>l(u=>!u),[l]),children:d.jsx(ge.div,{"data-state":Zt(c),"data-disabled":o?"":void 0,...n,ref:e})})});us.displayName=st;var ps="CollapsibleTrigger",Dt=S.forwardRef((t,e)=>{const{__scopeCollapsible:a,...s}=t,r=Ot(ps,a);return d.jsx(ge.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":Zt(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...s,ref:e,onClick:Je(t.onClick,r.onOpenToggle)})});Dt.displayName=ps;var $t="CollapsibleContent",Lt=S.forwardRef((t,e)=>{const{forceMount:a,...s}=t,r=Ot($t,t.__scopeCollapsible);return d.jsx(ha,{present:a||r.open,children:({present:o})=>d.jsx(Bn,{...s,ref:e,present:o})})});Lt.displayName=$t;var Bn=S.forwardRef((t,e)=>{const{__scopeCollapsible:a,present:s,children:r,...o}=t,i=Ot($t,a),[n,c]=S.useState(s),l=S.useRef(null),u=As(e,l),p=S.useRef(0),f=p.current,v=S.useRef(0),y=v.current,_=i.open||n,g=S.useRef(_),h=S.useRef(void 0);return S.useEffect(()=>{const x=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(x)},[]),Ms(()=>{const x=l.current;if(x){h.current=h.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const m=x.getBoundingClientRect();p.current=m.height,v.current=m.width,g.current||(x.style.transitionDuration=h.current.transitionDuration,x.style.animationName=h.current.animationName),c(s)}},[i.open,s]),d.jsx(ge.div,{"data-state":Zt(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!_,...o,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...t.style},children:_&&r})});function Zt(t){return t?"open":"closed"}var Vn=us,_i=Dt,Ei=Lt;function Ii(t){const e=j.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(Vn,{"data-slot":"collapsible",...a}),e[2]=a,e[3]=s):s=e[3],s}function Si(t){const e=j.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(Dt,{"data-slot":"collapsible-trigger",...a}),e[2]=a,e[3]=s):s=e[3],s}function wi(t){const e=j.c(4);let a;e[0]!==t?({...a}=t,e[0]=t,e[1]=a):a=e[1];let s;return e[2]!==a?(s=d.jsx(Lt,{"data-slot":"collapsible-content",...a}),e[2]=a,e[3]=s):s=e[3],s}function Ni(){const t=j.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=et.decoChatOpen(),t[0]=e):e=t[0];const[a,s]=ke(e,qn);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 qn(t){return!!(t??!0)}export{Ii as C,mi as M,Vn as R,Z as S,yi as T,vi as a,xi as b,gi as c,er as d,Ni as e,Si as f,_a as g,wi as h,Ks as i,_i as j,Ei as k,bi as l,pi as m,fi as n,Sa as t,hi as u};
|